DEV Community

Discussion on: Which framework use for an e2e tests of an SPA?

Collapse
 
isaacdlyman profile image
Isaac Lyman

Cypress is the best e2e testing framework I've ever used, by a long shot. It's still young (only works in Chrome so far) but it's very smart.

With Webdriver, you may find yourself writing a lot of sleep(500) statements to wait for elements to appear on screen. In Cypress, it automatically waits for elements to appear. In Webdriver and Protractor, you often have to chain Promises in order to use the results of a DOM query. In Cypress, expectations allow enough complexity that you very rarely have to write asynchronous-style tests.

On top of that, it has a fantastic UI, lets you step through failed tests (with snapshots of your webpage at each step) and automatically takes video of the entire test process.

Collapse
 
rafalpienkowski profile image
Rafal Pienkowski

Thanks a lot for your replay. To be honest support only for one browser is in my case a blocker right now but I'll look closer to that tool.

I know that stopping test execution by sleeping a thread (which is required for DOM to be prepared) is a pin if a neck. Selenium contains such a wait for an element, but this is cumbersome in my case. That is the reason why I'm looking for an alternative.

Cheers.

Collapse
 
ben profile image
Ben Halpern

We need to get around to implementing Cypress.

Collapse
 
isaacdlyman profile image
Isaac Lyman

I'd be happy to get you started. Hit me up with that GitHub access and I'll get you a PR. :)

Collapse
 
rhymes profile image
rhymes

I'll definitely take a look at it, thanks!

I've been using TestCafe which seems super nice but it doesn't support stubbing responses which cypress seems to be able to do docs.cypress.io/guides/guides/netw...

Collapse
 
isaacdlyman profile image
Isaac Lyman

Yep! Although I've never stubbed a response, as I feel that would defeat the purpose of an end to end test.

Thread Thread
 
rhymes profile image
rhymes

I agree in theory but how do you deal with running the e2e on endpoints which require a lot of seed data or with CI then?

Do you seed the testing database, start a "testing server backend" and then run e2e on it? Isn't it super slow?

Thread Thread
 
isaacdlyman profile image
Isaac Lyman

Yep, that is what I do. And admittedly it is slow. My tests, altogether, take probably 5 or 10 minutes to complete.

Thread Thread
 
rhymes profile image
rhymes

Thanks for the support :-D

I'll take a look at cypress