Closed toadornode closed 3 years ago
Nevermind, I was able to get it working with this code example Running lighthouse on authenticated routes with the test runner
https://npm.io/package/playwright-lighthouse
Thank you so much for this code example. This is awesome :)
I'm currently using the route.fulfill function from playwright to mock the response to our API in our UI application. In the same test case where I call route.fulfill, I call playAudit function.
When the first page.goto() loads, it loads the page correctly with the mocked response. But when playAudit spawns a new browser to run the lighthouse metrics, it completely forgets about the route.fulfill.
I've tried using the persistent context function but we're not storing anything in local storage so I don't think that will work here...
Is there any way to mock api calls when using playAudit?