Integration · Test framework · via REST API

Fresh, masked test data for Playwright tests

Refresh the test database before your Playwright suite starts. A setup project calls the Synthesized REST API with Playwright's own request fixture, waits for the workflow, and stops the run if the data isn't ready.

Playwright and Synthesized at a glance

There is no Playwright plugin; this pattern uses the documented REST API and Playwright's documented setup projects.

Where the call goesA setup project that your browser projects list in dependencies, so it runs first and appears in the report.
How it connectsrequest.post starts the workflow; expect.poll checks workflow_run_status until it is final.
ConfigurationGOVERNOR_URL, WORKFLOW_ID and GOVERNOR_ACCESS_KEY as environment variables.
Best forSuites that own their test environment and need production-like data that is safe to use.
StatusWorks through the REST API. Playwright isn't named in the Synthesized docs; the API calls are.

Set it up

1. Build the workflow in Governor

Create the masking, subsetting or generation workflow that fills your test database, and run it once by hand.

2. Provide the settings

Set GOVERNOR_URL, WORKFLOW_ID and GOVERNOR_ACCESS_KEY in the environment, from your CI secret store.

3. Add a setup project

Add the test-data project and the setup file below, and list it in each browser project's dependencies.

4. Run the suite

npx playwright test now refreshes the data first. If the run fails, the dependent projects don't start.

Example setup project

playwright.config.ts

import { defineConfig, devices } from '@playwright/test';
 
export default defineConfig({
projects: [
{ name: 'test-data', testMatch: /test-data\.setup\.ts/ },
{
name: 'chromium',
use: { ...devices['Desktop Chrome'] },
dependencies: ['test-data'],
},
],
});

tests/test-data.setup.ts

import { test as setup, expect } from '@playwright/test';
 
const api = `${process.env.GOVERNOR_URL}/external/api/v1`;
const headers = { 'X-Access-Key': process.env.GOVERNOR_ACCESS_KEY ?? '' };
 
setup('refresh test data with Synthesized', async ({ request }) => {
setup.setTimeout(30 * 60 * 1000);
const start = await request.post(`${api}/workflow/${process.env.WORKFLOW_ID}/run`, { headers });
expect(start.ok()).toBeTruthy();
const { workflow_run_id } = await start.json();
 
let status = 'QUEUED';
await expect
.poll(async () => {
const res = await request.get(`${api}/workflow-run/${workflow_run_id}`, { headers });
status = res.ok() ? (await res.json()).workflow_run_status : `HTTP ${res.status()}`;
return status;
}, { intervals: [10_000], timeout: 30 * 60 * 1000 })
.toMatch(/^(COMPLETED|FAILED|STOPPED|HTTP \d+)$/);
expect(status, 'Synthesized workflow run status').toBe('COMPLETED');
});

Things to know

Use a dedicated key

An access key carries the permissions of the Governor user who generated it. Create a user that can reach only the workflows this pipeline runs, generate the key as that user, and give it a short expiry: keys are chosen from 1 hour to a year, and the docs say they can't yet be revoked.

One output database per environment

Two runs can't write to the same output database at the same time. If parallel pipelines or branches need data, give each environment its own workflow or output database.

Where the data goes

Workers read the source, mask, subset or generate, and write the target. Database contents stay with the workers and aren't sent to Governor, which, like the pipeline, only sees run status, logs and configuration. Run Synthesized on-premises, including air-gapped, and the data never leaves your environment; it is also available as SaaS.

Questions about Playwright and Synthesized

Is there a Playwright plugin?

No. A setup project calls the Synthesized REST API, so it works with any Playwright setup that can reach your Governor over HTTPS. You need an HTTP client (the example uses Playwright's request fixture), the Governor URL, a workflow ID and an access key.

Why a setup project instead of globalSetup?

Playwright recommends project dependencies: the setup shows in the HTML report, records traces, and can use fixtures such as request. globalSetup works too, but without those features.

Should Playwright or the CI pipeline start the refresh?

If several suites share the test database, refresh it once in the pipeline before any of them run. If Playwright owns the environment, the setup project keeps everything in one place.

What about parallel workers?

The setup project runs once, before the projects that depend on it, so all workers share the refreshed database. Keep tests independent by giving each test or worker its own records.

Where do I keep the access key?

In an environment variable set by your CI secret store. Don't commit it to the test project.

Try it on one suite

Bring one Playwright suite that depends on production-like data, and see Synthesized prepare it before the run.

Updated November 2026

All product names, including Playwright, are trademarks of their respective owners.