mirror of https://github.com/vector-im/riot-web
look for a change (HS) link in the registration but don't fail if its not there
parent
912a974725
commit
06af5b3f22
|
@ -117,8 +117,7 @@ module.exports = class RiotSession {
|
||||||
await input.type(text);
|
await input.type(text);
|
||||||
}
|
}
|
||||||
|
|
||||||
query(selector) {
|
query(selector, timeout = DEFAULT_TIMEOUT) {
|
||||||
const timeout = DEFAULT_TIMEOUT;
|
|
||||||
return this.page.waitForSelector(selector, {visible: true, timeout});
|
return this.page.waitForSelector(selector, {visible: true, timeout});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -19,10 +19,23 @@ const assert = require('assert');
|
||||||
module.exports = async function signup(session, username, password, homeserver) {
|
module.exports = async function signup(session, username, password, homeserver) {
|
||||||
session.log.step("signs up");
|
session.log.step("signs up");
|
||||||
await session.goto(session.url('/#/register'));
|
await session.goto(session.url('/#/register'));
|
||||||
// change the homeserver by clicking the "Change" link.
|
// change the homeserver by clicking the advanced section
|
||||||
if (homeserver) {
|
if (homeserver) {
|
||||||
const advancedButton = await session.query('.mx_ServerTypeSelector_type_Advanced');
|
const advancedButton = await session.query('.mx_ServerTypeSelector_type_Advanced');
|
||||||
await advancedButton.click();
|
await advancedButton.click();
|
||||||
|
|
||||||
|
// depending on what HS is configured as the default, the advanced registration
|
||||||
|
// goes the HS/IS entry directly (for matrix.org) or takes you to the user/pass entry (not matrix.org).
|
||||||
|
// To work with both, we look for the "Change" link in the user/pass entry but don't fail when we can't find it
|
||||||
|
// As this link should be visible immediately, and to not slow down the case where it isn't present,
|
||||||
|
// pick a lower timeout of 5000ms
|
||||||
|
try {
|
||||||
|
const changeHsField = await session.query('.mx_AuthBody_editServerDetails', 5000);
|
||||||
|
if (changeHsField) {
|
||||||
|
await changeHsField.click();
|
||||||
|
}
|
||||||
|
} catch (err) {}
|
||||||
|
|
||||||
const hsInputField = await session.query('#mx_ServerConfig_hsUrl');
|
const hsInputField = await session.query('#mx_ServerConfig_hsUrl');
|
||||||
await session.replaceInputText(hsInputField, homeserver);
|
await session.replaceInputText(hsInputField, homeserver);
|
||||||
const nextButton = await session.query('.mx_Login_submit');
|
const nextButton = await session.query('.mx_Login_submit');
|
||||||
|
|
Loading…
Reference in New Issue