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鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow `ng e2e` accept `--base-url` with `--dev-server-target` #16325

Closed
ikedam opened this issue Dec 1, 2019 · 2 comments
Closed

Allow `ng e2e` accept `--base-url` with `--dev-server-target` #16325

ikedam opened this issue Dec 1, 2019 · 2 comments

Comments

@ikedam
Copy link

@ikedam ikedam commented Dec 1, 2019

馃殌 Feature request

Command (mark with an x)

- [ ] new
- [ ] build
- [ ] serve
- [ ] test
- [x] e2e
- [ ] generate
- [ ] add
- [ ] update
- [ ] lint
- [ ] xi18n
- [ ] run
- [ ] config
- [ ] help
- [ ] version
- [ ] doc

Description

I want to use --base-url with --dev-server-target in ng e2e, but it results a following error:

The 'baseUrl' option cannot be used with 'devServerTarget'.

I want to use them together in the following case:

  • Let ng e2e launch the server (--serve) and then run protractor.
    • --serve feature is really useful as protractor starts after the server gets ready.
  • protractor controls a browser in another host with webdriver protocol.

In that case, the browser have to access the server not with http://localhost:4200/ which is automatically configured with ng e2e --dev-app-server, but with http://(appropriate host name):4200/.

I created a demonstration project to explain what I want: https://github.com/ikedam/angular-e2e-base-url-demo

Describe the solution you'd like

I want to use --base-url to specify that host name.

Relates: #13611, #13614

Describe alternatives you've considered

Accepting --public-host in ng e2e can resolve this issue.
(It results Unknown option: '--public-host' for now)

Relates: #9242

@alan-agius4

This comment has been minimized.

Copy link
Collaborator

@alan-agius4 alan-agius4 commented Dec 2, 2019

Hi @ikedam, it looks to me that the problem is that the command you are running is

npm run e2e --host=0.0.0.0 --port=4200 --protractor-config=e2e/protractor-docker.conf.js

while to achieve the desired behaviour you need

npm run e2e --host=angular --protractor-config=e2e/protractor-docker.conf.js
@ikedam

This comment has been minimized.

Copy link
Author

@ikedam ikedam commented Dec 7, 2019

@alan-agius4 You're right.
Specifying a host name in --host instead of 0.0.0.0 resolves my issue: ikedam/angular-e2e-base-url-demo@ffcf1d8
(You also need to set up the environment to allow angular resolve the host name to IP address)

Thanks a lot!

@ikedam ikedam closed this Dec 7, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
3 participants
You can鈥檛 perform that action at this time.