✓ Used refs to describe a component tree ✓ Reduces the amount of boilerplate in tests Adds boilerplate back by having to write Page Objects Pattern is better for larger entities; React components are small, don't need an API to describe them QubitProducts/react-page-objects
refs to navigate the render tree ✓ Has none of the boilerplate of TestUtils or react-page- objects ✓ Supports stubbing, context changing and mounting X Have to add refs to anything you want to test X Library reaches inside the React internals - hacky and not liked by the React team QubitProducts/react-test-tree
(including selecting by component type and props) ✓ Is extendable ✓ Can mount into the DOM or shallowRender X Not had a big uptake in the community yet jquense/teaspoon
to assert that the entire output of a component is what you were expecting ✓ Has versions for chai and other assertion libraries X Not really a testing framework, just a utility algolia/expect-jsx
of rendering (shallow, DOM, static) ✓ Doesn't require refs to be added for testing ✓ Clean, extensive API with jQuery-style selectors X Only designed to run in Node - tricky to run in the browser X Selectors are a little limited compared to teaspoon airbnb/enzyme
to be indifferent to framework/library choices ▸ Already plenty of tools for E2E, most of them using Selenium WebDriver - webdriver.io - Nightwatch.js - Nemo.js ▸ Pain in the arse to implement/run
negatives ▸ Often caused by arbitrary timeouts - e.g. click a button, wait for the page to reload - how long do you wait for? ▸ There is no way to solve this without being framework- agnostic
launching browsers and injecting code 2. Enhance WebDriver with framework-agnostic plugins: ▸ Select React elements (enzyme/teaspoon) ▸ Do equality checks against components (expect-jsx) ▸ Navigate around the app (react-router) ▸ Wait for actions (redux)
test runners and assertion libraries Requirements Modern API Library indifferent Fast, simple, reliable For devs to want to use web automation it needs to be simple, fast and reliable The API should be simple and embrace modern JS features such as async/await
download and run Selenium Standalone automagically ✓ Does not care what runner/framework you use ✓ Zero-config N.B: Currently just a proof-of-concept - functioning release expected soon QubitProducts/react-driver
simplicity of testing them increases ▸ Hypothesis: If a component is perfectly functional and its props are perfectly described, every possible input/output can be deterministically generated and tested.
be able to assert that an output is correct given an arbitrary generated input ▸ Complex components could have many different possible inputs/outputs ▸ What if we adopt the principles of regression testing?
negatives ▸ Testing against JSX output, not a screenshot ▸ However it is still hard to implement 'well' ▸ Where is the test spec stored? ▸ How do you quickly and easily update the spec? ▸ How many variants do you generate? ▸ How does the user control what is generated (are PropTypes enough)?