Skip to content

Commit 5197f42

Browse files
kyliaujosephperrott
authored andcommitted
refactor(@schematics/angular): Do not include Protractor test in new project
Do not include Protractor for new projects since we do not have a concrete plan for Protractor yet. (cherry picked from commit 49ba5e2)
1 parent 2888f2a commit 5197f42

File tree

7 files changed

+23
-15
lines changed

7 files changed

+23
-15
lines changed

packages/angular/cli/commands/e2e-impl.ts

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,20 @@ import { Schema as E2eCommandSchema } from './e2e';
1414
export class E2eCommand extends ArchitectCommand<E2eCommandSchema> {
1515
public readonly target = 'e2e';
1616
public readonly multiTarget = true;
17+
public readonly missingTargetError = `
18+
Cannot find "e2e" target for the specified project.
1719
18-
public async run(options: E2eCommandSchema & Arguments) {
19-
return this.runArchitectTarget(options);
20+
You should add a package that implements end-to-end testing capabilities.
21+
22+
For example:
23+
WebdriverIO: ng add @wdio/schematics
24+
25+
More options will be added to the list as they become available.
26+
`;
27+
28+
async initialize(options: E2eCommandSchema & Arguments) {
29+
if (!options.help) {
30+
return super.initialize(options);
31+
}
2032
}
2133
}

packages/schematics/angular/application/index.ts

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,6 @@ import {
2929
} from '@angular-devkit/schematics';
3030
import { NodePackageInstallTask } from '@angular-devkit/schematics/tasks';
3131
import { Schema as ComponentOptions } from '../component/schema';
32-
import { Schema as E2eOptions } from '../e2e/schema';
3332
import { NodeDependencyType, addPackageJsonDependency } from '../utility/dependencies';
3433
import { latestVersions } from '../utility/latest-versions';
3534
import { applyLintFix } from '../utility/lint-fix';
@@ -282,11 +281,6 @@ export default function (options: ApplicationOptions): Rule {
282281
: join(normalize(newProjectRoot), strings.dasherize(options.name));
283282
const sourceDir = `${appDir}/src/app`;
284283

285-
const e2eOptions: E2eOptions = {
286-
relatedAppName: options.name,
287-
rootSelector: appRootSelector,
288-
};
289-
290284
return chain([
291285
addAppToWorkspaceFile(options, appDir),
292286
mergeWith(
@@ -338,7 +332,6 @@ export default function (options: ApplicationOptions): Rule {
338332
}),
339333
move(sourceDir),
340334
]), MergeStrategy.Overwrite),
341-
options.minimal ? noop() : schematic('e2e', e2eOptions),
342335
options.skipPackageJson ? noop() : addDependenciesToPackageJson(options),
343336
options.lintFix ? applyLintFix(appDir) : noop(),
344337
]);

packages/schematics/angular/e2e/index.ts

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ import {
1717
move,
1818
url,
1919
} from '@angular-devkit/schematics';
20+
import { NodeDependencyType, addPackageJsonDependency } from '../utility/dependencies';
2021
import { JSONFile } from '../utility/json-file';
2122
import { relativePathToWorkspaceRoot } from '../utility/paths';
2223
import { getWorkspace, updateWorkspace } from '../utility/workspace';
@@ -73,6 +74,11 @@ export default function (options: E2eOptions): Rule {
7374
}),
7475
move(root),
7576
])),
77+
host => addPackageJsonDependency(host, {
78+
type: NodeDependencyType.Dev,
79+
name: 'protractor',
80+
version: '~7.0.0',
81+
}),
7682
addScriptsToPackageJson(),
7783
]);
7884
};

packages/schematics/angular/ng-new/index_spec.ts

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -37,10 +37,6 @@ describe('Ng New Schematic', () => {
3737
'/bar/tsconfig.app.json',
3838
'/bar/src/main.ts',
3939
'/bar/src/app/app.module.ts',
40-
'/bar/e2e/src/app.po.ts',
41-
'/bar/e2e/src/app.e2e-spec.ts',
42-
'/bar/e2e/tsconfig.json',
43-
'/bar/e2e/protractor.conf.js',
4440
]));
4541
});
4642

packages/schematics/angular/workspace/files/README.md.template

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ Run `ng test` to execute the unit tests via [Karma](https://karma-runner.github.
2020

2121
## Running end-to-end tests
2222

23-
Run `ng e2e` to execute the end-to-end tests via [Protractor](http://www.protractortest.org/).
23+
Run `ng e2e` to execute the end-to-end tests via a platform of your choice.
2424

2525
## Further help
2626

packages/schematics/angular/workspace/files/package.json.template

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,6 @@
3535
"karma-coverage": "~2.0.3",
3636
"karma-jasmine": "~4.0.0",
3737
"karma-jasmine-html-reporter": "^1.5.0",
38-
"protractor": "~7.0.0",
3938
"ts-node": "~9.1.1",<% } %>
4039
"typescript": "<%= latestVersions.TypeScript %>"
4140
}

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

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,8 @@ export async function prepareProjectForE2e(name) {
5353
'false',
5454
);
5555

56+
await ng('generate', '@schematics/angular:e2e', '--related-app-name', name);
57+
5658
await useCIChrome(
5759
'e2e',
5860
);

0 commit comments

Comments
 (0)