我希望能够单击一个复选框并测试Cypress中DOM中是否不再有某个元素。有人可以建议您如何做吗?
//This is the Test when the check box is clicked and the element is there
cy.get('[type="checkbox"]').click();
cy.get('.check-box-sub-text').contains('Some text in this div.')
我想做与上面测试相反的事情。因此,当我再次单击它时,具有类的div不应位于DOM中。
好吧,这似乎行得通,所以它告诉我还有更多有关.should()的知识。
cy.get('.check-box-sub-text').should('not.exist');
本文收集自互联网,转载请注明来源。
如有侵权,请联系 [email protected] 删除。
我来说两句