Skip to content

Commit 1fda735

Browse files
committed
Rebrand various CI scripts and modules
This replaces Riot with Element in various CI scripts, modules, parameters, etc. This _should_ be the last major rebranding pass (hopefully). Fixes element-hq/element-web#14894
1 parent 675a4b0 commit 1fda735

22 files changed

+78
-79
lines changed

.eslintignore

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
src/component-index.js
22
test/end-to-end-tests/node_modules/
3-
test/end-to-end-tests/riot/
3+
test/end-to-end-tests/element/
44
test/end-to-end-tests/synapse/

.eslintignore.errorfiles

+1-1
Original file line numberDiff line numberDiff line change
@@ -12,5 +12,5 @@ test/components/views/dialogs/InteractiveAuthDialog-test.js
1212
test/mock-clock.js
1313
src/component-index.js
1414
test/end-to-end-tests/node_modules/
15-
test/end-to-end-tests/riot/
15+
test/end-to-end-tests/element/
1616
test/end-to-end-tests/synapse/

package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@
5050
"lint:types": "tsc --noEmit --jsx react",
5151
"lint:style": "stylelint 'res/css/**/*.scss'",
5252
"test": "jest",
53-
"test:e2e": "./test/end-to-end-tests/run.sh --riot-url http://localhost:8080"
53+
"test:e2e": "./test/end-to-end-tests/run.sh --app-url http://localhost:8080"
5454
},
5555
"dependencies": {
5656
"@babel/runtime": "^7.10.5",

scripts/ci/riot-unit-tests.sh renamed to scripts/ci/app-tests.sh

+3-3
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,11 @@
22
#
33
# script which is run by the CI build (after `yarn test`).
44
#
5-
# clones riot-web develop and runs the tests against our version of react-sdk.
5+
# clones element-web develop and runs the tests against our version of react-sdk.
66

77
set -ev
88

9-
scripts/ci/layered-riot-web.sh
10-
cd ../riot-web
9+
scripts/ci/layered.sh
10+
cd ../element-web
1111
yarn build:genfiles # so the tests can run. Faster version of `build`
1212
yarn test

scripts/ci/end-to-end-tests.sh

+7-7
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
#
33
# script which is run by the CI build (after `yarn test`).
44
#
5-
# clones riot-web develop and runs the tests against our version of react-sdk.
5+
# clones element-web develop and runs the tests against our version of react-sdk.
66

77
set -ev
88

@@ -14,20 +14,20 @@ handle_error() {
1414
trap 'handle_error' ERR
1515

1616
echo "--- Building Element"
17-
scripts/ci/layered-riot-web.sh
18-
cd ../riot-web
19-
riot_web_dir=`pwd`
17+
scripts/ci/layered.sh
18+
cd ../element-web
19+
element_web_dir=`pwd`
2020
CI_PACKAGE=true yarn build
2121
cd ../matrix-react-sdk
2222
# run end to end tests
2323
pushd test/end-to-end-tests
24-
ln -s $riot_web_dir riot/riot-web
24+
ln -s $element_web_dir element/element-web
2525
# PUPPETEER_SKIP_CHROMIUM_DOWNLOAD=true ./install.sh
2626
# CHROME_PATH=$(which google-chrome-stable) ./run.sh
2727
echo "--- Install synapse & other dependencies"
2828
./install.sh
29-
# install static webserver to server symlinked local copy of riot
30-
./riot/install-webserver.sh
29+
# install static webserver to server symlinked local copy of element
30+
./element/install-webserver.sh
3131
rm -r logs || true
3232
mkdir logs
3333
echo "+++ Running end-to-end tests"

scripts/ci/layered-riot-web.sh renamed to scripts/ci/layered.sh

+5-5
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
#!/bin/bash
22

3-
# Creates an environment similar to one that riot-web would expect for
3+
# Creates an environment similar to one that element-web would expect for
44
# development. This means going one directory up (and assuming we're in
5-
# a directory like /workdir/matrix-react-sdk) and putting riot-web and
5+
# a directory like /workdir/matrix-react-sdk) and putting element-web and
66
# the js-sdk there.
77

88
cd ../ # Assume we're at something like /workdir/matrix-react-sdk
@@ -21,9 +21,9 @@ yarn link
2121
yarn install
2222
popd
2323

24-
# Finally, set up riot-web
25-
matrix-react-sdk/scripts/fetchdep.sh vector-im riot-web
26-
pushd riot-web
24+
# Finally, set up element-web
25+
matrix-react-sdk/scripts/fetchdep.sh vector-im element-web
26+
pushd element-web
2727
yarn link matrix-js-sdk
2828
yarn link matrix-react-sdk
2929
yarn install

test/end-to-end-tests/.gitignore

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
node_modules
22
*.png
3-
riot/env
3+
element/env

test/end-to-end-tests/README.md

+5-6
Original file line numberDiff line numberDiff line change
@@ -5,17 +5,17 @@ This directory contains tests for matrix-react-sdk. The tests fire up a headless
55
## Setup
66

77
Run `./install.sh`. This will:
8-
- install Synapse, fetches the master branch at the moment. If anything fails here, please refer to the Synapse README to see if you're missing one of the prerequisites.
9-
- install Riot, this fetches the master branch at the moment.
10-
- install dependencies (will download copy of chrome)
8+
- install Synapse, fetches the develop branch at the moment. If anything fails here, please refer to the Synapse README to see if you're missing one of the prerequisites.
9+
- install Element Web, this fetches the develop branch at the moment.
10+
- install dependencies (will download copy of Chrome)
1111

1212
## Running the tests
1313

1414
Run tests with `./run.sh`.
1515

1616
### Debug tests locally.
1717

18-
`./run.sh` will run the tests against the Riot copy present in `riot/riot-web` served by a static Python HTTP server. You can symlink your `riot-web` develop copy here but that doesn't work well with Webpack recompiling. You can run the test runner directly and specify parameters to get more insight into a failure or run the tests against your local Webpack server.
18+
`./run.sh` will run the tests against the Element copy present in `element/element-web` served by a static Python HTTP server. You can symlink your `element-web` develop copy here but that doesn't work well with Webpack recompiling. You can run the test runner directly and specify parameters to get more insight into a failure or run the tests against your local Webpack server.
1919

2020
```
2121
./synapse/stop.sh && \
@@ -26,8 +26,7 @@ It's important to always stop and start Synapse before each run of the tests to
2626

2727
start.js accepts these parameters (and more, see `node start.js --help`) that can help running the tests locally:
2828

29-
- `--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:
30-
- `welcomeUserId` disabled as the tests assume there is no riot-bot currently.
29+
- `--app-url <url>` don't use the Element Web copy and static server provided by the tests, but use a running server like the Webpack watch server to run the tests against.
3130
- `--slow-mo` type at a human speed, useful with `--windowed`.
3231
- `--throttle-cpu <factor>` throttle cpu in the browser by the given factor. Useful to reproduce failures because of insufficient timeouts happening on the slower CI server.
3332
- `--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.

test/end-to-end-tests/Windows.md

+4-4
Original file line numberDiff line numberDiff line change
@@ -5,14 +5,14 @@ and start following these steps to get going:
55

66
1. Navigate to your working directory (`cd /mnt/c/users/travisr/whatever/matrix-react-sdk` for example).
77
2. Run `sudo apt-get install unzip python3 virtualenv dos2unix`
8-
3. Run `dos2unix ./test/end-to-end-tests/*.sh ./test/end-to-end-tests/synapse/*.sh ./test/end-to-end-tests/riot/*.sh`
8+
3. Run `dos2unix ./test/end-to-end-tests/*.sh ./test/end-to-end-tests/synapse/*.sh ./test/end-to-end-tests/element/*.sh`
99
4. Install NodeJS for ubuntu:
1010
```bash
1111
curl -sL https://deb.nodesource.com/setup_12.x | sudo -E bash -
1212
sudo apt-get update
1313
sudo apt-get install nodejs
1414
```
15-
5. Start Riot on Windows through `yarn start`
15+
5. Start Element on Windows through `yarn start`
1616
6. While that builds... Run:
1717
```bash
1818
sudo apt-get install x11-apps
@@ -25,11 +25,11 @@ and start following these steps to get going:
2525
cd ./test/end-to-end-tests
2626
./synapse/install.sh
2727
./install.sh
28-
./run.sh --riot-url http://localhost:8080 --no-sandbox
28+
./run.sh --app-url http://localhost:8080 --no-sandbox
2929
```
3030

3131
Note that using `yarn test:e2e` probably won't work for you. You might also have to use the config.json from the
32-
`riot/config-template` directory in order to actually succeed at the tests.
32+
`element/config-template` directory in order to actually succeed at the tests.
3333

3434
Also note that you'll have to use `--no-sandbox` otherwise Chrome will complain that there's no sandbox available. You
3535
could probably fix this with enough effort, or you could run a headless Chrome in the WSL container without a sandbox.
+2
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
element-web
2+
element.pid

test/end-to-end-tests/riot/config-template/config.json renamed to test/end-to-end-tests/element/config-template/config.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
"brand": "Element",
99
"integrations_ui_url": "https://scalar.vector.im/",
1010
"integrations_rest_url": "https://scalar.vector.im/api",
11-
"bug_report_endpoint_url": "https://riot.im/bugreports/submit",
11+
"bug_report_endpoint_url": "https://element.io/bugreports/submit",
1212
"showLabsSettings": true,
1313
"default_federate": true,
1414
"welcomePageUrl": "home.html",
+16
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
#!/bin/bash
2+
set -e
3+
ELEMENT_BRANCH=develop
4+
5+
if [ -d $BASE_DIR/element-web ]; then
6+
echo "Element is already installed"
7+
exit
8+
fi
9+
10+
curl -L https://github.com/vector-im/element-web/archive/${ELEMENT_BRANCH}.zip --output element.zip
11+
unzip -q element.zip
12+
rm element.zip
13+
mv element-web-${ELEMENT_BRANCH} element-web
14+
cd element-web
15+
yarn install
16+
yarn run build

test/end-to-end-tests/riot/start.sh renamed to test/end-to-end-tests/element/start.sh

+5-5
Original file line numberDiff line numberDiff line change
@@ -3,16 +3,16 @@ set -e
33

44
PORT=5000
55
BASE_DIR=$(cd $(dirname $0) && pwd)
6-
PIDFILE=$BASE_DIR/riot.pid
6+
PIDFILE=$BASE_DIR/element.pid
77
CONFIG_BACKUP=config.e2etests_backup.json
88

99
if [ -f $PIDFILE ]; then
1010
exit
1111
fi
1212

1313
cd $BASE_DIR/
14-
echo -n "starting riot on http://localhost:$PORT ... "
15-
pushd riot-web/webapp/ > /dev/null
14+
echo -n "Starting Element on http://localhost:$PORT ... "
15+
pushd element-web/webapp/ > /dev/null
1616

1717
# backup config file before we copy template
1818
if [ -f config.json ]; then
@@ -34,7 +34,7 @@ LOGFILE=$(mktemp)
3434
# NOT expected SIGTERM (128 + 15)
3535
# from stop.sh?
3636
if [ $RESULT -ne 143 ]; then
37-
echo "failed"
37+
echo "Failed"
3838
cat $LOGFILE
3939
rm $PIDFILE 2> /dev/null
4040
fi
@@ -49,6 +49,6 @@ sleep 0.5 &
4949
wait -n; RESULT=$?
5050
# return exit code of first child to exit
5151
if [ $RESULT -eq 0 ]; then
52-
echo "running"
52+
echo "Running"
5353
fi
5454
exit $RESULT

test/end-to-end-tests/riot/stop.sh renamed to test/end-to-end-tests/element/stop.sh

+3-3
Original file line numberDiff line numberDiff line change
@@ -2,19 +2,19 @@
22
set -e
33

44
BASE_DIR=$(cd $(dirname $0) && pwd)
5-
PIDFILE=riot.pid
5+
PIDFILE=element.pid
66
CONFIG_BACKUP=config.e2etests_backup.json
77

88
cd $BASE_DIR
99

1010
if [ -f $PIDFILE ]; then
11-
echo "stopping riot server ..."
11+
echo "Stopping Element server ..."
1212
PID=$(cat $PIDFILE)
1313
rm $PIDFILE
1414
kill $PID
1515

1616
# revert config file
17-
cd riot-web/webapp
17+
cd element-web/webapp
1818
rm config.json
1919
if [ -f $CONFIG_BACKUP ]; then
2020
mv $CONFIG_BACKUP config.json

test/end-to-end-tests/has_custom_riot.js renamed to test/end-to-end-tests/has-custom-app.js

+4-4
Original file line numberDiff line numberDiff line change
@@ -15,10 +15,10 @@ limitations under the License.
1515
*/
1616

1717
// used from run.sh as getopts doesn't support long parameters
18-
const idx = process.argv.indexOf("--riot-url");
19-
let hasRiotUrl = false;
18+
const idx = process.argv.indexOf("--app-url");
19+
let hasAppUrl = false;
2020
if (idx !== -1) {
2121
const value = process.argv[idx + 1];
22-
hasRiotUrl = !!value;
22+
hasAppUrl = !!value;
2323
}
24-
process.stdout.write(hasRiotUrl ? "1" : "0" );
24+
process.stdout.write(hasAppUrl ? "1" : "0" );

test/end-to-end-tests/riot/.gitignore

-2
This file was deleted.

test/end-to-end-tests/riot/install.sh

-16
This file was deleted.

test/end-to-end-tests/run.sh

+7-7
Original file line numberDiff line numberDiff line change
@@ -9,16 +9,16 @@ echo "Please first run $BASE_DIR/install.sh"
99
exit 1
1010
fi
1111

12-
has_custom_riot=$(node has_custom_riot.js $@)
12+
has_custom_app=$(node has-custom-app.js $@)
1313

14-
if [ ! -d "riot/riot-web" ] && [ $has_custom_riot -ne "1" ]; then
15-
echo "Please provide an instance of riot to test against by passing --riot-url <url> or running $BASE_DIR/riot/install.sh"
14+
if [ ! -d "element/element-web" ] && [ $has_custom_app -ne "1" ]; then
15+
echo "Please provide an instance of Element to test against by passing --element-url <url> or running $BASE_DIR/element/install.sh"
1616
exit 1
1717
fi
1818

1919
stop_servers() {
20-
if [ $has_custom_riot -ne "1" ]; then
21-
./riot/stop.sh
20+
if [ $has_custom_app -ne "1" ]; then
21+
./element/stop.sh
2222
fi
2323
./synapse/stop.sh
2424
}
@@ -32,8 +32,8 @@ handle_error() {
3232
trap 'handle_error' ERR
3333

3434
./synapse/start.sh
35-
if [ $has_custom_riot -ne "1" ]; then
36-
./riot/start.sh
35+
if [ $has_custom_app -ne "1" ]; then
36+
./element/start.sh
3737
fi
3838
node start.js $@
3939
stop_servers

test/end-to-end-tests/src/session.js

+6-6
Original file line numberDiff line numberDiff line change
@@ -22,12 +22,12 @@ const {delay} = require('./util');
2222

2323
const DEFAULT_TIMEOUT = 20000;
2424

25-
module.exports = class RiotSession {
26-
constructor(browser, page, username, riotserver, hsUrl) {
25+
module.exports = class ElementSession {
26+
constructor(browser, page, username, elementServer, hsUrl) {
2727
this.browser = browser;
2828
this.page = page;
2929
this.hsUrl = hsUrl;
30-
this.riotserver = riotserver;
30+
this.elementServer = elementServer;
3131
this.username = username;
3232
this.consoleLog = new LogBuffer(page, "console", (msg) => `${msg.text()}\n`);
3333
this.networkLog = new LogBuffer(page, "requestfinished", async (req) => {
@@ -38,7 +38,7 @@ module.exports = class RiotSession {
3838
this.log = new Logger(this.username);
3939
}
4040

41-
static async create(username, puppeteerOptions, riotserver, hsUrl, throttleCpuFactor = 1) {
41+
static async create(username, puppeteerOptions, elementServer, hsUrl, throttleCpuFactor = 1) {
4242
const browser = await puppeteer.launch(puppeteerOptions);
4343
const page = await browser.newPage();
4444
await page.setViewport({
@@ -50,7 +50,7 @@ module.exports = class RiotSession {
5050
console.log("throttling cpu by a factor of", throttleCpuFactor);
5151
await client.send('Emulation.setCPUThrottlingRate', { rate: throttleCpuFactor });
5252
}
53-
return new RiotSession(browser, page, username, riotserver, hsUrl);
53+
return new ElementSession(browser, page, username, elementServer, hsUrl);
5454
}
5555

5656
async tryGetInnertext(selector) {
@@ -194,7 +194,7 @@ module.exports = class RiotSession {
194194
}
195195

196196
url(path) {
197-
return this.riotserver + path;
197+
return this.elementServer + path;
198198
}
199199

200200
delay(ms) {

test/end-to-end-tests/start.js

+3-3
Original file line numberDiff line numberDiff line change
@@ -14,15 +14,15 @@ See the License for the specific language governing permissions and
1414
limitations under the License.
1515
*/
1616

17-
const RiotSession = require('./src/session');
17+
const ElementSession = require('./src/session');
1818
const scenario = require('./src/scenario');
1919
const RestSessionCreator = require('./src/rest/creator');
2020
const fs = require("fs");
2121

2222
const program = require('commander');
2323
program
2424
.option('--no-logs', "don't output logs, document html on error", false)
25-
.option('--riot-url [url]', "riot url to test", "http://localhost:5000")
25+
.option('--app-url [url]', "url to test", "http://localhost:5000")
2626
.option('--windowed', "dont run tests headless", false)
2727
.option('--slow-mo', "type at a human speed", false)
2828
.option('--dev-tools', "open chrome devtools in browser window", false)
@@ -57,7 +57,7 @@ async function runTests() {
5757
);
5858

5959
async function createSession(username) {
60-
const session = await RiotSession.create(username, options, program.riotUrl, hsUrl, program.throttleCpu);
60+
const session = await ElementSession.create(username, options, program.appUrl, hsUrl, program.throttleCpu);
6161
sessions.push(session);
6262
return session;
6363
}

0 commit comments

Comments
 (0)