> ## Documentation Index
> Fetch the complete documentation index at: https://docs.rehearsal.ai/llms.txt
> Use this file to discover all available pages before exploring further.

# Creating Tests

> Two ways to create tests: natural language or recording

## Natural Language

Describe what you want to test in plain English. AI converts it to Playwright code.

**Example:**

```
Test checkout flow:
1. Go to store.rehearsal.ai
2. Add green shirt to cart
3. Click checkout
4. Fill in shipping address
5. Verify order confirmation appears
```

**What you get:**

* Clean TypeScript Playwright code
* Proper `expect()` assertions
* Comments explaining each step
* Ready to run in CI/CD

<Note>
  Tests take 2-5 minutes to generate. Watch live execution in the dashboard.
</Note>

## Recording

Click record, use your app normally, get Playwright code.

**Steps:**

1. Dashboard → New Test → Record
2. Perform actions in your app
3. Click checkpoints to add assertions
4. Stop recording → Code auto-generated

**Best for:**

* Complex user flows
* Apps with lots of interactions
* Visual regression testing

## Common Patterns

<AccordionGroup>
  <Accordion title="Login Flow">
    ```
    Navigate to app.example.com/login
    Enter email: test@example.com
    Enter password: testpass123
    Click "Sign In"
    Verify dashboard page loads
    ```
  </Accordion>

  <Accordion title="Form Submission">
    ```
    Go to contact form
    Fill name: John Doe
    Fill email: john@example.com
    Fill message: Test message
    Click submit
    Verify "Thank you" message appears
    ```
  </Accordion>

  <Accordion title="E-commerce Checkout">
    ```
    Search for "laptop"
    Click first result
    Add to cart
    Go to cart
    Click checkout
    Fill shipping info
    Verify order total is correct
    ```
  </Accordion>
</AccordionGroup>

## Tips

* **Be specific**: "Click the blue 'Submit' button" > "Submit form"
* **Add assertions**: Tell AI what to verify at each step
* **Break it up**: Create separate tests for different flows
* **Use test suites**: Group related tests together

<CardGroup cols={2}>
  <Card title="Running Tests" icon="play" href="/running-tests">
    Execute tests and view results
  </Card>

  <Card title="GitHub PR Bot" icon="github" href="/github-pr-bot">
    Automate testing on pull requests
  </Card>
</CardGroup>
