Module 3. Practice: from requirements to automated tests · Lesson 27 of 41 · 16 min
CI/CD for automated tests: GitHub Actions, reports, sharding and publishing results
A pipeline that runs API and UI tests on every pull request, keeps the reports, splits the suite into shards and sends results to QA Tools.
What a pipeline should do
- Build the app.
- Run quick checks (linter, unit).
- Run the API tests.
- Run the UI tests in parallel.
- Keep reports, traces and screenshots as artifacts.
- Block the merge if anything is red.
A minimal workflow
# .github/workflows/tests.yml
name: tests
on: [pull_request]
jobs:
e2e:
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
shard: [1, 2, 3, 4]
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with: { node-version: 22 }
- run: npm ci
- run: npx playwright install --with-deps chromium
- run: npx playwright test --shard=${{ matrix.shard }}/4
env:
BASE_URL: ${{ vars.STAGING_URL }}
QA_USER_PASSWORD: ${{ secrets.QA_USER_PASSWORD }}
- uses: actions/upload-artifact@v4
if: always()
with:
name: report-${{ matrix.shard }}
path: playwright-report
Key points:
- Secrets (test user passwords, tokens) live only in secrets, never in code.
- if: always() — the report is saved even when tests fail, which is exactly when you need it.
- Sharding splits the suite into parts that run in parallel: 20 minutes become 5.
- fail-fast: false — one failed shard doesn't cancel the others, so you see the full picture.
Branch protection
In the repository settings (Branch protection rules), mark the tests job as required — then a PR can't be merged with red tests, even if someone skipped the git hooks.
Results next to manual testing
Automated tests that are visible only in CI are seen only by developers. In QA Tools any runner can send results through the API with a project token — then the release test plan shows manual cases and automated tests side by side:
# 1) create or update a run
curl -X POST https://qatools.space/api/autotests/v1/runs \
-H "Authorization: Bearer $QAT_TOKEN" -H "Content-Type: application/json" \
-d '{"local_id": 128, "environment": "staging", "release": "26.3", "status": "done", "total": 42, "passed": 41, "failed": 1}'
# 2) send the test results for that run
curl -X POST https://qatools.space/api/autotests/v1/runs/RUN_ID/results \
-H "Authorization: Bearer $QAT_TOKEN" -H "Content-Type: application/json" \
-d '{"results": [{"key": "checkout.spec.ts::promo SALE10", "title": "promo code SALE10", "status": "failed", "duration": 5.2, "error": "expected 112.5, received 125"}]}'
Notifications and webhooks
Failures on main should go to the team chat: GitHub Actions has ready-made steps for Slack and Microsoft Teams. The message should include the test name, a link to the report and the author of the last commit.
Nightly and release runs
- On every PR — a fast suite (API + critical UI), under 10 minutes.
- Nightly — full regression on staging (a schedule trigger with cron).
- Before a release — full regression plus a load test of critical endpoints.
Key takeaways
- Reports and traces are always kept as artifacts, especially on failure.
- Sharding and parallelism cut run time several times over.
- A required check in branch protection is a real barrier, unlike local hooks.
Check yourself
1. Why add if: always() to the report upload step?
2. Where should a test user's password for CI be stored?
3. What does --shard=2/4 do?