From 68a4ed0f103200784b5ab110c2838f80d5a17f9a Mon Sep 17 00:00:00 2001 From: Juan Ferrer Toribio Date: Tue, 24 Mar 2020 11:12:59 +0100 Subject: [PATCH] Some E2E timeouts removed --- e2e/helpers/extensions.js | 17 ++++++++++------- e2e/helpers/puppeteer.js | 17 +++++++++++------ 2 files changed, 21 insertions(+), 13 deletions(-) diff --git a/e2e/helpers/extensions.js b/e2e/helpers/extensions.js index 820a1e1f0e..1ff0119fdf 100644 --- a/e2e/helpers/extensions.js +++ b/e2e/helpers/extensions.js @@ -58,9 +58,9 @@ let actions = { return document.location.hash.includes(expectedHash); }, {}, expectedHash); } catch (error) { - throw new Error(`failed to reach URL containing: ${expectedHash}`); + throw new Error(`Failed to reach URL containing: ${expectedHash}`); } - await this.waitForContentLoaded(); + await this.waitForSpinnerLoad(); return true; }, @@ -123,8 +123,9 @@ let actions = { waitForState: async function(state) { await this.waitFor(state => { let $state = angular.element(document.body).injector().get('$state'); - return $state.is(state); + return !$state.transition && $state.is(state); }, {}, state); + await this.waitForSpinnerLoad(state); }, waitForTransition: async function() { @@ -152,7 +153,6 @@ let actions = { }, state); await this.waitForState(state); - await this.waitForContentLoaded(); }, reloadSection: async function(state) { @@ -172,7 +172,7 @@ let actions = { await this.write('vn-searchbar', searchValue); await this.waitToClick('vn-searchbar vn-icon[icon="search"]'); await this.waitForTransition(); - await this.waitForContentLoaded(); + await this.waitFor('.vn-descriptor'); }, getProperty: async function(selector, property) { @@ -334,7 +334,10 @@ let actions = { }, hideSnackbar: async function() { - await this.waitFor(300); // holds up for the snackbar to be visible for a small period of time. + // Holds up for the snackbar to be visible for a small period of time. + if (process.env.DEBUG) + await this.waitFor(300); + await this.evaluate(() => { let hideButton = document.querySelector('#shapes .shown button'); if (hideButton) @@ -549,7 +552,7 @@ let actions = { }, waitForContentLoaded: async function() { - await this.waitFor(250); + // await this.waitFor(250); } }; diff --git a/e2e/helpers/puppeteer.js b/e2e/helpers/puppeteer.js index 8aa3f72f89..1ea3c1c903 100644 --- a/e2e/helpers/puppeteer.js +++ b/e2e/helpers/puppeteer.js @@ -4,17 +4,22 @@ import {extendPage} from './extensions'; import {url as defaultURL} from './config'; export async function getBrowser() { - let headless = !process.env.E2E_SHOW; + const args = [ + `--no-sandbox`, + `--window-size=${ 1920 },${ 1080 }` + ]; + + if (process.env.DEBUG) + args.push('--auto-open-devtools-for-tabs'); + + const headless = !process.env.E2E_SHOW; const browser = await Puppeteer.launch({ - args: [ - '--no-sandbox', - `--window-size=${ 1920 },${ 1080 }`, - // '--auto-open-devtools-for-tabs' - ], + args, defaultViewport: null, headless: headless, slowMo: 0, // slow down by ms }); + let page = (await browser.pages())[0]; await page.evaluateOnNewDocument(() => { Object.defineProperty(navigator, 'language', {