@smoothdeploy/playwright 1.58.3 → 1.60.0-beta-1780662356000
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 +8 -5036
- package/lib/agents/agentParser.js +2 -2
- package/lib/agents/generateAgents.js +21 -22
- package/lib/agents/playwright-test-healer.agent.md +1 -0
- package/lib/agents/playwright-test-planner.agent.md +2 -1
- package/lib/cli/reportActions.js +78 -0
- package/lib/cli/testActions.js +211 -0
- package/lib/common/index.js +2898 -0
- package/lib/common/index.js.txt +35 -0
- package/lib/errorContext.js +130 -0
- package/lib/index.js +283 -206
- package/lib/{isomorphic/testServerConnection.js → isomorphic.js} +70 -35
- package/lib/isomorphic.js.txt +9 -0
- package/lib/loader/loaderProcessEntry.js +34 -0
- package/lib/loader/loaderProcessEntry.js.txt +9 -0
- package/lib/matchers/expect.js +12988 -249
- package/lib/matchers/expect.js.LICENSE +693 -0
- package/lib/matchers/expect.js.txt +72 -0
- package/lib/mcp/test/browserBackend.js +49 -22
- package/lib/mcp/test/generatorTools.js +16 -16
- package/lib/mcp/test/plannerTools.js +25 -20
- package/lib/mcp/test/seed.js +7 -7
- package/lib/mcp/test/testBackend.js +30 -30
- package/lib/mcp/test/testContext.js +50 -33
- package/lib/mcp/test/testTools.js +15 -25
- package/lib/{internalsForTest.js → package.js} +13 -8
- package/lib/program.js +63 -263
- package/lib/runner/index.js +8339 -0
- package/lib/runner/index.js.txt +60 -0
- package/lib/transform/babelBundle.js +71002 -18
- package/lib/transform/babelBundle.js.LICENSE +2359 -0
- package/lib/transform/babelBundle.js.txt +325 -0
- package/lib/transform/esmLoader.js +5884 -30
- package/lib/transform/esmLoader.js.LICENSE +335 -0
- package/lib/transform/esmLoader.js.txt +55 -0
- package/lib/util.js +37 -34
- package/lib/worker/workerProcessEntry.js +3251 -0
- package/lib/worker/workerProcessEntry.js.txt +24 -0
- package/package.json +5 -16
- package/test.mjs +1 -0
- package/types/test.d.ts +173 -12
- package/types/testReporter.d.ts +7 -5
- package/lib/common/config.js +0 -282
- package/lib/common/configLoader.js +0 -344
- package/lib/common/esmLoaderHost.js +0 -104
- package/lib/common/expectBundle.js +0 -28
- package/lib/common/expectBundleImpl.js +0 -407
- package/lib/common/fixtures.js +0 -302
- package/lib/common/ipc.js +0 -60
- package/lib/common/poolBuilder.js +0 -85
- package/lib/common/process.js +0 -132
- package/lib/common/suiteUtils.js +0 -140
- package/lib/common/test.js +0 -321
- package/lib/common/testLoader.js +0 -101
- package/lib/common/testType.js +0 -298
- package/lib/common/validators.js +0 -68
- package/lib/fsWatcher.js +0 -67
- package/lib/isomorphic/events.js +0 -77
- package/lib/isomorphic/folders.js +0 -30
- package/lib/isomorphic/stringInternPool.js +0 -69
- package/lib/isomorphic/teleReceiver.js +0 -521
- package/lib/isomorphic/teleSuiteUpdater.js +0 -157
- package/lib/isomorphic/testServerInterface.js +0 -16
- package/lib/isomorphic/testTree.js +0 -329
- package/lib/isomorphic/types.d.js +0 -16
- package/lib/loader/loaderMain.js +0 -59
- package/lib/matchers/matcherHint.js +0 -44
- package/lib/matchers/matchers.js +0 -383
- package/lib/matchers/toBeTruthy.js +0 -75
- package/lib/matchers/toEqual.js +0 -100
- package/lib/matchers/toHaveURL.js +0 -101
- package/lib/matchers/toMatchAriaSnapshot.js +0 -159
- package/lib/matchers/toMatchSnapshot.js +0 -342
- package/lib/matchers/toMatchText.js +0 -99
- package/lib/mcp/browser/browserContextFactory.js +0 -329
- package/lib/mcp/browser/browserServerBackend.js +0 -84
- package/lib/mcp/browser/config.js +0 -421
- package/lib/mcp/browser/context.js +0 -244
- package/lib/mcp/browser/response.js +0 -278
- package/lib/mcp/browser/sessionLog.js +0 -75
- package/lib/mcp/browser/tab.js +0 -343
- package/lib/mcp/browser/tools/common.js +0 -65
- package/lib/mcp/browser/tools/console.js +0 -46
- package/lib/mcp/browser/tools/dialogs.js +0 -60
- package/lib/mcp/browser/tools/evaluate.js +0 -61
- package/lib/mcp/browser/tools/files.js +0 -58
- package/lib/mcp/browser/tools/form.js +0 -63
- package/lib/mcp/browser/tools/install.js +0 -72
- package/lib/mcp/browser/tools/keyboard.js +0 -107
- package/lib/mcp/browser/tools/mouse.js +0 -107
- package/lib/mcp/browser/tools/navigate.js +0 -71
- package/lib/mcp/browser/tools/network.js +0 -63
- package/lib/mcp/browser/tools/open.js +0 -57
- package/lib/mcp/browser/tools/pdf.js +0 -49
- package/lib/mcp/browser/tools/runCode.js +0 -78
- package/lib/mcp/browser/tools/screenshot.js +0 -93
- package/lib/mcp/browser/tools/snapshot.js +0 -173
- package/lib/mcp/browser/tools/tabs.js +0 -67
- package/lib/mcp/browser/tools/tool.js +0 -47
- package/lib/mcp/browser/tools/tracing.js +0 -74
- package/lib/mcp/browser/tools/utils.js +0 -94
- package/lib/mcp/browser/tools/verify.js +0 -143
- package/lib/mcp/browser/tools/wait.js +0 -63
- package/lib/mcp/browser/tools.js +0 -84
- package/lib/mcp/browser/watchdog.js +0 -44
- package/lib/mcp/config.d.js +0 -16
- package/lib/mcp/extension/cdpRelay.js +0 -351
- package/lib/mcp/extension/extensionContextFactory.js +0 -76
- package/lib/mcp/extension/protocol.js +0 -28
- package/lib/mcp/index.js +0 -61
- package/lib/mcp/log.js +0 -35
- package/lib/mcp/program.js +0 -111
- package/lib/mcp/sdk/exports.js +0 -28
- package/lib/mcp/sdk/http.js +0 -152
- package/lib/mcp/sdk/inProcessTransport.js +0 -71
- package/lib/mcp/sdk/server.js +0 -223
- package/lib/mcp/sdk/tool.js +0 -47
- package/lib/mcp/terminal/cli.js +0 -296
- package/lib/mcp/terminal/command.js +0 -56
- package/lib/mcp/terminal/commands.js +0 -333
- package/lib/mcp/terminal/daemon.js +0 -129
- package/lib/mcp/terminal/help.json +0 -32
- package/lib/mcp/terminal/helpGenerator.js +0 -88
- package/lib/mcp/terminal/socketConnection.js +0 -80
- package/lib/plugins/gitCommitInfoPlugin.js +0 -198
- package/lib/plugins/index.js +0 -28
- package/lib/plugins/webServerPlugin.js +0 -237
- package/lib/reporters/base.js +0 -634
- package/lib/reporters/blob.js +0 -138
- package/lib/reporters/dot.js +0 -99
- package/lib/reporters/empty.js +0 -32
- package/lib/reporters/github.js +0 -128
- package/lib/reporters/html.js +0 -633
- package/lib/reporters/internalReporter.js +0 -138
- package/lib/reporters/json.js +0 -254
- package/lib/reporters/junit.js +0 -232
- package/lib/reporters/line.js +0 -131
- package/lib/reporters/list.js +0 -253
- package/lib/reporters/listModeReporter.js +0 -69
- package/lib/reporters/markdown.js +0 -144
- package/lib/reporters/merge.js +0 -558
- package/lib/reporters/multiplexer.js +0 -112
- package/lib/reporters/reporterV2.js +0 -102
- package/lib/reporters/smoothdeploy.js +0 -333
- package/lib/reporters/teleEmitter.js +0 -317
- package/lib/reporters/versions/blobV1.js +0 -16
- package/lib/runner/dispatcher.js +0 -531
- package/lib/runner/failureTracker.js +0 -72
- package/lib/runner/lastRun.js +0 -77
- package/lib/runner/loadUtils.js +0 -334
- package/lib/runner/loaderHost.js +0 -89
- package/lib/runner/processHost.js +0 -180
- package/lib/runner/projectUtils.js +0 -241
- package/lib/runner/rebase.js +0 -189
- package/lib/runner/reporters.js +0 -140
- package/lib/runner/sigIntWatcher.js +0 -96
- package/lib/runner/storage.js +0 -91
- package/lib/runner/taskRunner.js +0 -127
- package/lib/runner/tasks.js +0 -410
- package/lib/runner/testGroups.js +0 -125
- package/lib/runner/testRunner.js +0 -398
- package/lib/runner/testServer.js +0 -269
- package/lib/runner/uiModeReporter.js +0 -30
- package/lib/runner/vcs.js +0 -72
- package/lib/runner/watchMode.js +0 -396
- package/lib/runner/workerHost.js +0 -104
- package/lib/third_party/pirates.js +0 -62
- package/lib/third_party/tsconfig-loader.js +0 -103
- package/lib/transform/babelBundleImpl.js +0 -461
- package/lib/transform/compilationCache.js +0 -274
- package/lib/transform/md.js +0 -221
- package/lib/transform/portTransport.js +0 -67
- package/lib/transform/transform.js +0 -303
- package/lib/utilsBundle.js +0 -50
- package/lib/utilsBundleImpl.js +0 -103
- package/lib/worker/fixtureRunner.js +0 -262
- package/lib/worker/testInfo.js +0 -536
- package/lib/worker/testTracing.js +0 -345
- package/lib/worker/timeoutManager.js +0 -174
- package/lib/worker/util.js +0 -31
- package/lib/worker/workerMain.js +0 -530
- /package/lib/{common/globals.js → globals.js} +0 -0
|
@@ -32,7 +32,7 @@ __export(agentParser_exports, {
|
|
|
32
32
|
});
|
|
33
33
|
module.exports = __toCommonJS(agentParser_exports);
|
|
34
34
|
var import_fs = __toESM(require("fs"));
|
|
35
|
-
|
|
35
|
+
const yaml = require("playwright-core/lib/utilsBundle").yaml;
|
|
36
36
|
async function parseAgentSpec(filePath) {
|
|
37
37
|
const source = await import_fs.default.promises.readFile(filePath, "utf-8");
|
|
38
38
|
const { header, content } = extractYamlAndContent(source);
|
|
@@ -62,7 +62,7 @@ function extractYamlAndContent(markdown) {
|
|
|
62
62
|
const content = contentLines.join("\n");
|
|
63
63
|
let header;
|
|
64
64
|
try {
|
|
65
|
-
header =
|
|
65
|
+
header = yaml.parse(yamlRaw);
|
|
66
66
|
} catch (error) {
|
|
67
67
|
throw new Error(`Failed to parse YAML header: ${error.message}`);
|
|
68
68
|
}
|
|
@@ -36,29 +36,28 @@ __export(generateAgents_exports, {
|
|
|
36
36
|
module.exports = __toCommonJS(generateAgents_exports);
|
|
37
37
|
var import_fs = __toESM(require("fs"));
|
|
38
38
|
var import_path = __toESM(require("path"));
|
|
39
|
-
var import_utilsBundle = require("playwright-core/lib/utilsBundle");
|
|
40
|
-
var import_utils = require("playwright-core/lib/utils");
|
|
41
39
|
var import_seed = require("../mcp/test/seed");
|
|
42
40
|
var import_agentParser = require("./agentParser");
|
|
41
|
+
const colors = require("playwright-core/lib/utilsBundle").colors;
|
|
42
|
+
const yaml = require("playwright-core/lib/utilsBundle").yaml;
|
|
43
|
+
const { mkdirIfNeeded } = require("playwright-core/lib/coreBundle").utils;
|
|
43
44
|
async function loadAgentSpecs() {
|
|
44
45
|
const files = await import_fs.default.promises.readdir(__dirname);
|
|
45
46
|
return Promise.all(files.filter((file) => file.endsWith(".agent.md")).map((file) => (0, import_agentParser.parseAgentSpec)(import_path.default.join(__dirname, file))));
|
|
46
47
|
}
|
|
47
48
|
class ClaudeGenerator {
|
|
48
|
-
static async init(
|
|
49
|
-
await initRepo(
|
|
49
|
+
static async init(fullConfig, projectName, prompts) {
|
|
50
|
+
await initRepo(fullConfig, projectName, {
|
|
50
51
|
promptsFolder: prompts ? ".claude/prompts" : void 0
|
|
51
52
|
});
|
|
52
53
|
const agents = await loadAgentSpecs();
|
|
53
54
|
await import_fs.default.promises.mkdir(".claude/agents", { recursive: true });
|
|
54
55
|
for (const agent of agents)
|
|
55
56
|
await writeFile(`.claude/agents/${agent.name}.md`, ClaudeGenerator.agentSpec(agent), "\u{1F916}", "agent definition");
|
|
57
|
+
const mcpServer = process.platform === "win32" ? { command: "cmd", args: ["/c", "npx", "playwright", "run-test-mcp-server"] } : { command: "npx", args: ["playwright", "run-test-mcp-server"] };
|
|
56
58
|
await writeFile(".mcp.json", JSON.stringify({
|
|
57
59
|
mcpServers: {
|
|
58
|
-
"playwright-test":
|
|
59
|
-
command: "npx",
|
|
60
|
-
args: ["playwright", "run-test-mcp-server"]
|
|
61
|
-
}
|
|
60
|
+
"playwright-test": mcpServer
|
|
62
61
|
}
|
|
63
62
|
}, null, 2), "\u{1F527}", "mcp configuration");
|
|
64
63
|
initRepoDone();
|
|
@@ -84,15 +83,15 @@ class ClaudeGenerator {
|
|
|
84
83
|
color: agent.color
|
|
85
84
|
};
|
|
86
85
|
lines.push(`---`);
|
|
87
|
-
lines.push(
|
|
86
|
+
lines.push(yaml.stringify(header, { lineWidth: 1e5 }) + `---`);
|
|
88
87
|
lines.push("");
|
|
89
88
|
lines.push(agent.instructions);
|
|
90
89
|
return lines.join("\n");
|
|
91
90
|
}
|
|
92
91
|
}
|
|
93
92
|
class OpencodeGenerator {
|
|
94
|
-
static async init(
|
|
95
|
-
await initRepo(
|
|
93
|
+
static async init(fullConfig, projectName, prompts) {
|
|
94
|
+
await initRepo(fullConfig, projectName, {
|
|
96
95
|
defaultAgentName: "Build",
|
|
97
96
|
promptsFolder: prompts ? ".opencode/prompts" : void 0
|
|
98
97
|
});
|
|
@@ -147,8 +146,8 @@ class OpencodeGenerator {
|
|
|
147
146
|
}
|
|
148
147
|
}
|
|
149
148
|
class CopilotGenerator {
|
|
150
|
-
static async init(
|
|
151
|
-
await initRepo(
|
|
149
|
+
static async init(fullConfig, projectName, prompts) {
|
|
150
|
+
await initRepo(fullConfig, projectName, {
|
|
152
151
|
defaultAgentName: "agent",
|
|
153
152
|
promptsFolder: prompts ? ".github/prompts" : void 0,
|
|
154
153
|
promptSuffix: "prompt"
|
|
@@ -184,11 +183,11 @@ class CopilotGenerator {
|
|
|
184
183
|
"name": agent.name,
|
|
185
184
|
"description": agent.description + examples,
|
|
186
185
|
"tools": agent.tools,
|
|
187
|
-
"model": "Claude Sonnet 4",
|
|
186
|
+
"model": "Claude Sonnet 4.6",
|
|
188
187
|
"mcp-servers": CopilotGenerator.mcpServers
|
|
189
188
|
};
|
|
190
189
|
lines.push(`---`);
|
|
191
|
-
lines.push(
|
|
190
|
+
lines.push(yaml.stringify(header, { lineWidth: 1e5 }) + `---`);
|
|
192
191
|
lines.push("");
|
|
193
192
|
lines.push(agent.instructions);
|
|
194
193
|
lines.push("");
|
|
@@ -209,8 +208,8 @@ class CopilotGenerator {
|
|
|
209
208
|
}
|
|
210
209
|
}
|
|
211
210
|
class VSCodeGenerator {
|
|
212
|
-
static async init(
|
|
213
|
-
await initRepo(
|
|
211
|
+
static async init(fullConfig, projectName) {
|
|
212
|
+
await initRepo(fullConfig, projectName, {
|
|
214
213
|
promptsFolder: void 0
|
|
215
214
|
});
|
|
216
215
|
const agents = await loadAgentSpecs();
|
|
@@ -285,8 +284,8 @@ class VSCodeGenerator {
|
|
|
285
284
|
}
|
|
286
285
|
}
|
|
287
286
|
async function writeFile(filePath, content, icon, description) {
|
|
288
|
-
console.log(` ${icon} ${import_path.default.relative(process.cwd(), filePath)} ${
|
|
289
|
-
await
|
|
287
|
+
console.log(` ${icon} ${import_path.default.relative(process.cwd(), filePath)} ${colors.dim("- " + description)}`);
|
|
288
|
+
await mkdirIfNeeded(filePath);
|
|
290
289
|
await import_fs.default.promises.writeFile(filePath, content, "utf-8");
|
|
291
290
|
}
|
|
292
291
|
async function deleteFile(filePath, description) {
|
|
@@ -296,11 +295,11 @@ async function deleteFile(filePath, description) {
|
|
|
296
295
|
} catch {
|
|
297
296
|
return;
|
|
298
297
|
}
|
|
299
|
-
console.log(` \u2702\uFE0F ${import_path.default.relative(process.cwd(), filePath)} ${
|
|
298
|
+
console.log(` \u2702\uFE0F ${import_path.default.relative(process.cwd(), filePath)} ${colors.dim("- " + description)}`);
|
|
300
299
|
await import_fs.default.promises.unlink(filePath);
|
|
301
300
|
}
|
|
302
|
-
async function initRepo(
|
|
303
|
-
const project = (0, import_seed.seedProject)(
|
|
301
|
+
async function initRepo(fullConfig, projectName, options) {
|
|
302
|
+
const project = (0, import_seed.seedProject)(fullConfig, projectName);
|
|
304
303
|
console.log(` \u{1F3AD} Using project "${project.project.name}" as a primary project`);
|
|
305
304
|
if (!import_fs.default.existsSync("specs")) {
|
|
306
305
|
await import_fs.default.promises.mkdir("specs");
|
|
@@ -9,6 +9,7 @@ tools:
|
|
|
9
9
|
- playwright-test/browser_console_messages
|
|
10
10
|
- playwright-test/browser_evaluate
|
|
11
11
|
- playwright-test/browser_generate_locator
|
|
12
|
+
- playwright-test/browser_network_request
|
|
12
13
|
- playwright-test/browser_network_requests
|
|
13
14
|
- playwright-test/browser_snapshot
|
|
14
15
|
- playwright-test/test_debug
|
|
@@ -15,9 +15,10 @@ tools:
|
|
|
15
15
|
- playwright-test/browser_hover
|
|
16
16
|
- playwright-test/browser_navigate
|
|
17
17
|
- playwright-test/browser_navigate_back
|
|
18
|
+
- playwright-test/browser_network_request
|
|
18
19
|
- playwright-test/browser_network_requests
|
|
19
20
|
- playwright-test/browser_press_key
|
|
20
|
-
- playwright-test/
|
|
21
|
+
- playwright-test/browser_run_code_unsafe
|
|
21
22
|
- playwright-test/browser_select_option
|
|
22
23
|
- playwright-test/browser_snapshot
|
|
23
24
|
- playwright-test/browser_take_screenshot
|
|
@@ -0,0 +1,78 @@
|
|
|
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 reportActions_exports = {};
|
|
30
|
+
__export(reportActions_exports, {
|
|
31
|
+
mergeReports: () => mergeReports,
|
|
32
|
+
showReport: () => showReport
|
|
33
|
+
});
|
|
34
|
+
module.exports = __toCommonJS(reportActions_exports);
|
|
35
|
+
var import_fs = __toESM(require("fs"));
|
|
36
|
+
var import_path = __toESM(require("path"));
|
|
37
|
+
var import_common = require("../common");
|
|
38
|
+
var import_runner = require("../runner");
|
|
39
|
+
const { gracefullyProcessExitDoNotHang } = require("playwright-core/lib/coreBundle").utils;
|
|
40
|
+
async function showReport(report, host, port) {
|
|
41
|
+
await import_runner.html.showHTMLReport(report, host, port);
|
|
42
|
+
}
|
|
43
|
+
async function mergeReports(reportDir, opts) {
|
|
44
|
+
const configFile = opts.config;
|
|
45
|
+
const config = configFile ? await import_common.configLoader.loadConfigFromFile(configFile) : await import_common.configLoader.loadEmptyConfigForMergeReports();
|
|
46
|
+
const dir = import_path.default.resolve(process.cwd(), reportDir || "");
|
|
47
|
+
const dirStat = await import_fs.default.promises.stat(dir).catch((e) => null);
|
|
48
|
+
if (!dirStat)
|
|
49
|
+
throw new Error("Directory does not exist: " + dir);
|
|
50
|
+
if (!dirStat.isDirectory())
|
|
51
|
+
throw new Error(`"${dir}" is not a directory`);
|
|
52
|
+
let reporterDescriptions = resolveReporterOption(opts.reporter);
|
|
53
|
+
if (!reporterDescriptions && configFile)
|
|
54
|
+
reporterDescriptions = config.config.reporter;
|
|
55
|
+
if (!reporterDescriptions)
|
|
56
|
+
reporterDescriptions = [[import_common.config.defaultReporter]];
|
|
57
|
+
const rootDirOverride = configFile ? config.config.rootDir : void 0;
|
|
58
|
+
await import_runner.merge.createMergedReport(config, dir, reporterDescriptions, rootDirOverride);
|
|
59
|
+
gracefullyProcessExitDoNotHang(0);
|
|
60
|
+
}
|
|
61
|
+
function resolveReporterOption(reporter) {
|
|
62
|
+
if (!reporter || !reporter.length)
|
|
63
|
+
return void 0;
|
|
64
|
+
return reporter.split(",").map((r) => [resolveReporter(r)]);
|
|
65
|
+
}
|
|
66
|
+
function resolveReporter(id) {
|
|
67
|
+
if (import_common.builtInReporters.includes(id))
|
|
68
|
+
return id;
|
|
69
|
+
const localPath = import_path.default.resolve(process.cwd(), id);
|
|
70
|
+
if (import_fs.default.existsSync(localPath))
|
|
71
|
+
return localPath;
|
|
72
|
+
return require.resolve(id, { paths: [process.cwd()] });
|
|
73
|
+
}
|
|
74
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
75
|
+
0 && (module.exports = {
|
|
76
|
+
mergeReports,
|
|
77
|
+
showReport
|
|
78
|
+
});
|
|
@@ -0,0 +1,211 @@
|
|
|
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 testActions_exports = {};
|
|
30
|
+
__export(testActions_exports, {
|
|
31
|
+
clearCache: () => clearCache,
|
|
32
|
+
runTestServerAction: () => runTestServerAction,
|
|
33
|
+
runTests: () => runTests
|
|
34
|
+
});
|
|
35
|
+
module.exports = __toCommonJS(testActions_exports);
|
|
36
|
+
var import_fs = __toESM(require("fs"));
|
|
37
|
+
var import_path = __toESM(require("path"));
|
|
38
|
+
var import_common = require("../common");
|
|
39
|
+
var import_runner = require("../runner");
|
|
40
|
+
const { gracefullyProcessExitDoNotHang } = require("playwright-core/lib/coreBundle").utils;
|
|
41
|
+
const { startProfiling, stopProfiling } = require("playwright-core/lib/coreBundle").utils;
|
|
42
|
+
async function runTests(args, opts) {
|
|
43
|
+
await startProfiling();
|
|
44
|
+
const cliOverrides = overridesFromOptions(opts);
|
|
45
|
+
const config = await import_common.configLoader.loadConfigFromFile(opts.config, cliOverrides, opts.deps === false);
|
|
46
|
+
const options = {
|
|
47
|
+
locations: args.length ? args : void 0,
|
|
48
|
+
grep: opts.grep,
|
|
49
|
+
grepInvert: opts.grepInvert,
|
|
50
|
+
onlyChanged: opts.onlyChanged === true ? "HEAD" : opts.onlyChanged,
|
|
51
|
+
listMode: !!opts.list,
|
|
52
|
+
projectFilter: opts.project || void 0,
|
|
53
|
+
passWithNoTests: !!opts.passWithNoTests,
|
|
54
|
+
lastFailed: !!opts.lastFailed,
|
|
55
|
+
testList: opts.testList ? import_path.default.resolve(process.cwd(), opts.testList) : void 0,
|
|
56
|
+
testListInvert: opts.testListInvert ? import_path.default.resolve(process.cwd(), opts.testListInvert) : void 0,
|
|
57
|
+
shardWeights: resolveShardWeightsOption()
|
|
58
|
+
};
|
|
59
|
+
import_runner.projectUtils.filterProjects(config.projects, options.projectFilter);
|
|
60
|
+
if (opts.ui || opts.uiHost || opts.uiPort) {
|
|
61
|
+
if (opts.onlyChanged)
|
|
62
|
+
throw new Error(`--only-changed is not supported in UI mode. If you'd like that to change, see https://github.com/microsoft/playwright/issues/15075 for more details.`);
|
|
63
|
+
const status2 = await import_runner.testServer.runUIMode(opts.config, cliOverrides, {
|
|
64
|
+
host: opts.uiHost,
|
|
65
|
+
port: opts.uiPort ? +opts.uiPort : void 0,
|
|
66
|
+
args,
|
|
67
|
+
grep: opts.grep,
|
|
68
|
+
grepInvert: opts.grepInvert,
|
|
69
|
+
project: opts.project || void 0,
|
|
70
|
+
reporter: Array.isArray(opts.reporter) ? opts.reporter : opts.reporter ? [opts.reporter] : void 0
|
|
71
|
+
});
|
|
72
|
+
await stopProfiling("runner");
|
|
73
|
+
const exitCode2 = status2 === "interrupted" ? 130 : status2 === "passed" ? 0 : 1;
|
|
74
|
+
gracefullyProcessExitDoNotHang(exitCode2);
|
|
75
|
+
return;
|
|
76
|
+
}
|
|
77
|
+
if (process.env.PWTEST_WATCH) {
|
|
78
|
+
if (opts.onlyChanged)
|
|
79
|
+
throw new Error(`--only-changed is not supported in watch mode. If you'd like that to change, file an issue and let us know about your usecase for it.`);
|
|
80
|
+
const status2 = await import_runner.watchMode.runWatchModeLoop(
|
|
81
|
+
import_common.configLoader.resolveConfigLocation(opts.config),
|
|
82
|
+
{
|
|
83
|
+
projects: opts.project,
|
|
84
|
+
files: args,
|
|
85
|
+
grep: opts.grep
|
|
86
|
+
}
|
|
87
|
+
);
|
|
88
|
+
await stopProfiling("runner");
|
|
89
|
+
const exitCode2 = status2 === "interrupted" ? 130 : status2 === "passed" ? 0 : 1;
|
|
90
|
+
gracefullyProcessExitDoNotHang(exitCode2);
|
|
91
|
+
return;
|
|
92
|
+
}
|
|
93
|
+
const status = await import_runner.testRunner.runAllTestsWithConfig(config, options);
|
|
94
|
+
await stopProfiling("runner");
|
|
95
|
+
const exitCode = status === "interrupted" ? 130 : status === "passed" ? 0 : 1;
|
|
96
|
+
gracefullyProcessExitDoNotHang(exitCode);
|
|
97
|
+
}
|
|
98
|
+
async function runTestServerAction(opts) {
|
|
99
|
+
const host = opts.host;
|
|
100
|
+
const port = opts.port ? +opts.port : void 0;
|
|
101
|
+
const status = await import_runner.testServer.runTestServer(opts.config, {}, { host, port });
|
|
102
|
+
const exitCode = status === "interrupted" ? 130 : status === "passed" ? 0 : 1;
|
|
103
|
+
gracefullyProcessExitDoNotHang(exitCode);
|
|
104
|
+
}
|
|
105
|
+
async function clearCache(opts) {
|
|
106
|
+
const runner = new import_runner.testRunner.TestRunner(import_common.configLoader.resolveConfigLocation(opts.config), {});
|
|
107
|
+
const { status } = await runner.clearCache(import_runner.runnerReporters.createErrorCollectingReporter(import_runner.base.terminalScreen));
|
|
108
|
+
const exitCode = status === "interrupted" ? 130 : status === "passed" ? 0 : 1;
|
|
109
|
+
gracefullyProcessExitDoNotHang(exitCode);
|
|
110
|
+
}
|
|
111
|
+
function overridesFromOptions(options) {
|
|
112
|
+
if (options.ui) {
|
|
113
|
+
options.debug = void 0;
|
|
114
|
+
options.trace = void 0;
|
|
115
|
+
}
|
|
116
|
+
const overrides = {
|
|
117
|
+
debug: options.debug,
|
|
118
|
+
failOnFlakyTests: options.failOnFlakyTests ? true : void 0,
|
|
119
|
+
forbidOnly: options.forbidOnly ? true : void 0,
|
|
120
|
+
fullyParallel: options.fullyParallel ? true : void 0,
|
|
121
|
+
globalTimeout: options.globalTimeout ? parseInt(options.globalTimeout, 10) : void 0,
|
|
122
|
+
maxFailures: options.x ? 1 : options.maxFailures ? parseInt(options.maxFailures, 10) : void 0,
|
|
123
|
+
outputDir: options.output ? import_path.default.resolve(process.cwd(), options.output) : void 0,
|
|
124
|
+
pause: !!process.env.PWPAUSE,
|
|
125
|
+
quiet: options.quiet ? options.quiet : void 0,
|
|
126
|
+
repeatEach: options.repeatEach ? parseInt(options.repeatEach, 10) : void 0,
|
|
127
|
+
retries: options.retries ? parseInt(options.retries, 10) : void 0,
|
|
128
|
+
reporter: resolveReporterOption(options.reporter),
|
|
129
|
+
shard: resolveShardOption(options.shard),
|
|
130
|
+
timeout: options.timeout ? parseInt(options.timeout, 10) : void 0,
|
|
131
|
+
tsconfig: options.tsconfig ? import_path.default.resolve(process.cwd(), options.tsconfig) : void 0,
|
|
132
|
+
ignoreSnapshots: options.ignoreSnapshots ? !!options.ignoreSnapshots : void 0,
|
|
133
|
+
updateSnapshots: options.updateSnapshots,
|
|
134
|
+
updateSourceMethod: options.updateSourceMethod,
|
|
135
|
+
use: {
|
|
136
|
+
trace: options.trace
|
|
137
|
+
},
|
|
138
|
+
workers: options.workers
|
|
139
|
+
};
|
|
140
|
+
if (options.browser) {
|
|
141
|
+
const browserOpt = options.browser.toLowerCase();
|
|
142
|
+
if (!["all", "chromium", "firefox", "webkit"].includes(browserOpt))
|
|
143
|
+
throw new Error(`Unsupported browser "${options.browser}", must be one of "all", "chromium", "firefox" or "webkit"`);
|
|
144
|
+
const browserNames = browserOpt === "all" ? ["chromium", "firefox", "webkit"] : [browserOpt];
|
|
145
|
+
overrides.projects = browserNames.map((browserName) => {
|
|
146
|
+
return {
|
|
147
|
+
name: browserName,
|
|
148
|
+
use: { browserName }
|
|
149
|
+
};
|
|
150
|
+
});
|
|
151
|
+
}
|
|
152
|
+
if (options.headed)
|
|
153
|
+
overrides.use.headless = false;
|
|
154
|
+
if (options.debug === "inspector") {
|
|
155
|
+
overrides.use.headless = false;
|
|
156
|
+
process.env.PWDEBUG = "1";
|
|
157
|
+
}
|
|
158
|
+
if (overrides.tsconfig && !import_fs.default.existsSync(overrides.tsconfig))
|
|
159
|
+
throw new Error(`--tsconfig "${options.tsconfig}" does not exist`);
|
|
160
|
+
return overrides;
|
|
161
|
+
}
|
|
162
|
+
function resolveReporterOption(reporter) {
|
|
163
|
+
if (!reporter || !reporter.length)
|
|
164
|
+
return void 0;
|
|
165
|
+
return reporter.split(",").map((r) => [resolveReporter(r)]);
|
|
166
|
+
}
|
|
167
|
+
function resolveShardOption(shard) {
|
|
168
|
+
if (!shard)
|
|
169
|
+
return void 0;
|
|
170
|
+
const shardPair = shard.split("/");
|
|
171
|
+
if (shardPair.length !== 2) {
|
|
172
|
+
throw new Error(
|
|
173
|
+
`--shard "${shard}", expected format is "current/all", 1-based, for example "3/5".`
|
|
174
|
+
);
|
|
175
|
+
}
|
|
176
|
+
const current = parseInt(shardPair[0], 10);
|
|
177
|
+
const total = parseInt(shardPair[1], 10);
|
|
178
|
+
if (isNaN(total) || total < 1)
|
|
179
|
+
throw new Error(`--shard "${shard}" total must be a positive number`);
|
|
180
|
+
if (isNaN(current) || current < 1 || current > total) {
|
|
181
|
+
throw new Error(
|
|
182
|
+
`--shard "${shard}" current must be a positive number, not greater than shard total`
|
|
183
|
+
);
|
|
184
|
+
}
|
|
185
|
+
return { current, total };
|
|
186
|
+
}
|
|
187
|
+
function resolveShardWeightsOption() {
|
|
188
|
+
const shardWeights = process.env.PWTEST_SHARD_WEIGHTS;
|
|
189
|
+
if (!shardWeights)
|
|
190
|
+
return void 0;
|
|
191
|
+
return shardWeights.split(":").map((w) => {
|
|
192
|
+
const weight = parseInt(w, 10);
|
|
193
|
+
if (isNaN(weight) || weight < 0)
|
|
194
|
+
throw new Error(`PWTEST_SHARD_WEIGHTS="${shardWeights}" weights must be non-negative numbers`);
|
|
195
|
+
return weight;
|
|
196
|
+
});
|
|
197
|
+
}
|
|
198
|
+
function resolveReporter(id) {
|
|
199
|
+
if (import_common.builtInReporters.includes(id))
|
|
200
|
+
return id;
|
|
201
|
+
const localPath = import_path.default.resolve(process.cwd(), id);
|
|
202
|
+
if (import_fs.default.existsSync(localPath))
|
|
203
|
+
return localPath;
|
|
204
|
+
return require.resolve(id, { paths: [process.cwd()] });
|
|
205
|
+
}
|
|
206
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
207
|
+
0 && (module.exports = {
|
|
208
|
+
clearCache,
|
|
209
|
+
runTestServerAction,
|
|
210
|
+
runTests
|
|
211
|
+
});
|