> For the complete documentation index, see [llms.txt](https://docs.testvibe.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.testvibe.com/create-tests/edit-test-content.md).

# Edit Test Content

You can edit test intent and, when needed, generated code from the selected feature detail view.

![The feature detail Gherkin editor](/files/88VQ6dzqOMLxl0quj63b)

Most changes should start in the Gherkin feature file. Regenerate Playwright code after the intent changes meaningfully.

## Edit Gherkin Intent

Use the Gherkin editor when you want to change what the test should prove.

1. Open the **Test Suite**.
2. Select a feature.
3. Open the editor for the feature file.
4. Update the `Feature`, `Background`, `Scenario`, or steps.
5. Save the file.
6. Regenerate Playwright code if the behavior changed.

Saving writes the updated `.feature` file to your project.

## Save Options

Depending on the screen, you may see options such as:

| Option            | Use it when                                                            |
| ----------------- | ---------------------------------------------------------------------- |
| Save              | You want to keep editing or review before generating.                  |
| Save and close    | You are done editing the feature for now.                              |
| Save and generate | You want to save the current feature and immediately start generation. |
| Cancel or revert  | You do not want to keep unsaved edits.                                 |

If you have unsaved changes, TestVibe may ask before switching away from the editor.

## Edit Generated Code

Generated Playwright code is executable test code. Edit it only when you need a targeted adjustment that is easier to make in code than in Gherkin.

Good reasons to edit generated code:

| Reason                  | Example                                                    |
| ----------------------- | ---------------------------------------------------------- |
| Small selector fix      | A generated locator needs a more stable role or label.     |
| Extra wait or assertion | The app has a known delayed state that should be verified. |
| Project-specific helper | Your project has a reusable test helper.                   |

Prefer editing Gherkin and regenerating when the expected behavior changed.

## Regenerate Or Edit Manually?

| Situation                         | Better choice                                               |
| --------------------------------- | ----------------------------------------------------------- |
| The user journey changed          | Edit Gherkin, then regenerate.                              |
| The expected result changed       | Edit Gherkin, then regenerate.                              |
| A selector is slightly wrong      | Edit generated code or improve Gherkin with visible labels. |
| The generated code is broadly off | Improve Gherkin and regenerate.                             |
| A helper should be reused         | Edit generated code if your team owns that helper pattern.  |

## After Editing

After saving changes:

1. Generate or regenerate Playwright code if needed.
2. Run one test first.
3. Review screenshots, videos, traces, and failure details.
4. Keep the Gherkin and code aligned.

## Related Pages

* [Write good test instructions](/create-tests/write-good-test-instructions.md)
* [Regenerate a test](/ai-generation/regenerate-test.md)
* [Manage generated test files](/create-tests/manage-generated-test-files.md)


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## 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, and the optional `goal` query parameter:

```
GET https://docs.testvibe.com/create-tests/edit-test-content.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

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.
