playwright-testmo-reporter
Version:
A Playwright Reporter for the Testmo SaaS.
73 lines (70 loc) • 2.42 kB
text/typescript
import { Reporter, FullConfig, Suite } from '@playwright/test/reporter';
type TestStepCategory = "hook" | "expect" | "pw:api" | "test.step" | "fixture";
type AttachmentBasePathCallback = (basePath: string) => string;
interface TestmoReporterOptions {
/**
* Path where to save the JUnit XML file.
* @default "testmo.xml"
*/
outputFile?: string;
/**
* Embed browser type as property in the JUnit XML file.
* @default false
*/
embedBrowserType?: boolean;
/**
* Embed test steps as properties in the JUnit XML file.
* @default true
*/
embedTestSteps?: boolean;
/**
* Embed assertions as steps in the JUnit XML file.
* @default ["hook","expect","pw:api","test.step"]
*/
testStepCategories?: TestStepCategory[];
/**
* How many levels deep to report test titles.
* @default 1
*/
testTitleDepth?: number;
/**
* Include test sub fields in the JUnit XML file.
* @default false
*/
includeTestSubFields?: boolean;
/**
* Function which returns an overridden path.
*/
attachmentBasePathCallback?: AttachmentBasePathCallback;
}
declare class TestmoReporter implements Reporter {
private readonly outputFile;
private readonly embedBrowserType;
private readonly embedTestSteps;
private readonly testStepCategories;
private readonly testTitleDepth;
private readonly includeTestSubFields;
private readonly attachmentBasePathCallback?;
private config;
private suite;
private timestamp;
private startTime;
private totalTests;
private totalFailures;
private totalSkipped;
constructor({ outputFile, embedBrowserType, embedTestSteps, testStepCategories, testTitleDepth, includeTestSubFields, attachmentBasePathCallback, }?: TestmoReporterOptions);
onBegin(config: FullConfig, suite: Suite): void;
onEnd(): void;
private _buildTestSuite;
private _buildTestCase;
private addAttachmentsToProperties;
private addAnnotationsToProperties;
private addStepsToProperties;
private createStepProperty;
private createStepHtml;
private getStepTitleAndBodyFromStep;
private addBrowserToProperties;
printsToStdio(): boolean;
getExactTime(): number;
}
export { type AttachmentBasePathCallback, type TestStepCategory, TestmoReporter, type TestmoReporterOptions, TestmoReporter as default };