Skip to content

Commit

Permalink
chore(readme): add note about matching outer element (#400)
Browse files Browse the repository at this point in the history
  • Loading branch information
UziTech authored Apr 22, 2021
1 parent 7f40bd7 commit a6a1c61
Showing 1 changed file with 20 additions and 2 deletions.
22 changes: 20 additions & 2 deletions packages/expect-puppeteer/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -52,13 +52,31 @@ This API is designed for integration testing:
// Does not work if button is not in page
await page.click('button')

// Will try while 500ms to click on "button"
// Will try for 500ms to click on "button"
await page.toClick('button')

// Will match a button with a "My button" text inside
// Will click the first button with a "My button" text inside
await page.toClick('button', { text: 'My button' })
```

The first element to match will be selected

**Example**

```html
<div class="outer">
<div class="inner">some text</div>
</div>
```

```js
// Will match outer div
await expect(page).toMatch('div', { text: 'some text' })

// Will match inner div
await expect(page).toMatch('div.inner', { text: 'some text' })
```

## API

##### Table of Contents
Expand Down

0 comments on commit a6a1c61

Please sign in to comment.