Skip to content

Commit 768df7d

Browse files
robinmetralLekoArts
authored andcommitted
docs(gatsby-cypress): update example to use findByText (#20267)
getByText has been deprecated in @testing-library/cypress and will throw an error
1 parent 3081675 commit 768df7d

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

Diff for: packages/gatsby-cypress/README.md

+2-2
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ Once imported, the following additional commands are available:
4141
cy.getTestElement("btn-to-test").click()
4242
```
4343

44-
> **NOTE:** It’s recommended not to use test IDs. Instead, consider using [`cypress-testing-library`](https://github.com/kentcdodds/cypress-testing-library) and relying on `getByText` instead.
44+
> **NOTE:** It’s recommended not to use test IDs. Instead, consider using [`cypress-testing-library`](https://github.com/testing-library/cypress-testing-library) and relying on `findByText` instead.
4545
4646
## Running Cypress tests in Gatsby
4747

@@ -72,7 +72,7 @@ context("Homepage", () => {
7272
})
7373

7474
it("has focusable buttons", () => {
75-
cy.getByText("click me").focus()
75+
cy.findByText("click me").focus()
7676
cy.focused().should("have.text", "click me")
7777
})
7878
})

0 commit comments

Comments
 (0)