我正在测试在我的应用程序中添加和删除资源.目前,它在每个测试用例之前清除cookie并进行登录和客户 Select .我的应用程序判断Cookie是否不见了,然后它会重定向到登录页面.
describe("Resource Add / Remove", () => {
let resourceName;
beforeEach(() => {
cy.visit('http://localhost/myapp')
const user = {
email: EMAIL,
password: PASSWORD,
};
cy.login(user);
cy.selectCustomer('MyCustomer')
});
it("should create a new resource", () => {
resourceName = "MyResource";
// create new resource and check if it exist
});
it("it should delete last created resource", () => {
// find resource using resourceName in the list and click on delete button
// check if it is removed from the list
});
});
但这真的很耗时……创建新资源后,我只想跳到下一个测试用例,从头跳过登录和客户 Select .
如何做到这一点?
在 cypress 中,preserveOnce
现在被移除.