1
votes

Problem

I'm trying to get AppVeyor running some e2e tests using Protractor and Selenium-webdriver.

Everything works fine on my local machine, but when building and testing on AppVeyor protractor exits with code 1 due to a not-found method in the selenium-webdriver, it seems. I have tried to get some information on the error message, but my search didn't get me anywhere. Most of the result come from backend testing with Java.

Here is a snippet of the buildlog:

node_modules\.bin\gulp protractor
[08:37:23] Using gulpfile C:\projects\kitos\gulpfile.js
[08:37:23] Starting 'protractor'...
Starting selenium standalone server...
[launcher] Running 1 instances of WebDriver
Selenium standalone server started at http://10.240.0.18:63619/wd/hub
.. 

Finished in 42.225 seconds
2 tests, 2 assertions, 0 failures

C:\projects\kitos\node_modules\protractor\node_modules\selenium-webdriver\lib\atoms\error.js:108
  var template = new Error(this.message);
                 ^
UnknownError: Can't obtain updateLastError method for class com.sun.jna.Native
    at new bot.Error (C:\projects\kitos\node_modules\protractor\node_modules\selenium-webdriver\lib\atoms\error.js:108:18)
    at Object.bot.response.checkResponse (C:\projects\kitos\node_modules\protractor\node_modules\selenium-webdriver\lib\atoms\response.js:109:9)
    at C:\projects\kitos\node_modules\protractor\node_modules\selenium-webdriver\lib\webdriver\webdriver.js:379:20
    at [object Object].promise.ControlFlow.runInFrame_ (C:/projects/kitos/node_modules/protractor/node_modules/selenium-webdriver/lib/goog/../webdriver/promise.js:1857:20)
    at [object Object].goog.defineClass.notify (C:/projects/kitos/node_modules/protractor/node_modules/selenium-webdriver/lib/goog/../webdriver/promise.js:2448:25)
    at [object Object].promise.Promise.notify_ (C:/projects/kitos/node_modules/protractor/node_modules/selenium-webdriver/lib/goog/../webdriver/promise.js:564:12)
    at Array.forEach (native)
    at [object Object].promise.Promise.notifyAll_ (C:/projects/kitos/node_modules/protractor/node_modules/selenium-webdriver/lib/goog/../webdriver/promise.js:553:15)
    at goog.async.run.processWorkQueue (C:\projects\kitos\node_modules\protractor\node_modules\selenium-webdriver\lib\goog\async\run.js:130:15)
    at process._tickCallback (node.js:368:9)
[launcher] Process exited with error code 1
[08:38:13] 'protractor' errored after 50 s
[08:38:13] Error in plugin 'gulp-protractor'
Message:
    protractor exited with code 1

The selenium server is running, tests passes but when the server is about to shut down the error occurs.

Setup

On build start I run npm install which in turn runs node_modules\\.bin\\webdriver-manager update --standalone as a postinstall script.

Protractor is run with a gulp task with the gulp-protractor plugin and the selenium standalone jar is defined in the protractor configuration as seen here:

exports.config = {
    seleniumServerJar: '../node_modules/protractor/selenium/selenium-server-standalone-2.47.1.jar',

    specs: ['Tests/**/*e2e.spec.js'],

    resultJsonOutputFile: 'results-protractor.json',

    allScriptsTimeout: 30000
};

The complete buildlog can be seen here: https://ci.appveyor.com/project/Crevil/kitos/build/1.0.187 Apologizing for the noisy log. The deployment logging is very loud in the console and it is not configurable on AppVeyor afaict.

Local log information

As mentioned, everything runs fine on my local machine. Here is a log of protractor running.

C:\Users\BSO\Documents\Git repos\kitos>gulp protractor
[09:54:58] Using gulpfile ~\Documents\Git repos\kitos\gulpfile.js
[09:54:58] Starting 'protractor'...
Starting selenium standalone server...
[launcher] Running 1 instances of WebDriver
Selenium standalone server started at http://192.168.5.153:16772/wd/hub
..

Finished in 5.241 seconds
2 tests, 2 assertions, 0 failures

Shutting down selenium standalone server.
[launcher] 0 instance(s) of WebDriver still running
[launcher] chrome #1 passed
[09:55:08] Finished 'protractor' after 10 s

C:\Users\BSO\Documents\Git repos\kitos>
1

1 Answers

1
votes

This issue is solve with the following parameter to the java runtime engine

localSeleniumStandaloneOpts: {
        args: ['-Djna.nosys=true']
},
...

There are more details in the protractor issue here and the specific solution by Feodor Fitsner.