Skip to main content

Generate Playwright Code

Generate Playwright code when your feature intent is ready and you want a runnable browser test.

The generated code is stored in your project and can be run from TestVibe.

info

TestVibe generates standard Playwright tests. See the official Playwright documentation for the full API and testing concepts.

Before You Generate​

Confirm:

CheckWhy it matters
The feature is savedGeneration uses the saved project version of the feature.
The Gherkin is clearBetter intent produces better code.
The target site URL is reachableThe cloud test session and generated test need to open the app.
Required secrets existLogin credentials the test needs must be available in Settings > Variables & Secrets.

Steps​

  1. Open Tests and select the saved test.
  2. Choose … → Generate, or … → Regenerate if code already exists.
  3. Confirm the environment, configuration, and model in Generate test.
  4. Choose Generate and read the conversation. Answer any question or review a proposed change when needed.
  5. Keep watching, or choose Run in background and return through View progress.
  6. Read the outcome and open Code to review the saved files.

What TestVibe Generates​

Generation can create or update:

OutputPurpose
Playwright test fileThe browser automation that runs the scenario.
Supporting outputHelpers, configuration use, or generated metadata when needed.
Evidence during generationScreenshots, section progress, and trace links when available.
Project changesGenerated files saved to your project.

Review Before Running​

Before running the generated test, check:

  • it follows the intended journey
  • it uses the right target page
  • it verifies the expected result
  • it does not depend on private or accidental data
  • it does not ignore important setup from the Gherkin

For more detail, see Read generated output.

If The Output Is Not Right​

Do not keep regenerating blindly. First improve the feature:

ProblemBetter next step
Test clicks the wrong thingAdd visible labels or clearer page context to the Gherkin.
Test misses the assertionAdd a stronger Then step.
Test needs setupAdd Background or explicit setup and test data instructions.
Site could not be reachedFix the URL, or use a tunnel device for private apps.
A secret token is missingAdd the value in Settings > Variables & Secrets and match the {{secret:NAME}} token.

Then regenerate. See Regenerate a test.