-
Notifications
You must be signed in to change notification settings - Fork 3.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[REGRESSION]: page.evaluate with a string no longer works unless wrapped in an IIFE #10819
Comments
What other info can I provide? |
@trusktr I can repro this. I guess something has changed, but I am not sure we are going to fix this. I'd suggest to wrap your code in the IIFE, to have a scope to declare variables. Sorry for the inconvenience. const functionResult = await page.evaluate(`(() => {
${add.toString()}
var result = add(1, 2, 3);
return Promise.resolve(result);
})()`); |
trusktr
changed the title
[REGRESSION]:
[REGRESSION]: page.evaluate with a string no longer works unless wrapped in an IIFE
Jan 22, 2022
trusktr
added a commit
to docsifyjs/docsify
that referenced
this issue
Jan 23, 2022
Playwright had some in-range breaking changes (regressions): microsoft/playwright#10819 and microsoft/playwright#11570 Playwright tests need to `await onceRendered()` after each route navigation to wait for render to finish before testing the state of the rendered DOM. Tests were flaky because they were looking for DOM before render finished (sometimes). Additionally, this fixes one test that was failing only locally, but not in CI, due to a RegExp check against page.url() (not sure why it would differ on CI vs local, but now the URL is explicit).
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Context:
Code Snippet
Describe the bug
I get the error:
I am trying to migrate from an older
jest-playwright-preset
setup to@playwright/test
, in the process updating playwright. This code worked before.The text was updated successfully, but these errors were encountered: