Hi all!
I want to ask you which framework could you recommend me for an end to end tests of a Single Page Application. What is your suggestion what are advantages and disadvantages of frameworks you're using?
Currently, I'm using Selenium WebDriver and I'm writing tests in .Net but I've faced some problems which are related to the creation of DOM elements by an angular app. I've read about Protractor but I'm interested in your opinion.
Thanks in advance.
Top comments (19)
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.
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.
We need to get around to implementing Cypress.
I'd be happy to get you started. Hit me up with that GitHub access and I'll get you a PR. :)
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...
Yep! Although I've never stubbed a response, as I feel that would defeat the purpose of an end to end test.
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?
Yep, that is what I do. And admittedly it is slow. My tests, altogether, take probably 5 or 10 minutes to complete.
Thanks for the support :-D
I'll take a look at cypress
Hey Rafal,
As an alternative to Selenium, I'm a fan of TestCafe, it's fairly simple to install using npm and supports both JavaScript and TypeScript (which might feel better coming from .NET).
Things I like about it:
I wrote a few posts as examples which you can find here.
I've tried TestCafe but I couldn't make it work with webpack's dev proxy server and mocking.
I have the frontend separate from the backend and I would like to test the frontend isolated from the backend.
You can even find my github comment about it here - github.com/DevExpress/testcafe/iss...
Hi Christian.
Thanks for your replay. I'll look closer to the TestCafe. Great that you've written some posts with examples of usage. I think they will be beneficial for me.
Cheers.
I hadn't so much with Protractor and React. Therefore, I looked for other options and found Nightwatch. It works pretty well so far and the page objects are a really nice abstraction.
However, I recently checked out Cypress and I might want to switch to it.
Another +1 for Nightwatch from me - for anyone looking how to get started this might be useful
+1 for Nightwatch, was able to build nice CI utilizing this
Some colleagues have had great success with Katalon studio. In our organisation where most e2e testing frameworks have been thrown out of the window in frustration this is saying a lot.
It apparently plays well with CI and is tester friendly.
I haven't tried it myself but will definitely do so at the next opportunity.
Worth a look.
Thanks for your suggestion.
CodeceptJS. Just give it a try.
Thanks. I'll give it a try. On a first glance I like the syntax of it.