From 8127b21c71ab8445eb97650ce79a8ed0e8f0fee4 Mon Sep 17 00:00:00 2001 From: Anton Dosov Date: Thu, 20 Jul 2023 14:58:10 +0200 Subject: [PATCH 1/8] flaky run --- .../functional/test_suites/observability/navigation.ts | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/x-pack/test_serverless/functional/test_suites/observability/navigation.ts b/x-pack/test_serverless/functional/test_suites/observability/navigation.ts index 6b810305892ce..70e43218be26c 100644 --- a/x-pack/test_serverless/functional/test_suites/observability/navigation.ts +++ b/x-pack/test_serverless/functional/test_suites/observability/navigation.ts @@ -14,7 +14,8 @@ export default function ({ getPageObject, getService }: FtrProviderContext) { const svlCommonNavigation = getPageObject('svlCommonNavigation'); const browser = getService('browser'); - describe('navigation', function () { + // eslint-disable-next-line ban/ban + describe.only('navigation', function () { before(async () => { await svlObltNavigation.navigateToLandingPage(); }); From fa701edffb2d2af12f70f98d73854384ac26d1e1 Mon Sep 17 00:00:00 2001 From: Anton Dosov Date: Mon, 21 Aug 2023 11:02:46 +0200 Subject: [PATCH 2/8] flaky test --- .../test_suites/observability/navigation.ts | 164 +++++++++--------- 1 file changed, 83 insertions(+), 81 deletions(-) diff --git a/x-pack/test_serverless/functional/test_suites/observability/navigation.ts b/x-pack/test_serverless/functional/test_suites/observability/navigation.ts index 98da117893f18..f6083c41ada2e 100644 --- a/x-pack/test_serverless/functional/test_suites/observability/navigation.ts +++ b/x-pack/test_serverless/functional/test_suites/observability/navigation.ts @@ -14,95 +14,97 @@ export default function ({ getPageObject, getService }: FtrProviderContext) { const svlCommonNavigation = getPageObject('svlCommonNavigation'); const browser = getService('browser'); - // eslint-disable-next-line ban/ban - describe.only('navigation', function () { - before(async () => { - await svlObltNavigation.navigateToLandingPage(); - }); - - it('navigate observability sidenav & breadcrumbs', async () => { - const expectNoPageReload = await svlCommonNavigation.createNoPageReloadCheck(); - - // check serverless search side nav exists - await svlCommonNavigation.expectExists(); - await svlCommonNavigation.breadcrumbs.expectExists(); - await svlObltOnboardingPage.assertQuickstartBadgeExists(); - - // check side nav links - await svlCommonNavigation.sidenav.expectSectionOpen('observability_project_nav'); - await svlCommonNavigation.sidenav.expectLinkActive({ deepLinkId: 'observabilityOnboarding' }); - await svlCommonNavigation.breadcrumbs.expectBreadcrumbExists({ - deepLinkId: 'observabilityOnboarding', + for (let i = 0; i < 10; i++) { + // eslint-disable-next-line ban/ban + describe.only('navigation' + i, function () { + before(async () => { + await svlObltNavigation.navigateToLandingPage(); }); - await svlCommonNavigation.sidenav.expectSectionClosed('project_settings_project_nav'); - // navigate to discover - await svlCommonNavigation.sidenav.clickLink({ deepLinkId: 'discover:log-explorer' }); - await svlCommonNavigation.sidenav.expectLinkActive({ deepLinkId: 'discover:log-explorer' }); - await svlCommonNavigation.breadcrumbs.expectBreadcrumbExists({ - deepLinkId: 'discover:log-explorer', + it('navigate observability sidenav & breadcrumbs', async () => { + const expectNoPageReload = await svlCommonNavigation.createNoPageReloadCheck(); + + // check serverless search side nav exists + await svlCommonNavigation.expectExists(); + await svlCommonNavigation.breadcrumbs.expectExists(); + await svlObltOnboardingPage.assertQuickstartBadgeExists(); + + // check side nav links + await svlCommonNavigation.sidenav.expectSectionOpen('observability_project_nav'); + await svlCommonNavigation.sidenav.expectLinkActive({ deepLinkId: 'observabilityOnboarding' }); + await svlCommonNavigation.breadcrumbs.expectBreadcrumbExists({ + deepLinkId: 'observabilityOnboarding', + }); + await svlCommonNavigation.sidenav.expectSectionClosed('project_settings_project_nav'); + + // navigate to discover + await svlCommonNavigation.sidenav.clickLink({ deepLinkId: 'discover:log-explorer' }); + await svlCommonNavigation.sidenav.expectLinkActive({ deepLinkId: 'discover:log-explorer' }); + await svlCommonNavigation.breadcrumbs.expectBreadcrumbExists({ + deepLinkId: 'discover:log-explorer', + }); + await expect(await browser.getCurrentUrl()).contain('/app/discover'); + + // check the aiops subsection + await svlCommonNavigation.sidenav.clickLink({ navId: 'aiops' }); // open ai ops subsection + await svlCommonNavigation.sidenav.clickLink({ deepLinkId: 'ml:anomalyDetection' }); + await svlCommonNavigation.sidenav.expectLinkActive({ deepLinkId: 'ml:anomalyDetection' }); + await svlCommonNavigation.breadcrumbs.expectBreadcrumbExists({ text: 'AIOps' }); + await svlCommonNavigation.breadcrumbs.expectBreadcrumbExists({ + deepLinkId: 'ml:anomalyDetection', + }); + + // navigate to a different section + await svlCommonNavigation.sidenav.openSection('project_settings_project_nav'); + await svlCommonNavigation.sidenav.clickLink({ deepLinkId: 'management' }); + await svlCommonNavigation.sidenav.expectLinkActive({ deepLinkId: 'management' }); + await svlCommonNavigation.breadcrumbs.expectBreadcrumbExists({ deepLinkId: 'management' }); + + // navigate back to serverless oblt overview + await svlCommonNavigation.breadcrumbs.clickHome(); + await svlCommonNavigation.sidenav.expectLinkActive({ deepLinkId: 'observabilityOnboarding' }); + await svlCommonNavigation.breadcrumbs.expectBreadcrumbExists({ + deepLinkId: 'observabilityOnboarding', + }); + await svlCommonNavigation.sidenav.expectSectionOpen(`project_settings_project_nav`); // remains open + + await expectNoPageReload(); }); - await expect(await browser.getCurrentUrl()).contain('/app/discover'); - - // check the aiops subsection - await svlCommonNavigation.sidenav.clickLink({ navId: 'aiops' }); // open ai ops subsection - await svlCommonNavigation.sidenav.clickLink({ deepLinkId: 'ml:anomalyDetection' }); - await svlCommonNavigation.sidenav.expectLinkActive({ deepLinkId: 'ml:anomalyDetection' }); - await svlCommonNavigation.breadcrumbs.expectBreadcrumbExists({ text: 'AIOps' }); - await svlCommonNavigation.breadcrumbs.expectBreadcrumbExists({ - deepLinkId: 'ml:anomalyDetection', + + // FLAKY/BUG?: https://github.com/elastic/kibana/issues/162781 + it('active sidenav section is auto opened on load', async () => { + await svlCommonNavigation.sidenav.openSection('project_settings_project_nav'); + await svlCommonNavigation.sidenav.clickLink({ deepLinkId: 'management' }); + await browser.refresh(); + await svlCommonNavigation.expectExists(); + await svlCommonNavigation.sidenav.expectSectionOpen('project_settings_project_nav'); }); - // navigate to a different section - await svlCommonNavigation.sidenav.openSection('project_settings_project_nav'); - await svlCommonNavigation.sidenav.clickLink({ deepLinkId: 'management' }); - await svlCommonNavigation.sidenav.expectLinkActive({ deepLinkId: 'management' }); - await svlCommonNavigation.breadcrumbs.expectBreadcrumbExists({ deepLinkId: 'management' }); - - // navigate back to serverless oblt overview - await svlCommonNavigation.breadcrumbs.clickHome(); - await svlCommonNavigation.sidenav.expectLinkActive({ deepLinkId: 'observabilityOnboarding' }); - await svlCommonNavigation.breadcrumbs.expectBreadcrumbExists({ - deepLinkId: 'observabilityOnboarding', + it('navigate using search', async () => { + await svlCommonNavigation.search.showSearch(); + await svlCommonNavigation.search.searchFor('discover log explorer'); + await svlCommonNavigation.search.clickOnOption(0); + await svlCommonNavigation.search.hideSearch(); + + await expect(await browser.getCurrentUrl()).contain('/app/discover#/p/log-explorer'); }); - await svlCommonNavigation.sidenav.expectSectionOpen(`project_settings_project_nav`); // remains open - - await expectNoPageReload(); - }); - - // FLAKY/BUG?: https://github.com/elastic/kibana/issues/162781 - it.skip('active sidenav section is auto opened on load', async () => { - await svlCommonNavigation.sidenav.openSection('project_settings_project_nav'); - await svlCommonNavigation.sidenav.clickLink({ deepLinkId: 'management' }); - await browser.refresh(); - await svlCommonNavigation.expectExists(); - await svlCommonNavigation.sidenav.expectSectionOpen('project_settings_project_nav'); - }); - - it('navigate using search', async () => { - await svlCommonNavigation.search.showSearch(); - await svlCommonNavigation.search.searchFor('discover log explorer'); - await svlCommonNavigation.search.clickOnOption(0); - await svlCommonNavigation.search.hideSearch(); - - await expect(await browser.getCurrentUrl()).contain('/app/discover#/p/log-explorer'); - }); - - it('shows cases in sidebar navigation', async () => { - await svlCommonNavigation.expectExists(); - - await svlCommonNavigation.sidenav.expectLinkExists({ - deepLinkId: 'observability-overview:cases', + + it('shows cases in sidebar navigation', async () => { + await svlCommonNavigation.expectExists(); + + await svlCommonNavigation.sidenav.expectLinkExists({ + deepLinkId: 'observability-overview:cases', + }); }); - }); - it('navigates to cases app', async () => { - await svlCommonNavigation.sidenav.clickLink({ deepLinkId: 'observability-overview:cases' }); + it('navigates to cases app', async () => { + await svlCommonNavigation.sidenav.clickLink({ deepLinkId: 'observability-overview:cases' }); - await svlCommonNavigation.sidenav.expectLinkActive({ - deepLinkId: 'observability-overview:cases', + await svlCommonNavigation.sidenav.expectLinkActive({ + deepLinkId: 'observability-overview:cases', + }); + expect(await browser.getCurrentUrl()).contain('/app/observability/cases'); }); - expect(await browser.getCurrentUrl()).contain('/app/observability/cases'); - }); - }); + } + } } From 50e5be6e2acf728e90daa5c88e5d64df476dddef Mon Sep 17 00:00:00 2001 From: Anton Dosov Date: Mon, 21 Aug 2023 11:02:57 +0200 Subject: [PATCH 3/8] flaky test --- .../functional/test_suites/observability/navigation.ts | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/x-pack/test_serverless/functional/test_suites/observability/navigation.ts b/x-pack/test_serverless/functional/test_suites/observability/navigation.ts index f6083c41ada2e..84fa363f26ff5 100644 --- a/x-pack/test_serverless/functional/test_suites/observability/navigation.ts +++ b/x-pack/test_serverless/functional/test_suites/observability/navigation.ts @@ -31,7 +31,9 @@ export default function ({ getPageObject, getService }: FtrProviderContext) { // check side nav links await svlCommonNavigation.sidenav.expectSectionOpen('observability_project_nav'); - await svlCommonNavigation.sidenav.expectLinkActive({ deepLinkId: 'observabilityOnboarding' }); + await svlCommonNavigation.sidenav.expectLinkActive({ + deepLinkId: 'observabilityOnboarding', + }); await svlCommonNavigation.breadcrumbs.expectBreadcrumbExists({ deepLinkId: 'observabilityOnboarding', }); @@ -62,7 +64,9 @@ export default function ({ getPageObject, getService }: FtrProviderContext) { // navigate back to serverless oblt overview await svlCommonNavigation.breadcrumbs.clickHome(); - await svlCommonNavigation.sidenav.expectLinkActive({ deepLinkId: 'observabilityOnboarding' }); + await svlCommonNavigation.sidenav.expectLinkActive({ + deepLinkId: 'observabilityOnboarding', + }); await svlCommonNavigation.breadcrumbs.expectBreadcrumbExists({ deepLinkId: 'observabilityOnboarding', }); @@ -105,6 +109,6 @@ export default function ({ getPageObject, getService }: FtrProviderContext) { }); expect(await browser.getCurrentUrl()).contain('/app/observability/cases'); }); - } + }); } } From 1fa7d64f3e0a07bbcf87df9d0676a19b1915d24c Mon Sep 17 00:00:00 2001 From: Anton Dosov Date: Mon, 21 Aug 2023 11:38:37 +0200 Subject: [PATCH 4/8] fix --- .../test_suites/observability/navigation.ts | 174 +++++++++--------- 1 file changed, 91 insertions(+), 83 deletions(-) diff --git a/x-pack/test_serverless/functional/test_suites/observability/navigation.ts b/x-pack/test_serverless/functional/test_suites/observability/navigation.ts index 84fa363f26ff5..3fcfa3d24b0cf 100644 --- a/x-pack/test_serverless/functional/test_suites/observability/navigation.ts +++ b/x-pack/test_serverless/functional/test_suites/observability/navigation.ts @@ -14,101 +14,109 @@ export default function ({ getPageObject, getService }: FtrProviderContext) { const svlCommonNavigation = getPageObject('svlCommonNavigation'); const browser = getService('browser'); - for (let i = 0; i < 10; i++) { - // eslint-disable-next-line ban/ban - describe.only('navigation' + i, function () { - before(async () => { - await svlObltNavigation.navigateToLandingPage(); - }); - - it('navigate observability sidenav & breadcrumbs', async () => { - const expectNoPageReload = await svlCommonNavigation.createNoPageReloadCheck(); - - // check serverless search side nav exists - await svlCommonNavigation.expectExists(); - await svlCommonNavigation.breadcrumbs.expectExists(); - await svlObltOnboardingPage.assertQuickstartBadgeExists(); - - // check side nav links - await svlCommonNavigation.sidenav.expectSectionOpen('observability_project_nav'); - await svlCommonNavigation.sidenav.expectLinkActive({ - deepLinkId: 'observabilityOnboarding', + describe('navigation', () => { + for (let i = 0; i < 10; i++) { + // eslint-disable-next-line ban/ban + describe.only('navigation' + i, function () { + before(async () => { + await svlObltNavigation.navigateToLandingPage(); }); - await svlCommonNavigation.breadcrumbs.expectBreadcrumbExists({ - deepLinkId: 'observabilityOnboarding', - }); - await svlCommonNavigation.sidenav.expectSectionClosed('project_settings_project_nav'); - // navigate to discover - await svlCommonNavigation.sidenav.clickLink({ deepLinkId: 'discover:log-explorer' }); - await svlCommonNavigation.sidenav.expectLinkActive({ deepLinkId: 'discover:log-explorer' }); - await svlCommonNavigation.breadcrumbs.expectBreadcrumbExists({ - deepLinkId: 'discover:log-explorer', - }); - await expect(await browser.getCurrentUrl()).contain('/app/discover'); - - // check the aiops subsection - await svlCommonNavigation.sidenav.clickLink({ navId: 'aiops' }); // open ai ops subsection - await svlCommonNavigation.sidenav.clickLink({ deepLinkId: 'ml:anomalyDetection' }); - await svlCommonNavigation.sidenav.expectLinkActive({ deepLinkId: 'ml:anomalyDetection' }); - await svlCommonNavigation.breadcrumbs.expectBreadcrumbExists({ text: 'AIOps' }); - await svlCommonNavigation.breadcrumbs.expectBreadcrumbExists({ - deepLinkId: 'ml:anomalyDetection', + it('navigate observability sidenav & breadcrumbs', async () => { + const expectNoPageReload = await svlCommonNavigation.createNoPageReloadCheck(); + + // check serverless search side nav exists + await svlCommonNavigation.expectExists(); + await svlCommonNavigation.breadcrumbs.expectExists(); + await svlObltOnboardingPage.assertQuickstartBadgeExists(); + + // check side nav links + await svlCommonNavigation.sidenav.expectSectionOpen('observability_project_nav'); + await svlCommonNavigation.sidenav.expectLinkActive({ + deepLinkId: 'observabilityOnboarding', + }); + await svlCommonNavigation.breadcrumbs.expectBreadcrumbExists({ + deepLinkId: 'observabilityOnboarding', + }); + await svlCommonNavigation.sidenav.expectSectionClosed('project_settings_project_nav'); + + // navigate to discover + await svlCommonNavigation.sidenav.clickLink({ deepLinkId: 'discover:log-explorer' }); + await svlCommonNavigation.sidenav.expectLinkActive({ + deepLinkId: 'discover:log-explorer', + }); + await svlCommonNavigation.breadcrumbs.expectBreadcrumbExists({ + deepLinkId: 'discover:log-explorer', + }); + await expect(await browser.getCurrentUrl()).contain('/app/discover'); + + // check the aiops subsection + await svlCommonNavigation.sidenav.clickLink({ navId: 'aiops' }); // open ai ops subsection + await svlCommonNavigation.sidenav.clickLink({ deepLinkId: 'ml:anomalyDetection' }); + await svlCommonNavigation.sidenav.expectLinkActive({ deepLinkId: 'ml:anomalyDetection' }); + await svlCommonNavigation.breadcrumbs.expectBreadcrumbExists({ text: 'AIOps' }); + await svlCommonNavigation.breadcrumbs.expectBreadcrumbExists({ + deepLinkId: 'ml:anomalyDetection', + }); + + // navigate to a different section + await svlCommonNavigation.sidenav.openSection('project_settings_project_nav'); + await svlCommonNavigation.sidenav.clickLink({ deepLinkId: 'management' }); + await svlCommonNavigation.sidenav.expectLinkActive({ deepLinkId: 'management' }); + await svlCommonNavigation.breadcrumbs.expectBreadcrumbExists({ + deepLinkId: 'management', + }); + + // navigate back to serverless oblt overview + await svlCommonNavigation.breadcrumbs.clickHome(); + await svlCommonNavigation.sidenav.expectLinkActive({ + deepLinkId: 'observabilityOnboarding', + }); + await svlCommonNavigation.breadcrumbs.expectBreadcrumbExists({ + deepLinkId: 'observabilityOnboarding', + }); + await svlCommonNavigation.sidenav.expectSectionOpen(`project_settings_project_nav`); // remains open + + await expectNoPageReload(); }); - // navigate to a different section - await svlCommonNavigation.sidenav.openSection('project_settings_project_nav'); - await svlCommonNavigation.sidenav.clickLink({ deepLinkId: 'management' }); - await svlCommonNavigation.sidenav.expectLinkActive({ deepLinkId: 'management' }); - await svlCommonNavigation.breadcrumbs.expectBreadcrumbExists({ deepLinkId: 'management' }); - - // navigate back to serverless oblt overview - await svlCommonNavigation.breadcrumbs.clickHome(); - await svlCommonNavigation.sidenav.expectLinkActive({ - deepLinkId: 'observabilityOnboarding', - }); - await svlCommonNavigation.breadcrumbs.expectBreadcrumbExists({ - deepLinkId: 'observabilityOnboarding', + // FLAKY/BUG?: https://github.com/elastic/kibana/issues/162781 + it('active sidenav section is auto opened on load', async () => { + await svlCommonNavigation.sidenav.openSection('project_settings_project_nav'); + await svlCommonNavigation.sidenav.clickLink({ deepLinkId: 'management' }); + await browser.refresh(); + await svlCommonNavigation.expectExists(); + await svlCommonNavigation.sidenav.expectSectionOpen('project_settings_project_nav'); }); - await svlCommonNavigation.sidenav.expectSectionOpen(`project_settings_project_nav`); // remains open - await expectNoPageReload(); - }); - - // FLAKY/BUG?: https://github.com/elastic/kibana/issues/162781 - it('active sidenav section is auto opened on load', async () => { - await svlCommonNavigation.sidenav.openSection('project_settings_project_nav'); - await svlCommonNavigation.sidenav.clickLink({ deepLinkId: 'management' }); - await browser.refresh(); - await svlCommonNavigation.expectExists(); - await svlCommonNavigation.sidenav.expectSectionOpen('project_settings_project_nav'); - }); - - it('navigate using search', async () => { - await svlCommonNavigation.search.showSearch(); - await svlCommonNavigation.search.searchFor('discover log explorer'); - await svlCommonNavigation.search.clickOnOption(0); - await svlCommonNavigation.search.hideSearch(); + it('navigate using search', async () => { + await svlCommonNavigation.search.showSearch(); + await svlCommonNavigation.search.searchFor('discover log explorer'); + await svlCommonNavigation.search.clickOnOption(0); + await svlCommonNavigation.search.hideSearch(); - await expect(await browser.getCurrentUrl()).contain('/app/discover#/p/log-explorer'); - }); + await expect(await browser.getCurrentUrl()).contain('/app/discover#/p/log-explorer'); + }); - it('shows cases in sidebar navigation', async () => { - await svlCommonNavigation.expectExists(); + it('shows cases in sidebar navigation', async () => { + await svlCommonNavigation.expectExists(); - await svlCommonNavigation.sidenav.expectLinkExists({ - deepLinkId: 'observability-overview:cases', + await svlCommonNavigation.sidenav.expectLinkExists({ + deepLinkId: 'observability-overview:cases', + }); }); - }); - it('navigates to cases app', async () => { - await svlCommonNavigation.sidenav.clickLink({ deepLinkId: 'observability-overview:cases' }); + it('navigates to cases app', async () => { + await svlCommonNavigation.sidenav.clickLink({ + deepLinkId: 'observability-overview:cases', + }); - await svlCommonNavigation.sidenav.expectLinkActive({ - deepLinkId: 'observability-overview:cases', + await svlCommonNavigation.sidenav.expectLinkActive({ + deepLinkId: 'observability-overview:cases', + }); + expect(await browser.getCurrentUrl()).contain('/app/observability/cases'); }); - expect(await browser.getCurrentUrl()).contain('/app/observability/cases'); }); - }); - } + } + }); } From 1a1283dc7ac9840bffaa72cdae8fa1c929e62054 Mon Sep 17 00:00:00 2001 From: Anton Dosov Date: Mon, 21 Aug 2023 13:41:31 +0200 Subject: [PATCH 5/8] fix flaky nav test --- .../functional/page_objects/svl_common_navigation.ts | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/x-pack/test_serverless/functional/page_objects/svl_common_navigation.ts b/x-pack/test_serverless/functional/page_objects/svl_common_navigation.ts index 60964a820ac75..8d3edb04d640a 100644 --- a/x-pack/test_serverless/functional/page_objects/svl_common_navigation.ts +++ b/x-pack/test_serverless/functional/page_objects/svl_common_navigation.ts @@ -104,13 +104,17 @@ export function SvlCommonNavigationProvider(ctx: FtrProviderContext) { }, async expectSectionOpen(sectionId: NavigationId) { await this.expectSectionExists(sectionId); - const isOpen = await this.isSectionOpen(sectionId); - expect(isOpen).to.be(true); + await retry.waitFor(`section ${sectionId} to be open`, async () => { + const isOpen = await this.isSectionOpen(sectionId); + return isOpen; + }); }, async expectSectionClosed(sectionId: NavigationId) { await this.expectSectionExists(sectionId); - const isOpen = await this.isSectionOpen(sectionId); - expect(isOpen).to.be(false); + await retry.waitFor(`section ${sectionId} to be closed`, async () => { + const isOpen = await this.isSectionOpen(sectionId); + return !isOpen; + }); }, async openSection(sectionId: NavigationId) { await this.expectSectionExists(sectionId); From bb6edbccd684de9e863dc674e35b5f722acbbeb7 Mon Sep 17 00:00:00 2001 From: Anton Dosov Date: Mon, 21 Aug 2023 15:04:21 +0200 Subject: [PATCH 6/8] revert loop changes --- .../test_suites/observability/navigation.ts | 200 +++++++++--------- 1 file changed, 97 insertions(+), 103 deletions(-) diff --git a/x-pack/test_serverless/functional/test_suites/observability/navigation.ts b/x-pack/test_serverless/functional/test_suites/observability/navigation.ts index 3fcfa3d24b0cf..cc49ebb1344af 100644 --- a/x-pack/test_serverless/functional/test_suites/observability/navigation.ts +++ b/x-pack/test_serverless/functional/test_suites/observability/navigation.ts @@ -14,109 +14,103 @@ export default function ({ getPageObject, getService }: FtrProviderContext) { const svlCommonNavigation = getPageObject('svlCommonNavigation'); const browser = getService('browser'); - describe('navigation', () => { - for (let i = 0; i < 10; i++) { - // eslint-disable-next-line ban/ban - describe.only('navigation' + i, function () { - before(async () => { - await svlObltNavigation.navigateToLandingPage(); - }); - - it('navigate observability sidenav & breadcrumbs', async () => { - const expectNoPageReload = await svlCommonNavigation.createNoPageReloadCheck(); - - // check serverless search side nav exists - await svlCommonNavigation.expectExists(); - await svlCommonNavigation.breadcrumbs.expectExists(); - await svlObltOnboardingPage.assertQuickstartBadgeExists(); - - // check side nav links - await svlCommonNavigation.sidenav.expectSectionOpen('observability_project_nav'); - await svlCommonNavigation.sidenav.expectLinkActive({ - deepLinkId: 'observabilityOnboarding', - }); - await svlCommonNavigation.breadcrumbs.expectBreadcrumbExists({ - deepLinkId: 'observabilityOnboarding', - }); - await svlCommonNavigation.sidenav.expectSectionClosed('project_settings_project_nav'); - - // navigate to discover - await svlCommonNavigation.sidenav.clickLink({ deepLinkId: 'discover:log-explorer' }); - await svlCommonNavigation.sidenav.expectLinkActive({ - deepLinkId: 'discover:log-explorer', - }); - await svlCommonNavigation.breadcrumbs.expectBreadcrumbExists({ - deepLinkId: 'discover:log-explorer', - }); - await expect(await browser.getCurrentUrl()).contain('/app/discover'); - - // check the aiops subsection - await svlCommonNavigation.sidenav.clickLink({ navId: 'aiops' }); // open ai ops subsection - await svlCommonNavigation.sidenav.clickLink({ deepLinkId: 'ml:anomalyDetection' }); - await svlCommonNavigation.sidenav.expectLinkActive({ deepLinkId: 'ml:anomalyDetection' }); - await svlCommonNavigation.breadcrumbs.expectBreadcrumbExists({ text: 'AIOps' }); - await svlCommonNavigation.breadcrumbs.expectBreadcrumbExists({ - deepLinkId: 'ml:anomalyDetection', - }); - - // navigate to a different section - await svlCommonNavigation.sidenav.openSection('project_settings_project_nav'); - await svlCommonNavigation.sidenav.clickLink({ deepLinkId: 'management' }); - await svlCommonNavigation.sidenav.expectLinkActive({ deepLinkId: 'management' }); - await svlCommonNavigation.breadcrumbs.expectBreadcrumbExists({ - deepLinkId: 'management', - }); - - // navigate back to serverless oblt overview - await svlCommonNavigation.breadcrumbs.clickHome(); - await svlCommonNavigation.sidenav.expectLinkActive({ - deepLinkId: 'observabilityOnboarding', - }); - await svlCommonNavigation.breadcrumbs.expectBreadcrumbExists({ - deepLinkId: 'observabilityOnboarding', - }); - await svlCommonNavigation.sidenav.expectSectionOpen(`project_settings_project_nav`); // remains open - - await expectNoPageReload(); - }); - - // FLAKY/BUG?: https://github.com/elastic/kibana/issues/162781 - it('active sidenav section is auto opened on load', async () => { - await svlCommonNavigation.sidenav.openSection('project_settings_project_nav'); - await svlCommonNavigation.sidenav.clickLink({ deepLinkId: 'management' }); - await browser.refresh(); - await svlCommonNavigation.expectExists(); - await svlCommonNavigation.sidenav.expectSectionOpen('project_settings_project_nav'); - }); - - it('navigate using search', async () => { - await svlCommonNavigation.search.showSearch(); - await svlCommonNavigation.search.searchFor('discover log explorer'); - await svlCommonNavigation.search.clickOnOption(0); - await svlCommonNavigation.search.hideSearch(); - - await expect(await browser.getCurrentUrl()).contain('/app/discover#/p/log-explorer'); - }); - - it('shows cases in sidebar navigation', async () => { - await svlCommonNavigation.expectExists(); - - await svlCommonNavigation.sidenav.expectLinkExists({ - deepLinkId: 'observability-overview:cases', - }); - }); - - it('navigates to cases app', async () => { - await svlCommonNavigation.sidenav.clickLink({ - deepLinkId: 'observability-overview:cases', - }); - - await svlCommonNavigation.sidenav.expectLinkActive({ - deepLinkId: 'observability-overview:cases', - }); - expect(await browser.getCurrentUrl()).contain('/app/observability/cases'); - }); + describe('navigation' + i, function () { + before(async () => { + await svlObltNavigation.navigateToLandingPage(); + }); + + it('navigate observability sidenav & breadcrumbs', async () => { + const expectNoPageReload = await svlCommonNavigation.createNoPageReloadCheck(); + + // check serverless search side nav exists + await svlCommonNavigation.expectExists(); + await svlCommonNavigation.breadcrumbs.expectExists(); + await svlObltOnboardingPage.assertQuickstartBadgeExists(); + + // check side nav links + await svlCommonNavigation.sidenav.expectSectionOpen('observability_project_nav'); + await svlCommonNavigation.sidenav.expectLinkActive({ + deepLinkId: 'observabilityOnboarding', }); - } + await svlCommonNavigation.breadcrumbs.expectBreadcrumbExists({ + deepLinkId: 'observabilityOnboarding', + }); + await svlCommonNavigation.sidenav.expectSectionClosed('project_settings_project_nav'); + + // navigate to discover + await svlCommonNavigation.sidenav.clickLink({ deepLinkId: 'discover:log-explorer' }); + await svlCommonNavigation.sidenav.expectLinkActive({ + deepLinkId: 'discover:log-explorer', + }); + await svlCommonNavigation.breadcrumbs.expectBreadcrumbExists({ + deepLinkId: 'discover:log-explorer', + }); + await expect(await browser.getCurrentUrl()).contain('/app/discover'); + + // check the aiops subsection + await svlCommonNavigation.sidenav.clickLink({ navId: 'aiops' }); // open ai ops subsection + await svlCommonNavigation.sidenav.clickLink({ deepLinkId: 'ml:anomalyDetection' }); + await svlCommonNavigation.sidenav.expectLinkActive({ deepLinkId: 'ml:anomalyDetection' }); + await svlCommonNavigation.breadcrumbs.expectBreadcrumbExists({ text: 'AIOps' }); + await svlCommonNavigation.breadcrumbs.expectBreadcrumbExists({ + deepLinkId: 'ml:anomalyDetection', + }); + + // navigate to a different section + await svlCommonNavigation.sidenav.openSection('project_settings_project_nav'); + await svlCommonNavigation.sidenav.clickLink({ deepLinkId: 'management' }); + await svlCommonNavigation.sidenav.expectLinkActive({ deepLinkId: 'management' }); + await svlCommonNavigation.breadcrumbs.expectBreadcrumbExists({ + deepLinkId: 'management', + }); + + // navigate back to serverless oblt overview + await svlCommonNavigation.breadcrumbs.clickHome(); + await svlCommonNavigation.sidenav.expectLinkActive({ + deepLinkId: 'observabilityOnboarding', + }); + await svlCommonNavigation.breadcrumbs.expectBreadcrumbExists({ + deepLinkId: 'observabilityOnboarding', + }); + await svlCommonNavigation.sidenav.expectSectionOpen(`project_settings_project_nav`); // remains open + + await expectNoPageReload(); + }); + + it('active sidenav section is auto opened on load', async () => { + await svlCommonNavigation.sidenav.openSection('project_settings_project_nav'); + await svlCommonNavigation.sidenav.clickLink({ deepLinkId: 'management' }); + await browser.refresh(); + await svlCommonNavigation.expectExists(); + await svlCommonNavigation.sidenav.expectSectionOpen('project_settings_project_nav'); + }); + + it('navigate using search', async () => { + await svlCommonNavigation.search.showSearch(); + await svlCommonNavigation.search.searchFor('discover log explorer'); + await svlCommonNavigation.search.clickOnOption(0); + await svlCommonNavigation.search.hideSearch(); + + await expect(await browser.getCurrentUrl()).contain('/app/discover#/p/log-explorer'); + }); + + it('shows cases in sidebar navigation', async () => { + await svlCommonNavigation.expectExists(); + + await svlCommonNavigation.sidenav.expectLinkExists({ + deepLinkId: 'observability-overview:cases', + }); + }); + + it('navigates to cases app', async () => { + await svlCommonNavigation.sidenav.clickLink({ + deepLinkId: 'observability-overview:cases', + }); + + await svlCommonNavigation.sidenav.expectLinkActive({ + deepLinkId: 'observability-overview:cases', + }); + expect(await browser.getCurrentUrl()).contain('/app/observability/cases'); + }); }); } From 5fa71410201f48da8eca229a6e6932646ba7683f Mon Sep 17 00:00:00 2001 From: Anton Dosov Date: Mon, 21 Aug 2023 15:04:38 +0200 Subject: [PATCH 7/8] fix --- .../functional/test_suites/observability/navigation.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/x-pack/test_serverless/functional/test_suites/observability/navigation.ts b/x-pack/test_serverless/functional/test_suites/observability/navigation.ts index cc49ebb1344af..459dcaea571d3 100644 --- a/x-pack/test_serverless/functional/test_suites/observability/navigation.ts +++ b/x-pack/test_serverless/functional/test_suites/observability/navigation.ts @@ -14,7 +14,7 @@ export default function ({ getPageObject, getService }: FtrProviderContext) { const svlCommonNavigation = getPageObject('svlCommonNavigation'); const browser = getService('browser'); - describe('navigation' + i, function () { + describe('navigation', function () { before(async () => { await svlObltNavigation.navigateToLandingPage(); }); From 8bcc230b40c9f7c8e8743afe8ab8ebb3af86bec3 Mon Sep 17 00:00:00 2001 From: Anton Dosov Date: Mon, 21 Aug 2023 15:08:46 +0200 Subject: [PATCH 8/8] revert formatting changes --- .../test_suites/observability/navigation.ts | 20 +++++-------------- 1 file changed, 5 insertions(+), 15 deletions(-) diff --git a/x-pack/test_serverless/functional/test_suites/observability/navigation.ts b/x-pack/test_serverless/functional/test_suites/observability/navigation.ts index 459dcaea571d3..eb56af9f88688 100644 --- a/x-pack/test_serverless/functional/test_suites/observability/navigation.ts +++ b/x-pack/test_serverless/functional/test_suites/observability/navigation.ts @@ -29,9 +29,7 @@ export default function ({ getPageObject, getService }: FtrProviderContext) { // check side nav links await svlCommonNavigation.sidenav.expectSectionOpen('observability_project_nav'); - await svlCommonNavigation.sidenav.expectLinkActive({ - deepLinkId: 'observabilityOnboarding', - }); + await svlCommonNavigation.sidenav.expectLinkActive({ deepLinkId: 'observabilityOnboarding' }); await svlCommonNavigation.breadcrumbs.expectBreadcrumbExists({ deepLinkId: 'observabilityOnboarding', }); @@ -39,9 +37,7 @@ export default function ({ getPageObject, getService }: FtrProviderContext) { // navigate to discover await svlCommonNavigation.sidenav.clickLink({ deepLinkId: 'discover:log-explorer' }); - await svlCommonNavigation.sidenav.expectLinkActive({ - deepLinkId: 'discover:log-explorer', - }); + await svlCommonNavigation.sidenav.expectLinkActive({ deepLinkId: 'discover:log-explorer' }); await svlCommonNavigation.breadcrumbs.expectBreadcrumbExists({ deepLinkId: 'discover:log-explorer', }); @@ -60,15 +56,11 @@ export default function ({ getPageObject, getService }: FtrProviderContext) { await svlCommonNavigation.sidenav.openSection('project_settings_project_nav'); await svlCommonNavigation.sidenav.clickLink({ deepLinkId: 'management' }); await svlCommonNavigation.sidenav.expectLinkActive({ deepLinkId: 'management' }); - await svlCommonNavigation.breadcrumbs.expectBreadcrumbExists({ - deepLinkId: 'management', - }); + await svlCommonNavigation.breadcrumbs.expectBreadcrumbExists({ deepLinkId: 'management' }); // navigate back to serverless oblt overview await svlCommonNavigation.breadcrumbs.clickHome(); - await svlCommonNavigation.sidenav.expectLinkActive({ - deepLinkId: 'observabilityOnboarding', - }); + await svlCommonNavigation.sidenav.expectLinkActive({ deepLinkId: 'observabilityOnboarding' }); await svlCommonNavigation.breadcrumbs.expectBreadcrumbExists({ deepLinkId: 'observabilityOnboarding', }); @@ -103,9 +95,7 @@ export default function ({ getPageObject, getService }: FtrProviderContext) { }); it('navigates to cases app', async () => { - await svlCommonNavigation.sidenav.clickLink({ - deepLinkId: 'observability-overview:cases', - }); + await svlCommonNavigation.sidenav.clickLink({ deepLinkId: 'observability-overview:cases' }); await svlCommonNavigation.sidenav.expectLinkActive({ deepLinkId: 'observability-overview:cases',