Angular-cli: ng e2e dont execute with PhantomJS

Created on 27 Mar 2017  Â·  3Comments  Â·  Source: angular/angular-cli

Hi im trying to execute e2e tests with PhantomJS using ng e2e in an created angular-cli project (ng new e2e-test).

The tests fail with a message:
_Failed: Angular could not be found on the page http://localhost:49152/.If this is not an Angular application, you may need to turn off waiting for Angular. Please see https://github.com/angular/protractor/blob/master/docs/timeouts.md#waiting-for-angular-on-page-load_

With chrome the tests are working fine.

Bug Report or Feature Request (mark with an x)

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

Versions.

Windows 10

@angular/cli: 1.0.0-rc.2
node: 6.6.0
os: win32 x64
@angular/common: 2.4.10
@angular/compiler: 2.4.10
@angular/core: 2.4.10
@angular/forms: 2.4.10
@angular/http: 2.4.10
@angular/platform-browser: 2.4.10
@angular/platform-browser-dynamic: 2.4.10
@angular/router: 3.4.10
@angular/cli: 1.0.0-rc.2
@angular/compiler-cli: 2.4.10

also tested with:

@angular/cli: 1.0.0
node: 6.6.0
os: win32 x64
@angular/common: 4.0.0
@angular/compiler: 4.0.0
@angular/core: 4.0.0
@angular/forms: 4.0.0
@angular/http: 4.0.0
@angular/platform-browser: 4.0.0
@angular/platform-browser-dynamic: 4.0.0
@angular/router: 4.0.0
@angular/cli: 1.0.0
@angular/compiler-cli: 4.0.0

Repro steps.

Commands run:

  1. run npm i phantomjs
  2. update webdriver: node_modules\.bin\webdriver-manager update
  3. configure protractor.conf.json (see below)
  4. run ng e2e

protractor.conf.json:

// Protractor configuration file, see link for more information
// https://github.com/angular/protractor/blob/master/lib/config.ts

const { SpecReporter } = require('jasmine-spec-reporter');

exports.config = {
  allScriptsTimeout: 11000,
  specs: [
    './e2e/**/*.e2e-spec.ts'
  ],
  capabilities: {
    'browserName': 'phantomjs',
    'phantomjs.binary.path': require('phantomjs').path
  },
  //directConnect: true,
  baseUrl: 'http://localhost:4200/',
  framework: 'jasmine',
  jasmineNodeOpts: {
    showColors: true,
    defaultTimeoutInterval: 30000,
    print: function() {}
  },
  beforeLaunch: function() {
    require('ts-node').register({
      project: 'e2e/tsconfig.e2e.json'
    });
  },
  onPrepare() {
    jasmine.getEnv().addReporter(new SpecReporter({ spec: { displayStacktrace: true } }));
  }
};

The log given by the failure.

With Chrome:

[16:34:50] I/update - chromedriver: file exists C:\SC\e2e-test\node_modules\protractor\node_modules\webdriver-manager\selenium\chromedriver_2.28.zip
[16:34:50] I/update - chromedriver: unzipping chromedriver_2.28.zip
[16:34:51] I/update - chromedriver: chromedriver_2.28.exe up to date
[16:34:51] I/launcher - Running 1 instances of WebDriver
[16:34:51] I/local - Starting selenium standalone server...
[16:34:52] I/local - Selenium standalone server started at http://10.0.75.1:59995/wd/hub
Spec started

  e2e-test App
    √ should display message saying app works

Executed 1 of 1 spec SUCCESS in 1 sec.
[16:34:57] I/local - Shutting down selenium standalone server.
[16:34:57] I/launcher - 0 instance(s) of WebDriver still running
[16:34:57] I/launcher - chrome #01 passed

With PhantomJS:

1) e2e-test App should display message saying app works
  - Failed: Angular could not be found on the page http://localhost:49152/.If this is not an Angular application, you may need to turn off waiting for Angular.
                            Please see
                            https://github.com/angular/protractor/blob/master/docs/timeouts.md#waiting-for-angular-on-page-load

Executed 1 of 1 spec (1 FAILED) in 11 secs.
[16:13:23] I/local - Shutting down selenium standalone server.
[16:13:23] I/launcher - 0 instance(s) of WebDriver still running
[16:13:23] I/launcher - phantomjs #01 failed 1 test(s)
[16:13:23] I/launcher - overall: 1 failed spec(s)
[16:13:23] E/launcher - Process exited with error code 1

Desired functionality.

I would like that e2e can be executed also with phantomJS.

Mention any other details that might be useful.

Nothing special the project is created with angular-cli version 1.0.0-rc.2. The test is from the example inside the project.

Most helpful comment

That seems like a harsh response. That's like saying "we don't recommend or test using Firefox. There are many things that can go wrong depending on your app, environment and setup"

All 3 comments

Overall we don't recommend or test using PhantomJS. There are many things that can go wrong depending on your app, environment and setup - especially for e2e tests.

That seems like a harsh response. That's like saying "we don't recommend or test using Firefox. There are many things that can go wrong depending on your app, environment and setup"

This issue has been automatically locked due to inactivity.
Please file a new issue if you are encountering a similar or related problem.

Read more about our automatic conversation locking policy.

_This action has been performed automatically by a bot._

Was this page helpful?
0 / 5 - 0 ratings