This sample demonstrates how to run Playwright tests using cloud-hosted browsers provided by Playwright Workspace.
-
Clone this repository and navigate to the sample
git clone https://github.com/Azure/playwright-workspaces.git cd playwright-workspaces/samples/playwright-tests -
Install dependencies
npm install
-
Create a Playwright Workspace
Follow the Getting Started guide to create your workspace. -
Set the Playwright Service endpoint
-
macOS / Linux:
export PLAYWRIGHT_SERVICE_URL="wss://<your-service-endpoint>"
-
Windows PowerShell:
$env:PLAYWRIGHT_SERVICE_URL = "wss://<your-service-endpoint>"
-
-
Authenticate with Azure
az login
-
Run the full test suite using the Playwright Workspaces configuration
npx playwright test --config=playwright.service.config.ts --workers=20💡 Adjust the
--workersvalue based on your system resources and workspace quota. Use--workers=1when debugging or running locally.To run a single test file:
npx playwright test tests/example.spec.ts --config=playwright.service.config.ts
If you run into issues, open an issue in this repository or refer to the Playwright Workspaces documentation.