【发布时间】:2021-09-03 04:31:25
【问题描述】:
即使断言失败,赛普拉斯测试似乎也标有绿色复选框。有人遇到过吗?
我尝试将 Cypress.on("fail", (err, runnable) => { return false; }); 添加到 cypress/integration/support 文件夹中的 index.js 文件中,但没有帮助。
这是一个显示问题的简单测试。如果您运行测试,您应该会在 Cypress 运行器中看到一个绿色复选框,但如果您扩展测试以查看每个步骤,您将看到红色的失败断言:
describe('fail intentionally', () => {
it('should fail when some random element that does not exist on page is asserted', () => {
cy.visit('https://www.google.com');
cy.get('[name=btnK]').should('be.visible');
cy.get('[name=totallyfake12345').should('be.visible') //expected to not be on the page
});
});
【问题讨论】:
标签: cypress