# 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

| Output             | What to check                                                                |
| ------------------ | ---------------------------------------------------------------------------- |
| Feature file       | The Gherkin still describes the behavior you intended.                       |
| Playwright code    | The generated code follows the right journey and checks the expected result. |
| Generated path     | The file was saved where you expect in the repository.                       |
| Screenshots        | The browser saw the right page or state during generation.                   |
| Trace              | The agent's browser actions make sense when a trace is available.            |
| Generation summary | No warnings or missing setup are called out.                                 |

## 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](/create-tests/write-good-test-instructions.md).

## Then Review The Code

Generated Playwright code should:

| Good sign                     | Why it matters                                               |
| ----------------------------- | ------------------------------------------------------------ |
| Open the intended page        | The test starts from the right target.                       |
| Use readable locators         | The code can survive small layout changes.                   |
| Include assertions            | The test proves the expected result, not just clicks around. |
| Avoid accidental private data | Credentials and secrets should come from safe setup.         |
| Match the feature             | Code 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:

| Evidence      | Use it to answer                                                   |
| ------------- | ------------------------------------------------------------------ |
| Screenshot    | Did the agent reach the expected page?                             |
| Trace         | What did the browser do step by step?                              |
| Workflow link | Did the GitHub Actions workflow report setup or permission issues? |

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 runner are correct
* required secrets and test data are available
* the expected result is clearly asserted

Start with one test. See [Run one test](/run-tests/run-one-test.md).

## If Output Needs Work

| Issue                     | Next step                                       |
| ------------------------- | ----------------------------------------------- |
| Gherkin is vague          | Edit the feature and regenerate.                |
| Generated code is close   | Edit code or improve the specific Gherkin step. |
| The wrong page was used   | Check the site URL and starting context.        |
| Required data is missing  | Add setup steps, prerequisites, or secrets.     |
| Generation failed halfway | Review failure details before retrying.         |

For another pass, see [Regenerate a test](/ai-generation/regenerate-test.md).


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.testvibe.com/ai-generation/read-generated-output.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
