make inserting timestamp with navigate methods optional with default true (#64655)

This commit is contained in:
Lee Drengenberg 2020-04-29 19:05:45 +00:00 committed by GitHub
parent 53ff22997a
commit f5a8d8e6c2
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -44,6 +44,7 @@ export function CommonPageProvider({ getService, getPageObjects }: FtrProviderCo
ensureCurrentUrl: boolean; ensureCurrentUrl: boolean;
shouldLoginIfPrompted: boolean; shouldLoginIfPrompted: boolean;
useActualUrl: boolean; useActualUrl: boolean;
insertTimestamp: boolean;
} }
class CommonPage { class CommonPage {
@ -65,7 +66,7 @@ export function CommonPageProvider({ getService, getPageObjects }: FtrProviderCo
* Logins to Kibana as default user and navigates to provided app * Logins to Kibana as default user and navigates to provided app
* @param appUrl Kibana URL * @param appUrl Kibana URL
*/ */
private async loginIfPrompted(appUrl: string) { private async loginIfPrompted(appUrl: string, insertTimestamp: boolean) {
let currentUrl = await browser.getCurrentUrl(); let currentUrl = await browser.getCurrentUrl();
log.debug(`currentUrl = ${currentUrl}\n appUrl = ${appUrl}`); log.debug(`currentUrl = ${currentUrl}\n appUrl = ${appUrl}`);
await testSubjects.find('kibanaChrome', 6 * defaultFindTimeout); // 60 sec waiting await testSubjects.find('kibanaChrome', 6 * defaultFindTimeout); // 60 sec waiting
@ -87,7 +88,7 @@ export function CommonPageProvider({ getService, getPageObjects }: FtrProviderCo
'[data-test-subj="kibanaChrome"] nav:not(.ng-hide)', '[data-test-subj="kibanaChrome"] nav:not(.ng-hide)',
6 * defaultFindTimeout 6 * defaultFindTimeout
); );
await browser.get(appUrl); await browser.get(appUrl, insertTimestamp);
currentUrl = await browser.getCurrentUrl(); currentUrl = await browser.getCurrentUrl();
log.debug(`Finished login process currentUrl = ${currentUrl}`); log.debug(`Finished login process currentUrl = ${currentUrl}`);
} }
@ -95,7 +96,13 @@ export function CommonPageProvider({ getService, getPageObjects }: FtrProviderCo
} }
private async navigate(navigateProps: NavigateProps) { private async navigate(navigateProps: NavigateProps) {
const { appConfig, ensureCurrentUrl, shouldLoginIfPrompted, useActualUrl } = navigateProps; const {
appConfig,
ensureCurrentUrl,
shouldLoginIfPrompted,
useActualUrl,
insertTimestamp,
} = navigateProps;
const appUrl = getUrl.noAuth(config.get('servers.kibana'), appConfig); const appUrl = getUrl.noAuth(config.get('servers.kibana'), appConfig);
await retry.try(async () => { await retry.try(async () => {
@ -111,7 +118,7 @@ export function CommonPageProvider({ getService, getPageObjects }: FtrProviderCo
} }
const currentUrl = shouldLoginIfPrompted const currentUrl = shouldLoginIfPrompted
? await this.loginIfPrompted(appUrl) ? await this.loginIfPrompted(appUrl, insertTimestamp)
: await browser.getCurrentUrl(); : await browser.getCurrentUrl();
if (ensureCurrentUrl && !currentUrl.includes(appUrl)) { if (ensureCurrentUrl && !currentUrl.includes(appUrl)) {
@ -134,6 +141,7 @@ export function CommonPageProvider({ getService, getPageObjects }: FtrProviderCo
ensureCurrentUrl = true, ensureCurrentUrl = true,
shouldLoginIfPrompted = true, shouldLoginIfPrompted = true,
useActualUrl = false, useActualUrl = false,
insertTimestamp = true,
} = {} } = {}
) { ) {
const appConfig = { const appConfig = {
@ -146,6 +154,7 @@ export function CommonPageProvider({ getService, getPageObjects }: FtrProviderCo
ensureCurrentUrl, ensureCurrentUrl,
shouldLoginIfPrompted, shouldLoginIfPrompted,
useActualUrl, useActualUrl,
insertTimestamp,
}); });
} }
@ -165,6 +174,7 @@ export function CommonPageProvider({ getService, getPageObjects }: FtrProviderCo
ensureCurrentUrl = true, ensureCurrentUrl = true,
shouldLoginIfPrompted = true, shouldLoginIfPrompted = true,
useActualUrl = true, useActualUrl = true,
insertTimestamp = true,
} = {} } = {}
) { ) {
const appConfig = { const appConfig = {
@ -178,6 +188,7 @@ export function CommonPageProvider({ getService, getPageObjects }: FtrProviderCo
ensureCurrentUrl, ensureCurrentUrl,
shouldLoginIfPrompted, shouldLoginIfPrompted,
useActualUrl, useActualUrl,
insertTimestamp,
}); });
} }
@ -208,7 +219,7 @@ export function CommonPageProvider({ getService, getPageObjects }: FtrProviderCo
async navigateToApp( async navigateToApp(
appName: string, appName: string,
{ basePath = '', shouldLoginIfPrompted = true, hash = '' } = {} { basePath = '', shouldLoginIfPrompted = true, hash = '', insertTimestamp = true } = {}
) { ) {
let appUrl: string; let appUrl: string;
if (config.has(['apps', appName])) { if (config.has(['apps', appName])) {
@ -239,7 +250,7 @@ export function CommonPageProvider({ getService, getPageObjects }: FtrProviderCo
log.debug('returned from get, calling refresh'); log.debug('returned from get, calling refresh');
await browser.refresh(); await browser.refresh();
let currentUrl = shouldLoginIfPrompted let currentUrl = shouldLoginIfPrompted
? await this.loginIfPrompted(appUrl) ? await this.loginIfPrompted(appUrl, insertTimestamp)
: await browser.getCurrentUrl(); : await browser.getCurrentUrl();
if (currentUrl.includes('app/kibana')) { if (currentUrl.includes('app/kibana')) {