Skip to content

Commit 58775b5

Browse files
committed
Disable chrome autofill requests in cypress
Using this in package.json to run cypress with full debug: ```diff - "cypress:run:chrome": "cypress run --headless --browser chrome", + "cypress:run:chrome": "DEBUG='cypress:*' cypress run --headless --browser chrome", ``` I found that we run 445 autofill requests during our suite. Of the non-localhost, here's the list: ``` % grep "cypress:network:agent addRequest" cypress-debug.log | grep -v localhost | grep -oE "https*://.+\com" | sort | uniq -c | sort -rn 445 https://content-autofill.googleapis.com 46 https://optimizationguide-pa.googleapis.com 18 https://passwordsleakcheck-pa.googleapis.com 1 https://safebrowsingohttpgateway.googleapis.com 1 https://safebrowsing.googleapis.com 1 https://clientservices.googleapis.com 1 https://accounts.google.com 1 http://clients2.google.com ``` These requests look something like: ``` cypress:network:agent addRequest called { isHttps: true, href: 'https://content-autofill.googleapis.com/v1/pages/STRING=?alt=proto' } +2s ``` With this change: ``` % grep "cypress:network:agent addRequest" cypress-debug2.log | grep -v localhost | grep -oE "https*://.+\com" | sort | uniq -c | sort -rn 29 https://optimizationguide-pa.googleapis.com 21 https://passwordsleakcheck-pa.googleapis.com 1 https://safebrowsingohttpgateway.googleapis.com 1 https://safebrowsing.googleapis.com 1 https://clientservices.googleapis.com 1 https://accounts.google.com 1 http://clients2.google.com ```
1 parent d9ead32 commit 58775b5

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

cypress.config.js

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,15 @@ module.exports = defineConfig({
3535
}
3636
}
3737
});
38+
on('before:browser:launch', (browser = {}, launchOptions) => {
39+
console.log('Launching browser:', browser.name);
40+
console.log('Input args:', launchOptions.args);
41+
if (browser.name === 'chrome') {
42+
launchOptions.args.push('--disable-features=AutofillServerCommunication');
43+
}
44+
console.log('Actual args:', launchOptions.args);
45+
return launchOptions;
46+
});
3847
},
3948
},
4049
});

0 commit comments

Comments
 (0)