From 38b1ca9b901f2a9a1069d40e3d24561570428177 Mon Sep 17 00:00:00 2001 From: Richard van der Hoff Date: Wed, 5 Jul 2017 09:35:51 +0100 Subject: [PATCH 1/5] Use headless chrome instead of phantomjs for tests --- karma.conf.js | 15 +++++++++++++++ package.json | 2 +- 2 files changed, 16 insertions(+), 1 deletion(-) diff --git a/karma.conf.js b/karma.conf.js index 1e04366313..d834987e83 100644 --- a/karma.conf.js +++ b/karma.conf.js @@ -113,8 +113,23 @@ module.exports = function (config) { browsers: [ 'Chrome', //'PhantomJS', + //'ChromeHeadless' ], + customLaunchers: { + 'ChromeHeadless': { + base: 'Chrome', + flags: [ + // '--no-sandbox', + // See https://chromium.googlesource.com/chromium/src/+/lkgr/headless/README.md + '--headless', + '--disable-gpu', + // Without a remote debugging port, Google Chrome exits immediately. + '--remote-debugging-port=9222', + ], + } + }, + // Continuous Integration mode // if true, Karma captures browsers, runs the tests and exits // singleRun: false, diff --git a/package.json b/package.json index 3d7e6935fc..dc1058c9e4 100644 --- a/package.json +++ b/package.json @@ -48,7 +48,7 @@ "lintall": "eslint src/ test/", "clean": "rimraf lib webapp electron_app/dist", "prepublish": "npm run build:compile", - "test": "karma start --single-run=true --autoWatch=false --browsers PhantomJS --colors=false", + "test": "karma start --single-run=true --autoWatch=false --browsers ChromeHeadless --colors=false", "test-multi": "karma start" }, "dependencies": { From 9969d6095d46488c0c56663da68b6d9e0ccaac68 Mon Sep 17 00:00:00 2001 From: Richard van der Hoff Date: Wed, 5 Jul 2017 09:43:40 +0100 Subject: [PATCH 2/5] Remove phantomjs; add chrome --- .travis.yml | 4 +++- package.json | 2 -- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/.travis.yml b/.travis.yml index 0656064ec2..55744222b1 100644 --- a/.travis.yml +++ b/.travis.yml @@ -16,7 +16,9 @@ node_js: - 6.3 - 6 - 7 +addons: + chrome: stable install: # clone the deps with depth 1: we know we will only ever need that one # commit. - - scripts/fetch-develop.deps.sh --depth 1 && npm i phantomjs-prebuilt && npm install + - scripts/fetch-develop.deps.sh --depth 1 && npm install diff --git a/package.json b/package.json index dc1058c9e4..83d9bd16a8 100644 --- a/package.json +++ b/package.json @@ -119,14 +119,12 @@ "karma-cli": "^0.1.2", "karma-junit-reporter": "^0.4.1", "karma-mocha": "^0.2.2", - "karma-phantomjs-launcher": "^1.0.0", "karma-webpack": "^1.7.0", "matrix-mock-request": "^1.0.0", "minimist": "^1.2.0", "mkdirp": "^0.5.1", "mocha": "^2.4.5", "parallelshell": "^1.2.0", - "phantomjs-prebuilt": "^2.1.7", "postcss-extend": "^1.0.5", "postcss-import": "^9.0.0", "postcss-loader": "^1.2.2", From cfe9e762ad36556561c43a471b76de748a2ceb8d Mon Sep 17 00:00:00 2001 From: Richard van der Hoff Date: Wed, 5 Jul 2017 10:01:13 +0100 Subject: [PATCH 3/5] Use trusty dist --- .travis.yml | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/.travis.yml b/.travis.yml index 55744222b1..409fcd75d4 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,3 +1,10 @@ +# we need trusty for the chrome addon +dist: trusty + +# we don't need sudo, so can run in a container, which makes startup much +# quicker. +sudo: false + language: node_js node_js: # make sure we work with a range of node versions. From ba0073ca71af36e0f6ed671e35c4235b03286f88 Mon Sep 17 00:00:00 2001 From: Richard van der Hoff Date: Wed, 5 Jul 2017 11:45:23 +0100 Subject: [PATCH 4/5] README: Add notes on running tests --- README.md | 35 +++++++++++++++++++++++++---------- 1 file changed, 25 insertions(+), 10 deletions(-) diff --git a/README.md b/README.md index 89f2148f5e..3334ad4ed4 100644 --- a/README.md +++ b/README.md @@ -282,19 +282,34 @@ If any of these steps error with, `file table overflow`, you are probably on a m which has a very low limit on max open files. Run `ulimit -Sn 1024` and try again. You'll need to do this in each new terminal you open before building Riot. -How to add a new translation? -============================= +Running the tests +----------------- + +There are a number of application-level tests in the `tests` directory; these +are designed to run in a browser instance under the control of +[karma](https://karma-runner.github.io). To run them: + +* Make sure you have Chrome installed (a recent version, like 59) +* Make sure you have `matrix-js-sdk` and `matrix-react-sdk` installed and + built, as above +* `npm run test` + +The above will run the tests under Chrome in a `headless` mode. + +You can also tell karma to run the tests in a loop (every time the source +changes), in an instance of Chrome on your desktop, with `npm run +test-multi`. This also gives you the option of running the tests in 'debug' +mode, which is useful for stepping through the tests in the developer tools. + +Translations +============ + +To add a new translation, head to the [translating doc](docs/translating.md). + +For a developer guide, see the [translating dev doc](docs/translating-dev.md). [translationsstatus](https://translate.riot.im/engage/riot-web/?utm_source=widget) - -Head to the [translating doc](docs/translating.md) - -Adding Strings to the translations (Developer Guide) -==================================================== - -Head to the [translating dev doc](docs/translating-dev.md) - Triaging issues =============== From a14bc9a9b1642b674b22afff10bc570d740c7b0d Mon Sep 17 00:00:00 2001 From: Richard van der Hoff Date: Wed, 5 Jul 2017 11:47:38 +0100 Subject: [PATCH 5/5] README: minor fixes --- README.md | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/README.md b/README.md index 3334ad4ed4..d4b778b91e 100644 --- a/README.md +++ b/README.md @@ -81,7 +81,7 @@ to build. npm run build ``` However, we recommend setting up a proper development environment (see "Setting - up a development environment" below) if you want to run your own copy of the + up a dev environment" below) if you want to run your own copy of the `develop` branch, as it makes it much easier to keep these dependencies up-to-date. Or just use https://riot.im/develop - the continuous integration release of the develop branch. @@ -253,7 +253,6 @@ Finally, build and start Riot itself: 1. `rm -r node_modules/matrix-react-sdk; ln -s ../../matrix-react-sdk node_modules/` 1. `npm start` 1. Wait a few seconds for the initial build to finish; you should see something like: - ``` Hash: b0af76309dd56d7275c8 Version: webpack 1.12.14