x
)- [x] bug report -> please search issues before submitting
- [ ] feature request
@angular/cli: 1.0.0
node: 6.10.1
os: win32 x64
@angular/common: 4.1.2
@angular/compiler: 4.1.2
@angular/core: 4.1.2
@angular/forms: 4.1.2
@angular/http: 4.1.2
@angular/platform-browser: 4.1.2
@angular/platform-browser-dynamic: 4.1.2
@angular/router: 4.1.2
@angular/cli: 1.0.0
@angular/compiler-cli: 4.1.2
node_modules/protractor/node_modules/webdriver-manager/selenium/
. For example, if using Chrome webdriver, delete all chrome*
files in this selenium folder.proxy.conf.js
file to pass to ng e2e
.ng e2e --proxy-config proxy.conf.js
.If you are behind a proxy and https_proxy is not set, the command will fail after compiling the app. This is because by default, ng e2e
will run webdriver-manager update
to fetch the right browser drivers, but does not use the proxy config to do so.
$ ng e2e --proxy-config proxy.conf.js
** NG Live Development Server is running on http://localhost:49152 **
Hash: 95e0fe13c75ed4802b8b
Time: 17998ms
chunk {0} 0.chunk.js, 0.chunk.js.map 491 kB {3} [rendered]
chunk {1} polyfills.bundle.js, polyfills.bundle.js.map (polyfills) 237 kB {5} [initial] [rendered]
chunk {2} styles.bundle.js, styles.bundle.js.map (styles) 226 kB {5} [initial] [rendered]
chunk {3} main.bundle.js, main.bundle.js.map (main) 8.25 kB {4} [initial] [rendered]
chunk {4} vendor.bundle.js, vendor.bundle.js.map (vendor) 3.12 MB [initial] [rendered]
chunk {5} inline.bundle.js, inline.bundle.js.map (inline) 0 bytes [entry] [rendered]
webpack: Compiled successfully.
events.js:160
throw er; // Unhandled 'error' event
^
Error: connect ECONNREFUSED 172.217.8.16:443
at Object.exports._errnoException (util.js:1018:11)
at exports._exceptionWithHostPort (util.js:1041:20)
at TCPConnectWrap.afterConnect [as oncomplete] (net.js:1090:14)
ng e2e
should pass along proxy configuration to webdriver-manager when the --webdriver-update
flag is set to true. For webdriver-manager, the flag to use is --proxy
.
The code that calls webdriver-manager is at Line 65 in e2e.ts.
We don't actually have the functionality you are requesting, so this isn't a bug request as much as a feature request.
--proxy-config
is a flag inherited by ng e2e
from ng serve
and meant to be used by webpack-dev-server
(https://github.com/angular/angular-cli/wiki/stories-proxy).
Any updates ?
Hello, any updates with it?
any update?
I have no update on this but would like to mention you can do the update manually with the flags you need to use and then run ng e2e --webdriver-update=false
to prevent ng e2e
from trying to update webdriver.
still the same :(
It worked for me (below) as webdriver not taking npm proxy settings and it downloads the driver from googleapis link So we need to set it in package.json and run ng e2e
Added a “pree2e” step as follows in package.json
"pree2e":"webdriver-manager update --proxy 'http://**:8080/' --ignore_ssl",
"e2e": "ng e2e",
webdriver-manager update
respects HTTPS_PROXY
environment variable. Try to setup HTTPS_PROXY
environment variable with your (corporate) proxy server http://********:80
Restart your VS Code or command prompt (to pickup changes) and you should be fine to run e2e tests without issues.
I belive that there are 2 different issues discussed here..
What the issue creator is requesting is to reuse the --proxy-config (eg. all requests to "/api/*" is proxied to localhost:8080)
this has nothing to do with "pree2e":"webdriver-manager update --proxy 'http://**:8080/' --ignore_ssl",
Right?
How are you running your e2e-tests if having a api behind a reverse-proxy if
ng e2e --proxy-config proxy.conf.json
is not working?
Hi, I am trying to run e2e tests with an API behind a reverse-proxy. The API is accessible fine when I run ng serve --proxy-config proxy.conf.json
. But ng e2e --proxy-config proxy.conf.json
complains as follows:
Unknown option: '--proxyConfig'
any update? Thanks
This does not work for version 6.0.8 of angular cli either.
I have create a feature request #11408 for the --proxyConfig
option on ng e2e
command.
ng e2e --proxy-config proxy.conf.json
worked in ng
version 1.7. Not sure what broke in the latest build.
Any updates on this?
I tried a workaround, by proxying my dev server API through ng serve
and then setting protractor proxy configuration to that server instance. In other words, I use a custom built server that mimics my API, and I start it on my localhost with:
$ ./server
Sever launched on localhost:9000
Then, I start ng server on port 7000 and proxy my dummy API with --proxy-config
switch:
ng serve --proxy-config proxy.conf.json --port 7000
where proxy.conf.json
has a standard configuration:
{
"/api/*": {
"target": "http://localhost:9000",
"secure": false
}
}
And finally, I set the protractor.conf.js
capabilities as:
capabilities: {
proxy: {
proxyType: 'manual',
httpProxy: 'localhost:7000'
}
Finally, I use ng e2e
and all of my tests pass. However, being a proxy through proxy setup, I'm not sure if the successful attempts are just a placebo, or this workaround is really working. Here is the visualization:
It seems like ng e2e
takes now the proxy configuration from ng serve
. If you add following line in the angular.json file and run ng e2e
without any options it will execute with the proxy configurations.
"serve": {
"builder": "@angular-devkit/build-angular:dev-server",
"options": {
"browserTarget": "lmsbo-bo:build",
"proxyConfig": "config/proxy/proxy.tst5.json" <== **added this** line
},
"configurations": {
"production": {
"browserTarget": "lmsbo-bo:build:production"
}
}
},
But this is a step backwards. If you have multiple environments and therefore multiple proxy configurations you have to change everytime your angular.json file accordingly before running ng e2e
.
any updates ?
Also behind a proxy, I used @jainsachin121's solution. Howerver I add the --webdriverUpdate
flag otherwise ng
will try to update the driver again by default, causing an unnecessary delay.
// package.json
{
scripts: {
"pree2e": "webdriver-manager update --proxy 'http://********:8080/' --ignore_ssl",
"e2e": "ng e2e --webdriverUpdate false" // <-- added flag
}
}
E/downloader - Connection timeout downloading: https://chromedriver.storage.googleapis.com/2.46/chromedriver_mac64.zip. Default timeout is 4 minutes.
I/update - chromedriver: file exists /Users/some-user/node_modules/protractor/node_modules/webdriver-manager/selenium/chromedriver_2.46.zip
I/update - chromedriver: unzipping chromedriver_2.46.zip
I/update - chromedriver: setting permissions to 0755 for /Users/some-user/node_modules/protractor/node_modules/webdriver-manager/selenium/chromedriver_2.46
I/update - chromedriver: chromedriver_2.46 up to date
E/downloader - Connection timeout downloading: https://chromedriver.storage.googleapis.com/2.46/chromedriver_mac64.zip. Default timeout is 4 minutes.
I/launcher - Running 1 instances of WebDriver
I'm facing this issue as well. I'm currently behind a corporate network. I was able to run the following commands.
webdriver-manager update --proxy=http://xxx.xxx.xxx:8080
webdriver-manager start --proxy=http://xxx.xxx.xxx:8080
The binaries got downloaded and the selenium server started on 4444.
But now when i'm trying to run the test cases getting TIMEOUT error
C:UsersxxxWorkspaceAngularangular-with-cucumber>npm run e2e
[email protected] e2e C:UsersxxxWorkspaceAngularangular-with-cucumber
ng e2e
[16:02:15] I/config_source - curl -oC:UsersxxxWorkspaceAngularangular-with-cucumbernode_modulesprotractornode_moduleswebdriver-managerseleniumchrome-response.xml https://chromedriver.storage.googleapis.com/
events.js:288
throw er; // Unhandled 'error' event
^
Error: connect ETIMEDOUT 172.217.9.16:443
at TCPConnectWrap.afterConnect [as oncomplete] (net.js:1137:16)
Emitted 'error' event on Request instance at:
at Request.onRequestError (C:UsersxxxWorkspaceAngularangular-with-cucumbernode_modulesrequestrequest.js:877:8)
at ClientRequest.emit (events.js:323:22)
at TLSSocket.socketErrorListener (_http_client.js:426:9)
at TLSSocket.emit (events.js:311:20)
at emitErrorNT (internal/streams/destroy.js:92:8)
at emitErrorAndCloseNT (internal/streams/destroy.js:60:3)
at processTicksAndRejections (internal/process/task_queues.js:84:21) {
errno: 'ETIMEDOUT',
code: 'ETIMEDOUT',
syscall: 'connect',
address: '172.217.9.16',
port: 443
}
@SidV7 I faced the same issue after the manual webdriver update. You have to run the e2e without updating the webdriver again as @filipesilva suggested. This worked for me:
ng e2e --webdriver-update=false
Most helpful comment
Hi, I am trying to run e2e tests with an API behind a reverse-proxy. The API is accessible fine when I run
ng serve --proxy-config proxy.conf.json
. Butng e2e --proxy-config proxy.conf.json
complains as follows: