From 1c929f3e28716c6b32a4e040ed3d197025934437 Mon Sep 17 00:00:00 2001 From: Matt Kime Date: Tue, 28 Apr 2020 15:12:45 -0500 Subject: [PATCH 1/4] restore index pattern management data-test-subj's --- .../edit_index_pattern/tabs/utils.ts | 3 +++ test/functional/page_objects/settings_page.ts | 16 +++++++--------- 2 files changed, 10 insertions(+), 9 deletions(-) diff --git a/src/legacy/core_plugins/kibana/public/management/sections/index_patterns/edit_index_pattern/tabs/utils.ts b/src/legacy/core_plugins/kibana/public/management/sections/index_patterns/edit_index_pattern/tabs/utils.ts index bdb1436c37efb..57d1552e5a0d0 100644 --- a/src/legacy/core_plugins/kibana/public/management/sections/index_patterns/edit_index_pattern/tabs/utils.ts +++ b/src/legacy/core_plugins/kibana/public/management/sections/index_patterns/edit_index_pattern/tabs/utils.ts @@ -96,18 +96,21 @@ export function getTabs( tabs.push({ name: getTitle('indexed', filteredCount, totalCount), id: TAB_INDEXED_FIELDS, + 'data-test-subj': 'tab-indexFields', }); if (indexPatternListProvider.areScriptedFieldsEnabled(indexPattern)) { tabs.push({ name: getTitle('scripted', filteredCount, totalCount), id: TAB_SCRIPTED_FIELDS, + 'data-test-subj': 'tab-scriptedFields', }); } tabs.push({ name: getTitle('sourceFilters', filteredCount, totalCount), id: TAB_SOURCE_FILTERS, + 'data-test-subj': 'tab-sourceFilters', }); return tabs; diff --git a/test/functional/page_objects/settings_page.ts b/test/functional/page_objects/settings_page.ts index 8864eda3823ef..f5d073f63335f 100644 --- a/test/functional/page_objects/settings_page.ts +++ b/test/functional/page_objects/settings_page.ts @@ -206,17 +206,15 @@ export function SettingsPageProvider({ getService, getPageObjects }: FtrProvider async getFieldsTabCount() { return retry.try(async () => { - const indexedFieldsTab = await find.byCssSelector('#indexedFields .euiTab__content'); - const text = await indexedFieldsTab.getVisibleText(); - return text.split(/[()]/)[1]; + const text = await testSubjects.getVisibleText('tab-indexedFields'); + return text.replace(/\((.*)\)/, '$1'); }); } async getScriptedFieldsTabCount() { return await retry.try(async () => { - const scriptedFieldsTab = await find.byCssSelector('#scriptedFields .euiTab__content'); - const text = await scriptedFieldsTab.getVisibleText(); - return text.split(/[()]/)[1]; + const theText = await testSubjects.getVisibleText('tab-scriptedFields'); + return theText.replace(/\((.*)\)/, '$1'); }); } @@ -414,17 +412,17 @@ export function SettingsPageProvider({ getService, getPageObjects }: FtrProvider async clickFieldsTab() { log.debug('click Fields tab'); - await find.clickByCssSelector('#indexedFields'); + await testSubjects.click('tab-indexFields'); } async clickScriptedFieldsTab() { log.debug('click Scripted Fields tab'); - await find.clickByCssSelector('#scriptedFields'); + await testSubjects.click('tab-scriptedFields'); } async clickSourceFiltersTab() { log.debug('click Source Filters tab'); - await find.clickByCssSelector('#sourceFilters'); + await testSubjects.click('tab-sourceFilters'); } async editScriptedField(name: string) { From bc2340e44fe3eb1c0e536d8c319e4b8b3edf84a2 Mon Sep 17 00:00:00 2001 From: Matt Kime Date: Mon, 4 May 2020 10:39:03 -0500 Subject: [PATCH 2/4] fix data-test-subj and related test --- .../sections/index_patterns/edit_index_pattern/tabs/utils.ts | 2 +- test/functional/page_objects/settings_page.ts | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/legacy/core_plugins/kibana/public/management/sections/index_patterns/edit_index_pattern/tabs/utils.ts b/src/legacy/core_plugins/kibana/public/management/sections/index_patterns/edit_index_pattern/tabs/utils.ts index 57d1552e5a0d0..83335a6fabfeb 100644 --- a/src/legacy/core_plugins/kibana/public/management/sections/index_patterns/edit_index_pattern/tabs/utils.ts +++ b/src/legacy/core_plugins/kibana/public/management/sections/index_patterns/edit_index_pattern/tabs/utils.ts @@ -96,7 +96,7 @@ export function getTabs( tabs.push({ name: getTitle('indexed', filteredCount, totalCount), id: TAB_INDEXED_FIELDS, - 'data-test-subj': 'tab-indexFields', + 'data-test-subj': 'tab-indexedFields', }); if (indexPatternListProvider.areScriptedFieldsEnabled(indexPattern)) { diff --git a/test/functional/page_objects/settings_page.ts b/test/functional/page_objects/settings_page.ts index f66fff4ec0965..6024554755aca 100644 --- a/test/functional/page_objects/settings_page.ts +++ b/test/functional/page_objects/settings_page.ts @@ -207,7 +207,7 @@ export function SettingsPageProvider({ getService, getPageObjects }: FtrProvider async getFieldsTabCount() { return retry.try(async () => { const text = await testSubjects.getVisibleText('tab-indexedFields'); - return text.replace(/\((.*)\)/, '$1'); + return text.split(' ')[1].replace(/\((.*)\)/, '$1'); }); } From f25dc5bf591376c1de721c9efc7cb8177759cfd1 Mon Sep 17 00:00:00 2001 From: Matt Kime Date: Mon, 4 May 2020 21:57:49 -0500 Subject: [PATCH 3/4] update parsing of scripted field count but not yet working --- test/functional/page_objects/settings_page.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/test/functional/page_objects/settings_page.ts b/test/functional/page_objects/settings_page.ts index 6024554755aca..0566307723bcf 100644 --- a/test/functional/page_objects/settings_page.ts +++ b/test/functional/page_objects/settings_page.ts @@ -214,7 +214,7 @@ export function SettingsPageProvider({ getService, getPageObjects }: FtrProvider async getScriptedFieldsTabCount() { return await retry.try(async () => { const theText = await testSubjects.getVisibleText('tab-scriptedFields'); - return theText.replace(/\((.*)\)/, '$1'); + return theText.split(' ')[1].replace(/\((.*)\)/, '$1'); }); } @@ -430,7 +430,7 @@ export function SettingsPageProvider({ getService, getPageObjects }: FtrProvider async clickFieldsTab() { log.debug('click Fields tab'); - await testSubjects.click('tab-indexFields'); + await testSubjects.click('tab-indexedFields'); } async clickScriptedFieldsTab() { From 5f63f7b367332b641ccd30241bb03c06152181b6 Mon Sep 17 00:00:00 2001 From: Alexey Antonov Date: Fri, 8 May 2020 14:10:16 +0300 Subject: [PATCH 4/4] fix CI --- test/functional/page_objects/settings_page.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/test/functional/page_objects/settings_page.ts b/test/functional/page_objects/settings_page.ts index 9d7bac318cd7a..b8069b31257d3 100644 --- a/test/functional/page_objects/settings_page.ts +++ b/test/functional/page_objects/settings_page.ts @@ -213,8 +213,8 @@ export function SettingsPageProvider({ getService, getPageObjects }: FtrProvider async getScriptedFieldsTabCount() { return await retry.try(async () => { - const theText = await testSubjects.getVisibleText('tab-scriptedFields'); - return theText.split(' ')[1].replace(/\((.*)\)/, '$1'); + const text = await testSubjects.getVisibleText('tab-scriptedFields'); + return text.split(' ')[2].replace(/\((.*)\)/, '$1'); }); }