CI/CD Integration Documentation
This document explains the continuous integration and delivery (CI/CD) pipeline used for running Playwright-based vendor automation tests for HungryHubβs reservation API integrations. The workflow is triggered manually or on schedule, shards test execution, generates Allure reports, and notifies Slack with test summaries.
π Workflow File: Playwright-Tests.yml
Located in
.github/workflows/Playwright-Tests.yml
π§© Trigger Types
| Trigger | Description |
|---|---|
workflow_dispatch | Allows manual trigger via GitHub UI with parameters (env, scenarios, etc.) |
schedule | Automatically runs MondayβFriday at 02:30 UTC (09:30 Bangkok time) |
π§ Manual Inputs (workflow_dispatch)
| Input | Description | Example |
|---|---|---|
env | Target environment to run tests (e.g., ballbot) | ballbot |
scenarios | Specific test files (or all for all tests) | tc-001.spec.ts / all |
triggerFrom | Label to indicate source of trigger (e.g., schedule) | Schedule, Manual |
π¦ Job 1: setup-playwright
π Responsibilities
- Install dependencies & Playwright browsers
- Generate dynamic
restaurantData.jsonfrom API - Upload
src/data/restaurantData.jsonfor use in test steps
π‘ Notable steps
- Cache Playwright browsers for faster setup
- Use
npm run generate-master-datato prepare data per environment - Upload artifact
restaurant-datafor use in next job
π§ͺ Job 2: running-playwright
π Responsibilities
- Download generated data
- Run Playwright tests across 4 shards for parallelism
- Upload Allure results per shard
π Test Command Logic
# If `all` is selected or blank, run all tests with sharding
npx playwright test src/tests --shard X/4 --reporter=allure-playwright
# Else run a specific test file
npx playwright test ${{ github.event.inputs.scenarios }} --shard X/4 --reporter=allure-playwright
π Secrets & Vars
Supports various vendors with secrets like:
HMAC_API_KEY_VENDOR_*BASIC_AUTH_*API_KEY,API_SECRET_KEYBASE_URL,ENV_MODE, etc. All secrets are injected securely via GitHub's secrets & vars.
π Job 3: merge-reports-and-upload
π Responsibilities
- Merge all
allure-results - Generate Allure HTML report
- Upload report to:
- Cloudflare R2 (path includes environment + run number)
- GitHub as artifact (zipped)
- Notify on Slack with summary and link to report
π Allure Stats Parsed
| Metric | Source File |
|---|---|
| Passed | allure-report/widgets/summary.json |
| Failed | β same β |
| Skipped | β same β |
| Broken | β same β |
π€ Slack Notification
Sent via 8398a7/action-slack@v3, includes:
- Trigger source (
ScheduleorManual) - Environment (
ballbot) - Passed/Failed/Broken/Skipped counts
- Link to Cloudflare-hosted report
π Sample Slack Output **End to End Testing Result for Environment ballbot - Trigger From Schedule** - β Passed: 85 - β Failed: 3 - β Skipped: 5 - β Broken: 0 π View Report: https://allure.hh-ballbot.my.id/api/hh-server/ballbot/245
β Key CI/CD Features
| Feature | Description |
|---|---|
| β Manual Run Support | Run individual test scenarios on demand |
| β Scheduled Runs | Ensures regression tests run daily (MonβFri) |
| β Parallel Sharding | Speeds up test execution via 4-way sharding |
| β Allure Reporting | Rich HTML reports with stats, test steps, attachments, and errors |
| β Cloudflare Hosting | Reports are archived and viewable at custom URL |
| β Slack Alerts | Instant visibility on test health |
| β GitHub Caching | Improves performance for dependencies and Playwright browser installs |