Merge pull request #4433 from matrix-org/travis/fix-e2e-tests

Turn the end-to-end tests back on and fix the lazy-loading tests
This commit is contained in:
Travis Ralston 2020-04-16 22:38:41 -06:00 committed by GitHub
commit 001e4c13bc
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
5 changed files with 39 additions and 32 deletions

View file

@ -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",

View file

@ -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

View file

@ -194,7 +194,12 @@ export default createReactClass({
let e2eeSection;
if (!this.state.isPublic && SettingsStore.getValue("feature_cross_signing")) {
e2eeSection = <React.Fragment>
<LabelledToggleSwitch label={ _t("Enable end-to-end encryption")} onChange={this.onEncryptedChange} value={this.state.isEncrypted} />
<LabelledToggleSwitch
label={ _t("Enable end-to-end encryption")}
onChange={this.onEncryptedChange}
value={this.state.isEncrypted}
className='mx_CreateRoomDialog_e2eSwitch' // for end-to-end tests
/>
<p>{ _t("You cant disable this later. Bridges & most bots wont work yet.") }</p>
</React.Fragment>;
}

View file

@ -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 (
<div className="mx_SettingsFlag">
<div className={classes}>
{firstPart}
{secondPart}
</div>

View file

@ -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();