Luckily with Rails, we have Rake and it is easy to write a rake task that clears the data you need. If you want to optimize for performance and avoid startup time of rake, you could expose a special endpoint only under test/development environment something like “POST /debug/reset-db”. Or even mark db save points and rollback (https://www.postgresql.org/docs/8.2/sql-rollback-to.html). Something like “POST /debug/save-point” and “POST /debug/reset-to-save-point”. It is easy to call those endpoints from the before hooks in cypress.