Playwright Test Logs Reporter

1.0.1 · active · verified Tue Apr 21

pw-test-logs-reporter is a specialized Playwright test reporter designed to automatically send details of failed test cases to a configurable external API endpoint. Currently at version 1.0.1, this package offers a simple, purpose-built solution for integrating Playwright's test results into external logging or incident management systems, with a specific focus on capturing and reporting only test failures. It integrates directly into Playwright's configuration via a string reference in the `reporter` array, and requires the `FAILED_TEST_RESULTS_ENDPOINT` environment variable to be set for operation. Its release cadence is likely stable and infrequent, given its targeted functionality. It differentiates itself by its singular focus on failed tests and straightforward API reporting, providing a lean alternative to more comprehensive, all-encompassing reporting solutions.

Common errors

Warnings

Install

Imports

Quickstart

This configuration shows how to add `pw-test-logs-reporter` to your Playwright test setup, alongside the standard 'list' reporter. It sets up a basic Playwright project and emphasizes the critical `FAILED_TEST_RESULTS_ENDPOINT` environment variable.

import { defineConfig } from '@playwright/test';

const FAILED_ENDPOINT = process.env.FAILED_TEST_RESULTS_ENDPOINT ?? 'http://localhost:8080/api/failed-tests';

// playwright.config.ts
const config = defineConfig({
  testDir: './tests', // Specify your test directory
  reporter: [
    ["list"], // Standard list reporter
    ["pw-test-logs-reporter"]
  ],
  use: {
    // Base URL to use in actions like `await page.goto('/')`.
    baseURL: 'http://127.0.0.1:3000',
    trace: 'on-first-retry',
  },
  projects: [
    {
      name: 'chromium',
      use: {
        browserName: 'chromium',
      },
    }
  ]
});

export default config;

view raw JSON →