πŸ›‘οΈTesting

Getting tests to work

Run mix test to run the tests.

Petal Pro also comes with some end-to-end (E2E) tests (see signup_test.exs). We use the library Wallaby for this.

Wallaby tests don't run by default as they can be slow. We have hidden them behind a "feature" flag.

# Run all tests, including wallaby:
mix test --include feature

# Run only wallaby
mix test --only feature

# Or use our alias to run only wallaby:
mix wallaby

For E2E tests to work, you must install Chromedriver, which will run the tests like you were clicking things in a browser. On a Mac, you can install it with:

brew install --cask chromedriver

Then to run the E2E tests run mix test --only feature. Or you could use our alias mix wallaby (see aliases defined in mix.exs).

On Mac, you may get the error:

Error: β€œchromedriver” cannot be opened because the developer cannot be verified. Unable to launch the chrome browser

If this happens, you can run this command:

xattr -d com.apple.quarantine $(which chromedriver)