Problem
Cypress returns timeout while the GET request is complete.
Description
GET
request using Cypress.io
I should receive large (over 15Mb) response body from the API, but i have this: "CypressError: cy.request() timed out waiting 300000ms for a response from your server."
Increasing the "responseTimeout" didn't help...
I also checked the same request in POSTMAN and it ending up with success, always in maximum 50 seconds.
Logs shows us that the request which is timed out in cypress is actually finished, so I suppose this is the cypress issue
EDIT: there are examples of my code, I already tried to do something with "async" but timeouts are still occurring. Usually every second test is failing with timeout but it is not the rule.
commands.js:
Cypress.Commands.add('getRequestLimit', (token, limit) => {
cy.request({
failOnStatusCode: false,
url: '/endpoint',
headers: {
'Authorization': 'Bearer '+token
},
qs: {
'limit' : limit,
}
})
});
cypress.json:
{
"baseUrl": "url",
"chromeWebSecurity": false,
"video": false,
"numTestsKeptInMemory": 0,
"responseTimeout": 500000,
"pageLoadTimeout": 500000
}
test file:
it('Check query param "limit"', () => {
const limit = 3;
cy.getRequestLimit(token, limit)
.then((response) => {
expect(response.status).to.eq(200);
});
});
it('Check query param "offset"', () => {
const offset = 3;
cy.getRequestOffset(token, offset)
.then((response) => {
expect(response.status).to.eq(200);
});
});