3092-module_transactions #740

Merged
joan merged 41 commits from 3092-module_transactions into dev 2021-10-18 07:42:24 +00:00
1 changed files with 19 additions and 19 deletions
Showing only changes of commit 25e0e67c00 - Show all commits

View File

@ -108,7 +108,7 @@ let actions = {
},
getState: async function() {
return await this.evaluate(() => {
return this.evaluate(() => {
let $state = angular.element(document.body).injector().get('$state');
return $state.current.name;
});
@ -194,7 +194,7 @@ let actions = {
},
getProperty: async function(selector, property) {
return await this.evaluate((selector, property) => {
return this.evaluate((selector, property) => {
return document.querySelector(selector)[property].replace(/\s+/g, ' ').trim();
}, selector, property);
},
@ -202,7 +202,7 @@ let actions = {
getClassName: async function(selector) {
const element = await this.$(selector);
const handle = await element.getProperty('className');
return await handle.jsonValue();
return handle.jsonValue();
},
waitPropertyLength: async function(selector, property, minLength) {
@ -210,7 +210,7 @@ let actions = {
const element = document.querySelector(selector);
return element && element[property] != null && element[property] !== '' && element[property].length >= minLength;
}, {}, selector, property, minLength);
return await this.getProperty(selector, property);
return this.getProperty(selector, property);
},
expectPropertyValue: async function(selector, property, value) {
@ -219,7 +219,7 @@ let actions = {
builtSelector = await this.selectorFormater(selector);
try {
return await this.waitForFunction((selector, property, value) => {
return this.waitForFunction((selector, property, value) => {
const element = document.querySelector(selector);
return element[property] == value;
}, {}, builtSelector, property, value);
@ -239,7 +239,7 @@ let actions = {
return element && element[property] != null && element[property] !== '';
}, {}, builtSelector, property);
return await this.getProperty(builtSelector, property);
return this.getProperty(builtSelector, property);
} catch (error) {
throw new Error(`couldn't get property: ${property} of ${builtSelector}, ${error}`);
}
@ -261,7 +261,7 @@ let actions = {
await this.waitForSelector(selector);
await this.waitForFunction(checkVisibility, {}, selector);
return await this.click(selector);
return this.click(selector);
},
writeOnEditableTD: async function(selector, text) {
@ -274,7 +274,7 @@ let actions = {
focusElement: async function(selector) {
await this.waitForSelector(selector);
return await this.evaluate(selector => {
return this.evaluate(selector => {
let element = document.querySelector(selector);
element.focus();
}, selector);
@ -282,19 +282,19 @@ let actions = {
isVisible: async function(selector) {
await this.waitForSelector(selector);
return await this.evaluate(checkVisibility, selector);
return this.evaluate(checkVisibility, selector);
},
waitImgLoad: async function(selector) {
await this.waitForSelector(selector);
return await this.waitForFunction(selector => {
return this.waitForFunction(selector => {
const imageReady = document.querySelector(selector).complete;
return imageReady;
}, {}, selector);
},
countElement: async function(selector) {
return await this.evaluate(selector => {
return this.evaluate(selector => {
return document.querySelectorAll(selector).length;
}, selector);
},
@ -312,7 +312,7 @@ let actions = {
waitForClassNotPresent: async function(selector, className) {
await this.waitForSelector(selector);
return await this.waitForFunction((selector, className) => {
return this.waitForFunction((selector, className) => {
if (!document.querySelector(selector).classList.contains(className))
return true;
}, {}, selector, className);
@ -320,7 +320,7 @@ let actions = {
waitForClassPresent: async function(selector, className) {
await this.waitForSelector(selector);
return await this.waitForFunction((elementSelector, targetClass) => {
return this.waitForFunction((elementSelector, targetClass) => {
if (document.querySelector(elementSelector).classList.contains(targetClass))
return true;
}, {}, selector, className);
@ -387,13 +387,13 @@ let actions = {
const innerText = document.querySelector(selector).innerText;
return innerText != null && innerText != '';
}, {}, selector);
return await this.evaluate(selector => {
return this.evaluate(selector => {
return document.querySelector(selector).innerText;
}, selector);
},
waitForEmptyInnerText: async function(selector) {
return await this.waitFunction(selector => {
return this.waitFunction(selector => {
return document.querySelector(selector).innerText == '';
}, selector);
},
@ -521,7 +521,7 @@ let actions = {
checkboxState: async function(selector) {
await this.waitForSelector(selector);
return await this.evaluate(selector => {
return this.evaluate(selector => {
let checkbox = document.querySelector(selector);
switch (checkbox.$ctrl.field) {
case null:
@ -536,14 +536,14 @@ let actions = {
isDisabled: async function(selector) {
await this.waitForSelector(selector);
return await this.evaluate(selector => {
return this.evaluate(selector => {
let element = document.querySelector(selector);
return element.$ctrl.disabled;
}, selector);
},
waitForStylePresent: async function(selector, property, value) {
return await this.waitForFunction((selector, property, value) => {
return this.waitForFunction((selector, property, value) => {
const element = document.querySelector(selector);
return element.style[property] == value;
}, {}, selector, property, value);
@ -631,7 +631,7 @@ export function extendPage(page) {
for (let name in actions) {
page[name] = async(...args) => {
try {
return await actions[name].apply(page, args);
return actions[name].apply(page, args);
} catch (err) {
let stringArgs = args
.map(i => typeof i == 'function' ? 'Function' : i)