Skip to content

Commit

Permalink
ci: use headless chrome on travis
Browse files Browse the repository at this point in the history
  • Loading branch information
filipesilva committed Jul 21, 2017
1 parent 861b32b commit 509dfd1
Show file tree
Hide file tree
Showing 4 changed files with 27 additions and 7 deletions.
3 changes: 0 additions & 3 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -92,9 +92,6 @@ matrix:


before_install:
# Use a virtual display.
- export DISPLAY=:99.0
- sh -e /etc/init.d/xvfb start
# Install yarn.
- curl -o- -L https://yarnpkg.com/install.sh | bash
- export PATH="$HOME/.yarn/bin:$PATH"
Expand Down
2 changes: 1 addition & 1 deletion tests/e2e/assets/1.0.0-proj/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@
"jasmine-core": "~2.5.2",
"jasmine-spec-reporter": "~3.2.0",
"karma": "~1.4.1",
"karma-chrome-launcher": "~2.0.0",
"karma-chrome-launcher": "~2.1.1",
"karma-cli": "~1.0.1",
"karma-jasmine": "~1.1.0",
"karma-jasmine-html-reporter": "^0.2.2",
Expand Down
8 changes: 5 additions & 3 deletions tests/e2e/setup/500-create-project.ts
Original file line number Diff line number Diff line change
Expand Up @@ -39,20 +39,22 @@ export default function() {
// There's a race condition happening in Chrome. Enabling logging in chrome used by
// protractor actually fixes it. Logging is piped to a file so it doesn't affect our setup.
// --no-sandbox is needed for Circle CI.
// Travis can use headless chrome, but not appveyor.
.then(() => replaceInFile('protractor.conf.js', `'browserName': 'chrome'`,
`'browserName': 'chrome',
chromeOptions: {
args: [
"--enable-logging",
"--no-sandbox",
${process.env['TRAVIS'] ? '"--headless", "--disable-gpu"' : ''}
]
}
`))
.then(() => replaceInFile('karma.conf.js', `browsers: ['Chrome'],`,
`browsers: ['ChromeNoSandbox'],
`browsers: ['ChromeCI'],
customLaunchers: {
ChromeNoSandbox: {
base: 'Chrome',
ChromeCI: {
base: '${process.env['TRAVIS'] ? 'ChromeHeadless' : 'Chrome'}',
flags: ['--no-sandbox']
}
},
Expand Down
21 changes: 21 additions & 0 deletions tests/e2e/tests/misc/breaking-change.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import { createProjectFromAsset } from '../../utils/assets';
import { replaceInFile } from '../../utils/fs';
import { ng } from '../../utils/process';

// This test ensures a project generated with 1.0.0 will still work.
Expand All @@ -7,6 +8,26 @@ import { ng } from '../../utils/process';
export default function () {
return Promise.resolve()
.then(() => createProjectFromAsset('1.0.0-proj'))
// Update chrome configs.
.then(() => replaceInFile('protractor.conf.js', `'browserName': 'chrome'`,
`'browserName': 'chrome',
chromeOptions: {
args: [
"--enable-logging",
"--no-sandbox",
${process.env['TRAVIS'] ? '"--headless", "--disable-gpu"' : ''}
]
}
`))
.then(() => replaceInFile('karma.conf.js', `browsers: ['Chrome'],`,
`browsers: ['ChromeCI'],
customLaunchers: {
ChromeCI: {
base: '${process.env['TRAVIS'] ? 'ChromeHeadless' : 'Chrome'}',
flags: ['--no-sandbox']
}
},
`))
.then(() => ng('generate', 'component', 'my-comp'))
.then(() => ng('lint'))
.then(() => ng('test', '--single-run'))
Expand Down

0 comments on commit 509dfd1

Please sign in to comment.