[8.11] [Dashboard] Fix flaky pluggable actions test (#167926) (#170766)

# Backport

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

<!--- 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-04T17:21:02Z","message":"[Dashboard]
Fix flaky pluggable actions test (#167926)\n\nCloses
https://github.com/elastic/kibana/issues/136460\r\n\r\n##
Summary\r\n\r\nSimilar to https://github.com/elastic/kibana/pull/167836,
navigation\r\nthrough `header.clickDashboard()` was flaky in the
attached test because\r\nthe same `data-test-subj` was re-used for both
the application-specific\r\ntop navigation **and** the reusable
application listing page
component:\r\n\r\n\r\n8b6ba3d15f/packages/content-management/table_list_view/src/table_list_view.tsx (L91-L96)\r\n\r\nThis
meant that, when the referenced flaky test tried to navigation
from\r\nthe Visualization listing page to the dashboard app
in\r\n`clearSavedObjectsFromAppLinks` via the header page
object's\r\n`clickDashboard` method, it wasn't actually waiting to
navigate to the\r\ndashboard app because it detected the `top-nav` data
test subject from\r\nthe **visualization** listing page **and not** from
the dashboard app.\r\n\r\nTherefore, instead of navigating through the
`header` method, I switched\r\nto the new `navigateToAppFromAppsMenu`,
which relies on the URL to\r\nupdate to ensure navigation has occured
rather than the `top-nav` data\r\ntest subject. I also added logic to
close the flyout as part of the test\r\ncleanup, since it was remaining
open even after navigating to the\r\nVisualizations listing page, which
was getting in the way of the failure\r\nscreenshot.\r\n\r\n\r\n###
Flaky Test Runner\r\n\r\n- Without closing of
flyout:\r\n628f0da9-1e2a-45a9-b58b-dab92e345118)\r\n\r\n-
With closing of
flyout:\r\nhttps://buildkite.com/elastic/kibana-flaky-test-suite-runner/builds/3336\r\n
\r\n\r\n![image](3456db1a-9cee-4db9-a28d-4c0d1520a5ec)\r\n\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### 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":"4d1bd84309567bef2e5937e8d72faaa182414183","branchLabelMapping":{"^v8.11.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":167926,"url":"https://github.com/elastic/kibana/pull/167926","mergeCommit":{"message":"[Dashboard]
Fix flaky pluggable actions test (#167926)\n\nCloses
https://github.com/elastic/kibana/issues/136460\r\n\r\n##
Summary\r\n\r\nSimilar to https://github.com/elastic/kibana/pull/167836,
navigation\r\nthrough `header.clickDashboard()` was flaky in the
attached test because\r\nthe same `data-test-subj` was re-used for both
the application-specific\r\ntop navigation **and** the reusable
application listing page
component:\r\n\r\n\r\n8b6ba3d15f/packages/content-management/table_list_view/src/table_list_view.tsx (L91-L96)\r\n\r\nThis
meant that, when the referenced flaky test tried to navigation
from\r\nthe Visualization listing page to the dashboard app
in\r\n`clearSavedObjectsFromAppLinks` via the header page
object's\r\n`clickDashboard` method, it wasn't actually waiting to
navigate to the\r\ndashboard app because it detected the `top-nav` data
test subject from\r\nthe **visualization** listing page **and not** from
the dashboard app.\r\n\r\nTherefore, instead of navigating through the
`header` method, I switched\r\nto the new `navigateToAppFromAppsMenu`,
which relies on the URL to\r\nupdate to ensure navigation has occured
rather than the `top-nav` data\r\ntest subject. I also added logic to
close the flyout as part of the test\r\ncleanup, since it was remaining
open even after navigating to the\r\nVisualizations listing page, which
was getting in the way of the failure\r\nscreenshot.\r\n\r\n\r\n###
Flaky Test Runner\r\n\r\n- Without closing of
flyout:\r\n628f0da9-1e2a-45a9-b58b-dab92e345118)\r\n\r\n-
With closing of
flyout:\r\nhttps://buildkite.com/elastic/kibana-flaky-test-suite-runner/builds/3336\r\n
\r\n\r\n![image](3456db1a-9cee-4db9-a28d-4c0d1520a5ec)\r\n\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### 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":"4d1bd84309567bef2e5937e8d72faaa182414183"}},"sourceBranch":"main","suggestedTargetBranches":[],"targetPullRequestStates":[{"branch":"main","label":"v8.11.0","labelRegex":"^v8.11.0$","isSourceBranch":true,"state":"MERGED","url":"https://github.com/elastic/kibana/pull/167926","number":167926,"mergeCommit":{"message":"[Dashboard]
Fix flaky pluggable actions test (#167926)\n\nCloses
https://github.com/elastic/kibana/issues/136460\r\n\r\n##
Summary\r\n\r\nSimilar to https://github.com/elastic/kibana/pull/167836,
navigation\r\nthrough `header.clickDashboard()` was flaky in the
attached test because\r\nthe same `data-test-subj` was re-used for both
the application-specific\r\ntop navigation **and** the reusable
application listing page
component:\r\n\r\n\r\n8b6ba3d15f/packages/content-management/table_list_view/src/table_list_view.tsx (L91-L96)\r\n\r\nThis
meant that, when the referenced flaky test tried to navigation
from\r\nthe Visualization listing page to the dashboard app
in\r\n`clearSavedObjectsFromAppLinks` via the header page
object's\r\n`clickDashboard` method, it wasn't actually waiting to
navigate to the\r\ndashboard app because it detected the `top-nav` data
test subject from\r\nthe **visualization** listing page **and not** from
the dashboard app.\r\n\r\nTherefore, instead of navigating through the
`header` method, I switched\r\nto the new `navigateToAppFromAppsMenu`,
which relies on the URL to\r\nupdate to ensure navigation has occured
rather than the `top-nav` data\r\ntest subject. I also added logic to
close the flyout as part of the test\r\ncleanup, since it was remaining
open even after navigating to the\r\nVisualizations listing page, which
was getting in the way of the failure\r\nscreenshot.\r\n\r\n\r\n###
Flaky Test Runner\r\n\r\n- Without closing of
flyout:\r\n628f0da9-1e2a-45a9-b58b-dab92e345118)\r\n\r\n-
With closing of
flyout:\r\nhttps://buildkite.com/elastic/kibana-flaky-test-suite-runner/builds/3336\r\n
\r\n\r\n![image](3456db1a-9cee-4db9-a28d-4c0d1520a5ec)\r\n\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### 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":"4d1bd84309567bef2e5937e8d72faaa182414183"}},{"branch":"8.12","label":"v8.12.0","labelRegex":"^v(\\d+).(\\d+).\\d+$","isSourceBranch":false,"state":"NOT_CREATED"}]}]
BACKPORT-->

Co-authored-by: Hannah Mudge <Heenawter@users.noreply.github.com>
This commit is contained in:
Kibana Machine 2023-11-07 12:28:21 -05:00 committed by GitHub
parent 75b81029bc
commit d550227582
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 9 additions and 1 deletions

View file

@ -425,7 +425,7 @@ export class DashboardPageObject extends FtrService {
public async clearSavedObjectsFromAppLinks() {
await this.header.clickVisualize();
await this.visualize.gotoLandingPage();
await this.header.clickDashboard();
await this.navigateToAppFromAppsMenu();
await this.gotoDashboardLandingPage();
}

View file

@ -10,6 +10,7 @@ import expect from '@kbn/expect';
export default function ({ getService, getPageObjects }) {
const dashboardPanelActions = getService('dashboardPanelActions');
const retry = getService('retry');
const testSubjects = getService('testSubjects');
const PageObjects = getPageObjects(['dashboard']);
@ -44,5 +45,12 @@ export default function ({ getService, getPageObjects }) {
await testSubjects.existOrFail('samplePanelActionTitle');
await testSubjects.existOrFail('samplePanelActionBody');
});
after(async () => {
await retry.try(async () => {
await testSubjects.click('euiFlyoutCloseButton');
await testSubjects.missingOrFail('samplePanelActionFlyout');
});
});
});
}