1
0
mirror of https://github.com/matrix-org/matrix-react-sdk.git synced 2025-11-11 20:22:36 +03:00

accept terms when joining

This commit is contained in:
Bruno Windels
2018-07-10 19:26:47 +02:00
parent 9c5e43a693
commit 9a2d32e642
3 changed files with 36 additions and 2 deletions

View File

@@ -87,6 +87,23 @@ async function waitAndQuerySelector(page, selector, timeout = 500) {
return await page.$(selector);
}
function waitForNewPage(timeout = 500) {
return new Promise((resolve, reject) => {
const timeoutHandle = setTimeout(() => {
browser.removeEventListener('targetcreated', callback);
reject(new Error(`timeout of ${timeout}ms for waitForNewPage elapsed`));
}, timeout);
const callback = async (target) => {
clearTimeout(timeoutHandle);
const page = await target.page();
resolve(page);
};
browser.once('targetcreated', callback);
});
}
// other helpers
function randomInt(max) {
@@ -110,6 +127,7 @@ module.exports = {
printElements,
replaceInputText,
waitAndQuerySelector,
waitForNewPage,
randomInt,
riotUrl,
delay,