I'm trying cypress API Intercepting and I have an error because website gives me multiple URL calls with the same name 'articles' and one are having status code 307 and the otherone has 200. how to find the article with status code 200?
Here is my code
it('should logged in',()=> {
cy.wait(3000)
cy.contains('New Article').click()
cy.get('fieldset').then(article =>{
cy.server()
cy.route('POST', '**/articles').as('postArticles')
cy.wrap(article).find('[placeholder="Article Title"]').type('New Article')
cy.wrap(article).eq(2).type('nothing')
cy.wrap(article).eq(3).type('some text')
cy.wrap(article).find('button').contains(' Publish Article ').click()
cy.contains('Home').click()
cy.wait('@postArticles')
cy.get('@postArticles').then(xhr =>{
console.log(xhr)
expect(xhr.status).to.equal(200)
expect(xhr.request.body.article.body).to.equal('some text')
expect(xhr.request.body.article.description).to.equal('nothing')
expect(xhr.request.body.article.title).to.equal('New Article')
})
})
})
})
