Tech Notes Documentation

Insights, tutorials, and deep-dives into QA automation and software engineering.

DevOps & CI/CD Last updated: 05 Agustus 2026

Integrating Playwright into CI/CD Pipelines with GitHub Actions & Docker


Running automated tests locally on a laptop is great, but true automation runs inside a CI/CD pipeline every time new code is pushed to the repository.

1. The Role of Docker in Testing

Using Docker ensures that the test runner environment is consistent, whether executed on a developer laptop or in a GitHub Actions cloud runner, preventing the classic "works on my machine" issue.

2. Managing Secrets & Variables

When running automated tests in a CI/CD pipeline, securing sensitive data is a top priority. This is where GitHub Actions Secrets and Variables come in:

  • Secrets: Used to store encrypted sensitive data such as tokens, QA login credentials, or API keys (e.g., STAGING_PASSWORD). Values are securely masked in console logs.
  • Variables: Used for non-sensitive configuration values that can change across environments, such as BASE_URL or target execution flags.
3. GitHub Actions Configuration Example

Here is an example workflow injecting variables and secrets directly into the Docker container runner:

name: Playwright Tests
on:
  push:
    branches: [ main, master ]
jobs:
  test:
    runs-on: ubuntu-latest
    container:
      image: mcr.microsoft.com/playwright:v1.40.0-jammy
    steps:
    - uses: actions/checkout@v3
    - name: Install dependencies
      run: npm ci
    - name: Run Playwright tests
      env:
        BASE_URL: \${{ vars.STAGING_BASE_URL }}
        TEST_USER_PASSWORD: \${{ secrets.STAGING_USER_PASSWORD }}
      run: npx playwright test