filiphric / cypress-plugin-api

Cypress plugin to show your API information in the Cypress UI runner
ISC License
262 stars 34 forks source link

issue with using cy.api after cy.origin #124

Closed martin131 closed 4 months ago

martin131 commented 1 year ago

I have an issue with this code. After replacing cy.request with cy.api, tests are failing.

describe('test', () => {
  it('test', () => {
    cy.origin('https://www.novinky.cz', () => {
      cy.visit("https://www.novinky.cz/p/tiraz")
      cy.contains("Tiráž")
    })

    cy.request({
      method: 'GET',
      url: 'http://httpstat.us/200'
    })
  })
})
filiphric commented 4 months ago

the reason for this particular test failing is that the origin actually points to https://cmp.seznam.cz instead of novinky.cz. the error that causes this test to fail is from wrong use of cy.origin rather than cy.api. closing this for now, but if you are experiencing similar issue, feel free to reopen and provide more info