GoogleChrome / web-vitals

Essential metrics for a healthy site.
https://web.dev/vitals
Apache License 2.0
7.59k stars 415 forks source link

Playwright : document is not defined #334

Closed MehseinJohan closed 1 year ago

MehseinJohan commented 1 year ago

Hello team,

I've installed the framework in my playwright regression. Though, when trying to play my script :

test('screenshot_testing', async ({ cWelcomePage, page, webActions, baseURL, browserName }) => { //Display Home page await WelcomePage.isPageSuccessfullyDisplayed() onCLS(console.log);

I get rejected with -> "ReferenceError: document is not defined".

Could you please help me ?

Thank you,

Regards,

Johan

tunetheweb commented 1 year ago

onCLS needs to be executed as a JavaScript API.

I don't think this is an issue with this library, but more how you are using playwright. Found this form a quick Google: https://github.com/microsoft/playwright/issues/15006