Skip to content

Commit 59734eb

Browse files
Re-apply Playwright upgrade (#550)
* Reapply "Bump playwright from 1.52.0 to 1.55.1 (#538)" This reverts commit dac11cd. * PackageToJS: Fix missing await for `page.exposeFunction` It caused concurrent calls to `exposeFunction` and resulted losing the function bindings after the playwright upgrade.
1 parent dac11cd commit 59734eb

File tree

4 files changed

+18
-11
lines changed

4 files changed

+18
-11
lines changed

Plugins/PackageToJS/Templates/bin/test.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -116,7 +116,7 @@ Hint: This typically means that a continuation leak occurred.
116116
for (const [name, fn] of Object.entries(functions)) {
117117
// Bind the page context to each function if needed
118118
// The function can optionally use the page from its closure
119-
page.exposeFunction(name, fn);
119+
await page.exposeFunction(name, fn);
120120
}
121121
};
122122
}

Plugins/PackageToJS/Templates/test.js

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -108,10 +108,12 @@ Please run the following command to install it:
108108
page.on("console", (message) => {
109109
console.log(message.text());
110110
});
111-
111+
112+
let resolveExit = undefined;
112113
const onExit = new Promise((resolve) => {
113-
page.exposeFunction("exitTest", resolve);
114+
resolveExit = resolve;
114115
});
116+
await page.exposeFunction("exitTest", resolveExit);
115117
await page.goto(`http://localhost:${address.port}/test.browser.html`);
116118
const exitCode = await onExit;
117119
await browser.close();

package-lock.json

Lines changed: 12 additions & 8 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,7 @@
4141
"prettier": "3.5.3",
4242
"rollup": "^4.37.0",
4343
"rollup-plugin-dts": "^6.2.1",
44+
"tslib": "^2.8.1",
4445
"typescript": "^5.8.2"
4546
}
4647
}

0 commit comments

Comments
 (0)