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

# Frontend QA Agent

> Configure authenticated, pull-request-scoped browser testing for GitHub preview deployments

## Overview

Frontend QA opens a deployed pull request preview in a real browser, restores or creates a test-user session, and exercises the UI behavior changed by that pull request. Each run can produce scoped findings, screenshots, and a browser recording.

```mermaid theme={"theme":"css-variables"}
flowchart LR
    A[GitHub deployment succeeds] --> B[CodeAnt matches the repository, environment, and preview host]
    B --> C[CodeAnt restores the configured test session]
    C --> D[Checks are planned from the PR description and changed code]
    D --> E[Browser actions run against the preview]
    E --> F[Findings, screenshots, and recording]
```

> [!NOTE]
>
> Frontend QA is available for selected GitHub customers. You need CodeAnt administrator access. If **Settings → Code Review → QA Agent** is not visible, contact [support@codeant.ai](mailto:support@codeant.ai).

## Prerequisites

Before configuring a repository, confirm that:

* The GitHub repository is connected to CodeAnt AI.
* Pull requests receive a successful GitHub [`deployment_status`](https://docs.github.com/en/webhooks/webhook-events-and-payloads#deployment_status) event from the preview provider.
* The event identifies an open pull request commit and includes an `environment_url` or `target_url`, or GitHub exposes the URL through the deployment or commit status APIs.
* The preview is publicly reachable over HTTPS from CodeAnt AI.
* You have a dedicated, least-privilege test account with non-production data.
* The test account can access the workspace and features being changed, and the preview contains the data needed to exercise them. A successful login alone does not establish these prerequisites.
* You know whether the application stores authentication in cookies, `localStorage`, IndexedDB, or a combination of these.

> [!WARNING]
>
> Do not use a production administrator account. Browser recordings and screenshots can contain data visible to the configured test user.

## Configure a repository

[Open the CodeAnt AI dashboard](https://app.codeant.ai), select your organization, and go to **Settings → Code Review → QA Agent**.

### 1. Select the repository

Choose the repository that owns the frontend preview. Settings are repository-scoped; configuring one repository does not automatically configure another.

### 2. Configure the preview

> [tab] Dynamic preview
>
> Select **Dynamic (CI / Vercel)** when every pull request gets a different preview hostname. This is the current settings-page label; the option supports Amplify, Netlify, and other CI preview providers in addition to Vercel.
>
> In **Trusted preview host**, enter an app-specific hostname pattern—not a regular expression and not a full URL.
>
> | Provider | Example |
> | - | - |
> | AWS Amplify | `*.example-app-id.amplifyapp.com` |
> | Vercel | `project-git-*-team.vercel.app` |
> | Netlify | `*--site-name.netlify.app` |
>
> A hostname without `*` trusts that exact hostname and its subdomains. For example, `example-app-id.amplifyapp.com` also accepts `pr-42.example-app-id.amplifyapp.com`.
>
> The pattern must follow these rules:
>
> * Hostname only—do not include `https://`, a port, path, query string, or fragment.
> * `*` can appear inside a hostname label, but `**` is not supported.
> * The final two labels cannot contain `*`; patterns such as `*.amplifyapp.com` are intentionally rejected because they are not app-specific.

> [tab] Static preview
>
> Select **Static URL** when QA should always run against one stable environment, such as:
>
> ```text theme={"theme":"css-variables"}
> https://staging.example.com
> ```
>
> Use a publicly reachable HTTPS URL. The GitHub deployment environment is still required because the successful deployment event controls when automatic QA begins.

### 3. Set the deployment environment

In **GitHub deployment environment**, enter the environment name reported by the successful GitHub deployment event. Common values are `Preview`, `Staging`, and `Production`.

Use the exact value shown in GitHub. A run starts only when:

* the QA Agent is enabled;
* the deployment state is `success`;
* the deployment environment matches this setting;
* the commit belongs to an open pull request; and
* the resolved URL matches the trusted preview host.

#### If `deployment_status` is not being sent

First, check whether the preview provider creates GitHub deployments for the pull request head SHA:

```bash theme={"theme":"css-variables"}
gh api "repos/OWNER/REPOSITORY/deployments?sha=PR_HEAD_SHA"
gh api "repos/OWNER/REPOSITORY/deployments/DEPLOYMENT_ID/statuses"
```

The second response must contain a status whose `state` is `success`, whose `environment` exactly matches **GitHub deployment environment**, and whose `environment_url` or `target_url` is the ready preview URL.

If deployment happens in GitHub Actions, add an environment and URL to the existing deployment job, for example in `.github/workflows/deploy-preview.yml`. GitHub then creates the deployment and its status automatically:

```yaml .github/workflows/deploy-preview.yml theme={"theme":"css-variables"}
jobs:
  deploy-preview:
    permissions:
      contents: read
      deployments: write
    environment:
      name: Preview
      url: ${{ steps.deploy.outputs.preview_url }}
    steps:
      - id: deploy
        # Run your existing preview deployment here.
        # This step must expose the ready URL as the preview_url output.
```

If the provider deploys outside GitHub Actions and does not publish a deployment status, add this step to a workflow **after the preview is ready**. Replace the dummy URL with the URL returned by your deployment step:

Job fragment: merge into your existing job.

```yaml .github/workflows/deploy-preview.yml expandable theme={"theme":"css-variables"}
permissions:
  contents: read
  deployments: write

steps:
  - name: Publish preview deployment status
    uses: actions/github-script@v7
    env:
      PREVIEW_URL: https://pr-${{ github.event.pull_request.number }}.example-app-id.amplifyapp.com
      PREVIEW_ENVIRONMENT: Preview
    with:
      script: |
        const { data: deployment } = await github.rest.repos.createDeployment({
          ...context.repo,
          ref: context.payload.pull_request.head.sha,
          environment: process.env.PREVIEW_ENVIRONMENT,
          auto_merge: false,
          required_contexts: [],
          transient_environment: true,
          production_environment: false,
        });

        await github.rest.repos.createDeploymentStatus({
          ...context.repo,
          deployment_id: deployment.id,
          state: "success",
          environment: process.env.PREVIEW_ENVIRONMENT,
          environment_url: process.env.PREVIEW_URL,
          description: "Pull request preview is ready",
          auto_inactive: false,
        });
```

GitHub requires `Deployments: write` for the workflow that creates the status. The installed CodeAnt GitHub App must have at least `Deployments: read` and be subscribed to `deployment_status`. If GitHub shows the successful deployment status but CodeAnt does not start a run, contact [support@codeant.ai](mailto:support@codeant.ai) with the repository, pull request, deployment environment, and GitHub delivery ID. See GitHub's [deployment REST API](https://docs.github.com/en/rest/deployments/deployments) and [deployment status API](https://docs.github.com/en/rest/deployments/statuses) for the underlying event model.

### 4. Choose an authentication mode

> [tab] Saved session
>
> Use **Saved session** for SSO, MFA, OAuth, or any login that a person should complete once and CodeAnt should replay later.
>
> 1. In **Authentication source URL**, enter the stable login page for the application being tested, for example `https://app.example.com/login`.
> 2. Click **Connect browser session**.
> 3. Click **Open secure browser** and complete every login step in the isolated browser.
> 4. Confirm that the application shows a signed-in state.
> 5. Click **I'm logged in — save session**.
>
> The secure browser expires after 15 minutes. CodeAnt encrypts the captured cookies and site storage. Saved sessions are not automatically renewed by QA runs; reconnect the secure browser and save a fresh session when authentication expires.
>
> > [!WARNING]
> >
> > The authentication source is your application—not the CodeAnt dashboard. Do not enter `https://app.codeant.ai`. CodeAnt dashboard cookies cannot authenticate a separate customer preview.
>
> For dynamic previews, CodeAnt can copy source-origin `localStorage` and IndexedDB data to a validated preview origin. Cookies are never rewritten; a cookie is retained only when its domain is already valid for the preview hostname.
>
> > [!WARNING]
> >
> > Pull-request code runs on the preview origin and can read any bearer token or reusable credential copied into that origin's `localStorage` or IndexedDB. Origin filtering does not protect those values from same-origin JavaScript. Use a disposable, least-privilege QA account with non-production data, rotate it regularly, and prefer programmatic login or short-lived preview-scoped credentials when testing untrusted pull requests.
>
> For example, cookies captured on `app.example.com` cannot authenticate `pr-42.app-id.amplifyapp.com`. For a cookie-only application on unrelated domains, use a same-origin programmatic login, a customer-owned preview domain with compatible cookie scope, or configure the identity provider to support the preview callback.

> [tab] Programmatic login
>
> Use **Programmatic login** when the preview exposes a test-only endpoint that creates the browser session directly.
>
> The endpoint must be relative to, or use the same origin as, the resolved preview URL. It must return a successful response and establish authentication by setting cookies for that preview.
>
> Example settings:
>
> | Field | Example |
> | - | - |
> | Login endpoint | `/api/qa/session` |
> | Method | `POST` |
> | Headers JSON | `{"X-QA-Key":"${QA_KEY}"}` |
> | Request JSON | `{"email":"${QA_EMAIL}","password":"${QA_PASSWORD}"}` |
>
> Add the referenced values under **QA runtime variables**:
>
> ```dotenv theme={"theme":"css-variables"}
> QA_KEY=replace-with-a-dedicated-test-key
> QA_EMAIL=qa-bot@example.com
> QA_PASSWORD=replace-with-the-test-account-password
> ```
>
> Programmatic headers and request data must be JSON objects. The supported methods are `POST` and `PUT`. Redirects are not followed, so the endpoint should establish the session directly.

> [tab] Credentials
>
> Use **Credentials** for a conventional username/password form that the QA browser can operate.
>
> * Enter the dedicated test account's username or email and password.
> * Add concise **Login instructions**, for example: `Open /login, enter the email and password, click Sign in, and wait for /dashboard.`
> * Keep the instructions limited to the real login flow; do not include secrets in this text field.
>
> Credentials are encrypted at rest and never displayed again. Leave both fields blank when editing other settings to keep the stored credentials unchanged.

### 5. Add runtime variables

**QA runtime variables** are optional encrypted `KEY=value` entries. Use one entry per line:

```dotenv theme={"theme":"css-variables"}
QA_EMAIL=qa-bot@example.com
QA_PASSWORD=replace-with-the-test-account-password
QA_KEY=replace-with-a-dedicated-test-key
```

Variable names must start with a letter or underscore and contain only letters, numbers, and underscores. Reference a value as `${NAME}` in programmatic login JSON. Runtime variables can also be used in supported preview templates.

These values belong to the QA worker. They do **not** add or change environment variables in the deployed preview. When a **stored** badge is shown, leaving this field blank preserves the existing encrypted values; enter the complete replacement set when rotating them.

### 6. Add navigation guidance

Use **Navigation guidance** when the relevant feature is inside a workspace or is difficult to reach through the visible navigation.

In **Workspace entry paths**, enter the paths the agent may open on the preview, one per line. Replace these examples with paths that exist in your application:

```text theme={"theme":"css-variables"}
/workspaces/qa
/workspaces/qa/analytics
```

Paths must start with a single `/`. Do not include a hostname, query parameters, whitespace, backslashes, or credentials. You can provide up to 10 paths, each at most 500 characters. CodeAnt attaches each path to the resolved preview origin: `/workspaces/qa` becomes `https://pr-42.example.com/workspaces/qa` when that is the PR's preview host.

In **Navigation instructions**, describe how to reach the feature, for example: `Select the QA workspace, then open Analytics from its menu.` This field accepts up to 4,000 characters and must not contain secrets.

Guidance helps the agent navigate; it does not grant permissions, create test data, or expand the check beyond the PR's changes. The agent must still verify the account's access and the required prerequisites. To remove guidance, clear the fields and click **Save**.

### 7. Enable and save

Turn on **Enable QA agent**, then click **Save**. Saving validates the settings; a QA run is still needed to verify preview availability, authentication, and access to the changed feature.

## Complete AWS Amplify example

The following example configures dynamic previews such as `https://pr-42.example-app-id.amplifyapp.com`. All domains and repository names below are dummy values:

| Setting | Example value |
| - | - |
| Repository | `acme/web-app` |
| Enable QA agent | On |
| Preview URL | Dynamic (CI / Vercel)—the same option is used for Amplify |
| Trusted preview host | `*.example-app-id.amplifyapp.com` |
| GitHub deployment environment | `Preview` |
| Authentication mode | Saved session |
| Authentication source URL | `https://app.acme.example/login` |
| QA runtime variables | Leave blank unless the login recipe references variables |
| Workspace entry paths | `/workspaces/qa/analytics`, if this path exists in your app |
| Navigation instructions | `Select the QA workspace, then open Analytics.` |

After saving, connect the secure browser and sign in at `https://app.acme.example/login`. If the application stores its session only in cookies scoped to `acme.example`, those cookies cannot be copied to `amplifyapp.com`; use programmatic login or a compatible custom preview domain instead.

## Validate the setup

Use **Run now** before relying on automatic triggers:

1. Enter an open pull request number that has a deployed preview.
2. Click **Run QA now**.
3. Confirm that the result shows the expected preview URL, then read the verification outcome and the passed, failed, and blocked check counts.
4. Review each check's explanation, screenshots, and browser recording. For blocked checks in the PR comment, use **View check evidence** to open that check in the dashboard.

Dynamic preview runs require a PR number so CodeAnt can resolve its current deployment. A static-preview run can omit the PR number to check authentication only; **Login successful** does not mean any changed UI behavior was verified.

For the best validation, use a pull request with one small, observable UI change and describe the expected behavior in the PR description. Frontend QA reports only failures related to the pull request description and changed code; unrelated or pre-existing issues are discarded.

### Understand the result

| Outcome | Meaning and next action |
| - | - |
| **Login successful** | Authentication succeeded in a login-only run. Enter a PR number to test its changed UI behavior. |
| **No applicable checks** | Authentication succeeded, but no applicable UI checks were planned for the PR. Use a small, testable UI change with a clear expected result to validate the setup. |
| **Blocked** | No planned checks could be verified. Read the blocked reason and confirm the account's access, navigation, and test data. |
| **Partially verified** | Some checks reached a verdict and others were blocked. Review both the verdicts and the blocked prerequisites. |
| **Checks verified** | All planned checks reached a pass or fail verdict. Inspect the counts: verified does not mean every check passed. The PR comment shows **Issues found** when a fully verified run includes a failure. |
| **Preview unavailable** | The preview URL could not be resolved or the preview or login service remained unavailable. Check the deployment, then start a new run against a ready preview. |
| **Authentication required** | The saved session could not authenticate. Reconnect and save a fresh session. |
| **Run failed** | Execution could not finish. Read the reported error and review any available recording before retrying. |

Older runs without verification details show **Verification unavailable**. Neither a completed execution nor zero findings proves that the UI checks passed.

## Settings reference

| Setting | Required | Accepted value |
| - | - | - |
| Repository | Yes | One connected GitHub repository |
| Enable QA agent | Yes for manual and automatic runs | On or off |
| Preview source | Yes | Static URL or Dynamic (CI / Vercel) |
| Static URL | For static previews | Public HTTPS URL |
| Trusted preview host | For dynamic previews | App-specific hostname or constrained `*` pattern |
| GitHub deployment environment | Yes | Environment reported by GitHub, such as `Preview` |
| Login instructions | Credentials mode | Plain-language login steps; no secrets |
| Authentication mode | Yes | Credentials, Programmatic login, or Saved session |
| Username and password | Credentials mode | Dedicated test-account credentials |
| Login endpoint | Programmatic mode | Relative or same-origin endpoint |
| Method | Programmatic mode | `POST` or `PUT` |
| Headers JSON | Programmatic mode | JSON object |
| Request JSON | Programmatic mode | JSON object |
| Authentication source URL | Saved-session mode | Exact, public HTTPS application login URL; no wildcard |
| Playwright saved session | Saved-session mode | Secure-browser capture or a storage-state JSON file smaller than 2 MB |
| QA runtime variables | No | `KEY=value`, one per line |
| Workspace entry paths | No | Up to 10 preview-relative paths, one per line; at most 500 characters each; no hostname or query parameters |
| Navigation instructions | No | Up to 4,000 characters of navigation guidance; no secrets |
| PR number under Run now | For dynamic previews and diff-driven checks | Open PR number with a deployed preview; optional for a static login-only run |

## Authentication-source and preview-host rules

The two settings serve different purposes:

* **Authentication source URL** is the stable page where a person signs in once.
* **Trusted preview host** constrains which deployment URLs CodeAnt may test.

They do not need to be the same hostname, but the captured authentication data must be reusable on the preview:

| Authentication storage | Different dynamic preview host |
| - | - |
| `localStorage` or IndexedDB | Can be copied from the configured source origin to a validated preview origin |
| Cookie valid for the preview domain | Retained and replayed |
| Cookie valid only for an unrelated source domain | Cannot be rewritten; use another authentication strategy |

## Troubleshooting

> [accordion] The QA Agent settings page is missing
>
> Confirm that you are using GitHub, have CodeAnt administrator access, and that Frontend QA is enabled for your organization. Contact [support@codeant.ai](mailto:support@codeant.ai) if the page is still unavailable.

> [accordion] A successful deployment did not start QA
>
> Confirm that the QA Agent is enabled, the GitHub deployment status is `success`, the environment matches **GitHub deployment environment**, and the deployed commit belongs to an open pull request. The GitHub event must reach CodeAnt AI before the run can be queued.

> [accordion] CodeAnt could not resolve the preview URL
>
> Verify that the deployment publishes an `environment_url` or `target_url` and that its hostname matches **Trusted preview host**. Enter a hostname pattern only, without a path or regular expression. For a dynamic manual run, provide the PR number.

> [accordion] The result says Preview unavailable
>
> Confirm that the preview deployment has finished and that the login page opens. CodeAnt makes up to three navigation attempts within a 60-second readiness budget for transient HTTP or connection failures. HTTP 404 and 410 stop this recovery immediately.
>
> If login fails after the browser observes a transient HTTP error from the preview origin, CodeAnt can retry login once while its retry window remains open. Rejected credentials or permission responses are not retried.
>
> If the preview expired or was destroyed, redeploy it, wait for the ready deployment, and click **Run QA now** with the PR number. A new run resolves the PR's current preview. Retrying cannot restore a destroyed environment.

> [accordion] No reusable authentication data was found
>
> Make sure **Authentication source URL** points to the customer application and that you completed login before saving. Dynamic previews require source-origin web storage or cookies already valid for the trusted preview host. A cookie scoped only to an unrelated production domain cannot be copied to an Amplify, Vercel, or Netlify domain.

> [accordion] The preview loads but authentication fails
>
> Reconnect the saved session if it expired. For cross-domain cookie authentication, use programmatic login, a compatible custom preview domain, or an identity-provider callback that supports the preview URL. CodeAnt never rewrites cookie domains.

> [accordion] Programmatic login fails
>
> Use a relative or same-origin endpoint, valid JSON objects for headers and request data, and a `POST` or `PUT` method. Confirm that the endpoint returns a successful response and directly creates a browser session without relying on a redirect.

> [accordion] Login succeeds but the checks are blocked
>
> Open **View check evidence** from the PR comment and read what the agent could not verify. Sign in to a fresh preview with the same test account, then confirm that you can reach the named workspace, feature, and test data.
>
> If access is missing, configure the required test-account permissions, workspace membership, or feature availability in your application. If the feature is available but hard to find, add its path and navigation instructions under **Navigation guidance**, save, and start a new run. Guidance does not replace missing permissions or data.

> [accordion] The run completes with no findings
>
> Check the verification outcome and check counts. **Login successful**, **No applicable checks**, and **Blocked** can all have zero findings without verifying the changed behavior. Use a PR with a small, observable UI change, describe the expected behavior, and ensure the required test data is present.

If the reason remains unclear, contact [support@codeant.ai](mailto:support@codeant.ai) with the repository, PR URL, QA run link, and the reported error or blocked reason.

## Security notes

* Credentials, saved browser state, programmatic login recipes, and runtime variables are encrypted at rest.
* Stored secret values are not returned to the settings page; a **stored** badge indicates that encrypted data exists.
* Saved browser state is filtered to approved origins before use.
* Dynamic preview URLs must match the configured app-specific hostname pattern.
* Cloned repository context is limited to changed frontend files, and QA findings are kept only when they are grounded in the pull request description and code changes.


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.