Skip to content

Commit d861a33

Browse files
committed
heft-playwright-plugin
1 parent 505d12d commit d861a33

9 files changed

Lines changed: 600 additions & 0 deletions

File tree

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
# @rushstack/heft-playwright-plugin
2+
3+
This is a Heft plugin for running Playwright browser tests.
4+
5+
## Links
6+
7+
- [CHANGELOG.md](
8+
https://github.com/microsoft/rushstack/blob/main/heft-plugins/heft-playwright-plugin/CHANGELOG.md) - Find
9+
out what's new in the latest version
10+
- [@rushstack/heft](https://www.npmjs.com/package/@rushstack/heft) - Heft is a config-driven toolchain that invokes popular tools such as TypeScript, ESLint, Jest, Webpack, and API Extractor.
11+
12+
Heft is part of the [Rush Stack](https://rushstack.io/) family of projects.
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
{
2+
"$schema": "https://developer.microsoft.com/json-schemas/api-extractor/v7/api-extractor.schema.json",
3+
4+
"mainEntryPointFilePath": "<projectFolder>/lib-dts/index.d.ts",
5+
"apiReport": {
6+
"enabled": true,
7+
"reportFolder": "../../../common/reviews/api"
8+
},
9+
"docModel": {
10+
"enabled": false
11+
},
12+
"dtsRollup": {
13+
"enabled": true,
14+
"betaTrimmedFilePath": "<projectFolder>/dist/<unscopedPackageName>.d.ts"
15+
}
16+
}
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
{
2+
"$schema": "https://developer.microsoft.com/json-schemas/rig-package/rig.schema.json",
3+
"rigPackageName": "@rushstack/heft-node-rig"
4+
}
Lines changed: 137 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,137 @@
1+
{
2+
"$schema": "https://developer.microsoft.com/json-schemas/heft/v0/heft-plugin.schema.json",
3+
4+
"taskPlugins": [
5+
{
6+
"pluginName": "run-playwright-plugin",
7+
"entryPoint": "./lib/RunPlaywrightPlugin",
8+
"optionsSchema": "./lib/schemas/playwright.schema.json",
9+
"parameterScope": "playwright",
10+
"parameters": [
11+
{
12+
"longName": "--debug-mode",
13+
"parameterKind": "flag",
14+
"description": "Run Playwright in debug mode with a single worker and headed browser."
15+
},
16+
{
17+
"longName": "--headed",
18+
"parameterKind": "flag",
19+
"description": "Run tests in headed mode (show browser UI)."
20+
},
21+
{
22+
"longName": "--ui",
23+
"parameterKind": "flag",
24+
"description": "Run tests in UI mode."
25+
},
26+
{
27+
"longName": "--project",
28+
"parameterKind": "string",
29+
"argumentName": "PROJECT",
30+
"description": "Run tests only in the specified project (e.g., chromium, firefox, webkit)."
31+
},
32+
{
33+
"longName": "--config",
34+
"parameterKind": "string",
35+
"argumentName": "PATH",
36+
"description": "Path to Playwright configuration file."
37+
},
38+
{
39+
"longName": "--grep",
40+
"parameterKind": "string",
41+
"argumentName": "PATTERN",
42+
"description": "Run only tests matching the specified pattern."
43+
},
44+
{
45+
"longName": "--workers",
46+
"parameterKind": "string",
47+
"argumentName": "NUMBER",
48+
"description": "Number of parallel workers to use for running tests."
49+
},
50+
{
51+
"longName": "--list",
52+
"parameterKind": "flag",
53+
"description": "List all tests without running them."
54+
},
55+
{
56+
"longName": "--trace",
57+
"parameterKind": "flag",
58+
"description": "Record execution trace for each test."
59+
},
60+
{
61+
"longName": "--grep-invert",
62+
"parameterKind": "string",
63+
"argumentName": "PATTERN",
64+
"description": "Run only tests NOT matching the specified pattern."
65+
},
66+
{
67+
"longName": "--repeat-each",
68+
"parameterKind": "integer",
69+
"argumentName": "COUNT",
70+
"description": "Run each test N times."
71+
},
72+
{
73+
"longName": "--retries",
74+
"parameterKind": "integer",
75+
"argumentName": "COUNT",
76+
"description": "Maximum number of retry attempts per test."
77+
},
78+
{
79+
"longName": "--timeout",
80+
"parameterKind": "integer",
81+
"argumentName": "MILLISECONDS",
82+
"description": "Timeout for each test in milliseconds."
83+
},
84+
{
85+
"longName": "--ui-host",
86+
"parameterKind": "string",
87+
"argumentName": "HOST",
88+
"description": "Host to serve UI mode on (default: localhost)."
89+
},
90+
{
91+
"longName": "--ui-port",
92+
"parameterKind": "string",
93+
"argumentName": "PORT",
94+
"description": "Port to serve UI mode on (default: auto)."
95+
},
96+
{
97+
"longName": "--test-path",
98+
"parameterKind": "stringList",
99+
"argumentName": "PATH",
100+
"description": "Specify test file paths to run."
101+
},
102+
{
103+
"longName": "--install-browser",
104+
"parameterKind": "choiceList",
105+
"description": "Install the specified browser(s), but do not run the tests. The browser will be forcibly installed with dependencies.",
106+
"alternatives": [
107+
{
108+
"name": "chromium",
109+
"description": "The Chromium browser"
110+
},
111+
{
112+
"name": "firefox",
113+
"description": "The Mozilla Firefox browser"
114+
},
115+
{
116+
"name": "webkit",
117+
"description": "The WebKit browser"
118+
},
119+
{
120+
"name": "chrome",
121+
"description": "The Google Chrome browser"
122+
},
123+
{
124+
"name": "msedge",
125+
"description": "The Microsoft Edge browser"
126+
}
127+
]
128+
},
129+
{
130+
"parameterKind": "flag",
131+
"longName": "--install-browsers",
132+
"description": "Install all Playwright browsers (chromium, firefox, webkit, chrome, msedge), but do not run the tests."
133+
}
134+
]
135+
}
136+
]
137+
}
Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
{
2+
"name": "@rushstack/heft-playwright-plugin",
3+
"version": "0.0.0",
4+
"description": "Heft plugin for running Playwright browser tests",
5+
"repository": {
6+
"type": "git",
7+
"url": "https://github.com/microsoft/rushstack.git",
8+
"directory": "packages/heft-playwright-plugin"
9+
},
10+
"homepage": "https://rushstack.io/pages/heft/overview/",
11+
"main": "lib/index.js",
12+
"types": "dist/heft-playwright-plugin.d.ts",
13+
"license": "MIT",
14+
"scripts": {
15+
"build": "heft build --clean",
16+
"install-browsers": "node ./node_modules/playwright-core/cli.js install chromium firefox webkit chrome msedge --with-deps --force",
17+
"_phase:build": "heft run --only build -- --clean",
18+
"_phase:test": "heft run --only test -- --clean"
19+
},
20+
"exports": {
21+
".": {
22+
"import": "./lib/index.js",
23+
"types": "./dist/heft-playwright-plugin.d.ts"
24+
},
25+
"./lib/*": {
26+
"import": "./lib/*.js",
27+
"types": "./lib-dts/*.d.ts"
28+
},
29+
"./package.json": "./package.json"
30+
},
31+
"typesVersions": {
32+
"*": {
33+
"lib/*": [
34+
"lib-dts/*"
35+
]
36+
}
37+
},
38+
"peerDependencies": {
39+
"@rushstack/heft": "^0.75.0"
40+
},
41+
"dependencies": {
42+
"@rushstack/node-core-library": "workspace:*",
43+
"@rushstack/terminal": "workspace:*",
44+
"@playwright/test": "~1.56.1",
45+
"playwright-core": "~1.56.1"
46+
},
47+
"devDependencies": {
48+
"@rushstack/heft-node-rig": "workspace:*",
49+
"@rushstack/heft": "workspace:*",
50+
"@types/node": "20.17.19",
51+
"typescript": "~5.8.2"
52+
}
53+
}

0 commit comments

Comments
 (0)