diff --git a/test/functional/page_objects/common_page.ts b/test/functional/page_objects/common_page.ts index fc7860eecc83..861dc187d5b9 100644 --- a/test/functional/page_objects/common_page.ts +++ b/test/functional/page_objects/common_page.ts @@ -47,37 +47,6 @@ export function CommonPageProvider({ getService, getPageObjects }: FtrProviderCo } class CommonPage { - /** - * Navigates the browser window to provided URL - * @param url URL - * @param shouldAcceptAlert pass 'true' if browser alert should be accepted - */ - private static async navigateToUrlAndHandleAlert(url: string, shouldAcceptAlert: boolean) { - log.debug('Navigate to: ' + url); - try { - await browser.get(url); - } catch (navigationError) { - log.debug('Error navigating to url'); - const alert = await browser.getAlert(); - if (alert && alert.accept) { - if (shouldAcceptAlert) { - log.debug('Should accept alert'); - try { - await alert.accept(); - } catch (alertException) { - log.debug('Error accepting alert'); - throw alertException; - } - } else { - log.debug('Will not accept alert'); - throw navigationError; - } - } else { - throw navigationError; - } - } - } - /** * Returns Kibana host URL */ @@ -136,7 +105,8 @@ export function CommonPageProvider({ getService, getPageObjects }: FtrProviderCo } else { log.debug(`navigateToUrl ${appUrl}`); await browser.get(appUrl); - // await CommonPage.navigateToUrlAndHandleAlert(appUrl, shouldAcceptAlert); + const alert = await browser.getAlert(); + await alert?.accept(); } const currentUrl = shouldLoginIfPrompted @@ -261,7 +231,8 @@ export function CommonPageProvider({ getService, getPageObjects }: FtrProviderCo // since we're using hash URLs, always reload first to force re-render log.debug('navigate to: ' + appUrl); await browser.get(appUrl); - // await CommonPage.navigateToUrlAndHandleAlert(appUrl, shouldAcceptAlert); + const alert = await browser.getAlert(); + await alert?.accept(); await this.sleep(700); log.debug('returned from get, calling refresh'); await browser.refresh(); diff --git a/test/plugin_functional/test_suites/core_plugins/application_leave_confirm.ts b/test/plugin_functional/test_suites/core_plugins/application_leave_confirm.ts index 7dfc7d53fbfa..f892e52754c5 100644 --- a/test/plugin_functional/test_suites/core_plugins/application_leave_confirm.ts +++ b/test/plugin_functional/test_suites/core_plugins/application_leave_confirm.ts @@ -47,8 +47,6 @@ export default function({ getService, getPageObjects }: PluginFunctionalProvider expect(await browser.getCurrentUrl()).to.eql(getKibanaUrl('/app/appleave1')); }); it('allows navigation if user click confirm on the confirmation dialog', async () => { - const alert = await browser.getAlert(); - await alert?.accept(); await PageObjects.common.navigateToApp('appleave1'); await appsMenu.clickLink('AppLeave 2');