From 13e87b25587bdc7d9e63488d73004137f5233dae Mon Sep 17 00:00:00 2001 From: Lee Drengenberg Date: Mon, 1 Aug 2022 17:58:44 -0500 Subject: [PATCH 1/4] don't use es_archiver/empty_kibana, speed up steps --- .../apps/getting_started/_shakespeare.ts | 10 +++---- test/functional/page_objects/settings_page.ts | 26 +++++++++---------- test/functional/services/listing_table.ts | 16 ++++++------ 3 files changed, 24 insertions(+), 28 deletions(-) diff --git a/test/functional/apps/getting_started/_shakespeare.ts b/test/functional/apps/getting_started/_shakespeare.ts index 8cdf4a5f2ff76e..43294c380149fa 100644 --- a/test/functional/apps/getting_started/_shakespeare.ts +++ b/test/functional/apps/getting_started/_shakespeare.ts @@ -42,15 +42,10 @@ export default function ({ getService, getPageObjects }: FtrProviderContext) { let isNewChartsLibraryEnabled = true; before(async function () { - log.debug( - 'Load empty_kibana and Shakespeare Getting Started data\n' + - 'https://www.elastic.co/guide/en/kibana/current/tutorial-load-dataset.html' - ); + log.debug('https://www.elastic.co/guide/en/kibana/current/tutorial-load-dataset.html'); isNewChartsLibraryEnabled = await PageObjects.visChart.isNewChartsLibraryEnabled(); await security.testUser.setRoles(['kibana_admin', 'test_shakespeare_reader']); - await esArchiver.load('test/functional/fixtures/es_archiver/empty_kibana', { - skipExisting: true, - }); + await kibanaServer.savedObjects.cleanStandardList(); log.debug('Load shakespeare data'); await esArchiver.loadIfNeeded( 'test/functional/fixtures/es_archiver/getting_started/shakespeare' @@ -67,6 +62,7 @@ export default function ({ getService, getPageObjects }: FtrProviderContext) { after(async () => { await security.testUser.restoreDefaults(); await esArchiver.unload('test/functional/fixtures/es_archiver/getting_started/shakespeare'); + kibanaServer.savedObjects.cleanStandardList(); await kibanaServer.uiSettings.replace({}); }); diff --git a/test/functional/page_objects/settings_page.ts b/test/functional/page_objects/settings_page.ts index 0d6549b2e46b37..d929c96e163e24 100644 --- a/test/functional/page_objects/settings_page.ts +++ b/test/functional/page_objects/settings_page.ts @@ -453,20 +453,20 @@ export class SettingsPageObject extends FtrService { await this.retry.try(async () => { await this.header.waitUntilLoadingHasFinished(); await this.clickKibanaIndexPatterns(); - const exists = await this.hasIndexPattern(indexPatternName); - - if (exists) { - await this.clickIndexPatternByName(indexPatternName); - return; - } - - await this.header.waitUntilLoadingHasFinished(); - const flyOut = await this.testSubjects.exists('createAnyway'); - if (flyOut) { - await this.testSubjects.click('createAnyway'); - } else { + // const exists = await this.hasIndexPattern(indexPatternName); + + // if (exists) { + // await this.clickIndexPatternByName(indexPatternName); + // return; + // } + + // await this.header.waitUntilLoadingHasFinished(); + // const flyOut = await this.testSubjects.exists('createAnyway'); + // if (flyOut) { + // await this.testSubjects.click('createAnyway'); + // } else { await this.clickAddNewIndexPatternButton(); - } + // } await this.header.waitUntilLoadingHasFinished(); if (!isStandardIndexPattern) { await this.selectRollupIndexPatternType(); diff --git a/test/functional/services/listing_table.ts b/test/functional/services/listing_table.ts index 1cd4249df5050c..4f872bba047731 100644 --- a/test/functional/services/listing_table.ts +++ b/test/functional/services/listing_table.ts @@ -184,15 +184,15 @@ export class ListingTableService extends FtrService { */ public async clickNewButton(promptBtnTestSubj: string): Promise { await this.retry.tryForTime(20000, async () => { - // newItemButton button is only visible when there are items in the listing table is displayed. - const isnNewItemButtonPresent = await this.testSubjects.exists('newItemButton', { - timeout: 10000, - }); - if (isnNewItemButtonPresent) { - await this.testSubjects.click('newItemButton'); + const landingPageElement = await this.testSubjects.find('visualizationLandingPage'); + const landingPageText = await landingPageElement.getVisibleText(); + // NOTE: It's much faster to get the landing page parent, get the innerHTML and check + // which button it has compared to looking for an element and waiting for the timeout + // But do we have i18n tests for this page which would fail if it's localized? + if (landingPageText.includes('Create your first visualization')) { + await this.testSubjects.click('createVisualizationPromptButton'); } else { - // no items exist, click createPromptButton to create new dashboard/visualization - await this.testSubjects.click(promptBtnTestSubj); + await this.testSubjects.click('newItemButton'); } }); } From 272c495c578376d0453badb4a57d0c9369991903 Mon Sep 17 00:00:00 2001 From: kibanamachine <42973632+kibanamachine@users.noreply.github.com> Date: Mon, 1 Aug 2022 23:06:45 +0000 Subject: [PATCH 2/4] [CI] Auto-commit changed files from 'node scripts/precommit_hook.js --ref HEAD~1..HEAD --fix' --- test/functional/page_objects/settings_page.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/functional/page_objects/settings_page.ts b/test/functional/page_objects/settings_page.ts index d929c96e163e24..57ef24fd1ec394 100644 --- a/test/functional/page_objects/settings_page.ts +++ b/test/functional/page_objects/settings_page.ts @@ -465,7 +465,7 @@ export class SettingsPageObject extends FtrService { // if (flyOut) { // await this.testSubjects.click('createAnyway'); // } else { - await this.clickAddNewIndexPatternButton(); + await this.clickAddNewIndexPatternButton(); // } await this.header.waitUntilLoadingHasFinished(); if (!isStandardIndexPattern) { From f5083ecb51d00c427846d51c6e33213374cb06f5 Mon Sep 17 00:00:00 2001 From: Lee Drengenberg Date: Tue, 2 Aug 2022 11:19:37 -0500 Subject: [PATCH 3/4] revert change to listing page --- test/functional/services/listing_table.ts | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/test/functional/services/listing_table.ts b/test/functional/services/listing_table.ts index 4f872bba047731..1cd4249df5050c 100644 --- a/test/functional/services/listing_table.ts +++ b/test/functional/services/listing_table.ts @@ -184,15 +184,15 @@ export class ListingTableService extends FtrService { */ public async clickNewButton(promptBtnTestSubj: string): Promise { await this.retry.tryForTime(20000, async () => { - const landingPageElement = await this.testSubjects.find('visualizationLandingPage'); - const landingPageText = await landingPageElement.getVisibleText(); - // NOTE: It's much faster to get the landing page parent, get the innerHTML and check - // which button it has compared to looking for an element and waiting for the timeout - // But do we have i18n tests for this page which would fail if it's localized? - if (landingPageText.includes('Create your first visualization')) { - await this.testSubjects.click('createVisualizationPromptButton'); - } else { + // newItemButton button is only visible when there are items in the listing table is displayed. + const isnNewItemButtonPresent = await this.testSubjects.exists('newItemButton', { + timeout: 10000, + }); + if (isnNewItemButtonPresent) { await this.testSubjects.click('newItemButton'); + } else { + // no items exist, click createPromptButton to create new dashboard/visualization + await this.testSubjects.click(promptBtnTestSubj); } }); } From 72b1e4820dcaa96b7e19f29bc0bb9b1bd0d6bd79 Mon Sep 17 00:00:00 2001 From: Lee Drengenberg Date: Tue, 2 Aug 2022 13:34:25 -0500 Subject: [PATCH 4/4] revert this change and do in another PR --- test/functional/page_objects/settings_page.ts | 28 +++++++++---------- 1 file changed, 14 insertions(+), 14 deletions(-) diff --git a/test/functional/page_objects/settings_page.ts b/test/functional/page_objects/settings_page.ts index 57ef24fd1ec394..0d6549b2e46b37 100644 --- a/test/functional/page_objects/settings_page.ts +++ b/test/functional/page_objects/settings_page.ts @@ -453,20 +453,20 @@ export class SettingsPageObject extends FtrService { await this.retry.try(async () => { await this.header.waitUntilLoadingHasFinished(); await this.clickKibanaIndexPatterns(); - // const exists = await this.hasIndexPattern(indexPatternName); - - // if (exists) { - // await this.clickIndexPatternByName(indexPatternName); - // return; - // } - - // await this.header.waitUntilLoadingHasFinished(); - // const flyOut = await this.testSubjects.exists('createAnyway'); - // if (flyOut) { - // await this.testSubjects.click('createAnyway'); - // } else { - await this.clickAddNewIndexPatternButton(); - // } + const exists = await this.hasIndexPattern(indexPatternName); + + if (exists) { + await this.clickIndexPatternByName(indexPatternName); + return; + } + + await this.header.waitUntilLoadingHasFinished(); + const flyOut = await this.testSubjects.exists('createAnyway'); + if (flyOut) { + await this.testSubjects.click('createAnyway'); + } else { + await this.clickAddNewIndexPatternButton(); + } await this.header.waitUntilLoadingHasFinished(); if (!isStandardIndexPattern) { await this.selectRollupIndexPatternType();