Skip to content

Latest commit

 

History

History
60 lines (37 loc) · 2.08 KB

File metadata and controls

60 lines (37 loc) · 2.08 KB

Run Playwright Java tests with Microsoft Playwright Testing (Experimental)

This sample demonstrates how to run Playwright Java tests at scale using Microsoft Playwright Testing. It showcases the benefits of accelerating test suite completion by leveraging more parallel cloud browsers.

Note - You won't be able to get the support for reporting and authentication to the service from the client running the tests via Entra ID.

If you have not yet created a workspace, please follow the Get Started guide

Sample setup

  1. Clone this sample:

    git clone https://github.com/microsoft/playwright-testing-service
    cd playwright-testing-service/samples/experimental/java
  2. Install dependencies:

    mvn install
  3. Set up Authentication using Access Tokens:

    Currently, only access tokens are supported for Java. See Set up authentication using access tokens

  4. Set access token generated above as environment variable for your project:

    PLAYWRIGHT_SERVICE_ACCESS_TOKEN= # Paste Access Token value from previous step
  5. Set up environment:

    In the Playwright portal, copy the command under Add region endpoint in your set up and set the following environment variable:

    PLAYWRIGHT_SERVICE_URL= # Paste region endpoint URL

Run tests

Run Playwright tests against browsers managed by the service using the configuration you created above. You can run up to 100 parallel workers with the service

mvn compile exec:java -D exec.mainClass="org.example.App"

Add more configuration

You can use the following environment variables to specify configuration parameters for the service:

  1. PLAYWRIGHT_SERVICE_RUN_ID: This variable allows you to change the ID of the test run. The run ID is a unique identifier for a test run and is used to track test runs in the portal.

    Example :

    export PLAYWRIGHT_SERVICE_RUN_ID = "my_custom_runId"