# GitLab CI

<div class="view-markdown-wrapper">
<ViewMarkdown />
</div>

Run your Shiplight E2E tests in GitLab CI and upload the results to [Shiplight Cloud](https://app.shiplight.ai). GitLab uses the same `shiplight` CLI as every other provider — only the pipeline syntax differs.

## Before you start

- A scaffolded Shiplight test project (`/shiplight init`). See the [CI/CD overview](/local/ci) for how the pieces fit together.
- An org API token from [app.shiplight.ai/api-tokens](https://app.shiplight.ai/api-tokens), stored as a **masked** CI/CD variable named `SHIPLIGHT_API_TOKEN` (**Settings → CI/CD → Variables**). GitLab injects it into the job automatically.

## Pipeline

Create `.gitlab-ci.yml` at your repository root:

```yaml
e2e:
  image: node:22
  variables:
    SHIPLIGHT_REPORT_TO_CLOUD: "1"
    # SHIPLIGHT_API_TOKEN comes from a masked CI/CD variable — no need to repeat it here.
  script:
    - npm install
    - npx playwright install --with-deps chromium
    - npx shiplight test
  after_script:
    - npx shiplight report # after_script always runs, even when tests fail
```

## Notes

- `SHIPLIGHT_API_TOKEN` and `SHIPLIGHT_REPORT_TO_CLOUD=1` are required on every non-Shiplight runner — they are provided automatically only on [Shiplight-hosted GitHub runners](/local/ci/github-actions).
- With `SHIPLIGHT_API_TOKEN` set, AI-powered actions (natural-language steps, self-healing locators) run through the Shiplight LLM proxy, and healed locators persist to the Shiplight Cloud action cache so later runs replay at full speed.
- Install Chromium yourself (`npx playwright install --with-deps chromium`); no stock image ships it.
- `after_script` runs regardless of whether the tests passed, which is how the upload survives a red run.
- **Not available on GitLab:** Shiplight-hosted runners and [auto-triage](/local/ci/github-actions#auto-triage-ci-failures-optional) — those are GitHub Actions only.
- Project in a subdirectory (e.g. `tests/e2e`)? `cd` into it before each command, or set a `default: { before_script: [cd tests/e2e] }`.

## Related

- [CI/CD overview](/local/ci) · [Custom setups](/local/ci/custom) · [CLI Reference](/local/cli-reference)
