# Generate Playwright Code

URL: https://docs.testvibe.com/quickstart/generate-playwright-code

*Select the saved feature, confirm the browser configuration, model and environment, then watch a real generation run through to Playwright code you can read.*

After you create a test, use AI generation to turn the readable test intent into Playwright code.

Generation may take a few minutes. TestVibe will show progress while the agent works.

info
[Playwright](https://playwright.dev/) is the open-source browser automation framework TestVibe generates tests for. Visit [playwright.dev](https://playwright.dev/) to learn more.

## Before You Generate

Check that you have:

- a saved test or feature
- a site URL the cloud session can reach
- any variables or secrets your test references, added in Settings → Variables & Secrets
If something is missing, TestVibe may prompt you before generation starts.

## Steps

1. Select the test you created in the Test Suite.
2. Start generation from the test details or generation action.
3. Confirm the site URL and generation options if prompted.
4. Keep the default agent and model unless your team has a reason to change them (Settings → AI Model).
5. Start generation.
6. Watch the generation progress view.
7. Wait for the generation to finish.
When generation succeeds, TestVibe should show generated output and make the test ready to run.

## What Happens During Generation

TestVibe uses your Gherkin feature or test instructions as the source of intent. A cloud agent uses that intent to create Playwright code and supporting output, which is saved to your project. Generation usage is metered in credits.

You may see states such as:

- queued
- setting up
- running
- finalizing
- succeeded
- failed
- cancelled
If generation fails, open the failure details before changing the test. The problem may be a missing variable or secret, an unreachable site, an unclear instruction, or application behavior that did not match the expected result.

## After Generation Succeeds

Review the output enough to confirm that:

- the generated code matches the behavior you intended
- the target page or flow is correct
- the expected result is being checked
- no obvious setup or data requirement is missing
For deeper help, see [Read generated output](/ai-generation/read-generated-output) .

## Next

Continue to [Run your first test](/quickstart/run-first-test) .
