abhinaba-ghosh / playwright-lighthouse

:performing_arts:: Playwright Lighthouse Audit
https://www.npmjs.com/package/playwright-lighthouse
MIT License
240 stars 28 forks source link

[question]: launch 2 browsers? #55

Closed stevez closed 9 months ago

stevez commented 1 year ago

I just tried the latest version of this library, what I found is it launched 2 browsers: 1 is launched by playwright, the other seems launched by the lighthouse, I wonder if it is the expected behaviour or not?

abhinaba-ghosh commented 9 months ago

Duplicate of https://github.com/abhinaba-ghosh/playwright-lighthouse/issues/56

alphonse92 commented 1 month ago

No, this is not a duplication of #56 in facto after calling playAudit it runs an extra browser because we are not passing any puppeteer page to "lighthouselib" :

https://github.com/abhinaba-ghosh/playwright-lighthouse/blob/master/src/task.js#L85

Pupetter receives 4 parameters as you can see here:

https://github.com/GoogleChrome/lighthouse/blob/main/core/index.js#L39

The last parameter accepts a puppeteer page instance. If it is not received it will try to connect to the playwright browser instance and open a new page:

https://github.com/GoogleChrome/lighthouse/blob/main/core/gather/navigation-runner.js#L281

That will cause a second browser to be open. The problem is that won't share any session data with Plawright. We have a lack of flexibility when we use this library