From 80a85e9f51124e3e1395057fe26340dd4cfa131a Mon Sep 17 00:00:00 2001 From: CJ Cenizal Date: Wed, 25 Jul 2018 13:02:03 -0700 Subject: [PATCH 1/7] Verify that we've navigated to Settings by checking the title. --- .../public/management/sections/settings/advanced_settings.js | 2 +- test/functional/page_objects/settings_page.js | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/core_plugins/kibana/public/management/sections/settings/advanced_settings.js b/src/core_plugins/kibana/public/management/sections/settings/advanced_settings.js index 2ecc931906841..7899bbd2b0681 100644 --- a/src/core_plugins/kibana/public/management/sections/settings/advanced_settings.js +++ b/src/core_plugins/kibana/public/management/sections/settings/advanced_settings.js @@ -137,7 +137,7 @@ export class AdvancedSettings extends Component { -

Settings

+

Settings

diff --git a/test/functional/page_objects/settings_page.js b/test/functional/page_objects/settings_page.js index ce42b6e4dff35..cc1a584303d84 100644 --- a/test/functional/page_objects/settings_page.js +++ b/test/functional/page_objects/settings_page.js @@ -45,7 +45,7 @@ export function SettingsPageProvider({ getService, getPageObjects }) { async clickKibanaSettings() { await this.clickLinkText('Advanced Settings'); - await PageObjects.header.waitUntilLoadingHasFinished(); + await testSubjects.exists('managementSettingsTitle'); } async clickKibanaSavedObjects() { From 97f137131e5b0a39a8d720e8ac823c1e04fc8dd5 Mon Sep 17 00:00:00 2001 From: CJ Cenizal Date: Wed, 25 Jul 2018 15:52:31 -0700 Subject: [PATCH 2/7] Update snapshot. --- .../settings/__snapshots__/advanced_settings.test.js.snap | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/core_plugins/kibana/public/management/sections/settings/__snapshots__/advanced_settings.test.js.snap b/src/core_plugins/kibana/public/management/sections/settings/__snapshots__/advanced_settings.test.js.snap index 08e105b50d295..bfde665a6e5dc 100644 --- a/src/core_plugins/kibana/public/management/sections/settings/__snapshots__/advanced_settings.test.js.snap +++ b/src/core_plugins/kibana/public/management/sections/settings/__snapshots__/advanced_settings.test.js.snap @@ -20,7 +20,9 @@ exports[`AdvancedSettings should render normally 1`] = ` -

+

Settings

@@ -253,7 +255,9 @@ exports[`AdvancedSettings should render specific setting if given setting key 1` -

+

Settings

From f4535f4f34ecc3a2eda5031eebabd6c34c58c5de Mon Sep 17 00:00:00 2001 From: CJ Cenizal Date: Thu, 26 Jul 2018 10:27:42 -0700 Subject: [PATCH 3/7] Fail the consuming test if navigation to settings is unsuccessful. --- test/functional/page_objects/settings_page.js | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/test/functional/page_objects/settings_page.js b/test/functional/page_objects/settings_page.js index cc1a584303d84..d2fad0e3f08ec 100644 --- a/test/functional/page_objects/settings_page.js +++ b/test/functional/page_objects/settings_page.js @@ -17,6 +17,7 @@ * under the License. */ +import expect from 'expect.js'; import { map as mapAsync } from 'bluebird'; export function SettingsPageProvider({ getService, getPageObjects }) { @@ -45,7 +46,11 @@ export function SettingsPageProvider({ getService, getPageObjects }) { async clickKibanaSettings() { await this.clickLinkText('Advanced Settings'); - await testSubjects.exists('managementSettingsTitle'); + const isSettingsLoaded = await testSubjects.exists('managementSettingsTitle'); + + // Verify navigation is successful, or else fail the test consuming this. + expect(isSettingsLoaded).to.be(true); + return isSettingsLoaded; } async clickKibanaSavedObjects() { From 6b9cd4c6aa3efc4381f5f00ba4706a6ed2b38aaf Mon Sep 17 00:00:00 2001 From: CJ Cenizal Date: Thu, 26 Jul 2018 11:49:33 -0700 Subject: [PATCH 4/7] Resolve clickKibanaSettings() with undefined. --- test/functional/page_objects/settings_page.js | 1 - 1 file changed, 1 deletion(-) diff --git a/test/functional/page_objects/settings_page.js b/test/functional/page_objects/settings_page.js index d2fad0e3f08ec..1ce1b18990a46 100644 --- a/test/functional/page_objects/settings_page.js +++ b/test/functional/page_objects/settings_page.js @@ -50,7 +50,6 @@ export function SettingsPageProvider({ getService, getPageObjects }) { // Verify navigation is successful, or else fail the test consuming this. expect(isSettingsLoaded).to.be(true); - return isSettingsLoaded; } async clickKibanaSavedObjects() { From c8bfdb55c5464c8b76cc8f689a8df6a70e118149 Mon Sep 17 00:00:00 2001 From: CJ Cenizal Date: Thu, 26 Jul 2018 12:48:40 -0700 Subject: [PATCH 5/7] Add testSubjects.existOrFail helper. --- test/functional/apps/visualize/index.js | 2 +- test/functional/page_objects/settings_page.js | 7 ++----- test/functional/services/test_subjects.js | 9 +++++++++ 3 files changed, 12 insertions(+), 6 deletions(-) diff --git a/test/functional/apps/visualize/index.js b/test/functional/apps/visualize/index.js index 3fcbb55229623..23558f0956a8c 100644 --- a/test/functional/apps/visualize/index.js +++ b/test/functional/apps/visualize/index.js @@ -53,6 +53,6 @@ export default function ({ getService, loadTestFile }) { loadTestFile(require.resolve('./_histogram_request_start')); loadTestFile(require.resolve('./_vega_chart')); loadTestFile(require.resolve('./_lab_mode')); - loadTestFile(require.resolve('./_linked_saved_searches.js')); + // loadTestFile(require.resolve('./_linked_saved_searches.js')); }); } diff --git a/test/functional/page_objects/settings_page.js b/test/functional/page_objects/settings_page.js index 1ce1b18990a46..8781f3eddab86 100644 --- a/test/functional/page_objects/settings_page.js +++ b/test/functional/page_objects/settings_page.js @@ -17,7 +17,6 @@ * under the License. */ -import expect from 'expect.js'; import { map as mapAsync } from 'bluebird'; export function SettingsPageProvider({ getService, getPageObjects }) { @@ -46,10 +45,8 @@ export function SettingsPageProvider({ getService, getPageObjects }) { async clickKibanaSettings() { await this.clickLinkText('Advanced Settings'); - const isSettingsLoaded = await testSubjects.exists('managementSettingsTitle'); - - // Verify navigation is successful, or else fail the test consuming this. - expect(isSettingsLoaded).to.be(true); + // Verify navigation is successful. + await testSubjects.existOrFail('managementSettingsTitle'); } async clickKibanaSavedObjects() { diff --git a/test/functional/services/test_subjects.js b/test/functional/services/test_subjects.js index 9a614a1acbdc2..0f7b29a626caf 100644 --- a/test/functional/services/test_subjects.js +++ b/test/functional/services/test_subjects.js @@ -17,6 +17,7 @@ * under the License. */ +import expect from 'expect.js'; import testSubjSelector from '@kbn/test-subj-selector'; import { filter as filterAsync, @@ -37,6 +38,14 @@ export function TestSubjectsProvider({ getService }) { return await find.existsByDisplayedByCssSelector(testSubjSelector(selector), timeout); } + async existOrFail(selector, timeout = 1000) { + log.debug(`TestSubjects.existOrFail(${selector})`); + const doesExist = await find.existsByDisplayedByCssSelector(testSubjSelector(selector), timeout); + + // Verify element exists, or else fail the test consuming this. + expect(doesExist).to.be(true); + } + async append(selector, text) { return await retry.try(async () => { const input = await this.find(selector); From 68ee31725b307554e445e3b54582716f3509eb62 Mon Sep 17 00:00:00 2001 From: CJ Cenizal Date: Thu, 26 Jul 2018 13:00:29 -0700 Subject: [PATCH 6/7] Simplify existsOrFail. --- test/functional/services/test_subjects.js | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/test/functional/services/test_subjects.js b/test/functional/services/test_subjects.js index 0f7b29a626caf..06de796fba72f 100644 --- a/test/functional/services/test_subjects.js +++ b/test/functional/services/test_subjects.js @@ -40,8 +40,7 @@ export function TestSubjectsProvider({ getService }) { async existOrFail(selector, timeout = 1000) { log.debug(`TestSubjects.existOrFail(${selector})`); - const doesExist = await find.existsByDisplayedByCssSelector(testSubjSelector(selector), timeout); - + const doesExist = await this.exists(selector, timeout); // Verify element exists, or else fail the test consuming this. expect(doesExist).to.be(true); } From 69935c0896439070b430006660c9877efb802601 Mon Sep 17 00:00:00 2001 From: CJ Cenizal Date: Thu, 26 Jul 2018 13:06:39 -0700 Subject: [PATCH 7/7] Uncomment test suite. --- test/functional/apps/visualize/index.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/functional/apps/visualize/index.js b/test/functional/apps/visualize/index.js index 23558f0956a8c..3fcbb55229623 100644 --- a/test/functional/apps/visualize/index.js +++ b/test/functional/apps/visualize/index.js @@ -53,6 +53,6 @@ export default function ({ getService, loadTestFile }) { loadTestFile(require.resolve('./_histogram_request_start')); loadTestFile(require.resolve('./_vega_chart')); loadTestFile(require.resolve('./_lab_mode')); - // loadTestFile(require.resolve('./_linked_saved_searches.js')); + loadTestFile(require.resolve('./_linked_saved_searches.js')); }); }