You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: packages/expect-puppeteer/README.md
+19-18Lines changed: 19 additions & 18 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -24,7 +24,7 @@ Modify your Jest configuration:
24
24
25
25
Writing integration test is very hard, especially when you are testing a Single Page Applications. Data are loaded asynchronously and it is difficult to know exactly when an element will be displayed in the page.
26
26
27
-
[Puppeteer API](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md) is great, but it is low level and not designed for integration testing.
27
+
[Puppeteer API](https://pptr.dev/api) is great, but it is low level and not designed for integration testing.
-`selector` <[string]|[MatchSelector](#MatchSelector)> A [selector] or a [MatchSelector](#MatchSelector) to match field
116
116
-`value` <[string]> Value to fill
117
117
-`options` <[Object]> Optional parameters
118
118
-`delay` <[number]> delay to pass to [the puppeteer `element.type` API](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#elementhandletypetext-options)
-`selector` <[string]|[MatchSelector](#MatchSelector)> A [selector] or a [MatchSelector](#MatchSelector) to match form
130
130
-`values` <[Object]> Values to fill
131
131
-`options` <[Object]> Optional parameters
132
132
-`delay` <[number]> delay to pass to [the puppeteer `element.type` API](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#elementhandletypetext-options)
-`matcher` <[string]|[RegExp]> A text or a RegExp to match in page
147
147
-`options` <[Object]> Optional parameters
148
148
-`polling` <[string]|[number]> An interval at which the `pageFunction` is executed, defaults to `raf`. If `polling` is a number, then it is treated as an interval in milliseconds at which the function would be executed. If `polling` is a string, then it can be one of the following values:
-`selector` <[string]|[MatchSelector](#MatchSelector)> A [selector] or a [MatchSelector](#MatchSelector) to match element
167
167
-`options` <[Object]> Optional parameters
168
168
-`polling` <[string]|[number]> An interval at which the `pageFunction` is executed, defaults to `raf`. If `polling` is a number, then it is treated as an interval in milliseconds at which the function would be executed. If `polling` is a string, then it can be one of the following values:
169
169
-`raf` - to constantly execute `pageFunction` in `requestAnimationFrame` callback. This is the tightest polling mode which is suitable to observe styling changes.
2. Install `@types/jest` (`jest-puppeteer` does not support `@jest/globals`) :
51
+
52
+
```bash
53
+
npm install --save-dev @types/jest
54
+
```
55
+
56
+
3. Import the `jest-puppeteer` module to expose the global API :
57
+
58
+
```ts
59
+
import"jest-puppeteer";
60
+
```
61
+
40
62
## API
41
63
42
64
### `global.browser`
43
65
44
-
Give access to the [Puppeteer Browser](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#class-browser).
66
+
Give access to the [Puppeteer Browser](https://pptr.dev/api/puppeteer.browser).
45
67
46
68
```js
47
69
it("should open a new page", async () => {
@@ -52,7 +74,7 @@ it("should open a new page", async () => {
52
74
53
75
### `global.page`
54
76
55
-
Give access to a [Puppeteer Page](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#class-page) opened at start (you will use it most of time).
77
+
Give access to a [Puppeteer Page](https://pptr.dev/api/puppeteer.page) opened at start (you will use it most of time).
56
78
57
79
```js
58
80
it("should fill an input", async () => {
@@ -62,7 +84,7 @@ it("should fill an input", async () => {
62
84
63
85
### `global.context`
64
86
65
-
Give access to a [browser context](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#class-browsercontext) that is instantiated when the browser is launched. You can control whether each test has its own isolated browser context using the `browserContext` option in config.
87
+
Give access to a [browser context](https://pptr.dev/api/puppeteer.browsercontext) that is instantiated when the browser is launched. You can control whether each test has its own isolated browser context using the `browserContext` option in config.
0 commit comments