do accepting terms as part of signup since we try to create a room with riot-bot after login, which fails with consent warning
This commit is contained in:
parent
83eebfdecc
commit
fc4c425a22
2 changed files with 13 additions and 18 deletions
|
@ -17,7 +17,7 @@ limitations under the License.
|
|||
const helpers = require('../helpers');
|
||||
const assert = require('assert');
|
||||
|
||||
module.exports = async function join(page, roomName, acceptTerms = false) {
|
||||
module.exports = async function join(page, roomName) {
|
||||
//TODO: brittle selector
|
||||
const directoryButton = await helpers.waitAndQuerySelector(page, '.mx_RoleButton[aria-label="Room directory"]');
|
||||
await directoryButton.click();
|
||||
|
@ -31,21 +31,5 @@ module.exports = async function join(page, roomName, acceptTerms = false) {
|
|||
const joinLink = await helpers.waitAndQuerySelector(page, '.mx_RoomPreviewBar_join_text a');
|
||||
await joinLink.click();
|
||||
|
||||
if (acceptTerms) {
|
||||
const reviewTermsButton = await helpers.waitAndQuerySelector(page, '.mx_QuestionDialog button.mx_Dialog_primary');
|
||||
const termsPagePromise = helpers.waitForNewPage();
|
||||
await reviewTermsButton.click();
|
||||
const termsPage = await termsPagePromise;
|
||||
const acceptButton = await termsPage.$('input[type=submit]');
|
||||
await acceptButton.click();
|
||||
await helpers.delay(500); //TODO yuck, timers
|
||||
//try to join again after accepting the terms
|
||||
|
||||
//TODO need to do this because joinLink is detached after switching target
|
||||
const joinLink2 = await helpers.waitAndQuerySelector(page, '.mx_RoomPreviewBar_join_text a');
|
||||
await joinLink2.click();
|
||||
}
|
||||
|
||||
|
||||
await page.waitForSelector('.mx_MessageComposer');
|
||||
}
|
|
@ -57,7 +57,6 @@ module.exports = async function signup(page, username, password, homeserver) {
|
|||
await continueButton.click();
|
||||
//wait for registration to finish so the hash gets set
|
||||
//onhashchange better?
|
||||
await helpers.delay(1000);
|
||||
/*
|
||||
await page.screenshot({path: "afterlogin.png", fullPage: true});
|
||||
console.log('browser console logs:');
|
||||
|
@ -66,11 +65,23 @@ module.exports = async function signup(page, username, password, homeserver) {
|
|||
console.log(xhrLogs.logs());
|
||||
*/
|
||||
|
||||
await acceptTerms(page);
|
||||
|
||||
await helpers.delay(10000);
|
||||
//printElements('page', await page.$('#matrixchat'));
|
||||
// await navigation_promise;
|
||||
|
||||
//await page.waitForSelector('.mx_MatrixChat', {visible: true, timeout: 3000});
|
||||
const url = page.url();
|
||||
assert.strictEqual(url, helpers.riotUrl('/#/home'));
|
||||
}
|
||||
|
||||
async function acceptTerms(page) {
|
||||
const reviewTermsButton = await helpers.waitAndQuerySelector(page, '.mx_QuestionDialog button.mx_Dialog_primary');
|
||||
const termsPagePromise = helpers.waitForNewPage();
|
||||
await reviewTermsButton.click();
|
||||
const termsPage = await termsPagePromise;
|
||||
const acceptButton = await termsPage.$('input[type=submit]');
|
||||
await acceptButton.click();
|
||||
await helpers.delay(500); //TODO yuck, timers
|
||||
}
|
Loading…
Reference in a new issue