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

# Email & OTP Testing

> Test email verification and OTP flows in browser tests

# Email & OTP Testing

TestBrick has built-in email testing. Each test folder gets a unique email inbox — emails sent to it are caught and available for extraction during tests.

## Setup

1. Open your test folder
2. Click the **email icon** to open the Email Viewer
3. Copy the inbox address (e.g., `abc123@inbox.testbrick.com`)
4. Use this email in your app's signup/login form during recording

## Recording email steps

### Wait for Email

After triggering an email in your app (e.g., clicking "Send OTP"), add a **Wait for Email** step. This pauses the test until the email arrives.

### Extract Value (Click-to-Extract)

1. Open the Email Viewer — your received email appears
2. Click **Extract Value** to enter extraction mode
3. Hover over the OTP code or verification link — it highlights
4. Click to select it
5. Choose the extraction pattern (6-digit code, alphanumeric, etc.)
6. The value is copied to your clipboard — paste it in your app

During replay, TestBrick extracts the fresh value from the new email automatically.

### Assert Email

Verify email content:

* **Body contains** — check for specific text
* **Subject contains** — verify the email subject
* **From equals** — confirm the sender address

## Example flow

1. Fill signup form with `inbox@inbox.testbrick.com`
2. Click "Register"
3. **Wait for Email** — pauses until OTP email arrives
4. **Extract OTP** — clicks the 6-digit code in the email
5. Paste OTP into the verification field
6. Click "Verify"

<Info>
  The click-to-extract feature uses structural CSS paths for precise extraction — it works reliably across different email templates, even complex HTML emails.
</Info>
