Sending Custom Events
Users can send custom events to DeploySentinel to attach additional debug
information during a test run. (ex. debugging errors and flakes with DB or app
state dumps). To use it, simply pass the custom data to command cy.dsAddEvent
.
You can call it as often as needed and pass an arbitrary number of arguments,
similar to console.log
.
Cypress.on('fail', e => {
// As an example, fetch data from Firebase
cy.callFirestore('get', 'myData').then(r => {
cy.dsAddEvent('Firebase Data', r);
});
throw e;
});
To trigger dsAddEvent
, you can call it within various Cypress events, you can
take a look at the
Cypress events catalog (opens in a new tab)
for more information. The command can also be called during the test or within
before(Each)/after(Each) hooks as well.
Note: For each payload, it should be able to be stringified with
JSON.stringify
(no circular structures) and the size has to be smaller than
4 MB.
Events will show up in the debugger inside the "Custom Events" tab on the right side of the debugger.
Typescript Configuration
If you're using Typescript with Cypress, you'll need to add
@deploysentinel/cypress-debugger
to the cypress/tsconfig.json
file:
{
"compilerOptions": {
"types": ["cypress", "@deploysentinel/cypress-debugger"]
}
}