0
0
mirror of https://github.com/PostHog/posthog.git synced 2024-11-28 00:46:45 +01:00
posthog/cypress/support/commands.js

19 lines
487 B
JavaScript
Raw Normal View History

import 'cypress-plugin-snapshots/commands'
const patternHandler = {}
Cypress.Commands.add('interceptLazy', (pattern, handler) => {
patternHandler[pattern] = handler
return cy.intercept(pattern, (req) => {
req.reply(patternHandler[pattern]())
})
})
Cypress.Commands.add('overrideInterceptLazy', (pattern, handler) => {
patternHandler[pattern] = handler
})
Cypress.Commands.add('map', { prevSubject: true }, (subject, method) => {
return method(subject)
})