Skip to content

Latest commit

 

History

History
 
 

cypress-gatsby

Folders and files

NameName
Last commit message
Last commit date

parent directory

..
 
 
 
 
 
 
 
 
 
 
 
 

cypress-gatsby

This package provies additional Cypress commands for use with testing Gatsby websites. To use these commands, import the plugin in cypress/support/index.js as follows:

import "cypress-gatsby/commands"

Once imported, the following additional commands are available:

  • cy.getTestElement(selector): Selects elements where the data-testid attribute matches the value of selector. Example:

    cy.getTestElement(`post`).click()
  • cy.waitForRouteChange(): Waits for Gatsby to finish the route change, in order to ensure event handlers are properly setup. Example:

    // after navigating to another page via a link
    cy.waitForRouteChange()
      .get(`#element-with-event-handler`)
      .click()