Automate Test Runs on Pull Requests with Shiplight AI in a Jenkins Pipeline

Updated on April 24, 2026

Pull requests are where quality either becomes a fast, repeatable habit or a weekly fire drill. For teams running Jenkins, the good news is you do not need to overhaul your CI stack to get modern, PR-native UI verification. You can keep Jenkins as the system of record for builds and approvals, and use Shiplight AI to make end-to-end and UI regression testing reliable, maintainable, and fast enough to run on every change.

This post walks through a practical pattern for triggering Shiplight test runs automatically on pull request builds in Jenkins, then using those results to gate merges with confidence.

What PR-based UI testing needs to accomplish

PR checks fail for predictable reasons: they take too long, they are flaky, or they require constant maintenance. A useful PR testing workflow should:

  • Start automatically when a pull request is opened or updated.
  • Run the right coverage for the change, not an hour-long suite by default.
  • Produce proof, not just pass/fail. When something fails, the team needs actionable context.
  • Survive UI churn without a full-time “test fixer” role.

Shiplight AI is built around those constraints. It verifies UI changes in real browsers, supports intent-based test execution (so tests are not brittle selector puzzles), and emphasizes near-zero maintenance through self-healing behavior. It also supports triggering runs from CI workflows and reviewing outcomes in live dashboards with reporting designed for teams who need fast decisions.

Where Shiplight fits in a Jenkins PR pipeline

In a standard Jenkins setup, pull requests are typically built using a Multibranch Pipeline (for example, with GitHub or Bitbucket branch source plugins). Jenkins detects a PR event, creates a corresponding build, and runs your Jenkinsfile.

Shiplight slots into that flow as the PR-level “browser proof” step:

  1. Jenkins builds the PR commit and runs unit tests as usual.
  2. Jenkins triggers a Shiplight run (often a targeted suite for PRs).
  3. Shiplight executes tests in real browsers (optionally in parallel via cloud runners).
  4. Jenkins gates the PR based on the Shiplight outcome, while Shiplight provides the deep debugging and run-level reporting.

The key advantage is separation of concerns: Jenkins orchestrates and enforces policy; Shiplight specializes in UI verification and keeping tests stable as the product evolves.

A Jenkinsfile pattern for pull request test automation

Below is a clean, production-style pattern you can adapt. It uses Jenkins Declarative Pipeline features to run Shiplight only for pull requests, while keeping a different path for main branch builds.

A few notes before the snippet:

  • Store secrets in Jenkins credentials, then inject them as environment variables.
  • Use PR-aware conditions. In Declarative Pipeline, when { changeRequest() } is designed for this use case.
  • Treat Shiplight as an external quality gate. Your pipeline should fail when Shiplight fails, and link engineers to the Shiplight run for debugging.

pipeline {
agent any

options {
timestamps()
ansiColor('xterm')
}

environment {
// Example: store these in Jenkins credentials and inject safely.
// SHIPLIGHT_API_TOKEN = credentials('shiplight-api-token')
// SHIPLIGHT_PROJECT_ID = '...'
}

stages {
stage('Checkout') {
steps {
checkout scm
}
}

stage('Build and Unit Tests') {
steps {
sh '''
set -e
./gradlew test
'''
}
}

stage('Shiplight PR UI Verification') {
when {
changeRequest()
}
steps {
sh '''
set -e

echo "Triggering Shiplight run for PR validation..."
echo "Tip: pass commit SHA and PR metadata so results map cleanly to the change."

# Example placeholder:
# Call Shiplight using your preferred integration method (API/CLI),
# then wait for completion and return a non-zero exit code on failure.
#
# Replace the lines below with the Shiplight trigger you use in your org.
#
# curl -sS -X POST "https://<your-shiplight-endpoint>/runs" \
# -H "Authorization: Bearer $SHIPLIGHT_API_TOKEN" \
# -H "Content-Type: application/json" \
# -d '{
# "projectId": "'"$SHIPLIGHT_PROJECT_ID"'",
# "commitSha": "'"$GIT_COMMIT"'",
# "suite": "pr-smoke"
# }'

echo "Shiplight run triggered (placeholder)."
echo "Wait/poll for completion here, then fail the build if Shiplight reports failures."
'''
}
}

stage('Main Branch Regression') {
when {
branch 'main'
}
steps {
sh '''
set -e
echo "Run broader regression coverage for main (placeholder)."
'''
}
}
}

post {
always {
echo "Publish artifacts, test reports, or links to Shiplight run details here."
}
}
}

This is intentionally conservative about implementation details: the exact trigger mechanism depends on how your team has connected Shiplight (API, CLI, or a dedicated integration step). The important part is the shape of the pipeline: PR builds run a fast, high-signal UI suite; main merges get broader coverage.

Making PR runs fast without cutting coverage

PR-based testing lives and dies on cycle time. Shiplight enables a more practical approach than “run everything, always”:

  • Run a PR smoke suite by default. Keep it short and tied to the critical path: login, core navigation, primary flows.
  • Add risk-based expansion when needed. If a PR touches checkout, pricing, auth, or other high-risk surfaces, automatically broaden the suite.
  • Leverage intent-based execution and self-healing to reduce flakes. If tests break every time the UI shifts, teams stop trusting PR checks. The goal is to spend time fixing product issues, not patching selectors.
  • Parallelize when suites grow. Cloud execution with isolated containers lets you keep PR feedback tight even as coverage scales.

If you want PR checks to be meaningful, they need to be consistent. Speed matters, but stability matters more.

Turning Shiplight results into an enforceable merge gate

The cleanest operational model is:

  • Jenkins is the policy engine: “This PR cannot merge unless Shiplight passes.”
  • Shiplight is the truth source for UI evidence: real browser runs, failure context, and run-level reporting.

In practice, teams typically implement:

  • A hard failure in Jenkins if the Shiplight run fails.
  • A single link from the Jenkins build to the Shiplight run so reviewers can see what happened immediately.
  • A brief summary surfaced in the PR conversation, with deeper debugging in Shiplight.

This division keeps PR reviews focused. Reviewers do not need to interpret logs. They need to know whether the change is safe, and where to look if it is not.

Why teams choose Shiplight for PR automation in Jenkins

You can bolt UI testing onto Jenkins with almost any framework. The difference is what happens in week six, when the UI has evolved and your PR checks either keep up or collapse under maintenance.

Shiplight is designed to make PR-based UI verification a sustainable habit:

  • Tests are created and refined in a way that maps to user intent, not brittle selectors.
  • Self-healing behavior reduces the day-to-day cost of UI change.
  • Real-browser verification produces evidence you can trust during code review.
  • Reporting and summaries help teams act quickly, without drowning in CI noise.

If your Jenkins PR checks are currently green but not credible, or credible but too slow to run on every pull request, Shiplight gives you a path to both speed and proof, without rebuilding your CI foundation.