Acceptance Testing Framework for React application

(Shruti Rathee) #1

So we have a new React js project coming in and we are trying to decide the framework for acceptance testing specifically. I did read the article of What’s the preferred way to test React js components but it seemed like most of the comments are for Unit testing.

I was wondering what other people use to do their acceptance for React js components?

We have been thinking about mocha + chai + nightwatch.

Jest +nightmare was a solution too but couldn’t get ahead the fact that its chromium based. Someone also suggested python for testing framework.

What are your thoughts? Which framework is your preferred choice and why?

(Alexei) #2

Actually, on our project, we are using Protractor+Jasime2.
For correct component selection, we have added data-qa property, and we are using only stuff which doesn’t require Angular.

As for me protractor is much more reliable framework than nightwatch.js and has much reach API.
Personally, I think that React doesn’t need some specific stuff(like Angular do) for Acceptance testing.

And for me, your question sounds like what is a good library for acceptance testing in JS, and for me, an answer is Protractor.

(James Gillmore) #3

For me the answer is Jest + Nightmare. Super easy. And that’s probably Jest + Chromeless now:

The ease of use (and now speed with Chromeless) make up for any shortcomings. It’s testing just like unit tests basically, no browser driver setup, etc. You can even use Jest snapshots to snapshot any portions of the dom as strings.

AND, you can use jest-image-snapshot to take snapshots via nightmare or chromeless and create tests based on image diffs:

(Clara Attermo) #4

We use Selenium for end-to-end testing and it works ok. For a bigger company where not all applications are written in React it’s nice to use a framework that’s not connected to React or SPAs specifically so that all applications can be tested with similar code.

We’ve added specific data attributes as selectors for elements that Selenium needs to access. When dynamic stuff happens Selenium can wait for elements to appear or disappear, text to change and so on.

(Shruti Rathee) #5

Yeah that was our initial choice as well but i guess we are living stone age and we wanted to have multiple browser support. Couldn’t find anything solid to run Jest + Nightmare tests in other browsers let’s say firefox for instance.

(Nima) #6

Differencify ( is been used for visual regression testing. There are example here and here