Skip to content

ng e2e --no-serve fails when baseHref defined in config. #7753

@jh3141

Description

@jh3141

Bug Report or Feature Request (mark with an x)

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

Versions.

    _                      _                 ____ _     ___
   / \   _ __   __ _ _   _| | __ _ _ __     / ___| |   |_ _|
  / △ \ | '_ \ / _` | | | | |/ _` | '__|   | |   | |    | |
 / ___ \| | | | (_| | |_| | | (_| | |      | |___| |___ | |
/_/   \_\_| |_|\__, |\__,_|_|\__,_|_|       \____|_____|___|
               |___/
@angular/cli: 1.4.2
node: 6.10.1
os: win32 x64
@angular/animations: 4.4.3
@angular/common: 4.4.3
@angular/compiler: 4.4.3
@angular/core: 4.4.3
@angular/forms: 4.4.3
@angular/http: 4.4.3
@angular/platform-browser: 4.4.3
@angular/platform-browser-dynamic: 4.4.3
@angular/router: 4.4.3
@angular/cli: 1.4.2
@angular/compiler-cli: 4.4.3
@angular/language-service: 4.4.3
typescript: 2.3.4

Repro steps.

  1. make a new repository with ng new tempname
  2. set up a default base-href value: ng set defaults.build.baseHref /some/path
  3. add an e2e test spec that calls to browser.get('/some/path') or some other address that should be valid
  4. run ng e2e (note that the test is successful)
  5. run ng serve
  6. run ng e2e --no-serve

The log given by the failure.

[07:39:55] I/update - chromedriver: file exists C:\Development\tackta-webadmin\tackta-webadmin\node_modules\protractor\node_modules\webdriver-manager\selenium\chromedriver_2.32.zip
[07:39:55] I/update - chromedriver: unzipping chromedriver_2.32.zip
[07:39:56] I/update - chromedriver: chromedriver_2.32.exe up to date
[07:39:57] I/launcher - Running 1 instances of WebDriver
[07:39:57] I/direct - Using ChromeDriver directly...
[0920/074001.024:ERROR:gl_surface_egl.cc(744)] eglInitialize D3D11 failed with error EGL_NOT_INITIALIZED, trying next display type
[0920/074002.319:ERROR:gl_surface_egl.cc(744)] eglInitialize D3D9 failed with error EGL_NOT_INITIALIZED
[0920/074002.320:ERROR:gl_initializer_win.cc(232)] GLSurfaceEGL::InitializeOneOff failed.
[0920/074002.336:ERROR:gpu_child_thread.cc(252)] Exiting GPU process due to errors during initialization
[6020:5364:0920/074002.397:ERROR:browser_gpu_channel_host_factory.cc(103)] Failed to launch GPU process.
Jasmine started

  tackta-webadmin App
    × should display test component on /some/path
      - Failed: invalid element state: Failed to execute 'replace' on 'Location': '/some/path/' is not a valid URL.
        (Session info: chrome=61.0.3163.91)
        (Driver info: chromedriver=2.32.498550 (9dec58e66c31bcc53a9ce3c7226f0c1c5810906a),platform=Windows NT 6.1.7601 SP1 x86_64)

        (Session info: chrome=61.0.3163.91)
        (Driver info: chromedriver=2.32.498550 (9dec58e66c31bcc53a9ce3c7226f0c1c5810906a),platform=Windows NT 6.1.7601 SP1 x86_64)

          at WebDriverError (C:\Development\tempproject\node_modules\selenium-webdriver\lib\error.js:27:5)
          at InvalidElementStateError (C:\Development\tempproject\node_modules\selenium-webdriver\lib\error.js:100:5)
          at Object.checkLegacyResponse (C:\Development\tempproject\node_modules\selenium-webdriver\lib\error.js:505:15)
          at parseHttpResponse (C:\Development\tempproject\node_modules\selenium-webdriver\lib\http.js:509:13)
          at doSend.then.response (C:\Development\tempproject\node_modules\selenium-webdriver\lib\http.js:440:13)
          at process._tickCallback (internal/process/next_tick.js:109:7)
      From: Task: Protractor.get(/some/path/) - reset url
          at Driver.schedule (C:\Development\tempproject\node_modules\selenium-webdriver\lib\webdriver.js:816:17)
          at ProtractorBrowser.executeScriptWithDescription (C:\Development\tempproject\node_modules\protractor\lib\browser.ts:584:24)
          at driver.controlFlow.execute.then.then.then (C:\Development\tempproject\node_modules\protractor\lib\browser.ts:889:23)
          at ManagedPromise.invokeCallback_ (C:\Development\tempproject\node_modules\selenium-webdriver\lib\promise.js:1366:14)
          at TaskQueue.execute_ (C:\Development\tempproject\node_modules\selenium-webdriver\lib\promise.js:2970:14)
          at TaskQueue.executeNext_ (C:\Development\tempproject\node_modules\selenium-webdriver\lib\promise.js:2953:27)
          at asyncRun (C:\Development\tempproject\node_modules\selenium-webdriver\lib\promise.js:2813:27)
          at C:\Development\tempproject\node_modules\selenium-webdriver\lib\promise.js:676:7
          at process._tickCallback (internal/process/next_tick.js:109:7)
      From: Task: Run it("should display test component on /some/path") in control flow
          at ControlFlow.emit (C:\Development\tempproject\node_modules\selenium-webdriver\lib\events.js:62:21)
          at ControlFlow.shutdown_ (C:\Development\tempproject\node_modules\selenium-webdriver\lib\promise.js:2565:10)
          at shutdownTask_.MicroTask (C:\Development\tempproject\node_modules\selenium-webdriver\lib\promise.js:2490:53)
      From asynchronous test:
      Error
          at Suite.<anonymous> (C:\Development\tempproject\tackta-webadmin\e2e\app.e2e-spec.ts:10:3)
          at Object.<anonymous> (C:\Development\tempproject\e2e\app.e2e-spec.ts:3:1)
          at Module._compile (module.js:570:32)
          at Module.m._compile (C:\Development\tempproject\node_modules\ts-node\src\index.ts:392:23)
          at Module._extensions..js (module.js:579:10)
          at Object.require.extensions.(anonymous function) [as .ts] (C:\Development\tempproject\node_modules\ts-node\src\index.ts:395:12)

**************************************************
*                    Failures                    *
**************************************************

1) tempproject App should display test component on /some/path
  - Failed: invalid element state: Failed to execute 'replace' on 'Location': '/some/path/' is not a valid URL.
    (Session info: chrome=61.0.3163.91)
    (Driver info: chromedriver=2.32.498550 (9dec58e66c31bcc53a9ce3c7226f0c1c5810906a),platform=Windows NT 6.1.7601 SP1 x86_64)

Executed 1 of 1 spec (1 FAILED) in 0.308 sec.

[07:40:04] I/launcher - 0 instance(s) of WebDriver still running
[07:40:04] I/launcher - chrome #01 failed 1 test(s)
[07:40:04] I/launcher - overall: 1 failed spec(s)
[07:40:04] E/launcher - Process exited with error code 1

Desired functionality.

The correct base URL should have been built based on the default port for ng serve.

Mention any other details that might be useful.

Workaround is to explicitly specify the full base URL in the command: ng e2e --no-serve --base-href http://localhost:4200/some/path/

Metadata

Metadata

Assignees

No one assigned

    Labels

    P3An issue that is relevant to core functions, but does not impede progress. Important, but not urgentseverity3: brokentype: bug/fix

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions