Skip to content

feat(e2e): Added --config-file flag to e2e command #1054

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 5 additions & 2 deletions packages/angular-cli/commands/e2e.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,10 @@ const E2eCommand = Command.extend({
name: 'e2e',
description: 'Run e2e tests in existing project',
works: 'insideProject',
run: function () {
availableOptions: [
{ name: 'config', type: String, aliases: ['c', 'cf'] },
],
run: function (commandOptions: any) {
this.project.ngConfig = this.project.ngConfig || CliConfig.fromProject();

const e2eTask = new E2eTask({
Expand All @@ -15,7 +18,7 @@ const E2eCommand = Command.extend({
project: this.project
});

return e2eTask.run();
return e2eTask.run(commandOptions);
}
});

Expand Down
8 changes: 6 additions & 2 deletions packages/angular-cli/tasks/e2e.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,16 @@ import {exec} from 'child_process';


export const E2eTask = Task.extend({
run: function () {
run: function (options: any) {
const ui = this.ui;
let exitCode = 0;

let protractorConfig = (options.config) ?
this.project.ngConfig.config.e2e.protractor[options.config] :
this.project.ngConfig.config.e2e.protractor.config;

return new Promise((resolve) => {
exec(`npm run e2e -- ${this.project.ngConfig.config.e2e.protractor.config}`,
exec(`npm run e2e -- ${protractorConfig}`,
(err: NodeJS.ErrnoException, stdout: string, stderr: string) => {
ui.writeLine(stdout);
if (err) {
Expand Down
3 changes: 2 additions & 1 deletion tests/e2e/tests/test/e2e.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,5 +19,6 @@ export default function() {
.then(() => _runServeAndE2e())
.then(() => _runServeAndE2e('--prod'))
.then(() => _runServeAndE2e('--aot'))
.then(() => _runServeAndE2e('--aot', '--prod'));
.then(() => _runServeAndE2e('--aot', '--prod'))
.then(() => _runServeAndE2e('--config', 'config'));
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could you create an e2e that actually uses another config instead of the same default one?

}