Open NoamGaash opened 5 months ago
Does it only mean to add this line
await page.route('**/*google-analytics*', route => route.abort());
to every test file under "beforeEach"?
I'd like to assign myself if so.
@YaelChen I think there are some domains that we would like to block, while avoid blocking unrelated urls Using the Chrome DevTool can help determine which URLs should be blocked: And the test you've added that clicks this link is expected to pass despite of this change:
Thank you! :pray:
I see the logic 😅 Thanks! I'll need to investigate some more for this, So I'm not assigning yet so that someone else will be able to take it :)
Does it only mean to add this line
await page.route('**/*google-analytics*', route => route.abort());
to every test file under "beforeEach"?I'd like to assign myself if so.
@YaelChen Hello, I had the same idea! However, when I open local host, it looks like the requests are still being sent. They return 204 No Content, regardless of whether I put in the await page.route('**/*google-analytics*', route => route.abort());
.
I also tried creating a global-setup for playwright, but same thing. I am somewhat baffled. If you make any progress I'd be very excited to see :)
I believe that the command await page.route('**/*google-analytics*', route => route.abort());
use a wrong pattern.
something like:
page.route(/google-analytics\.com|googletagmanager\.com/, route => route.abort());
or
page.route(/^https?:\/\/(google-analytics|googletagmanager).com/, route => route.abort());
would probably do the trick
When running playwright test, let's use page.route to abort all requests to google analytics