Merge pull request #5466 from matrix-org/jryans/rebrand-ci
Rebrand various CI scripts and modules
This commit is contained in:
commit
3dfa535c8c
24 changed files with 90 additions and 90 deletions
|
@ -1,4 +1,4 @@
|
|||
src/component-index.js
|
||||
test/end-to-end-tests/node_modules/
|
||||
test/end-to-end-tests/riot/
|
||||
test/end-to-end-tests/element/
|
||||
test/end-to-end-tests/synapse/
|
||||
|
|
|
@ -12,5 +12,5 @@ test/components/views/dialogs/InteractiveAuthDialog-test.js
|
|||
test/mock-clock.js
|
||||
src/component-index.js
|
||||
test/end-to-end-tests/node_modules/
|
||||
test/end-to-end-tests/riot/
|
||||
test/end-to-end-tests/element/
|
||||
test/end-to-end-tests/synapse/
|
||||
|
|
|
@ -50,7 +50,7 @@
|
|||
"lint:types": "tsc --noEmit --jsx react",
|
||||
"lint:style": "stylelint 'res/css/**/*.scss'",
|
||||
"test": "jest",
|
||||
"test:e2e": "./test/end-to-end-tests/run.sh --riot-url http://localhost:8080"
|
||||
"test:e2e": "./test/end-to-end-tests/run.sh --app-url http://localhost:8080"
|
||||
},
|
||||
"dependencies": {
|
||||
"@babel/runtime": "^7.10.5",
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
# Update on docker hub with the following commands in the directory of this file:
|
||||
# docker build -t matrixdotorg/riotweb-ci-e2etests-env:latest .
|
||||
# docker build -t vectorim/element-web-ci-e2etests-env:latest .
|
||||
# docker log
|
||||
# docker push matrixdotorg/riotweb-ci-e2etests-env:latest
|
||||
# docker push vectorim/element-web-ci-e2etests-env:latest
|
||||
FROM node:10
|
||||
RUN apt-get update
|
||||
RUN apt-get -y install build-essential python3-dev libffi-dev python-pip python-setuptools sqlite3 libssl-dev python-virtualenv libjpeg-dev libxslt1-dev uuid-runtime
|
||||
|
|
12
scripts/ci/app-tests.sh
Executable file
12
scripts/ci/app-tests.sh
Executable file
|
@ -0,0 +1,12 @@
|
|||
#!/bin/bash
|
||||
#
|
||||
# script which is run by the CI build (after `yarn test`).
|
||||
#
|
||||
# clones element-web develop and runs the tests against our version of react-sdk.
|
||||
|
||||
set -ev
|
||||
|
||||
scripts/ci/layered.sh
|
||||
cd ../element-web
|
||||
yarn build:genfiles # so the tests can run. Faster version of `build`
|
||||
yarn test
|
|
@ -2,7 +2,7 @@
|
|||
#
|
||||
# script which is run by the CI build (after `yarn test`).
|
||||
#
|
||||
# clones riot-web develop and runs the tests against our version of react-sdk.
|
||||
# clones element-web develop and runs the tests against our version of react-sdk.
|
||||
|
||||
set -ev
|
||||
|
||||
|
@ -14,20 +14,20 @@ handle_error() {
|
|||
trap 'handle_error' ERR
|
||||
|
||||
echo "--- Building Element"
|
||||
scripts/ci/layered-riot-web.sh
|
||||
cd ../riot-web
|
||||
riot_web_dir=`pwd`
|
||||
scripts/ci/layered.sh
|
||||
cd ../element-web
|
||||
element_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
|
||||
ln -s $element_web_dir element/element-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
|
||||
# install static webserver to server symlinked local copy of element
|
||||
./element/install-webserver.sh
|
||||
rm -r logs || true
|
||||
mkdir logs
|
||||
echo "+++ Running end-to-end tests"
|
||||
|
|
|
@ -1,8 +1,8 @@
|
|||
#!/bin/bash
|
||||
|
||||
# Creates an environment similar to one that riot-web would expect for
|
||||
# Creates an environment similar to one that element-web would expect for
|
||||
# development. This means going one directory up (and assuming we're in
|
||||
# a directory like /workdir/matrix-react-sdk) and putting riot-web and
|
||||
# a directory like /workdir/matrix-react-sdk) and putting element-web and
|
||||
# the js-sdk there.
|
||||
|
||||
cd ../ # Assume we're at something like /workdir/matrix-react-sdk
|
||||
|
@ -21,9 +21,9 @@ yarn link
|
|||
yarn install
|
||||
popd
|
||||
|
||||
# Finally, set up riot-web
|
||||
matrix-react-sdk/scripts/fetchdep.sh vector-im riot-web
|
||||
pushd riot-web
|
||||
# Finally, set up element-web
|
||||
matrix-react-sdk/scripts/fetchdep.sh vector-im element-web
|
||||
pushd element-web
|
||||
yarn link matrix-js-sdk
|
||||
yarn link matrix-react-sdk
|
||||
yarn install
|
|
@ -1,12 +0,0 @@
|
|||
#!/bin/bash
|
||||
#
|
||||
# script which is run by the CI build (after `yarn test`).
|
||||
#
|
||||
# clones riot-web develop and runs the tests against our version of react-sdk.
|
||||
|
||||
set -ev
|
||||
|
||||
scripts/ci/layered-riot-web.sh
|
||||
cd ../riot-web
|
||||
yarn build:genfiles # so the tests can run. Faster version of `build`
|
||||
yarn test
|
1
scripts/ci/riot-unit-tests.sh
Symbolic link
1
scripts/ci/riot-unit-tests.sh
Symbolic link
|
@ -0,0 +1 @@
|
|||
app-tests.sh
|
2
test/end-to-end-tests/.gitignore
vendored
2
test/end-to-end-tests/.gitignore
vendored
|
@ -1,3 +1,3 @@
|
|||
node_modules
|
||||
*.png
|
||||
riot/env
|
||||
element/env
|
||||
|
|
|
@ -5,9 +5,9 @@ This directory contains tests for matrix-react-sdk. The tests fire up a headless
|
|||
## Setup
|
||||
|
||||
Run `./install.sh`. This will:
|
||||
- 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.
|
||||
- install Riot, this fetches the master branch at the moment.
|
||||
- install dependencies (will download copy of chrome)
|
||||
- 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.
|
||||
- install Element Web, this fetches the develop branch at the moment.
|
||||
- install dependencies (will download copy of Chrome)
|
||||
|
||||
## Running the tests
|
||||
|
||||
|
@ -15,7 +15,7 @@ Run tests with `./run.sh`.
|
|||
|
||||
### Debug tests locally.
|
||||
|
||||
`./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.
|
||||
`./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.
|
||||
|
||||
```
|
||||
./synapse/stop.sh && \
|
||||
|
@ -26,8 +26,7 @@ It's important to always stop and start Synapse before each run of the tests to
|
|||
|
||||
start.js accepts these parameters (and more, see `node start.js --help`) that can help running the tests locally:
|
||||
|
||||
- `--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.
|
||||
- `--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.
|
||||
- `--slow-mo` type at a human speed, useful with `--windowed`.
|
||||
- `--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.
|
||||
- `--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.
|
||||
|
|
|
@ -5,14 +5,14 @@ and start following these steps to get going:
|
|||
|
||||
1. Navigate to your working directory (`cd /mnt/c/users/travisr/whatever/matrix-react-sdk` for example).
|
||||
2. Run `sudo apt-get install unzip python3 virtualenv dos2unix`
|
||||
3. Run `dos2unix ./test/end-to-end-tests/*.sh ./test/end-to-end-tests/synapse/*.sh ./test/end-to-end-tests/riot/*.sh`
|
||||
3. Run `dos2unix ./test/end-to-end-tests/*.sh ./test/end-to-end-tests/synapse/*.sh ./test/end-to-end-tests/element/*.sh`
|
||||
4. Install NodeJS for ubuntu:
|
||||
```bash
|
||||
curl -sL https://deb.nodesource.com/setup_12.x | sudo -E bash -
|
||||
sudo apt-get update
|
||||
sudo apt-get install nodejs
|
||||
```
|
||||
5. Start Riot on Windows through `yarn start`
|
||||
5. Start Element on Windows through `yarn start`
|
||||
6. While that builds... Run:
|
||||
```bash
|
||||
sudo apt-get install x11-apps
|
||||
|
@ -25,11 +25,11 @@ and start following these steps to get going:
|
|||
cd ./test/end-to-end-tests
|
||||
./synapse/install.sh
|
||||
./install.sh
|
||||
./run.sh --riot-url http://localhost:8080 --no-sandbox
|
||||
./run.sh --app-url http://localhost:8080 --no-sandbox
|
||||
```
|
||||
|
||||
Note that using `yarn test:e2e` probably won't work for you. You might also have to use the config.json from the
|
||||
`riot/config-template` directory in order to actually succeed at the tests.
|
||||
`element/config-template` directory in order to actually succeed at the tests.
|
||||
|
||||
Also note that you'll have to use `--no-sandbox` otherwise Chrome will complain that there's no sandbox available. You
|
||||
could probably fix this with enough effort, or you could run a headless Chrome in the WSL container without a sandbox.
|
||||
|
|
2
test/end-to-end-tests/element/.gitignore
vendored
Normal file
2
test/end-to-end-tests/element/.gitignore
vendored
Normal file
|
@ -0,0 +1,2 @@
|
|||
element-web
|
||||
element.pid
|
|
@ -8,7 +8,7 @@
|
|||
"brand": "Element",
|
||||
"integrations_ui_url": "https://scalar.vector.im/",
|
||||
"integrations_rest_url": "https://scalar.vector.im/api",
|
||||
"bug_report_endpoint_url": "https://riot.im/bugreports/submit",
|
||||
"bug_report_endpoint_url": "https://element.io/bugreports/submit",
|
||||
"showLabsSettings": true,
|
||||
"default_federate": true,
|
||||
"welcomePageUrl": "home.html",
|
16
test/end-to-end-tests/element/install.sh
Executable file
16
test/end-to-end-tests/element/install.sh
Executable file
|
@ -0,0 +1,16 @@
|
|||
#!/bin/bash
|
||||
set -e
|
||||
ELEMENT_BRANCH=develop
|
||||
|
||||
if [ -d $BASE_DIR/element-web ]; then
|
||||
echo "Element is already installed"
|
||||
exit
|
||||
fi
|
||||
|
||||
curl -L https://github.com/vector-im/element-web/archive/${ELEMENT_BRANCH}.zip --output element.zip
|
||||
unzip -q element.zip
|
||||
rm element.zip
|
||||
mv element-web-${ELEMENT_BRANCH} element-web
|
||||
cd element-web
|
||||
yarn install
|
||||
yarn run build
|
|
@ -3,7 +3,7 @@ set -e
|
|||
|
||||
PORT=5000
|
||||
BASE_DIR=$(cd $(dirname $0) && pwd)
|
||||
PIDFILE=$BASE_DIR/riot.pid
|
||||
PIDFILE=$BASE_DIR/element.pid
|
||||
CONFIG_BACKUP=config.e2etests_backup.json
|
||||
|
||||
if [ -f $PIDFILE ]; then
|
||||
|
@ -11,8 +11,8 @@ if [ -f $PIDFILE ]; then
|
|||
fi
|
||||
|
||||
cd $BASE_DIR/
|
||||
echo -n "starting riot on http://localhost:$PORT ... "
|
||||
pushd riot-web/webapp/ > /dev/null
|
||||
echo -n "Starting Element on http://localhost:$PORT ... "
|
||||
pushd element-web/webapp/ > /dev/null
|
||||
|
||||
# backup config file before we copy template
|
||||
if [ -f config.json ]; then
|
||||
|
@ -34,7 +34,7 @@ LOGFILE=$(mktemp)
|
|||
# NOT expected SIGTERM (128 + 15)
|
||||
# from stop.sh?
|
||||
if [ $RESULT -ne 143 ]; then
|
||||
echo "failed"
|
||||
echo "Failed"
|
||||
cat $LOGFILE
|
||||
rm $PIDFILE 2> /dev/null
|
||||
fi
|
||||
|
@ -49,6 +49,6 @@ sleep 0.5 &
|
|||
wait -n; RESULT=$?
|
||||
# return exit code of first child to exit
|
||||
if [ $RESULT -eq 0 ]; then
|
||||
echo "running"
|
||||
echo "Running"
|
||||
fi
|
||||
exit $RESULT
|
|
@ -2,19 +2,19 @@
|
|||
set -e
|
||||
|
||||
BASE_DIR=$(cd $(dirname $0) && pwd)
|
||||
PIDFILE=riot.pid
|
||||
PIDFILE=element.pid
|
||||
CONFIG_BACKUP=config.e2etests_backup.json
|
||||
|
||||
cd $BASE_DIR
|
||||
|
||||
if [ -f $PIDFILE ]; then
|
||||
echo "stopping riot server ..."
|
||||
echo "Stopping Element server ..."
|
||||
PID=$(cat $PIDFILE)
|
||||
rm $PIDFILE
|
||||
kill $PID
|
||||
|
||||
# revert config file
|
||||
cd riot-web/webapp
|
||||
cd element-web/webapp
|
||||
rm config.json
|
||||
if [ -f $CONFIG_BACKUP ]; then
|
||||
mv $CONFIG_BACKUP config.json
|
|
@ -15,10 +15,10 @@ limitations under the License.
|
|||
*/
|
||||
|
||||
// used from run.sh as getopts doesn't support long parameters
|
||||
const idx = process.argv.indexOf("--riot-url");
|
||||
let hasRiotUrl = false;
|
||||
const idx = process.argv.indexOf("--app-url");
|
||||
let hasAppUrl = false;
|
||||
if (idx !== -1) {
|
||||
const value = process.argv[idx + 1];
|
||||
hasRiotUrl = !!value;
|
||||
hasAppUrl = !!value;
|
||||
}
|
||||
process.stdout.write(hasRiotUrl ? "1" : "0" );
|
||||
process.stdout.write(hasAppUrl ? "1" : "0" );
|
2
test/end-to-end-tests/riot/.gitignore
vendored
2
test/end-to-end-tests/riot/.gitignore
vendored
|
@ -1,2 +0,0 @@
|
|||
riot-web
|
||||
riot.pid
|
|
@ -1,16 +0,0 @@
|
|||
#!/bin/bash
|
||||
set -e
|
||||
RIOT_BRANCH=develop
|
||||
|
||||
if [ -d $BASE_DIR/riot-web ]; then
|
||||
echo "riot is already installed"
|
||||
exit
|
||||
fi
|
||||
|
||||
curl -L https://github.com/vector-im/riot-web/archive/${RIOT_BRANCH}.zip --output riot.zip
|
||||
unzip -q riot.zip
|
||||
rm riot.zip
|
||||
mv riot-web-${RIOT_BRANCH} riot-web
|
||||
cd riot-web
|
||||
yarn install
|
||||
yarn run build
|
|
@ -9,16 +9,16 @@ echo "Please first run $BASE_DIR/install.sh"
|
|||
exit 1
|
||||
fi
|
||||
|
||||
has_custom_riot=$(node has_custom_riot.js $@)
|
||||
has_custom_app=$(node has-custom-app.js $@)
|
||||
|
||||
if [ ! -d "riot/riot-web" ] && [ $has_custom_riot -ne "1" ]; then
|
||||
echo "Please provide an instance of riot to test against by passing --riot-url <url> or running $BASE_DIR/riot/install.sh"
|
||||
if [ ! -d "element/element-web" ] && [ $has_custom_app -ne "1" ]; then
|
||||
echo "Please provide an instance of Element to test against by passing --element-url <url> or running $BASE_DIR/element/install.sh"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
stop_servers() {
|
||||
if [ $has_custom_riot -ne "1" ]; then
|
||||
./riot/stop.sh
|
||||
if [ $has_custom_app -ne "1" ]; then
|
||||
./element/stop.sh
|
||||
fi
|
||||
./synapse/stop.sh
|
||||
}
|
||||
|
@ -32,8 +32,8 @@ handle_error() {
|
|||
trap 'handle_error' ERR
|
||||
|
||||
./synapse/start.sh
|
||||
if [ $has_custom_riot -ne "1" ]; then
|
||||
./riot/start.sh
|
||||
if [ $has_custom_app -ne "1" ]; then
|
||||
./element/start.sh
|
||||
fi
|
||||
node start.js $@
|
||||
stop_servers
|
||||
|
|
|
@ -22,12 +22,12 @@ const {delay} = require('./util');
|
|||
|
||||
const DEFAULT_TIMEOUT = 20000;
|
||||
|
||||
module.exports = class RiotSession {
|
||||
constructor(browser, page, username, riotserver, hsUrl) {
|
||||
module.exports = class ElementSession {
|
||||
constructor(browser, page, username, elementServer, hsUrl) {
|
||||
this.browser = browser;
|
||||
this.page = page;
|
||||
this.hsUrl = hsUrl;
|
||||
this.riotserver = riotserver;
|
||||
this.elementServer = elementServer;
|
||||
this.username = username;
|
||||
this.consoleLog = new LogBuffer(page, "console", (msg) => `${msg.text()}\n`);
|
||||
this.networkLog = new LogBuffer(page, "requestfinished", async (req) => {
|
||||
|
@ -38,7 +38,7 @@ module.exports = class RiotSession {
|
|||
this.log = new Logger(this.username);
|
||||
}
|
||||
|
||||
static async create(username, puppeteerOptions, riotserver, hsUrl, throttleCpuFactor = 1) {
|
||||
static async create(username, puppeteerOptions, elementServer, hsUrl, throttleCpuFactor = 1) {
|
||||
const browser = await puppeteer.launch(puppeteerOptions);
|
||||
const page = await browser.newPage();
|
||||
await page.setViewport({
|
||||
|
@ -50,7 +50,7 @@ module.exports = class RiotSession {
|
|||
console.log("throttling cpu by a factor of", throttleCpuFactor);
|
||||
await client.send('Emulation.setCPUThrottlingRate', { rate: throttleCpuFactor });
|
||||
}
|
||||
return new RiotSession(browser, page, username, riotserver, hsUrl);
|
||||
return new ElementSession(browser, page, username, elementServer, hsUrl);
|
||||
}
|
||||
|
||||
async tryGetInnertext(selector) {
|
||||
|
@ -194,7 +194,7 @@ module.exports = class RiotSession {
|
|||
}
|
||||
|
||||
url(path) {
|
||||
return this.riotserver + path;
|
||||
return this.elementServer + path;
|
||||
}
|
||||
|
||||
delay(ms) {
|
||||
|
|
|
@ -14,7 +14,7 @@ See the License for the specific language governing permissions and
|
|||
limitations under the License.
|
||||
*/
|
||||
|
||||
const RiotSession = require('./src/session');
|
||||
const ElementSession = require('./src/session');
|
||||
const scenario = require('./src/scenario');
|
||||
const RestSessionCreator = require('./src/rest/creator');
|
||||
const fs = require("fs");
|
||||
|
@ -22,7 +22,7 @@ const fs = require("fs");
|
|||
const program = require('commander');
|
||||
program
|
||||
.option('--no-logs', "don't output logs, document html on error", false)
|
||||
.option('--riot-url [url]', "riot url to test", "http://localhost:5000")
|
||||
.option('--app-url [url]', "url to test", "http://localhost:5000")
|
||||
.option('--windowed', "dont run tests headless", false)
|
||||
.option('--slow-mo', "type at a human speed", false)
|
||||
.option('--dev-tools', "open chrome devtools in browser window", false)
|
||||
|
@ -57,7 +57,7 @@ async function runTests() {
|
|||
);
|
||||
|
||||
async function createSession(username) {
|
||||
const session = await RiotSession.create(username, options, program.riotUrl, hsUrl, program.throttleCpu);
|
||||
const session = await ElementSession.create(username, options, program.appUrl, hsUrl, program.throttleCpu);
|
||||
sessions.push(session);
|
||||
return session;
|
||||
}
|
||||
|
|
|
@ -875,8 +875,8 @@ password_config:
|
|||
|
||||
|
||||
# Enable sending emails for notification events
|
||||
# Defining a custom URL for Riot is only needed if email notifications
|
||||
# should contain links to a self-hosted installation of Riot; when set
|
||||
# Defining a custom URL for Element is only needed if email notifications
|
||||
# should contain links to a self-hosted installation of Element; when set
|
||||
# the "app_name" setting is ignored.
|
||||
#
|
||||
# If your SMTP server requires authentication, the optional smtp_user &
|
||||
|
@ -897,7 +897,7 @@ email:
|
|||
notif_template_html: notif_mail.html
|
||||
notif_template_text: notif_mail.txt
|
||||
notif_for_new_users: True
|
||||
riot_base_url: "http://localhost/riot"
|
||||
client_base_url: "http://localhost/element"
|
||||
|
||||
|
||||
#password_providers:
|
||||
|
|
Loading…
Reference in a new issue