DEV Community

Discussion on: Angular struggles in 2020

Collapse
 
itsasine profile image
ItsASine (Kayla)

Re: Protractor

Protractor has been under the Angular umbrella for a while. Protractor 6 was going to be the big move to the most recent Selenium Webdriver version to nix the Selenium baked in Promise handling and go full into async. With how hard Protractor leaned in to wrapping Selenium, including maintaining their webdriver-manager package for getting the latest browser drivers, I'm not terribly surprised that got shelved.
I've been following that for a year or so so they were trying to move Protractor forward for a while. My understanding of the diff between 5 and 7 is more just bumping dependency versions since all the actual work for the past year+ was in 6. On one hand, I'm glad I don't have to rewrite my tests that are a weird blend of forcing Protractor to work in ES5 if they had bumped versions. On the other hand, though, you're right that they just coughed up a version to look like progress when their 6 release didn't pan out.

Interesting thing about the 6 release was when they did it, it was out for a bit before they pinned the npm package at the latest 5 release, before doing another 5 bug fix release, then doing a 7 release... 6 existed and was out for a few months. The problem was downloading it meant you needed to be on the bleeding edge of everything else in the Google ecosystem. I'm not writing e2e tests for beta Chrome versions and pre-release versions of Selenium... so I kept to 5. Checked back a month later and they removed 6 from the versions list and were on 7 as a marginal bump from 5.

TL;DR: Protractor 6 is like Angular 3 -- it never happened.

Re: the list of names: Aww, Brocchi is one of the best people

Collapse
 
jwp profile image
John Peters • Edited

Cypress has disrupted all Selenium products. Selinium is in sunset mode.

Collapse
 
itsasine profile image
ItsASine (Kayla)

Eventually. I'm more interested to see how things shake out when it's not the new hotness.

For the sake of a thread about Protractor, though, Angular apps will always benefit from the coupling Protractor has with the Angular hooks. As long as Protractor is around, I wouldn't use Cypress for Angular E2E.

Thread Thread
 
jwp profile image
John Peters

New hotness for Cypress? It won't shake out because it's just easier to write e2e tests than Protractor. But unlike protractor, it's inbound and outbound http interception allows it to be way more than just for e2e tests.

The javascript community and in particular the React people scream the superiority of declarative programming every day. Cypress is the declarative king for test.

Protractor has been disrupted.

Thread Thread
 
itsasine profile image
ItsASine (Kayla)

It's fine that Cypress is the new king of React testing or whatever.

For Angular, I'd still use Protractor. Because Protractor is specifically made for that framework.

Anyone who was using Protractor for React/Vue/etc was using a hammer as a screwdriver so any screwdriver is going to work a lot better.

Thread Thread
 
jwp profile image
John Peters

Interesting because even though Protractor has been around since before the Angular CLI, the Angular schematics to this day don't use Protractor. Instead they spin up the ridiculous Karma/Jasmine tests for each new component. Using Protractor has always been a choice whereas Karma/Jasmine were defaults.

But Karma/Jasmine solutions are ridiculous in my opinion. The Angular Testing Library is plug replaceable with Karma/Jasmine and a much better product.

Still Cypress reaches deep enough into our applications that it's now my preferred and only "real" test framework, I still use Angular-Testing lib, but don't spend much time on each test.

Thread Thread
 
layzee profile image
Lars Gyrup Brink Nielsen • Edited

The end-to-end test suite generated when creating an Angular application project with Angular CLI is using Protractor.

Protractor has the benefit of hooking into NgZone. Cypress sometimes has issues with waiting for an element to appear. You end up having to put random timeouts into your tests to wait for Angular to stabilize. Sometimes it works, but it's a flaky test waiting to fail.

Protractor is able to support legacy browsers like Internet Explorer and Edge Legacy.

Thread Thread
 
jwp profile image
John Peters

Thanks for the reminder Lars, yes Angular sees Protractor as E2E and not unit test.