Protractor testing

I’ve been working a lot with protractor recently. And even though there are still some issues with phantomjs, it is still pretty awesome. It integrates seamlessly with Jasmine and Cucumber, so that’s a bonus.

To start using protractor you can follow the official documentation here.

One very cool feature I like is multiCapabilities. As E2E tests are typically slow, you might want to speed up your tests by running them in parallel (as long as they are independent tests, of course).

Most probably your initial config file looks like this:

Which makes protractor run all the test files specifies in a sequential order. But if the tests are independent of each other, you can run them in parallel! Like so:

The above config will open up separate web driver instances for each of your test file, running them in parallel. Notice the multiCapability property and the shardTestFiles parameter. This is how protractor knows to split up the tests between individual browsers. As you probably guessed, maxInstances tells protractor the maximum number of browsers it should open at one time.

You can do even more. Since we are working with multi capabilities, you can go ahead and run your tests again in a different browser at the same time! How cool is that?

This has significantly lowered the time it took for my E2E tests to complete, hope you find it useful.

Related posts

Comments are closed.