@empiricalrun/playwright-utils 0.28.7 → 0.29.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.
- package/CHANGELOG.md +45 -0
- package/dist/config/index.d.ts.map +1 -1
- package/dist/config/index.js +1 -6
- package/dist/playwright-extensions.d.ts.map +1 -1
- package/dist/reporter/empirical-reporter.d.ts +1 -1
- package/dist/reporter/empirical-reporter.d.ts.map +1 -1
- package/dist/reporter/empirical-reporter.js +38 -38
- package/dist/reporter/uploader.d.ts +1 -12
- package/dist/reporter/uploader.d.ts.map +1 -1
- package/dist/reporter/uploader.js +0 -42
- package/dist/reporter/util.d.ts +3 -21
- package/dist/reporter/util.d.ts.map +1 -1
- package/dist/reporter/util.js +0 -17
- package/package.json +6 -6
- package/playwright.config.ts +7 -4
- package/tsconfig.tsbuildinfo +1 -1
- package/dist/reporter/base.d.ts +0 -41
- package/dist/reporter/base.d.ts.map +0 -1
- package/dist/reporter/base.js +0 -177
- package/dist/reporter/custom.d.ts +0 -72
- package/dist/reporter/custom.d.ts.map +0 -1
- package/dist/reporter/custom.js +0 -824
- package/dist/reporter/queue.d.ts +0 -8
- package/dist/reporter/queue.d.ts.map +0 -1
- package/dist/reporter/queue.js +0 -88
- package/dist/reporter/reporterV2.d.ts +0 -36
- package/dist/reporter/reporterV2.d.ts.map +0 -1
- package/dist/reporter/reporterV2.js +0 -19
- package/dist/reporter/third_party/html-reporter-types.d.ts +0 -107
- package/dist/reporter/third_party/html-reporter-types.d.ts.map +0 -1
- package/dist/reporter/third_party/html-reporter-types.js +0 -18
- package/dist/reporter/types.d.ts +0 -3
- package/dist/reporter/types.d.ts.map +0 -1
- package/dist/reporter/types.js +0 -2
- package/eslint.config.mjs +0 -23
package/dist/reporter/base.js
DELETED
|
@@ -1,177 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
/**
|
|
3
|
-
* Original file: https://github.com/microsoft/playwright/blob/cf8c14f884b6f24966350a5f49b1580c3e183d21/packages/playwright/src/reporters/base.ts
|
|
4
|
-
* Copyright (c) Microsoft Corporation.
|
|
5
|
-
* Modifications copyright (c) Forge AI Private Limited
|
|
6
|
-
*
|
|
7
|
-
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
8
|
-
* you may not use this file except in compliance with the License.
|
|
9
|
-
* You may obtain a copy of the License at
|
|
10
|
-
*
|
|
11
|
-
* http://www.apache.org/licenses/LICENSE-2.0
|
|
12
|
-
*
|
|
13
|
-
* Unless required by applicable law or agreed to in writing, software
|
|
14
|
-
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
15
|
-
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
16
|
-
* See the License for the specific language governing permissions and
|
|
17
|
-
* limitations under the License.
|
|
18
|
-
*/
|
|
19
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
20
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
21
|
-
};
|
|
22
|
-
var _a;
|
|
23
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
24
|
-
exports.colors = exports.ttyWidth = exports.isTTY = exports.kOutputSymbol = void 0;
|
|
25
|
-
exports.formatResultFailure = formatResultFailure;
|
|
26
|
-
exports.relativeFilePath = relativeFilePath;
|
|
27
|
-
exports.stepSuffix = stepSuffix;
|
|
28
|
-
exports.formatError = formatError;
|
|
29
|
-
exports.separator = separator;
|
|
30
|
-
exports.prepareErrorStack = prepareErrorStack;
|
|
31
|
-
exports.stripAnsiEscapes = stripAnsiEscapes;
|
|
32
|
-
const path_1 = __importDefault(require("path"));
|
|
33
|
-
const utilsBundle_1 = require("playwright-core/lib/utilsBundle");
|
|
34
|
-
exports.kOutputSymbol = Symbol("output");
|
|
35
|
-
_a = (() => {
|
|
36
|
-
let isTTY = !!process.stdout.isTTY;
|
|
37
|
-
let ttyWidth = process.stdout.columns || 0;
|
|
38
|
-
// if (
|
|
39
|
-
// process.env.PLAYWRIGHT_FORCE_TTY === "false" ||
|
|
40
|
-
// process.env.PLAYWRIGHT_FORCE_TTY === "0"
|
|
41
|
-
// ) {
|
|
42
|
-
// isTTY = false;
|
|
43
|
-
// ttyWidth = 0;
|
|
44
|
-
// } else if (
|
|
45
|
-
// process.env.PLAYWRIGHT_FORCE_TTY === "true" ||
|
|
46
|
-
// process.env.PLAYWRIGHT_FORCE_TTY === "1"
|
|
47
|
-
// ) {
|
|
48
|
-
// isTTY = true;
|
|
49
|
-
// ttyWidth = process.stdout.columns || 100;
|
|
50
|
-
// } else if (process.env.PLAYWRIGHT_FORCE_TTY) {
|
|
51
|
-
// isTTY = true;
|
|
52
|
-
// ttyWidth = +process.env.PLAYWRIGHT_FORCE_TTY;
|
|
53
|
-
// if (isNaN(ttyWidth)) ttyWidth = 100;
|
|
54
|
-
// }
|
|
55
|
-
let useColors = isTTY;
|
|
56
|
-
// if (
|
|
57
|
-
// process.env.DEBUG_COLORS === "0" ||
|
|
58
|
-
// process.env.DEBUG_COLORS === "false" ||
|
|
59
|
-
// process.env.FORCE_COLOR === "0" ||
|
|
60
|
-
// process.env.FORCE_COLOR === "false"
|
|
61
|
-
// )
|
|
62
|
-
// useColors = false;
|
|
63
|
-
// else if (process.env.DEBUG_COLORS || process.env.FORCE_COLOR)
|
|
64
|
-
// useColors = true;
|
|
65
|
-
const colors = useColors
|
|
66
|
-
? utilsBundle_1.colors
|
|
67
|
-
: {
|
|
68
|
-
bold: (t) => t,
|
|
69
|
-
cyan: (t) => t,
|
|
70
|
-
dim: (t) => t,
|
|
71
|
-
gray: (t) => t,
|
|
72
|
-
green: (t) => t,
|
|
73
|
-
red: (t) => t,
|
|
74
|
-
yellow: (t) => t,
|
|
75
|
-
enabled: false,
|
|
76
|
-
};
|
|
77
|
-
return { isTTY, ttyWidth, colors };
|
|
78
|
-
})(), exports.isTTY = _a.isTTY, exports.ttyWidth = _a.ttyWidth, exports.colors = _a.colors;
|
|
79
|
-
function formatResultFailure(test, result, initialIndent, highlightCode) {
|
|
80
|
-
const errorDetails = [];
|
|
81
|
-
if (result.status === "passed" && test.expectedStatus === "failed") {
|
|
82
|
-
errorDetails.push({
|
|
83
|
-
message: indent(exports.colors.red(`Expected to fail, but passed.`), initialIndent),
|
|
84
|
-
});
|
|
85
|
-
}
|
|
86
|
-
if (result.status === "interrupted") {
|
|
87
|
-
errorDetails.push({
|
|
88
|
-
message: indent(exports.colors.red(`Test was interrupted.`), initialIndent),
|
|
89
|
-
});
|
|
90
|
-
}
|
|
91
|
-
for (const error of result.errors) {
|
|
92
|
-
const formattedError = formatError(error, highlightCode);
|
|
93
|
-
errorDetails.push({
|
|
94
|
-
message: indent(formattedError.message, initialIndent),
|
|
95
|
-
location: formattedError.location,
|
|
96
|
-
});
|
|
97
|
-
}
|
|
98
|
-
return errorDetails;
|
|
99
|
-
}
|
|
100
|
-
function relativeFilePath(config, file) {
|
|
101
|
-
return path_1.default.relative(config.rootDir, file) || path_1.default.basename(file);
|
|
102
|
-
}
|
|
103
|
-
function stepSuffix(step) {
|
|
104
|
-
const stepTitles = step ? step.titlePath() : [];
|
|
105
|
-
return stepTitles
|
|
106
|
-
.map((t) => t.split("\n")[0])
|
|
107
|
-
.map((t) => " › " + t)
|
|
108
|
-
.join("");
|
|
109
|
-
}
|
|
110
|
-
function formatError(error, highlightCode) {
|
|
111
|
-
const message = error.message || error.value || "";
|
|
112
|
-
const stack = error.stack;
|
|
113
|
-
if (!stack && !error.location)
|
|
114
|
-
return { message };
|
|
115
|
-
const tokens = [];
|
|
116
|
-
// Now that we filter out internals from our stack traces, we can safely render
|
|
117
|
-
// the helper / original exception locations.
|
|
118
|
-
const parsedStack = stack ? prepareErrorStack(stack) : undefined;
|
|
119
|
-
tokens.push(parsedStack?.message || message);
|
|
120
|
-
if (error.snippet) {
|
|
121
|
-
let snippet = error.snippet;
|
|
122
|
-
if (!highlightCode)
|
|
123
|
-
snippet = stripAnsiEscapes(snippet);
|
|
124
|
-
tokens.push("");
|
|
125
|
-
tokens.push(snippet);
|
|
126
|
-
}
|
|
127
|
-
if (parsedStack && parsedStack.stackLines.length) {
|
|
128
|
-
tokens.push("");
|
|
129
|
-
tokens.push(exports.colors.dim(parsedStack.stackLines.join("\n")));
|
|
130
|
-
}
|
|
131
|
-
let location = error.location;
|
|
132
|
-
if (parsedStack && !location)
|
|
133
|
-
location = parsedStack.location;
|
|
134
|
-
return {
|
|
135
|
-
location,
|
|
136
|
-
message: tokens.join("\n"),
|
|
137
|
-
};
|
|
138
|
-
}
|
|
139
|
-
function separator(text = "") {
|
|
140
|
-
if (text)
|
|
141
|
-
text += " ";
|
|
142
|
-
const columns = Math.min(100, exports.ttyWidth || 100);
|
|
143
|
-
return text + exports.colors.dim("─".repeat(Math.max(0, columns - text.length)));
|
|
144
|
-
}
|
|
145
|
-
function indent(lines, tab) {
|
|
146
|
-
return lines.replace(/^(?=.+$)/gm, tab);
|
|
147
|
-
}
|
|
148
|
-
function prepareErrorStack(stack) {
|
|
149
|
-
const lines = stack.split("\n");
|
|
150
|
-
let firstStackLine = lines.findIndex((line) => line.startsWith(" at "));
|
|
151
|
-
if (firstStackLine === -1)
|
|
152
|
-
firstStackLine = lines.length;
|
|
153
|
-
const message = lines.slice(0, firstStackLine).join("\n");
|
|
154
|
-
const stackLines = lines.slice(firstStackLine);
|
|
155
|
-
let location;
|
|
156
|
-
for (const line of stackLines) {
|
|
157
|
-
const frame = (0, utilsBundle_1.parseStackTraceLine)(line);
|
|
158
|
-
if (!frame || !frame.file)
|
|
159
|
-
continue;
|
|
160
|
-
if (belongsToNodeModules(frame.file))
|
|
161
|
-
continue;
|
|
162
|
-
location = {
|
|
163
|
-
file: frame.file,
|
|
164
|
-
column: frame.column || 0,
|
|
165
|
-
line: frame.line || 0,
|
|
166
|
-
};
|
|
167
|
-
break;
|
|
168
|
-
}
|
|
169
|
-
return { message, stackLines, location };
|
|
170
|
-
}
|
|
171
|
-
const ansiRegex = new RegExp("([\\u001B\\u009B][[\\]()#;?]*(?:(?:(?:[a-zA-Z\\d]*(?:;[-a-zA-Z\\d\\/#&.:=?%@~_]*)*)?\\u0007)|(?:(?:\\d{1,4}(?:;\\d{0,4})*)?[\\dA-PR-TZcf-ntqry=><~])))", "g");
|
|
172
|
-
function stripAnsiEscapes(str) {
|
|
173
|
-
return str.replace(ansiRegex, "");
|
|
174
|
-
}
|
|
175
|
-
function belongsToNodeModules(file) {
|
|
176
|
-
return file.includes(`${path_1.default.sep}node_modules${path_1.default.sep}`);
|
|
177
|
-
}
|
|
@@ -1,72 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Original file: https://github.com/microsoft/playwright/blob/cf8c14f884b6f24966350a5f49b1580c3e183d21/packages/playwright/src/reporters/html.ts
|
|
3
|
-
* Copyright (c) Microsoft Corporation.
|
|
4
|
-
* Modifications copyright (c) Forge AI Private Limited
|
|
5
|
-
*
|
|
6
|
-
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
7
|
-
* you may not use this file except in compliance with the License.
|
|
8
|
-
* You may obtain a copy of the License at
|
|
9
|
-
*
|
|
10
|
-
* http://www.apache.org/licenses/LICENSE-2.0
|
|
11
|
-
*
|
|
12
|
-
* Unless required by applicable law or agreed to in writing, software
|
|
13
|
-
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
14
|
-
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
15
|
-
* See the License for the specific language governing permissions and
|
|
16
|
-
* limitations under the License.
|
|
17
|
-
*/
|
|
18
|
-
import type { FullConfig, FullResult, Suite, TestCase as TestCasePublic, TestError, TestResult as TestResultPublic } from "@playwright/test/reporter";
|
|
19
|
-
import { HttpServer } from "playwright-core/lib/utils";
|
|
20
|
-
import type { ReporterV2 } from "./reporterV2";
|
|
21
|
-
declare const htmlReportOptions: string[];
|
|
22
|
-
type HtmlReportOpenOption = (typeof htmlReportOptions)[number];
|
|
23
|
-
type HtmlReporterOptions = {
|
|
24
|
-
configDir: string;
|
|
25
|
-
outputFolder?: string;
|
|
26
|
-
open?: HtmlReportOpenOption;
|
|
27
|
-
host?: string;
|
|
28
|
-
port?: number;
|
|
29
|
-
attachmentsBaseURL?: string;
|
|
30
|
-
_mode?: "test" | "list";
|
|
31
|
-
_isTestServer?: boolean;
|
|
32
|
-
};
|
|
33
|
-
declare class HtmlReporter implements ReporterV2 {
|
|
34
|
-
private config;
|
|
35
|
-
private suite;
|
|
36
|
-
private _options;
|
|
37
|
-
private _outputFolder;
|
|
38
|
-
private _attachmentsBaseURL;
|
|
39
|
-
private _open;
|
|
40
|
-
private _port;
|
|
41
|
-
private _host;
|
|
42
|
-
private haveSeenAttachments;
|
|
43
|
-
private _buildResult;
|
|
44
|
-
private _topLevelErrors;
|
|
45
|
-
constructor(options: HtmlReporterOptions);
|
|
46
|
-
printsToStdio(): boolean;
|
|
47
|
-
onStdOut(): void;
|
|
48
|
-
onStdErr(): void;
|
|
49
|
-
onStepBegin(): void;
|
|
50
|
-
onStepEnd(): void;
|
|
51
|
-
onTestBegin(test: TestCasePublic): void;
|
|
52
|
-
version(): "v2";
|
|
53
|
-
onTestEnd(test: TestCasePublic, result: TestResultPublic): void;
|
|
54
|
-
private processTestAttachment;
|
|
55
|
-
onConfigure(config: FullConfig): void;
|
|
56
|
-
onBegin(suite: Suite): void;
|
|
57
|
-
_resolveOptions(): {
|
|
58
|
-
outputFolder: string;
|
|
59
|
-
open: HtmlReportOpenOption;
|
|
60
|
-
attachmentsBaseURL: string;
|
|
61
|
-
host: string | undefined;
|
|
62
|
-
port: number | undefined;
|
|
63
|
-
};
|
|
64
|
-
_isSubdirectory(parentDir: string, dir: string): boolean;
|
|
65
|
-
onError(error: TestError): void;
|
|
66
|
-
onEnd(result: FullResult): Promise<void>;
|
|
67
|
-
onExit(): Promise<void>;
|
|
68
|
-
}
|
|
69
|
-
export declare function showHTMLReport(reportFolder: string | undefined, host?: string, port?: number, testId?: string): Promise<void>;
|
|
70
|
-
export declare function startHtmlReportServer(folder: string): HttpServer;
|
|
71
|
-
export default HtmlReporter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