bigbluebutton-Github/bigbluebutton-tests/playwright/core/util.js
2022-03-21 12:04:43 -03:00

24 lines
695 B
JavaScript

const { expect } = require("@playwright/test");
// Common
function checkElement([element, index = 0]) {
return document.querySelectorAll(element)[index] !== undefined;
}
// Length
function checkElementLengthEqualTo([element, count]) {
return document.querySelectorAll(element).length == count;
}
// Text
async function checkTextContent(baseContent, checkData) {
if (typeof checkData === 'string' ) checkData = new Array(checkData);
const check = checkData.every(word => baseContent.includes(word));
await expect(check).toBeTruthy();
}
exports.checkElement = checkElement;
exports.checkElementLengthEqualTo = checkElementLengthEqualTo;
exports.checkTextContent = checkTextContent;