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

# GitHub PR Testing

> Automatically test preview deployments on every PR

<img src="https://mintcdn.com/morph-555d6c14/6bm3KIDcGh3tlVrb/images/browser-testing.webp?fit=max&auto=format&n=6bm3KIDcGh3tlVrb&q=85&s=3146cd49f725fc53a65e4d8fab1098ae" alt="Browser Testing" width="100%" style={{ borderRadius: 8, marginBottom: 24 }} data-path="images/browser-testing.webp" />

Push a PR → Morph tests your preview → posts video to PR.

## Setup

<Steps>
  <Step title="Connect GitHub">
    [Install the GitHub App](https://morphllm.com/dashboard/integrations/github) and select your repositories.
  </Step>

  <Step title="Connect Vercel">
    If you're on Vercel Pro/Enterprise, [Deployment Protection](https://vercel.com/docs/security/deployment-protection) blocks external access to previews by default.

    1. Click [Connect Vercel](https://morphllm.com/dashboard/integrations/github) in your Morph dashboard
    2. Select which team to install the integration into
    3. Click **Connect account**

    Bypass secrets are automatically populated for your projects.
  </Step>
</Steps>

## Options

| Option                 | Description                                                                                                      |
| ---------------------- | ---------------------------------------------------------------------------------------------------------------- |
| **Browser profiles** ⭐ | Sign into test accounts using a real browser. Sessions persist across tests. Best for OAuth, SSO, and most apps. |
| **Site Login**         | Simple username/password for apps with basic login forms. Use `x_user`/`x_pass` in prompts.                      |
| **Path filters**       | Only test PRs touching specific paths                                                                            |
| **Check runs**         | Block merges until tests pass                                                                                    |

Configure in the [integrations dashboard](https://morphllm.com/dashboard/integrations/github).

## FAQ

<AccordionGroup>
  <Accordion title="How do I test authenticated pages?">
    **We recommend using Browser Profiles** for most authentication scenarios.

    ### Browser Profiles (Recommended)

    Best for: OAuth, SSO, Google/GitHub login, complex login flows, or any app where you need to stay logged in.

    1. Expand your repo in the [integrations dashboard](https://morphllm.com/dashboard/integrations/github)
    2. Click **+ new profile** in the Browser Profiles section
    3. A browser opens — sign into your test account normally
    4. Click **Save Profile** when done

    The authenticated session persists across all future test runs. You can create multiple profiles and set one as active.

    ### Site Login (Simple auth)

    Best for: Apps with a simple username/password login form (no OAuth, no SSO).

    1. Connect Vercel in the [integrations dashboard](https://morphllm.com/dashboard/integrations/github)
    2. Expand a project and configure **Site Login**
    3. Enter your test account credentials
    4. In your test prompts, use `x_user` and `x_pass` — Morph substitutes the real values

    <Note>
      Site Login only works for simple form-based login. If your app uses OAuth (Google, GitHub, etc.) or SSO, use Browser Profiles instead.
    </Note>
  </Accordion>

  <Accordion title="Why am I getting 403 errors?">
    Vercel Deployment Protection is blocking access. Make sure you've connected Vercel through the integrations dashboard—bypass secrets are added automatically.
  </Accordion>

  <Accordion title="Login form not showing up in my preview URLs?">
    This typically happens when your preview environment is using production environment variables. OAuth providers (Google, GitHub, etc.) require redirect URIs to be whitelisted, and production tokens only allow production URLs.

    **Solution:** Configure your deployment platform to use development/staging tokens for preview environments:

    * **Vercel**: Use [Environment Variable Scopes](https://vercel.com/docs/projects/environment-variables#environment-variable-scopes) to set different OAuth credentials for Preview vs Production
    * **Other platforms**: Create separate environment variable configs for preview deployments

    Make sure your OAuth provider has your preview URL patterns (e.g., `*.vercel.app`) added to the allowed redirect URIs.
  </Accordion>

  <Accordion title="Can I use this without Vercel?">
    Yes. Use the GitHub Action for custom deployments:

    ```yaml theme={null}
    - uses: morphllm/preview-test-action@v1
      with:
        api-key: ${{ secrets.MORPH_API_KEY }}
        preview-url: ${{ steps.deploy.outputs.url }}
    ```

    See [full action docs](#github-action) below.
  </Accordion>
</AccordionGroup>

## GitHub Action

For non-Vercel deployments:

```yaml theme={null}
name: Preview Test
on: pull_request

jobs:
  test:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v4

      - name: Deploy
        id: deploy
        run: echo "url=https://pr-${{ github.event.number }}.example.com" >> $GITHUB_OUTPUT

      - uses: morphllm/preview-test-action@v1
        with:
          api-key: ${{ secrets.MORPH_API_KEY }}
          preview-url: ${{ steps.deploy.outputs.url }}
          instructions: Test login and checkout flow  # optional
```

Requires the [GitHub App](https://morphllm.com/dashboard/integrations/github) installed and `MORPH_API_KEY` in repo secrets.

***

<CardGroup cols={2}>
  <Card title="Browser Automation" icon="browser" href="/sdk/components/automation/browser/direct">
    Direct control, live sessions, recordings
  </Card>

  <Card title="Browser as Agent Tool" icon="robot" href="/sdk/components/automation/browser/tool">
    Add browser to your AI agents
  </Card>
</CardGroup>
