Playwright Reporter
Configure and use the @stanterprise/playwright-reporter for test observability
Observer integrates with your test frameworks to provide comprehensive test observability. This page covers the available integrations and how to configure them.
The primary way to integrate Observer with your tests is through the @stanterprise/playwright-reporter. This custom reporter sends test execution events to Observer in real-time.
Quick Setup:
npm install @stanterprise/playwright-reporter --save-dev
// playwright.config.ts
import { defineConfig } from "@playwright/test";
export default defineConfig({
reporter: [
["list"],
[
"@stanterprise/playwright-reporter",
{
grpcAddress: "localhost:50051",
},
],
],
});
Key Features:
📖 See the detailed Playwright Reporter guide for complete configuration options and examples.
Integrate Observer with GitHub Actions workflows:
name: E2E Tests
on: [push]
jobs:
test:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/setup-node@v3
with:
node-version: "18"
- name: Install dependencies
run: npm ci
- name: Run Playwright tests
env:
STANTERPRISE_GRPC_ADDRESS: observer.example.com:50051
STANTERPRISE_META_BUILD_ID: ${{ github.run_id }}
STANTERPRISE_META_BRANCH: ${{ github.ref_name }}
STANTERPRISE_META_COMMIT_SHA: ${{ github.sha }}
run: npx playwright test
Configure Observer in GitLab CI:
test:
image: mcr.microsoft.com/playwright:latest
script:
- npm ci
- npx playwright test
variables:
STANTERPRISE_GRPC_ADDRESS: "observer.example.com:50051"
STANTERPRISE_META_BUILD_ID: "$CI_PIPELINE_ID"
STANTERPRISE_META_BRANCH: "$CI_COMMIT_REF_NAME"
STANTERPRISE_META_COMMIT_SHA: "$CI_COMMIT_SHA"
Use Observer in Jenkins pipelines:
pipeline {
agent any
environment {
STANTERPRISE_GRPC_ADDRESS = 'observer.example.com:50051'
STANTERPRISE_META_BUILD_ID = "${BUILD_ID}"
STANTERPRISE_META_BRANCH = "${GIT_BRANCH}"
}
stages {
stage('Test') {
steps {
sh 'npm ci'
sh 'npx playwright test'
}
}
}
}
Run Observer with Docker:
# All-in-One mode (development)
docker run -d \
-p 3000:80 \
-p 50051:50051 \
-v observer-data:/data \
ghcr.io/stanterprise/observer/aio:latest
Deploy Observer on Kubernetes using Helm:
# Add Helm repository
helm install observer oci://ghcr.io/stanterprise/observer/charts/observer --version 0.1.0
# Create service for test clients
kubectl port-forward svc/observer-ingestion 50051:50051
Use Docker Compose for local development:
version: "3.8"
services:
observer:
image: ghcr.io/stanterprise/observer/aio:latest
ports:
- "3000:80"
- "50051:50051"
volumes:
- observer-data:/data
volumes:
observer-data:
Enhance your test runs with custom metadata using environment variables:
# Build information
STANTERPRISE_META_BUILD_ID=12345
STANTERPRISE_META_BUILD_URL=https://ci.example.com/build/12345
# Git information
STANTERPRISE_META_BRANCH=feature/new-feature
STANTERPRISE_META_COMMIT_SHA=abc123def456
STANTERPRISE_META_AUTHOR=john.doe@example.com
# Environment information
STANTERPRISE_META_ENVIRONMENT=staging
STANTERPRISE_META_REGION=us-west-2
# Run your tests
npx playwright test
All metadata with the STANTERPRISE_META_ prefix is automatically included in test run reports.
Observer is built on a distributed architecture:
Control reporter behavior through environment variables:
STANTERPRISE_GRPC_ADDRESS: gRPC server address (default: localhost:50051)STANTERPRISE_GRPC_ENABLED: Enable/disable reporting (default: true)STANTERPRISE_RUN_ID: Custom run ID for aggregating sharded testsConfigure Observer services:
Ingestion Service:
PORT: gRPC listening port (default: 50051)NATS_URL: NATS server URLProcessor Service:
MONGODB_URI: MongoDB connection stringNATS_URL: NATS server URLAPI Service:
PORT: HTTP listening port (default: 8080)MONGODB_URI: MongoDB connection stringNATS_URL: NATS server URL for WebSocket streamingConfigure and use the @stanterprise/playwright-reporter for test observability