Skip to content

CI/CD Integration

Running browser tests with pest-plugin-bridge in CI/CD is the primary use case for this plugin. This section provides modular documentation for GitHub Actions.

How Do I Combine Two Separate Repositories?

The Key Question

If your Laravel API and frontend live in separate repositories, you're probably wondering: "How do I bring them together in CI?"

The answer is simple: GitHub Actions can checkout multiple repositories in a single workflow.

yaml
steps:
  # 1. Checkout your API repo into ./backend
  - uses: actions/checkout@v4
    with:
      path: backend

  # 2. Checkout your frontend repo into ./frontend
  - uses: actions/checkout@v4
    with:
      repository: your-org/frontend-repo
      path: frontend

After this, your directory structure in CI looks like:

$GITHUB_WORKSPACE/
+-- backend/                # Your Laravel API
|   +-- app/
|   +-- tests/Browser/
|   +-- composer.json
+-- frontend/               # Your frontend repo
    +-- src/
    +-- package.json

Then configure Bridge to use the frontend:

php
// backend/tests/Pest.php
Bridge::setDefault('http://localhost:3000')
    ->serve('npm run dev', cwd: '../frontend');

That's it. Both projects are now in the same runner, and pest-plugin-bridge handles starting/stopping servers automatically.

For complete details including private repos and branch synchronization, see Multi-Repository.


How This Section Works

Each page is a standalone module you can combine:

PageWhat It Adds
Basic SetupMinimal working workflow (monorepo, no database)
Multi-RepositorySeparate frontend repository checkout
Manual TriggersRun tests manually with branch/group selection
SQLite DatabaseFile-based SQLite configuration
MySQL DatabaseMySQL service or external connection
CachingSpeed up CI with dependency caching
DebuggingScreenshots, artifacts, troubleshooting
AdvancedMatrix builds, parallel tests, timeouts

Start with Basic Setup, then add modules as needed.

CI Execution Flow

CI EXECUTION FLOWGitHub Actions Runner1. Checkout code (API + Frontend)2. Install PHP + Composer dependencies3. Install Node.js + Playwright browsers4. Install frontend dependencies./vendor/bin/pest tests/BrowserLaravel API starts automatically (in-process)Frontend dev server starts via serve()Playwright runs tests headlessly

Prerequisites

Before setting up CI/CD, ensure you have:

  • A Laravel API project with pest-plugin-bridge installed
  • A frontend project (Nuxt, React, Vue, etc.) in the same repo or separate repo
  • Basic familiarity with GitHub Actions

Repository Structures

Monorepo

my-app/
+-- backend/                    # Laravel API
|   +-- app/
|   +-- tests/
|   |   +-- Browser/
|   +-- composer.json
+-- frontend/                   # Frontend app
|   +-- src/
|   +-- package.json
+-- .github/
    +-- workflows/
        +-- browser-tests.yml

Multi-Repository

your-organization/
+-- api/                        # Laravel API repository
|   +-- tests/Browser/          # Browser tests live here
|   +-- .github/workflows/      # CI runs from API repo
|
+-- frontend/                   # Separate frontend repository
    +-- src/
    +-- package.json

Quick Start

  1. Start with Basic Setup - Get a minimal workflow running
  2. Add Multi-Repository if you have separate repos
  3. Add Manual Triggers for on-demand testing with branch selection
  4. Add SQLite or MySQL for database tests
  5. Add Caching to speed up builds
  6. Add Debugging for failure artifacts

Released under the MIT License.