refactor(e2e): moved animation and transition cancelation to post-login

This commit is contained in:
Carlos Jimenez Ruiz 2021-10-20 11:23:55 +02:00
parent 600de05d29
commit 7460986a8d
2 changed files with 15 additions and 7 deletions

View File

@ -94,6 +94,19 @@ let actions = {
login: async function(userName) { login: async function(userName) {
await this.doLogin(userName); await this.doLogin(userName);
await this.waitForState('home'); await this.waitForState('home');
await this.addStyleTag({
content: `
*,
*::after,
*::before {
transition-delay: 0s !important;
transition-duration: 0s !important;
animation-delay: -0.0001s !important;
animation-duration: 0s !important;
animation-play-state: paused !important;
caret-color: transparent !important;
}`
});
}, },
selectModule: async function(moduleName) { selectModule: async function(moduleName) {
@ -208,7 +221,8 @@ let actions = {
waitPropertyLength: async function(selector, property, minLength) { waitPropertyLength: async function(selector, property, minLength) {
await this.waitForFunction((selector, property, minLength) => { await this.waitForFunction((selector, property, minLength) => {
const element = document.querySelector(selector); const element = document.querySelector(selector);
return element && element[property] != null && element[property] !== '' && element[property].length >= minLength; const isValidElement = element && element[property] != null && element[property] !== '';
return isValidElement && element[property].length >= minLength;
}, {}, selector, property, minLength); }, {}, selector, property, minLength);
return this.getProperty(selector, property); return this.getProperty(selector, property);
}, },

View File

@ -47,12 +47,6 @@ export async function getBrowser() {
}); });
page = extendPage(page); page = extendPage(page);
page.setDefaultTimeout(5000); page.setDefaultTimeout(5000);
await page.addStyleTag({
content: `* {
transition: none!important;
animation: none!important;
}`
});
await page.goto(defaultURL, {waitUntil: 'load'}); await page.goto(defaultURL, {waitUntil: 'load'});
return {page, close: browser.close.bind(browser)}; return {page, close: browser.close.bind(browser)};