Microsoft Playwright Testing is a fully managed service that uses the cloud to enable you to run Playwright tests with much higher parallelization across different operating system-browser combinations simultaneously. Along with this, it enables you to publish test results and artifacts collected by Playwright to the service. This means faster test runs with broader scenario coverage, which helps speed up delivery of features without sacrificing quality.
Ready to get started? Jump into our quickstart guide!
playwright-testing.mov
- Quickstart: Run end-to-end tests at scale
- Quickstart: Set up continuous end-to-end testing across different browsers and operating systems
- Explore features and benefits
- Documentation
- Pricing
- Share feedback
Follow these steps to run your existing Playwright test suite with the service.
- An Azure account with an active subscription. If you don't have an Azure subscription, create a free account before you begin.
- Your Azure account must be assigned the Owner, Contributor, or one of the classic administrator roles.
- A Playwright project. If you don't have one, you can clone this repository and navigate to samples/get-started.
- Azure CLI. If you don't have Azure CLI, see Install Azure CLI
-
Sign in to the Playwright portal with your Azure account.
-
Create the Workspace.
Field Description Workspace Name A unique name to identify your workspace.
The name can't contain special characters or whitespace.Azure Subscription Select an Azure subscription where you want to create the workspace. Region This is where test run data will be stored for your workspace.
Note
If you don't see this screen, select an existing workspace and go to the next section.
To use the service, install Microsoft Playwright Testing package.
npm init @azure/microsoft-playwright-testing
This generates playwright.service.config.ts
file which serves to:
- Direct and authenticate Playwright to the Microsoft Playwright Testing service.
- Adds a reporter to publish test results and artifacts.
If you already have this file, the package asks you to override it.
Note
Make sure your project uses @playwright/test version 1.47 or above.
-
In the Playwright portal, copy the command under Add region endpoint in your set up.
The endpoint URL corresponds to the workspace region. You might see a different endpoint URL in the Playwright portal, depending on the region you selected when creating the workspace.
Note
The region end point could be updated. Make sure you copy the latest value from Playwright portal .
Ensure that the PLAYWRIGHT_SERVICE_URL
that you obtained in previous step is available in your environment.
We recommend using dotenv
module to manage your environment. With dotenv
you'll be using the .env
file to define your environment variables.
Important
Don't forget to add .env
file to your .gitignore
file in order to not leak your secrets.
npm i --save-dev dotenv
.env
file
PLAYWRIGHT_SERVICE_URL={MY-REGION-ENDPOINT}
Make sure to replace the {MY-REGION-ENDPOINT}
text placeholder with the value you copied earlier.
To run your Playwright tests in your Microsoft Playwright Testing workspace, you need to authenticate the Playwright client where you are running the tests with the service. This could be your local dev machine or CI machine.
The service offers two authentication methods: Microsoft Entra ID and Access Tokens.
Microsoft Entra ID uses your Azure credentials, requiring a sign-in to your Azure account for secure access. Alternatively, you can generate an access token from your Playwright workspace and use it in your setup.
You can follow any one of the authentication methods below:
We strongly recommend using Microsoft Entra ID for authentication to the service.
Microsoft Entra ID is the default and recommended authentication for the service. From your local dev machine, you can use Azure CLI to sign-in
az login
NOTE: If you are a part of multiple Microsoft Entra tenants, make sure you sign-in to the tenant where your workspace belongs. You can get the tenant id from Azure portal, see Find your Microsoft Entra Tenant. Once you get the ID, sign-in using the command az login --tenant <TenantID>
You can generate an access token from your Playwright Testing workspace and use it in your setup. However, we strongly recommend Microsoft Entra ID for authentication due to its enhanced security. Access tokens, while convenient, function like long-lived passwords and are more susceptible to being compromised.
-
Authentication using access tokens is disabled by default. To enable, see Enable access-token based authentication
We strongly recommend using Microsoft Entra ID for authentication to the service. If you are using access tokens, see How to Manage Access Tokens
Run Playwright tests against browsers managed by the service using the configuration you created above.
npx playwright test --config=playwright.service.config.ts --workers=20
-
Run tests in a CI/CD pipeline.
-
Learn how to manage access to the created workspace.
-
Experiment with different number of workers to determine the optimal configuration of your test suite.
This project welcomes contributions and suggestions. Most contributions require you to agree to a Contributor License Agreement (CLA) declaring that you have the right to, and actually do, grant us the rights to use your contribution. For details, visit https://cla.opensource.microsoft.com.
When you submit a pull request, a CLA bot will automatically determine whether you need to provide a CLA and decorate the PR appropriately (e.g., status check, comment). Simply follow the instructions provided by the bot. You will only need to do this once across all repos using our CLA.
This project has adopted the Microsoft Open Source Code of Conduct. For more information see the Code of Conduct FAQ or contact [email protected] with any additional questions or comments.
This project may contain trademarks or logos for projects, products, or services. Authorized use of Microsoft trademarks or logos is subject to and must follow Microsoft's Trademark & Brand Guidelines. Use of Microsoft trademarks or logos in modified versions of this project must not cause confusion or imply Microsoft sponsorship. Any use of third-party trademarks or logos is subject to those third-party's policies.