patchright-core 1.49.1 → 1.50.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/ThirdPartyNotices.txt +9 -9
- package/bin/reinstall_msedge_beta_linux.sh +6 -0
- package/bin/reinstall_msedge_dev_linux.sh +6 -0
- package/bin/reinstall_msedge_stable_linux.sh +6 -0
- package/browsers.json +17 -16
- package/lib/androidServerImpl.js +1 -1
- package/lib/cli/program.js +6 -30
- package/lib/client/channelOwner.js +35 -55
- package/lib/client/clientInstrumentation.js +2 -0
- package/lib/client/connection.js +3 -3
- package/lib/client/network.js +3 -1
- package/lib/client/waiter.js +1 -1
- package/lib/generated/consoleApiSource.js +1 -1
- package/lib/generated/injectedScriptSource.js +1 -1
- package/lib/generated/pollingRecorderSource.js +1 -1
- package/lib/inProcessFactory.js +2 -0
- package/lib/protocol/debug.js +1 -1
- package/lib/protocol/validator.js +2 -2
- package/lib/remote/playwrightConnection.js +4 -3
- package/lib/remote/playwrightServer.js +2 -1
- package/lib/server/bidi/bidiBrowser.js +9 -6
- package/lib/server/bidi/bidiExecutionContext.js +20 -1
- package/lib/server/bidi/bidiInput.js +7 -5
- package/lib/server/bidi/bidiNetworkManager.js +8 -9
- package/lib/server/bidi/bidiPage.js +9 -20
- package/lib/server/bidi/third_party/bidiKeyboard.js +9 -7
- package/lib/server/browserContext.js +24 -16
- package/lib/server/chromium/crBrowser.js +10 -10
- package/lib/server/chromium/crExecutionContext.js +1 -5
- package/lib/server/chromium/crInput.js +15 -4
- package/lib/server/chromium/crPage.js +19 -31
- package/lib/server/codegen/csharp.js +12 -2
- package/lib/server/codegen/java.js +14 -3
- package/lib/server/codegen/javascript.js +10 -2
- package/lib/server/codegen/jsonl.js +1 -1
- package/lib/server/codegen/python.js +5 -4
- package/lib/server/debugController.js +15 -40
- package/lib/server/debugger.js +1 -1
- package/lib/server/deviceDescriptorsSource.json +50 -50
- package/lib/server/dispatchers/browserContextDispatcher.js +2 -13
- package/lib/server/dispatchers/debugControllerDispatcher.js +4 -2
- package/lib/server/dispatchers/frameDispatcher.js +3 -2
- package/lib/server/dispatchers/pageDispatcher.js +1 -1
- package/lib/server/dispatchers/webSocketRouteDispatcher.js +10 -11
- package/lib/server/dom.js +7 -2
- package/lib/server/firefox/ffBrowser.js +6 -6
- package/lib/server/firefox/ffInput.js +15 -4
- package/lib/server/firefox/ffPage.js +13 -28
- package/lib/server/frames.js +30 -39
- package/lib/server/har/harTracer.js +1 -1
- package/lib/server/input.js +2 -3
- package/lib/server/launchApp.js +5 -5
- package/lib/server/network.js +2 -2
- package/lib/server/page.js +23 -16
- package/lib/server/recorder/chat.js +177 -0
- package/lib/server/recorder/contextRecorder.js +6 -15
- package/lib/server/recorder/recorderApp.js +1 -1
- package/lib/server/recorder/recorderCollection.js +5 -17
- package/lib/server/recorder/recorderRunner.js +7 -3
- package/lib/server/recorder/recorderUtils.js +5 -29
- package/lib/server/recorder.js +12 -9
- package/lib/server/registry/browserFetcher.js +1 -1
- package/lib/server/registry/dependencies.js +5 -5
- package/lib/server/registry/index.js +118 -5
- package/lib/server/registry/nativeDeps.js +7 -4
- package/lib/server/trace/recorder/snapshotterInjected.js +12 -5
- package/lib/server/trace/viewer/traceViewer.js +6 -1
- package/lib/server/transport.js +1 -0
- package/lib/server/webkit/webkit.js +1 -1
- package/lib/server/webkit/wkBrowser.js +6 -6
- package/lib/server/webkit/wkExecutionContext.js +1 -0
- package/lib/server/webkit/wkInput.js +15 -5
- package/lib/server/webkit/wkPage.js +9 -25
- package/lib/utils/comparators.js +16 -10
- package/lib/utils/debugLogger.js +3 -1
- package/lib/utils/hostPlatform.js +14 -8
- package/lib/utils/isomorphic/ariaSnapshot.js +176 -52
- package/lib/utils/isomorphic/cssParser.js +4 -4
- package/lib/utils/isomorphic/locatorGenerators.js +2 -2
- package/lib/utils/isomorphic/locatorParser.js +18 -12
- package/lib/utils/isomorphic/urlMatch.js +2 -4
- package/lib/utils/processLauncher.js +1 -1
- package/lib/utils/wsServer.js +1 -0
- package/lib/utils/zones.js +18 -20
- package/lib/utilsBundleImpl/index.js +95 -95
- package/lib/vite/htmlReport/index.html +14 -14
- package/lib/vite/recorder/assets/{codeMirrorModule-AFvV6hAs.js → codeMirrorModule-3Qn3tPnZ.js} +1 -1
- package/lib/vite/recorder/assets/{index-_cTWgVuJ.js → index-Bek6JFv8.js} +78 -78
- package/lib/vite/recorder/assets/{index-iA1aAGZg.css → index-CAQewHss.css} +1 -1
- package/lib/vite/recorder/index.html +2 -2
- package/lib/vite/traceViewer/assets/{codeMirrorModule-BWCrdKft.js → codeMirrorModule-aLkSUGpW.js} +1 -1
- package/lib/vite/traceViewer/assets/defaultSettingsView-CxUo6zd3.js +243 -0
- package/lib/vite/traceViewer/defaultSettingsView.DtIkrKWn.css +1 -0
- package/lib/vite/traceViewer/index.Bhu5cv5R.js +2 -0
- package/lib/vite/traceViewer/index.html +3 -6
- package/lib/vite/traceViewer/sw.bundle.js +3 -3
- package/lib/vite/traceViewer/uiMode.BBy7FOVd.js +5 -0
- package/lib/vite/traceViewer/{uiMode.voC1ZiOQ.css → uiMode.Be_ME-Go.css} +1 -1
- package/lib/vite/traceViewer/uiMode.html +4 -7
- package/package.json +1 -1
- package/types/protocol.d.ts +269 -20
- package/types/types.d.ts +59 -29
- package/bin/PrintDeps.exe +0 -0
- package/bin/README.md +0 -2
- package/lib/server/ariaSnapshot.js +0 -33
- package/lib/server/recorder/recorderInTraceViewer.js +0 -144
- package/lib/utils/isomorphic/recorderUtils.js +0 -227
- package/lib/vite/traceViewer/assets/inspectorTab-C_9qyxv5.js +0 -68
- package/lib/vite/traceViewer/assets/testServerConnection-DeE2kSzz.js +0 -1
- package/lib/vite/traceViewer/assets/workbench-DsQEOQud.js +0 -9
- package/lib/vite/traceViewer/embedded.D4x_-tXl.js +0 -2
- package/lib/vite/traceViewer/embedded.html +0 -18
- package/lib/vite/traceViewer/embedded.w7WN2u1R.css +0 -1
- package/lib/vite/traceViewer/index.BskMikzx.js +0 -2
- package/lib/vite/traceViewer/inspectorTab.DEOUW62d.css +0 -1
- package/lib/vite/traceViewer/recorder.B_SY1GJM.css +0 -0
- package/lib/vite/traceViewer/recorder.Dsk1wX5k.js +0 -2
- package/lib/vite/traceViewer/recorder.html +0 -17
- package/lib/vite/traceViewer/uiMode.CzKr-TMc.js +0 -5
- package/lib/vite/traceViewer/workbench.C-zR9ysA.css +0 -1
|
@@ -51,11 +51,20 @@ function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e;
|
|
|
51
51
|
|
|
52
52
|
const PACKAGE_PATH = _path.default.join(__dirname, '..', '..', '..');
|
|
53
53
|
const BIN_PATH = _path.default.join(__dirname, '..', '..', '..', 'bin');
|
|
54
|
-
const PLAYWRIGHT_CDN_MIRRORS = ['https://playwright.
|
|
54
|
+
const PLAYWRIGHT_CDN_MIRRORS = ['https://cdn.playwright.dev/dbazure/download/playwright',
|
|
55
|
+
// ESRP CDN
|
|
56
|
+
'https://playwright.download.prss.microsoft.com/dbazure/download/playwright',
|
|
57
|
+
// Directly hit ESRP CDN
|
|
58
|
+
'https://cdn.playwright.dev' // Hit the Storage Bucket directly
|
|
59
|
+
];
|
|
55
60
|
if (process.env.PW_TEST_CDN_THAT_SHOULD_WORK) {
|
|
56
61
|
for (let i = 0; i < PLAYWRIGHT_CDN_MIRRORS.length; i++) {
|
|
57
62
|
const cdn = PLAYWRIGHT_CDN_MIRRORS[i];
|
|
58
|
-
if (cdn !== process.env.PW_TEST_CDN_THAT_SHOULD_WORK)
|
|
63
|
+
if (cdn !== process.env.PW_TEST_CDN_THAT_SHOULD_WORK) {
|
|
64
|
+
const parsedCDN = new URL(cdn);
|
|
65
|
+
parsedCDN.hostname = parsedCDN.hostname + '.does-not-resolve.playwright.dev';
|
|
66
|
+
PLAYWRIGHT_CDN_MIRRORS[i] = parsedCDN.toString();
|
|
67
|
+
}
|
|
59
68
|
}
|
|
60
69
|
}
|
|
61
70
|
const EXECUTABLE_PATHS = {
|
|
@@ -83,6 +92,11 @@ const EXECUTABLE_PATHS = {
|
|
|
83
92
|
'linux': ['ffmpeg-linux'],
|
|
84
93
|
'mac': ['ffmpeg-mac'],
|
|
85
94
|
'win': ['ffmpeg-win64.exe']
|
|
95
|
+
},
|
|
96
|
+
'winldd': {
|
|
97
|
+
'linux': undefined,
|
|
98
|
+
'mac': undefined,
|
|
99
|
+
'win': ['PrintDeps.exe']
|
|
86
100
|
}
|
|
87
101
|
};
|
|
88
102
|
const DOWNLOAD_PATHS = {
|
|
@@ -173,6 +187,35 @@ const DOWNLOAD_PATHS = {
|
|
|
173
187
|
'mac15-arm64': 'builds/chromium-tip-of-tree/%s/chromium-tip-of-tree-mac-arm64.zip',
|
|
174
188
|
'win64': 'builds/chromium-tip-of-tree/%s/chromium-tip-of-tree-win64.zip'
|
|
175
189
|
},
|
|
190
|
+
'chromium-tip-of-tree-headless-shell': {
|
|
191
|
+
'<unknown>': undefined,
|
|
192
|
+
'ubuntu18.04-x64': undefined,
|
|
193
|
+
'ubuntu20.04-x64': 'builds/chromium-tip-of-tree/%s/chromium-tip-of-tree-headless-shell-linux.zip',
|
|
194
|
+
'ubuntu22.04-x64': 'builds/chromium-tip-of-tree/%s/chromium-tip-of-tree-headless-shell-linux.zip',
|
|
195
|
+
'ubuntu24.04-x64': 'builds/chromium-tip-of-tree/%s/chromium-tip-of-tree-headless-shell-linux.zip',
|
|
196
|
+
'ubuntu18.04-arm64': undefined,
|
|
197
|
+
'ubuntu20.04-arm64': 'builds/chromium-tip-of-tree/%s/chromium-tip-of-tree-headless-shell-linux-arm64.zip',
|
|
198
|
+
'ubuntu22.04-arm64': 'builds/chromium-tip-of-tree/%s/chromium-tip-of-tree-headless-shell-linux-arm64.zip',
|
|
199
|
+
'ubuntu24.04-arm64': 'builds/chromium-tip-of-tree/%s/chromium-tip-of-tree-headless-shell-linux-arm64.zip',
|
|
200
|
+
'debian11-x64': 'builds/chromium-tip-of-tree/%s/chromium-tip-of-tree-headless-shell-linux.zip',
|
|
201
|
+
'debian11-arm64': 'builds/chromium-tip-of-tree/%s/chromium-tip-of-tree-headless-shell-linux-arm64.zip',
|
|
202
|
+
'debian12-x64': 'builds/chromium-tip-of-tree/%s/chromium-tip-of-tree-headless-shell-linux.zip',
|
|
203
|
+
'debian12-arm64': 'builds/chromium-tip-of-tree/%s/chromium-tip-of-tree-headless-shell-linux-arm64.zip',
|
|
204
|
+
'mac10.13': undefined,
|
|
205
|
+
'mac10.14': undefined,
|
|
206
|
+
'mac10.15': undefined,
|
|
207
|
+
'mac11': 'builds/chromium-tip-of-tree/%s/chromium-tip-of-tree-headless-shell-mac.zip',
|
|
208
|
+
'mac11-arm64': 'builds/chromium-tip-of-tree/%s/chromium-tip-of-tree-headless-shell-mac-arm64.zip',
|
|
209
|
+
'mac12': 'builds/chromium-tip-of-tree/%s/chromium-tip-of-tree-headless-shell-mac.zip',
|
|
210
|
+
'mac12-arm64': 'builds/chromium-tip-of-tree/%s/chromium-tip-of-tree-headless-shell-mac-arm64.zip',
|
|
211
|
+
'mac13': 'builds/chromium-tip-of-tree/%s/chromium-tip-of-tree-headless-shell-mac.zip',
|
|
212
|
+
'mac13-arm64': 'builds/chromium-tip-of-tree/%s/chromium-tip-of-tree-headless-shell-mac-arm64.zip',
|
|
213
|
+
'mac14': 'builds/chromium-tip-of-tree/%s/chromium-tip-of-tree-headless-shell-mac.zip',
|
|
214
|
+
'mac14-arm64': 'builds/chromium-tip-of-tree/%s/chromium-tip-of-tree-headless-shell-mac-arm64.zip',
|
|
215
|
+
'mac15': 'builds/chromium-tip-of-tree/%s/chromium-tip-of-tree-headless-shell-mac.zip',
|
|
216
|
+
'mac15-arm64': 'builds/chromium-tip-of-tree/%s/chromium-tip-of-tree-headless-shell-mac-arm64.zip',
|
|
217
|
+
'win64': 'builds/chromium-tip-of-tree/%s/chromium-tip-of-tree-headless-shell-win64.zip'
|
|
218
|
+
},
|
|
176
219
|
'firefox': {
|
|
177
220
|
'<unknown>': undefined,
|
|
178
221
|
'ubuntu18.04-x64': undefined,
|
|
@@ -289,6 +332,35 @@ const DOWNLOAD_PATHS = {
|
|
|
289
332
|
'mac15-arm64': 'builds/ffmpeg/%s/ffmpeg-mac-arm64.zip',
|
|
290
333
|
'win64': 'builds/ffmpeg/%s/ffmpeg-win64.zip'
|
|
291
334
|
},
|
|
335
|
+
'winldd': {
|
|
336
|
+
'<unknown>': undefined,
|
|
337
|
+
'ubuntu18.04-x64': undefined,
|
|
338
|
+
'ubuntu20.04-x64': undefined,
|
|
339
|
+
'ubuntu22.04-x64': undefined,
|
|
340
|
+
'ubuntu24.04-x64': undefined,
|
|
341
|
+
'ubuntu18.04-arm64': undefined,
|
|
342
|
+
'ubuntu20.04-arm64': undefined,
|
|
343
|
+
'ubuntu22.04-arm64': undefined,
|
|
344
|
+
'ubuntu24.04-arm64': undefined,
|
|
345
|
+
'debian11-x64': undefined,
|
|
346
|
+
'debian11-arm64': undefined,
|
|
347
|
+
'debian12-x64': undefined,
|
|
348
|
+
'debian12-arm64': undefined,
|
|
349
|
+
'mac10.13': undefined,
|
|
350
|
+
'mac10.14': undefined,
|
|
351
|
+
'mac10.15': undefined,
|
|
352
|
+
'mac11': undefined,
|
|
353
|
+
'mac11-arm64': undefined,
|
|
354
|
+
'mac12': undefined,
|
|
355
|
+
'mac12-arm64': undefined,
|
|
356
|
+
'mac13': undefined,
|
|
357
|
+
'mac13-arm64': undefined,
|
|
358
|
+
'mac14': undefined,
|
|
359
|
+
'mac14-arm64': undefined,
|
|
360
|
+
'mac15': undefined,
|
|
361
|
+
'mac15-arm64': undefined,
|
|
362
|
+
'win64': 'builds/winldd/%s/winldd-win64.zip'
|
|
363
|
+
},
|
|
292
364
|
'android': {
|
|
293
365
|
'<unknown>': 'builds/android/%s/android.zip',
|
|
294
366
|
'ubuntu18.04-x64': undefined,
|
|
@@ -351,7 +423,14 @@ function isBrowserDirectory(browserDirectory) {
|
|
|
351
423
|
return false;
|
|
352
424
|
}
|
|
353
425
|
function readDescriptors(browsersJSON) {
|
|
354
|
-
|
|
426
|
+
const headlessShells = [];
|
|
427
|
+
for (const browserName of ['chromium', 'chromium-tip-of-tree']) {
|
|
428
|
+
headlessShells.push({
|
|
429
|
+
...browsersJSON.browsers.find(browser => browser.name === browserName),
|
|
430
|
+
name: `${browserName}-headless-shell`
|
|
431
|
+
});
|
|
432
|
+
}
|
|
433
|
+
return [...browsersJSON.browsers, ...headlessShells].map(obj => {
|
|
355
434
|
const name = obj.name;
|
|
356
435
|
const revisionOverride = (obj.revisionOverrides || {})[_hostPlatform.hostPlatform];
|
|
357
436
|
const revision = revisionOverride || obj.revision;
|
|
@@ -373,7 +452,7 @@ function readDescriptors(browsersJSON) {
|
|
|
373
452
|
return descriptor;
|
|
374
453
|
});
|
|
375
454
|
}
|
|
376
|
-
const allDownloadable = ['android', 'chromium', 'firefox', 'webkit', 'ffmpeg', 'firefox-beta', 'chromium-tip-of-tree', 'chromium-headless-shell'];
|
|
455
|
+
const allDownloadable = ['android', 'chromium', 'firefox', 'webkit', 'ffmpeg', 'firefox-beta', 'chromium-tip-of-tree', 'chromium-headless-shell', 'chromium-tip-of-tree-headless-shell'];
|
|
377
456
|
class Registry {
|
|
378
457
|
constructor(browsersJSON) {
|
|
379
458
|
this._executables = void 0;
|
|
@@ -430,6 +509,23 @@ class Registry {
|
|
|
430
509
|
_dependencyGroup: 'chromium',
|
|
431
510
|
_isHermeticInstallation: true
|
|
432
511
|
});
|
|
512
|
+
const chromiumTipOfTreeHeadlessShell = descriptors.find(d => d.name === 'chromium-tip-of-tree-headless-shell');
|
|
513
|
+
const chromiumTipOfTreeHeadlessShellExecutable = findExecutablePath(chromiumTipOfTreeHeadlessShell.dir, 'chromium-headless-shell');
|
|
514
|
+
this._executables.push({
|
|
515
|
+
type: 'channel',
|
|
516
|
+
name: 'chromium-tip-of-tree-headless-shell',
|
|
517
|
+
browserName: 'chromium',
|
|
518
|
+
directory: chromiumTipOfTreeHeadlessShell.dir,
|
|
519
|
+
executablePath: () => chromiumTipOfTreeHeadlessShellExecutable,
|
|
520
|
+
executablePathOrDie: sdkLanguage => executablePathOrDie('chromium', chromiumTipOfTreeHeadlessShellExecutable, chromiumTipOfTreeHeadlessShell.installByDefault, sdkLanguage),
|
|
521
|
+
installType: chromiumTipOfTreeHeadlessShell.installByDefault ? 'download-by-default' : 'download-on-demand',
|
|
522
|
+
_validateHostRequirements: sdkLanguage => this._validateHostRequirements(sdkLanguage, chromiumTipOfTreeHeadlessShell.dir, ['chrome-linux'], [], ['chrome-win']),
|
|
523
|
+
downloadURLs: this._downloadURLs(chromiumTipOfTreeHeadlessShell),
|
|
524
|
+
browserVersion: chromium.browserVersion,
|
|
525
|
+
_install: () => this._downloadExecutable(chromiumTipOfTreeHeadlessShell, chromiumTipOfTreeHeadlessShellExecutable),
|
|
526
|
+
_dependencyGroup: 'chromium',
|
|
527
|
+
_isHermeticInstallation: true
|
|
528
|
+
});
|
|
433
529
|
const chromiumTipOfTree = descriptors.find(d => d.name === 'chromium-tip-of-tree');
|
|
434
530
|
const chromiumTipOfTreeExecutable = findExecutablePath(chromiumTipOfTree.dir, 'chromium');
|
|
435
531
|
this._executables.push({
|
|
@@ -615,6 +711,22 @@ class Registry {
|
|
|
615
711
|
_dependencyGroup: 'tools',
|
|
616
712
|
_isHermeticInstallation: true
|
|
617
713
|
});
|
|
714
|
+
const winldd = descriptors.find(d => d.name === 'winldd');
|
|
715
|
+
const winlddExecutable = findExecutablePath(winldd.dir, 'winldd');
|
|
716
|
+
this._executables.push({
|
|
717
|
+
type: 'tool',
|
|
718
|
+
name: 'winldd',
|
|
719
|
+
browserName: undefined,
|
|
720
|
+
directory: winldd.dir,
|
|
721
|
+
executablePath: () => winlddExecutable,
|
|
722
|
+
executablePathOrDie: sdkLanguage => executablePathOrDie('winldd', winlddExecutable, winldd.installByDefault, sdkLanguage),
|
|
723
|
+
installType: process.platform === 'win32' ? 'download-by-default' : 'none',
|
|
724
|
+
_validateHostRequirements: () => Promise.resolve(),
|
|
725
|
+
downloadURLs: this._downloadURLs(winldd),
|
|
726
|
+
_install: () => this._downloadExecutable(winldd, winlddExecutable),
|
|
727
|
+
_dependencyGroup: 'tools',
|
|
728
|
+
_isHermeticInstallation: true
|
|
729
|
+
});
|
|
618
730
|
const android = descriptors.find(d => d.name === 'android');
|
|
619
731
|
this._executables.push({
|
|
620
732
|
type: 'tool',
|
|
@@ -751,7 +863,7 @@ class Registry {
|
|
|
751
863
|
}
|
|
752
864
|
async _validateHostRequirements(sdkLanguage, browserDirectory, linuxLddDirectories, dlOpenLibraries, windowsExeAndDllDirectories) {
|
|
753
865
|
if (os.platform() === 'linux') return await (0, _dependencies.validateDependenciesLinux)(sdkLanguage, linuxLddDirectories.map(d => _path.default.join(browserDirectory, d)), dlOpenLibraries);
|
|
754
|
-
if (os.platform() === 'win32' && os.arch() === 'x64') return await (0, _dependencies.validateDependenciesWindows)(windowsExeAndDllDirectories.map(d => _path.default.join(browserDirectory, d)));
|
|
866
|
+
if (os.platform() === 'win32' && os.arch() === 'x64') return await (0, _dependencies.validateDependenciesWindows)(sdkLanguage, windowsExeAndDllDirectories.map(d => _path.default.join(browserDirectory, d)));
|
|
755
867
|
}
|
|
756
868
|
async installDeps(executablesToInstallDeps, dryRun) {
|
|
757
869
|
const executables = this._dedupe(executablesToInstallDeps);
|
|
@@ -1017,6 +1129,7 @@ async function installBrowsersForNpmInstall(browsers) {
|
|
|
1017
1129
|
return false;
|
|
1018
1130
|
}
|
|
1019
1131
|
const executables = [];
|
|
1132
|
+
if (process.platform === 'win32') executables.push(registry.findExecutable('winldd'));
|
|
1020
1133
|
for (const browserName of browsers) {
|
|
1021
1134
|
const executable = registry.findExecutable(browserName);
|
|
1022
1135
|
if (!executable || executable.installType === 'none') throw new Error(`Cannot install ${browserName}`);
|
|
@@ -129,7 +129,7 @@ const deps = exports.deps = {
|
|
|
129
129
|
tools: ['xvfb', 'fonts-noto-color-emoji', 'fonts-unifont', 'libfontconfig1', 'libfreetype6', 'xfonts-cyrillic', 'xfonts-scalable', 'fonts-liberation', 'fonts-ipafont-gothic', 'fonts-wqy-zenhei', 'fonts-tlwg-loma-otf', 'fonts-freefont-ttf'],
|
|
130
130
|
chromium: ['libasound2', 'libatk-bridge2.0-0', 'libatk1.0-0', 'libatspi2.0-0', 'libcairo2', 'libcups2', 'libdbus-1-3', 'libdrm2', 'libgbm1', 'libglib2.0-0', 'libnspr4', 'libnss3', 'libpango-1.0-0', 'libwayland-client0', 'libx11-6', 'libxcb1', 'libxcomposite1', 'libxdamage1', 'libxext6', 'libxfixes3', 'libxkbcommon0', 'libxrandr2'],
|
|
131
131
|
firefox: ['ffmpeg', 'libasound2', 'libatk1.0-0', 'libcairo-gobject2', 'libcairo2', 'libdbus-1-3', 'libdbus-glib-1-2', 'libfontconfig1', 'libfreetype6', 'libgdk-pixbuf-2.0-0', 'libglib2.0-0', 'libgtk-3-0', 'libpango-1.0-0', 'libpangocairo-1.0-0', 'libx11-6', 'libx11-xcb1', 'libxcb-shm0', 'libxcb1', 'libxcomposite1', 'libxcursor1', 'libxdamage1', 'libxext6', 'libxfixes3', 'libxi6', 'libxrandr2', 'libxrender1', 'libxtst6'],
|
|
132
|
-
webkit: ['libsoup-3.0-0', 'libenchant-2-2', 'gstreamer1.0-libav', 'gstreamer1.0-plugins-bad', 'gstreamer1.0-plugins-base', 'gstreamer1.0-plugins-good', 'libicu70', 'libatk-bridge2.0-0', 'libatk1.0-0', 'libcairo2', 'libdbus-1-3', 'libdrm2', 'libegl1', 'libepoxy0', 'libevdev2', 'libffi7', 'libfontconfig1', 'libfreetype6', 'libgbm1', 'libgdk-pixbuf-2.0-0', 'libgles2', 'libglib2.0-0', 'libglx0', 'libgstreamer-gl1.0-0', 'libgstreamer-plugins-base1.0-0', 'libgstreamer1.0-0', 'libgtk-
|
|
132
|
+
webkit: ['libsoup-3.0-0', 'libenchant-2-2', 'gstreamer1.0-libav', 'gstreamer1.0-plugins-bad', 'gstreamer1.0-plugins-base', 'gstreamer1.0-plugins-good', 'libicu70', 'libatk-bridge2.0-0', 'libatk1.0-0', 'libcairo2', 'libdbus-1-3', 'libdrm2', 'libegl1', 'libepoxy0', 'libevdev2', 'libffi7', 'libfontconfig1', 'libfreetype6', 'libgbm1', 'libgdk-pixbuf-2.0-0', 'libgles2', 'libglib2.0-0', 'libglx0', 'libgstreamer-gl1.0-0', 'libgstreamer-plugins-base1.0-0', 'libgstreamer1.0-0', 'libgtk-4-1', 'libgudev-1.0-0', 'libharfbuzz-icu0', 'libharfbuzz0b', 'libhyphen0', 'libjpeg-turbo8', 'liblcms2-2', 'libmanette-0.2-0', 'libnotify4', 'libopengl0', 'libopenjp2-7', 'libopus0', 'libpango-1.0-0', 'libpng16-16', 'libproxy1v5', 'libsecret-1-0', 'libwayland-client0', 'libwayland-egl1', 'libwayland-server0', 'libwebpdemux2', 'libwoff1', 'libx11-6', 'libxcomposite1', 'libxdamage1', 'libxkbcommon0', 'libxml2', 'libxslt1.1', 'libx264-163', 'libatomic1', 'libevent-2.1-7', 'libavif13'],
|
|
133
133
|
lib2package: {
|
|
134
134
|
'libavif.so.13': 'libavif13',
|
|
135
135
|
'libsoup-3.0.so.0': 'libsoup-3.0-0',
|
|
@@ -169,6 +169,7 @@ const deps = exports.deps = {
|
|
|
169
169
|
'libgsttag-1.0.so.0': 'libgstreamer-plugins-base1.0-0',
|
|
170
170
|
'libgstvideo-1.0.so.0': 'libgstreamer-plugins-base1.0-0',
|
|
171
171
|
'libgtk-3.so.0': 'libgtk-3-0',
|
|
172
|
+
'libgtk-4.so.1': 'libgtk-4-1',
|
|
172
173
|
'libgudev-1.0.so.0': 'libgudev-1.0-0',
|
|
173
174
|
'libharfbuzz-icu.so.0': 'libharfbuzz-icu0',
|
|
174
175
|
'libharfbuzz.so.0': 'libharfbuzz0b',
|
|
@@ -225,7 +226,7 @@ const deps = exports.deps = {
|
|
|
225
226
|
tools: ['xvfb', 'fonts-noto-color-emoji', 'fonts-unifont', 'libfontconfig1', 'libfreetype6', 'xfonts-cyrillic', 'xfonts-scalable', 'fonts-liberation', 'fonts-ipafont-gothic', 'fonts-wqy-zenhei', 'fonts-tlwg-loma-otf', 'fonts-freefont-ttf'],
|
|
226
227
|
chromium: ['libasound2t64', 'libatk-bridge2.0-0t64', 'libatk1.0-0t64', 'libatspi2.0-0t64', 'libcairo2', 'libcups2t64', 'libdbus-1-3', 'libdrm2', 'libgbm1', 'libglib2.0-0t64', 'libnspr4', 'libnss3', 'libpango-1.0-0', 'libx11-6', 'libxcb1', 'libxcomposite1', 'libxdamage1', 'libxext6', 'libxfixes3', 'libxkbcommon0', 'libxrandr2'],
|
|
227
228
|
firefox: ['libasound2t64', 'libatk1.0-0t64', 'libcairo-gobject2', 'libcairo2', 'libdbus-1-3', 'libfontconfig1', 'libfreetype6', 'libgdk-pixbuf-2.0-0', 'libglib2.0-0t64', 'libgtk-3-0t64', 'libpango-1.0-0', 'libpangocairo-1.0-0', 'libx11-6', 'libx11-xcb1', 'libxcb-shm0', 'libxcb1', 'libxcomposite1', 'libxcursor1', 'libxdamage1', 'libxext6', 'libxfixes3', 'libxi6', 'libxrandr2', 'libxrender1'],
|
|
228
|
-
webkit: ['gstreamer1.0-libav', 'gstreamer1.0-plugins-bad', 'gstreamer1.0-plugins-base', 'gstreamer1.0-plugins-good', 'libicu74', 'libatomic1', 'libatk-bridge2.0-0t64', 'libatk1.0-0t64', 'libcairo-gobject2', 'libcairo2', 'libdbus-1-3', 'libdrm2', 'libenchant-2-2', 'libepoxy0', 'libevent-2.1-7t64', 'libflite1', 'libfontconfig1', 'libfreetype6', 'libgbm1', 'libgdk-pixbuf-2.0-0', 'libgles2', 'libglib2.0-0t64', 'libgstreamer-gl1.0-0', 'libgstreamer-plugins-bad1.0-0', 'libgstreamer-plugins-base1.0-0', 'libgstreamer1.0-0', 'libgtk-
|
|
229
|
+
webkit: ['gstreamer1.0-libav', 'gstreamer1.0-plugins-bad', 'gstreamer1.0-plugins-base', 'gstreamer1.0-plugins-good', 'libicu74', 'libatomic1', 'libatk-bridge2.0-0t64', 'libatk1.0-0t64', 'libcairo-gobject2', 'libcairo2', 'libdbus-1-3', 'libdrm2', 'libenchant-2-2', 'libepoxy0', 'libevent-2.1-7t64', 'libflite1', 'libfontconfig1', 'libfreetype6', 'libgbm1', 'libgdk-pixbuf-2.0-0', 'libgles2', 'libglib2.0-0t64', 'libgstreamer-gl1.0-0', 'libgstreamer-plugins-bad1.0-0', 'libgstreamer-plugins-base1.0-0', 'libgstreamer1.0-0', 'libgtk-4-1', 'libharfbuzz-icu0', 'libharfbuzz0b', 'libhyphen0', 'libicu74', 'libjpeg-turbo8', 'liblcms2-2', 'libmanette-0.2-0', 'libopus0', 'libpango-1.0-0', 'libpangocairo-1.0-0', 'libpng16-16t64', 'libsecret-1-0', 'libvpx9', 'libwayland-client0', 'libwayland-egl1', 'libwayland-server0', 'libwebp7', 'libwebpdemux2', 'libwoff1', 'libx11-6', 'libxkbcommon0', 'libxml2', 'libxslt1.1', 'libx264-164', 'libavif16'],
|
|
229
230
|
lib2package: {
|
|
230
231
|
'libavif.so.16': 'libavif16',
|
|
231
232
|
'libasound.so.2': 'libasound2t64',
|
|
@@ -276,6 +277,7 @@ const deps = exports.deps = {
|
|
|
276
277
|
'libgsttag-1.0.so.0': 'libgstreamer-plugins-base1.0-0',
|
|
277
278
|
'libgstvideo-1.0.so.0': 'libgstreamer-plugins-base1.0-0',
|
|
278
279
|
'libgtk-3.so.0': 'libgtk-3-0t64',
|
|
280
|
+
'libgtk-4.so.1': 'libgtk-4-1',
|
|
279
281
|
'libharfbuzz-icu.so.0': 'libharfbuzz-icu0',
|
|
280
282
|
'libharfbuzz.so.0': 'libharfbuzz0b',
|
|
281
283
|
'libhyphen.so.0': 'libhyphen0',
|
|
@@ -414,7 +416,7 @@ const deps = exports.deps = {
|
|
|
414
416
|
tools: ['xvfb', 'fonts-noto-color-emoji', 'fonts-unifont', 'libfontconfig1', 'libfreetype6', 'xfonts-scalable', 'fonts-liberation', 'fonts-ipafont-gothic', 'fonts-wqy-zenhei', 'fonts-tlwg-loma-otf', 'fonts-freefont-ttf'],
|
|
415
417
|
chromium: ['libasound2', 'libatk-bridge2.0-0', 'libatk1.0-0', 'libatspi2.0-0', 'libcairo2', 'libcups2', 'libdbus-1-3', 'libdrm2', 'libgbm1', 'libglib2.0-0', 'libnspr4', 'libnss3', 'libpango-1.0-0', 'libx11-6', 'libxcb1', 'libxcomposite1', 'libxdamage1', 'libxext6', 'libxfixes3', 'libxkbcommon0', 'libxrandr2'],
|
|
416
418
|
firefox: ['libasound2', 'libatk1.0-0', 'libcairo-gobject2', 'libcairo2', 'libdbus-1-3', 'libdbus-glib-1-2', 'libfontconfig1', 'libfreetype6', 'libgdk-pixbuf-2.0-0', 'libglib2.0-0', 'libgtk-3-0', 'libharfbuzz0b', 'libpango-1.0-0', 'libpangocairo-1.0-0', 'libx11-6', 'libx11-xcb1', 'libxcb-shm0', 'libxcb1', 'libxcomposite1', 'libxcursor1', 'libxdamage1', 'libxext6', 'libxfixes3', 'libxi6', 'libxrandr2', 'libxrender1', 'libxtst6'],
|
|
417
|
-
webkit: ['libsoup-3.0-0', 'gstreamer1.0-libav', 'gstreamer1.0-plugins-bad', 'gstreamer1.0-plugins-base', 'gstreamer1.0-plugins-good', 'libatk-bridge2.0-0', 'libatk1.0-0', 'libcairo2', 'libdbus-1-3', 'libdrm2', 'libegl1', 'libenchant-2-2', 'libepoxy0', 'libevdev2', 'libfontconfig1', 'libfreetype6', 'libgbm1', 'libgdk-pixbuf-2.0-0', 'libgles2', 'libglib2.0-0', 'libglx0', 'libgstreamer-gl1.0-0', 'libgstreamer-plugins-base1.0-0', 'libgstreamer1.0-0', 'libgtk-
|
|
419
|
+
webkit: ['libsoup-3.0-0', 'gstreamer1.0-libav', 'gstreamer1.0-plugins-bad', 'gstreamer1.0-plugins-base', 'gstreamer1.0-plugins-good', 'libatk-bridge2.0-0', 'libatk1.0-0', 'libcairo2', 'libdbus-1-3', 'libdrm2', 'libegl1', 'libenchant-2-2', 'libepoxy0', 'libevdev2', 'libfontconfig1', 'libfreetype6', 'libgbm1', 'libgdk-pixbuf-2.0-0', 'libgles2', 'libglib2.0-0', 'libglx0', 'libgstreamer-gl1.0-0', 'libgstreamer-plugins-base1.0-0', 'libgstreamer1.0-0', 'libgtk-4-1', 'libgudev-1.0-0', 'libharfbuzz-icu0', 'libharfbuzz0b', 'libhyphen0', 'libicu72', 'libjpeg62-turbo', 'liblcms2-2', 'libmanette-0.2-0', 'libnotify4', 'libopengl0', 'libopenjp2-7', 'libopus0', 'libpango-1.0-0', 'libpng16-16', 'libproxy1v5', 'libsecret-1-0', 'libwayland-client0', 'libwayland-egl1', 'libwayland-server0', 'libwebp7', 'libwebpdemux2', 'libwoff1', 'libx11-6', 'libxcomposite1', 'libxdamage1', 'libxkbcommon0', 'libxml2', 'libxslt1.1', 'libatomic1', 'libevent-2.1-7', 'libavif15'],
|
|
418
420
|
lib2package: {
|
|
419
421
|
'libavif.so.15': 'libavif15',
|
|
420
422
|
'libsoup-3.0.so.0': 'libsoup-3.0-0',
|
|
@@ -442,7 +444,8 @@ const deps = exports.deps = {
|
|
|
442
444
|
'libXext.so.6': 'libxext6',
|
|
443
445
|
'libXfixes.so.3': 'libxfixes3',
|
|
444
446
|
'libxkbcommon.so.0': 'libxkbcommon0',
|
|
445
|
-
'libXrandr.so.2': 'libxrandr2'
|
|
447
|
+
'libXrandr.so.2': 'libxrandr2',
|
|
448
|
+
'libgtk-4.so.1': 'libgtk-4-1'
|
|
446
449
|
}
|
|
447
450
|
}
|
|
448
451
|
};
|
|
@@ -36,6 +36,7 @@ function frameSnapshotStreamer(snapshotStreamer, removeNoScript) {
|
|
|
36
36
|
const kCustomElementsAttribute = '__playwright_custom_elements__';
|
|
37
37
|
const kCurrentSrcAttribute = '__playwright_current_src__';
|
|
38
38
|
const kBoundingRectAttribute = '__playwright_bounding_rect__';
|
|
39
|
+
const kPopoverOpenAttribute = '__playwright_popover_open_';
|
|
39
40
|
|
|
40
41
|
// Symbols for our own info on Nodes/StyleSheets.
|
|
41
42
|
const kSnapshotFrameId = Symbol('__playwright_snapshot_frameid_');
|
|
@@ -354,18 +355,24 @@ function frameSnapshotStreamer(snapshotStreamer, removeNoScript) {
|
|
|
354
355
|
expectValue(value);
|
|
355
356
|
attrs[kSelectedAttribute] = value;
|
|
356
357
|
}
|
|
357
|
-
if (nodeName === 'CANVAS') {
|
|
358
|
+
if (nodeName === 'CANVAS' || nodeName === 'IFRAME' || nodeName === 'FRAME') {
|
|
358
359
|
const boundingRect = element.getBoundingClientRect();
|
|
359
360
|
const value = JSON.stringify({
|
|
360
|
-
left: boundingRect.left
|
|
361
|
-
top: boundingRect.top
|
|
362
|
-
right: boundingRect.right
|
|
363
|
-
bottom: boundingRect.bottom
|
|
361
|
+
left: boundingRect.left,
|
|
362
|
+
top: boundingRect.top,
|
|
363
|
+
right: boundingRect.right,
|
|
364
|
+
bottom: boundingRect.bottom
|
|
364
365
|
});
|
|
365
366
|
expectValue(kBoundingRectAttribute);
|
|
366
367
|
expectValue(value);
|
|
367
368
|
attrs[kBoundingRectAttribute] = value;
|
|
368
369
|
}
|
|
370
|
+
if (element.popover && element.matches && element.matches(':popover-open')) {
|
|
371
|
+
const value = 'true';
|
|
372
|
+
expectValue(kPopoverOpenAttribute);
|
|
373
|
+
expectValue(value);
|
|
374
|
+
attrs[kPopoverOpenAttribute] = value;
|
|
375
|
+
}
|
|
369
376
|
if (element.scrollTop) {
|
|
370
377
|
expectValue(kScrollTopAttribute);
|
|
371
378
|
expectValue(element.scrollTop);
|
|
@@ -94,7 +94,12 @@ async function installRootRedirect(server, traceUrls, options) {
|
|
|
94
94
|
if (options.grepInvert) params.append('grepInvert', options.grepInvert);
|
|
95
95
|
for (const project of options.project || []) params.append('project', project);
|
|
96
96
|
for (const reporter of options.reporter || []) params.append('reporter', reporter);
|
|
97
|
-
|
|
97
|
+
let baseUrl = '.';
|
|
98
|
+
if (process.env.PW_HMR) {
|
|
99
|
+
baseUrl = 'http://localhost:44223'; // port is hardcoded in build.js
|
|
100
|
+
params.set('server', server.urlPrefix('precise'));
|
|
101
|
+
}
|
|
102
|
+
const urlPath = `${baseUrl}/trace/${options.webApp || 'index.html'}?${params.toString()}`;
|
|
98
103
|
server.routePath('/', (_, response) => {
|
|
99
104
|
response.statusCode = 302;
|
|
100
105
|
response.setHeader('Location', urlPath);
|
package/lib/server/transport.js
CHANGED
|
@@ -42,7 +42,7 @@ class WebKit extends _browserType.BrowserType {
|
|
|
42
42
|
}
|
|
43
43
|
doRewriteStartupLog(error) {
|
|
44
44
|
if (!error.logs) return error;
|
|
45
|
-
if (error.logs.includes('cannot open display')) error.logs = '\n' + (0, _utils.wrapInASCIIBox)(_browserType.kNoXServerRunningError, 1);
|
|
45
|
+
if (error.logs.includes('Failed to open display') || error.logs.includes('cannot open display')) error.logs = '\n' + (0, _utils.wrapInASCIIBox)(_browserType.kNoXServerRunningError, 1);
|
|
46
46
|
return error;
|
|
47
47
|
}
|
|
48
48
|
attemptToGracefullyCloseBrowser(transport) {
|
|
@@ -108,13 +108,13 @@ class WKBrowser extends _browser.Browser {
|
|
|
108
108
|
// abort navigation that is still running. We should be able to fix this by
|
|
109
109
|
// instrumenting policy decision start/proceed/cancel.
|
|
110
110
|
page._page._frameManager.frameAbortedNavigation(payload.frameId, 'Download is starting');
|
|
111
|
-
let originPage = page.
|
|
111
|
+
let originPage = page._page.initializedOrUndefined();
|
|
112
112
|
// If it's a new window download, report it on the opener page.
|
|
113
113
|
if (!originPage) {
|
|
114
114
|
// Resume the page creation with an error. The page will automatically close right
|
|
115
115
|
// after the download begins.
|
|
116
116
|
page._firstNonInitialNavigationCommittedReject(new Error('Starting new page download'));
|
|
117
|
-
if (page._opener) originPage = page._opener.
|
|
117
|
+
if (page._opener) originPage = page._opener._page.initializedOrUndefined();
|
|
118
118
|
}
|
|
119
119
|
if (!originPage) return;
|
|
120
120
|
this._downloadCreated(originPage, payload.uuid, payload.url);
|
|
@@ -209,17 +209,17 @@ class WKBrowserContext extends _browserContext.BrowserContext {
|
|
|
209
209
|
_wkPages() {
|
|
210
210
|
return Array.from(this._browser._wkPages.values()).filter(wkPage => wkPage._browserContext === this);
|
|
211
211
|
}
|
|
212
|
-
|
|
213
|
-
return this._wkPages().map(wkPage => wkPage.
|
|
212
|
+
possiblyUninitializedPages() {
|
|
213
|
+
return this._wkPages().map(wkPage => wkPage._page);
|
|
214
214
|
}
|
|
215
|
-
async
|
|
215
|
+
async doCreateNewPage() {
|
|
216
216
|
(0, _browserContext.assertBrowserContextIsNotOwned)(this);
|
|
217
217
|
const {
|
|
218
218
|
pageProxyId
|
|
219
219
|
} = await this._browser._browserSession.send('Playwright.createPage', {
|
|
220
220
|
browserContextId: this._browserContextId
|
|
221
221
|
});
|
|
222
|
-
return this._browser._wkPages.get(pageProxyId);
|
|
222
|
+
return this._browser._wkPages.get(pageProxyId)._page;
|
|
223
223
|
}
|
|
224
224
|
async doGetCookies(urls) {
|
|
225
225
|
const {
|
|
@@ -111,6 +111,7 @@ function potentiallyUnserializableValue(remoteObject) {
|
|
|
111
111
|
return isUnserializable ? js.parseUnserializableValue(remoteObject.description) : value;
|
|
112
112
|
}
|
|
113
113
|
function rewriteError(error) {
|
|
114
|
+
if (error.message.includes('Object has too long reference chain')) throw new Error('Cannot serialize result: object reference chain is too long.');
|
|
114
115
|
if (!js.isJavaScriptErrorInEvaluate(error) && !(0, _protocolError.isSessionClosedError)(error)) return new Error('Execution context was destroyed, most likely because of a navigation.');
|
|
115
116
|
return error;
|
|
116
117
|
}
|
|
@@ -51,11 +51,17 @@ class RawKeyboardImpl {
|
|
|
51
51
|
setSession(session) {
|
|
52
52
|
this._session = session;
|
|
53
53
|
}
|
|
54
|
-
async keydown(modifiers,
|
|
54
|
+
async keydown(modifiers, keyName, description, autoRepeat) {
|
|
55
55
|
const parts = [];
|
|
56
56
|
for (const modifier of ['Shift', 'Control', 'Alt', 'Meta']) {
|
|
57
57
|
if (modifiers.has(modifier)) parts.push(modifier);
|
|
58
58
|
}
|
|
59
|
+
const {
|
|
60
|
+
code,
|
|
61
|
+
keyCode,
|
|
62
|
+
key,
|
|
63
|
+
text
|
|
64
|
+
} = description;
|
|
59
65
|
parts.push(code);
|
|
60
66
|
const shortcut = parts.join('+');
|
|
61
67
|
let commands = _macEditingCommands.macEditingCommands[shortcut];
|
|
@@ -70,17 +76,21 @@ class RawKeyboardImpl {
|
|
|
70
76
|
unmodifiedText: text,
|
|
71
77
|
autoRepeat,
|
|
72
78
|
macCommands: commands,
|
|
73
|
-
isKeypad: location === input.keypadLocation
|
|
79
|
+
isKeypad: description.location === input.keypadLocation
|
|
74
80
|
});
|
|
75
81
|
}
|
|
76
|
-
async keyup(modifiers,
|
|
82
|
+
async keyup(modifiers, keyName, description) {
|
|
83
|
+
const {
|
|
84
|
+
code,
|
|
85
|
+
key
|
|
86
|
+
} = description;
|
|
77
87
|
await this._pageProxySession.send('Input.dispatchKeyEvent', {
|
|
78
88
|
type: 'keyUp',
|
|
79
89
|
modifiers: toModifiersMask(modifiers),
|
|
80
90
|
key,
|
|
81
|
-
windowsVirtualKeyCode: keyCode,
|
|
91
|
+
windowsVirtualKeyCode: description.keyCode,
|
|
82
92
|
code,
|
|
83
|
-
isKeypad: location === input.keypadLocation
|
|
93
|
+
isKeypad: description.location === input.keypadLocation
|
|
84
94
|
});
|
|
85
95
|
}
|
|
86
96
|
async sendText(text) {
|
|
@@ -5,7 +5,6 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
5
5
|
});
|
|
6
6
|
exports.WKPage = void 0;
|
|
7
7
|
var _path = _interopRequireDefault(require("path"));
|
|
8
|
-
var _os = _interopRequireDefault(require("os"));
|
|
9
8
|
var _utilsBundle = require("../../utilsBundle");
|
|
10
9
|
var _stackTrace = require("../../utils/stackTrace");
|
|
11
10
|
var _utils = require("../../utils");
|
|
@@ -24,7 +23,6 @@ var _wkInterceptableRequest = require("./wkInterceptableRequest");
|
|
|
24
23
|
var _wkProvisionalPage = require("./wkProvisionalPage");
|
|
25
24
|
var _wkWorkers = require("./wkWorkers");
|
|
26
25
|
var _debugLogger = require("../../utils/debugLogger");
|
|
27
|
-
var _manualPromise = require("../../utils/manualPromise");
|
|
28
26
|
var _browserContext = require("../browserContext");
|
|
29
27
|
var _errors = require("../errors");
|
|
30
28
|
function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function (e) { return e ? t : r; })(e); }
|
|
@@ -56,7 +54,6 @@ class WKPage {
|
|
|
56
54
|
this._session = void 0;
|
|
57
55
|
this._provisionalPage = null;
|
|
58
56
|
this._page = void 0;
|
|
59
|
-
this._pagePromise = new _manualPromise.ManualPromise();
|
|
60
57
|
this._pageProxySession = void 0;
|
|
61
58
|
this._opener = void 0;
|
|
62
59
|
this._requestIdToRequest = new Map();
|
|
@@ -66,7 +63,6 @@ class WKPage {
|
|
|
66
63
|
this._sessionListeners = [];
|
|
67
64
|
this._eventListeners = void 0;
|
|
68
65
|
this._browserContext = void 0;
|
|
69
|
-
this._initializedPage = null;
|
|
70
66
|
this._firstNonInitialNavigationCommittedPromise = void 0;
|
|
71
67
|
this._firstNonInitialNavigationCommittedFulfill = () => {};
|
|
72
68
|
this._firstNonInitialNavigationCommittedReject = e => {};
|
|
@@ -103,9 +99,6 @@ class WKPage {
|
|
|
103
99
|
};
|
|
104
100
|
}
|
|
105
101
|
}
|
|
106
|
-
potentiallyUninitializedPage() {
|
|
107
|
-
return this._page;
|
|
108
|
-
}
|
|
109
102
|
async _initializePageProxySession() {
|
|
110
103
|
if (this._page._browserContext.isSettingStorageState()) return;
|
|
111
104
|
const promises = [this._pageProxySession.send('Dialog.enable'), this._pageProxySession.send('Emulation.setActiveAndFocused', {
|
|
@@ -303,7 +296,7 @@ class WKPage {
|
|
|
303
296
|
this._pageProxySession.dispatchMessage(message);
|
|
304
297
|
}
|
|
305
298
|
handleProvisionalLoadFailed(event) {
|
|
306
|
-
if (!this.
|
|
299
|
+
if (!this._page.initializedOrUndefined()) {
|
|
307
300
|
this._firstNonInitialNavigationCommittedReject(new Error('Initial load failed'));
|
|
308
301
|
return;
|
|
309
302
|
}
|
|
@@ -316,9 +309,6 @@ class WKPage {
|
|
|
316
309
|
(0, _utils.debugAssert)(!this._nextWindowOpenPopupFeatures);
|
|
317
310
|
this._nextWindowOpenPopupFeatures = event.windowFeatures;
|
|
318
311
|
}
|
|
319
|
-
async pageOrError() {
|
|
320
|
-
return this._pagePromise;
|
|
321
|
-
}
|
|
322
312
|
async _onTargetCreated(event) {
|
|
323
313
|
const {
|
|
324
314
|
targetInfo
|
|
@@ -338,7 +328,8 @@ class WKPage {
|
|
|
338
328
|
});
|
|
339
329
|
(0, _utils.assert)(targetInfo.type === 'page', 'Only page targets are expected in WebKit, received: ' + targetInfo.type);
|
|
340
330
|
if (!targetInfo.isProvisional) {
|
|
341
|
-
|
|
331
|
+
var _this$_opener;
|
|
332
|
+
(0, _utils.assert)(!this._page.initializedOrUndefined());
|
|
342
333
|
let pageOrError;
|
|
343
334
|
try {
|
|
344
335
|
this._setSession(session);
|
|
@@ -365,12 +356,7 @@ class WKPage {
|
|
|
365
356
|
// Avoid rejection on disconnect.
|
|
366
357
|
this._firstNonInitialNavigationCommittedPromise.catch(() => {});
|
|
367
358
|
}
|
|
368
|
-
|
|
369
|
-
// Note: it is important to call |reportAsNew| before resolving pageOrError promise,
|
|
370
|
-
// so that anyone who awaits pageOrError got a ready and reported page.
|
|
371
|
-
this._initializedPage = pageOrError instanceof _page.Page ? pageOrError : null;
|
|
372
|
-
this._page.reportAsNew(pageOrError instanceof _page.Page ? undefined : pageOrError);
|
|
373
|
-
this._pagePromise.resolve(pageOrError);
|
|
359
|
+
this._page.reportAsNew((_this$_opener = this._opener) === null || _this$_opener === void 0 ? void 0 : _this$_opener._page, pageOrError instanceof _page.Page ? undefined : pageOrError);
|
|
374
360
|
} else {
|
|
375
361
|
(0, _utils.assert)(targetInfo.isProvisional);
|
|
376
362
|
(0, _utils.assert)(!this._provisionalPage);
|
|
@@ -473,7 +459,7 @@ class WKPage {
|
|
|
473
459
|
this._contextIdToContext.set(contextPayload.id, context);
|
|
474
460
|
}
|
|
475
461
|
async _onBindingCalled(contextId, argument) {
|
|
476
|
-
const pageOrError = await this.
|
|
462
|
+
const pageOrError = await this._page.waitForInitializedOrError();
|
|
477
463
|
if (!(pageOrError instanceof Error)) {
|
|
478
464
|
const context = this._contextIdToContext.get(contextId);
|
|
479
465
|
if (context) await this._page._onBindingCalled(argument, context);
|
|
@@ -570,6 +556,8 @@ class WKPage {
|
|
|
570
556
|
}
|
|
571
557
|
_onDialog(event) {
|
|
572
558
|
this._page.emitOnContext(_browserContext.BrowserContext.Events.Dialog, new dialog.Dialog(this._page, event.type, event.message, async (accept, promptText) => {
|
|
559
|
+
// TODO: this should actually be a RDP event that notifies about a cancelled navigation attempt.
|
|
560
|
+
if (event.type === 'beforeunload' && !accept) this._page._frameManager.frameAbortedNavigation(this._page.mainFrame()._id, 'navigation cancelled by beforeunload dialog');
|
|
573
561
|
await this._pageProxySession.send('Dialog.handleJavaScriptDialog', {
|
|
574
562
|
accept,
|
|
575
563
|
promptText
|
|
@@ -690,11 +678,7 @@ class WKPage {
|
|
|
690
678
|
})];
|
|
691
679
|
if (options.isMobile) {
|
|
692
680
|
const angle = viewportSize.width > viewportSize.height ? 90 : 0;
|
|
693
|
-
|
|
694
|
-
const useLegacySetOrientationOverrideMethod = _os.default.platform() === 'darwin' && parseInt(_os.default.release().split('.')[0], 10) <= 21;
|
|
695
|
-
if (useLegacySetOrientationOverrideMethod) promises.push(this._session.send('Page.setOrientationOverride', {
|
|
696
|
-
angle
|
|
697
|
-
}));else promises.push(this._pageProxySession.send('Emulation.setOrientationOverride', {
|
|
681
|
+
promises.push(this._pageProxySession.send('Emulation.setOrientationOverride', {
|
|
698
682
|
angle
|
|
699
683
|
}));
|
|
700
684
|
}
|
|
@@ -804,7 +788,7 @@ class WKPage {
|
|
|
804
788
|
toolbarHeight: this._toolbarHeight()
|
|
805
789
|
});
|
|
806
790
|
this._recordingVideoFile = options.outputFile;
|
|
807
|
-
this._browserContext._browser._videoStarted(this._browserContext, screencastId, options.outputFile, this.
|
|
791
|
+
this._browserContext._browser._videoStarted(this._browserContext, screencastId, options.outputFile, this._page.waitForInitializedOrError());
|
|
808
792
|
}
|
|
809
793
|
async _stopVideo() {
|
|
810
794
|
if (!this._recordingVideoFile) return;
|
package/lib/utils/comparators.js
CHANGED
|
@@ -3,6 +3,7 @@
|
|
|
3
3
|
Object.defineProperty(exports, "__esModule", {
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
|
+
exports.compareBuffersOrStrings = compareBuffersOrStrings;
|
|
6
7
|
exports.getComparator = getComparator;
|
|
7
8
|
var _utilsBundle = require("../utilsBundle");
|
|
8
9
|
var _pixelmatch = _interopRequireDefault(require("../third_party/pixelmatch"));
|
|
@@ -111,20 +112,25 @@ function compareText(actual, expectedBuffer) {
|
|
|
111
112
|
if (typeof actual !== 'string') return {
|
|
112
113
|
errorMessage: 'Actual result should be a string'
|
|
113
114
|
};
|
|
114
|
-
|
|
115
|
+
let expected = expectedBuffer.toString('utf-8');
|
|
115
116
|
if (expected === actual) return null;
|
|
116
|
-
|
|
117
|
+
// Eliminate '\'
|
|
118
|
+
if (!actual.endsWith('\n')) actual += '\n';
|
|
119
|
+
if (!expected.endsWith('\n')) expected += '\n';
|
|
120
|
+
const lines = _utilsBundle.diff.createPatch('file', expected, actual, undefined, undefined, {
|
|
121
|
+
context: 5
|
|
122
|
+
}).split('\n');
|
|
123
|
+
const coloredLines = lines.slice(4).map(line => {
|
|
124
|
+
if (line.startsWith('-')) return _utilsBundle.colors.red(line);
|
|
125
|
+
if (line.startsWith('+')) return _utilsBundle.colors.green(line);
|
|
126
|
+
if (line.startsWith('@@')) return _utilsBundle.colors.dim(line);
|
|
127
|
+
return line;
|
|
128
|
+
});
|
|
129
|
+
const errorMessage = coloredLines.join('\n');
|
|
117
130
|
return {
|
|
118
|
-
errorMessage
|
|
131
|
+
errorMessage
|
|
119
132
|
};
|
|
120
133
|
}
|
|
121
|
-
function diff_prettyTerminal(diffs) {
|
|
122
|
-
const result = diffs.map(part => {
|
|
123
|
-
const text = part.value;
|
|
124
|
-
if (part.added) return _utilsBundle.colors.green(text);else if (part.removed) return _utilsBundle.colors.reset(_utilsBundle.colors.strikethrough(_utilsBundle.colors.red(text)));else return text;
|
|
125
|
-
});
|
|
126
|
-
return result.join('');
|
|
127
|
-
}
|
|
128
134
|
function resizeImage(image, size) {
|
|
129
135
|
if (image.width === size.width && image.height === size.height) return image;
|
|
130
136
|
const buffer = new Uint8Array(size.width * size.height * 4);
|
package/lib/utils/debugLogger.js
CHANGED