Skip to content

Update cy examples to use find* #462

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
May 11, 2020
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 11 additions & 11 deletions docs/dom-testing-library/api-queries.md
Original file line number Diff line number Diff line change
Expand Up @@ -245,7 +245,7 @@ const inputNode = screen.getByPlaceholderText('Username')
<!--Cypress-->

```js
cy.getByPlaceholderText('Username').should('exist')
cy.findByPlaceholderText('Username').should('exist')
```

<!--END_DOCUSAURUS_CODE_TABS-->
Expand Down Expand Up @@ -301,7 +301,7 @@ const aboutAnchorNode = screen.getByText(/about/i)
<!--Cypress-->

```js
cy.getByText(/about/i).should('exist')
cy.findByText(/about/i).should('exist')
```

<!--END_DOCUSAURUS_CODE_TABS-->
Expand Down Expand Up @@ -376,7 +376,7 @@ const incrediblesPosterImg = screen.getByAltText(/incredibles.*? poster/i)
<!--Cypress-->

```js
cy.getByAltText(/incredibles.*? poster/i).should('exist')
cy.findByAltText(/incredibles.*? poster/i).should('exist')
```

<!--END_DOCUSAURUS_CODE_TABS-->
Expand Down Expand Up @@ -432,8 +432,8 @@ const closeElement = screen.getByTitle('Close')
<!--Cypress-->

```js
cy.getByTitle('Delete').should('exist')
cy.getByTitle('Close').should('exist')
cy.findByTitle('Delete').should('exist')
cy.findByTitle('Close').should('exist')
```

<!--END_DOCUSAURUS_CODE_TABS-->
Expand Down Expand Up @@ -488,7 +488,7 @@ const lastNameInput = screen.getByDisplayValue('Norris')
<!--Cypress-->

```js
cy.getByDisplayValue('Norris').should('exist')
cy.findByDisplayValue('Norris').should('exist')
```

<!--END_DOCUSAURUS_CODE_TABS-->
Expand Down Expand Up @@ -525,7 +525,7 @@ const messageTextArea = screen.getByDisplayValue('Hello World')
<!--Cypress-->

```js
cy.getByDisplayValue('Hello World').should('exist')
cy.findByDisplayValue('Hello World').should('exist')
```

<!--END_DOCUSAURUS_CODE_TABS-->
Expand Down Expand Up @@ -566,7 +566,7 @@ const selectElement = screen.getByDisplayValue('Alaska')
<!--Cypress-->

```js
cy.getByDisplayValue('Alaska').should('exist')
cy.findByDisplayValue('Alaska').should('exist')
```

<!--END_DOCUSAURUS_CODE_TABS-->
Expand Down Expand Up @@ -641,7 +641,7 @@ assertions about the `Open dialog`-button you would need to use
The default value for `hidden` can [be configured](api-configuration#configuration).

Certain roles can have a selected state. You can filter the
returned elements that by their selected state
returned elements by their selected state
by setting `selected: true` or `selected: false`.

For example in
Expand Down Expand Up @@ -686,7 +686,7 @@ const dialogContainer = screen.getByRole('dialog')
<!--Cypress-->

```js
cy.getByRole('dialog').should('exist')
cy.findByRole('dialog').should('exist')
```

<!--END_DOCUSAURUS_CODE_TABS-->
Expand Down Expand Up @@ -735,7 +735,7 @@ const element = screen.getByTestId('custom-element')
<!--Cypress-->

```js
cy.getByTestId('custom-element').should('exist')
cy.findByTestId('custom-element').should('exist')
```

<!--END_DOCUSAURUS_CODE_TABS-->
Expand Down