html-reporter 11.1.1 → 11.2.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (88) hide show
  1. package/build/lib/gui/index.js +0 -3
  2. package/build/lib/gui/index.js.map +1 -1
  3. package/build/lib/gui/listen-with-fallback.d.ts +12 -0
  4. package/build/lib/gui/listen-with-fallback.js +57 -0
  5. package/build/lib/gui/listen-with-fallback.js.map +1 -0
  6. package/build/lib/gui/routes/plugins.js +2 -1
  7. package/build/lib/gui/routes/plugins.js.map +1 -1
  8. package/build/lib/gui/server.js +15 -7
  9. package/build/lib/gui/server.js.map +1 -1
  10. package/build/lib/static/203.min.js +1 -0
  11. package/build/lib/static/23.min.js +1 -1
  12. package/build/lib/static/299.min.js +1 -0
  13. package/build/lib/static/326.min.js +1 -0
  14. package/build/lib/static/373.min.css +1 -0
  15. package/build/lib/static/373.min.js +1 -0
  16. package/build/lib/static/641.min.js +1 -1
  17. package/build/lib/static/864.min.css +1 -0
  18. package/build/lib/static/864.min.js +1 -0
  19. package/build/lib/static/gui.html +1 -1
  20. package/build/lib/static/gui.min.js +1 -1
  21. package/build/lib/static/index.html +1 -1
  22. package/build/lib/static/modules/utils/pluginMiddlewareRoute.d.ts +2 -0
  23. package/build/lib/static/modules/utils/pluginMiddlewareRoute.js +12 -0
  24. package/build/lib/static/modules/utils/pluginMiddlewareRoute.js.map +1 -0
  25. package/build/lib/static/new-ui-gui.html +1 -1
  26. package/build/lib/static/new-ui-report.html +1 -1
  27. package/build/lib/static/newGui.min.js +1 -1
  28. package/build/lib/static/newReport.min.js +1 -1
  29. package/build/lib/static/report.min.js +1 -1
  30. package/build/package.json +21 -4
  31. package/package.json +21 -4
  32. package/plugins-sdk/build/lib/static/new-ui/constants/plugins.d.ts +4 -0
  33. package/plugins-sdk/build/lib/static/new-ui/constants/plugins.d.ts.map +1 -0
  34. package/plugins-sdk/build/lib/static/new-ui/constants/plugins.js +8 -0
  35. package/plugins-sdk/build/lib/static/new-ui/constants/plugins.js.map +1 -0
  36. package/plugins-sdk/build/plugins-sdk/index.d.ts +5 -0
  37. package/plugins-sdk/build/plugins-sdk/index.d.ts.map +1 -0
  38. package/plugins-sdk/build/plugins-sdk/index.js +6 -0
  39. package/plugins-sdk/build/plugins-sdk/index.js.map +1 -0
  40. package/plugins-sdk/build-ui/lib/adapters/test-result/index.d.ts +33 -0
  41. package/plugins-sdk/build-ui/lib/adapters/test-result/sqlite.d.ts +34 -0
  42. package/plugins-sdk/build-ui/lib/adapters/test-result/transformers/db.d.ts +11 -0
  43. package/plugins-sdk/build-ui/lib/adapters/test-result/transformers/tree.d.ts +11 -0
  44. package/plugins-sdk/build-ui/lib/common-utils.d.ts +57 -0
  45. package/plugins-sdk/build-ui/lib/constants/browser.d.ts +6 -0
  46. package/plugins-sdk/build-ui/lib/constants/checked-statuses.d.ts +10 -0
  47. package/plugins-sdk/build-ui/lib/constants/database.d.ts +105 -0
  48. package/plugins-sdk/build-ui/lib/constants/defaults.d.ts +3 -0
  49. package/plugins-sdk/build-ui/lib/constants/diff-modes.d.ts +41 -0
  50. package/plugins-sdk/build-ui/lib/constants/errors.d.ts +3 -0
  51. package/plugins-sdk/build-ui/lib/constants/features.d.ts +12 -0
  52. package/plugins-sdk/build-ui/lib/constants/group-tests.d.ts +7 -0
  53. package/plugins-sdk/build-ui/lib/constants/index.d.ts +14 -0
  54. package/plugins-sdk/build-ui/lib/constants/local-storage.d.ts +9 -0
  55. package/plugins-sdk/build-ui/lib/constants/paths.d.ts +3 -0
  56. package/plugins-sdk/build-ui/lib/constants/plugin-events.d.ts +6 -0
  57. package/plugins-sdk/build-ui/lib/constants/save-formats.d.ts +3 -0
  58. package/plugins-sdk/build-ui/lib/constants/test-statuses.d.ts +41 -0
  59. package/plugins-sdk/build-ui/lib/constants/tests.d.ts +5 -0
  60. package/plugins-sdk/build-ui/lib/constants/tool-names.d.ts +5 -0
  61. package/plugins-sdk/build-ui/lib/constants/view-modes.d.ts +9 -0
  62. package/plugins-sdk/build-ui/lib/db-utils/common.d.ts +39 -0
  63. package/plugins-sdk/build-ui/lib/db-utils/migrations.d.ts +5 -0
  64. package/plugins-sdk/build-ui/lib/db-utils/server.d.ts +17 -0
  65. package/plugins-sdk/build-ui/lib/errors/index.d.ts +43 -0
  66. package/plugins-sdk/build-ui/lib/local-image-file-saver.d.ts +2 -0
  67. package/plugins-sdk/build-ui/lib/plugin-api.d.ts +41 -0
  68. package/plugins-sdk/build-ui/lib/server-utils.d.ts +70 -0
  69. package/plugins-sdk/build-ui/lib/sqlite-client.d.ts +60 -0
  70. package/plugins-sdk/build-ui/lib/static/modules/local-storage-wrapper.d.ts +22 -0
  71. package/plugins-sdk/build-ui/lib/static/modules/plugins-sdk-ui.d.ts +3 -0
  72. package/plugins-sdk/build-ui/lib/static/modules/plugins-sdk-ui.js +1 -0
  73. package/plugins-sdk/build-ui/lib/static/modules/static-image-accepter.d.ts +47 -0
  74. package/plugins-sdk/build-ui/lib/static/new-ui/components/PanelSection/index.d.ts +8 -0
  75. package/plugins-sdk/build-ui/lib/static/new-ui/features/suites/components/SuitesPage/types.d.ts +33 -0
  76. package/plugins-sdk/build-ui/lib/static/new-ui/types/index.d.ts +4 -0
  77. package/plugins-sdk/build-ui/lib/static/new-ui/types/store.d.ts +320 -0
  78. package/plugins-sdk/build-ui/lib/tests-tree-builder/base.d.ts +91 -0
  79. package/plugins-sdk/build-ui/lib/tests-tree-builder/static.d.ts +51 -0
  80. package/plugins-sdk/build-ui/lib/types.d.ts +315 -0
  81. package/build/lib/static/194.min.js +0 -1
  82. package/build/lib/static/210.min.css +0 -1
  83. package/build/lib/static/210.min.js +0 -1
  84. package/build/lib/static/556.min.css +0 -1
  85. package/build/lib/static/556.min.js +0 -1
  86. package/build/lib/static/825.min.js +0 -1
  87. package/build/lib/static/971.min.js +0 -1
  88. /package/build/lib/static/{825.min.css → 299.min.css} +0 -0
@@ -0,0 +1,43 @@
1
+ import { CoordBounds } from 'looks-same';
2
+ import { DiffOptions, ImageFile } from '../types';
3
+ import type { ValueOf } from 'type-fest';
4
+ export declare const ErrorName: {
5
+ readonly GENERAL_ERROR: "Error";
6
+ readonly IMAGE_DIFF: "ImageDiffError";
7
+ readonly NO_REF_IMAGE: "NoRefImageError";
8
+ readonly INVALID_REF_IMAGE: "InvalidRefImageError";
9
+ readonly ASSERT_VIEW: "AssertViewError";
10
+ };
11
+ export type ErrorName = ValueOf<typeof ErrorName>;
12
+ export type ErrorNames = typeof ErrorName;
13
+ export interface ImageDiffError {
14
+ name: ErrorNames['IMAGE_DIFF'];
15
+ message: string;
16
+ stack: string;
17
+ stateName: string;
18
+ diffOpts: DiffOptions;
19
+ currImg: ImageFile;
20
+ refImg: ImageFile;
21
+ diffClusters: CoordBounds[];
22
+ diffBuffer?: ArrayBuffer;
23
+ diffImg?: ImageFile;
24
+ differentPixels?: number;
25
+ diffRatio?: number;
26
+ }
27
+ export interface NoRefImageError {
28
+ name: ErrorNames['NO_REF_IMAGE'];
29
+ stateName: string;
30
+ message: string;
31
+ stack?: string;
32
+ currImg: ImageFile;
33
+ refImg: ImageFile;
34
+ }
35
+ /** @note Can be thrown by Testplane after version 8.20.7 */
36
+ export interface InvalidRefImageError {
37
+ name: ErrorNames['INVALID_REF_IMAGE'];
38
+ stateName: string;
39
+ message: string;
40
+ stack?: string;
41
+ currImg: ImageFile;
42
+ refImg: ImageFile;
43
+ }
@@ -0,0 +1,2 @@
1
+ import type { ImageFileSaver } from './types';
2
+ export declare const LocalImageFileSaver: ImageFileSaver;
@@ -0,0 +1,41 @@
1
+ import EventsEmitter2 from 'eventemitter2';
2
+ import { PluginEvents, ToolName } from './constants';
3
+ import { downloadDatabases, getTestsTreeFromDatabase, mergeDatabases } from './db-utils/server';
4
+ import { ImageFileSaver, ReporterConfig, ReportsSaver, SnapshotsSaver } from './types';
5
+ export interface HtmlReporterValues {
6
+ toolName: ToolName;
7
+ extraItems: Record<string, string>;
8
+ metaInfoExtenders: Record<string, string>;
9
+ imagesSaver: ImageFileSaver;
10
+ reportsSaver: ReportsSaver | null;
11
+ snapshotsSaver: SnapshotsSaver | null;
12
+ }
13
+ interface ReporterOptions {
14
+ toolName: ToolName;
15
+ }
16
+ type Parameters<F> = F extends (...rest: infer R) => any ? R : never;
17
+ export declare class HtmlReporter extends EventsEmitter2 {
18
+ protected _config: ReporterConfig;
19
+ protected _values: HtmlReporterValues;
20
+ protected _version: string;
21
+ static create<T extends HtmlReporter>(this: new (config: ReporterConfig, options?: Partial<ReporterOptions>) => T, config: ReporterConfig, options?: Partial<ReporterOptions>): T;
22
+ constructor(config: ReporterConfig, { toolName }?: Partial<ReporterOptions>);
23
+ get config(): ReporterConfig;
24
+ get version(): string;
25
+ get events(): typeof PluginEvents;
26
+ addExtraItem(key: string, value: string): void;
27
+ get extraItems(): Record<string, string>;
28
+ addMetaInfoExtender(key: string, value: string): void;
29
+ get metaInfoExtenders(): Record<string, string>;
30
+ set imagesSaver(imagesSaver: ImageFileSaver);
31
+ get imagesSaver(): ImageFileSaver;
32
+ set reportsSaver(reportsSaver: ReportsSaver);
33
+ get reportsSaver(): ReportsSaver | null;
34
+ set snapshotsSaver(snapshotsSaver: SnapshotsSaver);
35
+ get snapshotsSaver(): SnapshotsSaver | null;
36
+ get values(): HtmlReporterValues;
37
+ downloadDatabases(...args: Parameters<typeof downloadDatabases>): ReturnType<typeof downloadDatabases>;
38
+ mergeDatabases(...args: Parameters<typeof mergeDatabases>): ReturnType<typeof mergeDatabases>;
39
+ getTestsTreeFromDatabase(...args: Parameters<typeof getTestsTreeFromDatabase>): ReturnType<typeof getTestsTreeFromDatabase>;
40
+ }
41
+ export {};
@@ -0,0 +1,70 @@
1
+ /// <reference types="node" />
2
+ import type { Router } from 'express';
3
+ import type { TimeTravelMode as TimeTravelModeType, Test as TestplaneTest, Config } from 'testplane';
4
+ import { TestStatus } from './constants';
5
+ import type { HtmlReporter } from './plugin-api';
6
+ import type { ReporterTestResult } from './adapters/test-result';
7
+ import type { TestplaneTestResult, ImageInfoWithState, ReporterConfig, TestSpecByPath } from './types';
8
+ interface GetPathOptions {
9
+ imageDir: string;
10
+ attempt: number;
11
+ browserId: string;
12
+ timestamp: number;
13
+ }
14
+ export declare const getReferencePath: (options: GetPathOptions, stateName?: string) => string;
15
+ export declare const getCurrentPath: (options: GetPathOptions, stateName?: string) => string;
16
+ export declare const getDiffPath: (options: GetPathOptions, stateName?: string) => string;
17
+ export declare const getReferenceAbsolutePath: (testResult: ReporterTestResult, reportDir: string, stateName: string) => string;
18
+ export declare const getCurrentAbsolutePath: (testResult: ReporterTestResult, reportDir: string, stateName: string) => string;
19
+ export declare const getDiffAbsolutePath: (testResult: ReporterTestResult, reportDir: string, stateName: string) => string;
20
+ interface CreatePathOptions extends GetPathOptions {
21
+ stateName?: string;
22
+ kind: string;
23
+ }
24
+ export declare function createPath({ attempt: attemptInput, imageDir: imageDirInput, timestamp, browserId, kind, stateName }: CreatePathOptions): string;
25
+ export declare const getTempPath: (destPath: string) => Promise<string>;
26
+ export declare function createHash(buffer: Buffer): string;
27
+ export interface CopyFileAsyncOptions {
28
+ reportDir: string;
29
+ overwrite: boolean;
30
+ }
31
+ export declare function copyFileAsync(srcPath: string, destPath: string, { reportDir, overwrite }?: Partial<CopyFileAsyncOptions>): Promise<void>;
32
+ export declare function deleteFile(filePath: string): Promise<void>;
33
+ export declare function makeDirFor(destPath: string): Promise<void>;
34
+ export declare function fileExists(path: string): boolean;
35
+ export declare function logPathToHtmlReport(pluginConfig: ReporterConfig): void;
36
+ export declare function logError(e: Error): void;
37
+ export declare function prepareCommonJSData(data: unknown): string;
38
+ export declare function shouldUpdateAttempt(status: TestStatus): boolean;
39
+ export declare function saveStaticFilesToReportDir(htmlReporter: HtmlReporter, pluginConfig: ReporterConfig, destPath: string): Promise<void>;
40
+ export declare function copyPlugins({ plugins, pluginsEnabled }: ReporterConfig, destPath: string): Promise<void>;
41
+ export declare function copyPlugin(pluginName: string, pluginsPath: string): Promise<void>;
42
+ export declare function urlPathNameEndsWith(currentUrl: string, searchString: string): boolean;
43
+ export declare function isJsonUrl(url: string): boolean;
44
+ export declare function isDbFile(filePath: string): boolean;
45
+ export declare function writeDatabaseUrlsFile(destPath: string, srcPaths: string[]): Promise<void>;
46
+ export declare function copyFilesToReportDir(destPath: string, ext: string, sourceDirectory: string): Promise<void[]>;
47
+ export type ConfigForStaticFile = Pick<ReporterConfig, 'defaultView' | 'diffMode' | 'baseHost' | 'errorPatterns' | 'metaInfoBaseUrls' | 'customScripts' | 'yandexMetrika' | 'pluginsEnabled' | 'plugins' | 'uiMode'>;
48
+ export declare function getConfigForStaticFile(pluginConfig: ReporterConfig): ConfigForStaticFile;
49
+ export interface DataForStaticFile {
50
+ skips: object[];
51
+ config: ConfigForStaticFile;
52
+ apiValues: HtmlReporter['values'];
53
+ timestamp: number;
54
+ date: string;
55
+ }
56
+ export declare function getDataForStaticFile(htmlReporter: HtmlReporter, pluginConfig: ReporterConfig): DataForStaticFile;
57
+ export declare function getPluginClientScriptPath(pluginName: string): string | null;
58
+ interface PluginMiddleware {
59
+ (pluginRouter: Router): unknown;
60
+ }
61
+ export declare function getPluginMiddleware(pluginName: string): PluginMiddleware | null;
62
+ export declare function isUnexpectedPlugin(plugins: ReporterConfig['plugins'], pluginName: string): boolean;
63
+ export declare function forEachPlugin(plugins: ReporterConfig['plugins'], callback: (name: string) => void): void;
64
+ export declare function mapPlugins<T>(plugins: ReporterConfig['plugins'], callback: (name: string) => T): T[];
65
+ export declare const formatTestResult: (rawResult: TestplaneTest | TestplaneTestResult, status: TestStatus, attempt: number | undefined, saveHistoryMode: Config['saveHistoryMode']) => ReporterTestResult;
66
+ export declare const saveErrorDetails: (testResult: ReporterTestResult, reportPath: string) => Promise<void>;
67
+ export declare const getExpectedCacheKey: ([testResult, stateName]: [TestSpecByPath, string | undefined]) => string;
68
+ export declare const getImagesInfoByStateName: (imagesInfo: ReporterTestResult['imagesInfo'], stateName: string) => ImageInfoWithState | undefined;
69
+ export declare const getTimeTravelModeEnumSafe: () => typeof TimeTravelModeType | null;
70
+ export {};
@@ -0,0 +1,60 @@
1
+ /// <reference types="gemini-testing__sql.js" />
2
+ import type { Database } from '@gemini-testing/sql.js';
3
+ import { TestStatus } from './constants';
4
+ import type { Attachment, ImageInfoFull, TestError, TestStepCompressed } from './types';
5
+ import type { HtmlReporter } from './plugin-api';
6
+ import { ReporterTestResult } from './adapters/test-result';
7
+ import { DbTestResultTransformer } from './adapters/test-result/transformers/db';
8
+ interface QueryParams {
9
+ select?: string;
10
+ where?: string;
11
+ orderBy?: string;
12
+ orderDescending?: boolean;
13
+ limit?: number;
14
+ noCache?: boolean;
15
+ }
16
+ interface DeleteParams {
17
+ where?: string;
18
+ }
19
+ export interface DbTestResult {
20
+ description?: string | null;
21
+ error?: TestError;
22
+ history: TestStepCompressed[];
23
+ imagesInfo: ImageInfoFull[];
24
+ metaInfo: Record<string, unknown>;
25
+ multipleTabs: boolean;
26
+ name: string;
27
+ screenshot: boolean;
28
+ skipReason?: string;
29
+ status: TestStatus;
30
+ suiteName: string;
31
+ suitePath: string[];
32
+ suiteUrl: string;
33
+ timestamp: number;
34
+ duration: number;
35
+ attachments: Attachment[];
36
+ }
37
+ interface SqliteClientOptions {
38
+ htmlReporter: HtmlReporter;
39
+ reportPath: string;
40
+ reuse?: boolean;
41
+ }
42
+ export declare class SqliteClient {
43
+ private readonly _db;
44
+ private readonly _dbPath;
45
+ private readonly _insertSuitesStatement;
46
+ private _queryCache;
47
+ private _transformer;
48
+ static create<T extends SqliteClient>(this: {
49
+ new (db: Database, dbPath: string, transformer: DbTestResultTransformer): T;
50
+ }, options: SqliteClientOptions): Promise<T>;
51
+ constructor(db: Database, dbPath: string, transformer: DbTestResultTransformer);
52
+ getRawConnection(): Database;
53
+ close(): void;
54
+ query<T = unknown>(queryParams?: QueryParams, ...queryArgs: string[]): T | undefined;
55
+ write(testResult: ReporterTestResult): void;
56
+ delete(deleteParams?: DeleteParams, ...deleteArgs: string[]): void;
57
+ private _createSentence;
58
+ private _createValuesArray;
59
+ }
60
+ export {};
@@ -0,0 +1,22 @@
1
+ /**
2
+ * Wrap localStorage#setItem method
3
+ * Support value serialization
4
+ * @param key
5
+ * @param value
6
+ */
7
+ export function setItem(key: any, value: any): void;
8
+ /**
9
+ * Wrap localStorage#getItem method
10
+ * Parse deserialize storage value
11
+ * If key doesn't exist in storage return defaultValue
12
+ * @param key
13
+ * @param defaultValue
14
+ * @returns {object|string}
15
+ */
16
+ export function getItem(key: any, defaultValue: any): object | string;
17
+ /**
18
+ * Checks whether the key is contained in storage.
19
+ * @param key
20
+ * @returns {boolean}
21
+ */
22
+ export function hasItem(key: any): boolean;
@@ -0,0 +1,3 @@
1
+ export { PanelSection } from '../new-ui/components/PanelSection';
2
+ export { State } from '../new-ui/types/store';
3
+ export * as Features from '../../constants/features';
@@ -0,0 +1 @@
1
+ module.exports = {};
@@ -0,0 +1,47 @@
1
+ import PropTypes from 'prop-types';
2
+ import type { ReporterConfig } from '../../types';
3
+ import { COMMITED, STAGED } from '../../constants';
4
+ import { ImageEntity } from "../new-ui/types/store";
5
+ export interface AcceptableImage {
6
+ id: string;
7
+ parentId: string;
8
+ stateName: string;
9
+ stateNameImageId: string;
10
+ commitStatus: null | typeof STAGED | typeof COMMITED;
11
+ originalStatus: string;
12
+ }
13
+ type ImagesById = Record<string, ImageEntity>;
14
+ type CommitPayload = Array<{
15
+ id: string;
16
+ stateNameImageId: string;
17
+ image: string;
18
+ path: string;
19
+ }>;
20
+ export declare const checkIsEnabled: (config: ReporterConfig['staticImageAccepter'], isGui: boolean) => boolean;
21
+ export declare const formatCommitPayload: (acceptableImgages: AcceptableImage[], imagesById: ImagesById, extraImages?: Array<{
22
+ imageId: string;
23
+ stateNameImageId: string;
24
+ }>) => CommitPayload;
25
+ export declare const getLocalStorageCommitedImageIds: () => string[];
26
+ export declare const storeCommitInLocalStorage: (newCommitedImages: Array<{
27
+ imageId: string;
28
+ stateNameImageId: string;
29
+ }>) => void;
30
+ export declare const staticImageAccepterPropType: PropTypes.Requireable<PropTypes.InferProps<{
31
+ enabled: PropTypes.Validator<boolean>;
32
+ accepterDelayedImages: PropTypes.Validator<(PropTypes.InferProps<{
33
+ imageId: PropTypes.Validator<string>;
34
+ stateName: PropTypes.Validator<string>;
35
+ stateNameImageId: PropTypes.Validator<string>;
36
+ }> | null | undefined)[]>;
37
+ acceptableImages: PropTypes.Requireable<{
38
+ [x: string]: PropTypes.InferProps<{
39
+ id: PropTypes.Validator<string>;
40
+ parentId: PropTypes.Validator<string>;
41
+ stateName: PropTypes.Validator<string>;
42
+ commitStatus: PropTypes.Requireable<import("../../constants").TestStatus | null>;
43
+ originalStatus: PropTypes.Validator<string>;
44
+ }> | null | undefined;
45
+ }>;
46
+ }>>;
47
+ export {};
@@ -0,0 +1,8 @@
1
+ import { ReactNode } from 'react';
2
+ interface PanelSectionProps {
3
+ title: ReactNode;
4
+ description?: ReactNode;
5
+ children?: ReactNode;
6
+ }
7
+ export declare function PanelSection(props: PanelSectionProps): ReactNode;
8
+ export {};
@@ -0,0 +1,33 @@
1
+ import { TestStatus } from "../../../../../../constants";
2
+ import { ImageEntity } from "../../../../types/store";
3
+ export declare enum EntityType {
4
+ Group = "group",
5
+ Suite = "suite",
6
+ Browser = "browser"
7
+ }
8
+ export interface TreeViewItemData {
9
+ id: string;
10
+ entityType: EntityType;
11
+ entityId: string;
12
+ prefix?: string;
13
+ title: string[];
14
+ status: TestStatus | null;
15
+ tags: string[];
16
+ errorTitle?: string;
17
+ errorStack?: string;
18
+ images?: ImageEntity[];
19
+ parentData?: TreeViewItemData;
20
+ skipReason?: string;
21
+ }
22
+ export interface TreeRoot {
23
+ isRoot: true;
24
+ data?: TreeViewItemData;
25
+ children?: TreeNode[];
26
+ }
27
+ export interface GenericTreeViewItem<T> {
28
+ parentNode?: TreeRoot | GenericTreeViewItem<T>;
29
+ data: T;
30
+ children?: GenericTreeViewItem<T>[];
31
+ }
32
+ export type TreeNode = GenericTreeViewItem<TreeViewItemData>;
33
+ export declare const isTreeRoot: (nodeOrRoot: TreeNode | TreeRoot) => nodeOrRoot is TreeRoot;
@@ -0,0 +1,4 @@
1
+ export interface Point {
2
+ x: number;
3
+ y: number;
4
+ }
@@ -0,0 +1,320 @@
1
+ import { CoordBounds } from 'looks-same';
2
+ import { BrowserFeature, DiffModeId, Feature, TestStatus, ViewMode } from "../../../constants";
3
+ import { Attachment, BrowserItem, ImageFile, RefImageFile, StoreReporterConfig, TestError, TestStepCompressed } from "../../../types";
4
+ import { HtmlReporterValues } from "../../../plugin-api";
5
+ import { Point } from "./index";
6
+ import { AcceptableImage } from "../../modules/static-image-accepter";
7
+ import { CheckStatus } from "../../../constants/checked-statuses";
8
+ import { EntityType } from "../features/suites/components/SuitesPage/types";
9
+ import { DbDetails } from "../../../db-utils/common";
10
+ import { Stats, PerBrowserStats } from "../../../tests-tree-builder/static";
11
+ export interface GroupEntity {
12
+ id: string;
13
+ /** @note For cosmetic purposes, grouping key. For example: "url". */
14
+ key: string;
15
+ /** @note For cosmetic purposes, group value. For example: "https://example.com" */
16
+ label: string;
17
+ resultIds: string[];
18
+ browserIds: string[];
19
+ type: EntityType.Group;
20
+ }
21
+ export interface SuiteEntityNode {
22
+ id: string;
23
+ name: string;
24
+ parentId: string | null;
25
+ status: TestStatus;
26
+ suiteIds: string[];
27
+ suitePath: string[];
28
+ }
29
+ export interface SuiteEntityLeaf {
30
+ id: string;
31
+ name: string;
32
+ parentId: string | null;
33
+ status: TestStatus;
34
+ browserIds: string[];
35
+ suitePath: string[];
36
+ }
37
+ export type SuiteEntity = SuiteEntityNode | SuiteEntityLeaf;
38
+ export declare const hasBrowsers: (suite: SuiteEntity) => suite is SuiteEntityLeaf;
39
+ export declare const hasSuites: (suite: SuiteEntity) => suite is SuiteEntityNode;
40
+ export interface BrowserEntity {
41
+ id: string;
42
+ name: string;
43
+ resultIds: string[];
44
+ imageIds: string[];
45
+ parentId: string;
46
+ }
47
+ export declare const isSuiteEntity: (entity: SuiteEntity | BrowserEntity | GroupEntity) => entity is SuiteEntity;
48
+ export declare const isBrowserEntity: (entity: SuiteEntity | BrowserEntity) => entity is BrowserEntity;
49
+ export declare const isGroupEntity: (entity: SuiteEntity | BrowserEntity | GroupEntity) => entity is GroupEntity;
50
+ export interface ResultEntityCommon {
51
+ id: string;
52
+ parentId: string;
53
+ attempt: number;
54
+ imageIds: string[];
55
+ status: TestStatus;
56
+ timestamp: number;
57
+ metaInfo: Record<string, string>;
58
+ suiteUrl?: string;
59
+ history?: TestStepCompressed[];
60
+ error?: TestError;
61
+ suitePath: string[];
62
+ /** @note Browser Name/ID, e.g. `chrome-desktop` */
63
+ name: string;
64
+ skipReason?: string;
65
+ duration?: number;
66
+ attachments?: Attachment[];
67
+ }
68
+ export interface ResultEntityError extends ResultEntityCommon {
69
+ error: TestError;
70
+ status: TestStatus.ERROR | TestStatus.FAIL;
71
+ }
72
+ export type ResultEntity = ResultEntityCommon | ResultEntityError;
73
+ export declare const isResultEntityError: (result: ResultEntity) => result is ResultEntityError;
74
+ interface ImageEntityCommon {
75
+ id: string;
76
+ /** @note Corresponding ResultEntity id */
77
+ parentId: string;
78
+ }
79
+ export interface ImageEntitySuccess extends ImageEntityCommon {
80
+ status: TestStatus.SUCCESS;
81
+ stateName: string;
82
+ expectedImg: ImageFile;
83
+ refImg: RefImageFile;
84
+ }
85
+ export interface ImageEntityUpdated extends ImageEntityCommon {
86
+ status: TestStatus.UPDATED;
87
+ stateName: string;
88
+ expectedImg: ImageFile;
89
+ refImg: RefImageFile;
90
+ }
91
+ export interface ImageEntityStaged extends ImageEntityCommon {
92
+ status: TestStatus.STAGED;
93
+ stateName: string;
94
+ actualImg: ImageFile;
95
+ refImg: RefImageFile;
96
+ }
97
+ export interface ImageEntityCommitted extends ImageEntityCommon {
98
+ status: TestStatus.COMMITED;
99
+ stateName: string;
100
+ actualImg: ImageFile;
101
+ refImg: RefImageFile;
102
+ }
103
+ export interface ImageEntityError extends ImageEntityCommon {
104
+ status: TestStatus.ERROR;
105
+ stateName?: string;
106
+ actualImg: ImageFile;
107
+ error?: TestError;
108
+ refImg?: RefImageFile;
109
+ }
110
+ export interface ImageEntityFail extends ImageEntityCommon {
111
+ status: TestStatus.FAIL;
112
+ stateName: string;
113
+ diffClusters: CoordBounds[];
114
+ diffImg: ImageFile;
115
+ actualImg: ImageFile;
116
+ expectedImg: ImageFile;
117
+ refImg: RefImageFile;
118
+ }
119
+ export type ImageEntity = ImageEntityError | ImageEntityFail | ImageEntitySuccess | ImageEntityUpdated | ImageEntityStaged | ImageEntityCommitted;
120
+ export declare const isImageEntityFail: (image: ImageEntity) => image is ImageEntityFail;
121
+ export interface SuiteState {
122
+ shouldBeOpened: boolean;
123
+ shouldBeShown: boolean;
124
+ checkStatus: CheckStatus;
125
+ }
126
+ export interface BrowserState {
127
+ shouldBeShown: boolean;
128
+ retryIndex: number;
129
+ lastMatchedRetryIndex?: number | null;
130
+ isHiddenBecauseOfStatus?: boolean;
131
+ checkStatus: CheckStatus;
132
+ fuzzyMatchScore?: number;
133
+ }
134
+ export interface ResultState {
135
+ matchedSelectedGroup: boolean;
136
+ }
137
+ export interface TreeEntity {
138
+ browsers: {
139
+ allIds: string[];
140
+ byId: Record<string, BrowserEntity>;
141
+ stateById: Record<string, BrowserState>;
142
+ };
143
+ images: {
144
+ byId: Record<string, ImageEntity>;
145
+ };
146
+ results: {
147
+ byId: Record<string, ResultEntity>;
148
+ stateById: Record<string, ResultState>;
149
+ };
150
+ suites: {
151
+ allRootIds: string[];
152
+ byId: Record<string, SuiteEntity>;
153
+ stateById: Record<string, SuiteState>;
154
+ };
155
+ groups: {
156
+ byId: Record<string, GroupEntity>;
157
+ allRootIds: string[];
158
+ };
159
+ }
160
+ export interface GroupBySection {
161
+ id: string;
162
+ label: string;
163
+ }
164
+ export declare enum GroupByType {
165
+ Meta = "meta",
166
+ Error = "error"
167
+ }
168
+ export interface GroupByMetaExpression {
169
+ id: string;
170
+ type: GroupByType.Meta;
171
+ sectionId?: string;
172
+ key: string;
173
+ }
174
+ export interface GroupByErrorExpression {
175
+ id: string;
176
+ type: GroupByType.Error;
177
+ sectionId?: string;
178
+ }
179
+ export type GroupByExpression = GroupByMetaExpression | GroupByErrorExpression;
180
+ export declare enum SortType {
181
+ ByName = 0,
182
+ ByFailedRuns = 1,
183
+ ByTestsCount = 2,
184
+ ByStartTime = 3,
185
+ ByDuration = 4,
186
+ ByRelevance = 5
187
+ }
188
+ export declare enum SortDirection {
189
+ Asc = "asc",
190
+ Desc = "desc"
191
+ }
192
+ export interface SortByExpression {
193
+ id: string;
194
+ type: SortType;
195
+ label: string;
196
+ }
197
+ export declare enum TreeViewMode {
198
+ Tree = "tree",
199
+ List = "list"
200
+ }
201
+ export interface SnapshotsPlayerHighlightState {
202
+ isActive: boolean;
203
+ highlightStartTime: number;
204
+ highlightEndTime: number;
205
+ goToTime: number;
206
+ }
207
+ export declare enum Page {
208
+ suitesPage = "suitesPage",
209
+ visualChecksPage = "visualChecksPage"
210
+ }
211
+ export interface State {
212
+ app: {
213
+ isNewUi: boolean;
214
+ isInitialized: boolean;
215
+ availableFeatures: Feature[];
216
+ isSearchLoading?: boolean;
217
+ [Page.suitesPage]: {
218
+ currentTreeNodeId: string | null;
219
+ currentBrowserId: string | null;
220
+ currentGroupId: string | null;
221
+ currentStepId: string | null;
222
+ currentHighlightedStepId: string | null;
223
+ nameFilter: string;
224
+ useRegexFilter: boolean;
225
+ useMatchCaseFilter: boolean;
226
+ viewMode: ViewMode;
227
+ filteredBrowsers: BrowserItem[];
228
+ };
229
+ [Page.visualChecksPage]: {
230
+ currentNamedImageId: string | null;
231
+ nameFilter: string;
232
+ useRegexFilter: boolean;
233
+ useMatchCaseFilter: boolean;
234
+ viewMode: ViewMode;
235
+ filteredBrowsers: BrowserItem[];
236
+ };
237
+ loading: {
238
+ /** @note Determines whether the loading bar is visible */
239
+ isVisible: boolean;
240
+ /** @note Determines visibility of bouncing dots at the end of the task title */
241
+ isInProgress: boolean;
242
+ taskTitle: string;
243
+ /** @note Maps ID of a resource to its loading progress. E.g. dbUrl: 88. Progress is measured from 0 to 1. */
244
+ progress: Record<string, number>;
245
+ };
246
+ staticImageAccepterModal: {
247
+ commitMessage: string;
248
+ };
249
+ groupTestsData: {
250
+ availableSections: GroupBySection[];
251
+ availableExpressions: GroupByExpression[];
252
+ currentExpressionIds: string[];
253
+ };
254
+ sortTestsData: {
255
+ availableExpressions: SortByExpression[];
256
+ currentExpressionIds: string[];
257
+ currentDirection: SortDirection;
258
+ previousExpressionIds: string[];
259
+ previousDirection: SortDirection;
260
+ };
261
+ guiServerConnection: {
262
+ isConnected: boolean;
263
+ };
264
+ snapshotsPlayer: SnapshotsPlayerHighlightState;
265
+ };
266
+ ui: {
267
+ [Page.suitesPage]: {
268
+ treeViewMode: TreeViewMode;
269
+ retryIndexByTreeNodeId: Record<string, number | null>;
270
+ expandedTreeNodesById: Record<string, boolean>;
271
+ expandedSectionsById: Record<string, boolean>;
272
+ expandedStepsByResultId: Record<string, Record<string, boolean>>;
273
+ sectionSizes: number[];
274
+ backupSectionSizes: number[];
275
+ isSnapshotsPlayerVisible: boolean;
276
+ };
277
+ [Page.visualChecksPage]: {
278
+ sectionSizes: number[];
279
+ backupSectionSizes: number[];
280
+ };
281
+ staticImageAccepterToolbar: {
282
+ offset: Point;
283
+ };
284
+ };
285
+ browsers: BrowserItem[];
286
+ browserFeatures: Record<string, BrowserFeature[]>;
287
+ tree: TreeEntity;
288
+ view: {
289
+ diffMode: DiffModeId;
290
+ /** @deprecated Use tree.groups instead. */
291
+ keyToGroupTestsBy: string;
292
+ baseHost: string;
293
+ };
294
+ running: boolean;
295
+ processing: boolean;
296
+ gui: boolean;
297
+ apiValues: HtmlReporterValues;
298
+ config: StoreReporterConfig;
299
+ staticImageAccepter: {
300
+ enabled: boolean;
301
+ acceptableImages: Record<string, AcceptableImage>;
302
+ accepterDelayedImages: {
303
+ imageId: string;
304
+ stateName: string;
305
+ stateNameImageId: string;
306
+ }[];
307
+ imagesToCommitCount: number;
308
+ };
309
+ timestamp: number;
310
+ fetchDbDetails: DbDetails[];
311
+ stats: {
312
+ all: Stats | Record<string, never>;
313
+ perBrowser: PerBrowserStats | undefined;
314
+ } | null;
315
+ }
316
+ declare module 'react-redux' {
317
+ interface DefaultRootState extends State {
318
+ }
319
+ }
320
+ export {};