Skip to content

Commit

Permalink
Add links (#2058)
Browse files Browse the repository at this point in the history
* add instrument-cra plugin link

* add another cy.within example

* Fix typo

* lowercase 'TR'


Co-authored-by: Jennifer Shehane <[email protected]>
  • Loading branch information
bahmutov and jennifer-shehane committed Sep 5, 2019
1 parent e910dbf commit 5cad54b
Show file tree
Hide file tree
Showing 2 changed files with 34 additions and 0 deletions.
5 changes: 5 additions & 0 deletions source/_data/plugins.yml
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,11 @@
link: https://github.com/cypress-io/code-coverage
keywords: [coverage]

- name: '@cypress/instrument-cra'
description: NPM module for create-react-app applications to instrument source code without ejecting react-scripts
link: https://github.com/cypress-io/instrument-cra
keywords: [coverage]

- name: 'npm-cy'
description: This GitHub Action for npm enables arbitrary actions with the npm command-line client, including testing with cypress.io and publishing to a registry.
link: https://github.com/bartlett705/npm-cy
Expand Down
29 changes: 29 additions & 0 deletions source/api/commands/within.md
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,9 @@ Option | Default | Description

```javascript
cy.get('form').within(($form) => {
// you have access to the found form via
// the jQuery object $form if you need it

// cy.get() will only search for elements within form,
// not within the entire document
cy.get('input[name="email"]').type('[email protected]')
Expand All @@ -68,6 +71,32 @@ cy.get('form').within(($form) => {
})
```

## Tables

### Find row with specific cell and confirm other cells in the row

```html
<table>
<tr>
<td>My first client</td>
<td>My first project</td>
<td>0</td>
<td>Active</td>
<td><button>Edit</button></td>
</tr>
</table>
```

```javascript
cy.contains('My first client').parent('tr').within(() => {
// all searches are automatically rooted to the found tr element
cy.get('td').eq(1).contains('My first project')
cy.get('td').eq(2).contains('0')
cy.get('td').eq(3).contains('Active')
cy.get('td').eq(4).contains('button', 'Edit').click()
})
```

# Rules

## Requirements {% helper_icon requirements %}
Expand Down

0 comments on commit 5cad54b

Please sign in to comment.