|
1 |
| -import { ng, execAndWaitForOutputToMatch, killAllProcesses } from '../../utils/process'; |
| 1 | +import { silentNg } from '../../utils/process'; |
2 | 2 | import { expectToFail } from '../../utils/utils';
|
3 |
| -import { moveFile, copyFile, replaceInFile } from '../../utils/fs'; |
4 | 3 |
|
5 |
| -export default function () { |
6 |
| - return ( |
7 |
| - Promise.resolve() |
8 |
| - // Should fail without serving |
9 |
| - .then(() => expectToFail(() => ng('e2e', 'test-project', '--dev-server-target='))) |
10 |
| - // These should work. |
11 |
| - .then(() => ng('e2e', 'test-project')) |
12 |
| - .then(() => ng('e2e', 'test-project', '--dev-server-target=test-project:serve')) |
13 |
| - // Should accept different config file |
14 |
| - .then(() => moveFile('./e2e/protractor.conf.js', './e2e/renamed-protractor.conf.js')) |
15 |
| - .then(() => ng('e2e', 'test-project', '--protractor-config=e2e/renamed-protractor.conf.js')) |
16 |
| - .then(() => moveFile('./e2e/renamed-protractor.conf.js', './e2e/protractor.conf.js')) |
17 |
| - // Should accept different multiple spec files |
18 |
| - .then(() => moveFile('./e2e/src/app.e2e-spec.ts', './e2e/src/renamed-app.e2e-spec.ts')) |
19 |
| - .then(() => |
20 |
| - copyFile('./e2e/src/renamed-app.e2e-spec.ts', './e2e/src/another-app.e2e-spec.ts'), |
21 |
| - ) |
22 |
| - .then(() => |
23 |
| - ng( |
24 |
| - 'e2e', |
25 |
| - 'test-project', |
26 |
| - '--specs', |
27 |
| - './e2e/renamed-app.e2e-spec.ts', |
28 |
| - '--specs', |
29 |
| - './e2e/another-app.e2e-spec.ts', |
30 |
| - ), |
31 |
| - ) |
32 |
| - // Rename the spec back to how it was. |
33 |
| - .then(() => moveFile('./e2e/src/renamed-app.e2e-spec.ts', './e2e/src/app.e2e-spec.ts')) |
34 |
| - // Suites block need to be added in the protractor.conf.js file to test suites |
35 |
| - .then(() => |
36 |
| - replaceInFile( |
37 |
| - 'e2e/protractor.conf.js', |
38 |
| - `allScriptsTimeout: 11000,`, |
39 |
| - `allScriptsTimeout: 11000, |
40 |
| - suites: { |
41 |
| - app: './e2e/src/app.e2e-spec.ts' |
42 |
| - }, |
43 |
| - `, |
44 |
| - ), |
45 |
| - ) |
46 |
| - .then(() => ng('e2e', 'test-project', '--suite=app')) |
47 |
| - // Remove suites block from protractor.conf.js file after testing suites |
48 |
| - .then(() => |
49 |
| - replaceInFile( |
50 |
| - 'e2e/protractor.conf.js', |
51 |
| - `allScriptsTimeout: 11000, |
52 |
| - suites: { |
53 |
| - app: './e2e/src/app.e2e-spec.ts' |
54 |
| - }, |
55 |
| - `, |
56 |
| - `allScriptsTimeout: 11000,`, |
57 |
| - ), |
58 |
| - ) |
59 |
| - // Should run side-by-side with `ng serve` |
60 |
| - .then(() => execAndWaitForOutputToMatch('ng', ['serve'], / Compiled successfully./)) |
61 |
| - .then(() => ng('e2e', 'test-project', '--dev-server-target=')) |
62 |
| - .finally(() => killAllProcesses()) |
63 |
| - ); |
| 4 | +export default async function () { |
| 5 | + await expectToFail(() => silentNg('e2e', 'test-project', '--dev-server-target=')); |
| 6 | + |
| 7 | + // These should work. |
| 8 | + await silentNg('e2e', 'test-project'); |
| 9 | + await silentNg('e2e', 'test-project', '--dev-server-target=test-project:serve'); |
64 | 10 | }
|
0 commit comments