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 +6 -0
- package/dist/fixture.mjs +11 -3
- package/package.json +1 -1
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
|
-
|
|
17
|
-
|
|
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();
|