Protractor Tests

Dave's Avatar

Dave

10 Sep, 2015 06:03 PM

Is there any guidance on setting up and running Angular protractor tests on Appveyor?

  1. Support Staff 1 Posted by Feodor Fitsner on 10 Sep, 2015 10:51 PM

    Feodor Fitsner's Avatar

    Nope. Are there any specific requirements?

    - Feodor

  2. 2 Posted by Dave on 10 Sep, 2015 11:11 PM

    Dave's Avatar

    We need the ability to run protractor tests during our build and fail the build if the tests do not pass.

    Here is how one would setup protractor: https://angular.github.io/protractor/#/.

    It uses the Chrome web driver.

  3. 3 Posted by Dave on 11 Sep, 2015 06:31 PM

    Dave's Avatar

    Is it possible? Or should we try to found another solution?

  4. Support Staff 4 Posted by Feodor Fitsner on 11 Sep, 2015 06:35 PM

    Feodor Fitsner's Avatar

    You could give it a try. I don't see any reasons why it's not possible. People run Jasmine tests, Selenium tests against both Chrome and FF without any problems.

  5. 5 Posted by Dave on 11 Sep, 2015 06:42 PM

    Dave's Avatar

    Do they set it up via the test scripts? Also, how would one start up the asp.net web app before the test run? The app needs to be running for protractor test runs.

    Thanks.

  6. Support Staff 6 Posted by Feodor Fitsner on 11 Sep, 2015 06:44 PM

    Feodor Fitsner's Avatar

    Right, you should provide your own script for deploying app and running tests.

    There is IIS available on build workers - you can deploy your app to there before running tests. XCopy or Web Deploy or PS can be used. Some people use IIS Express.

  7. 7 Posted by Dave on 11 Sep, 2015 06:50 PM

    Dave's Avatar

    Great. Thanks. A couple of more questions:

    1) So the deployment would something like the following provider: http://www.appveyor.com/docs/deployment/local?

    2) How do you report back test failures so we can properly fail the build if the tests don't pass?

    Thanks.

  8. Support Staff 8 Posted by Feodor Fitsner on 11 Sep, 2015 11:34 PM

    Feodor Fitsner's Avatar

    1) Yes, you can use Local deployment provider. This case you could run your tests on "after_deploy" section.

    2) If test runner process exits with non-zero code then build will fail automatically. Also, to pass test details to build results you can use build worker API: http://www.appveyor.com/docs/build-worker-api#add-tests

  9. 9 Posted by Bjørn Sørensen on 09 Nov, 2015 09:50 AM

    Bjørn Sørensen's Avatar

    Hi Feodor,
    I'm using the Local provider for deploying my ASP.NET MVC project before running some Protractor tests.
    I do have some problems accessing the running IIS in my tests. Can you clarify hos I set this up?
    My appveyor.yml has this configuration:

    deploy:
    - provider: Local
      Presentation.Web.deploy_website: true
      Presentation.Web.hostname: localhost
      Presentation.Web.port: 44300
    

    And I expected to access the IIS with http://localhost:44300/.
    Here is my build log at the deployment step: https://ci.appveyor.com/project/Crevil/kitos/build/1.0.148#L2595

    Am I missing something or expecting the wrong things?

    Regards
    Bjørn

  10. Support Staff 10 Posted by Feodor Fitsner on 10 Nov, 2015 12:33 AM

    Feodor Fitsner's Avatar

    Everything looks good to me. Before running tests you may try querying that site with something like Invoke-WebRequest cmdlet to see if it responds and check the response.

  11. Support Staff 11 Posted by Feodor Fitsner on 10 Nov, 2015 12:33 AM

    Feodor Fitsner's Avatar

    And you can look into build worker via RDP to further troubleshoot the issue: http://www.appveyor.com/docs/how-to/rdp-to-build-worker

  12. 12 Posted by Bjørn Sørensen on 10 Nov, 2015 07:45 AM

    Bjørn Sørensen's Avatar

    I'll look in to this. How have I missed the RDP option. This is brilliant! Thanks again.

  13. 13 Posted by Bjørn Sørensen on 10 Nov, 2015 12:23 PM

    Bjørn Sørensen's Avatar

    I now have it running. I missed the fact that I needed the self signing certificate to run this right.
    Further more I had not created a specific build configuration, which proved necessary when getting to the configurations with the database etc.

    The ability to use RDP was really necessary to find these issues, so thanks for this!

  14. Support Staff 14 Posted by Feodor Fitsner on 10 Nov, 2015 05:33 PM

    Feodor Fitsner's Avatar

    Great, thanks for the update!

  15. 15 Posted by Bjørn Sørensen on 13 Nov, 2015 07:41 AM

    Bjørn Sørensen's Avatar

    Hi again,
    I have a problem when running the protractor tests. It's a long shot, but maybe you have a suggestion?

    I get this error:

    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
    
    My search of help has only put me in the direction of Java things, but the only difference I have noticed is AppVeyor running Java 1.8.0_66 and my local machine runs 1.8.0_65. Can this be the reason? The error happens when the selenium-webdriver is shutting down.
    For more information see this SO
  16. Support Staff 16 Posted by Feodor Fitsner on 13 Nov, 2015 05:38 PM

    Feodor Fitsner's Avatar

    Hi Bjorn,

    Have you tried submitting an issue on Protractor repo: https://github.com/angular/protractor/issues ? You may get answers faster if contact Protractor developers there.

    Imho, bringing up Selenium Java server is not the "lightest" solution. There are "shorter" ways like WebdriverIO or WebDriverJs that works with web drivers directly.

  17. 17 Posted by Bjørn Sørensen on 16 Nov, 2015 07:29 AM

    Bjørn Sørensen's Avatar

    Hi Feodor,

    Thank you for the reply. I have not. But I will. :)

    I will also look into the lighter ways. I've read this approach on the protractor documentation pages, so I thought this was the way.

  18. 18 Posted by Bjørn Sørensen on 23 Nov, 2015 10:20 AM

    Bjørn Sørensen's Avatar

    Hi Feodor,

    Protractor team expect it to be an issue with the build worker and the Java configuration.

    See the response on github.

    I've decided to run things on BrowserStack instead of locally. This "fixes" the issue to me.

  19. Support Staff 19 Posted by Feodor Fitsner on 23 Nov, 2015 06:41 PM

    Feodor Fitsner's Avatar

    Thanks for the update.

  20. Support Staff 20 Posted by Feodor Fitsner on 09 Feb, 2016 07:15 PM

    Feodor Fitsner's Avatar

    There was a similar issue with using Selemium server from node.js which was fixed by passing -Djna.nosys=true to selenium Java process command-line: http://help.appveyor.com/discussions/questions/2093-using-selenium#...

    If there is a way to pass this argument to java.exe call in Protractor I think the issue will be resolved too.

  21. Support Staff 21 Posted by Feodor Fitsner on 10 Feb, 2016 02:11 AM

    Feodor Fitsner's Avatar
  22. Ilya Finkelshteyn closed this discussion on 25 Aug, 2018 02:04 AM.

Comments are currently closed for this discussion. You can start a new one.

Keyboard shortcuts

Generic

? Show this help
ESC Blurs the current field

Comment Form

r Focus the comment reply box
^ + ↩ Submit the comment

You can use Command ⌘ instead of Control ^ on Mac