coryhouse/reactjsconsulting

Cypress

coryhouse opened this issue · 0 comments

Custom Commands

Cypress.Commands.add("findSectionByHeading", (heading) => {
  return cy.findByRole("heading", { name: heading }).closest("section");
});

// This type is necessary for TypeScript
declare global {
  namespace Cypress {
    interface Chainable {
      findSectionByHeading(heading: string): Chainable<Element>;
    }
  }
}