Keyboard shortcuts

Press ← or β†’ to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

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

TriggerDescription
workflow_dispatchAllows manual trigger via GitHub UI with parameters (env, scenarios, etc.)
scheduleAutomatically runs Monday–Friday at 02:30 UTC (09:30 Bangkok time)

πŸ”§ Manual Inputs (workflow_dispatch)

InputDescriptionExample
envTarget environment to run tests (e.g., ballbot)ballbot
scenariosSpecific test files (or all for all tests)tc-001.spec.ts / all
triggerFromLabel to indicate source of trigger (e.g., schedule)Schedule, Manual

πŸ“¦ Job 1: setup-playwright

πŸ›  Responsibilities

  • Install dependencies & Playwright browsers
  • Generate dynamic restaurantData.json from API
  • Upload src/data/restaurantData.json for use in test steps

πŸ’‘ Notable steps

  • Cache Playwright browsers for faster setup
  • Use npm run generate-master-data to prepare data per environment
  • Upload artifact restaurant-data for 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_KEY
  • BASE_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

MetricSource File
Passedallure-report/widgets/summary.json
Failedβ€” same β€”
Skippedβ€” same β€”
Brokenβ€” same β€”

πŸ“€ Slack Notification

Sent via 8398a7/action-slack@v3, includes:

  • Trigger source (Schedule or Manual)
  • 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

FeatureDescription
βœ… Manual Run SupportRun individual test scenarios on demand
βœ… Scheduled RunsEnsures regression tests run daily (Mon–Fri)
βœ… Parallel ShardingSpeeds up test execution via 4-way sharding
βœ… Allure ReportingRich HTML reports with stats, test steps, attachments, and errors
βœ… Cloudflare HostingReports are archived and viewable at custom URL
βœ… Slack AlertsInstant visibility on test health
βœ… GitHub CachingImproves performance for dependencies and Playwright browser installs