Pagy provides quite a few helpers that render the pagination elements for different js-frameworks on the client side. They are tested with the Pagy Playground apps and Cypress.
Notice: the e2e
dir containing the cypress tests is also a minimalistic workspace. That is a solution needed to workaround this cypress issue and keep everything cypress-related in a single dir inside the project (instead of files and dirs mixed with the main project).
You have two different ways to run the tests:
Just create a PR and all the ruby and e2e tests will run on GitHub. Usually this option is fine for simple PRs that pass the ruby tests.
Notice: This option is not enabled by default in Github for new contributors, however after you create a PR it will get enabled ASAP.
The test environment uses bun (but cypress still needs node ATM )
- Install bun
- Install modules:
bun install
- Optional for updating packages:
- Install:
npm-check
:bun install -g npm-check
- Interactive usage:
npm-check -u
- Install:
You can run all the cypress tests in parallel with:
./e2e/cy/test
Notice:
- The output of the parallel processes get mixed in the same log stream, however the test summaries are prefixed with the app name.
- The script will return a non-zero status if any of the test fail, and will print a brief feedback.
You can limit the cypress test to a specific APP:
./e2e/cy/test repro
You can also run the cypress test interactively (only one APP/file at the time) opening cypress UI:
./e2e/cy/open demo
Notice: You can only run the spec file for the app that is running (e.g. demo.cy.ts
in the example above)
The pagy e2e testing is mostly based on snapshots, so if you changed the pagy output you may need just to reconcile it with the snapshot values by running this command (that runs the tests and stores their new value):
./e2e/cy/reconcile
See also Ruby Test Environment