Getting Started
Prerequisites
Before you begin, make sure you have:- A GitLab project with CI/CD enabled
- At least one Testpilot test file (
.pilot.yaml
) in your repository - Access to GitLab runners (SaaS or self-hosted)
Step 1: Create Your First Pipeline
Let’s start by creating a simple GitLab CI pipeline that installs Testpilot and runs a test. Create or edit your.gitlab-ci.yml
file in your project root:
Step 2: Commit and Run
Now that you have your pipeline defined, let’s run it:- Save your
.gitlab-ci.yml
file - Commit and push to your GitLab repository
- Navigate to your project’s CI/CD > Pipelines section
- Watch your pipeline run!
testpilot-install-linux-amd64
- Downloads and sets up Testpilotrun-my-tests
- Runs your Testpilot tests
Step 3: View your Artifacts
Theartifacts
section of the job above will preserve a static report of your Testpilot tests,
including images and videos. You can view it by browsing to the Artifacts
section of your Gitlab
project.
Testpilot also generates a JUnit report that can be directly reported to your merge requests
Step 4: Understanding What Happened
The Testpilot component automatically:- Downloaded the Testpilot installer
- Installed Testpilot and its dependencies (Playwright, Node.js)
- Created a
./bin/testpilot
launcher script - Cached everything for faster future runs
- Made Testpilot available to your test job
Platform-Specific Setup
Testpilot supports running your tests on Linux and macOS runners. You can easily configure your pipeline to handle both platforms:Setting Up for Linux (Default)
The component works out-of-the-box with GitLab’s standard Linux runners. No additional configuration needed!Setting Up for macOS
Since macOS runners can’t (currently) run Docker Images directly, they require a slightly different setup. Here’s how to configure your pipeline to use GitLab’s SaaS macOS runners: Step 1: Define your macOS runner configuration at the top of your.gitlab-ci.yml
:
Setting up Custom Runners
If you’re using self-hosted runners, you can configure Testpilot to run on them using a configuration like the followingMulti-Platform Testing
Want to test on both Linux and macOS? Here’s how:Sharding your Tests and Running in Parallel
Testpilot can shard your test files across multiple runners using the--shard
flag, which is
useful for parallelizing and speeding up your test runs. Note that after sharding and running your
tests in parallel, you will probably want to merge the reports back together using
testpilot report merge
.
You can see an example of sharding testpilot files in our
example repo. An example gitlab.yaml file
is below:
Understanding the Component
Behind the Scenes
When you include the Testpilot component, it creates a job that:- Downloads the installer from
https://get.jetify.com/testpilot
- Installs Testpilot and its dependencies (Playwright, Node.js)
- Creates a launcher script at
./bin/testpilot
that handles environment setup - Caches everything so future pipeline runs are faster
- Shares the installation with your test jobs via GitLab artifacts
Component Configuration Options
The component accepts these parameters:Parameter | Required | Default | Description | Example |
---|---|---|---|---|
stage | ✅ Yes | - | Which stage to install Testpilot in | install |
platform | No | linux-amd64 | Target platform | macos , linux-arm64 |
runner-extends | No | - | Custom runner configuration | .macos_saas_runners |
xdg_cache_home | No | .cache | Cache directory location | .custom_cache |
Caching and Performance
Caching Strategy
The component automatically caches:- The Testpilot binary and dependencies
- Your
./bin/testpilot
launcher script
Custom Cache Directory
If you need to change where files are cached:Best Practices Summary
✅ Do:- Always use
needs:
to ensure proper job dependencies - Leverage the built-in caching for faster pipelines
- Use descriptive job names that reflect what you’re testing
- Test on multiple platforms if your application supports them
- Structure your tests in logical directories
- Forget to specify the correct job name in
needs:
- Modify the cache directory unless necessary
- Run tests without waiting for the installation job
- Use the same job name for multiple platforms