test(cypress): Await promise in response to prevent timeout

The idea is to intercept the request,
then test the loading state,
and after the tests continue the request.

Problem here: `cy.intercept` has a timeout on the request-handler
which uses the same timeout as DOM assertions (4s) we could increase it,
but this also will increase DOM assertion timeout.

So instead we do not await in the request handler, but in the response handler.
This should use the response timeout which is much higher (30s).

Signed-off-by: Ferdinand Thiessen <opensource@fthiessen.de>
This commit is contained in:
Ferdinand Thiessen 2024-09-01 12:29:15 +02:00
parent 8dd169601d
commit 7e2bea6550
No known key found for this signature in database
GPG key ID: 45FAE7268762B400

View file

@ -78,7 +78,10 @@ describe('files: Rename nodes', { testIsolation: true }, () => {
cy.intercept(
'MOVE',
/\/remote.php\/dav\/files\//,
async () => { await promise },
(request) => {
// we need to wait in the onResponse handler as the intercept handler times out otherwise
request.on('response', async () => { await promise })
},
).as('moveFile')
// Start the renaming