Some E2E timeouts removed
gitea/salix/pipeline/head This commit looks good Details

This commit is contained in:
Juan Ferrer 2020-03-24 11:12:59 +01:00
parent acf8c117b0
commit 68a4ed0f10
2 changed files with 21 additions and 13 deletions

View File

@ -58,9 +58,9 @@ let actions = {
return document.location.hash.includes(expectedHash); return document.location.hash.includes(expectedHash);
}, {}, expectedHash); }, {}, expectedHash);
} catch (error) { } 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; return true;
}, },
@ -123,8 +123,9 @@ let actions = {
waitForState: async function(state) { waitForState: async function(state) {
await this.waitFor(state => { await this.waitFor(state => {
let $state = angular.element(document.body).injector().get('$state'); let $state = angular.element(document.body).injector().get('$state');
return $state.is(state); return !$state.transition && $state.is(state);
}, {}, state); }, {}, state);
await this.waitForSpinnerLoad(state);
}, },
waitForTransition: async function() { waitForTransition: async function() {
@ -152,7 +153,6 @@ let actions = {
}, state); }, state);
await this.waitForState(state); await this.waitForState(state);
await this.waitForContentLoaded();
}, },
reloadSection: async function(state) { reloadSection: async function(state) {
@ -172,7 +172,7 @@ let actions = {
await this.write('vn-searchbar', searchValue); await this.write('vn-searchbar', searchValue);
await this.waitToClick('vn-searchbar vn-icon[icon="search"]'); await this.waitToClick('vn-searchbar vn-icon[icon="search"]');
await this.waitForTransition(); await this.waitForTransition();
await this.waitForContentLoaded(); await this.waitFor('.vn-descriptor');
}, },
getProperty: async function(selector, property) { getProperty: async function(selector, property) {
@ -334,7 +334,10 @@ let actions = {
}, },
hideSnackbar: async function() { 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(() => { await this.evaluate(() => {
let hideButton = document.querySelector('#shapes .shown button'); let hideButton = document.querySelector('#shapes .shown button');
if (hideButton) if (hideButton)
@ -549,7 +552,7 @@ let actions = {
}, },
waitForContentLoaded: async function() { waitForContentLoaded: async function() {
await this.waitFor(250); // await this.waitFor(250);
} }
}; };

View File

@ -4,17 +4,22 @@ import {extendPage} from './extensions';
import {url as defaultURL} from './config'; import {url as defaultURL} from './config';
export async function getBrowser() { 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({ const browser = await Puppeteer.launch({
args: [ args,
'--no-sandbox',
`--window-size=${ 1920 },${ 1080 }`,
// '--auto-open-devtools-for-tabs'
],
defaultViewport: null, defaultViewport: null,
headless: headless, headless: headless,
slowMo: 0, // slow down by ms slowMo: 0, // slow down by ms
}); });
let page = (await browser.pages())[0]; let page = (await browser.pages())[0];
await page.evaluateOnNewDocument(() => { await page.evaluateOnNewDocument(() => {
Object.defineProperty(navigator, 'language', { Object.defineProperty(navigator, 'language', {