johnnyevolunium johnnyevolunium - 1 year ago 361
Javascript Question

How to use Protractor with Angular 2?

I use Protractor with Angular 1.x. I would like to migrate to Angular 2.0 step by step but I don't see Protractor in the docs.

Has protractor been dropped since Angular 2? Should I write my tests without using Protractor, using Jasmine instead (or others)?

Answer Source

You can test Angular 2 applications with Protractor starting from 2.5.0.

You would only need to add useAllAngular2AppRoots: true to your config. Here is a sample.

Note that several built-in Protractor matchers would not yet work with Angular2, see:

There is also that Protractor+Angular2 problem in Firefox (still unresolved), see:

If you are curious what changed in Protractor to support Angular 2, here you are:

When useAllAngular2AppRoots is set to true, it now uses GetTestability interface to get Testability objects for all Angular 2 apps under test and then waits for them to become stable (changelog1, changelog2).

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download