14

After updating Angular JS 1.4.x to Angular 2, Selenium tests can't run anymore via grunt-protractor-runner on Firefox. As soon as AngularJS is loaded, the following error occurs:

D:\...\node_modules\grunt-protractor-runner\node_modules\protractor\node_modules\selenium-webdriver\lib\atoms\error.js:108
  var template = new Error(this.message);
                 ^
UnknownError: Permission denied to access property "toString"
Build info: version: '2.48.2', revision: '41bccdd', time: '2015-10-09 19:59:12'
System info: host: 'NAGWS72', ip: '192.168.210.23', os.name: 'Windows 7', os.arch: 'x86', os.version: '6.1', java.version: '1.7.0_79'
Driver info: driver.version: unknown
    at new bot.Error (D:\...\node_modules\grunt-protractor-runner\node_modules\protractor\node_modules\selenium-webdriver\lib\atoms\error.js:108:18)
    at Object.bot.response.checkResponse (D:\...\node_modules\grunt-protractor-runner\node_modules\protractor\node_modules\selenium-webdriver\lib\atoms\response.js:109:9)
    at D:\...\node_modules\grunt-protractor-runner\node_modules\protractor\node_modules\selenium-webdriver\lib\webdriver\webdriver.js:379:20
    at [object Object].promise.Promise.goog.defineClass.invokeCallback_ (D:/.../node_modules/grunt-protractor-runner/node_modules/protractor/node_modules/selenium-webdriver/lib/goog/../webdriver/promise.js:1337:14)
    at [object Object].promise.ControlFlow.goog.defineClass.goog.defineClass.abort_.error.executeNext_.execute_ (D:/.../node_modules/grunt-protractor-runner/node_modules/protractor/node_modules/selenium-webdriver/lib/goog/../webdriver/promise.js:2776:14)
    at [object Object].promise.ControlFlow.goog.defineClass.goog.defineClass.abort_.error.executeNext_ (D:/.../node_modules/grunt-protractor-runner/node_modules/protractor/node_modules/selenium-webdriver/lib/goog/../webdriver/promise.js:2758:21)
    at goog.async.run.processWorkQueue (D:\...\node_modules\grunt-protractor-runner\node_modules\protractor\node_modules\selenium-webdriver\lib\goog\async\run.js:124:15)
    at process._tickCallback (node.js:366:9)
From: Task: <anonymous>
    at [object Object].pollCondition [as _onTimeout] (D:/.../node_modules/grunt-protractor-runner/node_modules/protractor/node_modules/selenium-webdriver/lib/goog/../webdriver/promise.js:2233:16)
    at Timer.listOnTimeout (timers.js:92:15)
From: Task: <anonymous wait>
    at [object Object].promise.ControlFlow.goog.defineClass.getSchedule.indent.wait (D:/.../node_modules/grunt-protractor-runner/node_modules/protractor/node_modules/selenium-webdriver/lib/goog/../webdriver/promise.js:2226:17)
    at [object Object].webdriver.WebDriver.wait (D:\...\node_modules\grunt-protractor-runner\node_modules\protractor\node_modules\selenium-webdriver\lib\webdriver\webdriver.js:716:21)
    at [object Object].to.(anonymous function) [as wait] (D:\...\node_modules\grunt-protractor-runner\node_modules\protractor\lib\protractor.js:65:25)
    at global.doLogin (D:\...\nisXplorerConfig.js:44:21)
    at exports.config.onPrepare (D:\...\nisXplorerConfig.js:79:9)
    at D:\...\node_modules\grunt-protractor-runner\node_modules\protractor\lib\util.js:54:41
    at Function.promise (D:\...\node_modules\grunt-protractor-runner\node_modules\protractor\node_modules\q\q.js:650:9)
    at Object.exports.runFilenameOrFn_ (D:\...\node_modules\grunt-protractor-runner\node_modules\protractor\lib\util.js:44:12)
    at [object Object].Runner.runTestPreparer (D:\...\node_modules\grunt-protractor-runner\node_modules\protractor\lib\runner.js:76:17)
    at Object.exports.run (D:\...\node_modules\grunt-protractor-runner\node_modules\protractor\lib\frameworks\jasmine.js:89:17)

Chrome and Internet Explorer work fine.

The problem appears with the following components:

  • Firefox version 38 and 42
  • grunt-protractor-runner 2.1.0 and 3.0.0 (which uses selenium-server-standalone-2.48.2.jar)
  • protractor 2.5.1 and 3.0.0

The following node modules are in use (package.json):

{
  "name": "...",
  "version": "1.0.0",
  "description": "",
  "main": "Gruntfile.js",
  "dependencies": {
    "jasmine-reporters": "^2.0.7",
    "protractor-video-recorder": "^0.1.0"
  },
  "devDependencies": {
    "grunt-protractor-runner": "^3.0.0",
    "jasmine-spec-reporter": "^2.4.0",
    "lodash": "^3.10.1",
    "protractor-console": "^2.0.0"
  },
  "scripts": {
    "test": "echo \"Error: no test specified\" && exit 1"
  },
  "author": "",
  "license": "ISC"
}

There is no code part in the Selenium test, which can be localized to produce the error. The error appears just at the moment when AngularJS is loaded.

gogol
  • 241
  • 2
  • 7
  • Could you reproduce the problem on any of the public angular2 website? (say, https://angular.io/). Thanks. – alecxe Dec 11 '15 at 14:24
  • Also, have you tried with `directConnect`? – alecxe Dec 11 '15 at 14:25
  • Thanks for your answer, @alecxe . I've just tried it: - testing against angular.io works fine. - `directConnect` produces exactly the same error Here is my config: `> options: { > configFile: "....js", > args: { > directConnect: true, > baseUrl: "...", > capabilities: { > 'browserName': 'firefox', > 'browser': 'Firefox' > }, > specs: [ > 'testFiles/....js' > ], > } > }` – gogol Dec 11 '15 at 16:11
  • Thanks for the tests. So, we can assume this is application-specific and might be related to how you bootstrap angular... – alecxe Dec 11 '15 at 16:12
  • Many thanks! I'll review that. – gogol Dec 11 '15 at 16:15
  • Are you sure angular.io is on Angular 2? I've just seen they include ``. – gogol Dec 11 '15 at 16:19
  • Yeah, my bad, I just assumed they use angular2, sorry. Please try any other angular 2 demo page. Thanks! – alecxe Dec 11 '15 at 16:20
  • I've just tested against [http://www.syntaxsuccess.com/angular-2-samples/#/demo/react](http://www.syntaxsuccess.com/angular-2-samples/#/demo/react) and it says `- Failed: Error while waiting for Protractor to sync with the page: "window.angular is undefined. This could be either because this is a non-angular page or because your test involves client-side navigation, which can interfere with Protractor's bootstrapping. See http://git.io/v4gXM for details" `. I'll analyse that later. – gogol Dec 11 '15 at 16:37

2 Answers2

5

To isolate the problem I installed the sample Angular 2 Go with Protractor ! and got exactly the same error (as in my first comment) after I changed browserName: 'chrome' to firefox.

Thus I created a new issue on Protractors github page.

gogol
  • 241
  • 2
  • 7
0

See related tickets:

Based on the last comment on the selenium ticket:

Angular 2 is patching EventTarget.prototype, so they are responsible for any bugs caused by their changes.

dnozay
  • 23,846
  • 6
  • 82
  • 104