@radhya/mach 2.6.11 → 2.7.0

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.
package/README.md CHANGED
@@ -67,7 +67,7 @@ mach build --platform web # Flutter projects
67
67
  | `mach audit` | Check project health, delivery impact, and security locally |
68
68
  | `mach agent` | Manage the local device discovery agent for Install Hub |
69
69
  | `mach host` | Set up S3 static hosting and CloudFront |
70
- | `mach web` | Deploy and manage static web releases through Mach Web Hosting |
70
+ | `mach web` | Deploy, test, and manage static web releases through Mach Web Hosting |
71
71
  | `mach sitemap` | Generate sitemap.xml from Expo Router app routes |
72
72
  | `mach deeplink` | Configure and verify universal links and Android App Links |
73
73
 
@@ -182,6 +182,64 @@ always point to Production for now:
182
182
  mach web domain add --domain www.customer.com
183
183
  ```
184
184
 
185
+ ## Local Playwright Web E2E Testing
186
+
187
+ `mach web test` runs Playwright from the current project on the developer's
188
+ machine or the project's existing CI runner. It creates a tenant-scoped
189
+ `Playwright · Web · Local` entry in Mach **Test Runs**, where it shares the
190
+ same history and detail screen as Maestro. It never starts a Mach browser
191
+ runner, creates a billable test run, uploads test source or artifacts, or sends
192
+ environment variables to Mach. Browser CPU time, reports, screenshots, traces,
193
+ and browser output stay local.
194
+
195
+ The first run automatically adds `@playwright/test` to the project using its
196
+ existing package manager and ensures local Chromium is available. That is a
197
+ one-time local dependency/browser download, not Mach infrastructure. Use a
198
+ different browser when needed:
199
+
200
+ ```bash
201
+ # Mach runs the project's Playwright configuration locally and records the
202
+ # safe status/timing outcome in the dashboard.
203
+ mach web test
204
+ mach web test --project chromium --trace on-first-retry
205
+ mach web test --base-url https://staging.example.com
206
+ mach web test --install-browser firefox
207
+ ```
208
+
209
+ `--base-url` sets `PLAYWRIGHT_BASE_URL`; use that variable in the project's
210
+ `playwright.config.ts`. For local applications, Playwright's own `webServer`
211
+ setting should start and wait for the project server. The first setup saves
212
+ `@playwright/test` in the project's development dependencies; commit that
213
+ package-manager lockfile. Later local and CI runs use the normal project
214
+ install, rather than adding the dependency again. Mach checks the Chromium
215
+ installation on each run, but Playwright skips the download when it is already
216
+ in its browser cache. On short-lived Linux CI runners, cache
217
+ `~/.cache/ms-playwright` to avoid the initial browser download for every fresh
218
+ worker. Use `--no-setup` only in a pre-provisioned CI image to prevent any
219
+ dependency or browser installation.
220
+
221
+ ### Keep CI web tests fast
222
+
223
+ - Commit `package.json` and the matching npm, pnpm, or Yarn lockfile after the
224
+ initial setup. Let the pipeline use its normal frozen dependency install;
225
+ never add Playwright during every job.
226
+ - Cache both the package-manager store and Playwright's browser directory. On
227
+ Linux runners the browser cache is `~/.cache/ms-playwright`; key both caches
228
+ from the dependency lockfile so a Playwright upgrade gets a compatible
229
+ browser automatically.
230
+ - Run one browser project for the fast validation path, for example
231
+ `mach web test --project chromium`. Use a separate scheduled or release
232
+ job for cross-browser coverage.
233
+ - Keep CI headless. Avoid `--headed`, `--ui`, and `--debug` in pipelines;
234
+ use `--trace on-first-retry` rather than recording traces for every passing
235
+ test.
236
+ - Match `--workers` to the runner capacity. Start with `--workers 2` on a
237
+ two-core runner and increase it only when tests remain stable. Use `--grep`
238
+ or explicit test files for a focused pull-request check, then keep the full
239
+ suite for the main branch or release gate.
240
+ - Keep `--no-setup` for a deliberately pre-built image. With normal caches,
241
+ the default setup check is fast and protects a newly provisioned runner.
242
+
185
243
  ## Managed Maestro Testing
186
244
 
187
245
  Mach's E2E testing layer is being implemented to run Maestro without requiring Maestro Cloud: