test default server setup for signup

pull/21833/head
Bruno Windels 2018-07-23 11:20:07 +02:00
parent c693d861f4
commit 1643b9552e
2 changed files with 12 additions and 7 deletions

View File

@ -35,7 +35,7 @@ async function runTests() {
const username = 'user-' + helpers.randomInt(10000);
const password = 'testtest';
process.stdout.write(`* signing up as ${username} ... `);
await signup(page, username, password, homeserver);
await signup(page, username, password);
process.stdout.write('done\n');
const noticesName = "Server Notices";

View File

@ -18,16 +18,18 @@ const helpers = require('../helpers');
const acceptTerms = require('./consent');
const assert = require('assert');
module.exports = async function signup(page, username, password, homeserver, options) {
module.exports = async function signup(page, username, password, homeserver) {
const consoleLogs = helpers.logConsole(page);
const xhrLogs = helpers.logXHRRequests(page);
await page.goto(helpers.riotUrl('/#/register'));
//click 'Custom server' radio button
const advancedRadioButton = await helpers.waitAndQuerySelector(page, '#advanced');
await advancedRadioButton.click();
if (homeserver) {
const advancedRadioButton = await helpers.waitAndQuerySelector(page, '#advanced');
await advancedRadioButton.click();
}
// wait until register button is visible
await page.waitForSelector('.mx_Login_submit[value=Register]');
//fill out form
await page.waitForSelector('.mx_ServerConfig', {visible: true, timeout: 500});
const loginFields = await page.$$('.mx_Login_field');
assert.strictEqual(loginFields.length, 7);
const usernameField = loginFields[2];
@ -37,7 +39,10 @@ module.exports = async function signup(page, username, password, homeserver, opt
await helpers.replaceInputText(usernameField, username);
await helpers.replaceInputText(passwordField, password);
await helpers.replaceInputText(passwordRepeatField, password);
await helpers.replaceInputText(hsurlField, homeserver);
if (homeserver) {
await page.waitForSelector('.mx_ServerConfig', {visible: true, timeout: 500});
await helpers.replaceInputText(hsurlField, homeserver);
}
//wait over a second because Registration/ServerConfig have a 1000ms
//delay to internally set the homeserver url
//see Registration::render and ServerConfig::props::delayTimeMs