add util.js to core folder
This commit is contained in:
parent
8feda80111
commit
b2552628e9
44
bigbluebutton-tests/puppeteer/core/util.js
Normal file
44
bigbluebutton-tests/puppeteer/core/util.js
Normal file
@ -0,0 +1,44 @@
|
|||||||
|
// Common
|
||||||
|
function checkElement(element, index = 0) {
|
||||||
|
return document.querySelectorAll(element)[index] !== undefined;
|
||||||
|
}
|
||||||
|
|
||||||
|
function clickElement(element, index = 0) {
|
||||||
|
document.querySelectorAll(element)[index].click();
|
||||||
|
}
|
||||||
|
|
||||||
|
// Text
|
||||||
|
function checkElementText(element, param, index = 0) {
|
||||||
|
return document.querySelectorAll(element)[index].innerText === param;
|
||||||
|
}
|
||||||
|
|
||||||
|
function checkElementTextIncludes(element, param, index = 0) {
|
||||||
|
return document.querySelectorAll(element)[index].innerText.includes(param);
|
||||||
|
}
|
||||||
|
|
||||||
|
function getElementText(element, index = 0) {
|
||||||
|
return document.querySelectorAll(element)[index].innerText;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Length
|
||||||
|
function checkElementLengthEqualTo(element, param) {
|
||||||
|
return document.querySelectorAll(element).length === param;
|
||||||
|
}
|
||||||
|
|
||||||
|
function checkElementLengthDifferentTo(element, param) {
|
||||||
|
return document.querySelectorAll(element).length !== param;
|
||||||
|
}
|
||||||
|
|
||||||
|
// use this for other operations
|
||||||
|
function getElementLength(element) {
|
||||||
|
return document.querySelectorAll(element).length;
|
||||||
|
}
|
||||||
|
|
||||||
|
exports.checkElement = checkElement;
|
||||||
|
exports.clickElement = clickElement;
|
||||||
|
exports.checkElementText = checkElementText;
|
||||||
|
exports.checkElementTextIncludes = checkElementTextIncludes;
|
||||||
|
exports.getElementText = getElementText;
|
||||||
|
exports.checkElementLengthEqualTo = checkElementLengthEqualTo;
|
||||||
|
exports.checkElementLengthDifferentTo = checkElementLengthDifferentTo;
|
||||||
|
exports.getElementLength = getElementLength;
|
Loading…
Reference in New Issue
Block a user