Skip to content
This repository was archived by the owner on Aug 6, 2025. It is now read-only.

Commit c478c29

Browse files
committed
docs: update README with Playwright information, usage, links etc.
1 parent 0fa0305 commit c478c29

File tree

1 file changed

+27
-23
lines changed

1 file changed

+27
-23
lines changed

README.md

Lines changed: 27 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -1,27 +1,29 @@
1-
# pptr-testing-library
1+
# playwright-testing-library
22

3-
[![NPM Package](https://badge.fury.io/js/pptr-testing-library.svg)](https://www.npmjs.com/package/pptr-testing-library)
4-
[![Build Status](https://travis-ci.org/testing-library/pptr-testing-library.svg?branch=master)](https://travis-ci.org/testing-library/pptr-testing-library)
5-
[![Coverage Status](https://coveralls.io/repos/github/testing-library/pptr-testing-library/badge.svg?branch=master)](https://coveralls.io/github/testing-library/pptr-testing-library?branch=master)
6-
[![Dependencies](https://david-dm.org/testing-library/pptr-testing-library.svg)](https://david-dm.org/testing-library/pptr-testing-library)
3+
[![NPM Package](https://badge.fury.io/js/playwright-testing-library.svg)](https://www.npmjs.com/package/playwright-testing-library)
4+
[![Build Status](https://travis-ci.org/hoverinc/playwright-testing-library.svg?branch=master)](https://travis-ci.org/hoverinc/playwright-testing-library)
5+
[![Coverage Status](https://coveralls.io/repos/github/hoverinc/playwright-testing-library/badge.svg?branch=master)](https://coveralls.io/github/hoverinc/playwright-testing-library?branch=master)
6+
[![Dependencies](https://david-dm.org/hoverinc/playwright-testing-library.svg)](https://david-dm.org/hoverinc/playwright-testing-library)
77

8-
[puppeteer](https://github.com/GoogleChrome/puppeteer) + [@testing-library/dom](https://github.com/testing-library/dom-testing-library) = 💖
8+
[playwright](https://github.com/microsoft/playwright) + [@testing-library/dom](https://github.com/testing-library/dom-testing-library) = 💖
99

10-
All your favorite user-centric querying functions from @testing-library/react & @testing-library/library available from Puppeteer!
10+
All your favorite user-centric querying functions from @testing-library/react & @testing-library/library available from Playwright!
11+
12+
> ⚠️ Note: this is a fork of [pptr-testing-library](https://github.com/testing-library/pptr-testing-library) modified to accomodate for some subtle API differences.
1113
1214
## Install
1315

14-
`npm install --save-dev pptr-testing-library`
16+
`npm install --save-dev playwright-testing-library`
1517

1618
## Use
1719

1820
```js
19-
const puppeteer = require('puppeteer')
20-
const {getDocument, queries, wait} = require('pptr-testing-library')
21+
const {webkit} = require('playwright') // or 'firefox' or 'chromium'
22+
const {getDocument, queries, wait} = require('playwright-testing-library')
2123

2224
const {getByTestId, getByLabelText} = queries
2325

24-
const browser = await puppeteer.launch()
26+
const browser = await webkit.launch()
2527
const page = await browser.newPage()
2628

2729
// Grab ElementHandle for document
@@ -30,19 +32,19 @@ const $document = await getDocument(page)
3032
const $form = await getByTestId($document, 'my-form')
3133
// returned elements are ElementHandles too!
3234
const $email = await getByLabelText($form, 'Email')
33-
// interact with puppeteer like usual
34-
await $email.type('pptr@example.com')
35+
// interact with playwright like usual
36+
await $email.type('playwright@example.com')
3537
// waiting works too!
3638
await wait(() => getByText($document, 'Loading...'))
3739
```
3840

39-
A little too un-puppeteer for you? We've got prototype-mucking covered too :)
41+
A little too un-playwright for you? We've got prototype-mucking covered too :)
4042

4143
```js
42-
const puppeteer = require('puppeteer')
43-
require('pptr-testing-library/extend')
44+
const {webkit} = require('playwright') // or 'firefox' or 'chromium'
45+
require('playwright-testing-library/extend')
4446

45-
const browser = await puppeteer.launch()
47+
const browser = await webkit.launch()
4648
const page = await browser.newPage()
4749

4850
// getDocument is added to prototype of Page
@@ -58,7 +60,7 @@ const {getByText} = $form.getQueriesForElement()
5860

5961
Unique methods, not part of `@testing-library/dom`
6062

61-
- `getDocument(page: puppeteer.Page): ElementHandle` - get an ElementHandle for the document
63+
- `getDocument(page: playwright.Page): ElementHandle` - get an ElementHandle for the document
6264
- `wait(conditionFn: () => {}): Promise<{}>` - wait for the condition to not throw (wrapper around `waitForExpect`)
6365

6466
---
@@ -95,17 +97,19 @@ Unique methods, not part of `@testing-library/dom`
9597

9698
## Known Limitations
9799

98-
- `waitForElement` method is not exposed. Puppeteer has its own set of wait utilities that somewhat conflict with the style used in `@testing-library/dom`. See [#3](https://github.com/testing-library/pptr-testing-library/issues/3).
99-
- `fireEvent` method is not exposed, use puppeteer's built-ins instead.
100+
- `waitForElement` method is not exposed. Playwright has its own set of wait utilities that somewhat conflict with the style used in `@testing-library/dom`. See [#3](https://github.com/testing-library/playwright-testing-library/issues/3).
101+
- `fireEvent` method is not exposed, use Playwright's built-ins instead.
100102
- `expect` assertion extensions are not available.
101103

102104
## Special Thanks
103105

104-
[@testing-library/dom](https://github.com/testing-library/dom-testing-library) of course!
106+
- [pptr-testing-library](https://github.com/testing-library/pptr-testing-library)
107+
- [@testing-library/dom](https://github.com/testing-library/dom-testing-library) of course!
105108

106-
## Related Puppeteer Test Utilities
109+
## Related Playwright Test Utilities
107110

108-
- [jest-puppeteer](https://github.com/smooth-code/jest-puppeteer)
111+
- [jest-playwright](https://github.com/playwright-community/jest-playwright)
112+
- [expect-playwright](https://github.com/playwright-community/expect-playwright)
109113
- Yours! Name TBD, PR welcome ;)
110114

111115
## LICENSE

0 commit comments

Comments
 (0)