【发布时间】:2021-06-28 11:56:53
【问题描述】:
我正在使用 cypress,我想在测试用例中禁用 chromeWebSecurity,但不想更改 cypress 配置。
在每个之前:
beforeEach('before test', () => {
Cypress.config('chromeWebSecurity',false);
cy.createUser('type').then((response) => {
ssoId = response.id;
phone = response.phone;
});
});
如果我在 cypress 配置 (cypress.json) 中添加 ""chromeWebSecurity": false" - 它可以工作,但我不想在我的所有测试套件中禁用它。
我正在尝试添加“Cypress.config('chromeWebSecurity',false);”在 "cy.createUser('type').then((response) => {" 之前在每个这样的之前:
beforeEach('before test', () => {
Cypress.config('chromeWebSecurity',false);
cy.createUser('type').then((response) => {
ssoId = response.id;
phone = response.phone;
});
});
但它不起作用
【问题讨论】: