working consent test by accepting server notices invite and clicking on link, also create room
This commit is contained in:
parent
bc1da0565e
commit
a74a753a05
6 changed files with 132 additions and 16 deletions
14
helpers.js
14
helpers.js
|
@ -16,6 +16,7 @@ limitations under the License.
|
|||
|
||||
// puppeteer helpers
|
||||
|
||||
// TODO: rename to queryAndInnertext?
|
||||
async function tryGetInnertext(page, selector) {
|
||||
const field = await page.$(selector);
|
||||
if (field != null) {
|
||||
|
@ -25,6 +26,11 @@ async function tryGetInnertext(page, selector) {
|
|||
return null;
|
||||
}
|
||||
|
||||
async function innerText(page, field) {
|
||||
const text_handle = await field.getProperty('innerText');
|
||||
return await text_handle.jsonValue();
|
||||
}
|
||||
|
||||
async function newPage() {
|
||||
const page = await browser.newPage();
|
||||
await page.setViewport({
|
||||
|
@ -82,11 +88,17 @@ async function replaceInputText(input, text) {
|
|||
await input.type(text);
|
||||
}
|
||||
|
||||
// TODO: rename to waitAndQuery(Single)?
|
||||
async function waitAndQuerySelector(page, selector, timeout = 500) {
|
||||
await page.waitForSelector(selector, {visible: true, timeout});
|
||||
return await page.$(selector);
|
||||
}
|
||||
|
||||
async function waitAndQueryAll(page, selector, timeout = 500) {
|
||||
await page.waitForSelector(selector, {visible: true, timeout});
|
||||
return await page.$$(selector);
|
||||
}
|
||||
|
||||
function waitForNewPage(timeout = 500) {
|
||||
return new Promise((resolve, reject) => {
|
||||
const timeoutHandle = setTimeout(() => {
|
||||
|
@ -120,6 +132,7 @@ function delay(ms) {
|
|||
|
||||
module.exports = {
|
||||
tryGetInnertext,
|
||||
innerText,
|
||||
newPage,
|
||||
logConsole,
|
||||
logXHRRequests,
|
||||
|
@ -127,6 +140,7 @@ module.exports = {
|
|||
printElements,
|
||||
replaceInputText,
|
||||
waitAndQuerySelector,
|
||||
waitAndQueryAll,
|
||||
waitForNewPage,
|
||||
randomInt,
|
||||
riotUrl,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue