Skip to content

Commit 20714e1

Browse files
committed
add docs
1 parent 0f3e618 commit 20714e1

File tree

3 files changed

+105
-0
lines changed

3 files changed

+105
-0
lines changed

docs/config/extensions/overview.mdx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,7 @@ Trigger.dev provides a set of built-in extensions that you can use to customize
5050
| :-------------------------------------------------------------------- | :----------------------------------------------------------------------------- |
5151
| [prismaExtension](/config/extensions/prismaExtension) | Using prisma in your Trigger.dev tasks |
5252
| [pythonExtension](/config/extensions/pythonExtension) | Execute Python scripts in your project |
53+
| [playwright](/config/extensions/playwright) | Use Playwright in your Trigger.dev tasks |
5354
| [puppeteer](/config/extensions/puppeteer) | Use Puppeteer in your Trigger.dev tasks |
5455
| [ffmpeg](/config/extensions/ffmpeg) | Use FFmpeg in your Trigger.dev tasks |
5556
| [aptGet](/config/extensions/aptGet) | Install system packages in your build image |
Lines changed: 103 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,103 @@
1+
---
2+
title: "Playwright"
3+
sidebarTitle: "playwright"
4+
description: "Use the playwright build extension to use Playwright with Trigger.dev"
5+
---
6+
7+
If you are using Playwright, you should use the Playwright build extension.
8+
9+
- Automatically installs Playwright and required browser dependencies
10+
- Allows you to specify which browsers to install (chromium, firefox, webkit)
11+
- Supports headless or non-headless mode
12+
- Lets you specify the Playwright version, or auto-detects it
13+
- Installs only the dependencies needed for the selected browsers to optimize build time and image size
14+
15+
You can use it for a simple Playwright setup like this:
16+
17+
```ts
18+
import { defineConfig } from "@trigger.dev/sdk/v3";
19+
import { playwright } from "@trigger.dev/build/extensions/playwright";
20+
21+
export default defineConfig({
22+
project: "<project ref>",
23+
// Your other config settings...
24+
build: {
25+
extensions: [
26+
playwright(),
27+
],
28+
},
29+
});
30+
```
31+
32+
<Note>
33+
This extension only affects the build and deploy process, not the `dev` command.
34+
</Note>
35+
36+
### Options
37+
38+
- `browsers`: Array of browsers to install. Valid values: `"chromium"`, `"firefox"`, `"webkit"`. Default: `["chromium"]`.
39+
- `headless`: Run browsers in headless mode. Default: `true`. If set to `false`, a virtual display (Xvfb) will be set up automatically.
40+
- `version`: Playwright version to install. If not provided, the version will be auto-detected from your dependencies (recommended).
41+
42+
<Warning>
43+
Using a different version in your app than specified here will break things.
44+
</Warning>
45+
46+
### Custom browsers and version
47+
48+
```ts
49+
import { defineConfig } from "@trigger.dev/sdk/v3";
50+
import { playwright } from "@trigger.dev/build/extensions/playwright";
51+
52+
export default defineConfig({
53+
project: "<project ref>",
54+
build: {
55+
extensions: [
56+
playwright({
57+
browsers: ["chromium", "webkit"], // optional, will use ["chromium"] if not provided
58+
version: "1.43.1", // optional, will automatically detect the version if not provided
59+
}),
60+
],
61+
},
62+
});
63+
```
64+
65+
### Headless mode
66+
67+
By default, browsers are run in headless mode. If you need to run browsers with a UI (for example, for debugging), set `headless: false`. This will automatically set up a virtual display using Xvfb.
68+
69+
```ts
70+
import { defineConfig } from "@trigger.dev/sdk/v3";
71+
import { playwright } from "@trigger.dev/build/extensions/playwright";
72+
73+
export default defineConfig({
74+
project: "<project ref>",
75+
build: {
76+
extensions: [
77+
playwright({
78+
headless: false,
79+
}),
80+
],
81+
},
82+
});
83+
```
84+
85+
### Environment variables
86+
87+
The extension sets the following environment variables during the build:
88+
89+
- `PLAYWRIGHT_BROWSERS_PATH`: Set to `/ms-playwright` so Playwright finds the installed browsers
90+
- `PLAYWRIGHT_SKIP_BROWSER_DOWNLOAD`: Set to `1` to skip browser download at runtime
91+
- `PLAYWRIGHT_SKIP_BROWSER_VALIDATION`: Set to `1` to skip browser validation at runtime
92+
- `DISPLAY`: Set to `:99` if `headless: false` (for Xvfb)
93+
94+
### Notes
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.
100+
101+
<Note>
102+
For more information about Playwright, see the [official Playwright documentation](https://playwright.dev/).
103+
</Note>

docs/docs.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -73,6 +73,7 @@
7373
"pages": [
7474
"config/extensions/prismaExtension",
7575
"config/extensions/pythonExtension",
76+
"config/extensions/playwright",
7677
"config/extensions/puppeteer",
7778
"config/extensions/ffmpeg",
7879
"config/extensions/aptGet",

0 commit comments

Comments
 (0)