Skip to content
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

fix(@angular/cli): Fixed e2e task to respect --publicHost setting as baseUrl for protractor #6266

Merged
merged 9 commits into from
Jun 27, 2017
Next Next commit
fix(@angular/cli): Fixed e2e task to respect --publicHost setting as …
…baseUrl for protractor

#6173 added two new settings
to the serve task. The --publicHost setting is not respected as baseUrl
for protractor in the e2e-task.

With this fix, if --publicHost is set, it will be used as baseUrl for protrator.
u220374 authored and Reto Lehmann committed Jun 13, 2017

Verified

This commit was signed with the committer’s verified signature.
snyk-bot Snyk bot
commit 5c570b155df67d70678da9bf06c699016a9f8620
12 changes: 11 additions & 1 deletion packages/@angular/cli/tasks/e2e.ts
Original file line number Diff line number Diff line change
@@ -26,7 +26,17 @@ export const E2eTask = Task.extend({
};

// use serve url as override for protractors baseUrl
if (e2eTaskOptions.serve) {
if (e2eTaskOptions.serve && e2eTaskOptions.publicHost) {
const clientUrl = url.parse(e2eTaskOptions.publicHost);
if (!clientUrl.host) {
return Promise.reject(new SilentError(`'publicHost' must be a full URL.`));
}
additionalProtractorConfig.baseUrl = url.format({
protocol: e2eTaskOptions.ssl ? 'https' : 'http',
hostname: clientUrl.host,
port: clientUrl.port
});
} else if (e2eTaskOptions.serve) {
additionalProtractorConfig.baseUrl = url.format({
protocol: e2eTaskOptions.ssl ? 'https' : 'http',
hostname: e2eTaskOptions.host,