From 5034558446d8350d0b5a81efc3100ee9cb7bda72 Mon Sep 17 00:00:00 2001 From: Rodney Norris Date: Tue, 22 Oct 2024 16:29:55 -0500 Subject: [PATCH] [Search][FTR] Fix / Improve tests (#197264) ## Summary Closes #196981 - Updated Search Index Details with data test suite to check for index documents first, this should help reduce flakey tests in MKI since we will ensure the documents are available before moving forward - Updated URL checks to use regex instead `.equal` with the mocked value. This should ensure the tests can pass in MKI and with integration testing - Removed the navigation check for the Maps page, this was causing intermittent failures due to a modal on the page. - Updated the getting started test suite to use `developer` role instead of `admin` ### 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 - [x] [Flaky Test Runner](https://ci-stats.kibana.dev/trigger_flaky_test_runner/1) was used on any tests changed --- .../svl_search_elasticsearch_start_page.ts | 4 ++-- .../page_objects/svl_search_index_detail_page.ts | 4 ++-- .../test_suites/search/elasticsearch_start.ts | 3 --- .../test_suites/search/getting_started.ts | 2 +- .../functional/test_suites/search/navigation.ts | 15 --------------- .../test_suites/search/search_index_detail.ts | 9 +++------ 6 files changed, 8 insertions(+), 29 deletions(-) diff --git a/x-pack/test_serverless/functional/page_objects/svl_search_elasticsearch_start_page.ts b/x-pack/test_serverless/functional/page_objects/svl_search_elasticsearch_start_page.ts index 0e3bc4b82a298..1f4294d4c8f41 100644 --- a/x-pack/test_serverless/functional/page_objects/svl_search_elasticsearch_start_page.ts +++ b/x-pack/test_serverless/functional/page_objects/svl_search_elasticsearch_start_page.ts @@ -85,8 +85,8 @@ export function SvlSearchElasticsearchStartPageProvider({ getService }: FtrProvi }, async expectO11yTrialLink() { await testSubjects.existOrFail('startO11yTrialBtn'); - expect(await testSubjects.getAttribute('startO11yTrialBtn', 'href')).equal( - 'https://fake-cloud.elastic.co/projects/create/observability/start' + expect(await testSubjects.getAttribute('startO11yTrialBtn', 'href')).match( + /^https?\:\/\/.*\/projects\/create\/observability\/start/ ); expect(await testSubjects.getAttribute('startO11yTrialBtn', 'target')).equal('_blank'); }, diff --git a/x-pack/test_serverless/functional/page_objects/svl_search_index_detail_page.ts b/x-pack/test_serverless/functional/page_objects/svl_search_index_detail_page.ts index 656c75fb308bc..1b355138173d6 100644 --- a/x-pack/test_serverless/functional/page_objects/svl_search_index_detail_page.ts +++ b/x-pack/test_serverless/functional/page_objects/svl_search_index_detail_page.ts @@ -27,8 +27,8 @@ export function SvlSearchIndexDetailPageProvider({ getService }: FtrProviderCont }, async expectConnectionDetails() { await testSubjects.existOrFail('connectionDetailsEndpoint', { timeout: 2000 }); - expect(await (await testSubjects.find('connectionDetailsEndpoint')).getVisibleText()).to.be( - 'https://fakeprojectid.es.fake-domain.cld.elstc.co:443' + expect(await (await testSubjects.find('connectionDetailsEndpoint')).getVisibleText()).match( + /^https?\:\/\/.*(\:\d+)?/ ); }, async expectQuickStats() { diff --git a/x-pack/test_serverless/functional/test_suites/search/elasticsearch_start.ts b/x-pack/test_serverless/functional/test_suites/search/elasticsearch_start.ts index 7ff1505304761..129f769283b34 100644 --- a/x-pack/test_serverless/functional/test_suites/search/elasticsearch_start.ts +++ b/x-pack/test_serverless/functional/test_suites/search/elasticsearch_start.ts @@ -27,9 +27,6 @@ export default function ({ getPageObjects, getService }: FtrProviderContext) { }; describe('Elasticsearch Start [Onboarding Empty State]', function () { - // fails on MKI, see https://github.com/elastic/kibana/issues/196981 - this.tags(['failsOnMKI']); - describe('developer', function () { before(async () => { await pageObjects.svlCommonPage.loginWithRole('developer'); diff --git a/x-pack/test_serverless/functional/test_suites/search/getting_started.ts b/x-pack/test_serverless/functional/test_suites/search/getting_started.ts index dac9b2d7dae94..4a2c34d98eebc 100644 --- a/x-pack/test_serverless/functional/test_suites/search/getting_started.ts +++ b/x-pack/test_serverless/functional/test_suites/search/getting_started.ts @@ -15,7 +15,7 @@ export default function ({ getPageObjects, getService }: FtrProviderContext) { describe('getting started', function () { before(async () => { - await pageObjects.svlCommonPage.loginAsAdmin(); + await pageObjects.svlCommonPage.loginWithRole('developer'); }); it('has serverless side nav', async () => { diff --git a/x-pack/test_serverless/functional/test_suites/search/navigation.ts b/x-pack/test_serverless/functional/test_suites/search/navigation.ts index 88f327d6f1ac2..a6da7b1467e9a 100644 --- a/x-pack/test_serverless/functional/test_suites/search/navigation.ts +++ b/x-pack/test_serverless/functional/test_suites/search/navigation.ts @@ -130,21 +130,6 @@ export default function ({ getPageObject, getService }: FtrProviderContext) { await solutionNavigation.breadcrumbs.expectBreadcrumbExists({ deepLinkId: 'dashboards', }); - // check Other tools - // > Maps - await solutionNavigation.sidenav.clickLink({ - deepLinkId: 'maps', - }); - await solutionNavigation.sidenav.expectLinkActive({ - deepLinkId: 'maps', - }); - await solutionNavigation.breadcrumbs.expectBreadcrumbExists({ text: 'Other tools' }); - await solutionNavigation.breadcrumbs.expectBreadcrumbExists({ - text: 'Maps', - }); - await solutionNavigation.breadcrumbs.expectBreadcrumbExists({ - deepLinkId: 'maps', - }); // check Getting Started await solutionNavigation.sidenav.clickLink({ diff --git a/x-pack/test_serverless/functional/test_suites/search/search_index_detail.ts b/x-pack/test_serverless/functional/test_suites/search/search_index_detail.ts index e7831d1f91b3a..fae3abc3ad8d2 100644 --- a/x-pack/test_serverless/functional/test_suites/search/search_index_detail.ts +++ b/x-pack/test_serverless/functional/test_suites/search/search_index_detail.ts @@ -25,9 +25,6 @@ export default function ({ getPageObjects, getService }: FtrProviderContext) { const indexName = 'test-my-index'; describe('Search index detail page', function () { - // fails on MKI, see https://github.com/elastic/kibana/issues/196981 - this.tags(['failsOnMKI']); - before(async () => { await pageObjects.svlCommonPage.loginWithRole('developer'); await pageObjects.svlApiKeys.deleteAPIKeys(); @@ -120,6 +117,9 @@ export default function ({ getPageObjects, getService }: FtrProviderContext) { }); await svlSearchNavigation.navigateToIndexDetailPage(indexName); }); + it('should have index documents', async () => { + await pageObjects.svlSearchIndexDetailPage.expectHasIndexDocuments(); + }); it('menu action item should be replaced with playground', async () => { await pageObjects.svlSearchIndexDetailPage.expectActionItemReplacedWhenHasDocs(); }); @@ -127,9 +127,6 @@ export default function ({ getPageObjects, getService }: FtrProviderContext) { await pageObjects.svlSearchIndexDetailPage.clickMoreOptionsActionsButton(); await pageObjects.svlSearchIndexDetailPage.expectAPIReferenceDocLinkExistsInMoreOptions(); }); - it('should have index documents', async () => { - await pageObjects.svlSearchIndexDetailPage.expectHasIndexDocuments(); - }); it('should have one document in quick stats', async () => { await pageObjects.svlSearchIndexDetailPage.expectQuickStatsToHaveDocumentCount(1); });