html-reporter
Version:
Html-reporter and GUI for viewing and managing results of a tests run. Currently supports Testplane and Hermione.
83 lines (82 loc) • 2.9 kB
TypeScript
import { TestCase as PlaywrightTestCase, TestResult as PlaywrightTestResult } from '@playwright/test/reporter';
import { ReporterTestResult } from './index';
import { TestStatus } from '../../constants';
import { Attachment, ErrorDetails, ImageFile, ImageInfoFull, TestError, TestStepCompressed } from '../../types';
import type { CoordBounds } from 'looks-same';
export type PlaywrightAttachment = PlaywrightTestResult['attachments'][number] & {
relativePath?: string;
size?: {
width: number;
height: number;
};
isUpdated?: boolean;
};
type ExtendedError<T> = TestError & {
meta?: T & {
type: string;
};
};
export type PwtImageDiffError = ExtendedError<{
snapshotName: string;
diffClusters: CoordBounds[];
}>;
export type PwtNoRefImageError = ExtendedError<{
snapshotName: string;
}>;
export type PlaywrightImageFile = ImageFile & {
relativePath: string;
};
export declare enum PwtTestStatus {
PASSED = "passed",
FAILED = "failed",
TIMED_OUT = "timedOut",
INTERRUPTED = "interrupted",
SKIPPED = "skipped"
}
export declare enum ImageTitleEnding {
Expected = "-expected.png",
Actual = "-actual.png",
Diff = "-diff.png",
Previous = "-previous.png"
}
export interface TestResultWithGuiStatus extends Omit<PlaywrightTestResult, 'status'> {
status: PlaywrightTestResult['status'] | TestStatus.RUNNING | TestStatus.UPDATED;
}
export declare const DEFAULT_DIFF_OPTIONS: {
diffColor: string;
};
export declare const getStatus: (result: TestResultWithGuiStatus) => TestStatus;
export declare class PlaywrightTestResultAdapter implements ReporterTestResult {
private readonly _testCase;
private readonly _testResult;
private _attempt;
static create<T extends PlaywrightTestResultAdapter>(this: new (testCase: PlaywrightTestCase, testResult: PlaywrightTestResult, attempt: number) => T, testCase: PlaywrightTestCase, testResult: PlaywrightTestResult, attempt: number): T;
constructor(testCase: PlaywrightTestCase, testResult: PlaywrightTestResult, attempt: number);
get attempt(): number;
get browserId(): string;
get description(): string | undefined;
get error(): TestError | undefined;
get errorDetails(): ErrorDetails | null;
get file(): string;
get fullName(): string;
get history(): TestStepCompressed[];
get id(): string;
get imageDir(): string;
get imagesInfo(): ImageInfoFull[];
get meta(): Record<string, unknown>;
get multipleTabs(): boolean;
get screenshot(): ImageFile | null;
get sessionId(): string;
get skipReason(): string;
get state(): {
name: string;
};
get status(): TestStatus;
get testPath(): string[];
get timestamp(): number;
get url(): string;
private get _attachmentsByState();
get duration(): number;
get attachments(): Attachment[];
}
export {};