@scoutqa/playwright 1.58.0-fork.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.
- package/ThirdPartyNotices.txt +3919 -0
- package/cli.js +19 -0
- package/index.d.ts +17 -0
- package/index.js +17 -0
- package/index.mjs +18 -0
- package/jsx-runtime.js +42 -0
- package/jsx-runtime.mjs +21 -0
- package/lib/agents/agentParser.js +89 -0
- package/lib/agents/copilot-setup-steps.yml +34 -0
- package/lib/agents/generateAgents.js +348 -0
- package/lib/agents/playwright-test-coverage.prompt.md +31 -0
- package/lib/agents/playwright-test-generate.prompt.md +8 -0
- package/lib/agents/playwright-test-generator.agent.md +88 -0
- package/lib/agents/playwright-test-heal.prompt.md +6 -0
- package/lib/agents/playwright-test-healer.agent.md +55 -0
- package/lib/agents/playwright-test-plan.prompt.md +9 -0
- package/lib/agents/playwright-test-planner.agent.md +73 -0
- package/lib/common/config.js +281 -0
- package/lib/common/configLoader.js +344 -0
- package/lib/common/esmLoaderHost.js +104 -0
- package/lib/common/expectBundle.js +43 -0
- package/lib/common/expectBundleImpl.js +407 -0
- package/lib/common/fixtures.js +302 -0
- package/lib/common/globals.js +58 -0
- package/lib/common/ipc.js +60 -0
- package/lib/common/poolBuilder.js +85 -0
- package/lib/common/process.js +132 -0
- package/lib/common/suiteUtils.js +140 -0
- package/lib/common/test.js +322 -0
- package/lib/common/testLoader.js +101 -0
- package/lib/common/testType.js +298 -0
- package/lib/common/validators.js +68 -0
- package/lib/fsWatcher.js +67 -0
- package/lib/index.js +721 -0
- package/lib/internalsForTest.js +42 -0
- package/lib/isomorphic/events.js +77 -0
- package/lib/isomorphic/folders.js +30 -0
- package/lib/isomorphic/stringInternPool.js +69 -0
- package/lib/isomorphic/teleReceiver.js +523 -0
- package/lib/isomorphic/teleSuiteUpdater.js +157 -0
- package/lib/isomorphic/testServerConnection.js +225 -0
- package/lib/isomorphic/testServerInterface.js +16 -0
- package/lib/isomorphic/testTree.js +329 -0
- package/lib/isomorphic/types.d.js +16 -0
- package/lib/loader/loaderMain.js +59 -0
- package/lib/matchers/expect.js +324 -0
- package/lib/matchers/matcherHint.js +87 -0
- package/lib/matchers/matchers.js +382 -0
- package/lib/matchers/toBeTruthy.js +73 -0
- package/lib/matchers/toEqual.js +99 -0
- package/lib/matchers/toHaveURL.js +102 -0
- package/lib/matchers/toMatchAriaSnapshot.js +159 -0
- package/lib/matchers/toMatchSnapshot.js +341 -0
- package/lib/matchers/toMatchText.js +99 -0
- package/lib/mcp/browser/actions.d.js +16 -0
- package/lib/mcp/browser/browserContextFactory.js +321 -0
- package/lib/mcp/browser/browserServerBackend.js +77 -0
- package/lib/mcp/browser/config.js +418 -0
- package/lib/mcp/browser/context.js +285 -0
- package/lib/mcp/browser/response.js +352 -0
- package/lib/mcp/browser/sessionLog.js +160 -0
- package/lib/mcp/browser/tab.js +328 -0
- package/lib/mcp/browser/tools/common.js +63 -0
- package/lib/mcp/browser/tools/console.js +44 -0
- package/lib/mcp/browser/tools/dialogs.js +60 -0
- package/lib/mcp/browser/tools/evaluate.js +59 -0
- package/lib/mcp/browser/tools/files.js +58 -0
- package/lib/mcp/browser/tools/form.js +63 -0
- package/lib/mcp/browser/tools/install.js +69 -0
- package/lib/mcp/browser/tools/keyboard.js +84 -0
- package/lib/mcp/browser/tools/mouse.js +107 -0
- package/lib/mcp/browser/tools/navigate.js +62 -0
- package/lib/mcp/browser/tools/network.js +60 -0
- package/lib/mcp/browser/tools/pdf.js +48 -0
- package/lib/mcp/browser/tools/runCode.js +77 -0
- package/lib/mcp/browser/tools/screenshot.js +105 -0
- package/lib/mcp/browser/tools/snapshot.js +191 -0
- package/lib/mcp/browser/tools/tabs.js +67 -0
- package/lib/mcp/browser/tools/tool.js +50 -0
- package/lib/mcp/browser/tools/tracing.js +74 -0
- package/lib/mcp/browser/tools/utils.js +94 -0
- package/lib/mcp/browser/tools/verify.js +143 -0
- package/lib/mcp/browser/tools/wait.js +63 -0
- package/lib/mcp/browser/tools.js +82 -0
- package/lib/mcp/browser/watchdog.js +44 -0
- package/lib/mcp/config.d.js +16 -0
- package/lib/mcp/extension/cdpRelay.js +351 -0
- package/lib/mcp/extension/extensionContextFactory.js +76 -0
- package/lib/mcp/extension/protocol.js +28 -0
- package/lib/mcp/index.js +61 -0
- package/lib/mcp/log.js +35 -0
- package/lib/mcp/program.js +93 -0
- package/lib/mcp/sdk/exports.js +28 -0
- package/lib/mcp/sdk/http.js +152 -0
- package/lib/mcp/sdk/inProcessTransport.js +71 -0
- package/lib/mcp/sdk/server.js +207 -0
- package/lib/mcp/sdk/tool.js +47 -0
- package/lib/mcp/test/browserBackend.js +98 -0
- package/lib/mcp/test/generatorTools.js +122 -0
- package/lib/mcp/test/plannerTools.js +144 -0
- package/lib/mcp/test/seed.js +82 -0
- package/lib/mcp/test/streams.js +44 -0
- package/lib/mcp/test/testBackend.js +99 -0
- package/lib/mcp/test/testContext.js +279 -0
- package/lib/mcp/test/testTool.js +30 -0
- package/lib/mcp/test/testTools.js +108 -0
- package/lib/plugins/gitCommitInfoPlugin.js +198 -0
- package/lib/plugins/index.js +28 -0
- package/lib/plugins/webServerPlugin.js +237 -0
- package/lib/program.js +417 -0
- package/lib/reporters/base.js +609 -0
- package/lib/reporters/blob.js +139 -0
- package/lib/reporters/dot.js +82 -0
- package/lib/reporters/empty.js +32 -0
- package/lib/reporters/github.js +128 -0
- package/lib/reporters/html.js +623 -0
- package/lib/reporters/internalReporter.js +140 -0
- package/lib/reporters/json.js +255 -0
- package/lib/reporters/junit.js +232 -0
- package/lib/reporters/line.js +113 -0
- package/lib/reporters/list.js +231 -0
- package/lib/reporters/listModeReporter.js +69 -0
- package/lib/reporters/markdown.js +144 -0
- package/lib/reporters/merge.js +546 -0
- package/lib/reporters/multiplexer.js +112 -0
- package/lib/reporters/reporterV2.js +102 -0
- package/lib/reporters/teleEmitter.js +319 -0
- package/lib/reporters/versions/blobV1.js +16 -0
- package/lib/runner/dispatcher.js +533 -0
- package/lib/runner/failureTracker.js +72 -0
- package/lib/runner/lastRun.js +77 -0
- package/lib/runner/loadUtils.js +334 -0
- package/lib/runner/loaderHost.js +89 -0
- package/lib/runner/processHost.js +180 -0
- package/lib/runner/projectUtils.js +241 -0
- package/lib/runner/rebase.js +189 -0
- package/lib/runner/reporters.js +138 -0
- package/lib/runner/sigIntWatcher.js +96 -0
- package/lib/runner/storage.js +91 -0
- package/lib/runner/taskRunner.js +127 -0
- package/lib/runner/tasks.js +410 -0
- package/lib/runner/testGroups.js +125 -0
- package/lib/runner/testRunner.js +398 -0
- package/lib/runner/testServer.js +269 -0
- package/lib/runner/uiModeReporter.js +30 -0
- package/lib/runner/vcs.js +72 -0
- package/lib/runner/watchMode.js +396 -0
- package/lib/runner/workerHost.js +104 -0
- package/lib/third_party/pirates.js +62 -0
- package/lib/third_party/tsconfig-loader.js +103 -0
- package/lib/transform/babelBundle.js +43 -0
- package/lib/transform/babelBundleImpl.js +461 -0
- package/lib/transform/babelHighlightUtils.js +63 -0
- package/lib/transform/compilationCache.js +272 -0
- package/lib/transform/esmLoader.js +103 -0
- package/lib/transform/portTransport.js +67 -0
- package/lib/transform/transform.js +296 -0
- package/lib/util.js +403 -0
- package/lib/utilsBundle.js +43 -0
- package/lib/utilsBundleImpl.js +100 -0
- package/lib/worker/fixtureRunner.js +258 -0
- package/lib/worker/testInfo.js +557 -0
- package/lib/worker/testTracing.js +345 -0
- package/lib/worker/timeoutManager.js +174 -0
- package/lib/worker/util.js +31 -0
- package/lib/worker/workerMain.js +529 -0
- package/package.json +72 -0
- package/test.d.ts +18 -0
- package/test.js +24 -0
- package/test.mjs +34 -0
- package/types/test.d.ts +10277 -0
- package/types/testReporter.d.ts +827 -0
|
@@ -0,0 +1,139 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __create = Object.create;
|
|
3
|
+
var __defProp = Object.defineProperty;
|
|
4
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
5
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
6
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
7
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
8
|
+
var __export = (target, all) => {
|
|
9
|
+
for (var name in all)
|
|
10
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
11
|
+
};
|
|
12
|
+
var __copyProps = (to, from, except, desc) => {
|
|
13
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
14
|
+
for (let key of __getOwnPropNames(from))
|
|
15
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
16
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
17
|
+
}
|
|
18
|
+
return to;
|
|
19
|
+
};
|
|
20
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
21
|
+
// If the importer is in node compatibility mode or this is not an ESM
|
|
22
|
+
// file that has been converted to a CommonJS file using a Babel-
|
|
23
|
+
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
24
|
+
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
25
|
+
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
26
|
+
mod
|
|
27
|
+
));
|
|
28
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
29
|
+
var blob_exports = {};
|
|
30
|
+
__export(blob_exports, {
|
|
31
|
+
BlobReporter: () => BlobReporter,
|
|
32
|
+
currentBlobReportVersion: () => currentBlobReportVersion
|
|
33
|
+
});
|
|
34
|
+
module.exports = __toCommonJS(blob_exports);
|
|
35
|
+
var import_fs = __toESM(require("fs"));
|
|
36
|
+
var import_path = __toESM(require("path"));
|
|
37
|
+
var import_stream = require("stream");
|
|
38
|
+
var import_utils = require("playwright-core/lib/utils");
|
|
39
|
+
var import_utils2 = require("playwright-core/lib/utils");
|
|
40
|
+
var import_utilsBundle = require("playwright-core/lib/utilsBundle");
|
|
41
|
+
var import_zipBundle = require("playwright-core/lib/zipBundle");
|
|
42
|
+
var import_base = require("./base");
|
|
43
|
+
var import_teleEmitter = require("./teleEmitter");
|
|
44
|
+
const currentBlobReportVersion = 2;
|
|
45
|
+
class BlobReporter extends import_teleEmitter.TeleReporterEmitter {
|
|
46
|
+
constructor(options) {
|
|
47
|
+
super((message) => this._messages.push(message));
|
|
48
|
+
this._messages = [];
|
|
49
|
+
this._attachments = [];
|
|
50
|
+
this._options = options;
|
|
51
|
+
if (this._options.fileName && !this._options.fileName.endsWith(".zip"))
|
|
52
|
+
throw new Error(`Blob report file name must end with .zip extension: ${this._options.fileName}`);
|
|
53
|
+
this._salt = (0, import_utils2.createGuid)();
|
|
54
|
+
}
|
|
55
|
+
onConfigure(config) {
|
|
56
|
+
const metadata = {
|
|
57
|
+
version: currentBlobReportVersion,
|
|
58
|
+
userAgent: (0, import_utils2.getUserAgent)(),
|
|
59
|
+
// TODO: remove after some time, recommend config.tag instead.
|
|
60
|
+
name: process.env.PWTEST_BOT_NAME,
|
|
61
|
+
shard: config.shard ?? void 0,
|
|
62
|
+
pathSeparator: import_path.default.sep
|
|
63
|
+
};
|
|
64
|
+
this._messages.push({
|
|
65
|
+
method: "onBlobReportMetadata",
|
|
66
|
+
params: metadata
|
|
67
|
+
});
|
|
68
|
+
this._config = config;
|
|
69
|
+
super.onConfigure(config);
|
|
70
|
+
}
|
|
71
|
+
async onTestPaused(test, result, step) {
|
|
72
|
+
return { action: void 0 };
|
|
73
|
+
}
|
|
74
|
+
async onEnd(result) {
|
|
75
|
+
await super.onEnd(result);
|
|
76
|
+
const zipFileName = await this._prepareOutputFile();
|
|
77
|
+
const zipFile = new import_zipBundle.yazl.ZipFile();
|
|
78
|
+
const zipFinishPromise = new import_utils2.ManualPromise();
|
|
79
|
+
const finishPromise = zipFinishPromise.catch((e) => {
|
|
80
|
+
throw new Error(`Failed to write report ${zipFileName}: ` + e.message);
|
|
81
|
+
});
|
|
82
|
+
zipFile.on("error", (error) => zipFinishPromise.reject(error));
|
|
83
|
+
zipFile.outputStream.pipe(import_fs.default.createWriteStream(zipFileName)).on("close", () => {
|
|
84
|
+
zipFinishPromise.resolve(void 0);
|
|
85
|
+
}).on("error", (error) => zipFinishPromise.reject(error));
|
|
86
|
+
for (const { originalPath, zipEntryPath } of this._attachments) {
|
|
87
|
+
if (!import_fs.default.statSync(originalPath, { throwIfNoEntry: false })?.isFile())
|
|
88
|
+
continue;
|
|
89
|
+
zipFile.addFile(originalPath, zipEntryPath);
|
|
90
|
+
}
|
|
91
|
+
const lines = this._messages.map((m) => JSON.stringify(m) + "\n");
|
|
92
|
+
const content = import_stream.Readable.from(lines);
|
|
93
|
+
zipFile.addReadStream(content, "report.jsonl");
|
|
94
|
+
zipFile.end();
|
|
95
|
+
await finishPromise;
|
|
96
|
+
}
|
|
97
|
+
async _prepareOutputFile() {
|
|
98
|
+
const { outputFile, outputDir } = (0, import_base.resolveOutputFile)("BLOB", {
|
|
99
|
+
...this._options,
|
|
100
|
+
default: {
|
|
101
|
+
fileName: this._defaultReportName(this._config),
|
|
102
|
+
outputDir: "blob-report"
|
|
103
|
+
}
|
|
104
|
+
});
|
|
105
|
+
if (!process.env.PWTEST_BLOB_DO_NOT_REMOVE)
|
|
106
|
+
await (0, import_utils.removeFolders)([outputDir]);
|
|
107
|
+
await import_fs.default.promises.mkdir(import_path.default.dirname(outputFile), { recursive: true });
|
|
108
|
+
return outputFile;
|
|
109
|
+
}
|
|
110
|
+
_defaultReportName(config) {
|
|
111
|
+
let reportName = "report";
|
|
112
|
+
if (this._options._commandHash)
|
|
113
|
+
reportName += "-" + (0, import_utils.sanitizeForFilePath)(this._options._commandHash);
|
|
114
|
+
if (config.shard) {
|
|
115
|
+
const paddedNumber = `${config.shard.current}`.padStart(`${config.shard.total}`.length, "0");
|
|
116
|
+
reportName = `${reportName}-${paddedNumber}`;
|
|
117
|
+
}
|
|
118
|
+
return `${reportName}.zip`;
|
|
119
|
+
}
|
|
120
|
+
_serializeAttachments(attachments) {
|
|
121
|
+
return super._serializeAttachments(attachments).map((attachment) => {
|
|
122
|
+
if (!attachment.path)
|
|
123
|
+
return attachment;
|
|
124
|
+
const sha1 = (0, import_utils2.calculateSha1)(attachment.path + this._salt);
|
|
125
|
+
const extension = import_utilsBundle.mime.getExtension(attachment.contentType) || "dat";
|
|
126
|
+
const newPath = `resources/${sha1}.${extension}`;
|
|
127
|
+
this._attachments.push({ originalPath: attachment.path, zipEntryPath: newPath });
|
|
128
|
+
return {
|
|
129
|
+
...attachment,
|
|
130
|
+
path: newPath
|
|
131
|
+
};
|
|
132
|
+
});
|
|
133
|
+
}
|
|
134
|
+
}
|
|
135
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
136
|
+
0 && (module.exports = {
|
|
137
|
+
BlobReporter,
|
|
138
|
+
currentBlobReportVersion
|
|
139
|
+
});
|
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
+
var __export = (target, all) => {
|
|
7
|
+
for (var name in all)
|
|
8
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
9
|
+
};
|
|
10
|
+
var __copyProps = (to, from, except, desc) => {
|
|
11
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
12
|
+
for (let key of __getOwnPropNames(from))
|
|
13
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
14
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
15
|
+
}
|
|
16
|
+
return to;
|
|
17
|
+
};
|
|
18
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
|
+
var dot_exports = {};
|
|
20
|
+
__export(dot_exports, {
|
|
21
|
+
default: () => dot_default
|
|
22
|
+
});
|
|
23
|
+
module.exports = __toCommonJS(dot_exports);
|
|
24
|
+
var import_base = require("./base");
|
|
25
|
+
class DotReporter extends import_base.TerminalReporter {
|
|
26
|
+
constructor() {
|
|
27
|
+
super(...arguments);
|
|
28
|
+
this._counter = 0;
|
|
29
|
+
}
|
|
30
|
+
onBegin(suite) {
|
|
31
|
+
super.onBegin(suite);
|
|
32
|
+
this.writeLine(this.generateStartingMessage());
|
|
33
|
+
}
|
|
34
|
+
onStdOut(chunk, test, result) {
|
|
35
|
+
super.onStdOut(chunk, test, result);
|
|
36
|
+
if (!this.config.quiet)
|
|
37
|
+
this.screen.stdout.write(chunk);
|
|
38
|
+
}
|
|
39
|
+
onStdErr(chunk, test, result) {
|
|
40
|
+
super.onStdErr(chunk, test, result);
|
|
41
|
+
if (!this.config.quiet)
|
|
42
|
+
this.screen.stderr.write(chunk);
|
|
43
|
+
}
|
|
44
|
+
onTestEnd(test, result) {
|
|
45
|
+
super.onTestEnd(test, result);
|
|
46
|
+
if (this._counter === 80) {
|
|
47
|
+
this.screen.stdout.write("\n");
|
|
48
|
+
this._counter = 0;
|
|
49
|
+
}
|
|
50
|
+
++this._counter;
|
|
51
|
+
if (result.status === "skipped") {
|
|
52
|
+
this.screen.stdout.write(this.screen.colors.yellow("\xB0"));
|
|
53
|
+
return;
|
|
54
|
+
}
|
|
55
|
+
if (this.willRetry(test)) {
|
|
56
|
+
this.screen.stdout.write(this.screen.colors.gray("\xD7"));
|
|
57
|
+
return;
|
|
58
|
+
}
|
|
59
|
+
switch (test.outcome()) {
|
|
60
|
+
case "expected":
|
|
61
|
+
this.screen.stdout.write(this.screen.colors.green("\xB7"));
|
|
62
|
+
break;
|
|
63
|
+
case "unexpected":
|
|
64
|
+
this.screen.stdout.write(this.screen.colors.red(result.status === "timedOut" ? "T" : "F"));
|
|
65
|
+
break;
|
|
66
|
+
case "flaky":
|
|
67
|
+
this.screen.stdout.write(this.screen.colors.yellow("\xB1"));
|
|
68
|
+
break;
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
onError(error) {
|
|
72
|
+
super.onError(error);
|
|
73
|
+
this.writeLine("\n" + this.formatError(error).message);
|
|
74
|
+
this._counter = 0;
|
|
75
|
+
}
|
|
76
|
+
async onEnd(result) {
|
|
77
|
+
await super.onEnd(result);
|
|
78
|
+
this.screen.stdout.write("\n");
|
|
79
|
+
this.epilogue(true);
|
|
80
|
+
}
|
|
81
|
+
}
|
|
82
|
+
var dot_default = DotReporter;
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
+
var __export = (target, all) => {
|
|
7
|
+
for (var name in all)
|
|
8
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
9
|
+
};
|
|
10
|
+
var __copyProps = (to, from, except, desc) => {
|
|
11
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
12
|
+
for (let key of __getOwnPropNames(from))
|
|
13
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
14
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
15
|
+
}
|
|
16
|
+
return to;
|
|
17
|
+
};
|
|
18
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
|
+
var empty_exports = {};
|
|
20
|
+
__export(empty_exports, {
|
|
21
|
+
default: () => empty_default
|
|
22
|
+
});
|
|
23
|
+
module.exports = __toCommonJS(empty_exports);
|
|
24
|
+
class EmptyReporter {
|
|
25
|
+
version() {
|
|
26
|
+
return "v2";
|
|
27
|
+
}
|
|
28
|
+
printsToStdio() {
|
|
29
|
+
return false;
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
var empty_default = EmptyReporter;
|
|
@@ -0,0 +1,128 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __create = Object.create;
|
|
3
|
+
var __defProp = Object.defineProperty;
|
|
4
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
5
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
6
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
7
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
8
|
+
var __export = (target, all) => {
|
|
9
|
+
for (var name in all)
|
|
10
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
11
|
+
};
|
|
12
|
+
var __copyProps = (to, from, except, desc) => {
|
|
13
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
14
|
+
for (let key of __getOwnPropNames(from))
|
|
15
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
16
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
17
|
+
}
|
|
18
|
+
return to;
|
|
19
|
+
};
|
|
20
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
21
|
+
// If the importer is in node compatibility mode or this is not an ESM
|
|
22
|
+
// file that has been converted to a CommonJS file using a Babel-
|
|
23
|
+
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
24
|
+
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
25
|
+
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
26
|
+
mod
|
|
27
|
+
));
|
|
28
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
29
|
+
var github_exports = {};
|
|
30
|
+
__export(github_exports, {
|
|
31
|
+
GitHubReporter: () => GitHubReporter,
|
|
32
|
+
default: () => github_default
|
|
33
|
+
});
|
|
34
|
+
module.exports = __toCommonJS(github_exports);
|
|
35
|
+
var import_path = __toESM(require("path"));
|
|
36
|
+
var import_utils = require("playwright-core/lib/utils");
|
|
37
|
+
var import_utilsBundle = require("playwright-core/lib/utilsBundle");
|
|
38
|
+
var import_base = require("./base");
|
|
39
|
+
var import_util = require("../util");
|
|
40
|
+
class GitHubLogger {
|
|
41
|
+
_log(message, type = "notice", options = {}) {
|
|
42
|
+
message = message.replace(/\n/g, "%0A");
|
|
43
|
+
const configs = Object.entries(options).map(([key, option]) => `${key}=${option}`).join(",");
|
|
44
|
+
process.stdout.write((0, import_util.stripAnsiEscapes)(`::${type} ${configs}::${message}
|
|
45
|
+
`));
|
|
46
|
+
}
|
|
47
|
+
debug(message, options) {
|
|
48
|
+
this._log(message, "debug", options);
|
|
49
|
+
}
|
|
50
|
+
error(message, options) {
|
|
51
|
+
this._log(message, "error", options);
|
|
52
|
+
}
|
|
53
|
+
notice(message, options) {
|
|
54
|
+
this._log(message, "notice", options);
|
|
55
|
+
}
|
|
56
|
+
warning(message, options) {
|
|
57
|
+
this._log(message, "warning", options);
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
class GitHubReporter extends import_base.TerminalReporter {
|
|
61
|
+
constructor(options = {}) {
|
|
62
|
+
super(options);
|
|
63
|
+
this.githubLogger = new GitHubLogger();
|
|
64
|
+
this.screen = { ...this.screen, colors: import_utils.noColors };
|
|
65
|
+
}
|
|
66
|
+
printsToStdio() {
|
|
67
|
+
return false;
|
|
68
|
+
}
|
|
69
|
+
async onEnd(result) {
|
|
70
|
+
await super.onEnd(result);
|
|
71
|
+
this._printAnnotations();
|
|
72
|
+
}
|
|
73
|
+
onError(error) {
|
|
74
|
+
const errorMessage = this.formatError(error).message;
|
|
75
|
+
this.githubLogger.error(errorMessage);
|
|
76
|
+
}
|
|
77
|
+
_printAnnotations() {
|
|
78
|
+
const summary = this.generateSummary();
|
|
79
|
+
const summaryMessage = this.generateSummaryMessage(summary);
|
|
80
|
+
if (summary.failuresToPrint.length)
|
|
81
|
+
this._printFailureAnnotations(summary.failuresToPrint);
|
|
82
|
+
this._printSlowTestAnnotations();
|
|
83
|
+
this._printSummaryAnnotation(summaryMessage);
|
|
84
|
+
}
|
|
85
|
+
_printSlowTestAnnotations() {
|
|
86
|
+
this.getSlowTests().forEach(([file, duration]) => {
|
|
87
|
+
const filePath = workspaceRelativePath(import_path.default.join(process.cwd(), file));
|
|
88
|
+
this.githubLogger.warning(`${filePath} took ${(0, import_utilsBundle.ms)(duration)}`, {
|
|
89
|
+
title: "Slow Test",
|
|
90
|
+
file: filePath
|
|
91
|
+
});
|
|
92
|
+
});
|
|
93
|
+
}
|
|
94
|
+
_printSummaryAnnotation(summary) {
|
|
95
|
+
this.githubLogger.notice(summary, {
|
|
96
|
+
title: "\u{1F3AD} Playwright Run Summary"
|
|
97
|
+
});
|
|
98
|
+
}
|
|
99
|
+
_printFailureAnnotations(failures) {
|
|
100
|
+
failures.forEach((test, index) => {
|
|
101
|
+
const title = this.formatTestTitle(test);
|
|
102
|
+
const header = this.formatTestHeader(test, { indent: " ", index: index + 1, mode: "error" });
|
|
103
|
+
for (const result of test.results) {
|
|
104
|
+
const errors = (0, import_base.formatResultFailure)(this.screen, test, result, " ");
|
|
105
|
+
for (const error of errors) {
|
|
106
|
+
const options = {
|
|
107
|
+
file: workspaceRelativePath(error.location?.file || test.location.file),
|
|
108
|
+
title
|
|
109
|
+
};
|
|
110
|
+
if (error.location) {
|
|
111
|
+
options.line = error.location.line;
|
|
112
|
+
options.col = error.location.column;
|
|
113
|
+
}
|
|
114
|
+
const message = [header, ...(0, import_base.formatRetry)(this.screen, result), error.message].join("\n");
|
|
115
|
+
this.githubLogger.error(message, options);
|
|
116
|
+
}
|
|
117
|
+
}
|
|
118
|
+
});
|
|
119
|
+
}
|
|
120
|
+
}
|
|
121
|
+
function workspaceRelativePath(filePath) {
|
|
122
|
+
return import_path.default.relative(process.env["GITHUB_WORKSPACE"] ?? "", filePath);
|
|
123
|
+
}
|
|
124
|
+
var github_default = GitHubReporter;
|
|
125
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
126
|
+
0 && (module.exports = {
|
|
127
|
+
GitHubReporter
|
|
128
|
+
});
|