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
0e046e222c
commit
7528d32dfc
@ -1,6 +1,6 @@
|
||||
{
|
||||
"projectId": "qa7fe2",
|
||||
"defaultCommandTimeout": 180000,
|
||||
"defaultCommandTimeout": 5000,
|
||||
"pageLoadTimeout": 180000,
|
||||
"ignoreTestFiles": "*.js",
|
||||
"chromeWebSecurity": false,
|
||||
|
||||
@ -2,10 +2,12 @@ import { Given } from "cypress-cucumber-preprocessor/steps";
|
||||
import 'cypress-network-idle';
|
||||
|
||||
Given('somebody reported the following posts:', table => {
|
||||
const reportIdRegex = /^[0-9a-zA-Z]{8}-[0-9a-zA-Z]{4}-[0-9a-zA-Z]{4}-[0-9a-zA-Z]{4}-[0-9a-zA-Z]{12}$/
|
||||
cy.intercept({
|
||||
method: 'POST',
|
||||
url: '/',
|
||||
hostname: 'localhost',
|
||||
port: 4000,
|
||||
}).as('postToLocalhoast')
|
||||
|
||||
table.hashes().forEach(({ submitterEmail, resourceId, reasonCategory, reasonDescription }) => {
|
||||
@ -36,6 +38,7 @@ Given('somebody reported the following posts:', table => {
|
||||
cy.wrap(interception.response.statusCode).should('eq', 200)
|
||||
cy.wrap(interception.response.body)
|
||||
.should('have.nested.property', 'data.fileReport.reportId')
|
||||
.and('match', reportIdRegex)
|
||||
})
|
||||
console.log('Cypress waited for fileReport request')
|
||||
cy.waitForNetworkIdle(2000)
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user