Connect your Playwright workflow

With the Playwright integration you can start your Playwright tests (opens in new tab) from a Tosca Cloud test case. A GitHub Actions workflow (opens in new tab) runs the tests and sends the results to Tosca Cloud. This way, you check the Playwright results on the Test runs page, next to your Tosca Cloud test results.

This topic explains how to authenticate your workflow, configure it, and protect sensitive data.

Playwright and GitHub Actions are third-party products that we don't control. We don't take responsibility for them, and we can't guarantee their availability or performance. Before you use them, check that they meet your security requirements.

Before you start

Make sure you have the following:

Authenticate your workflow with Tosca Cloud

Your workflow needs the following secrets and variables to authenticate with Tosca Cloud and send the results to the right workspace. Add them to your GitHub repository as repository secrets (opens in new tab) and repository variables (opens in new tab):

Name

Type

Value

TOSCA_CLOUD_CLIENT_ID

Secret

Your client ID for the application Tricentis Cloud API.

TOSCA_CLOUD_CLIENT_SECRET

Secret

Your client secret for the application Tricentis Cloud API.

TOSCA_BASE_URL

Variable

Your Tosca Cloud URL without a slash at the end. For example, https://acmecompany.my.tricentis.com.

TOSCA_SPACE

Variable

The ID of the workspace where you want to see the results. To use the default workspace, enter default.

Configure your workflow

To send the Playwright results to Tosca Cloud, your workflow must meet the following requirements:

The ToscaCloudPlaywright sample repository (opens in new tab) contains upload.mjs and a workflow that meets all these requirements. To use this workflow, copy the repository and set runs-on to a GitHub runner (opens in new tab) that's available to you.

This example shows an upload step that sends both report files to Tosca Cloud:

The env section reads the secrets and variables that you added to GitHub. The upload script uses them to authenticate with Tosca Cloud. The arguments --junit and --zip define the paths to the two report files.

Copy
- name: Upload results to Tosca Cloud
  run: >
    node upload.mjs
    --base "$TOSCA_BASE_URL"
    --space "$TOSCA_SPACE"
    --clientId "$TOSCA_CLIENT_ID"
    --clientSecret "$TOSCA_CLIENT_SECRET"
    --junit results.xml
    --zip blob-report/report.zip
  env:
    TOSCA_BASE_URL: ${{ vars.TOSCA_BASE_URL }}
    TOSCA_SPACE: ${{ vars.TOSCA_SPACE }}
    TOSCA_CLIENT_ID: ${{ secrets.TOSCA_CLOUD_CLIENT_ID }}
    TOSCA_CLIENT_SECRET: ${{ secrets.TOSCA_CLOUD_CLIENT_SECRET }}

If the upload succeeds, the Playwright results show up on the Test runs page. For details, check out Check Playwright results.

Protect sensitive data

Playwright traces, screenshots, and video recordings can contain sensitive data, such as typed passwords, cookies, tokens, and customer data. Users with access to the workspace can open the Playwright report in Tosca Cloud and see this data. Use dedicated test data and test accounts for your Playwright tests instead of production credentials and personal data.

Troubleshoot the connection

If the integration doesn't work, find your problem in the following table:

Problem

Solution

The Run GitHub Workflow test step fails with 401.

The personal access token is incorrect or expired. Create a new token in GitHub and update the token parameter. For details, check out Add Playwright tests to your test cases.

The Run GitHub Workflow test step fails with 404 Not Found.

The token doesn't have access to the repository. Check the token's access in GitHub. Also check the Repository and Workflow values in the test step.

The Run GitHub Workflow test step fails and shows a link to the workflow run.

The workflow failed or took longer than the Timeout value. Open the workflow run to find the failed step. If the workflow needs more time, increase the Timeout value in the test step.

The Upload results to Tosca Cloud step fails with Missing required arguments.

Secrets or variables are missing or have different names. For the correct names, check out Authenticate your workflow with Tosca Cloud.

The Upload results to Tosca Cloud step fails with 401.

The client ID or client secret is incorrect. Get the client ID and client secret again.

The Upload results to Tosca Cloud step fails with PUT upload failed.

The upload URL expired after 15 minutes or was already used. Run the workflow again. The upload script then requests a new upload URL and creates a new test run.

The test run shows up, but the Playwright report doesn't open.

Tosca Cloud can't open a blob-report/report.zip that's larger than 200 MB. To reduce the size, check out the report data, size, and retention guidance (opens in new tab) in the sample repository.

The workflow succeeds, but the results are missing on the Test runs page.

Check that TOSCA_BASE_URL and TOSCA_SPACE point to the Tosca Cloud URL and workspace that you have open.

What's next

Now that your workflow is ready, add Playwright tests to your test cases. This way, you start your Playwright tests from Tosca Cloud.