html-reporter
Version:
Html-reporter and GUI for viewing and managing results of a tests run. Currently supports Testplane and Hermione.
98 lines (97 loc) • 3.2 kB
TypeScript
import { TestStatus } from '../constants';
import { ReporterTestResult } from '../adapters/test-result';
import { ErrorDetails, ImageInfoFull } from '../types';
import { TreeTestResultTransformer } from '../adapters/test-result/transformers/tree';
import { DbTestResult } from '../sqlite-client';
export type BaseTreeTestResult = Omit<DbTestResult, 'imagesInfo'> & {
attempt?: number;
errorDetails?: ErrorDetails | null;
};
export interface TreeTestResult extends BaseTreeTestResult {
id: string;
parentId: string;
imageIds: string[];
attempt: number;
}
interface TreeBrowser {
id: string;
name: string;
parentId: string;
resultIds: string[];
version: string;
}
export interface TreeSuite {
status?: TestStatus;
id: string;
parentId: string | null;
name: string;
suitePath: string[];
root: boolean;
suiteIds?: string[];
browserIds?: string[];
}
export type TreeImage = {
id: string;
parentId: string;
} & ImageInfoFull;
export interface Tree {
suites: {
byId: Record<string, TreeSuite>;
allIds: string[];
allRootIds: string[];
};
browsers: {
byId: Record<string, TreeBrowser>;
allIds: string[];
};
results: {
byId: Record<string, TreeTestResult>;
allIds: string[];
};
images: {
byId: Record<string, TreeImage>;
allIds: string[];
};
}
interface ResultPayload {
id: string;
parentId: string;
result: ReporterTestResult;
}
interface BrowserPayload {
id: string;
name: string;
parentId: string;
version: string;
}
interface ImagesPayload {
imagesInfo: ImageInfoFull[];
parentId: string;
}
export interface BaseTestsTreeBuilderOptions {
baseHost?: string;
}
export declare class BaseTestsTreeBuilder {
protected _tree: Tree;
protected _transformer: TreeTestResultTransformer;
static create<T extends BaseTestsTreeBuilder>(this: new (options: BaseTestsTreeBuilderOptions) => T, options?: BaseTestsTreeBuilderOptions): T;
constructor(options?: BaseTestsTreeBuilderOptions);
get tree(): Tree;
sortTree(): void;
addTestResult(formattedResult: ReporterTestResult): void;
protected _buildId(parentId?: string | string[], name?: string | string[]): string;
protected _addSuites(testPath: string[], browserId: string): void;
protected _addSuite(suite: TreeSuite): void;
protected _addNodeId(parentSuiteId: string, nodeId: string, { fieldName }: {
fieldName: 'browserIds' | 'suiteIds';
}): void;
protected _isNodeIdExists(parentSuiteId: string, nodeId: string, { fieldName }: {
fieldName: 'browserIds' | 'suiteIds';
}): boolean;
protected _addBrowser({ id, parentId, name, version }: BrowserPayload, testResultId: string, attempt: number): void;
protected _addResultIdToBrowser(browserId: string, testResultId: string, attempt: number): void;
protected _addResult({ id, parentId, result }: ResultPayload, imageIds: string[]): void;
protected _addImages(imageIds: string[], { imagesInfo, parentId }: ImagesPayload): void;
protected _setStatusForBranch(testPath?: string[]): void;
}
export {};