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.
- package/dist/fixture.mjs +10 -4
- 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
|
-
//
|
|
146
|
-
// page.close() sends Target.closeTarget
|
|
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.
|
|
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) => {
|