html-reporter 10.3.2 → 10.5.0

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 (134) hide show
  1. package/build/lib/adapters/config/index.d.ts +7 -0
  2. package/build/lib/adapters/config/index.js +3 -0
  3. package/build/lib/adapters/config/index.js.map +1 -0
  4. package/build/lib/adapters/config/playwright.d.ts +24 -0
  5. package/build/lib/adapters/config/playwright.js +83 -0
  6. package/build/lib/adapters/config/playwright.js.map +1 -0
  7. package/build/lib/adapters/config/testplane.d.ts +13 -0
  8. package/build/lib/adapters/config/testplane.js +29 -0
  9. package/build/lib/adapters/config/testplane.js.map +1 -0
  10. package/build/lib/adapters/test/index.d.ts +24 -0
  11. package/build/lib/adapters/test/index.js +3 -0
  12. package/build/lib/adapters/test/index.js.map +1 -0
  13. package/build/lib/adapters/test/playwright.d.ts +23 -0
  14. package/build/lib/adapters/test/playwright.js +103 -0
  15. package/build/lib/adapters/test/playwright.js.map +1 -0
  16. package/build/lib/adapters/test/testplane.d.ts +18 -0
  17. package/build/lib/adapters/test/testplane.js +60 -0
  18. package/build/lib/adapters/test/testplane.js.map +1 -0
  19. package/build/lib/adapters/test-collection/index.d.ts +4 -0
  20. package/build/lib/adapters/test-collection/index.js +3 -0
  21. package/build/lib/adapters/test-collection/index.js.map +1 -0
  22. package/build/lib/adapters/test-collection/playwright.d.ts +8 -0
  23. package/build/lib/adapters/test-collection/playwright.js +17 -0
  24. package/build/lib/adapters/test-collection/playwright.js.map +1 -0
  25. package/build/lib/adapters/test-collection/testplane.d.ts +11 -0
  26. package/build/lib/adapters/test-collection/testplane.js +21 -0
  27. package/build/lib/adapters/test-collection/testplane.js.map +1 -0
  28. package/build/lib/adapters/test-result/playwright.d.ts +13 -2
  29. package/build/lib/adapters/test-result/playwright.js +26 -4
  30. package/build/lib/adapters/test-result/playwright.js.map +1 -1
  31. package/build/lib/adapters/test-result/sqlite.d.ts +1 -6
  32. package/build/lib/adapters/test-result/sqlite.js +2 -3
  33. package/build/lib/adapters/test-result/sqlite.js.map +1 -1
  34. package/build/lib/adapters/test-result/testplane.d.ts +1 -1
  35. package/build/lib/adapters/test-result/testplane.js +1 -1
  36. package/build/lib/adapters/test-result/testplane.js.map +1 -1
  37. package/build/lib/adapters/tool/index.d.ts +8 -4
  38. package/build/lib/adapters/tool/index.js +2 -1
  39. package/build/lib/adapters/tool/index.js.map +1 -1
  40. package/build/lib/adapters/tool/playwright/index.d.ts +39 -0
  41. package/build/lib/adapters/tool/playwright/index.js +234 -0
  42. package/build/lib/adapters/tool/playwright/index.js.map +1 -0
  43. package/build/lib/adapters/tool/playwright/ipc.d.ts +8 -0
  44. package/build/lib/adapters/tool/playwright/ipc.js +20 -0
  45. package/build/lib/adapters/tool/playwright/ipc.js.map +1 -0
  46. package/build/lib/adapters/tool/playwright/reporter.d.ts +13 -0
  47. package/build/lib/adapters/tool/playwright/reporter.js +29 -0
  48. package/build/lib/adapters/tool/playwright/reporter.js.map +1 -0
  49. package/build/lib/adapters/tool/playwright/transformer.d.ts +1 -0
  50. package/build/lib/adapters/tool/playwright/transformer.js +6 -0
  51. package/build/lib/adapters/tool/playwright/transformer.js.map +1 -0
  52. package/build/lib/adapters/tool/testplane/index.d.ts +13 -4
  53. package/build/lib/adapters/tool/testplane/index.js +50 -7
  54. package/build/lib/adapters/tool/testplane/index.js.map +1 -1
  55. package/build/lib/adapters/tool/testplane/runner/all-test-runner.d.ts +1 -1
  56. package/build/lib/adapters/tool/testplane/runner/all-test-runner.js.map +1 -1
  57. package/build/lib/adapters/tool/testplane/runner/specific-test-runner.d.ts +1 -1
  58. package/build/lib/adapters/tool/testplane/runner/specific-test-runner.js.map +1 -1
  59. package/build/lib/bundle/index.js +409 -0
  60. package/build/lib/cli/commands/merge-reports.js +5 -0
  61. package/build/lib/cli/commands/merge-reports.js.map +1 -1
  62. package/build/lib/cli/commands/remove-unused-screens/index.js +5 -1
  63. package/build/lib/cli/commands/remove-unused-screens/index.js.map +1 -1
  64. package/build/lib/cli/commands/remove-unused-screens/utils.js +6 -7
  65. package/build/lib/cli/commands/remove-unused-screens/utils.js.map +1 -1
  66. package/build/lib/cli/index.js +21 -1
  67. package/build/lib/cli/index.js.map +1 -1
  68. package/build/lib/common-utils.d.ts +3 -2
  69. package/build/lib/common-utils.js +6 -6
  70. package/build/lib/common-utils.js.map +1 -1
  71. package/build/lib/config/index.js +36 -0
  72. package/build/lib/config/index.js.map +1 -1
  73. package/build/lib/constants/checked-statuses.d.ts +10 -3
  74. package/build/lib/constants/checked-statuses.js +10 -5
  75. package/build/lib/constants/checked-statuses.js.map +1 -1
  76. package/build/lib/constants/defaults.js +8 -0
  77. package/build/lib/constants/defaults.js.map +1 -1
  78. package/build/lib/constants/expand-modes.d.ts +4 -4
  79. package/build/lib/constants/expand-modes.js +6 -6
  80. package/build/lib/constants/expand-modes.js.map +1 -1
  81. package/build/lib/constants/test-statuses.d.ts +17 -1
  82. package/build/lib/constants/test-statuses.js +17 -1
  83. package/build/lib/constants/test-statuses.js.map +1 -1
  84. package/build/lib/constants/tests.d.ts +1 -0
  85. package/build/lib/constants/tests.js +3 -2
  86. package/build/lib/constants/tests.js.map +1 -1
  87. package/build/lib/constants/view-modes.d.ts +3 -1
  88. package/build/lib/constants/view-modes.js +2 -0
  89. package/build/lib/constants/view-modes.js.map +1 -1
  90. package/build/lib/db-utils/client.d.ts +5 -1
  91. package/build/lib/db-utils/client.js +53 -17
  92. package/build/lib/db-utils/client.js.map +1 -1
  93. package/build/lib/db-utils/server.d.ts +1 -2
  94. package/build/lib/db-utils/server.js +2 -2
  95. package/build/lib/db-utils/server.js.map +1 -1
  96. package/build/lib/gui/app.d.ts +0 -5
  97. package/build/lib/gui/app.js +1 -28
  98. package/build/lib/gui/app.js.map +1 -1
  99. package/build/lib/gui/index.d.ts +2 -2
  100. package/build/lib/gui/server.js.map +1 -1
  101. package/build/lib/gui/tool-runner/index.d.ts +11 -9
  102. package/build/lib/gui/tool-runner/index.js +66 -42
  103. package/build/lib/gui/tool-runner/index.js.map +1 -1
  104. package/build/lib/history-utils.d.ts +4 -0
  105. package/build/lib/history-utils.js +7 -4
  106. package/build/lib/history-utils.js.map +1 -1
  107. package/build/lib/plugin-api.d.ts +2 -2
  108. package/build/lib/plugin-api.js +1 -1
  109. package/build/lib/plugin-api.js.map +1 -1
  110. package/build/lib/report-builder/gui.d.ts +4 -3
  111. package/build/lib/report-builder/gui.js +11 -8
  112. package/build/lib/report-builder/gui.js.map +1 -1
  113. package/build/lib/report-builder/static.d.ts +5 -3
  114. package/build/lib/report-builder/static.js +9 -9
  115. package/build/lib/report-builder/static.js.map +1 -1
  116. package/build/lib/server-utils.d.ts +1 -0
  117. package/build/lib/server-utils.js +6 -2
  118. package/build/lib/server-utils.js.map +1 -1
  119. package/build/lib/static/gui.min.css +10 -10
  120. package/build/lib/static/gui.min.js +1 -1
  121. package/build/lib/static/report.min.css +9 -9
  122. package/build/lib/static/report.min.js +1 -1
  123. package/build/lib/tests-tree-builder/base.d.ts +3 -5
  124. package/build/lib/tests-tree-builder/base.js +3 -5
  125. package/build/lib/tests-tree-builder/base.js.map +1 -1
  126. package/build/lib/tests-tree-builder/static.js +1 -2
  127. package/build/lib/tests-tree-builder/static.js.map +1 -1
  128. package/build/lib/types.d.ts +26 -0
  129. package/build/package.json +20 -7
  130. package/build/playwright.js +1 -1
  131. package/build/playwright.js.map +1 -1
  132. package/build/testplane.js +7 -2
  133. package/build/testplane.js.map +1 -1
  134. package/package.json +20 -7
@@ -0,0 +1,7 @@
1
+ import { TestAdapter } from '../test';
2
+ export interface ConfigAdapter {
3
+ readonly tolerance: number;
4
+ readonly antialiasingTolerance: number;
5
+ readonly browserIds: string[];
6
+ getScreenshotPath(test: TestAdapter, stateName: string): string;
7
+ }
@@ -0,0 +1,3 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../lib/adapters/config/index.ts"],"names":[],"mappings":""}
@@ -0,0 +1,24 @@
1
+ import type { ConfigAdapter } from './index';
2
+ import type { FullConfig, FullProject } from '@playwright/test/reporter';
3
+ import type { TestAdapter } from '../test';
4
+ export type PwtProject = FullProject & {
5
+ snapshotPathTemplate?: string;
6
+ };
7
+ export type PwtConfig = FullConfig & {
8
+ testDir?: string;
9
+ snapshotDir?: string;
10
+ snapshotPathTemplate?: string;
11
+ projects?: PwtProject[];
12
+ };
13
+ export declare const DEFAULT_BROWSER_ID = "chromium";
14
+ export declare class PlaywrightConfigAdapter implements ConfigAdapter {
15
+ private _config;
16
+ private _browserIds;
17
+ static create<T extends PlaywrightConfigAdapter>(this: new (config: PwtConfig) => T, config: PwtConfig): T;
18
+ constructor(config: PwtConfig);
19
+ get original(): PwtConfig;
20
+ get tolerance(): number;
21
+ get antialiasingTolerance(): number;
22
+ get browserIds(): string[];
23
+ getScreenshotPath(test: TestAdapter, stateName: string): string;
24
+ }
@@ -0,0 +1,83 @@
1
+ "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ exports.PlaywrightConfigAdapter = exports.DEFAULT_BROWSER_ID = void 0;
7
+ const node_path_1 = __importDefault(require("node:path"));
8
+ const node_crypto_1 = __importDefault(require("node:crypto"));
9
+ const lodash_1 = __importDefault(require("lodash"));
10
+ exports.DEFAULT_BROWSER_ID = 'chromium';
11
+ const DEFAULT_SNAPSHOT_PATH_TEMPLATE = '{snapshotDir}/{testFileDir}/{testFileName}-snapshots/{arg}{-projectName}{-snapshotSuffix}{ext}';
12
+ class PlaywrightConfigAdapter {
13
+ static create(config) {
14
+ return new this(config);
15
+ }
16
+ constructor(config) {
17
+ this._config = config;
18
+ this._browserIds = lodash_1.default.isEmpty(this._config.projects) ? [exports.DEFAULT_BROWSER_ID] : this._config.projects.map(prj => prj.name).filter(Boolean);
19
+ }
20
+ get original() {
21
+ return this._config;
22
+ }
23
+ get tolerance() {
24
+ return 2.3;
25
+ }
26
+ get antialiasingTolerance() {
27
+ return 4;
28
+ }
29
+ get browserIds() {
30
+ return this._browserIds;
31
+ }
32
+ // used from pwt - https://github.com/microsoft/playwright/blob/v1.45.1/packages/playwright/src/worker/testInfo.ts#L452-L473
33
+ getScreenshotPath(test, stateName) {
34
+ const subPath = `${stateName}.png`;
35
+ const parsedSubPath = node_path_1.default.parse(subPath);
36
+ const parsedRelativeTestFilePath = node_path_1.default.parse(test.file);
37
+ const currProject = (this._config.projects || []).find(prj => prj.name === test.browserId) || {};
38
+ const projectNamePathSegment = sanitizeForFilePath(test.browserId);
39
+ const snapshotPathTemplate = currProject.snapshotPathTemplate || this._config.snapshotPathTemplate || DEFAULT_SNAPSHOT_PATH_TEMPLATE;
40
+ const testDir = node_path_1.default.resolve(currProject.testDir || this._config.testDir || '');
41
+ let snapshotDir = currProject.snapshotDir || this._config.snapshotDir;
42
+ snapshotDir = snapshotDir ? node_path_1.default.resolve(snapshotDir) : testDir;
43
+ const snapshotSuffix = process.platform;
44
+ const snapshotPath = snapshotPathTemplate
45
+ .replace(/\{(.)?testDir\}/g, '$1' + testDir)
46
+ .replace(/\{(.)?snapshotDir\}/g, '$1' + snapshotDir)
47
+ .replace(/\{(.)?snapshotSuffix\}/g, snapshotSuffix ? '$1' + snapshotSuffix : '')
48
+ .replace(/\{(.)?testFileDir\}/g, '$1' + parsedRelativeTestFilePath.dir)
49
+ .replace(/\{(.)?platform\}/g, '$1' + process.platform)
50
+ .replace(/\{(.)?projectName\}/g, projectNamePathSegment ? '$1' + projectNamePathSegment : '')
51
+ .replace(/\{(.)?testName\}/g, '$1' + fsSanitizedTestName(test.titlePath))
52
+ .replace(/\{(.)?testFileName\}/g, '$1' + parsedRelativeTestFilePath.base)
53
+ .replace(/\{(.)?testFilePath\}/g, '$1' + test.file)
54
+ .replace(/\{(.)?arg\}/g, '$1' + node_path_1.default.join(parsedSubPath.dir, parsedSubPath.name))
55
+ .replace(/\{(.)?ext\}/g, parsedSubPath.ext ? '$1' + parsedSubPath.ext : '');
56
+ return node_path_1.default.normalize(node_path_1.default.resolve(snapshotPath));
57
+ }
58
+ }
59
+ exports.PlaywrightConfigAdapter = PlaywrightConfigAdapter;
60
+ function sanitizeForFilePath(s) {
61
+ // eslint-disable-next-line no-control-regex
62
+ return s.replace(/[\x00-\x2C\x2E-\x2F\x3A-\x40\x5B-\x60\x7B-\x7F]+/g, '-');
63
+ }
64
+ function fsSanitizedTestName(titlePath) {
65
+ const fullTitleWithoutSpec = titlePath.join(' ');
66
+ return sanitizeForFilePath(trimLongString(fullTitleWithoutSpec));
67
+ }
68
+ function trimLongString(s, length = 100) {
69
+ if (s.length <= length) {
70
+ return s;
71
+ }
72
+ const hash = calculateSha1(s);
73
+ const middle = `-${hash.substring(0, 5)}-`;
74
+ const start = Math.floor((length - middle.length) / 2);
75
+ const end = length - middle.length - start;
76
+ return s.substring(0, start) + middle + s.slice(-end);
77
+ }
78
+ function calculateSha1(buffer) {
79
+ const hash = node_crypto_1.default.createHash('sha1');
80
+ hash.update(buffer);
81
+ return hash.digest('hex');
82
+ }
83
+ //# sourceMappingURL=playwright.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"playwright.js","sourceRoot":"","sources":["../../../../lib/adapters/config/playwright.ts"],"names":[],"mappings":";;;;;;AAAA,0DAA6B;AAC7B,8DAAiC;AACjC,oDAAuB;AAiBV,QAAA,kBAAkB,GAAG,UAAU,CAAC;AAC7C,MAAM,8BAA8B,GAAG,gGAAgG,CAAC;AAExI,MAAa,uBAAuB;IAIhC,MAAM,CAAC,MAAM,CAAwE,MAAiB;QAClG,OAAO,IAAI,IAAI,CAAC,MAAM,CAAC,CAAC;IAC5B,CAAC;IAED,YAAY,MAAiB;QACzB,IAAI,CAAC,OAAO,GAAG,MAAM,CAAC;QACtB,IAAI,CAAC,WAAW,GAAG,gBAAC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AAK,CAAC,CAAC;AAC9B,CAAC"}
@@ -0,0 +1,13 @@
1
+ import type { Config } from 'testplane';
2
+ import type { ConfigAdapter } from './';
3
+ import { TestplaneTestAdapter } from '../test/testplane';
4
+ export declare class TestplaneConfigAdapter implements ConfigAdapter {
5
+ private _config;
6
+ static create<T extends TestplaneConfigAdapter>(this: new (config: Config) => T, config: Config): T;
7
+ constructor(config: Config);
8
+ get tolerance(): number;
9
+ get antialiasingTolerance(): number;
10
+ get browserIds(): string[];
11
+ getBrowserConfig(browserId: string): ReturnType<Config['forBrowser']>;
12
+ getScreenshotPath(test: TestplaneTestAdapter, stateName: string): string;
13
+ }
@@ -0,0 +1,29 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.TestplaneConfigAdapter = void 0;
4
+ class TestplaneConfigAdapter {
5
+ static create(config) {
6
+ return new this(config);
7
+ }
8
+ constructor(config) {
9
+ this._config = config;
10
+ }
11
+ get tolerance() {
12
+ return this._config.tolerance;
13
+ }
14
+ get antialiasingTolerance() {
15
+ return this._config.antialiasingTolerance;
16
+ }
17
+ get browserIds() {
18
+ return this._config.getBrowserIds();
19
+ }
20
+ getBrowserConfig(browserId) {
21
+ return this._config.forBrowser(browserId);
22
+ }
23
+ getScreenshotPath(test, stateName) {
24
+ const { browserId } = test;
25
+ return this._config.browsers[browserId].getScreenshotPath(test.original, stateName);
26
+ }
27
+ }
28
+ exports.TestplaneConfigAdapter = TestplaneConfigAdapter;
29
+ //# sourceMappingURL=testplane.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"testplane.js","sourceRoot":"","sources":["../../../../lib/adapters/config/testplane.ts"],"names":[],"mappings":";;;AAIA,MAAa,sBAAsB;IAG/B,MAAM,CAAC,MAAM,CAAoE,MAAc;QAC3F,OAAO,IAAI,IAAI,CAAC,MAAM,CAAC,CAAC;IAC5B,CAAC;IAED,YAAY,MAAc;QACtB,IAAI,CAAC,OAAO,GAAG,MAAM,CAAC;IAC1B,CAAC;IAED,IAAI,SAAS;QACT,OAAO,IAAI,CAAC,OAAO,CAAC,SAAS,CAAC;IAClC,CAAC;IAED,IAAI,qBAAqB;QACrB,OAAO,IAAI,CAAC,OAAO,CAAC,qBAAqB,CAAC;IAC9C,CAAC;IAED,IAAI,UAAU;QACV,OAAO,IAAI,CAAC,OAAO,CAAC,aAAa,EAAE,CAAC;IACxC,CAAC;IAED,gBAAgB,CAAC,SAAiB;QAC9B,OAAO,IAAI,CAAC,OAAO,CAAC,UAAU,CAAC,SAAS,CAAC,CAAC;IAC9C,CAAC;IAED,iBAAiB,CAAC,IAA0B,EAAE,SAAiB;QAC3D,MAAM,EAAC,SAAS,EAAC,GAAG,IAAI,CAAC;QAEzB,OAAO,IAAI,CAAC,OAAO,CAAC,QAAQ,CAAC,SAAS,CAAC,CAAC,iBAAiB,CAAC,IAAI,CAAC,QAAQ,EAAE,SAAS,CAAC,CAAC;IACxF,CAAC;CACJ;AAhCD,wDAgCC"}
@@ -0,0 +1,24 @@
1
+ import { TestStatus } from '../../constants';
2
+ import type { ReporterTestResult } from '../test-result';
3
+ import type { AssertViewResult } from '../../types';
4
+ export interface CreateTestResultOpts {
5
+ status: TestStatus;
6
+ attempt?: number;
7
+ assertViewResults?: AssertViewResult[];
8
+ error?: Error;
9
+ sessionId?: string;
10
+ meta?: {
11
+ url?: string;
12
+ };
13
+ }
14
+ export interface TestAdapter {
15
+ readonly id: string;
16
+ readonly pending: boolean;
17
+ readonly disabled: boolean;
18
+ readonly silentlySkipped: boolean;
19
+ readonly browserId: string;
20
+ readonly fullName: string;
21
+ readonly file: string;
22
+ readonly titlePath: string[];
23
+ createTestResult(opts: CreateTestResultOpts): ReporterTestResult;
24
+ }
@@ -0,0 +1,3 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../lib/adapters/test/index.ts"],"names":[],"mappings":""}
@@ -0,0 +1,23 @@
1
+ import type { TestAdapter, CreateTestResultOpts } from './';
2
+ import type { ReporterTestResult } from '../test-result';
3
+ export type PwtRawTest = {
4
+ file: string;
5
+ browserName: string;
6
+ title: string;
7
+ titlePath: string[];
8
+ };
9
+ export declare class PlaywrightTestAdapter implements TestAdapter {
10
+ private _test;
11
+ static create<T extends PlaywrightTestAdapter>(this: new (test: PwtRawTest) => T, test: PwtRawTest): T;
12
+ constructor(test: PwtRawTest);
13
+ get original(): PwtRawTest;
14
+ get id(): string;
15
+ get pending(): boolean;
16
+ get disabled(): boolean;
17
+ get silentlySkipped(): boolean;
18
+ get browserId(): string;
19
+ get fullName(): string;
20
+ get file(): string;
21
+ get titlePath(): string[];
22
+ createTestResult(opts: CreateTestResultOpts): ReporterTestResult;
23
+ }
@@ -0,0 +1,103 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.PlaywrightTestAdapter = void 0;
4
+ const playwright_1 = require("../test-result/playwright");
5
+ const constants_1 = require("../../constants");
6
+ class PlaywrightTestAdapter {
7
+ static create(test) {
8
+ return new this(test);
9
+ }
10
+ constructor(test) {
11
+ this._test = test;
12
+ }
13
+ get original() {
14
+ return this._test;
15
+ }
16
+ get id() {
17
+ return this._test.title;
18
+ }
19
+ get pending() {
20
+ return false;
21
+ }
22
+ get disabled() {
23
+ return false;
24
+ }
25
+ get silentlySkipped() {
26
+ return false;
27
+ }
28
+ get browserId() {
29
+ return this._test.browserName;
30
+ }
31
+ get fullName() {
32
+ return this._test.title;
33
+ }
34
+ get file() {
35
+ return this._test.file;
36
+ }
37
+ get titlePath() {
38
+ return this._test.titlePath;
39
+ }
40
+ createTestResult(opts) {
41
+ const { status, attempt = constants_1.UNKNOWN_ATTEMPT, assertViewResults = [] } = opts;
42
+ const testCase = {
43
+ titlePath: () => ['', this._test.browserName, this._test.file, ...this._test.titlePath],
44
+ title: this._test.title,
45
+ annotations: [],
46
+ location: {
47
+ file: this._test.file
48
+ },
49
+ parent: {
50
+ project: () => ({
51
+ name: this._test.browserName
52
+ })
53
+ }
54
+ };
55
+ const attachments = assertViewResults.map(assertViewResult => {
56
+ const attachmentByState = [generateExpectedAttachment(assertViewResult, assertViewResult.refImg)];
57
+ if (assertViewResult.currImg) {
58
+ attachmentByState.push(generateActualAttachment(assertViewResult, assertViewResult.currImg));
59
+ }
60
+ if (assertViewResult.diffImg) {
61
+ // eslint-disable-next-line @typescript-eslint/no-non-null-assertion
62
+ attachmentByState.push(generateDiffAttachment(assertViewResult, assertViewResult.diffImg));
63
+ }
64
+ return attachmentByState;
65
+ }).flat();
66
+ const result = {
67
+ attachments,
68
+ status,
69
+ steps: [],
70
+ startTime: new Date()
71
+ };
72
+ return playwright_1.PlaywrightTestResultAdapter.create(testCase, result, attempt);
73
+ }
74
+ }
75
+ exports.PlaywrightTestAdapter = PlaywrightTestAdapter;
76
+ function generateExpectedAttachment(assertViewResult, imageFile) {
77
+ return {
78
+ name: `${assertViewResult.stateName}${playwright_1.ImageTitleEnding.Expected}`,
79
+ relativePath: assertViewResult.refImg.relativePath,
80
+ ...generateAttachment(assertViewResult, imageFile)
81
+ };
82
+ }
83
+ function generateActualAttachment(assertViewResult, imageFile) {
84
+ return {
85
+ name: `${assertViewResult.stateName}${playwright_1.ImageTitleEnding.Actual}`,
86
+ ...generateAttachment(assertViewResult, imageFile)
87
+ };
88
+ }
89
+ function generateDiffAttachment(assertViewResult, imageFile) {
90
+ return {
91
+ name: `${assertViewResult.stateName}${playwright_1.ImageTitleEnding.Diff}`,
92
+ ...generateAttachment(assertViewResult, imageFile)
93
+ };
94
+ }
95
+ function generateAttachment(assertViewResult, imageFile) {
96
+ return {
97
+ path: imageFile.path,
98
+ contentType: 'image/png',
99
+ size: imageFile.size,
100
+ isUpdated: assertViewResult.isUpdated
101
+ };
102
+ }
103
+ //# sourceMappingURL=playwright.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"playwright.js","sourceRoot":"","sources":["../../../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AC,gBAAgB,EAAE,SAAS,CAAC;KACrD,CAAC;AACN,CAAC;AAED,SAAS,wBAAwB,CAAC,gBAAkC,EAAE,SAAoB;IACtF,OAAO;QACH,IAAI,EAAE,GAAG,gBAAgB,CAAC,SAAS,GAAG,6BAAgB,CAAC,MAAM,EAAE;QAC/D,GAAG,kBAAkB,CAAC,gBAAgB,EAAE,SAAS,CAAC;KACrD,CAAC;AACN,CAAC;AAED,SAAS,sBAAsB,CAAC,gBAAkC,EAAE,SAAoB;IACpF,OAAO;QACH,IAAI,EAAE,GAAG,gBAAgB,CAAC,SAAS,GAAG,6BAAgB,CAAC,IAAI,EAAE;QAC7D,GAAG,kBAAkB,CAAC,gBAAgB,EAAE,SAAS,CAAC;KACrD,CAAC;AACN,CAAC;AAED,SAAS,kBAAkB,CAAC,gBAAkC,EAAE,SAAoB;IAChF,OAAO;QACH,IAAI,EAAE,SAAS,CAAC,IAAI;QACpB,WAAW,EAAE,WAAW;QACxB,IAAI,EAAE,SAAS,CAAC,IAAI;QACpB,SAAS,EAAE,gBAAgB,CAAC,SAAS;KACxC,CAAC;AACN,CAAC"}
@@ -0,0 +1,18 @@
1
+ import type { TestAdapter, CreateTestResultOpts } from './';
2
+ import type { Test } from 'testplane';
3
+ import type { ReporterTestResult } from '../test-result';
4
+ export declare class TestplaneTestAdapter implements TestAdapter {
5
+ private _test;
6
+ static create<T extends TestplaneTestAdapter>(this: new (test: Test) => T, test: Test): T;
7
+ constructor(test: Test);
8
+ get original(): Test;
9
+ get id(): string;
10
+ get pending(): boolean;
11
+ get disabled(): boolean;
12
+ get silentlySkipped(): boolean;
13
+ get browserId(): string;
14
+ get fullName(): string;
15
+ get file(): string;
16
+ get titlePath(): string[];
17
+ createTestResult(opts: CreateTestResultOpts): ReporterTestResult;
18
+ }
@@ -0,0 +1,60 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.TestplaneTestAdapter = void 0;
4
+ const testplane_1 = require("../test-result/testplane");
5
+ const constants_1 = require("../../constants");
6
+ class TestplaneTestAdapter {
7
+ static create(test) {
8
+ return new this(test);
9
+ }
10
+ constructor(test) {
11
+ this._test = test;
12
+ }
13
+ get original() {
14
+ return this._test;
15
+ }
16
+ get id() {
17
+ return this._test.id;
18
+ }
19
+ get pending() {
20
+ return this._test.pending;
21
+ }
22
+ get disabled() {
23
+ return this._test.disabled;
24
+ }
25
+ get silentlySkipped() {
26
+ return isSilentlySkipped(this._test);
27
+ }
28
+ get browserId() {
29
+ return this._test.browserId;
30
+ }
31
+ get fullName() {
32
+ return this._test.fullTitle();
33
+ }
34
+ get file() {
35
+ return this._test.file;
36
+ }
37
+ get titlePath() {
38
+ return this._test.fullTitle().split(constants_1.DEFAULT_TITLE_DELIMITER);
39
+ }
40
+ createTestResult(opts) {
41
+ const { status, assertViewResults, error, sessionId, meta, attempt = constants_1.UNKNOWN_ATTEMPT } = opts;
42
+ const test = this._test.clone();
43
+ [
44
+ { key: 'assertViewResults', value: assertViewResults },
45
+ { key: 'err', value: error },
46
+ { key: 'sessionId', value: sessionId },
47
+ { key: 'meta', value: meta }
48
+ ].forEach(({ key, value }) => {
49
+ if (value) {
50
+ test[key] = value;
51
+ }
52
+ });
53
+ return testplane_1.TestplaneTestResultAdapter.create(test, { attempt, status });
54
+ }
55
+ }
56
+ exports.TestplaneTestAdapter = TestplaneTestAdapter;
57
+ function isSilentlySkipped(runnable) {
58
+ return Boolean(runnable.silentSkip || runnable.parent && isSilentlySkipped(runnable.parent));
59
+ }
60
+ //# sourceMappingURL=testplane.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"testplane.js","sourceRoot":"","sources":["../../../../lib/adapters/test/testplane.ts"],"names":[],"mappings":";;;AAAA,wDAAoE;AACpE,+CAAyE;AAMzE,MAAa,oBAAoB;IAG7B,MAAM,CAAC,MAAM,CAA8D,IAAU;QACjF,OAAO,IAAI,IAAI,CAAC,IAAI,CAAC,CAAC;IAC1B,CAAC;IAED,YAAY,IAAU;QACl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AK,EAAE,IAAI,EAAC;SAC7B,CAAC,OAAO,CAAC,CAAC,EAAC,GAAG,EAAE,KAAK,EAAC,EAAE,EAAE;YACvB,IAAI,KAAK,EAAE;gBACP,IAAI,CAAC,GAAG,CAAC,GAAG,KAAK,CAAC;aACrB;QACL,CAAC,CAAC,CAAC;QAEH,OAAO,sCAA0B,CAAC,MAAM,CAAC,IAAI,EAAE,EAAC,OAAO,EAAE,MAAM,EAAC,CAAC,CAAC;IACtE,CAAC;CACJ;AAhED,oDAgEC;AAED,SAAS,iBAAiB,CAAC,QAAsB;IAC7C,OAAO,OAAO,CAAC,QAAQ,CAAC,UAAU,IAAI,QAAQ,CAAC,MAAM,IAAI,iBAAiB,CAAC,QAAQ,CAAC,MAAM,CAAC,CAAC,CAAC;AACjG,CAAC"}
@@ -0,0 +1,4 @@
1
+ import type { TestAdapter } from '../test';
2
+ export interface TestCollectionAdapter {
3
+ readonly tests: TestAdapter[];
4
+ }
@@ -0,0 +1,3 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../lib/adapters/test-collection/index.ts"],"names":[],"mappings":""}
@@ -0,0 +1,8 @@
1
+ import { PlaywrightTestAdapter, type PwtRawTest } from '../test/playwright';
2
+ import type { TestCollectionAdapter } from './';
3
+ export declare class PlaywrightTestCollectionAdapter implements TestCollectionAdapter {
4
+ private _testAdapters;
5
+ static create<T>(this: new (tests: PwtRawTest[]) => T, tests: PwtRawTest[]): T;
6
+ constructor(tests: PwtRawTest[]);
7
+ get tests(): PlaywrightTestAdapter[];
8
+ }
@@ -0,0 +1,17 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.PlaywrightTestCollectionAdapter = void 0;
4
+ const playwright_1 = require("../test/playwright");
5
+ class PlaywrightTestCollectionAdapter {
6
+ static create(tests) {
7
+ return new this(tests);
8
+ }
9
+ constructor(tests) {
10
+ this._testAdapters = tests.map(test => playwright_1.PlaywrightTestAdapter.create(test));
11
+ }
12
+ get tests() {
13
+ return this._testAdapters;
14
+ }
15
+ }
16
+ exports.PlaywrightTestCollectionAdapter = PlaywrightTestCollectionAdapter;
17
+ //# sourceMappingURL=playwright.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"playwright.js","sourceRoot":"","sources":["../../../../lib/adapters/test-collection/playwright.ts"],"names":[],"mappings":";;;AAAA,mDAA0E;AAG1E,MAAa,+BAA+B;IAGxC,MAAM,CAAC,MAAM,CAET,KAAmB;QAEnB,OAAO,IAAI,IAAI,CAAC,KAAK,CAAC,CAAC;IAC3B,CAAC;IAED,YAAY,KAAmB;QAC3B,IAAI,CAAC,aAAa,GAAG,KAAK,CAAC,GAAG,CAAC,IAAI,CAAC,EAAE,CAAC,kCAAqB,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC,CAAC;IAC/E,CAAC;IAED,IAAI,KAAK;QACL,OAAO,IAAI,CAAC,aAAa,CAAC;IAC9B,CAAC;CACJ;AAjBD,0EAiBC"}
@@ -0,0 +1,11 @@
1
+ import { TestplaneTestAdapter } from '../test/testplane';
2
+ import type { TestCollectionAdapter } from './';
3
+ import type { TestCollection } from 'testplane';
4
+ export declare class TestplaneTestCollectionAdapter implements TestCollectionAdapter {
5
+ private _testCollection;
6
+ private _testAdapters;
7
+ static create<T>(this: new (testCollection: TestCollection) => T, testCollection: TestCollection): T;
8
+ constructor(testCollection: TestCollection);
9
+ get original(): TestCollection;
10
+ get tests(): TestplaneTestAdapter[];
11
+ }
@@ -0,0 +1,21 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.TestplaneTestCollectionAdapter = void 0;
4
+ const testplane_1 = require("../test/testplane");
5
+ class TestplaneTestCollectionAdapter {
6
+ static create(testCollection) {
7
+ return new this(testCollection);
8
+ }
9
+ constructor(testCollection) {
10
+ this._testCollection = testCollection;
11
+ this._testAdapters = this._testCollection.mapTests(test => testplane_1.TestplaneTestAdapter.create(test));
12
+ }
13
+ get original() {
14
+ return this._testCollection;
15
+ }
16
+ get tests() {
17
+ return this._testAdapters;
18
+ }
19
+ }
20
+ exports.TestplaneTestCollectionAdapter = TestplaneTestCollectionAdapter;
21
+ //# sourceMappingURL=testplane.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"testplane.js","sourceRoot":"","sources":["../../../../lib/adapters/test-collection/testplane.ts"],"names":[],"mappings":";;;AAAA,iDAAuD;AAIvD,MAAa,8BAA8B;IAIvC,MAAM,CAAC,MAAM,CAET,cAA8B;QAE9B,OAAO,IAAI,IAAI,CAAC,cAAc,CAAC,CAAC;IACpC,CAAC;IAED,YAAY,cAA8B;QACtC,IAAI,CAAC,eAAe,GAAG,cAAc,CAAC;QACtC,IAAI,CAAC,aAAa,GAAG,IAAI,CAAC,eAAe,CAAC,QAAQ,CAAC,IAAI,CAAC,EAAE,CAAC,gCAAoB,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC,CAAC;IAClG,CAAC;IAED,IAAI,QAAQ;QACR,OAAO,IAAI,CAAC,eAAe,CAAC;IAChC,CAAC;IAED,IAAI,KAAK;QACL,OAAO,IAAI,CAAC,aAAa,CAAC;IAC9B,CAAC;CACJ;AAvBD,wEAuBC"}
@@ -3,7 +3,14 @@ import { ReporterTestResult } from './index';
3
3
  import { TestStatus } from '../../constants';
4
4
  import { ErrorDetails, ImageFile, ImageInfoFull, TestError } from '../../types';
5
5
  import type { CoordBounds } from 'looks-same';
6
- export type PlaywrightAttachment = PlaywrightTestResult['attachments'][number];
6
+ export type PlaywrightAttachment = PlaywrightTestResult['attachments'][number] & {
7
+ relativePath?: string;
8
+ size?: {
9
+ width: number;
10
+ height: number;
11
+ };
12
+ isUpdated?: boolean;
13
+ };
7
14
  type ExtendedError<T> = TestError & {
8
15
  meta?: T & {
9
16
  type: string;
@@ -29,14 +36,18 @@ export declare enum ImageTitleEnding {
29
36
  Diff = "-diff.png",
30
37
  Previous = "-previous.png"
31
38
  }
39
+ export interface TestResultWithGuiStatus extends Omit<PlaywrightTestResult, 'status'> {
40
+ status: PlaywrightTestResult['status'] | TestStatus.RUNNING | TestStatus.UPDATED;
41
+ }
32
42
  export declare const DEFAULT_DIFF_OPTIONS: {
33
43
  diffColor: string;
34
44
  };
35
- export declare const getStatus: (result: PlaywrightTestResult) => TestStatus;
45
+ export declare const getStatus: (result: TestResultWithGuiStatus) => TestStatus;
36
46
  export declare class PlaywrightTestResultAdapter implements ReporterTestResult {
37
47
  private readonly _testCase;
38
48
  private readonly _testResult;
39
49
  private _attempt;
50
+ static create<T extends PlaywrightTestResultAdapter>(this: new (testCase: PlaywrightTestCase, testResult: PlaywrightTestResult, attempt: number) => T, testCase: PlaywrightTestCase, testResult: PlaywrightTestResult, attempt: number): T;
40
51
  constructor(testCase: PlaywrightTestCase, testResult: PlaywrightTestResult, attempt: number);
41
52
  get attempt(): number;
42
53
  get browserId(): string;
@@ -31,13 +31,22 @@ exports.DEFAULT_DIFF_OPTIONS = {
31
31
  diffColor: '#ff00ff'
32
32
  };
33
33
  const getStatus = (result) => {
34
+ if (result.status === constants_1.TestStatus.RUNNING) {
35
+ return constants_1.TestStatus.RUNNING;
36
+ }
37
+ if (result.status === constants_1.TestStatus.UPDATED) {
38
+ return constants_1.TestStatus.UPDATED;
39
+ }
34
40
  if (result.status === PwtTestStatus.PASSED) {
35
41
  return constants_1.TestStatus.SUCCESS;
36
42
  }
37
43
  if ([PwtTestStatus.FAILED, PwtTestStatus.TIMED_OUT, PwtTestStatus.INTERRUPTED].includes(result.status)) {
38
44
  return constants_1.TestStatus.FAIL;
39
45
  }
40
- return constants_1.TestStatus.SKIPPED;
46
+ if (result.status === PwtTestStatus.SKIPPED) {
47
+ return constants_1.TestStatus.SKIPPED;
48
+ }
49
+ return constants_1.TestStatus.IDLE;
41
50
  };
42
51
  exports.getStatus = getStatus;
43
52
  const extractErrorMessage = (result) => {
@@ -82,10 +91,14 @@ const getImageData = (attachment) => {
82
91
  }
83
92
  return {
84
93
  path: attachment.path,
85
- size: lodash_1.default.pick((0, image_size_1.default)(attachment.path), ['height', 'width'])
94
+ size: !attachment.size ? lodash_1.default.pick((0, image_size_1.default)(attachment.path), ['height', 'width']) : attachment.size,
95
+ ...(attachment.relativePath ? { relativePath: attachment.relativePath } : {})
86
96
  };
87
97
  };
88
98
  class PlaywrightTestResultAdapter {
99
+ static create(testCase, testResult, attempt) {
100
+ return new this(testCase, testResult, attempt);
101
+ }
89
102
  constructor(testCase, testResult, attempt) {
90
103
  this._testCase = testCase;
91
104
  this._testResult = testResult;
@@ -108,7 +121,7 @@ class PlaywrightTestResultAdapter {
108
121
  if (!lodash_1.default.isNil(stack)) {
109
122
  result.stack = stack;
110
123
  }
111
- if (message.includes('snapshot doesn\'t exist') && message.includes('.png')) {
124
+ if (/snapshot .*doesn't exist/.test(message) && message.includes('.png')) {
112
125
  result.name = errors_1.ErrorName.NO_REF_IMAGE;
113
126
  }
114
127
  else if (message.includes('Screenshot comparison failed')) {
@@ -125,7 +138,7 @@ class PlaywrightTestResultAdapter {
125
138
  return path_1.default.relative(process.cwd(), this._testCase.location.file);
126
139
  }
127
140
  get fullName() {
128
- return this.testPath.join(constants_1.PWT_TITLE_DELIMITER);
141
+ return this.testPath.join(constants_1.DEFAULT_TITLE_DELIMITER);
129
142
  }
130
143
  get history() {
131
144
  return this._testResult.steps.map(step => `${step.title} <- ${step.duration}ms\n`);
@@ -165,6 +178,15 @@ class PlaywrightTestResultAdapter {
165
178
  actualImg
166
179
  };
167
180
  }
181
+ else if (expectedAttachment?.isUpdated && expectedImg && actualImg) {
182
+ return {
183
+ status: constants_1.UPDATED,
184
+ stateName: state,
185
+ refImg: lodash_1.default.clone(expectedImg),
186
+ expectedImg,
187
+ actualImg
188
+ };
189
+ }
168
190
  else if (!error && expectedImg) {
169
191
  return {
170
192
  status: constants_1.SUCCESS,