mirror of
https://github.com/Ocelot-Social-Community/Ocelot-Social.git
synced 2025-12-13 07:46:06 +00:00
add network interception to cypress test
This commit is contained in:
parent
18288efa1b
commit
0e046e222c
@ -2,6 +2,12 @@ import { Given } from "cypress-cucumber-preprocessor/steps";
|
||||
import 'cypress-network-idle';
|
||||
|
||||
Given('somebody reported the following posts:', table => {
|
||||
cy.intercept({
|
||||
method: 'POST',
|
||||
url: '/',
|
||||
hostname: 'localhost',
|
||||
}).as('postToLocalhoast')
|
||||
|
||||
table.hashes().forEach(({ submitterEmail, resourceId, reasonCategory, reasonDescription }) => {
|
||||
const submitter = {
|
||||
email: submitterEmail,
|
||||
@ -19,6 +25,19 @@ Given('somebody reported the following posts:', table => {
|
||||
reasonCategory,
|
||||
reasonDescription
|
||||
})
|
||||
cy.wait(['@postToLocalhoast']).then((interception) => {
|
||||
cy.wrap(interception.response.statusCode).should('eq', 200)
|
||||
})
|
||||
cy.wait(['@postToLocalhoast']).then((interception) => {
|
||||
cy.wrap(interception.response.statusCode).should('eq', 200)
|
||||
})
|
||||
cy.wait(['@postToLocalhoast']).then((interception) => {
|
||||
console.log('Cypress interception:', interception)
|
||||
cy.wrap(interception.response.statusCode).should('eq', 200)
|
||||
cy.wrap(interception.response.body)
|
||||
.should('have.nested.property', 'data.fileReport.reportId')
|
||||
})
|
||||
console.log('Cypress waited for fileReport request')
|
||||
cy.waitForNetworkIdle(2000)
|
||||
})
|
||||
})
|
||||
Loading…
x
Reference in New Issue
Block a user