在最新版本的 Cypress 中,Cookie 保留已被弃用,因此我希望使用 cy.session。但是,我无法让它在多个测试中工作,因为 cy.session 需要位于测试“it”内,这是我当前如何设置测试的示例。
beforeEach(() => {
Cypress.Cookies.defaults({
preserve: /somecookie|someOtherCookie|AnotherCookie/
})
it('Navigate to URL', () => {
performance.NavigateToUrl(URL);
});
it('Login - Username/Pass', () => {
performance.LoginUserPass();
});
it('Navigate Order Page', () => {
performance.Orderpage();
});
//And so on............
Run Code Online (Sandbox Code Playgroud)
欢迎任何帮助和建议,因为我真的不想重写测试结构,因为我创建了一份关于当前输出/设计的报告。
在所有测试中保留会话