What should you use instead of Protractor for test automation of Angular sites?

Photo by Jeff Sheldon on Unsplash

If you are using Protractor for test automation of Angular sites, I have bad and good news for you.

First, the bad news.

Protractor will be retired at the end of 2022 as it became incompatible with the latest version of the Selenium WebDriver framework.

Protractor is built on top of the Selenium WebDriver bindings for Node.JS and unfortunately the latest version of these bindings introduced changes that are difficult to use in Protractor.

Read the announcement here.

If you have lots of UI tests built with Protractor, this is obviously not good news.

You will have to migrate the tests to another automation library for Javascript.

Which one should you use?

The good news is that there are quite a few libraries that you can use.

The “retirement” announcement presents a few options for Protractor:

  • Cypress

Let’s discuss the options one by one.

I do not know what TestCafe is so will ignore it for now.

Selenium-webdriver is the Selenium bindings for Javascript and Node.js. You can use it instead of Protractor but it is probably more basic than the other options.

Puppeteer is not a good option because the team that built it left Google for Microsoft so they work on a different library named Playwright. The Puppeteer project can be probably considered as done.

This lefts us with 3 options:

  • Playwright

Playwright is the new Puppeteer. It is a pretty good library which does not depend on Selenium WebDriver. It basically implements the same functionality in a different way.

It does a lot of good things for UI automation:

  • works in all browsers compared to Puppeteer which worked only in Chrome

With so many good things, maybe this is the winner?

Unfortunately, no.

Playwright is still very new and with lots of bugs that need to be fixed. If there is something that I personally want in my projects, this is a stable UI automation library which Playwright is not yet.

What’s next? Yes, Cypress.

Cypress is cool and trendy at the moment, having more downloads than the Selenium Webdriver bindings for Javascript and Node.JS.

Cypress, like Playwright, has a new architecture that is completely independent from Selenium WebDriver.

It has lots of great features such as:

  • tests get executed automatically while you write them

One downside is that Cypress is also very new.

Another downside is related to maintaining your existing code. If you structured your project to use page object classes, this may prevent you from writing the best Cypress tests. Why not? Because page objects are considered an anti-pattern by the Cypress team. Instead of using page objects, they suggest using methods of the Cypress API directly in the tests. The tests will be longer, more difficult to read and maintain.

Migrating the existing Protractor solution to Cypress will probably be the same with rewriting it from scratch.

This leaves us with WebDriver.IO.

WebDriver.IO is a mobile and browser test automation framework for Node.js.

It can run either on the Selenium WebDriver protocol or on the Chrome DevTools protocol.

It is extendable and very rich in features.

It supports page objects.

It is supported and developed by Sauce Labs, one of the biggest cloud grids for test automation.

It is also around for about 5 years which means great stability.

What should you use then?

I think that WebDriver.IO is probably the best solution at this moment especially when considering the migration of the existing code that depends on Protractor.

Cypress is probably as good as WebDriver.IO but the migration process will be much more difficult.

Playwright is not mature yet.

Blogs about Selenium and Java at https://seleniumjava.com.

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store