From 05ccb957826c69ea554a33ead214ca8283c9df80 Mon Sep 17 00:00:00 2001 From: Robert Oskamp Date: Fri, 15 May 2020 11:58:44 +0200 Subject: [PATCH 1/3] Move welcome screen disabling to common page --- test/functional/page_objects/common_page.ts | 7 +++++++ x-pack/test/functional/page_objects/security_page.js | 4 ---- 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/test/functional/page_objects/common_page.ts b/test/functional/page_objects/common_page.ts index aefb1e8ee1620..0671f26ecd149 100644 --- a/test/functional/page_objects/common_page.ts +++ b/test/functional/page_objects/common_page.ts @@ -73,6 +73,13 @@ export function CommonPageProvider({ getService, getPageObjects }: FtrProviderCo const loginPage = currentUrl.includes('/login'); const wantedLoginPage = appUrl.includes('/login') || appUrl.includes('/logout'); + // Disable the welcome screen if the corresponding environment variable is set + // This is relevant for environments which don't allow to use the yml setting, e.g. cloud production + // It is done here so it applies to logins but also to a login re-use + if (process.env.DISABLE_WELCOME_SCREEN) { + await browser.setLocalStorageItem('home:welcome:show', 'false'); + } + if (loginPage && !wantedLoginPage) { log.debug('Found login page'); if (config.get('security.disableTestUser')) { diff --git a/x-pack/test/functional/page_objects/security_page.js b/x-pack/test/functional/page_objects/security_page.js index ae26a831d4172..bddadcce12e1f 100644 --- a/x-pack/test/functional/page_objects/security_page.js +++ b/x-pack/test/functional/page_objects/security_page.js @@ -31,10 +31,6 @@ export function SecurityPageProvider({ getService, getPageObjects }) { await PageObjects.common.navigateToApp('login'); - // ensure welcome screen won't be shown. This is relevant for environments which don't allow - // to use the yml setting, e.g. cloud - await browser.setLocalStorageItem('home:welcome:show', 'false'); - await testSubjects.setValue('loginUsername', username); await testSubjects.setValue('loginPassword', password); await testSubjects.click('loginSubmit'); From a38a39deee77034e95b3af800ef3cf603c373645 Mon Sep 17 00:00:00 2001 From: Robert Oskamp Date: Mon, 18 May 2020 13:43:02 +0200 Subject: [PATCH 2/3] Add security_page code back in --- x-pack/test/functional/page_objects/security_page.ts | 3 +++ 1 file changed, 3 insertions(+) diff --git a/x-pack/test/functional/page_objects/security_page.ts b/x-pack/test/functional/page_objects/security_page.ts index d2462faa2c4f0..ac549fff12e65 100644 --- a/x-pack/test/functional/page_objects/security_page.ts +++ b/x-pack/test/functional/page_objects/security_page.ts @@ -108,6 +108,9 @@ export function SecurityPageProvider({ getService, getPageObjects }: FtrProvider async login(username?: string, password?: string, options: LoginOptions = {}) { await PageObjects.common.navigateToApp('login'); + // ensure welcome screen won't be shown. This is relevant for environments which don't allow + // to use the yml setting, e.g. cloud + await browser.setLocalStorageItem('home:welcome:show', 'false'); await waitForLoginForm(); const [superUsername, superPassword] = config.get('servers.elasticsearch.auth').split(':'); From 7605062b6e92f0fa387d0595fd78654e4f0dcd34 Mon Sep 17 00:00:00 2001 From: Robert Oskamp Date: Mon, 18 May 2020 13:48:50 +0200 Subject: [PATCH 3/3] Remove environemnt variable --- test/functional/page_objects/common_page.ts | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/test/functional/page_objects/common_page.ts b/test/functional/page_objects/common_page.ts index 2d0dcb9d1f5d6..7810cce5c78bb 100644 --- a/test/functional/page_objects/common_page.ts +++ b/test/functional/page_objects/common_page.ts @@ -73,12 +73,10 @@ export function CommonPageProvider({ getService, getPageObjects }: FtrProviderCo const loginPage = currentUrl.includes('/login'); const wantedLoginPage = appUrl.includes('/login') || appUrl.includes('/logout'); - // Disable the welcome screen if the corresponding environment variable is set - // This is relevant for environments which don't allow to use the yml setting, e.g. cloud production - // It is done here so it applies to logins but also to a login re-use - if (process.env.DISABLE_WELCOME_SCREEN) { - await browser.setLocalStorageItem('home:welcome:show', 'false'); - } + // Disable the welcome screen. This is relevant for environments + // which don't allow to use the yml setting, e.g. cloud production. + // It is done here so it applies to logins but also to a login re-use. + await browser.setLocalStorageItem('home:welcome:show', 'false'); if (loginPage && !wantedLoginPage) { log.debug('Found login page');