UNPKG

@testmonitor/playwright-reporter

Version:

The TestMonitor Playwright Reporter is a custom Playwright reporter that automatically sends your test results to TestMonitor.

62 lines (58 loc) 1.54 kB
import { Reporter, FullConfig, Suite, FullResult } from '@playwright/test/reporter'; interface Configuration { domain: string; token: string; milestoneId?: number; milestoneName?: string; testEnvironmentId?: number; } /** * Playwright reporter that sends test results to TestMonitor. * * Implements the Playwright `Reporter` interface and hooks into * the test lifecycle to report execution results to TestMonitor's API. */ declare class PlaywrightReporter implements Reporter { /** * TestMonitor reporter instance responsible for API communication. */ private reporter; /** * Root Playwright test suite. */ private suite; /** * TestMonitor report instance. */ private report; /** * Console logger. */ private logger; /** * Progress spinner. */ private spinner; /** * Test statuses for which attachments should be uploaded. */ private attachmentStatuses; /** * @param config */ constructor(config: Configuration); /** * Called at the start of the test run. * Creates a new report in TestMonitor and stores the test suite. * @param _config * @param suite */ onBegin(_config: FullConfig, suite: Suite): Promise<void>; /** * Called at the end of the test run. * Sends all test results to TestMonitor and logs the outcome. * @param result */ onEnd(result: FullResult): Promise<void>; } export { PlaywrightReporter as default };