This commit is contained in:
Michael Telatynski 2020-11-25 10:39:44 +00:00
parent 1b1c482f9c
commit c4084196d1
5 changed files with 7 additions and 24 deletions

View file

@ -22,24 +22,12 @@ module.exports = async function signup(session, username, password, homeserver)
await session.goto(session.url('/#/register'));
// change the homeserver by clicking the advanced section
if (homeserver) {
const advancedButton = await session.query('.mx_ServerTypeSelector_type_Advanced');
await advancedButton.click();
const changeButton = await session.query('.mx_ServerPicker_change');
await changeButton.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_ServerPickerDialog_otherHomeserver');
await session.replaceInputText(hsInputField, homeserver);
const nextButton = await session.query('.mx_Login_submit');
const nextButton = await session.query('.mx_ServerPickerDialog_continue');
// accept homeserver
await nextButton.click();
}