playwright 1.62.1 → 1.65.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/README.md +4 -4
- package/lib/agents/playwright-test-generator.agent.md +1 -1
- package/lib/cli/testActions.js +9 -6
- package/lib/common/index.js +207 -148
- package/lib/common/index.js.txt +13 -14
- package/lib/index.js +51 -30
- package/lib/matchers/expect.js +117 -81
- package/lib/matchers/expect.js.LICENSE +3 -3
- package/lib/matchers/expect.js.txt +8 -8
- package/lib/mcp/test/browserBackend.js +12 -2
- package/lib/mcp/test/testContext.js +2 -8
- package/lib/program.js +4 -4
- package/lib/runner/index.js +1151 -572
- package/lib/runner/index.js.txt +32 -29
- package/lib/transform/babelBundle.js +1217 -982
- package/lib/transform/babelBundle.js.LICENSE +15 -15
- package/lib/transform/babelBundle.js.txt +14 -11
- package/lib/transform/esmLoader.js +375 -187
- package/lib/transform/esmLoader.js.LICENSE +3 -3
- package/lib/transform/esmLoader.js.txt +9 -8
- package/lib/worker/workerProcessEntry.js +43 -41
- package/lib/worker/workerProcessEntry.js.txt +4 -4
- package/package.json +2 -10
- package/types/test.d.ts +755 -88
- package/types/testReporter.d.ts +74 -3
- package/jsx-runtime.js +0 -42
- package/jsx-runtime.mjs +0 -21
|
@@ -104,11 +104,21 @@ async function generatePausedMessage(tools, testInfo, context) {
|
|
|
104
104
|
lines.push(`### Task`, `Try recovering from the error prior to continuing`);
|
|
105
105
|
return lines.join("\n");
|
|
106
106
|
}
|
|
107
|
+
const kDaemonSymbol = /* @__PURE__ */ Symbol("daemon");
|
|
108
|
+
const kSessionNameSymbol = /* @__PURE__ */ Symbol("sessionName");
|
|
107
109
|
async function runDaemonForContext(testInfo, context) {
|
|
108
110
|
if (testInfo._configInternal.configCLIOverrides.debug !== "cli")
|
|
109
111
|
return false;
|
|
110
|
-
const
|
|
111
|
-
|
|
112
|
+
const browser = context.browser();
|
|
113
|
+
let sessionName = browser[kSessionNameSymbol];
|
|
114
|
+
if (!sessionName) {
|
|
115
|
+
sessionName = `tw-${import_crypto.default.randomBytes(3).toString("hex")}`;
|
|
116
|
+
await browser.bind(sessionName, { workspaceDir: testInfo.project.testDir });
|
|
117
|
+
browser[kSessionNameSymbol] = sessionName;
|
|
118
|
+
}
|
|
119
|
+
if (testInfo[kDaemonSymbol])
|
|
120
|
+
return false;
|
|
121
|
+
testInfo[kDaemonSymbol] = true;
|
|
112
122
|
console.log([
|
|
113
123
|
`### The test is currently paused at the start`,
|
|
114
124
|
``,
|
|
@@ -182,7 +182,7 @@ class TestContext {
|
|
|
182
182
|
const { testRunner: runner, screen, claimStdio, releaseStdio } = testRunnerAndScreen;
|
|
183
183
|
claimStdio();
|
|
184
184
|
try {
|
|
185
|
-
const setupReporter = new
|
|
185
|
+
const setupReporter = new import_runner.ListReporter({ configDir, screen, includeTestId: true });
|
|
186
186
|
const { status: status2 } = await runner.runGlobalSetup([setupReporter]);
|
|
187
187
|
if (status2 !== "passed")
|
|
188
188
|
return { output: testRunnerAndScreen.output.join("\n"), status: status2 };
|
|
@@ -204,7 +204,7 @@ class TestContext {
|
|
|
204
204
|
const abortPromise = abort ? abort.promise.then(() => "interrupted") : new Promise(() => {
|
|
205
205
|
});
|
|
206
206
|
try {
|
|
207
|
-
const reporter = new
|
|
207
|
+
const reporter = new import_runner.ListReporter({ configDir, screen, includeTestId: true });
|
|
208
208
|
status = await Promise.race([
|
|
209
209
|
runner.runTests(reporter, params).then((result) => result.status),
|
|
210
210
|
testRunnerAndScreen.waitForTestPaused().then(() => "paused"),
|
|
@@ -292,12 +292,6 @@ const bestPracticesMarkdown = `
|
|
|
292
292
|
- NEVER! use page.waitForTimeout()
|
|
293
293
|
- NEVER! use page.evaluate()
|
|
294
294
|
`;
|
|
295
|
-
class MCPListReporter extends import_runner.ListReporter {
|
|
296
|
-
async onTestPaused() {
|
|
297
|
-
await new Promise(() => {
|
|
298
|
-
});
|
|
299
|
-
}
|
|
300
|
-
}
|
|
301
295
|
// Annotate the CommonJS export names for ESM import in node:
|
|
302
296
|
0 && (module.exports = {
|
|
303
297
|
GeneratorJournal,
|
package/lib/program.js
CHANGED
|
@@ -138,9 +138,7 @@ function addTestMCPServerCommand(program2) {
|
|
|
138
138
|
nameInConfig: "playwright-test-runner",
|
|
139
139
|
version: import_package.packageJSON.version,
|
|
140
140
|
toolSchemas: import_testBackend.testServerBackendTools.map((tool) => tool.schema),
|
|
141
|
-
create: async () => new import_testBackend.TestServerBackend(options.config, { muteConsole: options.port === void 0, headless: options.headless })
|
|
142
|
-
disposed: async () => {
|
|
143
|
-
}
|
|
141
|
+
create: async () => new import_testBackend.TestServerBackend(options.config, { muteConsole: options.port === void 0, headless: options.headless })
|
|
144
142
|
};
|
|
145
143
|
await import_coreBundle.tools.start(factory, { port: options.port === void 0 ? void 0 : +options.port, host: options.host });
|
|
146
144
|
});
|
|
@@ -188,6 +186,7 @@ function addInitSkillsCommand(program2) {
|
|
|
188
186
|
}
|
|
189
187
|
const kTraceModes = ["on", "off", "on-first-retry", "on-all-retries", "retain-on-failure", "retain-on-first-failure", "retain-on-failure-and-retries"];
|
|
190
188
|
const testOptions = [
|
|
189
|
+
["--add-reporter <reporter>", { description: `Reporter to add on top of the configured reporters, comma-separated, can be ${import_common.builtInReporters.map((name) => `"${name}"`).join(", ")} or a path to a reporter module` }],
|
|
191
190
|
/* deprecated */
|
|
192
191
|
["--browser <browser>", { description: `Browser to use for tests, one of "all", "chromium", "firefox" or "webkit" (default: "chromium")` }],
|
|
193
192
|
["-c, --config <file>", { description: `Configuration file, or a test directory with optional "playwright.config.{m,c}?{js,ts}"` }],
|
|
@@ -217,13 +216,14 @@ const testOptions = [
|
|
|
217
216
|
["--shard <shard>", { description: `Shard tests and execute only the selected shard, specify in the form "current/all", 1-based, for example "3/5"` }],
|
|
218
217
|
["--test-list <file>", { description: `Path to a file containing a list of tests to run. See https://playwright.dev/docs/test-cli for more details.` }],
|
|
219
218
|
["--test-list-invert <file>", { description: `Path to a file containing a list of tests to skip. See https://playwright.dev/docs/test-cli for more details.` }],
|
|
219
|
+
["--shuffle [seed]", { description: `Schedule test files, and tests in parallel mode, in a random order; pass a seed to reproduce a previous order` }],
|
|
220
220
|
["--timeout <timeout>", { description: `Specify test timeout threshold in milliseconds, zero for unlimited (default: ${import_common.config.defaultTimeout})` }],
|
|
221
221
|
["--trace <mode>", { description: `Force tracing mode`, choices: kTraceModes }],
|
|
222
222
|
["--tsconfig <path>", { description: `Path to a single tsconfig applicable to all imported files (default: look up tsconfig for each imported file separately)` }],
|
|
223
223
|
["--ui", { description: `Run tests in interactive UI mode` }],
|
|
224
224
|
["--ui-host <host>", { description: `Host to serve UI on; specifying this option opens UI in a browser tab` }],
|
|
225
225
|
["--ui-port <port>", { description: `Port to serve UI on, 0 for any free port; specifying this option opens UI in a browser tab` }],
|
|
226
|
-
["-u, --update-snapshots [mode]", { description: `Update snapshots with actual results. Running tests without the flag defaults to "
|
|
226
|
+
["-u, --update-snapshots [mode]", { description: `Update snapshots with actual results. Running tests without the flag defaults to "default"`, choices: ["all", "changed", "missing", "none", "default"], preset: "changed" }],
|
|
227
227
|
["--update-source-method <method>", { description: `Chooses the way source is updated (default: "patch")`, choices: ["overwrite", "3way", "patch"] }],
|
|
228
228
|
["-j, --workers <workers>", { description: `Number of concurrent workers or percentage of logical CPU cores, use 1 to run in a single worker (default: 50%)` }],
|
|
229
229
|
["-x", { description: `Stop after the first failure` }]
|