diff --git a/cypress/support/commands.ts b/cypress/support/commands.ts index fad258ef..6efc69e9 100644 --- a/cypress/support/commands.ts +++ b/cypress/support/commands.ts @@ -26,4 +26,6 @@ export function visitAndCheck(url: string, waitTime = 1000) { cy.location("pathname").should("contain", url).wait(waitTime); } -Cypress.Commands.add("visitAndCheck", visitAndCheck); +export function registerCommands() { + Cypress.Commands.add("visitAndCheck", visitAndCheck); +} diff --git a/cypress/support/e2e.ts b/cypress/support/e2e.ts index baa9411a..e2c28ef0 100644 --- a/cypress/support/e2e.ts +++ b/cypress/support/e2e.ts @@ -1,5 +1,7 @@ import "@testing-library/cypress/add-commands"; -import "./commands"; +import { registerCommands } from "./commands"; + +registerCommands(); Cypress.on("uncaught:exception", (err) => { // Cypress and React Hydrating the document don't get along