ohos-playwright 0.3.0 → 0.3.2

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 (2) hide show
  1. package/dist/fixture.mjs +10 -4
  2. package/package.json +1 -1
package/dist/fixture.mjs CHANGED
@@ -56,7 +56,9 @@ export const test = base.extend({
56
56
  ? ([...pages].reverse().find((p) => p.url() === (info.launchUrl ?? 'about:blank')) ?? pages[pages.length - 1])
57
57
  : (pages.find((p) => p.url().startsWith('http://localhost')) ?? pages[0]);
58
58
  const ctxEmit = context.emit.bind(context);
59
- // Patch baseURL
59
+ // Patch baseURL — save and restore to prevent wrapper accumulation across
60
+ // tests that share the same page object.
61
+ const savedGoto = page['goto'];
60
62
  const baseURL = testInfo.project.use.baseURL;
61
63
  if (baseURL) {
62
64
  const root = baseURL.replace(/\/+$/, '');
@@ -142,14 +144,18 @@ export const test = base.extend({
142
144
  finally {
143
145
  clearInterval(popupPoller);
144
146
  page.evaluate = savedEvaluate;
145
- // Close the tab we opened so the user's browser is left clean.
146
- // page.close() sends Target.closeTarget via CDP; non-fatal if it fails.
147
+ // Reset the test tab to about:blank so it's clean for the next test.
148
+ // page.close() sends Target.closeTarget which terminates the ArkWeb
149
+ // DevTools socket — use goto instead to keep the connection alive.
147
150
  if (info.openedNewTab) {
148
151
  try {
149
- await page.close();
152
+ await page.goto('about:blank');
150
153
  }
151
154
  catch { }
152
155
  }
156
+ // Restore goto to prevent wrapper accumulation across tests.
157
+ ;
158
+ page.goto = savedGoto;
153
159
  }
154
160
  },
155
161
  emulateDevice: async ({ page }, use) => {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ohos-playwright",
3
- "version": "0.3.0",
3
+ "version": "0.3.2",
4
4
  "description": "Playwright adapter for OpenHarmony / ArkWeb via hdc + CDP",
5
5
  "license": "MIT",
6
6
  "author": "social4hyq",