From fc4c425a22c11737d12b39ca83fc11efd1046d1e Mon Sep 17 00:00:00 2001 From: Bruno Windels Date: Tue, 17 Jul 2018 12:38:20 +0200 Subject: [PATCH] do accepting terms as part of signup since we try to create a room with riot-bot after login, which fails with consent warning --- tests/join.js | 18 +----------------- tests/signup.js | 13 ++++++++++++- 2 files changed, 13 insertions(+), 18 deletions(-) diff --git a/tests/join.js b/tests/join.js index 79990af3a2..ea16a93936 100644 --- a/tests/join.js +++ b/tests/join.js @@ -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'); } \ No newline at end of file diff --git a/tests/signup.js b/tests/signup.js index 2a0d6dc9b4..5560fc56cf 100644 --- a/tests/signup.js +++ b/tests/signup.js @@ -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 } \ No newline at end of file