pull/21833/head
Bruno Windels 2018-07-09 18:40:25 +02:00
parent d4682eb5e6
commit 9c5e43a693
2 changed files with 6 additions and 15 deletions

View File

@ -26,8 +26,9 @@ global.homeserver = 'http://localhost:8008';
global.browser = null; global.browser = null;
async function runTests() { async function runTests() {
await startSession(); global.browser = await puppeteer.launch();
const page = await helpers.newPage(); const page = await helpers.newPage();
const username = 'bruno-' + helpers.randomInt(10000); const username = 'bruno-' + helpers.randomInt(10000);
const password = 'testtest'; const password = 'testtest';
process.stdout.write(`* signing up as ${username} ... `); process.stdout.write(`* signing up as ${username} ... `);
@ -39,15 +40,7 @@ async function runTests() {
await join(page, room); await join(page, room);
process.stdout.write('done\n'); process.stdout.write('done\n');
await endSession(); await browser.close();
}
async function startSession() {
global.browser = await puppeteer.launch();
}
function endSession() {
return browser.close();
} }
function onSuccess() { function onSuccess() {

View File

@ -22,8 +22,8 @@ module.exports = async function signup(page, username, password, homeserver) {
const xhrLogs = helpers.logXHRRequests(page); const xhrLogs = helpers.logXHRRequests(page);
await page.goto(helpers.riotUrl('/#/register')); await page.goto(helpers.riotUrl('/#/register'));
//click 'Custom server' radio button //click 'Custom server' radio button
await page.waitForSelector('#advanced', {visible: true, timeout: 500}); const advancedRadioButton = await helpers.waitAndQuerySelector(page, '#advanced');
await page.click('#advanced'); await advancedRadioButton.click();
//fill out form //fill out form
await page.waitForSelector('.mx_ServerConfig', {visible: true, timeout: 500}); await page.waitForSelector('.mx_ServerConfig', {visible: true, timeout: 500});
@ -53,9 +53,7 @@ module.exports = async function signup(page, username, password, homeserver) {
await registerButton.click(); await registerButton.click();
//confirm dialog saying you cant log back in without e-mail //confirm dialog saying you cant log back in without e-mail
await page.waitForSelector('.mx_QuestionDialog', {visible: true, timeout: 500}); const continueButton = await helpers.waitAndQuerySelector(page, '.mx_QuestionDialog button.mx_Dialog_primary');
const continueButton = await page.$('.mx_QuestionDialog button.mx_Dialog_primary');
//await helpers.printElements('continueButton', [continueButton]);
await continueButton.click(); await continueButton.click();
//wait for registration to finish so the hash gets set //wait for registration to finish so the hash gets set
//onhashchange better? //onhashchange better?