Merge pull request #12 from matrix-org/bwindels/fixbuild
Attempt to fix the build
This commit is contained in:
commit
3e8b55b41e
11 changed files with 32 additions and 28 deletions
|
@ -15,7 +15,7 @@ limitations under the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
const {acceptDialog} = require('./tests/dialog');
|
const {acceptDialogMaybe} = require('./tests/dialog');
|
||||||
const signup = require('./tests/signup');
|
const signup = require('./tests/signup');
|
||||||
const join = require('./tests/join');
|
const join = require('./tests/join');
|
||||||
const sendMessage = require('./tests/send-message');
|
const sendMessage = require('./tests/send-message');
|
||||||
|
@ -67,13 +67,13 @@ async function createE2ERoomAndTalk(alice, bob) {
|
||||||
const bobDevice = await getE2EDeviceFromSettings(bob);
|
const bobDevice = await getE2EDeviceFromSettings(bob);
|
||||||
// wait some time for the encryption warning dialog
|
// wait some time for the encryption warning dialog
|
||||||
// to appear after closing the settings
|
// to appear after closing the settings
|
||||||
await bob.delay(500);
|
await bob.delay(1000);
|
||||||
await acceptDialog(bob, "encryption");
|
await acceptDialogMaybe(bob, "encryption");
|
||||||
const aliceDevice = await getE2EDeviceFromSettings(alice);
|
const aliceDevice = await getE2EDeviceFromSettings(alice);
|
||||||
// wait some time for the encryption warning dialog
|
// wait some time for the encryption warning dialog
|
||||||
// to appear after closing the settings
|
// to appear after closing the settings
|
||||||
await alice.delay(500);
|
await alice.delay(1000);
|
||||||
await acceptDialog(alice, "encryption");
|
await acceptDialogMaybe(alice, "encryption");
|
||||||
await verifyDeviceForUser(bob, "alice", aliceDevice);
|
await verifyDeviceForUser(bob, "alice", aliceDevice);
|
||||||
await verifyDeviceForUser(alice, "bob", bobDevice);
|
await verifyDeviceForUser(alice, "bob", bobDevice);
|
||||||
const aliceMessage = "Guess what I just heard?!"
|
const aliceMessage = "Guess what I just heard?!"
|
||||||
|
|
|
@ -148,7 +148,7 @@ module.exports = class RiotSession {
|
||||||
return this.page.$(selector);
|
return this.page.$(selector);
|
||||||
}
|
}
|
||||||
|
|
||||||
waitAndQuery(selector, timeout = 500) {
|
waitAndQuery(selector, timeout = 5000) {
|
||||||
return this.page.waitForSelector(selector, {visible: true, timeout});
|
return this.page.waitForSelector(selector, {visible: true, timeout});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -156,25 +156,29 @@ module.exports = class RiotSession {
|
||||||
return this.page.$$(selector);
|
return this.page.$$(selector);
|
||||||
}
|
}
|
||||||
|
|
||||||
async waitAndQueryAll(selector, timeout = 500) {
|
async waitAndQueryAll(selector, timeout = 5000) {
|
||||||
await this.waitAndQuery(selector, timeout);
|
await this.waitAndQuery(selector, timeout);
|
||||||
return await this.queryAll(selector);
|
return await this.queryAll(selector);
|
||||||
}
|
}
|
||||||
|
|
||||||
waitForNewPage(timeout = 500) {
|
waitForNewPage(timeout = 5000) {
|
||||||
return new Promise((resolve, reject) => {
|
return new Promise((resolve, reject) => {
|
||||||
const timeoutHandle = setTimeout(() => {
|
const timeoutHandle = setTimeout(() => {
|
||||||
this.browser.removeEventListener('targetcreated', callback);
|
this.browser.removeListener('targetcreated', callback);
|
||||||
reject(new Error(`timeout of ${timeout}ms for waitForNewPage elapsed`));
|
reject(new Error(`timeout of ${timeout}ms for waitForNewPage elapsed`));
|
||||||
}, timeout);
|
}, timeout);
|
||||||
|
|
||||||
const callback = async (target) => {
|
const callback = async (target) => {
|
||||||
|
if (target.type() !== 'page') {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
this.browser.removeListener('targetcreated', callback);
|
||||||
clearTimeout(timeoutHandle);
|
clearTimeout(timeoutHandle);
|
||||||
const page = await target.page();
|
const page = await target.page();
|
||||||
resolve(page);
|
resolve(page);
|
||||||
};
|
};
|
||||||
|
|
||||||
this.browser.once('targetcreated', callback);
|
this.browser.on('targetcreated', callback);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -20,7 +20,7 @@ const {acceptDialogMaybe} = require('./dialog');
|
||||||
module.exports = async function acceptInvite(session, name) {
|
module.exports = async function acceptInvite(session, name) {
|
||||||
session.log.step(`accepts "${name}" invite`);
|
session.log.step(`accepts "${name}" invite`);
|
||||||
//TODO: brittle selector
|
//TODO: brittle selector
|
||||||
const invitesHandles = await session.waitAndQueryAll('.mx_RoomTile_name.mx_RoomTile_invite', 1000);
|
const invitesHandles = await session.waitAndQueryAll('.mx_RoomTile_name.mx_RoomTile_invite');
|
||||||
const invitesWithText = await Promise.all(invitesHandles.map(async (inviteHandle) => {
|
const invitesWithText = await Promise.all(invitesHandles.map(async (inviteHandle) => {
|
||||||
const text = await session.innerText(inviteHandle);
|
const text = await session.innerText(inviteHandle);
|
||||||
return {inviteHandle, text};
|
return {inviteHandle, text};
|
||||||
|
|
|
@ -17,11 +17,11 @@ limitations under the License.
|
||||||
const assert = require('assert');
|
const assert = require('assert');
|
||||||
|
|
||||||
module.exports = async function acceptTerms(session) {
|
module.exports = async function acceptTerms(session) {
|
||||||
const reviewTermsButton = await session.waitAndQuery('.mx_QuestionDialog button.mx_Dialog_primary', 5000);
|
const reviewTermsButton = await session.waitAndQuery('.mx_QuestionDialog button.mx_Dialog_primary');
|
||||||
const termsPagePromise = session.waitForNewPage();
|
const termsPagePromise = session.waitForNewPage();
|
||||||
await reviewTermsButton.click();
|
await reviewTermsButton.click();
|
||||||
const termsPage = await termsPagePromise;
|
const termsPage = await termsPagePromise;
|
||||||
const acceptButton = await termsPage.$('input[type=submit]');
|
const acceptButton = await termsPage.$('input[type=submit]');
|
||||||
await acceptButton.click();
|
await acceptButton.click();
|
||||||
await session.delay(500); //TODO yuck, timers
|
await session.delay(1000); //TODO yuck, timers
|
||||||
}
|
}
|
|
@ -27,7 +27,7 @@ async function acceptDialog(session, expectedContent) {
|
||||||
async function acceptDialogMaybe(session, expectedContent) {
|
async function acceptDialogMaybe(session, expectedContent) {
|
||||||
let dialog = null;
|
let dialog = null;
|
||||||
try {
|
try {
|
||||||
dialog = await session.waitAndQuery(".mx_QuestionDialog", 100);
|
dialog = await session.waitAndQuery(".mx_QuestionDialog");
|
||||||
} catch(err) {
|
} catch(err) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
|
@ -18,7 +18,7 @@ const assert = require('assert');
|
||||||
|
|
||||||
module.exports = async function invite(session, userId) {
|
module.exports = async function invite(session, userId) {
|
||||||
session.log.step(`invites "${userId}" to room`);
|
session.log.step(`invites "${userId}" to room`);
|
||||||
await session.delay(200);
|
await session.delay(1000);
|
||||||
const inviteButton = await session.waitAndQuery(".mx_RightPanel_invite");
|
const inviteButton = await session.waitAndQuery(".mx_RightPanel_invite");
|
||||||
await inviteButton.click();
|
await inviteButton.click();
|
||||||
const inviteTextArea = await session.waitAndQuery(".mx_ChatInviteDialog textarea");
|
const inviteTextArea = await session.waitAndQuery(".mx_ChatInviteDialog textarea");
|
||||||
|
|
|
@ -33,7 +33,7 @@ module.exports = async function receiveMessage(session, message) {
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
// wait a bit for the incoming event to be rendered
|
// wait a bit for the incoming event to be rendered
|
||||||
await session.delay(500);
|
await session.delay(1000);
|
||||||
let lastTile = await session.query(".mx_EventTile_last");
|
let lastTile = await session.query(".mx_EventTile_last");
|
||||||
const senderElement = await lastTile.$(".mx_SenderProfile_name");
|
const senderElement = await lastTile.$(".mx_SenderProfile_name");
|
||||||
const bodyElement = await lastTile.$(".mx_EventTile_body");
|
const bodyElement = await lastTile.$(".mx_EventTile_body");
|
||||||
|
|
|
@ -33,7 +33,7 @@ module.exports = async function changeRoomSettings(session, settings) {
|
||||||
session.log.startGroup(`changes the room settings`);
|
session.log.startGroup(`changes the room settings`);
|
||||||
/// XXX delay is needed here, possible because the header is being rerendered
|
/// XXX delay is needed here, possible because the header is being rerendered
|
||||||
/// click doesn't do anything otherwise
|
/// click doesn't do anything otherwise
|
||||||
await session.delay(500);
|
await session.delay(1000);
|
||||||
const settingsButton = await session.query(".mx_RoomHeader .mx_AccessibleButton[title=Settings]");
|
const settingsButton = await session.query(".mx_RoomHeader .mx_AccessibleButton[title=Settings]");
|
||||||
await settingsButton.click();
|
await settingsButton.click();
|
||||||
const checks = await session.waitAndQueryAll(".mx_RoomSettings_settings input[type=checkbox]");
|
const checks = await session.waitAndQueryAll(".mx_RoomSettings_settings input[type=checkbox]");
|
||||||
|
|
|
@ -19,13 +19,13 @@ const acceptInvite = require("./accept-invite")
|
||||||
module.exports = async function acceptServerNoticesInviteAndConsent(session) {
|
module.exports = async function acceptServerNoticesInviteAndConsent(session) {
|
||||||
await acceptInvite(session, "Server Notices");
|
await acceptInvite(session, "Server Notices");
|
||||||
session.log.step(`accepts terms & conditions`);
|
session.log.step(`accepts terms & conditions`);
|
||||||
const consentLink = await session.waitAndQuery(".mx_EventTile_body a", 1000);
|
const consentLink = await session.waitAndQuery(".mx_EventTile_body a");
|
||||||
const termsPagePromise = session.waitForNewPage();
|
const termsPagePromise = session.waitForNewPage();
|
||||||
await consentLink.click();
|
await consentLink.click();
|
||||||
const termsPage = await termsPagePromise;
|
const termsPage = await termsPagePromise;
|
||||||
const acceptButton = await termsPage.$('input[type=submit]');
|
const acceptButton = await termsPage.$('input[type=submit]');
|
||||||
await acceptButton.click();
|
await acceptButton.click();
|
||||||
await session.delay(500); //TODO yuck, timers
|
await session.delay(1000); //TODO yuck, timers
|
||||||
await termsPage.close();
|
await termsPage.close();
|
||||||
session.log.done();
|
session.log.done();
|
||||||
}
|
}
|
|
@ -44,7 +44,7 @@ module.exports = async function signup(session, username, password, homeserver)
|
||||||
//wait over a second because Registration/ServerConfig have a 1000ms
|
//wait over a second because Registration/ServerConfig have a 1000ms
|
||||||
//delay to internally set the homeserver url
|
//delay to internally set the homeserver url
|
||||||
//see Registration::render and ServerConfig::props::delayTimeMs
|
//see Registration::render and ServerConfig::props::delayTimeMs
|
||||||
await session.delay(1200);
|
await session.delay(1500);
|
||||||
/// focus on the button to make sure error validation
|
/// focus on the button to make sure error validation
|
||||||
/// has happened before checking the form is good to go
|
/// has happened before checking the form is good to go
|
||||||
const registerButton = await session.query('.mx_Login_submit');
|
const registerButton = await session.query('.mx_Login_submit');
|
||||||
|
|
2
start.js
2
start.js
|
@ -52,7 +52,7 @@ async function runTests() {
|
||||||
} catch(err) {
|
} catch(err) {
|
||||||
failure = true;
|
failure = true;
|
||||||
console.log('failure: ', err);
|
console.log('failure: ', err);
|
||||||
if (!program.noLogs) {
|
if (program.logs) {
|
||||||
for(let i = 0; i < sessions.length; ++i) {
|
for(let i = 0; i < sessions.length; ++i) {
|
||||||
const session = sessions[i];
|
const session = sessions[i];
|
||||||
documentHtml = await session.page.content();
|
documentHtml = await session.page.content();
|
||||||
|
|
Loading…
Reference in a new issue