UNPKG

playwright-custom-reporter

Version:

A custom Playwright reporter.

71 lines (54 loc) 1.66 kB
# Playwright Custom Reporter A custom Playwright reporter that provides a clean and focused test output. This reporter is designed to show detailed results for your Playwright tests in a structured and readable format, excluding any extra logs or irrelevant information. ## Features - Displays test results in a clean format. - Shows detailed error information for failed tests, including: - Error message - Locator details - Expected vs. received values - Stack trace (filtered for readability) - Suitable for debugging Playwright test failures. ## Installation Install the package via NPM: ```bash npm install playwright-custom-reporter ``` ## Usage To use the custom reporter, add it to your Playwright configuration file (playwright.config.js): ``` import { defineConfig } from '@playwright/test'; export default defineConfig({ reporter: [ ['playwright-custom-reporter'] ] }); ``` Then, run your Playwright tests as usual: ``` npx playwright test ``` ## Example Output Here’s an example of the output generated by this custom reporter: ``` Running: Contact Page Submission Passed: Contact Page Submission --- Running: Homepage Critical Elements Passed: Homepage Critical Elements --- Running: User Login and Profile Update Failed: User Login and Profile Update --- Error Details: Message: Error: Timed out 5000ms waiting for expect(locator).toBeVisible() Stack Trace: Expected: visible Received: <element(s) not found> --- Running: Shop Add to Cart and Checkout Passed: Shop Add to Cart and Checkout --- Finished the test run. Status: failed ``` ## License This project is licensed under the MIT License.