Files
alighasami 3d5eaf9445
Security: Sync from Public / sync-from-public (push) Has been cancelled
Test: Benchmark Nightly / build (push) Has been cancelled
Test: Benchmark Nightly / Notify Cats on failure (push) Has been cancelled
CI: Python / Checks (push) Has been cancelled
Test: Evals Python / Workflow Comparison Python (push) Has been cancelled
Util: Check Docs URLs / check-docs-urls (push) Has been cancelled
Test: Visual Storybook / Cloudflare Pages (push) Has been cancelled
Test: E2E Performance / build-and-test-performance (push) Has been cancelled
Test: Workflows Nightly / Run Workflow Tests (push) Has been cancelled
Util: Cleanup CI Docker Images / Delete stale CI images (push) Has been cancelled
Test: Benchmark Destroy Env / build (push) Has been cancelled
Util: Update Node Popularity / update-popularity (push) Has been cancelled
Test: E2E Coverage Weekly / Coverage Tests (push) Has been cancelled
first commit
2026-03-17 16:22:57 +03:30

1.7 KiB

Metrics Reporter Usage

Automatically collect performance metrics from Playwright tests and send them to a Webhook.

Setup

export QA_PERFORMANCE_METRICS_WEBHOOK_URL=https://your-webhook-endpoint.com/metrics
export QA_PERFORMANCE_METRICS_WEBHOOK_USER=username
export QA_PERFORMANCE_METRICS_WEBHOOK_PASSWORD=password

Attach Metrics in Tests

Option 1: Helper function (recommended)

import { attachMetric } from '../../utils/performance-helper';

await attachMetric(testInfo, 'memory-usage', 1234567, 'bytes');

Option 2: Direct attach

await testInfo.attach('metric:memory-usage', {
  body: JSON.stringify({ value: 1234567, unit: 'bytes' })
});

What Gets Sent to BigQuery

{
  "test_name": "My performance test",
  "metric_name": "memory-usage",
  "metric_value": 1234567,
  "metric_unit": "bytes",
  "git_commit": "abc123...",
  "git_branch": "main",
  "timestamp": "2025-08-29T..."
}

Data Pipeline

Playwright Testn8n WebhookBigQuery Table

The n8n workflow that processes the metrics is here: https://internal.users.n8n.cloud/workflow/zSRjEwfBfCNjGXK8

BigQuery Schema

{
  "fields": [
    {"name": "test_name", "type": "STRING", "mode": "REQUIRED"},
    {"name": "metric_name", "type": "STRING", "mode": "REQUIRED"},
    {"name": "metric_value", "type": "FLOAT", "mode": "REQUIRED"},
    {"name": "metric_unit", "type": "STRING", "mode": "REQUIRED"},
    {"name": "git_commit", "type": "STRING", "mode": "REQUIRED"},
    {"name": "git_branch", "type": "STRING", "mode": "REQUIRED"},
    {"name": "timestamp", "type": "TIMESTAMP", "mode": "REQUIRED"}
  ]
}

That's it! Metrics are automatically collected and sent when you attach them to tests.