coryhouse / reactjsconsulting

React Related Resources
http://www.reactjsconsulting.com
378 stars 37 forks source link

Cypress #146

Open coryhouse opened 2 years ago

coryhouse commented 2 years ago

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>;
    }
  }
}