big-judge-93427
10/13/2022, 7:06 PMbig-judge-93427
10/13/2022, 7:06 PMit
description using the given/when/then methods in my examplebig-judge-93427
10/13/2022, 7:07 PMstale-optician-85950
10/13/2022, 7:09 PMbig-judge-93427
10/13/2022, 7:10 PMbig-judge-93427
10/13/2022, 7:10 PMmillions-electrician-95804
10/13/2022, 8:05 PMlimited-barista-33480
10/13/2022, 10:05 PMadamant-mouse-7124
10/14/2022, 8:32 AMstale-optician-85950
10/14/2022, 12:09 PMsetupNodeEvents(on, config) {
on('before:browser:launch', (browser = {}, launchOptions) => {
// your code
chilly-mechanic-84880
10/14/2022, 12:51 PMchilly-mechanic-84880
10/14/2022, 12:51 PMstrong-application-30670
10/14/2022, 1:37 PMjs
// perhaps look into default cookies
Cypress.Cookies.default({
foo: 'bar'
})
// or you can add cookies yourself
cy.setCookie('foo', 'bar')
// and remove afterwards
cy.clearCookie('foo')
limited-barista-33480
10/14/2022, 1:55 PMstale-optician-85950
10/14/2022, 2:04 PMlimited-barista-33480
10/14/2022, 2:14 PMstale-optician-85950
10/14/2022, 2:17 PMlimited-barista-33480
10/14/2022, 2:32 PMstale-optician-85950
10/14/2022, 2:38 PMkind-artist-92362
10/14/2022, 5:00 PMkind-artist-92362
10/14/2022, 5:08 PMkind-artist-92362
10/14/2022, 5:24 PMkind-artist-92362
10/14/2022, 5:24 PMkind-artist-92362
10/14/2022, 5:25 PMlimited-barista-33480
10/14/2022, 5:49 PMstale-optician-85950
10/14/2022, 7:43 PMcypress.config.ts
or .js
(whichever your use), similar to the docs https://docs.cypress.io/api/plugins/browser-launch-api and launch Cypress open
:
setupNodeEvents: async (on, config) => {
on(
'before:browser:launch',
(
browser,
launchOptions
) => {
// `args` is an array of all the arguments that will be passed to browsers when it launches
if (browser.family === 'chromium' && browser.name !== 'electron') {
launchOptions.args.push('--auto-open-devtools-for-tabs', '--disable-application-cache');
consola.info('Chromium flags set count:', launchOptions.args.length);
consola.info('Chromium flags set list:', launchOptions.args);
}
return launchOptions;
}
);
See that I'm logging (in my terminal) the number of arguments with .length
and then all the arguments set list. There are 50 in total, 48 were by default and I added 2 more (so the Cypress team set 48 arguments to configure it how they want it by default, you can undo this). Also, you can do this trick https://docs.cypress.io/api/plugins/browser-launch-api#See-all-Chrome-browser-switches to see the list within the Chrome browser itself.
Also, you'll see that Dev Tools is now open by default (as I like it)!
Now once you see the list, you can think about which arguments relate to what you need enabled / disabled, you obviously need to Google around on this part. Play around with it until you get Cypress Chrome browser exactly as you need it. Then happy days πlimited-barista-33480
10/14/2022, 8:25 PMrefined-raincoat-56329
10/14/2022, 9:53 PMrefined-raincoat-56329
10/14/2022, 9:54 PMrefined-raincoat-56329
10/14/2022, 9:55 PM