Skip to content

Commit 2d3ab38

Browse files
renovate[bot]renovate-botcalebeby
authored
[Requires manual changes] Update dependency puppeteer to v12 (#322)
Co-authored-by: Renovate Bot <bot@renovateapp.com> Co-authored-by: Caleb Eby <caleb.eby01@gmail.com>
1 parent 2518999 commit 2d3ab38

4 files changed

Lines changed: 32 additions & 32 deletions

File tree

.changeset/eighty-carrots-tap.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,4 +2,4 @@
22
'pleasantest': minor
33
---
44

5-
Update puppeteer to v11.0.0
5+
Update puppeteer to v12.0.1

README.md

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -184,7 +184,7 @@ test(
184184
);
185185
```
186186

187-
Sometimes, you may want to traverse the DOM tree to find parent, sibling, or descendant elements. Pleasantest communicates asynchronously with the browser, so you do not have synchronous access to the DOM tree. You can use [`ElementHandle.evaluate`](https://pptr.dev/#?product=Puppeteer&version=v11.0.0&show=api-elementhandleevaluatepagefunction-args) to run code in the browser using an `ElementHandle` returned from a query:
187+
Sometimes, you may want to traverse the DOM tree to find parent, sibling, or descendant elements. Pleasantest communicates asynchronously with the browser, so you do not have synchronous access to the DOM tree. You can use [`ElementHandle.evaluate`](https://pptr.dev/#?product=Puppeteer&version=v12.0.1&show=api-elementhandleevaluatepagefunction-args) to run code in the browser using an `ElementHandle` returned from a query:
188188

189189
```js
190190
import { withBrowser } from 'pleasantest';
@@ -226,7 +226,7 @@ test(
226226

227227
You can use the [User API](#user-api-pleasantestuser) to perform actions in the browser.
228228

229-
If the User API is missing a method that you need, you can instead use [methods on `ElementHandle`s directly](https://pptr.dev/#?product=Puppeteer&version=v11.0.0&show=api-class-elementhandle)
229+
If the User API is missing a method that you need, you can instead use [methods on `ElementHandle`s directly](https://pptr.dev/#?product=Puppeteer&version=v12.0.1&show=api-class-elementhandle)
230230

231231
```js
232232
test(
@@ -355,7 +355,7 @@ Call Signatures:
355355
`WithBrowserOpts` (all properties are optional):
356356

357357
- `headless`: `boolean`, default `true`: Whether to open a headless (not visible) browser. If you use the `withBrowser.headed` chain, that will override the value of `headless`.
358-
- `device`: Device Object [described here](https://pptr.dev/#?product=Puppeteer&version=v11.0.0&show=api-pageemulateoptions).
358+
- `device`: Device Object [described here](https://pptr.dev/#?product=Puppeteer&version=v12.0.1&show=api-pageemulateoptions).
359359
- `moduleServer`: Module Server options object (all properties are optional). They will be applied to files imported through [`utils.runJS`](#pleasantestutilsrunjscode-string-promisevoid) or [`utils.loadJS`](#pleasantestutilsloadjsjspath-string-promisevoid).
360360
- `plugins`: Array of Rollup, Vite, or WMR plugins to add.
361361
- `envVars`: Object with string keys and string values for environment variables to pass in as `import.meta.env.*` / `process.env.*`
@@ -410,7 +410,7 @@ The `devices` import from `pleasantest` is re-exported from Puppeteer, [here is
410410

411411
#### `PleasantestContext.screen`
412412

413-
The `PleasantestContext` object exposes the [`screen`](https://testing-library.com/docs/queries/about/#screen) property, which is an [object with Testing Library queries pre-bound to the document](https://testing-library.com/docs/queries/about/#screen). All of the [Testing Library queries](https://testing-library.com/docs/queries/about#overview) are available. These are used to find elements in the DOM for use in your tests. There is one difference in how you use the queries in Pleasantest compared to Testing Library: in Pleasantest, all queries must be `await`ed to handle the time it takes to communicate with the browser. In addition, since your tests are running in Node, the queries return Promises that resolve to [`ElementHandle`](https://pptr.dev/#?product=Puppeteer&version=v11.0.0&show=api-class-elementhandle)'s from Puppeteer.
413+
The `PleasantestContext` object exposes the [`screen`](https://testing-library.com/docs/queries/about/#screen) property, which is an [object with Testing Library queries pre-bound to the document](https://testing-library.com/docs/queries/about/#screen). All of the [Testing Library queries](https://testing-library.com/docs/queries/about#overview) are available. These are used to find elements in the DOM for use in your tests. There is one difference in how you use the queries in Pleasantest compared to Testing Library: in Pleasantest, all queries must be `await`ed to handle the time it takes to communicate with the browser. In addition, since your tests are running in Node, the queries return Promises that resolve to [`ElementHandle`](https://pptr.dev/#?product=Puppeteer&version=v12.0.1&show=api-class-elementhandle)'s from Puppeteer.
414414

415415
List of queries attached to screen object:
416416

@@ -461,7 +461,7 @@ test(
461461

462462
#### `PleasantestContext.page`
463463

464-
The `PleasantestContext` object exposes the `page` property, which is an instance of Puppeteer's [`Page` class](https://pptr.dev/#?product=Puppeteer&version=v11.0.0&show=api-class-page). This will most often be used for navigation ([`page.goto`](https://pptr.dev/#?product=Puppeteer&version=v11.0.0&show=api-pagegotourl-options)), but you can do anything with it that you can do with puppeteer.
464+
The `PleasantestContext` object exposes the `page` property, which is an instance of Puppeteer's [`Page` class](https://pptr.dev/#?product=Puppeteer&version=v12.0.1&show=api-class-page). This will most often be used for navigation ([`page.goto`](https://pptr.dev/#?product=Puppeteer&version=v12.0.1&show=api-pagegotourl-options)), but you can do anything with it that you can do with puppeteer.
465465

466466
```js
467467
import { withBrowser } from 'pleasantest';
@@ -494,7 +494,7 @@ The user API allows you to perform actions on behalf of the user. If you have us
494494

495495
#### `PleasantestUser.click(element: ElementHandle, options?: { force?: boolean }): Promise<void>`
496496

497-
Clicks an element, if the element is visible and the center of it is not covered by another element. If the center of the element is covered by another element, an error is thrown. This is a thin wrapper around Puppeteer's [`ElementHandle.click` method](https://pptr.dev/#?product=Puppeteer&version=v11.0.0&show=api-elementhandleclickoptions). The difference is that `PleasantestUser.click` checks that the target element is an element that actually can be clicked before clicking it!
497+
Clicks an element, if the element is visible and the center of it is not covered by another element. If the center of the element is covered by another element, an error is thrown. This is a thin wrapper around Puppeteer's [`ElementHandle.click` method](https://pptr.dev/#?product=Puppeteer&version=v12.0.1&show=api-elementhandleclickoptions). The difference is that `PleasantestUser.click` checks that the target element is an element that actually can be clicked before clicking it!
498498

499499
**Actionability checks**: It refuses to click elements that are not [**attached**](#attached) or not [**visible**](#visible). You can override the visibility check by passing `{ force: true }`.
500500

@@ -523,7 +523,7 @@ The `delay` option controls the amount of time (ms) between keypresses (defaults
523523

524524
**Actionability checks**: It refuses to type into elements that are not [**attached**](#attached) or not [**visible**](#visible). You can override the visibility check by passing `{ force: true }`.
525525

526-
In the text, you can pass special commands using curly brackets to trigger special keypresses, similar to [user-event](https://github.com/testing-library/user-event#special-characters) and [Cypress](https://docs.cypress.io/api/commands/type.html#Arguments). Open an issue if you want more commands available here! Note: If you want to simulate individual keypresses independent from a text field, you can use Puppeteer's [page.keyboard API](https://pptr.dev/#?product=Puppeteer&version=v11.0.0&show=api-pagekeyboard)
526+
In the text, you can pass special commands using curly brackets to trigger special keypresses, similar to [user-event](https://github.com/testing-library/user-event#special-characters) and [Cypress](https://docs.cypress.io/api/commands/type.html#Arguments). Open an issue if you want more commands available here! Note: If you want to simulate individual keypresses independent from a text field, you can use Puppeteer's [page.keyboard API](https://pptr.dev/#?product=Puppeteer&version=v12.0.1&show=api-pagekeyboard)
527527

528528
| Text string | Key | Notes |
529529
| -------------- | ---------- | --------------------------------------------------------------------------------------- |
@@ -571,7 +571,7 @@ test(
571571

572572
#### `PleasantestUser.selectOptions(element: ElementHandle, values: ElementHandle | ElementHandle[] | string[] | string, options?: { force?: boolean }): Promise<void>`
573573

574-
Selects the specified option(s) of a `<select>` or a `<select multiple>` element. Values can be passed as either strings (option values) or as [`ElementHandle`](https://pptr.dev/#?product=Puppeteer&version=v11.0.0&show=api-class-elementhandle) references to elements.
574+
Selects the specified option(s) of a `<select>` or a `<select multiple>` element. Values can be passed as either strings (option values) or as [`ElementHandle`](https://pptr.dev/#?product=Puppeteer&version=v12.0.1&show=api-class-elementhandle) references to elements.
575575

576576
**Actionability checks**: It refuses to select in elements that are not [**attached**](#attached) or not [**visible**](#visible). You can override the visibility check by passing `{ force: true }`.
577577

@@ -621,7 +621,7 @@ test(
621621
);
622622
```
623623

624-
To pass variables from the test environment into the browser, you can pass them as the 2nd parameter. Note that they must either be JSON-serializable or they can be a [`JSHandle`](https://pptr.dev/#?product=Puppeteer&version=v11.0.0&show=api-class-jshandle) or an [`ElementHandle`](https://pptr.dev/#?product=Puppeteer&version=v11.0.0&show=api-class-elementhandle). The arguments can be received in the browser as parameters to a default-exported function:
624+
To pass variables from the test environment into the browser, you can pass them as the 2nd parameter. Note that they must either be JSON-serializable or they can be a [`JSHandle`](https://pptr.dev/#?product=Puppeteer&version=v12.0.1&show=api-class-jshandle) or an [`ElementHandle`](https://pptr.dev/#?product=Puppeteer&version=v12.0.1&show=api-class-elementhandle). The arguments can be received in the browser as parameters to a default-exported function:
625625

626626
```js
627627
import { withBrowser } from 'pleasantest';
@@ -738,11 +738,11 @@ test(
738738

739739
Pleasantest uses [Puppeteer](https://github.com/puppeteer/puppeteer) under the hood. You don't need to know how to use Puppeteer in order to use Pleasantest, but a little bit of Puppeteer knowledge might come in handy. Here are the parts of Puppeteer that are most helpful and relevant for Pleasantest:
740740

741-
### [`ElementHandle`](https://pptr.dev/#?product=Puppeteer&version=v11.0.0&show=api-class-elementhandle)
741+
### [`ElementHandle`](https://pptr.dev/#?product=Puppeteer&version=v12.0.1&show=api-class-elementhandle)
742742

743743
An `ElementHandle` is a reference to a DOM element in the browser. When you use one of the [Testing Library queries](#pleasantestcontextscreen) to find elements, the queries return promises that resolve to `ElementHandle`s.
744744

745-
You can use the [`.evaluate`](https://pptr.dev/#?product=Puppeteer&version=v11.0.0&show=api-elementhandleevaluatepagefunction-args) method to execute code in the browser, using a reference to the actual `Element` instance that the `ElementHandle` points to. For example, if you want to get the [`innerText`](https://developer.mozilla.org/en-US/docs/Web/API/HTMLElement/innerText) of an element:
745+
You can use the [`.evaluate`](https://pptr.dev/#?product=Puppeteer&version=v12.0.1&show=api-elementhandleevaluatepagefunction-args) method to execute code in the browser, using a reference to the actual `Element` instance that the `ElementHandle` points to. For example, if you want to get the [`innerText`](https://developer.mozilla.org/en-US/docs/Web/API/HTMLElement/innerText) of an element:
746746

747747
```js
748748
import { withBrowser } from 'pleasantest';
@@ -762,7 +762,7 @@ test(
762762
);
763763
```
764764

765-
Sometimes, you may want to return another `ElementHandle` from the browser callback, or some other value that can't be serialized in order to be transferred from the browser to Node. To do this, you can use the [`.evaluateHandle`](https://pptr.dev/#?product=Puppeteer&version=v11.0.0&show=api-elementhandleevaluatehandlepagefunction-args) method. In this example, we want to get a reference to the parent of an element.
765+
Sometimes, you may want to return another `ElementHandle` from the browser callback, or some other value that can't be serialized in order to be transferred from the browser to Node. To do this, you can use the [`.evaluateHandle`](https://pptr.dev/#?product=Puppeteer&version=v12.0.1&show=api-elementhandleevaluatehandlepagefunction-args) method. In this example, we want to get a reference to the parent of an element.
766766

767767
```js
768768
import { withBrowser } from 'pleasantest';
@@ -780,13 +780,13 @@ test(
780780
);
781781
```
782782

783-
### [`Page`](https://pptr.dev/#?product=Puppeteer&version=v11.0.0&show=api-class-page)
783+
### [`Page`](https://pptr.dev/#?product=Puppeteer&version=v12.0.1&show=api-class-page)
784784

785785
The page object is one of the properties that is passed into the test callback by [`withBrowser`](#withbrowser). You can use `.evaluate` and `.evaluateHandle` on `Page`, and those methods work the same as on `ElementHandle`.
786786

787787
Here are some useful methods that are exposed through `Page`:
788788

789-
[`page.cookies`](https://pptr.dev/#?product=Puppeteer&version=v11.0.0&show=api-pagecookiesurls), [`page.emulateMediaFeatures`](https://pptr.dev/#?product=Puppeteer&version=v11.0.0&show=api-pageemulatemediafeaturesfeatures), [`page.emulateNetworkConditions`](https://pptr.dev/#?product=Puppeteer&version=v11.0.0&show=api-pageemulatenetworkconditionsnetworkconditions), [`page.evaluate`](https://pptr.dev/#?product=Puppeteer&version=v11.0.0&show=api-pageevaluatepagefunction-args), [`page.evaluateHandle`](https://pptr.dev/#?product=Puppeteer&version=v11.0.0&show=api-pageevaluatehandlepagefunction-args), [`page.exposeFunction`](https://pptr.dev/#?product=Puppeteer&version=v11.0.0&show=api-pageexposefunctionname-puppeteerfunction), [`page.goBack`](https://pptr.dev/#?product=Puppeteer&version=v11.0.0&show=api-pagegobackoptions), [`page.goForward`](https://pptr.dev/#?product=Puppeteer&version=v11.0.0&show=api-pagegoforwardoptions), [`page.goto`](https://pptr.dev/#?product=Puppeteer&version=v11.0.0&show=api-pagegotourl-options), [`page.metrics`](https://pptr.dev/#?product=Puppeteer&version=v11.0.0&show=api-pagemetrics), [`page.reload`](https://pptr.dev/#?product=Puppeteer&version=v11.0.0&show=api-pagereloadoptions), [`page.screenshot`](https://pptr.dev/#?product=Puppeteer&version=v11.0.0&show=api-pagescreenshotoptions), [`page.setGeolocation`](https://pptr.dev/#?product=Puppeteer&version=v11.0.0&show=api-pagesetgeolocationoptions), [`page.setOfflineMode`](https://pptr.dev/#?product=Puppeteer&version=v11.0.0&show=api-pagesetofflinemodeenabled), [`page.setRequestInterception`](https://pptr.dev/#?product=Puppeteer&version=v11.0.0&show=api-pagesetrequestinterceptionvalue-cachesafe), [`page.title`](https://pptr.dev/#?product=Puppeteer&version=v11.0.0&show=api-pagetitle), [`page.url`](https://pptr.dev/#?product=Puppeteer&version=v11.0.0&show=api-pageurl), [`page.waitForNavigation`](https://pptr.dev/#?product=Puppeteer&version=v11.0.0&show=api-pagewaitfornavigationoptions), [`page.browserContext().overridePermissions`](https://pptr.dev/#?product=Puppeteer&version=v11.0.0&show=api-browsercontextoverridepermissionsorigin-permissions), [`page.keyboard.press`](https://pptr.dev/#?product=Puppeteer&version=v11.0.0&show=api-keyboardpresskey-options), [`page.mouse.move`](https://pptr.dev/#?product=Puppeteer&version=v11.0.0&show=api-mousemovex-y-options), [`page.mouse.click`](https://pptr.dev/#?product=Puppeteer&version=v11.0.0&show=api-mouseclickx-y-options), [`page.touchscreen.tap`](https://pptr.dev/#?product=Puppeteer&version=v11.0.0&show=api-touchscreentapx-y)
789+
[`page.cookies`](https://pptr.dev/#?product=Puppeteer&version=v12.0.1&show=api-pagecookiesurls), [`page.emulateMediaFeatures`](https://pptr.dev/#?product=Puppeteer&version=v12.0.1&show=api-pageemulatemediafeaturesfeatures), [`page.emulateNetworkConditions`](https://pptr.dev/#?product=Puppeteer&version=v12.0.1&show=api-pageemulatenetworkconditionsnetworkconditions), [`page.evaluate`](https://pptr.dev/#?product=Puppeteer&version=v12.0.1&show=api-pageevaluatepagefunction-args), [`page.evaluateHandle`](https://pptr.dev/#?product=Puppeteer&version=v12.0.1&show=api-pageevaluatehandlepagefunction-args), [`page.exposeFunction`](https://pptr.dev/#?product=Puppeteer&version=v12.0.1&show=api-pageexposefunctionname-puppeteerfunction), [`page.goBack`](https://pptr.dev/#?product=Puppeteer&version=v12.0.1&show=api-pagegobackoptions), [`page.goForward`](https://pptr.dev/#?product=Puppeteer&version=v12.0.1&show=api-pagegoforwardoptions), [`page.goto`](https://pptr.dev/#?product=Puppeteer&version=v12.0.1&show=api-pagegotourl-options), [`page.metrics`](https://pptr.dev/#?product=Puppeteer&version=v12.0.1&show=api-pagemetrics), [`page.reload`](https://pptr.dev/#?product=Puppeteer&version=v12.0.1&show=api-pagereloadoptions), [`page.screenshot`](https://pptr.dev/#?product=Puppeteer&version=v12.0.1&show=api-pagescreenshotoptions), [`page.setGeolocation`](https://pptr.dev/#?product=Puppeteer&version=v12.0.1&show=api-pagesetgeolocationoptions), [`page.setOfflineMode`](https://pptr.dev/#?product=Puppeteer&version=v12.0.1&show=api-pagesetofflinemodeenabled), [`page.setRequestInterception`](https://pptr.dev/#?product=Puppeteer&version=v12.0.1&show=api-pagesetrequestinterceptionvalue-cachesafe), [`page.title`](https://pptr.dev/#?product=Puppeteer&version=v12.0.1&show=api-pagetitle), [`page.url`](https://pptr.dev/#?product=Puppeteer&version=v12.0.1&show=api-pageurl), [`page.waitForNavigation`](https://pptr.dev/#?product=Puppeteer&version=v12.0.1&show=api-pagewaitfornavigationoptions), [`page.browserContext().overridePermissions`](https://pptr.dev/#?product=Puppeteer&version=v12.0.1&show=api-browsercontextoverridepermissionsorigin-permissions), [`page.keyboard.press`](https://pptr.dev/#?product=Puppeteer&version=v12.0.1&show=api-keyboardpresskey-options), [`page.mouse.move`](https://pptr.dev/#?product=Puppeteer&version=v12.0.1&show=api-mousemovex-y-options), [`page.mouse.click`](https://pptr.dev/#?product=Puppeteer&version=v12.0.1&show=api-mouseclickx-y-options), [`page.touchscreen.tap`](https://pptr.dev/#?product=Puppeteer&version=v12.0.1&show=api-touchscreentapx-y)
790790

791791
## Comparisons with other testing tools
792792

@@ -812,7 +812,7 @@ Jest uses [jsdom](https://github.com/jsdom/jsdom) and exposes browser-like globa
812812

813813
### [pptr-testing-library](https://github.com/testing-library/pptr-testing-library) + Jest
814814

815-
`pptr-testing-library` makes versions of the [Testing Library](https://testing-library.com) queries that work with Puppeteer's [ElementHandle](https://pptr.dev/#?product=Puppeteer&version=v11.0.0&show=api-class-elementhandle)s, similarly to how Pleasantest does.
815+
`pptr-testing-library` makes versions of the [Testing Library](https://testing-library.com) queries that work with Puppeteer's [ElementHandle](https://pptr.dev/#?product=Puppeteer&version=v12.0.1&show=api-class-elementhandle)s, similarly to how Pleasantest does.
816816

817817
- It does not make the [jest-dom](https://github.com/testing-library/jest-dom) assertions work with Puppeteer ElementHandles.
818818
- It does not manage the browser for you. You must manually set up and tear down the browser.

0 commit comments

Comments
 (0)