ng e2e - Protractor's browser.baseUrl Doesn't Match baseHref Build Option Anymore #15522
Labels
area: @angular-devkit/build-angular
freq1: low
Only reported by a handful of users who observe it rarely
severity5: regression
type: bug/fix
Milestone
🐞 Bug report
Command (mark with an
x
)Is this a regression?
Yes, the previous version in which this bug was not present was: 7.1.3Description
When running
ng e2e
before with abaseHref
specified as an option in thebuild
that was ran forng e2e
it produced a protractorbrowser.baseUrl
that ended in a/
but now in Angular 8 it does not.Meaning using a
baseHref
of/ext/
back in v7.1.3 madebrowser.baseUrl
returnhttp://localhost:4200/ext/
when runningng e2e
but now in Angular 8 using abaseHref
of/ext/
makesbrowser.baseUrl
returnhttp://localhost:4200/ext
. That missing/
at the end is a very important difference.So the real problem here is that back in Angular 7.1.3 my e2e were passing while making use of the
baseHref
build flag and now they are not in latest Angular 8 version. The reason why they are not passing is becauseawait browser.get('connect');
should navigate tohttp://localhost:4200/ext/connect
but instead it is trying to navigate tohttp://localhost:4200/connect
. This is because thebrowser.baseUrl
ishttp://localhost:4200/ext
and if you go into the code of Protractor you will see that it usesbrowser.baseUrl
with theurl.resolve(...)
method. Andurl.resolve('http://localhost:4200/ext', 'connect');
returns'http://localhost:4200/connect'
.Note: my Angular.json build has this for the baseHref:
"baseHref": "/ext/"
🔬 Minimal Reproduction
baseHref
of/ext/
http://localhost:4200/ext/connect
is a valid pageapp.po.ts
'snavigateTo()
method so that you usereturn brwoser.get('connect');
ng e2e
http://localhost:4200/connect
instead ofhttp://localhost:4200/ext/connect
🌍 Your Environment
The text was updated successfully, but these errors were encountered: