Comments (3)
There is a before:run
and after:run
API as part of setupNodeEvents
that does this.
- https://docs.cypress.io/api/plugins/before-run-api
- https://docs.cypress.io/api/plugins/after-run-api
I'm not sure if we could hook into this once a spec has begun, so that you could run Cypress tests.... it would require quite a bit of rework anyway.
from cypress.
Thanks for the input @jennifer-shehane
Yeah, I know I can use those apis. The problem is that the whole setup and cleanup processes in our scenario make use of a lot of cypress commands, which blocks us from being able to call them from there.
It would be awesome if we could have a true global before hook (one that runs just one at the beginning of the test run) and a true global after hook (that runs just once, after the whole test run has completed)... Are there any limitations that would prevent Cypress to provide such functionality?
Thanks again.
from cypress.
NOTE: I know that using the after or afterEach hooks to cleanup state or test data is an anti pattern. The problem we face is that we are required by dba's to cleanup every test data we create in the lower environments databases for our tests as soon as the test runs are completed.
We could (and that's what we are doing) delete the users after each spec is completed. The problem with that is that we are creating between 4 and 10 users depending on the run type, and creating that amount of users takes a lot of time... If we have to create them before each spec, with 20 specs we will have more than 40 minutes taken only for test users setup and cleanup.
That's why we decided to create a set of users on startup, use them across all our test run, and clean them up when we are done...
Hope that makes sense.
from cypress.
Related Issues (20)
- Support Chrome Devtools Protocol event listening
- Remove support for Node.js 16 and 21
- `сypress open` failed to start on Mac M1 Sonoma 14.5 (23F79) HOT 3
- Cypress incorrectly uses the box model of elements that have `display:contents` when determining visibility of child elements
- support angular signals inside cypress/angular
- Remove official support for versions of React 17 and under for CT Testing and make cypress/react18 the cypress/react package (deprecate cypress/react18) HOT 1
- Cypress crashes with "Warning: We failed to record the video." HOT 1
- Typing `{{arrowUp}}` should trigger event on `input[type=number]` HOT 10
- Drag and Drop functionality not producing expected behaviour
- `Eval`ed UserInvocationStack is sometimes off for projects using Typescript 5
- Vue elements error when checking missing nodeType property
- Waiting for aliases array hangs when running on Circle CI
- Support automated E2E config and example scaffolding HOT 2
- Problem during Cypress instalatión HOT 10
- `cy.scrollIntoView` doesn't respect css `scroll-margin` or `scroll-padding` properties
- Issue during installing forked Cypress HOT 5
- Screen size is restricted to 800 x 600 in Chrome Headless using cypress docker inside CI HOT 3
- 'failures' in mochawesome-report is not accurate. HOT 2
- Cypress cy.visit not updating url and dom after first visit in the spec. HOT 1
- Add config hook for altering the actually used webpack config
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from cypress.