Attempt to fix flaky sidenav test (#212213)

Fixes #195153

## Summary

Waiting for the page to be loaded and the side nav item to exist before
clicking.
This commit is contained in:
Maryam Saeidi 2025-02-26 10:42:27 +01:00 committed by GitHub
parent 9d1d297ae9
commit f5c4f203fc
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 8 additions and 1 deletions

View file

@ -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 () => {

View file

@ -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');
@ -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 () => {