CI/CD Integration Guide
socialseed-e2e is designed to be CI-native, providing ready-to-use templates for all major platforms. This guide explains how to set up and customize your CI/CD pipelines.
Automatic Setup
The easiest way to integrate socialseed-e2e into your CI/CD pipeline is using the setup-ci command:
e2e setup-ci <platform> [--force]
Supported Platforms
github: Generates GitHub Actions workflows in.github/workflows/gitlab: Generates.gitlab-ci.ymljenkins: Generates aJenkinsfileazure: Generatesazure-pipelines.ymlcircleci: Generates.circleci/config.ymltravis: Generates.travis.ymlbitbucket: Generatesbitbucket-pipelines.ymlall: Generates templates for all of the above
GitHub Actions Workflows
When you run e2e setup-ci github, three workflows are created:
e2e-basic.yml: A simple workflow that runs all tests on every push and pull request.
e2e-parallel.yml: Uses the framework’s built-in parallel execution (
--parallel auto).e2e-matrix.yml (Recommended for Microservices):
Dynamic Discovery: Automatically detects services in your project.
Matrix Strategy: Creates a separate job for each service, running them in isolation.
Reporting: Aggregates results and uploads artifacts for each service.
Key Features in Templates
1. Smart Caching
All templates include caching for pip and Playwright browsers to significantly reduce execution time.
2. Artifact Management
Templates are pre-configured to save the .e2e/reports/ directory as a build artifact. This allows you to view the HTML test report directly from your CI platform.
3. Parallel Execution
The templates utilize the framework’s parallel capabilities:
--parallel auto: Uses all available CPU cores.--parallel-mode test: Runs individual test modules in parallel (best for large test suites).--parallel-mode service: Runs different services in parallel.
4. Headless Execution
socialseed-e2e and Playwright are configured to run headlessly by default in these templates, making them compatible with standard CI runners (Ubuntu, Debian, etc.).
Customizing Your Pipeline
Environment Variables
Most CI systems allow you to define secrets. You can pass these to your tests via environment variables in the workflow files:
# Example in GitHub Actions
- name: Run E2E Tests
run: e2e run
env:
API_KEY: ${{ secrets.API_KEY }}
BASE_URL: https://staging.api.example.com
Notifications
The templates include placeholders for Slack or Teams notifications. For GitHub Actions, we include a step using 8398a7/action-slack which requires a SLACK_WEBHOOK_URL secret.
Best Practices
Use isolation: Leverage the Matrix strategy for microservice architectures to pinpoint which service failed.
Retain artifacts: Keep test reports for at least 30 days to debug intermittent failures.
Schedule runs: Use the
scheduletrigger (cron) ine2e-matrix.ymlto run full regression suites daily.Health checks: Ensure your services are up before running tests. The framework handles this if
health_endpointis configured ine2e.conf.