Geeks logo

Protractor.js is dead, What did we learn? Part 1

Avoid hypes, do real hands-on end-to-end test automation daily. Raw Selenium WebDriver + RSpec is better.

By Zhimin ZhanPublished 9 months ago Updated 9 months ago 3 min read
Like

My recent article “ ‘Cucumber is Dying’, What did we learn?” turned out to be a hit, in terms of reads within my 300+ articles. I have been warning people about “Gherkin” in test automation at software testing conferences, in my books, during my coaching, …, etc. There were disagreements and doubts about my judgment. This time, no single argument/disagreement, as my prediction (since 2013) about Cucumber is correct.

Today, I will write about another correct prediction on Protractor.js. Some of you might have read my articles on this topic:

A brief introduction to Protractor.js for testers who are not aware of it. Protractor.js was quite a big hype, not long ago. In fact, its deprecation was only announced in April 2021.

Protractor.js was created in 2013, i.e. it died at the age of eight.

On the paper, Protractor.js had all the reasons to be successful:

  • “Protractor wraps selenium-webdriver
  • It was created by the Angular team (at Google), and Angular was the most popular web framework during 2013–2018.
  • Using JavaScript, as it was (still is) the trendy thing (because of the huge popularity of Angular)
  • Yet, it failed.

    I will list my reasons why Protractor.js failed.

1. So-called “enhanced syntax over Selenium” is actually making it much worse.

A big selling point of Protractor.js is “simpler and enhanced test syntax over Selenium WebDriver”.

“Everything should be made as simple as possible, but no simpler.” — Albert Einstein

I disagree with my first sight of a sample Protractor script on its tutorial site.

Let’s see an equivalent raw Selenium version (in RSpec):

Back in the “Protractor.js alive” days, some people argued with me, saying the first version was an improvement. I explained “It is wrong for the following reasons”:

  • Assuming the target web app is Angular, e.g. @ng-model - Remember, end-to-end testing is for all web apps. How would Protractor testers think after Angular.js is announced ‘deprecated’? A Selenium Webriver tester can test any web app.
  • Not clear, such as .binding('latest') - A tester’s brain might need to process on looking at this kind of test statement. As for the selenium version, testers who have a basic understanding of HTML, can get the idea unambiguously.
  • Losing “Action” tone and rhythm. - In the Selenium version, get , find , expect actions emulate end-users' operations, it is more logical and easy to follow. Protractor broke that rhythm, which will lead to problems in maintaining a large suite of tests.

Some might argue that “Protractor.js version is more concise, quicker typing ”. People are saying that lack the concept of “Snippets” in IDEs/Programming editors. For example, in TestWise, I type dfex followed by a Tab, which will be expanded to driver.find_element_by_xpath("...", "...") .

2. Using the same language in automated test scripts as the coding one is a bad idea.

A common mistake in test automation is using the coding language, typically Java, C#, and JavaScript, for end-to-end test automation scripts. There is no such rule, because end-to-end test automation is about the perspective of end-users, nothing to do with the code behind the app. The failure of Protractor.js ( coding with Angular.js) is proof.

For more, check out my article, Correct a Common Misconception: “Using the Coding Language for End-to-End Test Automation”.

3. JavaScript is not a good language for end-to-end test automation.

In recent years, JavaScript has become the mainstream coding language. However, in my opinion, JavaScript is bad for end-to-end test automation, for example, async does not much sense in the testing context.

I wouldn’t say any end-to-end test automation with JavaScript definitely fails, but every single test automation attempt (with JS) I witnessed failed. Protractor.js (in JavaScript) may serve as a side-proof, after all, it has been widely tried (and failed). Not long before Protractor, the big embarrassment in test automation is the failure of Phantom.js (another one in JavaScript). Cypress is the next popular JS test automation framework/tool. All Cypress test automation attempts (which I witnessed) were complete failures. Cypress, so-called test automation framework, is with a number of severe limitations, which is unthinkable in other industries. (can you imagine a car stops working at night or on a rainy day?)

For more, check out my articles:

In Part 2, I will share why my predictions on test automation technologies are proven 100% correct, so far.

--

This article was originally published on my Medium blog on 2023-05-12.

Further reading:

product review
Like

About the Creator

Zhimin Zhan

Test automation & CT coach, author, speaker and award-winning software developer.

A top writer on Test Automation, with 150+ articles featured in leading software testing newsletters.

My Most Viewed Articles on Vocal.

Reader insights

Be the first to share your insights about this piece.

How does it work?

Add your insights

Comments

There are no comments for this story

Be the first to respond and start the conversation.

Sign in to comment

    Find us on social media

    Miscellaneous links

    • Explore
    • Contact
    • Privacy Policy
    • Terms of Use
    • Support

    © 2024 Creatd, Inc. All Rights Reserved.