Skip to content

Commit

Permalink
[Dashboard] Fix flaky pluggable actions test (elastic#167926)
Browse files Browse the repository at this point in the history
Closes elastic#136460

## Summary

Similar to elastic#167836, navigation
through `header.clickDashboard()` was flaky in the attached test because
the same `data-test-subj` was re-used for both the application-specific
top navigation **and** the reusable application listing page component:


https://github.com/elastic/kibana/blob/8b6ba3d15ff18de07d32ab2302bf9e18844ce25c/src/plugins/navigation/public/top_nav_menu/top_nav_menu.tsx#L120-L124


https://github.com/elastic/kibana/blob/8b6ba3d15ff18de07d32ab2302bf9e18844ce25c/packages/content-management/table_list_view/src/table_list_view.tsx#L91-L96

This meant that, when the referenced flaky test tried to navigation from
the Visualization listing page to the dashboard app in
`clearSavedObjectsFromAppLinks` via the header page object's
`clickDashboard` method, it wasn't actually waiting to navigate to the
dashboard app because it detected the `top-nav` data test subject from
the **visualization** listing page **and not** from the dashboard app.

Therefore, instead of navigating through the `header` method, I switched
to the new `navigateToAppFromAppsMenu`, which relies on the URL to
update to ensure navigation has occured rather than the `top-nav` data
test subject. I also added logic to close the flyout as part of the test
cleanup, since it was remaining open even after navigating to the
Visualizations listing page, which was getting in the way of the failure
screenshot.


### Flaky Test Runner

- Without closing of flyout:
https://buildkite.com/elastic/kibana-flaky-test-suite-runner/builds/3323


![image](https://github.com/elastic/kibana/assets/8698078/628f0da9-1e2a-45a9-b58b-dab92e345118)

- With closing of flyout:
https://buildkite.com/elastic/kibana-flaky-test-suite-runner/builds/3336
    

![image](https://github.com/elastic/kibana/assets/8698078/3456db1a-9cee-4db9-a28d-4c0d1520a5ec)


### Checklist

- [x] [Unit or functional
tests](https://www.elastic.co/guide/en/kibana/master/development-tests.html)
were updated or added to match the most common scenarios

### For maintainers

- [ ] This was checked for breaking API changes and was [labeled
appropriately](https://www.elastic.co/guide/en/kibana/master/contributing.html#kibana-release-notes-process)
  • Loading branch information
Heenawter authored Oct 4, 2023
1 parent ed5e00f commit 4d1bd84
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 1 deletion.
2 changes: 1 addition & 1 deletion test/functional/page_objects/dashboard_page.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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();
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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']);

Expand Down Expand Up @@ -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');
});
});
});
}

0 comments on commit 4d1bd84

Please sign in to comment.