Skip to content

Instantly share code, notes, and snippets.

@up1
Last active February 6, 2025 07:11
Show Gist options
  • Save up1/09b30efeb0eed0a529b043a297e4f736 to your computer and use it in GitHub Desktop.
Save up1/09b30efeb0eed0a529b043a297e4f736 to your computer and use it in GitHub Desktop.
Playwright + Prometheus + Grafana
$npx playwright test
[2025-02-05 14:09:43.147 +0700] DEBUG: [PumpoEvents] Loading configuration file from resolved config path /workshop-playwright-2025/monitor-test/config.conf
[2025-02-05 14:09:43.147 +0700] INFO: Adding custom label: environment=ppe
[2025-02-05 14:09:43.147 +0700] INFO: Adding custom label: type=end-to-end
[2025-02-05 14:09:43.156 +0700] INFO: Starting the run with 2 tests.
[2025-02-05 14:09:43.407 +0700] INFO: Starting test "has title_chromium_example.spec.ts"
[2025-02-05 14:09:43.407 +0700] INFO: Starting test "get started link_chromium_example.spec.ts"
[2025-02-05 14:09:44.514 +0700] INFO: Test case name: has title_chromium_example.spec.ts job name undefined
[2025-02-05 14:09:44.514 +0700] INFO: Finished test "has title_chromium_example.spec.ts" with result passed
[2025-02-05 14:09:44.514 +0700] DEBUG: Pushing metric test_execution_total with labels todo,has title,,chromium,ppe,end-to-end,passed to Prometheus
[2025-02-05 14:09:44.514 +0700] DEBUG: Pushing metric test_execution_finish_time with labels todo,has title,,chromium,ppe,end-to-end to Prometheus
[2025-02-05 14:09:44.515 +0700] DEBUG: Pushing metric test_execution_duration_seconds with labels todo,has title,,chromium,ppe,end-to-end to Prometheus
[2025-02-05 14:09:44.670 +0700] INFO: Test case name: get started link_chromium_example.spec.ts job name undefined
[2025-02-05 14:09:44.670 +0700] INFO: Finished test "get started link_chromium_example.spec.ts" with result passed
[2025-02-05 14:09:44.670 +0700] DEBUG: Pushing metric test_execution_total with labels todo,get started link,,chromium,ppe,end-to-end,passed to Prometheus
[2025-02-05 14:09:44.670 +0700] DEBUG: Pushing metric test_execution_finish_time with labels todo,get started link,,chromium,ppe,end-to-end to Prometheus
[2025-02-05 14:09:44.670 +0700] DEBUG: Pushing metric test_execution_duration_seconds with labels todo,get started link,,chromium,ppe,end-to-end to Prometheus
[2025-02-05 14:09:44.688 +0700] INFO: Finished the run: passed
[2025-02-05 14:09:44.689 +0700] DEBUG: Pushing metric suite_execution_finish_time with labels todo,,,ppe,end-to-end to Prometheus
[2025-02-05 14:09:44.689 +0700] DEBUG: Pushing metric suite_execution_duration_seconds with labels todo,,,ppe,end-to-end to Prometheus
[2025-02-05 14:09:44.689 +0700] DEBUG: Pushing metric suite_execution_total with labels todo,,,ppe,end-to-end to Prometheus
[2025-02-05 14:09:44.689 +0700] DEBUG: Pushing metric suite_execution_failed with labels todo,,,ppe,end-to-end to Prometheus
pn5.reporting.enabled="true"
pn5.reporting.prometheus.enabled="true"
pn5.reporting.prometheus.testcases_track="true"
pn5.reporting.prometheus.suite="todo"
pn5.reporting.prometheus.endpoint="http://localhost:9191"
pn5.reporting.prometheus.labels="environment=ppe,type=end-to-end"
import { defineConfig, devices } from '@playwright/test';
export default defineConfig({
testDir: './tests',
reporter: "@pumpo5.dev/playwright-prometheus-reporter",
projects: [
{
name: 'chromium',
use: { ...devices['Desktop Chrome'] },
},
],
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment