Intercept the same API call multiple times in Cypress

Updated for Cypress v7.0.0 Released 04/05/2021 The change-log shows from this release the intercepts are now called in reverse order Response handlers (supplied via event handlers or via req.continue(cb)) supplied to cy.intercept() will be called in reverse order until res.send is called or until there are no more response handlers. Also illustrated in this diagram … Read more

How can i use soft assertion in Cypress

The soft assertion concept is pretty cool, and you can add it with minimal implementation to Cypress const jsonAssertion = require(“soft-assert”) it(‘asserts several times and only fails at the end’, () => { jsonAssertion.softAssert(10, 12, “expected actual mismatch”); // some more assertions, not causing a failure jsonAssertion.softAssertAll(); // Now fail the test if above fails … Read more

select dropdownlist item using cypress

Material Design Select and Cypress This is the same basic problem as Access element whose parent is hidden – cypress.io, except this question is angularjs + md-select and that question was angular + mdc-select. Nevertheless, the two versions of material design select use the same trick of making the parent control invisible (by setting width … Read more

Cypress get href attribute

The code below should do what you’re trying to achieve. There is also an entire recipe with suggestions on how to test links that open in new tabs. it(‘Advertise link should refer to Contact page’, () => { cy.get(‘div.footer-nav > ul > li:nth-child(2) > a’) .should(‘have.attr’, ‘href’).and(‘include’, ‘contact’) .then((href) => { cy.visit(href) }) }) I … Read more