Skip to content

Commit

Permalink
cypress support: register commands workaround
Browse files Browse the repository at this point in the history
  • Loading branch information
cmnord committed Sep 21, 2023
1 parent f00111e commit 32b30cf
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
4 changes: 3 additions & 1 deletion cypress/support/commands.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
4 changes: 3 additions & 1 deletion cypress/support/e2e.ts
Original file line number Diff line number Diff line change
@@ -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
Expand Down

0 comments on commit 32b30cf

Please sign in to comment.