mirror of
https://github.com/IT4Change/Ocelot-Social.git
synced 2025-12-13 07:45:56 +00:00
add network waiting to several cypress steps
This commit is contained in:
parent
a5eca59f88
commit
14ed84620b
@ -1,5 +1,7 @@
|
||||
import { When } from "cypress-cucumber-preprocessor/steps";
|
||||
import 'cypress-network-idle';
|
||||
|
||||
When("I click on the avatar menu in the top right corner", () => {
|
||||
cy.get(".avatar-menu").click();
|
||||
cy.waitForNetworkIdle(2000);
|
||||
});
|
||||
@ -7,7 +7,6 @@ Given('somebody reported the following posts:', table => {
|
||||
method: 'POST',
|
||||
url: '/',
|
||||
hostname: 'localhost',
|
||||
port: 4000,
|
||||
}).as('postToLocalhost')
|
||||
|
||||
table.hashes().forEach(({ submitterEmail, resourceId, reasonCategory, reasonDescription }) => {
|
||||
@ -30,9 +29,6 @@ Given('somebody reported the following posts:', table => {
|
||||
cy.wait(['@postToLocalhost']).then((interception) => {
|
||||
cy.wrap(interception.response.statusCode).should('eq', 200)
|
||||
})
|
||||
cy.wait(['@postToLocalhost']).then((interception) => {
|
||||
cy.wrap(interception.response.statusCode).should('eq', 200)
|
||||
})
|
||||
cy.wait(['@postToLocalhost']).then((interception) => {
|
||||
console.log('Cypress interception:', interception)
|
||||
cy.wrap(interception.response.statusCode).should('eq', 200)
|
||||
@ -40,7 +36,6 @@ Given('somebody reported the following posts:', table => {
|
||||
.should('have.nested.property', 'data.fileReport.reportId')
|
||||
.and('match', reportIdRegex)
|
||||
})
|
||||
console.log('Cypress waited for fileReport request')
|
||||
cy.waitForNetworkIdle(2000)
|
||||
})
|
||||
})
|
||||
@ -1,4 +1,5 @@
|
||||
import { When } from "cypress-cucumber-preprocessor/steps";
|
||||
import 'cypress-network-idle';
|
||||
|
||||
When("I click on {string}", element => {
|
||||
const elementSelectors = {
|
||||
@ -16,4 +17,5 @@ When("I click on {string}", element => {
|
||||
cy.get(elementSelectors[element])
|
||||
.click()
|
||||
.wait(750);
|
||||
cy.waitForNetworkIdle(2000);
|
||||
});
|
||||
@ -50,8 +50,6 @@ Cypress.Commands.add(
|
||||
{ prevSubject: true },
|
||||
(graphQLClient, mutation, variables, response) => {
|
||||
return new Cypress.Promise(async (resolve, reject) => {
|
||||
const response = await graphQLClient.request(mutation, variables)
|
||||
console.log('Cypress command mutate:', response)
|
||||
graphQLClient.request(mutation, variables).then(() => resolve(graphQLClient))
|
||||
|
||||
})
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user