From 6d46ef548e27bda21006e4bd024ef697549e5965 Mon Sep 17 00:00:00 2001 From: Travis Ralston Date: Thu, 16 Apr 2020 16:26:29 -0600 Subject: [PATCH 1/2] Enable tests again to catch failures --- package.json | 3 +-- scripts/ci/end-to-end-tests.sh | 47 +++++++++++++++------------------- 2 files changed, 22 insertions(+), 28 deletions(-) diff --git a/package.json b/package.json index 4204b87b5a..7ba69c4272 100644 --- a/package.json +++ b/package.json @@ -51,8 +51,7 @@ "lint:types": "tsc --noEmit --jsx react", "lint:style": "stylelint 'res/css/**/*.scss'", "test": "jest", - "test:e2e": "echo 'The tests are broken with cross-signing. Fix them: https://github.com/vector-im/riot-web/issues/13226'", - "test:e2e_real": "./test/end-to-end-tests/run.sh --riot-url http://localhost:8080" + "test:e2e": "./test/end-to-end-tests/run.sh --riot-url http://localhost:8080" }, "dependencies": { "@babel/runtime": "^7.8.3", diff --git a/scripts/ci/end-to-end-tests.sh b/scripts/ci/end-to-end-tests.sh index fa1f2b983f..1233677db4 100755 --- a/scripts/ci/end-to-end-tests.sh +++ b/scripts/ci/end-to-end-tests.sh @@ -13,29 +13,24 @@ handle_error() { trap 'handle_error' ERR -echo "Tests are disabled, see https://github.com/vector-im/riot-web/issues/13226" -exit 0 - -#TODO: Uncomment all of this in https://github.com/vector-im/riot-web/issues/13226 - -#echo "--- Building Riot" -#scripts/ci/layered-riot-web.sh -#cd ../riot-web -#riot_web_dir=`pwd` -#CI_PACKAGE=true yarn build -#cd ../matrix-react-sdk -## run end to end tests -#pushd test/end-to-end-tests -#ln -s $riot_web_dir riot/riot-web -## PUPPETEER_SKIP_CHROMIUM_DOWNLOAD=true ./install.sh -## CHROME_PATH=$(which google-chrome-stable) ./run.sh -#echo "--- Install synapse & other dependencies" -#./install.sh -## install static webserver to server symlinked local copy of riot -#./riot/install-webserver.sh -#rm -r logs || true -#mkdir logs -#echo "+++ Running end-to-end tests" -#TESTS_STARTED=1 -#./run.sh --no-sandbox --log-directory logs/ -#popd +echo "--- Building Riot" +scripts/ci/layered-riot-web.sh +cd ../riot-web +riot_web_dir=`pwd` +CI_PACKAGE=true yarn build +cd ../matrix-react-sdk +# run end to end tests +pushd test/end-to-end-tests +ln -s $riot_web_dir riot/riot-web +# PUPPETEER_SKIP_CHROMIUM_DOWNLOAD=true ./install.sh +# CHROME_PATH=$(which google-chrome-stable) ./run.sh +echo "--- Install synapse & other dependencies" +./install.sh +# install static webserver to server symlinked local copy of riot +./riot/install-webserver.sh +rm -r logs || true +mkdir logs +echo "+++ Running end-to-end tests" +TESTS_STARTED=1 +./run.sh --no-sandbox --log-directory logs/ +popd From a5f5f759cb83cbd03e53e3a2a826134c34cd52d4 Mon Sep 17 00:00:00 2001 From: Travis Ralston Date: Thu, 16 Apr 2020 16:27:43 -0600 Subject: [PATCH 2/2] Create unencrypted rooms by default in e2e-tests Otherwise the lazy loading test will try to join the room after the encrypted messages have already been sent, making them invisible. See https://github.com/vector-im/riot-web/issues/13226#issuecomment-614928362 --- src/components/views/dialogs/CreateRoomDialog.js | 7 ++++++- src/components/views/elements/LabelledToggleSwitch.js | 6 +++++- test/end-to-end-tests/src/usecases/create-room.js | 8 ++++++-- 3 files changed, 17 insertions(+), 4 deletions(-) diff --git a/src/components/views/dialogs/CreateRoomDialog.js b/src/components/views/dialogs/CreateRoomDialog.js index fa8c7dd30e..74e006354b 100644 --- a/src/components/views/dialogs/CreateRoomDialog.js +++ b/src/components/views/dialogs/CreateRoomDialog.js @@ -194,7 +194,12 @@ export default createReactClass({ let e2eeSection; if (!this.state.isPublic && SettingsStore.getValue("feature_cross_signing")) { e2eeSection = - +

{ _t("You can’t disable this later. Bridges & most bots won’t work yet.") }

; } diff --git a/src/components/views/elements/LabelledToggleSwitch.js b/src/components/views/elements/LabelledToggleSwitch.js index ecd4d39bf8..78beb2aa91 100644 --- a/src/components/views/elements/LabelledToggleSwitch.js +++ b/src/components/views/elements/LabelledToggleSwitch.js @@ -35,6 +35,9 @@ export default class LabelledToggleSwitch extends React.Component { // True to put the toggle in front of the label // Default false. toggleInFront: PropTypes.bool, + + // Additional class names to append to the switch. Optional. + className: PropTypes.string, }; render() { @@ -50,8 +53,9 @@ export default class LabelledToggleSwitch extends React.Component { secondPart = temp; } + const classes = `mx_SettingsFlag ${this.props.className || ""}`; return ( -
+
{firstPart} {secondPart}
diff --git a/test/end-to-end-tests/src/usecases/create-room.js b/test/end-to-end-tests/src/usecases/create-room.js index 140748bca7..ab2d9b69b9 100644 --- a/test/end-to-end-tests/src/usecases/create-room.js +++ b/test/end-to-end-tests/src/usecases/create-room.js @@ -20,7 +20,7 @@ async function openRoomDirectory(session) { await roomDirectoryButton.click(); } -async function createRoom(session, roomName) { +async function createRoom(session, roomName, encrypted=false) { session.log.step(`creates room "${roomName}"`); const roomListHeaders = await session.queryAll('.mx_RoomSubList_labelContainer'); @@ -33,10 +33,14 @@ async function createRoom(session, roomName) { const addRoomButton = await roomsHeader.$(".mx_RoomSubList_addRoom"); await addRoomButton.click(); - const roomNameInput = await session.query('.mx_CreateRoomDialog_name input'); await session.replaceInputText(roomNameInput, roomName); + if (!encrypted) { + const encryptionToggle = await session.query('.mx_CreateRoomDialog_e2eSwitch .mx_ToggleSwitch'); + await encryptionToggle.click(); + } + const createButton = await session.query('.mx_Dialog_primary'); await createButton.click();