Solvedangular cli ng e2e does not use --proxy-config for webdriver-manager update

Bug Report or Feature Request (mark with an x)

- [x] bug report -> please search issues before submitting
- [ ] feature request

Versions.

@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

Repro steps.

  1. Must have an out of date web driver or delete it from node_modules/protractor/node_modules/webdriver-manager/selenium/. For example, if using Chrome webdriver, delete all chrome* files in this selenium folder.
  2. Must be behind a proxy, but without HTTPS_PROXY or https_proxy environment variables set.
  3. Using the proxy guide described in the cli wiki, create a proxy.conf.js file to pass to ng e2e.
  4. Run 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.

The log given by the failure.

$ 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)

Desired functionality.

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.

Mention any other details that might be useful.

The code that calls webdriver-manager is at Line 65 in e2e.ts.

24 Answers

✔️Accepted Answer

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'

Other Answers:

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?

Any updates ?

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.

Hello, any updates with it?

More Issues: