You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
update the CircleCi and Travis configurations
update ng test and ng e2e command flags for version 6
use headless chrome instead of chrome
add guidance on ChromeDriver
closes#10677
Copy file name to clipboardExpand all lines: docs/documentation/stories/continuous-integration.md
+48-32
Original file line number
Diff line number
Diff line change
@@ -23,22 +23,24 @@ set up Circle CI and Travis CI.
23
23
Even though `ng test` and `ng e2e` already run on your environment, they need to be adjusted to
24
24
run in CI environments.
25
25
26
-
When using Chrome in CI environments it has to be started without sandboxing.
27
-
We can achieve that by editing our test configs.
26
+
We'll use [Headless Chrome](https://developers.google.com/web/updates/2017/04/headless-chrome#cli) in CI environments. In some environments we need to start the browser without
27
+
sandboxing or disable the gpu. Here we'll do both.
28
28
29
-
In `karma.conf.js`, add a custom launcher called `ChromeNoSandbox` below `browsers`:
29
+
In `karma.conf.js`, add a custom launcher called `ChromeHeadlessCI` below `browsers`:
30
30
31
31
```
32
32
browsers: ['Chrome'],
33
33
customLaunchers: {
34
-
ChromeNoSandbox: {
35
-
base: 'Chrome',
36
-
flags: ['--no-sandbox']
34
+
ChromeHeadlessCI: {
35
+
base: 'ChromeHeadless',
36
+
flags: ['--no-sandbox', '--disable-gpu']
37
37
}
38
38
},
39
39
```
40
40
41
-
Create a new file in the root of your project called `protractor-ci.conf.js`, that extends
41
+
We'll override the `browsers` option from the command line to use our new configuration.
42
+
43
+
Create a new file in the `e2e` directory of your project called `protractor-ci.conf.js`, that extends
- run: xvfb-run -a npm run test -- --no-watch --no-progress --browser=ChromeNoSandbox
90
-
- run: xvfb-run -a npm run e2e -- --no-progress --config=protractor-ci.conf.js
91
-
94
+
- "node_modules"
95
+
- run: npm run test -- --watch=false --progress=false --browsers=ChromeHeadlessCI
96
+
- run: npm run e2e -- --protractor-config=./e2e/protractor-ci.conf.js
92
97
```
93
98
94
99
We're doing a few things here:
95
100
-
96
101
- `node_modules` is cached.
97
-
-[npm run](https://docs.npmjs.com/cli/run-script) is used to run `ng` because `@angular/cli` is
102
+
- we use [npm run](https://docs.npmjs.com/cli/run-script) to run `ng` because `@angular/cli` is
98
103
not installed globally. The double dash (`--`) is needed to pass arguments into the npm script.
99
-
-`xvfb-run` is used to run `npm run` to run a command using a virtual screen, which is needed by
100
-
Chrome.
101
104
102
105
Commit your changes and push them to your repository.
103
106
@@ -119,7 +122,7 @@ sudo: false
119
122
language: node_js
120
123
node_js:
121
124
- "8"
122
-
125
+
123
126
addons:
124
127
apt:
125
128
sources:
@@ -135,21 +138,34 @@ install:
135
138
- npm install
136
139
137
140
script:
138
-
# Use Chromium instead of Chrome.
139
-
- export CHROME_BIN=chromium-browser
140
-
- xvfb-run -a npm run test -- --no-watch --no-progress --browser=ChromeNoSandbox
141
-
- xvfb-run -a npm run e2e -- --no-progress --config=protractor-ci.conf.js
142
-
141
+
- npm run test -- --watch=false --progress=false --browsers=ChromeHeadlessCI
142
+
- npm run e2e -- --protractor-config=./e2e/protractor-ci.conf.js
143
143
```
144
144
145
-
Although the syntax is different, we're mostly doing the same steps as were done in the
146
-
Circle CI config.
147
-
The only difference is that Travis doesn't come with Chrome, so we use Chromium instead.
148
-
149
145
Commit your changes and push them to your repository.
150
146
151
147
Next you'll need to [sign up for Travis CI](https://travis-ci.org/auth) and
152
148
[add your project](https://travis-ci.org/profile).
153
149
You'll need to push a new commit to trigger a build.
154
150
155
151
Be sure to check out the [Travis CI docs](https://docs.travis-ci.com/) if you want to know more.
152
+
153
+
## ChromeDriver
154
+
155
+
In CI environments it's a good idea to to use a specific version of [ChromeDriver](http://chromedriver.chromium.org/)
156
+
instead of allowing `ng e2e` to use the latest one. CI environments often use older versions of chrome, which are unsupported by newer versions of ChromeDriver.
0 commit comments