question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

e2e test doesn't work with multiCapabilities

See original GitHub issue

The main goal I try to achieve is to run the e2e tests of an angular-cli generated app on multiple browsers which currently fails because as soon as I add a second browser I get Unexpected token import errors when I run tests.

Please provide us with the following information:

  1. OS? Windows 7, 8 or 10. Linux (which distribution). Mac OSX (Yosemite? El Capitan?)

Mac OS X El Capitan (10.11.4).

  1. Versions. Please run ng --version. If there’s nothing outputted, please run in a Terminal: node --version And paste the result here.
$ ng --version
Could not start watchman; falling back to NodeWatcher for file system events.
Visit http://ember-cli.com/user-guide/#watchman for more info.
angular-cli: 1.0.0-beta.5
node: 5.9.1
os: darwin x64
$ node --version
v5.9.1
  1. Repro steps. Was this an app that wasn’t created using the CLI? What change did you do on your code? etc.
  • Create an app with angular-cli: ng new testfoo
  • Change protractor.conf.js like this to make tests run in multiple browsers:
diff --git a/config/protractor.conf.js b/config/protractor.conf.js
index 57f4f87..76b4df8 100644
--- a/config/protractor.conf.js
+++ b/config/protractor.conf.js
@@ -6,9 +6,10 @@ exports.config = {
   specs: [
     '../e2e/**/*.e2e.ts'
   ],
-  capabilities: {
-    'browserName': 'chrome'
-  },
+  multiCapabilities: [
+    { 'browserName': 'chrome' },
+    { 'browserName': 'firefox' }
+  ],
   directConnect: true,
   baseUrl: 'http://localhost:4200/',
   framework: 'jasmine',
  1. The log given by the failure. Normally this include a stack trace and some more information.
$ ng serve &
$ ng e2e
Could not start watchman; falling back to NodeWatcher for file system events.
Visit http://ember-cli.com/user-guide/#watchman for more info.

> testfoo@0.0.0 pree2e /Users/u1235/tmp/angularclitest/testfoo
> webdriver-manager update

selenium standalone is up to date.
chromedriver is up to date.

> testfoo@0.0.0 e2e /Users/u1235/tmp/angularclitest/testfoo
> protractor "config/protractor.conf.js"

[14:02:58] I/launcher - Running 2 instances of WebDriver
[14:02:59] I/testLogger -
------------------------------------

[14:02:59] I/testLogger - [chrome #01] PID: 4694
[chrome #01] Specs: /Users/u1235/tmp/angularclitest/testfoo/e2e/app.e2e.ts
[chrome #01]
[chrome #01] [14:02:58] I/direct - Using ChromeDriver directly...
[chrome #01] [14:02:59] I/runnerCli - Unexpected token import

[14:02:59] I/testLogger -

[14:02:59] E/launcher - Runner process exited unexpectedly with error code: 1
[14:02:59] I/launcher - 1 instance(s) of WebDriver still running
[14:03:00] I/testLogger -
------------------------------------

[14:03:00] I/testLogger - [firefox #11] PID: 4695
[firefox #11] Specs: /Users/u1235/tmp/angularclitest/testfoo/e2e/app.e2e.ts
[firefox #11]
[firefox #11] [14:02:58] I/direct - Using FirefoxDriver directly...
[firefox #11] [14:03:00] I/runnerCli - Unexpected token import

[14:03:00] I/testLogger -

[14:03:00] E/launcher - Runner process exited unexpectedly with error code: 1
[14:03:00] I/launcher - 0 instance(s) of WebDriver still running
[14:03:00] I/launcher - chrome #01 failed with exit code: 1
[14:03:00] I/launcher - firefox #11 failed with exit code: 1
[14:03:00] I/launcher - overall: 2 process(es) failed to complete
[14:03:00] E/launcher - Process exited with error code 100

Some end-to-end tests failed, see above.

5. Mention any other details that might be useful.

Interestingly it works if multiCapabilities is used with only one browser, no matter which.

Issue Analytics

  • State:closed
  • Created 7 years ago
  • Reactions:4
  • Comments:9 (2 by maintainers)

github_iconTop GitHub Comments

16reactions
raymondkarstensencommented, Jun 6, 2016

Had the same problem, but fixed it by adding the following to protractor.conf.js onPrepare: function () { require('ts-node').register({ project: 'e2e' }); }

13reactions
raymondkarstensencommented, Jun 7, 2016

Actually I moved it from beforeLaunch to onPrepare.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Running e2e tests using Protractor multiCapabilities config but ...
EDIT2: I recently tried to add seleniumArgs: ['-maxSession=1'] to my Protractor config, unfortunaltely this doesn't work too... angularjs · selenium-webdriver ...
Read more >
Unit testing and E2E testing | AngularJS Directives in Traction
Testing the Beast: Unit testing and E2E testing. This chapter covers. The importance of testing to build workable applications; Seamless Unit Testing with ......
Read more >
Run protractor tests on multiple browsers in parallel
multiCapabilities : [ {'browserName': 'chrome'}, {'browserName': 'firefox'}, ],. If we add above parameter to conf.js file, your tests will run ...
Read more >
Protractor parallel execution - Perfecto Help
Protractor will run tests in parallel against each set of capabilities. Note. If both multiCapabilities and capabilities are defined, the capabilities block ...
Read more >
Selenium Grid and Protractor for running tests in Parallel on ...
I was able to run protractor and point to it but the tests only seem to run on one of the node containers....
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found