建议如何在赛普拉斯中使用断言

时间:2020-08-19 09:37:19

标签: cypress

在项目中如何使用赛普拉斯中的断言?在同一步骤(it())或不同的(it())中执行断言和断言?

1:

describe('test', ()=> {
    it('clicks on button "Add new user"', ()=> {
        // click action
        
        // assert (should()) modal to add new user is opened
    })
})

2:

describe('test', ()=> {
    it('clicks on button "Add new user"', ()=> {
        // click action
    })
    
    it('Expect: modal should be opened', ()=> {
        // assert (should()) modal to add new user is opened
    })
})

在量角器中,我使用过否。 1,动作方法和Expect方法都位于it()内,但是在Cypress中,您无法为should()断言添加自定义消息,以查看失败的确切原因。 (例如,“应该打开模式”)

谢谢!

0 个答案:

没有答案