赛普拉斯 6.x+ 迁移
根据关于存在的赛普拉斯文档
有点幼稚的非常流行的尝试将一直有效,直到它不起作用,然后您将不得不再次重写它......一次又一次......
// retry until loading spinner no longer exists
cy.get('#loading').should('not.exist')
这实际上不适用于大多数人会寻找的标题问题。
这适用于它被删除的情况。但如果你希望它永远不存在......它会重试直到它消失。
但是,如果您想测试该元素在我们的案例中不存在。
是的哈哈。这是你真正想要的,除非你想改天再头痛一次。
// Goes through all the like elements, and says this object doesn't exist ever
cy.get(`img[src]`)
.then(($imageSection) => {
$imageSection.map((x, i) => { expect($imageSection[x].getAttribute('src')).to.not.equal(`${Cypress.config().baseUrl}/assets/images/imageName.jpg`) });
})