/// <reference types='cypress'/> describe("Intercepting network resources", ()=>{ it("Intercepting and waiting for a URL", ()=>{ cy.intercept({ method: "GET", url: "https://the-internet.herokuapp.com/css/app.css" }).as("slowResource") cy.visit("https://the-internet.herokuapp.com/dropdown"); cy.wait("@slowResource").its('response.statusCode').should('eq', 200); }) it("Intercepting and throwing a network error for a resource", ()=> { cy.intercept({ method: "GET", url: "https://the-internet.herokuapp.com/dropdown" },{ forceNetworkError: true }).as("slowResource") cy.visit("https://the-internet.herokuapp.com/dropdown"); }) it.skip("Intercepting and loging the request object", ()=>{ cy.intercept({ method: "GET", url: "https://the-internet.herokuapp.com/dropdown" }, (req) => { console.log(req); }).as("slowResource") cy.visit("https://the-internet.herokuapp.com/dropdown"); cy.wait("@slowResource").its('response.statusCode'); }) it("Intercepting and replying with a static response", ()=>{ cy.intercept('GET','https://the-internet.herokuapp.com/dropdown', {statusCode: 200, body: "<html><body>test</body></html>"}).as("slowResource") cy.visit("https://the-internet.herokuapp.com/dropdown"); cy.wait("@slowResource").its('response.statusCode').should('eq', 200); }) })