Skip to main content

Read Generated Output

After generation succeeds, review the output before you rely on the test.

The goal is to confirm that generated code matches the intended user behavior and is ready for a first run.

What To Review

OutputWhat to check
Feature fileThe Gherkin still describes the behavior you intended.
Playwright codeThe generated code follows the right journey and checks the expected result.
Generated pathThe file was saved where you expect in your project.
ScreenshotsThe browser saw the right page or state during generation.
TraceThe agent's browser actions make sense when a trace is available.
Generation summaryNo warnings or missing setup are called out.
What the Assistant learnedIf present, this card lists app-specific behavior the agent discovered while exploring — read it to understand why the test is built the way it is.

Read The Feature First

Start with the Gherkin. If the feature intent is wrong, the generated code will usually be wrong too.

Check:

  • the feature name is clear
  • scenarios are focused
  • setup belongs in Background only when all scenarios need it
  • every scenario has a visible expected result
  • test data is repeatable

See Write good test instructions.

Then Review The Code

Generated Playwright code should:

Good signWhy it matters
Open the intended pageThe test starts from the right target.
Use readable locatorsThe code can survive small layout changes.
Include assertionsThe test proves the expected result, not just clicks around.
Avoid accidental private dataCredentials and secrets should come from safe setup.
Match the featureCode and Gherkin should tell the same story.

You do not need to understand every line before the first run, but you should catch obvious wrong turns.

Use Screenshots And Traces

Screenshots and traces help explain what happened during generation:

EvidenceUse it to answer
ScreenshotDid the agent reach the expected page?
TraceWhat did the browser do step by step?
Verification videoWhat did the final end-to-end verification look like?
Run details linkDid the run report setup or permission issues?

A completed generation now includes a trace you can open in the built-in Playwright trace viewer — whether the final verification passed or failed — alongside the verification video. Open the trace to step through the browser actions the assistant recorded and confirm they match the intended journey.

If the preview shows the wrong screen, improve the Gherkin or site setup before running a large suite.

Ready To Run Checklist

Run the generated test when:

  • the feature describes the right behavior
  • the generated code appears to follow the feature
  • the target site and configuration are correct
  • required secrets and test data are available
  • the expected result is clearly asserted

Start with one test. See Run one test.

If Output Needs Work

IssueNext step
Gherkin is vagueEdit the feature and regenerate.
Generated code is closeEdit code or improve the specific Gherkin step.
The wrong page was usedCheck the site URL and starting context.
Required data is missingAdd setup steps, prerequisites, or secrets.
Generation failed halfwayReview failure details before retrying.

For another pass, see Regenerate a test.