Press n or j to go to the next uncovered block, b, p or k for the previous block.
| 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 | 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 26x 26x 156x 156x 26x 1x 1x 1x 1x 1x | /**
* Utility to block ad network requests and tracking scripts that can cause
* test flakiness or layout shifts on automationexercise.com.
*/
const AD_URL_PATTERNS = [
'**/*doubleclick.net/**',
'**/*googleadservices.com/**',
'**/*googlesyndication.com/**',
'**/*google-analytics.com/**',
'**/*adservice.google.*/**',
'**/*pagead2.googlesyndication.com/**',
];
/**
* Attaches route blocking for ad domains to a Playwright page.
* @param {import('@playwright/test').Page} page
*/
async function setupAdBlocker(page) {
for (const pattern of AD_URL_PATTERNS) {
await page.route(pattern, (route) => route.abort());
}
}
module.exports = {
setupAdBlocker,
AD_URL_PATTERNS,
};
|