playwright-core 1.57.0-alpha-2025-10-27 → 1.57.0-alpha-2025-10-29
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/browsers.json +4 -4
- package/lib/cli/program.js +9 -53
- package/lib/generated/injectedScriptSource.js +1 -1
- package/lib/server/page.js +34 -19
- package/lib/server/registry/index.js +44 -7
- package/lib/vite/htmlReport/index.html +18 -18
- package/lib/vite/traceViewer/assets/{codeMirrorModule-Be0GytTP.js → codeMirrorModule-DdzW2bmF.js} +1 -1
- package/lib/vite/traceViewer/assets/{defaultSettingsView-Dt_7E-Y1.js → defaultSettingsView-B24Q0BeR.js} +48 -48
- package/lib/vite/traceViewer/index.C4Y3Aw8n.css +1 -0
- package/lib/vite/traceViewer/index.DY0nr6ME.js +2 -0
- package/lib/vite/traceViewer/index.html +3 -3
- package/lib/vite/traceViewer/{uiMode.CxoPlGfr.js → uiMode.DKwZJGjT.js} +1 -1
- package/lib/vite/traceViewer/uiMode.html +2 -2
- package/package.json +1 -1
- package/lib/vite/traceViewer/index.I8N9v4jT.css +0 -1
- package/lib/vite/traceViewer/index.IU5uHe94.js +0 -2
package/lib/server/page.js
CHANGED
|
@@ -667,7 +667,7 @@ class Page extends import_instrumentation.SdkObject {
|
|
|
667
667
|
}
|
|
668
668
|
async snapshotForAI(progress, options) {
|
|
669
669
|
const snapshot = await snapshotFrameForAI(progress, this.mainFrame(), options);
|
|
670
|
-
return snapshot.join("\n");
|
|
670
|
+
return snapshot.lines.join("\n");
|
|
671
671
|
}
|
|
672
672
|
}
|
|
673
673
|
class Worker extends import_instrumentation.SdkObject {
|
|
@@ -808,7 +808,7 @@ class FrameThrottler {
|
|
|
808
808
|
}
|
|
809
809
|
}
|
|
810
810
|
async function snapshotFrameForAI(progress, frame, options) {
|
|
811
|
-
const snapshot = await frame.retryWithProgressAndTimeouts(progress, [1e3, 2e3, 4e3, 8e3], async (continuePolling) => {
|
|
811
|
+
const { snapshot, iframeRefs, isIncremental } = await frame.retryWithProgressAndTimeouts(progress, [1e3, 2e3, 4e3, 8e3], async (continuePolling) => {
|
|
812
812
|
try {
|
|
813
813
|
const context = await progress.race(frame._utilityContext());
|
|
814
814
|
const injectedScript = await progress.race(context.injectedScript());
|
|
@@ -816,8 +816,8 @@ async function snapshotFrameForAI(progress, frame, options) {
|
|
|
816
816
|
const node = injected.document.body;
|
|
817
817
|
if (!node)
|
|
818
818
|
return true;
|
|
819
|
-
return injected.
|
|
820
|
-
}, { refPrefix: frame.seq ? "f" + frame.seq : "", incremental: options.mode === "incremental"
|
|
819
|
+
return injected.incrementalAriaSnapshot(node, { mode: "ai", ...options2 });
|
|
820
|
+
}, { refPrefix: frame.seq ? "f" + frame.seq : "", incremental: options.mode === "incremental", track: options.track }));
|
|
821
821
|
if (snapshotOrRetry === true)
|
|
822
822
|
return continuePolling;
|
|
823
823
|
return snapshotOrRetry;
|
|
@@ -829,29 +829,44 @@ async function snapshotFrameForAI(progress, frame, options) {
|
|
|
829
829
|
});
|
|
830
830
|
const lines = snapshot.split("\n");
|
|
831
831
|
const result = [];
|
|
832
|
+
if (isIncremental) {
|
|
833
|
+
result.push(...lines);
|
|
834
|
+
for (const ref of iframeRefs) {
|
|
835
|
+
const childSnapshot = await snapshotFrameRefForAI(progress, frame, ref, options);
|
|
836
|
+
if (!childSnapshot.lines.length)
|
|
837
|
+
continue;
|
|
838
|
+
if (childSnapshot.isIncremental)
|
|
839
|
+
result.push(...childSnapshot.lines);
|
|
840
|
+
else
|
|
841
|
+
result.push("- <changed> iframe [ref=" + ref + "]:", ...childSnapshot.lines.map((l) => " " + l));
|
|
842
|
+
}
|
|
843
|
+
return { lines: result, isIncremental };
|
|
844
|
+
}
|
|
832
845
|
for (const line of lines) {
|
|
833
|
-
const match = line.match(/^(\s*)-
|
|
846
|
+
const match = line.match(/^(\s*)- iframe (?:\[active\] )?\[ref=([^\]]*)\]/);
|
|
834
847
|
if (!match) {
|
|
835
848
|
result.push(line);
|
|
836
849
|
continue;
|
|
837
850
|
}
|
|
838
851
|
const leadingSpace = match[1];
|
|
839
852
|
const ref = match[2];
|
|
840
|
-
const
|
|
841
|
-
|
|
842
|
-
|
|
843
|
-
|
|
844
|
-
|
|
845
|
-
|
|
846
|
-
|
|
847
|
-
|
|
848
|
-
|
|
849
|
-
|
|
850
|
-
|
|
851
|
-
|
|
852
|
-
|
|
853
|
+
const childSnapshot = await snapshotFrameRefForAI(progress, frame, ref, options);
|
|
854
|
+
result.push(childSnapshot.lines.length ? line + ":" : line);
|
|
855
|
+
result.push(...childSnapshot.lines.map((l) => leadingSpace + " " + l));
|
|
856
|
+
}
|
|
857
|
+
return { lines: result, isIncremental };
|
|
858
|
+
}
|
|
859
|
+
async function snapshotFrameRefForAI(progress, parentFrame, frameRef, options) {
|
|
860
|
+
const frameSelector = `aria-ref=${frameRef} >> internal:control=enter-frame`;
|
|
861
|
+
const frameBodySelector = `${frameSelector} >> body`;
|
|
862
|
+
const child = await progress.race(parentFrame.selectors.resolveFrameForSelector(frameBodySelector, { strict: true }));
|
|
863
|
+
if (!child)
|
|
864
|
+
return { lines: [], isIncremental: false };
|
|
865
|
+
try {
|
|
866
|
+
return await snapshotFrameForAI(progress, child.frame, options);
|
|
867
|
+
} catch {
|
|
868
|
+
return { lines: [], isIncremental: false };
|
|
853
869
|
}
|
|
854
|
-
return result;
|
|
855
870
|
}
|
|
856
871
|
function ensureArrayLimit(array, limit) {
|
|
857
872
|
if (array.length > limit)
|
|
@@ -1003,7 +1003,7 @@ Run "${buildPlaywrightCLICommand(sdkLanguage, "install " + name)}"` : "";
|
|
|
1003
1003
|
if (import_os.default.platform() === "linux")
|
|
1004
1004
|
return await (0, import_dependencies2.installDependenciesLinux)(targets, dryRun);
|
|
1005
1005
|
}
|
|
1006
|
-
async install(executablesToInstall,
|
|
1006
|
+
async install(executablesToInstall, options) {
|
|
1007
1007
|
const executables = this._dedupe(executablesToInstall);
|
|
1008
1008
|
await import_fs.default.promises.mkdir(registryDirectory, { recursive: true });
|
|
1009
1009
|
const lockfilePath = import_path.default.join(registryDirectory, "__dirlock");
|
|
@@ -1031,7 +1031,7 @@ Run "${buildPlaywrightCLICommand(sdkLanguage, "install " + name)}"` : "";
|
|
|
1031
1031
|
if (!executable._install)
|
|
1032
1032
|
throw new Error(`ERROR: Playwright does not support installing ${executable.name}`);
|
|
1033
1033
|
const { embedderName } = (0, import_userAgent.getEmbedderName)();
|
|
1034
|
-
if (!(0, import_utils.getAsBooleanFromENV)("CI") && !executable._isHermeticInstallation && !
|
|
1034
|
+
if (!(0, import_utils.getAsBooleanFromENV)("CI") && !executable._isHermeticInstallation && !options?.force && executable.executablePath(embedderName)) {
|
|
1035
1035
|
const command = buildPlaywrightCLICommand(embedderName, "install --force " + executable.name);
|
|
1036
1036
|
process.stderr.write("\n" + (0, import_ascii.wrapInASCIIBox)([
|
|
1037
1037
|
`ATTENTION: "${executable.name}" is already installed on the system!`,
|
|
@@ -1275,6 +1275,47 @@ ${e.stack}`);
|
|
|
1275
1275
|
await import_fs.default.promises.unlink(linkPath).catch((e) => {
|
|
1276
1276
|
});
|
|
1277
1277
|
}
|
|
1278
|
+
_defaultBrowsersToInstall(options) {
|
|
1279
|
+
let executables = this.defaultExecutables();
|
|
1280
|
+
if (options.shell === "no")
|
|
1281
|
+
executables = executables.filter((e) => e.name !== "chromium-headless-shell");
|
|
1282
|
+
if (options.shell === "only")
|
|
1283
|
+
executables = executables.filter((e) => e.name !== "chromium");
|
|
1284
|
+
return executables;
|
|
1285
|
+
}
|
|
1286
|
+
suggestedBrowsersToInstall() {
|
|
1287
|
+
return this.executables().filter((e) => e.installType !== "none" && e.type !== "tool").map((e) => e.name).join(", ");
|
|
1288
|
+
}
|
|
1289
|
+
resolveBrowsers(aliases, options) {
|
|
1290
|
+
if (aliases.length === 0)
|
|
1291
|
+
return this._defaultBrowsersToInstall(options);
|
|
1292
|
+
const faultyArguments = [];
|
|
1293
|
+
const executables = [];
|
|
1294
|
+
const handleArgument = (arg) => {
|
|
1295
|
+
const executable = this.findExecutable(arg);
|
|
1296
|
+
if (!executable || executable.installType === "none")
|
|
1297
|
+
faultyArguments.push(arg);
|
|
1298
|
+
else
|
|
1299
|
+
executables.push(executable);
|
|
1300
|
+
if (executable?.browserName === "chromium")
|
|
1301
|
+
executables.push(this.findExecutable("ffmpeg"));
|
|
1302
|
+
};
|
|
1303
|
+
for (const alias of aliases) {
|
|
1304
|
+
if (alias === "chromium") {
|
|
1305
|
+
if (options.shell !== "only")
|
|
1306
|
+
handleArgument("chromium");
|
|
1307
|
+
if (options.shell !== "no")
|
|
1308
|
+
handleArgument("chromium-headless-shell");
|
|
1309
|
+
} else {
|
|
1310
|
+
handleArgument(alias);
|
|
1311
|
+
}
|
|
1312
|
+
}
|
|
1313
|
+
if (process.platform === "win32")
|
|
1314
|
+
executables.push(this.findExecutable("winldd"));
|
|
1315
|
+
if (faultyArguments.length)
|
|
1316
|
+
throw new Error(`Invalid installation targets: ${faultyArguments.map((name) => `'${name}'`).join(", ")}. Expecting one of: ${this.suggestedBrowsersToInstall()}`);
|
|
1317
|
+
return executables;
|
|
1318
|
+
}
|
|
1278
1319
|
}
|
|
1279
1320
|
function browserDirectoryToMarkerFilePath(browserDirectory) {
|
|
1280
1321
|
return import_path.default.join(browserDirectory, "INSTALLATION_COMPLETE");
|
|
@@ -1307,11 +1348,7 @@ async function installBrowsersForNpmInstall(browsers) {
|
|
|
1307
1348
|
throw new Error(`Cannot install ${browserName}`);
|
|
1308
1349
|
executables.push(executable);
|
|
1309
1350
|
}
|
|
1310
|
-
await registry.install(
|
|
1311
|
-
executables,
|
|
1312
|
-
false
|
|
1313
|
-
/* forceReinstall */
|
|
1314
|
-
);
|
|
1351
|
+
await registry.install(executables);
|
|
1315
1352
|
}
|
|
1316
1353
|
function findChromiumChannelBestEffort(sdkLanguage) {
|
|
1317
1354
|
let channel = null;
|