Skip to content

Commit 43a70c2

Browse files
authored
Merge pull request element-hq#4512 from vector-im/rav/chrome_headless
Use chrome headless instead of phantomjs
2 parents 60703bd + a14bc9a commit 43a70c2

4 files changed

Lines changed: 49 additions & 13 deletions

File tree

‎.travis.yml‎

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,10 @@
1+
# we need trusty for the chrome addon
2+
dist: trusty
3+
4+
# we don't need sudo, so can run in a container, which makes startup much
5+
# quicker.
6+
sudo: false
7+
18
language: node_js
29
node_js:
310
# make sure we work with a range of node versions.
@@ -16,7 +23,9 @@ node_js:
1623
- 6.3
1724
- 6
1825
- 7
26+
addons:
27+
chrome: stable
1928
install:
2029
# clone the deps with depth 1: we know we will only ever need that one
2130
# commit.
22-
- scripts/fetch-develop.deps.sh --depth 1 && npm i phantomjs-prebuilt && npm install
31+
- scripts/fetch-develop.deps.sh --depth 1 && npm install

‎README.md‎

Lines changed: 23 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,7 @@ to build.
8181
npm run build
8282
```
8383
However, we recommend setting up a proper development environment (see "Setting
84-
up a development environment" below) if you want to run your own copy of the
84+
up a dev environment" below) if you want to run your own copy of the
8585
`develop` branch, as it makes it much easier to keep these dependencies
8686
up-to-date. Or just use https://riot.im/develop - the continuous integration
8787
release of the develop branch.
@@ -253,7 +253,6 @@ Finally, build and start Riot itself:
253253
1. `rm -r node_modules/matrix-react-sdk; ln -s ../../matrix-react-sdk node_modules/`
254254
1. `npm start`
255255
1. Wait a few seconds for the initial build to finish; you should see something like:
256-
257256
```
258257
Hash: b0af76309dd56d7275c8
259258
Version: webpack 1.12.14
@@ -282,18 +281,33 @@ If any of these steps error with, `file table overflow`, you are probably on a m
282281
which has a very low limit on max open files. Run `ulimit -Sn 1024` and try again.
283282
You'll need to do this in each new terminal you open before building Riot.
284283
285-
How to add a new translation?
286-
=============================
284+
Running the tests
285+
-----------------
287286
288-
[<img src="https://translate.riot.im/widgets/riot-web/-/multi-auto.svg" alt="translationsstatus" width="340">](https://translate.riot.im/engage/riot-web/?utm_source=widget)
287+
There are a number of application-level tests in the `tests` directory; these
288+
are designed to run in a browser instance under the control of
289+
[karma](https://karma-runner.github.io). To run them:
290+
291+
* Make sure you have Chrome installed (a recent version, like 59)
292+
* Make sure you have `matrix-js-sdk` and `matrix-react-sdk` installed and
293+
built, as above
294+
* `npm run test`
289295
296+
The above will run the tests under Chrome in a `headless` mode.
290297
291-
Head to the [translating doc](docs/translating.md)
298+
You can also tell karma to run the tests in a loop (every time the source
299+
changes), in an instance of Chrome on your desktop, with `npm run
300+
test-multi`. This also gives you the option of running the tests in 'debug'
301+
mode, which is useful for stepping through the tests in the developer tools.
292302
293-
Adding Strings to the translations (Developer Guide)
294-
====================================================
303+
Translations
304+
============
295305
296-
Head to the [translating dev doc](docs/translating-dev.md)
306+
To add a new translation, head to the [translating doc](docs/translating.md).
307+
308+
For a developer guide, see the [translating dev doc](docs/translating-dev.md).
309+
310+
[<img src="https://translate.riot.im/widgets/riot-web/-/multi-auto.svg" alt="translationsstatus" width="340">](https://translate.riot.im/engage/riot-web/?utm_source=widget)
297311
298312
Triaging issues
299313
===============

‎karma.conf.js‎

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -113,8 +113,23 @@ module.exports = function (config) {
113113
browsers: [
114114
'Chrome',
115115
//'PhantomJS',
116+
//'ChromeHeadless'
116117
],
117118

119+
customLaunchers: {
120+
'ChromeHeadless': {
121+
base: 'Chrome',
122+
flags: [
123+
// '--no-sandbox',
124+
// See https://chromium.googlesource.com/chromium/src/+/lkgr/headless/README.md
125+
'--headless',
126+
'--disable-gpu',
127+
// Without a remote debugging port, Google Chrome exits immediately.
128+
'--remote-debugging-port=9222',
129+
],
130+
}
131+
},
132+
118133
// Continuous Integration mode
119134
// if true, Karma captures browsers, runs the tests and exits
120135
// singleRun: false,

‎package.json‎

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@
4848
"lintall": "eslint src/ test/",
4949
"clean": "rimraf lib webapp electron_app/dist",
5050
"prepublish": "npm run build:compile",
51-
"test": "karma start --single-run=true --autoWatch=false --browsers PhantomJS --colors=false",
51+
"test": "karma start --single-run=true --autoWatch=false --browsers ChromeHeadless --colors=false",
5252
"test-multi": "karma start"
5353
},
5454
"dependencies": {
@@ -119,14 +119,12 @@
119119
"karma-cli": "^0.1.2",
120120
"karma-junit-reporter": "^0.4.1",
121121
"karma-mocha": "^0.2.2",
122-
"karma-phantomjs-launcher": "^1.0.0",
123122
"karma-webpack": "^1.7.0",
124123
"matrix-mock-request": "^1.0.0",
125124
"minimist": "^1.2.0",
126125
"mkdirp": "^0.5.1",
127126
"mocha": "^2.4.5",
128127
"parallelshell": "^1.2.0",
129-
"phantomjs-prebuilt": "^2.1.7",
130128
"postcss-extend": "^1.0.5",
131129
"postcss-import": "^9.0.0",
132130
"postcss-loader": "^1.2.2",

0 commit comments

Comments
 (0)