如何解决我的测试用例在 Cypress 中通过后出错
在我的测试用例通过后,我注意到 cypress 试图在我的测试用例结束时运行我的自定义命令,这引发了 AssertionError。
})
it('Does not do much!',function() {
const productPage = new ProductPage();
cy.get(':nth-child(2) > .nav-link').click()
this.key.ProductName.forEach(function(element) {
cy.selectProduct(element)
productPage.getCheckoutBox().click()
productPage.getFinalCheckoutBox().click()
productPage.getAutoCountryBox().type('United States')
cy.wait(6000)
productPage.getCountryBox().click()
cy.wait(9000)
productPage.getTermsandConditions().click()
productPage.getPurchaseBox().click()
//productPage.getAlert().should('have.text','Success! Thank you! Your order will be delivered in next few weeks :-).')
productPage.getAlert().then(function(element2)
{
const actualText=element2.text()
expect(actualText.includes("Success! Thank you! Your order will be delivered in next few weeks")).to.be.true
})
})
})
})
故障排除步骤: 我尝试创建另一个元素,因为我之前创建了一个自定义命令元素。
@Nanker Phelge 请提供任何见解
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。