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: docs/config/extensions/playwright.mdx
+80-14Lines changed: 80 additions & 14 deletions
Original file line number
Diff line number
Diff line change
@@ -4,14 +4,18 @@ sidebarTitle: "playwright"
4
4
description: "Use the playwright build extension to use Playwright with Trigger.dev"
5
5
---
6
6
7
-
If you are using Playwright, you should use the Playwright build extension.
7
+
If you are using [Playwright](https://playwright.dev/), you should use the Playwright build extension.
8
8
9
9
- Automatically installs Playwright and required browser dependencies
10
10
- Allows you to specify which browsers to install (chromium, firefox, webkit)
11
11
- Supports headless or non-headless mode
12
12
- Lets you specify the Playwright version, or auto-detects it
13
13
- Installs only the dependencies needed for the selected browsers to optimize build time and image size
14
14
15
+
<Note>
16
+
This extension only affects the build and deploy process, not the `dev` command.
17
+
</Note>
18
+
15
19
You can use it for a simple Playwright setup like this:
16
20
17
21
```ts
@@ -29,18 +33,14 @@ export default defineConfig({
29
33
});
30
34
```
31
35
32
-
<Note>
33
-
This extension only affects the build and deploy process, not the `dev` command.
34
-
</Note>
35
-
36
36
### Options
37
37
38
38
-`browsers`: Array of browsers to install. Valid values: `"chromium"`, `"firefox"`, `"webkit"`. Default: `["chromium"]`.
39
39
-`headless`: Run browsers in headless mode. Default: `true`. If set to `false`, a virtual display (Xvfb) will be set up automatically.
40
40
-`version`: Playwright version to install. If not provided, the version will be auto-detected from your dependencies (recommended).
41
41
42
42
<Warning>
43
-
Using a different version in your app than specified here will break things.
43
+
Using a different version in your app than specified here will break things. We recommend not setting this option to automatically detect the version.
44
44
</Warning>
45
45
46
46
### Custom browsers and version
@@ -91,13 +91,79 @@ The extension sets the following environment variables during the build:
91
91
-`PLAYWRIGHT_SKIP_BROWSER_VALIDATION`: Set to `1` to skip browser validation at runtime
92
92
-`DISPLAY`: Set to `:99` if `headless: false` (for Xvfb)
93
93
94
-
### Notes
94
+
##Managing browser instances
95
95
96
-
- The extension installs only the dependencies required for the browsers you select, reducing build time and image size.
97
-
- Playwright is installed globally in the build image.
98
-
- The extension does not affect local development (`dev` command), only the build and deploy process.
99
-
- Only specify the Playwright version in the options if automatic detection is not working.
96
+
To prevent issues with waits and resumes, you can use middleware and locals to manage the browser instance. This will ensure the browser is available for the whole run, and is properly cleaned up on waits, resumes, and after the run completes.
100
97
101
-
<Note>
102
-
For more information about Playwright, see the [official Playwright documentation](https://playwright.dev/).
103
-
</Note>
98
+
Here's an example using `chromium`, but you can adapt it for other browsers:
0 commit comments