Skip to content
This repository was archived by the owner on Apr 4, 2025. It is now read-only.

Commit 88a94ac

Browse files
clydinhansl
authored andcommitted
test: adjust CLI E2E chrome settings
1 parent d1b7234 commit 88a94ac

3 files changed

Lines changed: 24 additions & 20 deletions

File tree

tests/legacy-cli/e2e/tests/basic/update-1.0.ts

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import { createProjectFromAsset } from '../../utils/assets';
2-
import { expectToFail } from '../../utils/utils';
32
import { ng } from '../../utils/process';
4-
import { useCIChrome } from '../../utils/project';
3+
import { useCIChrome, useCIDefaults } from '../../utils/project';
4+
import { expectToFail } from '../../utils/utils';
55

66

77
export default function () {
@@ -10,6 +10,7 @@ export default function () {
1010
.then(() => useCIChrome('.'))
1111
.then(() => expectToFail(() => ng('build')))
1212
.then(() => ng('update', '@angular/cli'))
13+
.then(() => useCIDefaults('one-oh-project'))
1314
.then(() => ng('generate', 'component', 'my-comp'))
1415
.then(() => ng('test', '--watch=false'))
1516
.then(() => ng('lint'))

tests/legacy-cli/e2e/tests/basic/update-1.7.ts

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import { createProjectFromAsset } from '../../utils/assets';
2-
import { expectToFail } from '../../utils/utils';
32
import { ng } from '../../utils/process';
4-
import { useCIChrome } from '../../utils/project';
3+
import { useCIChrome, useCIDefaults } from '../../utils/project';
4+
import { expectToFail } from '../../utils/utils';
55

66

77
export default function () {
@@ -10,6 +10,7 @@ export default function () {
1010
.then(() => useCIChrome('.'))
1111
.then(() => expectToFail(() => ng('build')))
1212
.then(() => ng('update', '@angular/cli'))
13+
.then(() => useCIDefaults('latest-project'))
1314
.then(() => ng('generate', 'component', 'my-comp'))
1415
.then(() => ng('test', '--watch=false'))
1516
.then(() => ng('lint'))

tests/legacy-cli/e2e/utils/project.ts

Lines changed: 18 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -174,14 +174,14 @@ export function useNgVersion(version: string) {
174174
});
175175
}
176176

177-
export function useCIDefaults() {
177+
export function useCIDefaults(projectName = 'test-project') {
178178
return updateJsonFile('angular.json', workspaceJson => {
179179
// Disable progress reporting on CI to reduce spam.
180-
const appArchitect = workspaceJson.projects['test-project'].architect;
180+
const appArchitect = workspaceJson.projects[projectName].architect;
181181
appArchitect.build.options.progress = false;
182182
appArchitect.test.options.progress = false;
183183
// Disable auto-updating webdriver in e2e.
184-
const e2eArchitect = workspaceJson.projects['test-project-e2e'].architect;
184+
const e2eArchitect = workspaceJson.projects[projectName + '-e2e'].architect;
185185
e2eArchitect.e2e.options.webdriverUpdate = false;
186186
})
187187
.then(() => updateJsonFile('package.json', json => {
@@ -194,8 +194,10 @@ export function useCIDefaults() {
194194
// webdriver 2.37 matches Chrome 65.0.3325.18100 (latest stable).
195195
// The webdriver versions for latest stable will need to be manually updated.
196196
const webdriverVersion = process.env['CIRCLECI'] ? '2.33' : '2.37';
197+
const driverOption = process.env['CHROMEDRIVER_VERSION_ARG']
198+
|| `--versions.chrome ${webdriverVersion}`;
197199
json['scripts']['webdriver-update'] = 'webdriver-manager update' +
198-
` --standalone false --gecko false --versions.chrome ${webdriverVersion}`;
200+
` --standalone false --gecko false ${driverOption}`;
199201
}))
200202
.then(() => npm('run', 'webdriver-update'));
201203
}
@@ -212,22 +214,22 @@ export function useCIChrome(projectDir: string) {
212214
chromeOptions: {
213215
args: [
214216
"--enable-logging",
215-
"--no-sandbox",
216-
${process.env['TRAVIS'] ? '"--headless", "--disable-gpu"' : ''}
217+
// "--no-sandbox",
218+
// "--headless"
217219
]
218220
}
219221
`))
220222
// Not a problem if the file can't be found.
221-
.catch(() => null)
222-
.then(() => replaceInFile(`${projectDir}/karma.conf.js`, `browsers: ['Chrome'],`,
223-
`browsers: ['ChromeCI'],
224-
customLaunchers: {
225-
ChromeCI: {
226-
base: '${process.env['TRAVIS'] ? 'ChromeHeadless' : 'Chrome'}',
227-
flags: ['--no-sandbox']
228-
}
229-
},
230-
`))
223+
// .catch(() => null)
224+
// .then(() => replaceInFile(`${projectDir}/karma.conf.js`, `browsers: ['Chrome'],`,
225+
// `browsers: ['ChromeCI'],
226+
// customLaunchers: {
227+
// ChromeCI: {
228+
// base: 'ChromeHeadless',
229+
// flags: ['--no-sandbox']
230+
// }
231+
// },
232+
// `))
231233
.catch(() => null);
232234
}
233235

0 commit comments

Comments
 (0)