Feature tests are one of the best ways to ensure reliability and consistency for web applications. But, as we’ve discussed previously feature tests can become a performance bottleneck for a large test suite.
With the fast approaching release of Ecto 2.0, Elixirists will be able to run feature tests for Phoenix applications concurrently. To take advantage of these performance benefits we wanted a testing tool that supported concurrent tests out of the box and provided a flexible api for querying and interacting with webpages.
Thats why we built Wallaby.
Wallaby is a concurrent, feature testing library for Elixir and Phoenix applications. It provides a flexible api for querying and selecting visible DOM elements and their attributes. For instance if you wanted to query a list of users you could write a test like this:
Concurrent by default
We’re big fans of PhantomJS for feature tests. Wallaby manages a pool of PhantomJS browsers to run each test case concurrently. This ensures that tests don’t share session information or cookies.
Interacting with forms
We like readable tests. Wallaby allows you to interact with form elements based on their id, name, or label text:
If actions need to be scoped within a specific DOM node then they can be composed with a finder:
Because Wallaby supports running tests concurrently its possible to simulate multiple browsers in a single test:
We use this technique to test our applications that rely on Phoenix Channels for communication.
Give it a try and let us know what you think.