user2086647
user2086647

Reputation:

Basic Authentication and Certificates handling with Protractor

I need to write some automated tests for our AngularJS apps with Protractor. Currently I am facing two problems:

  1. before the page is fully rendered some calls to services are made that require user name and password. These are prompted with a basic auth popup. I am not able to get my hands on this popup as all attempts to get the window handles fail. (or more explicit: the callback for the promise is never executed)

  2. for a different case I am getting the "select certificate" popup which I am also unable to get my hands on.

For both cases I have now the question if I am even able to ever capture them somehow or is it just that these are not accessible via automated tests via WebDriver? Currently I am trying to test the app with Chrome and PhantomJS but I would prefer to have them running with PhantomJS for an easier integration to our build environment.

Upvotes: 1

Views: 2183

Answers (2)

Cyberto
Cyberto

Reputation: 9

There is a possibility to automatically select the certificate with Chrome. Just have a look at the documentation: http://www.chromium.org/administrators/policy-list-3#AutoSelectCertificateForUrls

Upvotes: 1

bdavidxyz
bdavidxyz

Reputation: 2560

I had the problem and when such security pop-up occurs I couldn't handle them with WebDriver. PhantomJS of course is even worse in such case.

You have 2 or 3 options here :

  • deploy in a environment where security is not a concern, test with WebDriver the app, and test security manually in a prod-like env.
  • test with sikuli, there is zero adherence with the app under test, I did test this way, combined with Jenkins Jacoco etc it was very powerful once you build a DSL on top of the jar (don't use the GUI tool)
  • a third way is to combine sikuli and WebDriver, letting sikuli do the job only when required, but I didn't follow that way since mixing up approaches is somehow ugly.

Upvotes: 0

Related Questions