playwright-ci-caching_skill

This skill speeds up CI by caching Playwright browsers across Linux, macOS, and Windows, reducing download overhead and ensuring version-aligned caches.
  • Shell

643

GitHub Stars

1

Bundled Files

2 months ago

Catalog Refreshed

4 months ago

First Indexed

Readme & install

Copy the install command, review bundled files from the catalogue, and read any extended description pulled from the listing source.

Installation

Preview and clipboard use veilstrat where the catalogue uses aiagentskills.

npx veilstrat add skill aaronontheweb/dotnet-skills --skill playwright-ci-caching

  • SKILL.md6.7 KB

Overview

This skill caches Playwright browser binaries in CI/CD pipelines to eliminate the 1–2 minute download overhead on every build. It extracts the Playwright package version to build a cache key, stores platform-appropriate cache paths, and only installs browsers when the cache is missed. Works with GitHub Actions and Azure DevOps and includes a helper PowerShell script to discover and run the Playwright CLI.

How this skill works

The pipeline reads Microsoft.Playwright version from Directory.Packages.props and writes it to an environment variable. The cache step uses runner OS plus that version as the cache key and stores the OS-specific Playwright browser cache folders. A conditional install step runs the Playwright CLI only if the cache miss occurs. The version in the key ensures automatic invalidation when Playwright is upgraded.

When to use it

  • You run Playwright E2E tests in CI and want faster builds
  • Builds are slowed by recurring ~400MB browser downloads
  • You want automatic cache invalidation on Playwright upgrades
  • You use GitHub Actions or Azure DevOps pipelines
  • You can run PowerShell on CI agents

Best practices

  • Extract Playwright version from Directory.Packages.props to form the cache key
  • Include runner OS plus version in the key to avoid cross-OS conflicts
  • Cache all OS paths in multi-OS workflows to ensure hits on each runner
  • Run dotnet restore/build before attempting to find Microsoft.Playwright.dll
  • Only run playwright install when cache-hit is false to skip redundant downloads

Example use cases

  • GitHub Actions workflow that caches ~/.cache/ms-playwright with key ${{ runner.os }}-playwright-${{ env.PlaywrightVersion }}
  • Multi-OS GitHub workflow listing Linux, macOS, and Windows cache paths for a shared cache step
  • Azure DevOps pipeline using Cache@2 with key 'playwright | $(Agent.OS) | $(PlaywrightVersion)'
  • Using build/playwright.ps1 to discover Microsoft.Playwright.dll and invoke the Playwright CLI after dotnet build
  • Faster PR feedback loops by avoiding network-bound browser downloads

FAQ

Verify the Playwright version extraction step writes the correct value and that the cache path matches the runner OS. Confirm the key format includes runner OS and PlaywrightVersion.

Why include the Playwright version in the key?

Including the version forces automatic cache invalidation after upgrades so cached binaries always match the SDK and avoid runtime mismatches.

Built by
VeilStrat
AI signals for GTM teams
© 2026 VeilStrat. All rights reserved.All systems operational