The short answer
You do not add a workflow file, and you do not write a script that scrapes the preview URL out of your build logs. TestSprite installs as a GitHub App, listens for the deployment event your pipeline already produces, works out the preview URL from a pattern you define once, runs your tests against it, and posts the result back as a comment on the pull request.
Setup takes about ten minutes, needs admin rights to install a GitHub App, and requires no changes to your repository.
Your pipeline deploys
Vercel builds the pull request and produces a deployment event in GitHub. TestSprite does not build or deploy anything itself.
TestSprite hears the event
The GitHub App receives it, resolves the target URL from your pattern, and starts the run.
Results land on the PR
A comment with pass/fail counts, failing steps, screenshots, and a fix prompt — plus an optional required check that blocks the merge.
Prerequisite: confirm the pull request produces a deployment
TestSprite triggers off a deployment event, so that event has to exist before anything else will work. Open any existing pull request and confirm a deployment is listed with a clickable URL, then open that URL and check the preview environment actually loads.
On Vercel this appears as a bot comment on the pull request listing the project, a Ready status, and a link to the preview. AWS Amplify, Netlify, and self-hosted pipelines that create GitHub deployments all produce the same signal in their own format — what matters is that a deployment exists and its URL is reachable.
Step 1 — connect GitHub to your workspace
This is a one-time setup per workspace. In TestSprite, go to Workspace Settings → Integrations, find the GitHub row, and click Connect. You will be redirected to GitHub to choose the organisation or personal account that owns the repository, then pick All repositories or Only select repositories and click Install & Authorize.
The permissions requested are worth knowing before you approve them:
| Access | Scopes |
|---|---|
| Read | Actions, checks, issues, metadata |
| Read and write | Code, commit statuses, deployments, pull requests |
Write access is used to post test results back to your pull requests and commits. TestSprite does not push commits or modify your workflow files. If your organisation is not listed during installation, you do not have permission to install GitHub Apps for it — an organisation owner needs to approve it.
Step 2 — connect the repository to a project
Open the TestSprite project you want to connect, go to the GitHub Action tab, and click Connect GitHub Action. Then choose how tests should be triggered:
| Trigger | Best for | Where results appear |
|---|---|---|
| Pull request | Catching regressions before merge | A comment on the pull request |
| Push to branch | Testing a shared environment such as staging or dev after every merge | A check on the commit |
One trigger is enough to start. You can create both — they run independently of each other.
Step 3 — pick the event that means "deployment finished"
Select the Pull Request tab, paste the URL of an existing pull request that has a working preview deployment, and click Detect Events. TestSprite lists the CI/CD events it found on that pull request — GitHub Actions checks, bot comments from Vercel or Amplify, workflow runs — and you choose which one starts a run.
Pick the event that fires after the deployment is live and the URL is reachable. This is the single most common way to get the setup wrong: an event that fires at build start will run your tests against a URL that is not up yet, and every test will fail.
Step 4 — fill in the target URL pattern
Every hosting provider names preview URLs differently, so you tell TestSprite how to construct the URL for any given pull request. Five placeholders are available:
| Placeholder | Resolves to |
|---|---|
{pr} | Pull request number |
{branch} | Branch name |
{branch-slug} | Branch name, URL-safe |
{sha} | Full commit SHA |
{short-sha} | Shortened commit SHA |
Match the pattern against a real preview URL, character by character:
| Your preview URLs look like | Enter this pattern |
|---|---|
https://app-git-login-fix-team.vercel.app | https://app-git-{branch-slug}-team.vercel.app |
https://pr-123.example.com | https://pr-{pr}.example.com |
Vercel's default preview hostnames are built from the branch, which is why {branch-slug} is usually the right placeholder there rather than {pr}. If your host generates random subdomains with nothing predictable in them, configure a stable alias URL for the preview environment and use that instead.
A push trigger needs no pattern at all — it runs against the configured URL of whichever TestSprite environment you select, so pick Dev for dev or Production for main.
Step 5 — send a test event before you save
Click Send Test Event. This runs your tests against the sample pull request exactly like a real trigger would, so you can preview the whole flow before committing to it. Wait roughly 30 seconds, then return to the pull request on GitHub — a TestSprite comment appears.
Open the URL in that comment before going any further. Confirm it is reachable and points at the environment you expect. If it is wrong, correct the pattern and send another test event rather than waiting for the next pull request to find out. Once the run completes, TestSprite updates the same comment with the result.
When the test event looks right, click Create Trigger. It appears in the Triggers list marked Active and runs automatically on every future pull request. Two optional toggles are worth setting deliberately:
| Toggle | What it does |
|---|---|
| Include draft PRs | Runs tests on draft pull requests as well as ready-for-review ones |
| Block PR until tests pass | Makes the TestSprite check required, so merges are blocked while tests are failing |
If your preview sits behind Deployment Protection
This is the failure mode that looks like a passing setup. With Vercel's Deployment Protection enabled, every preview URL sits behind an authentication wall, and an external tester receives the login page instead of your application. The tests do not error — they describe a page nobody expected.
The check in Step 5 catches it: open the URL from the TestSprite comment in a private window. If you see a Vercel login screen, protection is on. The two ways forward are to disable protection for the preview environment, or to use Vercel's Protection Bypass for Automation, which generates a secret that Vercel accepts as an x-vercel-protection-bypass query parameter as well as a header. Because the target URL pattern is just a URL, the query-parameter form can be appended to it:
https://app-git-{branch-slug}-team.vercel.app?x-vercel-protection-bypass=YOUR_SECRET
Generate the secret under Project Settings → Deployment Protection → Protection Bypass for Automation. Be deliberate about this one — it stores a bypass secret in a settings field, so disabling protection on preview environments is the cleaner option when your previews contain nothing sensitive.
Reading the result
When a run completes, TestSprite updates its pull request comment — or commit check — with the outcome. The comment is structured, and the last row is the one that matters most if an AI agent wrote the code:
| Section | What it tells you |
|---|---|
| Headline result | How many tests passed, failed, and were blocked |
| Quality score | Computed on the executable subset of your suite. Blocked cases are excluded and reported separately, because they usually indicate a test-environment gap rather than a product regression |
| Failed tests | Each failure expands to show what was expected, what was observed, and a screenshot from the moment of failure |
| Suggested fix prompt | A ready-to-copy prompt describing the likely root cause and fix, intended to be pasted straight into your AI coding agent |
Every result links back to the full report in TestSprite.
Verify your setup
Before you rely on the integration, confirm all five:
The GitHub integration shows as Connected in your workspace
The repository appears inside the project's GitHub Action tab
A trigger is listed and enabled
A test event produced a TestSprite comment (pull request) or check (push)
The URL in that comment or check opens the correct deployed environment
Troubleshooting
Every test fails and the URL does not load
The trigger is firing too early — on a build-start or workflow-start event rather than a deployment-complete one. Edit the trigger and select an event that fires after the environment is live.
The comment shows the wrong URL
Check the URL pattern against a real preview URL character by character. Send another test event after each change rather than waiting for the next pull request.
No events appear on Detect Events
The pull request or branch has no CI/CD events recorded, or the GitHub App does not have access to that repository. Confirm the repository is included in the app installation.
Tests run against a stale environment
Confirm the selected event corresponds to the deployment you intend to test. If a branch has several environments, verify the Environment to test selection matches.
The organisation is not listed
You do not have permission to install GitHub Apps for it. Ask an organisation owner to approve the installation, then return to Step 1.
Tests pass but the app is broken
Check what the preview URL actually served. A protected preview returns a login page that a test can describe without failing.
The command-line alternative
The GitHub App is the right answer when your pipeline already produces deployments. If you would rather drive the run from your own workflow — or you are not on GitHub at all — the open-source TestSprite CLI does the same job from any CI system. It is free to install and Apache-2.0 licensed:
npm install -g @testsprite/testsprite-cli
testsprite setup
Point a project at a URL you have already resolved, and run the suite to a verdict:
testsprite project update prj_abc123 --url "$PREVIEW_URL"
testsprite test run --all --project prj_abc123 --wait --output json
# exit 0 = everything passed, exit 1 = something is broken
testsprite ci init github scaffolds a workflow for this path, and the CLI needs only TESTSPRITE_API_KEY in the environment, so it drops into CircleCI, GitLab, Jenkins, or Azure Pipelines just as easily. Use --report junit --report-file <path> for a sidecar those systems ingest natively.
If the flows you care about live behind your application's own login, store a test account on the project so runs can authenticate. Both flags are required together:
testsprite project update prj_abc123 \
--username qa@example.com \
--password-file ./.secrets/qa-password
Frequently asked questions
Do I need to add a workflow file to my repository?
No. The integration is configured entirely in TestSprite, and no changes to your repository are required.
Does this replace my existing GitHub Actions workflow?
No. TestSprite listens to events your workflow already produces — it does not modify or replace your pipeline.
Which hosting providers are supported?
Any provider that reports a deployment to GitHub and exposes a reachable URL, including Vercel, AWS Amplify, Netlify, and self-hosted pipelines that create GitHub deployments.
Can I have both a pull request trigger and a push trigger?
Yes. Create them separately — they run independently of each other.
What if my preview URLs do not include the pull request number?
The URL pattern field expects a predictable pattern. Vercel's default hostnames are built from the branch, so {branch-slug} is usually the right placeholder. If your host generates random subdomains, configure a stable alias URL for the preview environment and use that instead.
Can the result feed straight into my AI coding agent?
Yes — that is what the Suggested fix prompt section of the comment is for. It is a ready-to-copy prompt describing the likely root cause and fix, written to be pasted into a coding agent. For a fuller loop, testsprite setup --agent claude installs a verification skill so the agent can create, run, and triage tests itself.
How long does setup take?
About ten minutes, and you need admin rights to install a GitHub App on the organisation that owns the repository.
Your pipeline already emits the signal. Listen to it.
Testing a preview deployment does not require a new workflow file, a script that scrapes build logs, or a third-party action to wait for a URL. Your pipeline already produces a deployment event; the work is telling TestSprite which event means "live" and how to build the URL from it. Ten minutes, no repository changes, and every pull request gets checked against a real browser before a human looks at it. For the command-line path, read the reference at docs.testsprite.com and star the open-source CLI on GitHub.