patchright-core 1.49.2 → 1.50.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (128) hide show
  1. package/ThirdPartyNotices.txt +380 -12
  2. package/bin/reinstall_msedge_beta_linux.sh +6 -0
  3. package/bin/reinstall_msedge_dev_linux.sh +6 -0
  4. package/bin/reinstall_msedge_stable_linux.sh +6 -0
  5. package/browsers.json +17 -16
  6. package/lib/androidServerImpl.js +1 -1
  7. package/lib/cli/program.js +6 -30
  8. package/lib/client/channelOwner.js +35 -55
  9. package/lib/client/clientInstrumentation.js +2 -0
  10. package/lib/client/connection.js +3 -3
  11. package/lib/client/network.js +3 -1
  12. package/lib/client/waiter.js +1 -1
  13. package/lib/generated/consoleApiSource.js +1 -1
  14. package/lib/generated/injectedScriptSource.js +1 -1
  15. package/lib/generated/pollingRecorderSource.js +1 -1
  16. package/lib/inProcessFactory.js +2 -0
  17. package/lib/protocol/debug.js +1 -1
  18. package/lib/protocol/validator.js +2 -2
  19. package/lib/remote/playwrightConnection.js +4 -3
  20. package/lib/remote/playwrightServer.js +2 -1
  21. package/lib/server/bidi/bidiBrowser.js +9 -6
  22. package/lib/server/bidi/bidiExecutionContext.js +20 -1
  23. package/lib/server/bidi/bidiInput.js +7 -5
  24. package/lib/server/bidi/bidiNetworkManager.js +8 -9
  25. package/lib/server/bidi/bidiPage.js +9 -20
  26. package/lib/server/bidi/third_party/bidiKeyboard.js +9 -7
  27. package/lib/server/browserContext.js +24 -16
  28. package/lib/server/chromium/crBrowser.js +10 -10
  29. package/lib/server/chromium/crExecutionContext.js +1 -5
  30. package/lib/server/chromium/crInput.js +15 -4
  31. package/lib/server/chromium/crPage.js +17 -31
  32. package/lib/server/codegen/csharp.js +12 -2
  33. package/lib/server/codegen/java.js +14 -3
  34. package/lib/server/codegen/javascript.js +10 -2
  35. package/lib/server/codegen/jsonl.js +1 -1
  36. package/lib/server/codegen/python.js +5 -4
  37. package/lib/server/debugController.js +15 -40
  38. package/lib/server/debugger.js +1 -1
  39. package/lib/server/deviceDescriptorsSource.json +50 -50
  40. package/lib/server/dispatchers/browserContextDispatcher.js +2 -13
  41. package/lib/server/dispatchers/debugControllerDispatcher.js +4 -2
  42. package/lib/server/dispatchers/frameDispatcher.js +3 -2
  43. package/lib/server/dispatchers/pageDispatcher.js +1 -1
  44. package/lib/server/dispatchers/webSocketRouteDispatcher.js +10 -11
  45. package/lib/server/dom.js +7 -2
  46. package/lib/server/fetch.js +14 -20
  47. package/lib/server/firefox/ffBrowser.js +9 -7
  48. package/lib/server/firefox/ffInput.js +15 -4
  49. package/lib/server/firefox/ffPage.js +13 -28
  50. package/lib/server/frames.js +25 -30
  51. package/lib/server/har/harTracer.js +1 -1
  52. package/lib/server/input.js +2 -3
  53. package/lib/server/network.js +2 -2
  54. package/lib/server/page.js +23 -16
  55. package/lib/server/recorder/chat.js +177 -0
  56. package/lib/server/recorder/contextRecorder.js +6 -15
  57. package/lib/server/recorder/recorderApp.js +1 -1
  58. package/lib/server/recorder/recorderCollection.js +5 -17
  59. package/lib/server/recorder/recorderRunner.js +7 -3
  60. package/lib/server/recorder/recorderUtils.js +5 -29
  61. package/lib/server/recorder.js +12 -9
  62. package/lib/server/registry/browserFetcher.js +1 -1
  63. package/lib/server/registry/dependencies.js +5 -5
  64. package/lib/server/registry/index.js +118 -5
  65. package/lib/server/registry/nativeDeps.js +7 -4
  66. package/lib/server/socksClientCertificatesInterceptor.js +1 -1
  67. package/lib/server/trace/recorder/snapshotterInjected.js +12 -5
  68. package/lib/server/trace/viewer/traceViewer.js +6 -1
  69. package/lib/server/transport.js +1 -0
  70. package/lib/server/webkit/webkit.js +1 -1
  71. package/lib/server/webkit/wkBrowser.js +6 -6
  72. package/lib/server/webkit/wkExecutionContext.js +1 -0
  73. package/lib/server/webkit/wkInput.js +15 -5
  74. package/lib/server/webkit/wkPage.js +7 -25
  75. package/lib/utils/comparators.js +16 -10
  76. package/lib/utils/debugLogger.js +3 -1
  77. package/lib/utils/hostPlatform.js +14 -8
  78. package/lib/utils/httpServer.js +0 -4
  79. package/lib/utils/isomorphic/ariaSnapshot.js +176 -52
  80. package/lib/utils/isomorphic/cssParser.js +4 -4
  81. package/lib/utils/isomorphic/locatorGenerators.js +2 -2
  82. package/lib/utils/isomorphic/locatorParser.js +18 -12
  83. package/lib/utils/isomorphic/urlMatch.js +2 -4
  84. package/lib/utils/network.js +1 -1
  85. package/lib/utils/processLauncher.js +1 -1
  86. package/lib/utils/wsServer.js +1 -0
  87. package/lib/utils/zones.js +18 -20
  88. package/lib/utilsBundleImpl/index.js +104 -104
  89. package/lib/vite/htmlReport/index.html +14 -14
  90. package/lib/vite/{traceViewer/assets/codeMirrorModule-VZNWuWvU.js → recorder/assets/codeMirrorModule-CNAqJrkA.js} +1 -1
  91. package/lib/vite/recorder/assets/{index-CqeZmzx8.js → index-DGS0JLxS.js} +78 -78
  92. package/lib/vite/recorder/assets/{index-iA1aAGZg.css → index-eHBmevrY.css} +1 -1
  93. package/lib/vite/recorder/index.html +2 -2
  94. package/lib/vite/{recorder/assets/codeMirrorModule-DUzBrnvO.js → traceViewer/assets/codeMirrorModule-D55P_UuL.js} +10 -10
  95. package/lib/vite/traceViewer/assets/defaultSettingsView-B-uNoFsX.js +243 -0
  96. package/lib/vite/traceViewer/defaultSettingsView.2xeEXCXv.css +1 -0
  97. package/lib/vite/traceViewer/index.BfvuujqP.js +2 -0
  98. package/lib/vite/traceViewer/index.html +4 -7
  99. package/lib/vite/traceViewer/sw.bundle.js +3 -3
  100. package/lib/vite/traceViewer/{uiMode.voC1ZiOQ.css → uiMode.BatfzHMG.css} +1 -1
  101. package/lib/vite/traceViewer/uiMode.CStJu6jo.js +5 -0
  102. package/lib/vite/traceViewer/uiMode.html +4 -7
  103. package/package.json +1 -1
  104. package/types/protocol.d.ts +269 -20
  105. package/types/types.d.ts +69 -30
  106. package/bin/PrintDeps.exe +0 -0
  107. package/bin/README.md +0 -2
  108. package/lib/server/ariaSnapshot.js +0 -33
  109. package/lib/server/recorder/recorderInTraceViewer.js +0 -144
  110. package/lib/utils/isomorphic/recorderUtils.js +0 -227
  111. package/lib/vite/traceViewer/assets/inspectorTab-BV-Uf3j9.js +0 -68
  112. package/lib/vite/traceViewer/assets/testServerConnection-DeE2kSzz.js +0 -1
  113. package/lib/vite/traceViewer/assets/workbench-B4WPcYi9.js +0 -9
  114. package/lib/vite/traceViewer/embedded.BLPSqdbm.js +0 -2
  115. package/lib/vite/traceViewer/embedded.html +0 -18
  116. package/lib/vite/traceViewer/embedded.w7WN2u1R.css +0 -1
  117. package/lib/vite/traceViewer/index.BGZfFXXF.js +0 -2
  118. package/lib/vite/traceViewer/inspectorTab.DEOUW62d.css +0 -1
  119. package/lib/vite/traceViewer/recorder.B_SY1GJM.css +0 -0
  120. package/lib/vite/traceViewer/recorder.eWs2vuTG.js +0 -2
  121. package/lib/vite/traceViewer/recorder.html +0 -17
  122. package/lib/vite/traceViewer/uiMode.CW2d9h0S.js +0 -5
  123. package/lib/vite/traceViewer/workbench.C-zR9ysA.css +0 -1
  124. /package/lib/vite/recorder/assets/{codeMirrorModule-ez37Vkbh.css → codeMirrorModule-C3UTv-Ge.css} +0 -0
  125. /package/lib/vite/traceViewer/assets/{xtermModule-BeNbaIVa.js → xtermModule-c-SNdYZy.js} +0 -0
  126. /package/lib/vite/traceViewer/{codeMirrorModule.ez37Vkbh.css → codeMirrorModule.C3UTv-Ge.css} +0 -0
  127. /package/lib/vite/traceViewer/{index.CrbWWHbf.css → index.CFOW-Ezb.css} +0 -0
  128. /package/lib/vite/traceViewer/{xtermModule.DSXBckUd.css → xtermModule.Beg8tuEN.css} +0 -0
package/types/types.d.ts CHANGED
@@ -3609,8 +3609,6 @@ export interface Page {
3609
3609
  /**
3610
3610
  * Returns the PDF buffer.
3611
3611
  *
3612
- * **NOTE** Generating a pdf is currently only supported in Chromium headless.
3613
- *
3614
3612
  * `page.pdf()` generates a pdf of the page with `print` css media. To generate a pdf with `screen` media, call
3615
3613
  * [page.emulateMedia([options])](https://playwright.dev/docs/api/class-page#page-emulate-media) before calling
3616
3614
  * `page.pdf()`:
@@ -4296,7 +4294,7 @@ export interface Page {
4296
4294
  * takes priority over
4297
4295
  * [page.setDefaultTimeout(timeout)](https://playwright.dev/docs/api/class-page#page-set-default-timeout).
4298
4296
  *
4299
- * @param timeout Maximum time in milliseconds
4297
+ * @param timeout Maximum time in milliseconds. Pass `0` to disable timeout.
4300
4298
  */
4301
4299
  setDefaultTimeout(timeout: number): void;
4302
4300
 
@@ -8961,9 +8959,13 @@ export interface BrowserContext {
8961
8959
  /**
8962
8960
  * Grants specified permissions to the browser context. Only grants corresponding permissions to the given origin if
8963
8961
  * specified.
8964
- * @param permissions A permission or an array of permissions to grant. Permissions can be one of the following values:
8962
+ * @param permissions A list of permissions to grant.
8963
+ *
8964
+ * **NOTE** Supported permissions differ between browsers, and even between different versions of the same browser.
8965
+ * Any permission may stop working after an update.
8966
+ *
8967
+ * Here are some permissions that may be supported by some browsers:
8965
8968
  * - `'accelerometer'`
8966
- * - `'accessibility-events'`
8967
8969
  * - `'ambient-light-sensor'`
8968
8970
  * - `'background-sync'`
8969
8971
  * - `'camera'`
@@ -9191,7 +9193,7 @@ export interface BrowserContext {
9191
9193
  * take priority over
9192
9194
  * [browserContext.setDefaultTimeout(timeout)](https://playwright.dev/docs/api/class-browsercontext#browser-context-set-default-timeout).
9193
9195
  *
9194
- * @param timeout Maximum time in milliseconds
9196
+ * @param timeout Maximum time in milliseconds. Pass `0` to disable timeout.
9195
9197
  */
9196
9198
  setDefaultTimeout(timeout: number): void;
9197
9199
 
@@ -9587,10 +9589,11 @@ export interface Browser {
9587
9589
  * In case this browser is connected to, clears all created contexts belonging to this browser and disconnects from
9588
9590
  * the browser server.
9589
9591
  *
9590
- * **NOTE** This is similar to force quitting the browser. Therefore, you should call
9592
+ * **NOTE** This is similar to force-quitting the browser. To close pages gracefully and ensure you receive page close
9593
+ * events, call
9591
9594
  * [browserContext.close([options])](https://playwright.dev/docs/api/class-browsercontext#browser-context-close) on
9592
- * any [BrowserContext](https://playwright.dev/docs/api/class-browsercontext)'s you explicitly created earlier with
9593
- * [browser.newContext([options])](https://playwright.dev/docs/api/class-browser#browser-new-context) **before**
9595
+ * any [BrowserContext](https://playwright.dev/docs/api/class-browsercontext) instances you explicitly created earlier
9596
+ * using [browser.newContext([options])](https://playwright.dev/docs/api/class-browser#browser-new-context) **before**
9594
9597
  * calling [browser.close([options])](https://playwright.dev/docs/api/class-browser#browser-close).
9595
9598
  *
9596
9599
  * The [Browser](https://playwright.dev/docs/api/class-browser) object itself is considered to be disposed and cannot
@@ -12912,7 +12915,6 @@ export interface Locator {
12912
12915
  * live objects to be passed into the event:
12913
12916
  *
12914
12917
  * ```js
12915
- * // Note you can only create DataTransfer in Chromium and Firefox
12916
12918
  * const dataTransfer = await page.evaluateHandle(() => new DataTransfer());
12917
12919
  * await locator.dispatchEvent('dragstart', { dataTransfer });
12918
12920
  * ```
@@ -13676,7 +13678,9 @@ export interface Locator {
13676
13678
  }): Promise<boolean>;
13677
13679
 
13678
13680
  /**
13679
- * Returns whether the element is [editable](https://playwright.dev/docs/actionability#editable).
13681
+ * Returns whether the element is [editable](https://playwright.dev/docs/actionability#editable). If the target element is not an `<input>`,
13682
+ * `<textarea>`, `<select>`, `[contenteditable]` and does not have a role allowing `[aria-readonly]`, this method
13683
+ * throws an error.
13680
13684
  *
13681
13685
  * **NOTE** If you need to assert that an element is editable, prefer
13682
13686
  * [expect(locator).toBeEditable([options])](https://playwright.dev/docs/api/class-locatorassertions#locator-assertions-to-be-editable)
@@ -13848,18 +13852,22 @@ export interface Locator {
13848
13852
  /**
13849
13853
  * Creates a locator matching all elements that match one or both of the two locators.
13850
13854
  *
13851
- * Note that when both locators match something, the resulting locator will have multiple matches and violate
13852
- * [locator strictness](https://playwright.dev/docs/locators#strictness) guidelines.
13855
+ * Note that when both locators match something, the resulting locator will have multiple matches, potentially causing
13856
+ * a [locator strictness](https://playwright.dev/docs/locators#strictness) violation.
13853
13857
  *
13854
13858
  * **Usage**
13855
13859
  *
13856
13860
  * Consider a scenario where you'd like to click on a "New email" button, but sometimes a security settings dialog
13857
13861
  * shows up instead. In this case, you can wait for either a "New email" button, or a dialog and act accordingly.
13858
13862
  *
13863
+ * **NOTE** If both "New email" button and security dialog appear on screen, the "or" locator will match both of them,
13864
+ * possibly throwing the ["strict mode violation" error](https://playwright.dev/docs/locators#strictness). In this case, you can use
13865
+ * [locator.first()](https://playwright.dev/docs/api/class-locator#locator-first) to only match one of them.
13866
+ *
13859
13867
  * ```js
13860
13868
  * const newEmail = page.getByRole('button', { name: 'New' });
13861
13869
  * const dialog = page.getByText('Confirm security settings');
13862
- * await expect(newEmail.or(dialog)).toBeVisible();
13870
+ * await expect(newEmail.or(dialog).first()).toBeVisible();
13863
13871
  * if (await dialog.isVisible())
13864
13872
  * await page.getByRole('button', { name: 'Dismiss' }).click();
13865
13873
  * await newEmail.click();
@@ -14558,6 +14566,11 @@ export interface BrowserType<Unused = {}> {
14558
14566
  *
14559
14567
  * **NOTE** Connecting over the Chrome DevTools Protocol is only supported for Chromium-based browsers.
14560
14568
  *
14569
+ * **NOTE** This connection is significantly lower fidelity than the Playwright protocol connection via
14570
+ * [browserType.connect(wsEndpoint[, options])](https://playwright.dev/docs/api/class-browsertype#browser-type-connect).
14571
+ * If you are experiencing issues or attempting to use advanced functionality, you probably want to use
14572
+ * [browserType.connect(wsEndpoint[, options])](https://playwright.dev/docs/api/class-browsertype#browser-type-connect).
14573
+ *
14561
14574
  * **Usage**
14562
14575
  *
14563
14576
  * ```js
@@ -14583,6 +14596,11 @@ export interface BrowserType<Unused = {}> {
14583
14596
  *
14584
14597
  * **NOTE** Connecting over the Chrome DevTools Protocol is only supported for Chromium-based browsers.
14585
14598
  *
14599
+ * **NOTE** This connection is significantly lower fidelity than the Playwright protocol connection via
14600
+ * [browserType.connect(wsEndpoint[, options])](https://playwright.dev/docs/api/class-browsertype#browser-type-connect).
14601
+ * If you are experiencing issues or attempting to use advanced functionality, you probably want to use
14602
+ * [browserType.connect(wsEndpoint[, options])](https://playwright.dev/docs/api/class-browsertype#browser-type-connect).
14603
+ *
14586
14604
  * **Usage**
14587
14605
  *
14588
14606
  * ```js
@@ -14597,10 +14615,14 @@ export interface BrowserType<Unused = {}> {
14597
14615
  */
14598
14616
  connectOverCDP(options: ConnectOverCDPOptions & { wsEndpoint?: string }): Promise<Browser>;
14599
14617
  /**
14600
- * This method attaches Playwright to an existing browser instance. When connecting to another browser launched via
14601
- * `BrowserType.launchServer` in Node.js, the major and minor version needs to match the client version (1.2.3 → is
14602
- * compatible with 1.2.x).
14603
- * @param wsEndpoint A browser websocket endpoint to connect to.
14618
+ * This method attaches Playwright to an existing browser instance created via
14619
+ * [browserType.launchServer([options])](https://playwright.dev/docs/api/class-browsertype#browser-type-launch-server).
14620
+ *
14621
+ * **NOTE** The major and minor version of the Playwright instance that connects needs to match the version of
14622
+ * Playwright that launches the browser (1.2.3 → is compatible with 1.2.x).
14623
+ *
14624
+ * @param wsEndpoint A Playwright browser websocket endpoint to connect to. You obtain this endpoint via
14625
+ * [browserServer.wsEndpoint()](https://playwright.dev/docs/api/class-browserserver#browser-server-ws-endpoint).
14604
14626
  * @param options
14605
14627
  */
14606
14628
  connect(wsEndpoint: string, options?: ConnectOptions): Promise<Browser>;
@@ -14611,10 +14633,14 @@ export interface BrowserType<Unused = {}> {
14611
14633
  * @deprecated
14612
14634
  */
14613
14635
  /**
14614
- * This method attaches Playwright to an existing browser instance. When connecting to another browser launched via
14615
- * `BrowserType.launchServer` in Node.js, the major and minor version needs to match the client version (1.2.3 → is
14616
- * compatible with 1.2.x).
14617
- * @param wsEndpoint A browser websocket endpoint to connect to.
14636
+ * This method attaches Playwright to an existing browser instance created via
14637
+ * [browserType.launchServer([options])](https://playwright.dev/docs/api/class-browsertype#browser-type-launch-server).
14638
+ *
14639
+ * **NOTE** The major and minor version of the Playwright instance that connects needs to match the version of
14640
+ * Playwright that launches the browser (1.2.3 → is compatible with 1.2.x).
14641
+ *
14642
+ * @param wsEndpoint A Playwright browser websocket endpoint to connect to. You obtain this endpoint via
14643
+ * [browserServer.wsEndpoint()](https://playwright.dev/docs/api/class-browserserver#browser-server-ws-endpoint).
14618
14644
  * @param options
14619
14645
  */
14620
14646
  connect(options: ConnectOptions & { wsEndpoint?: string }): Promise<Browser>;
@@ -14711,7 +14737,7 @@ export interface BrowserType<Unused = {}> {
14711
14737
  /**
14712
14738
  * Browser distribution channel.
14713
14739
  *
14714
- * Use "chromium" to [opt in to new headless mode](https://playwright.dev/docs/browsers#opt-in-to-new-headless-mode).
14740
+ * Use "chromium" to [opt in to new headless mode](https://playwright.dev/docs/browsers#chromium-new-headless-mode).
14715
14741
  *
14716
14742
  * Use "chrome", "chrome-beta", "chrome-dev", "chrome-canary", "msedge", "msedge-beta", "msedge-dev", or
14717
14743
  * "msedge-canary" to use branded [Google Chrome and Microsoft Edge](https://playwright.dev/docs/browsers#google-chrome--microsoft-edge).
@@ -15210,7 +15236,7 @@ export interface BrowserType<Unused = {}> {
15210
15236
  /**
15211
15237
  * Browser distribution channel.
15212
15238
  *
15213
- * Use "chromium" to [opt in to new headless mode](https://playwright.dev/docs/browsers#opt-in-to-new-headless-mode).
15239
+ * Use "chromium" to [opt in to new headless mode](https://playwright.dev/docs/browsers#chromium-new-headless-mode).
15214
15240
  *
15215
15241
  * Use "chrome", "chrome-beta", "chrome-dev", "chrome-canary", "msedge", "msedge-beta", "msedge-dev", or
15216
15242
  * "msedge-canary" to use branded [Google Chrome and Microsoft Edge](https://playwright.dev/docs/browsers#google-chrome--microsoft-edge).
@@ -16599,11 +16625,6 @@ export interface AndroidDevice {
16599
16625
  */
16600
16626
  colorScheme?: null|"light"|"dark"|"no-preference";
16601
16627
 
16602
- /**
16603
- * Optional package name to launch instead of default Chrome for Android.
16604
- */
16605
- command?: string;
16606
-
16607
16628
  /**
16608
16629
  * Specify device scale factor (can be thought of as dpr). Defaults to `1`. Learn more about
16609
16630
  * [emulating devices with device scale factor](https://playwright.dev/docs/emulation#devices).
@@ -16712,6 +16733,11 @@ export interface AndroidDevice {
16712
16733
  */
16713
16734
  permissions?: Array<string>;
16714
16735
 
16736
+ /**
16737
+ * Optional package name to launch instead of default Chrome for Android.
16738
+ */
16739
+ pkg?: string;
16740
+
16715
16741
  /**
16716
16742
  * Network proxy settings.
16717
16743
  */
@@ -18586,6 +18612,19 @@ export interface Clock {
18586
18612
  * await page.clock.pauseAt('2020-02-02');
18587
18613
  * ```
18588
18614
  *
18615
+ * For best results, install the clock before navigating the page and set it to a time slightly before the intended
18616
+ * test time. This ensures that all timers run normally during page loading, preventing the page from getting stuck.
18617
+ * Once the page has fully loaded, you can safely use
18618
+ * [clock.pauseAt(time)](https://playwright.dev/docs/api/class-clock#clock-pause-at) to pause the clock.
18619
+ *
18620
+ * ```js
18621
+ * // Initialize clock with some time before the test time and let the page load
18622
+ * // naturally. `Date.now` will progress as the timers fire.
18623
+ * await page.clock.install({ time: new Date('2024-12-10T08:00:00') });
18624
+ * await page.goto('http://localhost:3333');
18625
+ * await page.clock.pauseAt(new Date('2024-12-10T10:00:00'));
18626
+ * ```
18627
+ *
18589
18628
  * @param time Time to pause at.
18590
18629
  */
18591
18630
  pauseAt(time: number|string|Date): Promise<void>;
@@ -21548,7 +21587,7 @@ export interface LaunchOptions {
21548
21587
  /**
21549
21588
  * Browser distribution channel.
21550
21589
  *
21551
- * Use "chromium" to [opt in to new headless mode](https://playwright.dev/docs/browsers#opt-in-to-new-headless-mode).
21590
+ * Use "chromium" to [opt in to new headless mode](https://playwright.dev/docs/browsers#chromium-new-headless-mode).
21552
21591
  *
21553
21592
  * Use "chrome", "chrome-beta", "chrome-dev", "chrome-canary", "msedge", "msedge-beta", "msedge-dev", or
21554
21593
  * "msedge-canary" to use branded [Google Chrome and Microsoft Edge](https://playwright.dev/docs/browsers#google-chrome--microsoft-edge).
package/bin/PrintDeps.exe DELETED
Binary file
package/bin/README.md DELETED
@@ -1,2 +0,0 @@
1
- See building instructions at [`/browser_patches/winldd/README.md`](../../../browser_patches/winldd/README.md)
2
-
@@ -1,33 +0,0 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- exports.parseAriaSnapshot = parseAriaSnapshot;
7
- exports.parseYamlForAriaSnapshot = parseYamlForAriaSnapshot;
8
- var _ariaSnapshot = require("../utils/isomorphic/ariaSnapshot");
9
- var _utilsBundle = require("../utilsBundle");
10
- /**
11
- * Copyright (c) Microsoft Corporation.
12
- *
13
- * Licensed under the Apache License, Version 2.0 (the "License");
14
- * you may not use this file except in compliance with the License.
15
- * You may obtain a copy of the License at
16
- *
17
- * http://www.apache.org/licenses/LICENSE-2.0
18
- *
19
- * Unless required by applicable law or agreed to in writing, software
20
- * distributed under the License is distributed on an "AS IS" BASIS,
21
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
22
- * See the License for the specific language governing permissions and
23
- * limitations under the License.
24
- */
25
-
26
- function parseAriaSnapshot(text) {
27
- return (0, _ariaSnapshot.parseYamlTemplate)(parseYamlForAriaSnapshot(text));
28
- }
29
- function parseYamlForAriaSnapshot(text) {
30
- const parsed = _utilsBundle.yaml.parse(text);
31
- if (!Array.isArray(parsed)) throw new Error('Expected object key starting with "- ":\n\n' + text + '\n');
32
- return parsed;
33
- }
@@ -1,144 +0,0 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- exports.RecorderInTraceViewer = void 0;
7
- var _path = _interopRequireDefault(require("path"));
8
- var _events = require("events");
9
- var _traceViewer = require("../trace/viewer/traceViewer");
10
- var _manualPromise = require("../../utils/manualPromise");
11
- function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
12
- /**
13
- * Copyright (c) Microsoft Corporation.
14
- *
15
- * Licensed under the Apache License, Version 2.0 (the "License");
16
- * you may not use this file except in compliance with the License.
17
- * You may obtain a copy of the License at
18
- *
19
- * http://www.apache.org/licenses/LICENSE-2.0
20
- *
21
- * Unless required by applicable law or agreed to in writing, software
22
- * distributed under the License is distributed on an "AS IS" BASIS,
23
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
24
- * See the License for the specific language governing permissions and
25
- * limitations under the License.
26
- */
27
-
28
- class RecorderInTraceViewer extends _events.EventEmitter {
29
- static factory(context) {
30
- return async recorder => {
31
- const transport = new RecorderTransport();
32
- const trace = _path.default.join(context._browser.options.tracesDir, 'trace');
33
- const {
34
- wsEndpointForTest,
35
- tracePage,
36
- traceServer
37
- } = await openApp(trace, {
38
- transport,
39
- headless: !context._browser.options.headful
40
- });
41
- return new RecorderInTraceViewer(transport, tracePage, traceServer, wsEndpointForTest);
42
- };
43
- }
44
- constructor(transport, tracePage, traceServer, wsEndpointForTest) {
45
- super();
46
- this.wsEndpointForTest = void 0;
47
- this._transport = void 0;
48
- this._tracePage = void 0;
49
- this._traceServer = void 0;
50
- this._transport = transport;
51
- this._transport.eventSink.resolve(this);
52
- this._tracePage = tracePage;
53
- this._traceServer = traceServer;
54
- this.wsEndpointForTest = wsEndpointForTest;
55
- this._tracePage.once('close', () => {
56
- this.close();
57
- });
58
- }
59
- async close() {
60
- await this._tracePage.context().close({
61
- reason: 'Recorder window closed'
62
- });
63
- await this._traceServer.stop();
64
- }
65
- async setPaused(paused) {
66
- this._transport.deliverEvent('setPaused', {
67
- paused
68
- });
69
- }
70
- async setMode(mode) {
71
- this._transport.deliverEvent('setMode', {
72
- mode
73
- });
74
- }
75
- async setRunningFile(file) {
76
- this._transport.deliverEvent('setRunningFile', {
77
- file
78
- });
79
- }
80
- async elementPicked(elementInfo, userGesture) {
81
- this._transport.deliverEvent('elementPicked', {
82
- elementInfo,
83
- userGesture
84
- });
85
- }
86
- async updateCallLogs(callLogs) {
87
- this._transport.deliverEvent('updateCallLogs', {
88
- callLogs
89
- });
90
- }
91
- async setSources(sources) {
92
- this._transport.deliverEvent('setSources', {
93
- sources
94
- });
95
- if (process.env.PWTEST_CLI_IS_UNDER_TEST && sources.length) {
96
- if (process._didSetSourcesForTest(sources[0].text)) this.close();
97
- }
98
- }
99
- async setActions(actions, sources) {
100
- this._transport.deliverEvent('setActions', {
101
- actions,
102
- sources
103
- });
104
- }
105
- }
106
- exports.RecorderInTraceViewer = RecorderInTraceViewer;
107
- async function openApp(trace, options) {
108
- const traceServer = await (0, _traceViewer.startTraceViewerServer)(options);
109
- await (0, _traceViewer.installRootRedirect)(traceServer, [trace], {
110
- ...options,
111
- webApp: 'recorder.html'
112
- });
113
- const page = await (0, _traceViewer.openTraceViewerApp)(traceServer.urlPrefix('precise'), 'chromium', options);
114
- return {
115
- wsEndpointForTest: page.context()._browser.options.wsEndpoint,
116
- tracePage: page,
117
- traceServer
118
- };
119
- }
120
- class RecorderTransport {
121
- constructor() {
122
- this._connected = new _manualPromise.ManualPromise();
123
- this.eventSink = new _manualPromise.ManualPromise();
124
- this.sendEvent = void 0;
125
- this.close = void 0;
126
- }
127
- onconnect() {
128
- this._connected.resolve();
129
- }
130
- async dispatch(method, params) {
131
- const eventSink = await this.eventSink;
132
- eventSink.emit('event', {
133
- event: method,
134
- params
135
- });
136
- }
137
- onclose() {}
138
- deliverEvent(method, params) {
139
- this._connected.then(() => {
140
- var _this$sendEvent;
141
- return (_this$sendEvent = this.sendEvent) === null || _this$sendEvent === void 0 ? void 0 : _this$sendEvent.call(this, method, params);
142
- });
143
- }
144
- }
@@ -1,227 +0,0 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- exports.buildFullSelector = buildFullSelector;
7
- exports.toKeyboardModifiers = toKeyboardModifiers;
8
- exports.traceParamsForAction = traceParamsForAction;
9
- /**
10
- * Copyright (c) Microsoft Corporation.
11
- *
12
- * Licensed under the Apache License, Version 2.0 (the "License");
13
- * you may not use this file except in compliance with the License.
14
- * You may obtain a copy of the License at
15
- *
16
- * http://www.apache.org/licenses/LICENSE-2.0
17
- *
18
- * Unless required by applicable law or agreed to in writing, software
19
- * distributed under the License is distributed on an "AS IS" BASIS,
20
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
21
- * See the License for the specific language governing permissions and
22
- * limitations under the License.
23
- */
24
-
25
- function buildFullSelector(framePath, selector) {
26
- return [...framePath, selector].join(' >> internal:control=enter-frame >> ');
27
- }
28
- const kDefaultTimeout = 5_000;
29
- function traceParamsForAction(actionInContext) {
30
- const {
31
- action
32
- } = actionInContext;
33
- switch (action.name) {
34
- case 'navigate':
35
- {
36
- const params = {
37
- url: action.url
38
- };
39
- return {
40
- method: 'goto',
41
- apiName: 'page.goto',
42
- params
43
- };
44
- }
45
- case 'openPage':
46
- case 'closePage':
47
- throw new Error('Not reached');
48
- }
49
- const selector = buildFullSelector(actionInContext.frame.framePath, action.selector);
50
- switch (action.name) {
51
- case 'click':
52
- {
53
- const params = {
54
- selector,
55
- strict: true,
56
- modifiers: toKeyboardModifiers(action.modifiers),
57
- button: action.button,
58
- clickCount: action.clickCount,
59
- position: action.position
60
- };
61
- return {
62
- method: 'click',
63
- apiName: 'locator.click',
64
- params
65
- };
66
- }
67
- case 'press':
68
- {
69
- const params = {
70
- selector,
71
- strict: true,
72
- key: [...toKeyboardModifiers(action.modifiers), action.key].join('+')
73
- };
74
- return {
75
- method: 'press',
76
- apiName: 'locator.press',
77
- params
78
- };
79
- }
80
- case 'fill':
81
- {
82
- const params = {
83
- selector,
84
- strict: true,
85
- value: action.text
86
- };
87
- return {
88
- method: 'fill',
89
- apiName: 'locator.fill',
90
- params
91
- };
92
- }
93
- case 'setInputFiles':
94
- {
95
- const params = {
96
- selector,
97
- strict: true,
98
- localPaths: action.files
99
- };
100
- return {
101
- method: 'setInputFiles',
102
- apiName: 'locator.setInputFiles',
103
- params
104
- };
105
- }
106
- case 'check':
107
- {
108
- const params = {
109
- selector,
110
- strict: true
111
- };
112
- return {
113
- method: 'check',
114
- apiName: 'locator.check',
115
- params
116
- };
117
- }
118
- case 'uncheck':
119
- {
120
- const params = {
121
- selector,
122
- strict: true
123
- };
124
- return {
125
- method: 'uncheck',
126
- apiName: 'locator.uncheck',
127
- params
128
- };
129
- }
130
- case 'select':
131
- {
132
- const params = {
133
- selector,
134
- strict: true,
135
- options: action.options.map(option => ({
136
- value: option
137
- }))
138
- };
139
- return {
140
- method: 'selectOption',
141
- apiName: 'locator.selectOption',
142
- params
143
- };
144
- }
145
- case 'assertChecked':
146
- {
147
- const params = {
148
- selector: action.selector,
149
- expression: 'to.be.checked',
150
- isNot: !action.checked,
151
- timeout: kDefaultTimeout
152
- };
153
- return {
154
- method: 'expect',
155
- apiName: 'expect.toBeChecked',
156
- params
157
- };
158
- }
159
- case 'assertText':
160
- {
161
- const params = {
162
- selector,
163
- expression: 'to.have.text',
164
- expectedText: [],
165
- isNot: false,
166
- timeout: kDefaultTimeout
167
- };
168
- return {
169
- method: 'expect',
170
- apiName: 'expect.toContainText',
171
- params
172
- };
173
- }
174
- case 'assertValue':
175
- {
176
- const params = {
177
- selector,
178
- expression: 'to.have.value',
179
- expectedValue: undefined,
180
- isNot: false,
181
- timeout: kDefaultTimeout
182
- };
183
- return {
184
- method: 'expect',
185
- apiName: 'expect.toHaveValue',
186
- params
187
- };
188
- }
189
- case 'assertVisible':
190
- {
191
- const params = {
192
- selector,
193
- expression: 'to.be.visible',
194
- isNot: false,
195
- timeout: kDefaultTimeout
196
- };
197
- return {
198
- method: 'expect',
199
- apiName: 'expect.toBeVisible',
200
- params
201
- };
202
- }
203
- case 'assertSnapshot':
204
- {
205
- const params = {
206
- selector,
207
- expression: 'to.match.snapshot',
208
- expectedText: [],
209
- isNot: false,
210
- timeout: kDefaultTimeout
211
- };
212
- return {
213
- method: 'expect',
214
- apiName: 'expect.toMatchAriaSnapshot',
215
- params
216
- };
217
- }
218
- }
219
- }
220
- function toKeyboardModifiers(modifiers) {
221
- const result = [];
222
- if (modifiers & 1) result.push('Alt');
223
- if (modifiers & 2) result.push('ControlOrMeta');
224
- if (modifiers & 4) result.push('ControlOrMeta');
225
- if (modifiers & 8) result.push('Shift');
226
- return result;
227
- }