ohos-playwright 0.2.9 → 0.2.10

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 CHANGED
@@ -43,6 +43,12 @@ The following Playwright APIs have been validated on ArkWeb / HarmonyOS 6.1 (Chr
43
43
  | Device emulation | `emulateDevice` fixture (see below) |
44
44
  | Input | `locator.fill()`, `locator.type()`, `keyboard.press()` |
45
45
  | Cookies | `context.addCookies()`, `context.cookies()`, `context.clearCookies()` |
46
+ | Dialog | `page.on('dialog')`, `dialog.accept()`, `dialog.dismiss()`, `dialog.message()`, `dialog.type()` |
47
+ | Popup | `context.waitForEvent('page')` + `window.open()` — stub Page with `url()`, `waitForLoadState()`, `close()` |
48
+ | Page events | `page.on('pageerror')`, `page.on('console')`, `page.on('download')` |
49
+ | Frames | `page.frames()`, `page.mainFrame()`, `frame.url()` |
50
+ | Viewport | `page.viewportSize()` (pre-fetched via `Page.getLayoutMetrics` for reused CDP tabs) |
51
+ | Media emulation | `page.emulateMedia({ colorScheme })` |
46
52
 
47
53
  ### `emulateDevice` fixture
48
54
 
package/dist/fixture.mjs CHANGED
@@ -12,9 +12,17 @@ export const test = base.extend({
12
12
  },
13
13
  { scope: 'worker' },
14
14
  ],
15
- context: async ({ browser }, use) => {
16
- // baseURL 通过 page fixture 重写 page.goto 实现;不再触碰 BrowserContext 私有字段 _options。
17
- await use(browser.contexts()[0]);
15
+ context: async ({ browser }, use, testInfo) => {
16
+ const ctx = browser.contexts()[0];
17
+ // Inject baseURL into the context's private _options so that internal
18
+ // Playwright URL resolution (toHaveURL, waitForURL, locators) works for
19
+ // SPA-navigated pages — page.goto patching alone is not sufficient.
20
+ const baseURL = testInfo.project.use.baseURL;
21
+ if (baseURL) {
22
+ ;
23
+ ctx._options.baseURL = baseURL;
24
+ }
25
+ await use(ctx);
18
26
  },
19
27
  page: async ({ context }, use, testInfo) => {
20
28
  const pages = context.pages();
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ohos-playwright",
3
- "version": "0.2.9",
3
+ "version": "0.2.10",
4
4
  "description": "Playwright adapter for OpenHarmony / ArkWeb via hdc + CDP",
5
5
  "license": "MIT",
6
6
  "author": "social4hyq",