@nsxbet/playwright-orchestrator 0.5.0 → 0.5.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. package/README.md +32 -2
  2. package/package.json +5 -3
package/README.md CHANGED
@@ -87,9 +87,28 @@ export default defineConfig({
87
87
 
88
88
  The reporter reads `ORCHESTRATOR_SHARD_FILE` env var to filter tests for the current shard.
89
89
 
90
+ ## Local Testing
91
+
92
+ Reproduce CI shard behavior locally:
93
+
94
+ ```bash
95
+ # 1. Generate test list (same as CI does)
96
+ npx playwright test --list --reporter=json --project="Mobile Chrome" > test-list.json
97
+
98
+ # 2. Get shard distribution and extract shard 1 (requires jq)
99
+ playwright-orchestrator assign --test-list test-list.json --shards 4 | jq '.shards."1"' > shard.json
100
+
101
+ # 3. Run tests for that shard
102
+ ORCHESTRATOR_SHARD_FILE=shard.json npx playwright test --project="Mobile Chrome"
103
+ ```
104
+
105
+ This is useful for debugging why a specific test runs (or doesn't run) in a particular shard.
106
+
90
107
  ## GitHub Actions (External Repositories)
91
108
 
92
- Use the orchestrator in your own repository. The recommended pattern runs orchestration **once** before matrix jobs:
109
+ Use the orchestrator in your own repository. The recommended pattern runs orchestration **once** before matrix jobs.
110
+
111
+ **Important**: Use `npx playwright test --list --reporter=json` to generate the test list. This ensures accurate discovery of parameterized tests (`test.each`) and avoids mismatches between discovered and actual tests.
93
112
 
94
113
  ```yaml
95
114
  jobs:
@@ -100,6 +119,14 @@ jobs:
100
119
  shard-files: ${{ steps.orchestrate.outputs.shard-files }}
101
120
  steps:
102
121
  - uses: actions/checkout@v4
122
+
123
+ - uses: actions/setup-node@v4
124
+ with:
125
+ node-version: 20
126
+ cache: npm
127
+
128
+ - run: npm ci
129
+
103
130
  - uses: NSXBet/playwright-orchestrator/.github/actions/setup-orchestrator@v0
104
131
 
105
132
  # YOU control cache location
@@ -109,11 +136,14 @@ jobs:
109
136
  key: playwright-timing-${{ github.ref_name }}
110
137
  restore-keys: playwright-timing-
111
138
 
139
+ # IMPORTANT: Generate test list with Playwright for accurate discovery
140
+ - run: npx playwright test --list --reporter=json > test-list.json
141
+
112
142
  # Action handles all orchestration logic
113
143
  - uses: NSXBet/playwright-orchestrator/.github/actions/orchestrate@v0
114
144
  id: orchestrate
115
145
  with:
116
- test-dir: ./e2e
146
+ test-list: test-list.json # Use pre-generated list (recommended)
117
147
  shards: 4
118
148
  timing-file: timing-data.json
119
149
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@nsxbet/playwright-orchestrator",
3
- "version": "0.5.0",
3
+ "version": "0.5.1",
4
4
  "description": "Intelligent Playwright test distribution across CI shards using historical timing data",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",
@@ -8,11 +8,13 @@
8
8
  "exports": {
9
9
  ".": {
10
10
  "types": "./dist/index.d.ts",
11
- "import": "./dist/index.js"
11
+ "import": "./dist/index.js",
12
+ "require": "./dist/index.js"
12
13
  },
13
14
  "./reporter": {
14
15
  "types": "./dist/reporter.d.ts",
15
- "import": "./dist/reporter.js"
16
+ "import": "./dist/reporter.js",
17
+ "require": "./dist/reporter.js"
16
18
  }
17
19
  },
18
20
  "bin": {