mirror of
https://github.com/element-hq/element-web
synced 2024-11-27 19:56:47 +03:00
Merge branch 'master' into toml/install-scripts-fail-fast
This commit is contained in:
commit
c1464aaa5d
12 changed files with 54 additions and 66 deletions
|
@ -27,7 +27,10 @@ It's important to always stop and start synapse before each run of the tests to
|
|||
start.js accepts the following parameters that can help running the tests locally:
|
||||
|
||||
- `--no-logs` dont show the excessive logging show by default (meant for CI), just where the test failed.
|
||||
- `--riot-url <url>` don't use the riot copy and static server provided by the tests, but use a running server like the webpack watch server to run the tests against. Make sure to have `welcomeUserId` disabled in your config as the tests assume there is no riot-bot currently.
|
||||
- `--riot-url <url>` don't use the riot copy and static server provided by the tests, but use a running server like the webpack watch server to run the tests against. Make sure to have the following local config:
|
||||
- `welcomeUserId` disabled as the tests assume there is no riot-bot currently. Make sure to set the default homeserver to
|
||||
- `"default_hs_url": "http://localhost:5005"`, to use the e2e tests synapse (the tests use the default HS to run against atm)
|
||||
- `"feature_lazyloading": "labs"`, currently assumes lazy loading needs to be turned on in the settings, will change soon.
|
||||
- `--slow-mo` run the tests a bit slower, so it's easier to follow along with `--windowed`.
|
||||
- `--windowed` run the tests in an actual browser window Try to limit interacting with the windows while the tests are running. Hovering over the window tends to fail the tests, dragging the title bar should be fine though.
|
||||
- `--dev-tools` open the devtools in the browser window, only applies if `--windowed` is set as well.
|
||||
|
|
4
TODO.md
Normal file
4
TODO.md
Normal file
|
@ -0,0 +1,4 @@
|
|||
join a peekable room by directory
|
||||
join a peekable room by invite
|
||||
join a non-peekable room by directory
|
||||
join a non-peekable room by invite
|
|
@ -1,7 +1,7 @@
|
|||
#!/bin/bash
|
||||
set -e
|
||||
RIOT_BRANCH=develop
|
||||
|
||||
RIOT_BRANCH=master
|
||||
BASE_DIR=$(cd $(dirname $0) && pwd)
|
||||
if [ -d $BASE_DIR/riot-web ]; then
|
||||
echo "riot is already installed"
|
||||
|
|
|
@ -59,6 +59,11 @@ module.exports = class RestMultiSession {
|
|||
this.log.done();
|
||||
return new RestMultiRoom(rooms, roomIdOrAlias, this.log);
|
||||
}
|
||||
|
||||
room(roomIdOrAlias) {
|
||||
const rooms = this.sessions.map(s => s.room(roomIdOrAlias));
|
||||
return new RestMultiRoom(rooms, roomIdOrAlias, this.log);
|
||||
}
|
||||
}
|
||||
|
||||
class RestMultiRoom {
|
||||
|
@ -82,7 +87,7 @@ class RestMultiRoom {
|
|||
this.log.step(`leave ${this.roomIdOrAlias}`)
|
||||
await Promise.all(this.rooms.map(async (r) => {
|
||||
r.log.mute();
|
||||
await r.leave(message);
|
||||
await r.leave();
|
||||
r.log.unmute();
|
||||
}));
|
||||
this.log.done();
|
||||
|
|
|
@ -24,6 +24,7 @@ module.exports = class RestSession {
|
|||
this.log = new Logger(credentials.userId);
|
||||
this._credentials = credentials;
|
||||
this._displayName = null;
|
||||
this._rooms = {};
|
||||
}
|
||||
|
||||
userId() {
|
||||
|
@ -51,7 +52,18 @@ module.exports = class RestSession {
|
|||
this.log.step(`joins ${roomIdOrAlias}`);
|
||||
const {room_id} = await this._post(`/join/${encodeURIComponent(roomIdOrAlias)}`);
|
||||
this.log.done();
|
||||
return new RestRoom(this, room_id, this.log);
|
||||
const room = new RestRoom(this, room_id, this.log);
|
||||
this._rooms[room_id] = room;
|
||||
this._rooms[roomIdOrAlias] = room;
|
||||
return room;
|
||||
}
|
||||
|
||||
room(roomIdOrAlias) {
|
||||
if (this._rooms.hasOwnProperty(roomIdOrAlias)) {
|
||||
return this._rooms[roomIdOrAlias];
|
||||
} else {
|
||||
throw new Error(`${this._credentials.userId} is not in ${roomIdOrAlias}`);
|
||||
}
|
||||
}
|
||||
|
||||
async createRoom(name, options) {
|
||||
|
|
|
@ -17,7 +17,6 @@ limitations under the License.
|
|||
|
||||
const {range} = require('./util');
|
||||
const signup = require('./usecases/signup');
|
||||
const acceptServerNoticesInviteAndConsent = require('./usecases/server-notices-consent');
|
||||
const roomDirectoryScenarios = require('./scenarios/directory');
|
||||
const lazyLoadingScenarios = require('./scenarios/lazy-loading');
|
||||
const e2eEncryptionScenarios = require('./scenarios/e2e-encryption');
|
||||
|
@ -26,7 +25,6 @@ module.exports = async function scenario(createSession, restCreator, runningOnTr
|
|||
async function createUser(username) {
|
||||
const session = await createSession(username);
|
||||
await signup(session, session.username, 'testtest', session.hsUrl);
|
||||
await acceptServerNoticesInviteAndConsent(session);
|
||||
return session;
|
||||
}
|
||||
|
||||
|
|
|
@ -40,6 +40,10 @@ module.exports = async function lazyLoadingScenarios(alice, bob, charlies) {
|
|||
await checkMemberList(alice, charly1to5);
|
||||
await joinCharliesWhileAliceIsOffline(alice, charly6to10);
|
||||
await checkMemberList(alice, charly6to10);
|
||||
await charlies.room(alias).leave();
|
||||
await delay(1000);
|
||||
await checkMemberListLacksCharlies(alice, charlies);
|
||||
await checkMemberListLacksCharlies(bob, charlies);
|
||||
}
|
||||
|
||||
const room = "Lazy Loading Test";
|
||||
|
@ -92,6 +96,17 @@ async function checkMemberList(alice, charlies) {
|
|||
alice.log.done();
|
||||
}
|
||||
|
||||
async function checkMemberListLacksCharlies(session, charlies) {
|
||||
session.log.step(`checks the memberlist doesn't contain ${charlies.log.username}`);
|
||||
const displayNames = (await getMembersInMemberlist(session)).map((m) => m.displayName);
|
||||
charlies.sessions.forEach((charly) => {
|
||||
assert(!displayNames.includes(charly.displayName()),
|
||||
`${charly.displayName()} should not be in the member list, ` +
|
||||
`only have ${displayNames}`);
|
||||
});
|
||||
session.log.done();
|
||||
}
|
||||
|
||||
async function joinCharliesWhileAliceIsOffline(alice, charly6to10) {
|
||||
await alice.setOffline(true);
|
||||
await delay(1000);
|
||||
|
|
|
@ -1,27 +0,0 @@
|
|||
/*
|
||||
Copyright 2018 New Vector Ltd
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing, software
|
||||
distributed under the License is distributed on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
*/
|
||||
|
||||
const assert = require('assert');
|
||||
|
||||
module.exports = async function acceptTerms(session) {
|
||||
const reviewTermsButton = await session.waitAndQuery('.mx_QuestionDialog button.mx_Dialog_primary');
|
||||
const termsPagePromise = session.waitForNewPage();
|
||||
await reviewTermsButton.click();
|
||||
const termsPage = await termsPagePromise;
|
||||
const acceptButton = await termsPage.$('input[type=submit]');
|
||||
await acceptButton.click();
|
||||
await session.delay(1000); //TODO yuck, timers
|
||||
}
|
|
@ -1,31 +0,0 @@
|
|||
/*
|
||||
Copyright 2018 New Vector Ltd
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing, software
|
||||
distributed under the License is distributed on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
*/
|
||||
|
||||
const assert = require('assert');
|
||||
const acceptInvite = require("./accept-invite")
|
||||
module.exports = async function acceptServerNoticesInviteAndConsent(session) {
|
||||
await acceptInvite(session, "Server Notices");
|
||||
session.log.step(`accepts terms & conditions`);
|
||||
const consentLink = await session.waitAndQuery(".mx_EventTile_body a");
|
||||
const termsPagePromise = session.waitForNewPage();
|
||||
await consentLink.click();
|
||||
const termsPage = await termsPagePromise;
|
||||
const acceptButton = await termsPage.$('input[type=submit]');
|
||||
await acceptButton.click();
|
||||
await session.delay(1000); //TODO yuck, timers
|
||||
await termsPage.close();
|
||||
session.log.done();
|
||||
}
|
|
@ -14,7 +14,6 @@ See the License for the specific language governing permissions and
|
|||
limitations under the License.
|
||||
*/
|
||||
|
||||
const acceptTerms = require('./consent');
|
||||
const assert = require('assert');
|
||||
|
||||
module.exports = async function signup(session, username, password, homeserver) {
|
||||
|
@ -59,6 +58,15 @@ module.exports = async function signup(session, username, password, homeserver)
|
|||
//confirm dialog saying you cant log back in without e-mail
|
||||
const continueButton = await session.waitAndQuery('.mx_QuestionDialog button.mx_Dialog_primary');
|
||||
await continueButton.click();
|
||||
|
||||
//find the privacy policy checkbox and check it
|
||||
const policyCheckbox = await session.waitAndQuery('.mx_Login_box input[type="checkbox"]');
|
||||
await policyCheckbox.click();
|
||||
|
||||
//now click the 'Accept' button to agree to the privacy policy
|
||||
const acceptButton = await session.waitAndQuery('.mx_InteractiveAuthEntryComponents_termsSubmit');
|
||||
await acceptButton.click();
|
||||
|
||||
//wait for registration to finish so the hash gets set
|
||||
//onhashchange better?
|
||||
await session.delay(2000);
|
||||
|
|
|
@ -674,6 +674,7 @@ user_consent:
|
|||
block_events_error: >-
|
||||
To continue using this homeserver you must review and agree to the
|
||||
terms and conditions at %(consent_uri)s
|
||||
require_at_registration: true
|
||||
|
||||
|
||||
|
||||
|
|
|
@ -34,7 +34,7 @@ pip install --upgrade setuptools
|
|||
python synapse/python_dependencies.py | xargs pip install
|
||||
pip install lxml mock
|
||||
pip install .
|
||||
|
||||
pip install jinja2 # We use the ConsentResource, which requires jinja2
|
||||
python -m synapse.app.homeserver \
|
||||
--server-name localhost \
|
||||
--config-path homeserver.yaml \
|
||||
|
|
Loading…
Reference in a new issue