https://cypress.io logo
Hi gang! I'm mulling over one of the points in the...
# best-practices
a
Hi gang! I'm mulling over one of the points in the Best Practices docs that talks about cleaning up state before test runs. The principle makes total sense; leave the state dangling after a run so that any manual assessment on data can be performed to address any unexpected results. I'm having trouble figuring out a way to make it work given our current execution strategy. - We have a one-to-many concept of organization to company(ies) - We use a before hook in
e2e.ts
(Cypress 10) or
support/index.ts
(pre migration) to create a company on our test org to perform the tests - We alias this created company using
as(testCompany)
and reference it in all tests for a given run - We use an after hook to
deleteCompany(this.testCompany)
since the Mocha context is still shared during the run Anyone have any ideas on how we can adapt this model and determine the company to be deleted when a run begins in order to adhere to the "reset before runs, not after" methodology?