forked from angular/angular-cli
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathe2e.ts
More file actions
45 lines (42 loc) · 1.9 KB
/
e2e.ts
File metadata and controls
45 lines (42 loc) · 1.9 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
import {
ng,
npm,
execAndWaitForOutputToMatch,
killAllProcesses
} from '../../utils/process';
import { updateJsonFile } from '../../utils/project';
import { expectToFail } from '../../utils/utils';
import { moveFile, copyFile } from '../../utils/fs';
export default function () {
// Should fail without updated webdriver
return updateJsonFile('package.json', packageJson => {
// Add to npm scripts to make running the binary compatible with Windows
const scripts = packageJson['scripts'];
scripts['wd:clean'] = 'webdriver-manager clean';
})
.then(() => npm('run', 'wd:clean'))
.then(() => expectToFail(() => ng('e2e', '--no-webdriver-update', '--no-serve')))
// Should fail without serving
.then(() => expectToFail(() => ng('e2e', '--no-serve')))
// These should work.
.then(() => ng('e2e', '--no-progress'))
.then(() => ng('e2e', '--prod', '--no-progress'))
// Should use port in baseUrl
.then(() => ng('e2e', '--port', '4400', '--no-progress'))
// Should accept different config file
.then(() => moveFile('./protractor.conf.js', './renamed-protractor.conf.js'))
.then(() => ng('e2e', '--config', './renamed-protractor.conf.js', '--no-progress'))
.then(() => moveFile('./renamed-protractor.conf.js', './protractor.conf.js'))
// Should accept different multiple spec files
.then(() => moveFile('./e2e/app.e2e-spec.ts', './e2e/renamed-app.e2e-spec.ts'))
.then(() => copyFile('./e2e/renamed-app.e2e-spec.ts', './e2e/another-app.e2e-spec.ts'))
.then(() => ng('e2e', '--specs', './e2e/renamed-app.e2e-spec.ts',
'--specs', './e2e/another-app.e2e-spec.ts', '--no-progress'))
// Should start up Element Explorer
.then(() => execAndWaitForOutputToMatch('ng', ['e2e', '--element-explorer', '--no-progress'],
/Element Explorer/))
.then(() => killAllProcesses(), (err: any) => {
killAllProcesses();
throw err;
});
}