1

I am using cypress, and I want to disable chromeWebSecurity in test cases, but dont want change cypress config.

before each:

beforeEach('before test', () => {
        Cypress.config('chromeWebSecurity',false);
        cy.createUser('type').then((response) => {
            ssoId = response.id;
            phone = response.phone;
        });
    });

If I add ""chromeWebSecurity": false" in cypress config (cypress.json) - it works, but i dont want disable this in all my test suites.

I’m trying to add "Cypress.config('chromeWebSecurity',false);" before "cy.createUser('type').then((response) => {" in before each like this:

beforeEach('before test', () => {
        Cypress.config('chromeWebSecurity',false);
        cy.createUser('type').then((response) => {
            ssoId = response.id;
            phone = response.phone;
        });
    });

but it doesn’t work

nasibullin
  • 11
  • 1

1 Answers1

-2

According to cypress docs, you can add it as an option to the describe or it:

describe(
    'login',
    {
        chromeWebSecurity: true
    },
    () => {
        it('With webSecurity', () => {
            // ...
        })

        it('Without webSecurity',
            {chromeWebSecurity: false},
            () => {
            //...
            }
        )
    }
)
Rosen Mihaylov
  • 1,363
  • 2
  • 10