DEV Community

Cover image for 5 reasons you should not use Protractor in 2020

5 reasons you should not use Protractor in 2020

davert on September 27, 2019

TLDR: There is a chance that you might still want to use Protractor when version 6 is released. But not today. As of today, it is recommended to s...
Collapse
 
paulogoncalvesr profile image
Paulo Gonçalves • Edited

The reason 2 to 5 isn't a argument, only the 1 is a argument to why don't use protractor.

1. Protractor is not updated
Yeah, 8 months on version 5.4.2, because the version 6 has some problems :(

2. Protractor 6 will break compatibility
That's normal on any major release on any framework, because the most open source project use semantic versioning.

3. Protractor is overcomplicated
That's not true, is so easy and had many good features, the setup is so easy, the minimum needed is where directory the spec are.

Example:

//protractor.conf.js
module.exports.config = {
  specs: ['src/spec/*.spec.js'],
};

4. Protractor not driving a good design
That's not true, your example is a result of the knowledge of the coder who does not know good automation practices. In any framework it will create a bad design like this.

5. Protractor is not required for Angular
Why that's bad?

Suggestion: Learn about protractor-helper to create robust and flakiness free tests.

Note: Webdriverio and codeceptjs can't be considered a 'modern framework', is only one more with less suport and feature.

Collapse
 
warioneila86 profile image
Mario

Agree.

About reason #2, in our company we already updated our tests (thousands) to use async/await two years ago, just to be prepared when the upgrade comes.

We had the whole team working on that and it took us like 3 days to get the whole framework updated. Not a big deal, to be honest.

The protractor upgrade didn't arrive yet, true, but our code is much more readable and maintainable now 😍

Maintaining your tests must be part of your work IMO.

Collapse
 
jsunaina1 profile image
jsunaina

Thanks for the awesome information!!

What would you recommend as a substitute of Protractor.
Do you think we will still be able to run tests using Protractor 5.4.2 with future browser versions?

Collapse
 
davert profile image
davert

I assume - yes, Protractor will work, as Selenium team support legacy implementations. However, new features or protocol extensions won't be available. Anyway, don't blame yourself if you already use it. No need to worry. But it's not a great idea to choose Protractor for the next project.

Collapse
 
paulogoncalvesr profile image
Paulo Gonçalves

I recommend Cypress, with him is possible to do E2E and Unit tests.

Do you think we will still be able to run tests using Protractor 5.4.2 with future browser versions?

Sure, totally possible.

Collapse
 
xfaramir profile image
Xfaramir

Protractor is maintained by Google and supports typescript
Just because they haven't updated it in a while doesn't mean still not the best framework for automation. Even better than selenium java.

Collapse
 
davert profile image
davert

Protractor is maintained by Google

Well, that's a myth. There is only one person working in spare time on this huge project. It was maintained by Google but not now.

Just because they haven't updated it in a while doesn't mean still not the best framework for automation.

If they won't change their policy on maintaining it won't be the best framework. I'm just rising awareness of that problem.

Even better than selenium java.

There are more alternatives than just Java. I hope you can find time to investigate more tools for testing so you could see Protractor is not the best at the market.

Collapse
 
xfaramir profile image
Xfaramir

BTW CodeceptJS should not be considered as alternative to Protractor, but rather a testing framework that leverages this powerful library. So maybe webdriver.io could be an alternative but don't see anything better tgan protractor.

Collapse
 
benz738 profile image
Federico R.

I just checked if protractor is the official e2e test tool, and looks like it is, speaking of Angular 10. I trust Angular team, if they are still using this tool probably there are good reasons for keeping it.

Honestly I added this comment because I don't like that a project quality is judged by the its number of releases. As others said, a major version introduces breaking changes, so it can be backwards compatible but it doesn't have to. It's up to the project team to merge the most important bug fixes on older major versions, but again they're not obliged to.

Also don't consider the number of open issues as an indicator of quality: sometimes people is just not using the tool correctly, or they are looking for tips on how to do something. The fact is that Angular is very popular, and Protractor is its official e2e test tool, so you can easily imagine why many people is using the repository issue board to ask things that are not bug related.

If I was you, in order to complete this article and make it more "credible", I would add at least a good alternative to it, and for alternative I mean something that has Tons of reasons to justify the migration from an official tool to one unofficial!

Cheers ;)

Collapse
 
praveendvd profile image
praveendvd

I feel sad for people who took this article seriously, now the library is maintained by angular, it's being developed actively, await made the life much easier and cleaner, await removed the complexity of the framework, page object model is the slogan for any automation project

Collapse
 
spleshakov profile image
spleshakov

Such a nonsense to be honest in my opinion... Yes, sooner or later Protractor may be a bad choice, but why I disagree to the mentioned as of today:

  1. How is it not updated? just take a look at the history of releases github.com/angular/protractor/rele... and then status of pull requests
  2. This item should have been 'Protractor 6 will break compatibility if you don't make the transition'. Which essentially is - your code will break if you don't maintain it. Thanks cap. But I'm thinking about benefits I get like readability, and resolving what you mentioned under #4
  3. Yes, maybe. Not more complicated than Java+Selenium stack though. But in the end who cares, if eventually you talk to the last layer of the stack (protractor itself), which is pretty straight forward. You don't mention how NodeJS is complicated under the hood, but why would you care if use don't need to know it to start using it, right?
  4. That exactly the point why async/await were brought to the game, to solve this 10 level code structure
  5. Nothing in particular is required for testing, it's always what you like/prefer, so why not Protractor? which has very good community support, unlike many new tools (at least for now)

Don't get me wrong, the practice shows that those who don't make transition to newer technologies timely, lose their marketability. But that's not about Protractor in 2020

Collapse
 
trigunam profile image
Triguna Mutuguppe Sripathi • Edited

I came here from github.com/wswebcreation/protracto...

As we are actively using the above plugin with Protractor for testing.

I do not agree with every point you made against Protractor, however, the other frameworks mentioned is not solid as such and new to the market as well.
With recent upgrades from protractor, I believe it is stable. If there are more contributors to protractor itself, we could make it stronger as a framework.

Collapse
 
bwanamaker profile image
Brandon Wanamaker • Edited

It looks as though Protractor v6 isn't happening and the project is jumping straight to v7. The v6 packages on NPM have been marked as deprecated. Just FYI, not that it changes anything you've written, but I thought it was an interesting move on their part.

Collapse
 
davert profile image
davert

Yes, thank you! The post is very provocative but still true.
Even they jumped to 7 they didn't introduce anything huge in codebase, as the codebase is still a big mess. So project still faces stagnation

Collapse
 
xotabu4 profile image
Oleksandr Khotemskyi • Edited

Just for someone who will read this article in 2021

TLDR
The Angular team plans to end development of Protractor at the end of 2022 (in conjunction with Angular v15)

github.com/angular/protractor/issu...

Collapse
 
chandrasekhaer profile image
chandrasekhaer

One more feature why we not use protractor;
Re-run only Failed test cases.(not supported by protractor)

Collapse
 
moinuddin14 profile image
Khaja Moinuddin Mohammed

Definite alternatives to Protractor are

  1. Puppeteer
  2. Cypress
  3. WebDriverIO
  4. Playwright (Still in beta)

All the above other than WebDriverIO are not based on Selenium which is a good thing.

Collapse
 
moinuddin14 profile image
Khaja Moinuddin Mohammed

BTW, to answer some pointers raised in the article against Cypress

iframes: This article explains how to work with iframes cypress.io/blog/2020/02/12/working...

file uploads: How to work with file upload with Cypress github.com/cypress-io/cypress-exam...

native events: Yes this is a big issue which they are actively working on github.com/cypress-io/cypress/issu...

any other browser except Chrome: They have recently started supporting firefox docs.cypress.io/guides/guides/laun...

xpath: Cypress has this beautiful concept called plugins and with that it's possible to extend the capabilities of cypress, one such example is using external node module for working with xpath, I personally used this and it works well npmjs.com/package/cypress-xpath

multiple windows and tabs: It's true that Cypress doesn't support multi tab and multi window but they have given reasons for not supporting that, which to me makes sense. We shouldn't be testing the browser features instead the application feature. Also, multi tab and multi browser scenarios are quite brittle. These are one of those flaky tests that has plauged the testing community for so long. Time to take these tests out of the test suite.

testing sites you don't control: Honestly, didn't get this point

page objects: As Page Objects is only a concept and not language/framework specific, ideally we should be able to use with almost any testing tool/framework. But then there are alternatives to Page Objects like SerenityJs's Screenplay Pattern, again PO Pattern makes things more complex. Cypress has a better way to handle with Custom cypress.io/blog/2019/01/03/stop-us...

Also, Cypress is ever evolving and they are going places to reach audience and gather feedback. Looks to me they are truly on their mission to provide a better alternative to Selenium.