Integration · Test framework · via REST API
Refresh the test database before your specs run. A Cypress task calls the Synthesized REST API from Node, waits for the workflow to finish, and fails the hook if the data isn't ready. The access key never reaches the browser.
There is no Cypress plugin; this pattern uses the documented REST API and Cypress's documented tasks.
| Where the call goes | A task registered in setupNodeEvents and called with cy.task from a before hook. |
|---|---|
| How it connects | Node's fetch starts the workflow and polls workflow_run_status until it is final. |
| Configuration | GOVERNOR_URL, WORKFLOW_ID and GOVERNOR_ACCESS_KEY as environment variables of the Cypress process. |
| Timeouts | Pass a timeout to cy.task; the default task timeout is 60 seconds. |
| Status | Works through the REST API. Cypress isn't named in the Synthesized docs; the API calls are. |
Create the masking, subsetting or generation workflow that fills your test database, and run it once by hand.
Set GOVERNOR_URL, WORKFLOW_ID and GOVERNOR_ACCESS_KEY in the environment that starts Cypress.
Add the synthesized:refresh task to cypress.config.js, as below.
Call the task from a before hook in the specs that need fresh data, with a timeout long enough for the workflow.
cypress.config.js
cypress/e2e/checkout.cy.js
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.
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.
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.
No. A Node task defined in setupNodeEvents calls the Synthesized REST API, so it works with any Cypress setup that can reach your Governor over HTTPS. You need an HTTP client (the example uses Node's built-in fetch), the Governor URL, a workflow ID and an access key.
The task runs in the Cypress Node process, so the access key stays in Node's environment and never reaches the browser. It can also wait as long as the workflow takes.
Cypress recommends resetting state before tests rather than after them. A full masking run takes minutes, so refresh once per run or per spec, and reset small fixtures per test.
cy.task uses taskTimeout, 60 seconds by default. Pass a longer timeout to the call, as in the example.
Each machine would start its own refresh. Refresh once in the CI pipeline before cypress run instead, and keep the task for local runs.
Bring one Cypress spec that depends on production-like data, and see Synthesized prepare it before the run.
All product names, including Cypress, are trademarks of their respective owners.