Menu

CI CD Integration

Viktor Fási

CI/CD Integration

Lastest integrates with CI/CD pipelines via the CLI runner and a reusable GitHub Action.

Development & Review Flow

End-to-end view: code push → PR → CI/CD pipeline → preview env or staging → Lastest visual validation → manager review → approve & merge or request changes.


CLI Test Runner

Run visual regression tests from the command line:

pnpm test:visual --repo-id <id> [options]

Options

Flag Description Default
--repo-id <id> Repository ID (required) -
--base-url <url> Override target URL http://localhost:3000
--headless Run in headless mode true
--no-headless Run with visible browser -
--output-dir <dir> Screenshot output directory ./test-output

Example: GitHub Actions with CLI

- name: Run Visual Tests
  run: pnpm test:visual --repo-id ${{ env.REPO_ID }} --base-url http://localhost:3000
  env:
    REPO_ID: your-repo-id

The runner automatically captures GITHUB_HEAD_REF, GITHUB_REF_NAME, and GITHUB_SHA for git tracking.


GitHub Action (Reusable)

Zero-config CI/CD integration. No local Playwright install needed -- tests run on your Lastest server via a remote runner.

- name: Run visual regression tests
  uses: las-team/lastest/action@main
  with:
    server-url: ${{ secrets.LASTEST_SERVER_URL }}
    runner-token: ${{ secrets.LASTEST_RUNNER_TOKEN }}
    timeout: '300'
    fail-on-changes: 'false'

Inputs

Input Description Required Default
server-url Lastest server URL Yes -
runner-token Runner authentication token Yes -
timeout Build completion timeout (seconds) No 300
fail-on-changes Fail when visual changes detected No false

Outputs

Output Description
status Build status (passed, failed, review_required, safe_to_merge, blocked)
build-url Link to build results in Lastest
changed-count Number of visual changes detected
passed-count Number of passed tests
failed-count Number of failed tests
total-tests Total number of tests run

Results are automatically posted to the GitHub Actions step summary.

Setup

  1. Register a remote runner in Lastest (Settings > Runners)
  2. Copy the runner token
  3. Add LASTEST_SERVER_URL and LASTEST_RUNNER_TOKEN as GitHub repository secrets
  4. Add the action to your workflow

Smart Run

Run only tests affected by your code changes:

  1. Requires a GitHub or GitLab connection
  2. Select a feature branch (not main/master)
  3. Lastest compares against the default branch via the API
  4. Tests are matched to changed files by URL patterns and code references
  5. Only affected tests run

This dramatically reduces CI time for large test suites.


Webhook-Triggered Builds

Configure webhooks in GitHub or GitLab to trigger builds automatically:

GitHub

  1. Connect your GitHub account in Settings
  2. Enable webhooks for your repository
  3. Builds trigger on PR open/update/push

GitLab

  1. Connect your GitLab account in Settings
  2. Enable webhooks for your project
  3. Builds trigger on MR open/update/push

Results are posted back as PR/MR comments automatically.


Related

Wiki: GitHub Integration
Wiki: Home
Wiki: Running Tests
Wiki: Scheduled Runs
Wiki: _Sidebar

MongoDB Logo MongoDB