[8.11] [Controls] Fix flaky a11y test (#169559) (#170771)

# Backport

This will backport the following commits from `main` to `8.11`:
- [[Controls] Fix flaky `a11y` test
(#169559)](https://github.com/elastic/kibana/pull/169559)

<!--- Backport version: 8.9.7 -->

### Questions ?
Please refer to the [Backport tool
documentation](https://github.com/sqren/backport)

<!--BACKPORT [{"author":{"name":"Hannah
Mudge","email":"Heenawter@users.noreply.github.com"},"sourceCommit":{"committedDate":"2023-10-24T15:48:16Z","message":"[Controls]
Fix flaky `a11y` test (#169559)\n\nCloses
https://github.com/elastic/kibana/issues/169542\r\n\r\n##
Summary\r\n\r\nFor some reason, the search session popover was being
opened, which\r\nblocked the controls button from being
clickable:\r\n\r\n\r\n![image](6882e67e-6f17-4820-8e71-14e84c3d04c2)\r\n\r\nI'm
unsure why this popover is open to begin with; this should
**only**\r\nhappen when the `searchSessionIndicator` button is clicked,
but this\r\nbutton is **not** interacted with in **any** of the
accessibility tests\r\n(that I could find). This makes me suspicious
that this is actually a\r\n**misclick** - i.e. the element that was
meant to be clicked gets moved\r\n(possibly the Dashboard \"edit\"
button?), which causes the\r\n`searchSessionIndicator` button to be
clicked instead.\r\n\r\nGoing off this theory, I've switched the
controls `a11y` tests to use\r\nthe Dashboard page's methods (which have
more safeguards in place) to\r\nnavigate to the desired dashboard rather
than clicking elements solely\r\nbased off of the `data-test-subj` like
we were previously.\r\n\r\n### [Flaky
Test\r\nRunner](74fb0d27-9cb2-4650-ba91-97865a3bd962)\r\n\r\n###
Checklist\r\n\r\n- [x] [Unit or
functional\r\ntests](https://www.elastic.co/guide/en/kibana/master/development-tests.html)\r\nwere
updated or added to match the most common scenarios\r\n\r\n\r\n### For
maintainers\r\n\r\n- [ ] This was checked for breaking API changes and
was
[labeled\r\nappropriately](https://www.elastic.co/guide/en/kibana/master/contributing.html#kibana-release-notes-process)","sha":"ad932ec5d5c71c33f11cdf29dd5faa10123e1ca9","branchLabelMapping":{"^v8.12.0$":"main","^v(\\d+).(\\d+).\\d+$":"$1.$2"}},"sourcePullRequest":{"labels":["Team:Presentation","loe:small","release_note:skip","impact:critical","backport:prev-minor","v8.11.0","v8.12.0"],"number":169559,"url":"https://github.com/elastic/kibana/pull/169559","mergeCommit":{"message":"[Controls]
Fix flaky `a11y` test (#169559)\n\nCloses
https://github.com/elastic/kibana/issues/169542\r\n\r\n##
Summary\r\n\r\nFor some reason, the search session popover was being
opened, which\r\nblocked the controls button from being
clickable:\r\n\r\n\r\n![image](6882e67e-6f17-4820-8e71-14e84c3d04c2)\r\n\r\nI'm
unsure why this popover is open to begin with; this should
**only**\r\nhappen when the `searchSessionIndicator` button is clicked,
but this\r\nbutton is **not** interacted with in **any** of the
accessibility tests\r\n(that I could find). This makes me suspicious
that this is actually a\r\n**misclick** - i.e. the element that was
meant to be clicked gets moved\r\n(possibly the Dashboard \"edit\"
button?), which causes the\r\n`searchSessionIndicator` button to be
clicked instead.\r\n\r\nGoing off this theory, I've switched the
controls `a11y` tests to use\r\nthe Dashboard page's methods (which have
more safeguards in place) to\r\nnavigate to the desired dashboard rather
than clicking elements solely\r\nbased off of the `data-test-subj` like
we were previously.\r\n\r\n### [Flaky
Test\r\nRunner](74fb0d27-9cb2-4650-ba91-97865a3bd962)\r\n\r\n###
Checklist\r\n\r\n- [x] [Unit or
functional\r\ntests](https://www.elastic.co/guide/en/kibana/master/development-tests.html)\r\nwere
updated or added to match the most common scenarios\r\n\r\n\r\n### For
maintainers\r\n\r\n- [ ] This was checked for breaking API changes and
was
[labeled\r\nappropriately](https://www.elastic.co/guide/en/kibana/master/contributing.html#kibana-release-notes-process)","sha":"ad932ec5d5c71c33f11cdf29dd5faa10123e1ca9"}},"sourceBranch":"main","suggestedTargetBranches":["8.11"],"targetPullRequestStates":[{"branch":"8.11","label":"v8.11.0","labelRegex":"^v(\\d+).(\\d+).\\d+$","isSourceBranch":false,"state":"NOT_CREATED"},{"branch":"main","label":"v8.12.0","labelRegex":"^v8.12.0$","isSourceBranch":true,"state":"MERGED","url":"https://github.com/elastic/kibana/pull/169559","number":169559,"mergeCommit":{"message":"[Controls]
Fix flaky `a11y` test (#169559)\n\nCloses
https://github.com/elastic/kibana/issues/169542\r\n\r\n##
Summary\r\n\r\nFor some reason, the search session popover was being
opened, which\r\nblocked the controls button from being
clickable:\r\n\r\n\r\n![image](6882e67e-6f17-4820-8e71-14e84c3d04c2)\r\n\r\nI'm
unsure why this popover is open to begin with; this should
**only**\r\nhappen when the `searchSessionIndicator` button is clicked,
but this\r\nbutton is **not** interacted with in **any** of the
accessibility tests\r\n(that I could find). This makes me suspicious
that this is actually a\r\n**misclick** - i.e. the element that was
meant to be clicked gets moved\r\n(possibly the Dashboard \"edit\"
button?), which causes the\r\n`searchSessionIndicator` button to be
clicked instead.\r\n\r\nGoing off this theory, I've switched the
controls `a11y` tests to use\r\nthe Dashboard page's methods (which have
more safeguards in place) to\r\nnavigate to the desired dashboard rather
than clicking elements solely\r\nbased off of the `data-test-subj` like
we were previously.\r\n\r\n### [Flaky
Test\r\nRunner](74fb0d27-9cb2-4650-ba91-97865a3bd962)\r\n\r\n###
Checklist\r\n\r\n- [x] [Unit or
functional\r\ntests](https://www.elastic.co/guide/en/kibana/master/development-tests.html)\r\nwere
updated or added to match the most common scenarios\r\n\r\n\r\n### For
maintainers\r\n\r\n- [ ] This was checked for breaking API changes and
was
[labeled\r\nappropriately](https://www.elastic.co/guide/en/kibana/master/contributing.html#kibana-release-notes-process)","sha":"ad932ec5d5c71c33f11cdf29dd5faa10123e1ca9"}}]}]
BACKPORT-->

Co-authored-by: Hannah Mudge <Heenawter@users.noreply.github.com>
This commit is contained in:
Kibana Machine 2023-11-07 12:35:41 -05:00 committed by GitHub
parent d550227582
commit b372e86e91
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -23,8 +23,8 @@ export default function ({ getService, getPageObjects }: FtrProviderContext) {
});
await PageObjects.home.addSampleDataSet('flights');
await PageObjects.common.navigateToApp('dashboard');
await testSubjects.click('dashboardListingTitleLink-[Flights]-Global-Flight-Dashboard');
await testSubjects.click('dashboardEditMode');
await PageObjects.dashboard.loadSavedDashboard('[Flights] Global Flight Dashboard');
await PageObjects.dashboard.switchToEditMode();
});
after(async () => {