Skip to content

Commit

Permalink
Attempt to fix flaky sidenav test (elastic#212213)
Browse files Browse the repository at this point in the history
Fixes elastic#195153

## Summary

Waiting for the page to be loaded and the side nav item to exist before
clicking.
  • Loading branch information
maryam-saeidi authored Feb 26, 2025
1 parent 9d1d297 commit f5c4f20
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 1 deletion.
2 changes: 2 additions & 0 deletions test/functional/page_objects/solution_navigation.ts
Original file line number Diff line number Diff line change
Expand Up @@ -115,8 +115,10 @@ export function SolutionNavigationProvider(ctx: Pick<FtrProviderContext, 'getSer
async clickLink(by: { deepLinkId: AppDeepLinkId } | { navId: string } | { text: string }) {
await this.expectLinkExists(by);
if ('deepLinkId' in by) {
await testSubjects.existOrFail(`~nav-item-deepLinkId-${by.deepLinkId}`);
await testSubjects.click(`~nav-item-deepLinkId-${by.deepLinkId}`);
} else if ('navId' in by) {
await testSubjects.existOrFail(`~nav-item-id-${by.navId}`);
await testSubjects.click(`~nav-item-id-${by.navId}`);
} else {
await retry.try(async () => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,11 @@ import expect from '@kbn/expect';
import { FtrProviderContext } from '../../../ftr_provider_context';

export default function ({ getPageObjects, getService }: FtrProviderContext) {
const { common, solutionNavigation } = getPageObjects(['common', 'solutionNavigation']);
const { common, solutionNavigation, header } = getPageObjects([
'common',
'solutionNavigation',
'header',
]);
const spaces = getService('spaces');
const browser = getService('browser');

Expand All @@ -24,6 +28,7 @@ export default function ({ getPageObjects, getService }: FtrProviderContext) {
// Create a space with the observability solution and navigate to its home page
({ cleanUp, space: spaceCreated } = await spaces.create({ solution: 'oblt' }));
await browser.navigateTo(spaces.getRootUrl(spaceCreated.id));
await header.waitUntilLoadingHasFinished();
});

after(async () => {
Expand Down

0 comments on commit f5c4f20

Please sign in to comment.