From 42bc522582c203ec8d8a7924fc62788df6b4d4e2 Mon Sep 17 00:00:00 2001 From: Gard Rimestad Date: Thu, 11 Jan 2024 11:03:01 +0100 Subject: [PATCH] chore: wait for post to finish instead of waiting a fixed time (#5851) This will hopefully make the test faster and more stable --- frontend/cypress/integration/import/import.spec.ts | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/frontend/cypress/integration/import/import.spec.ts b/frontend/cypress/integration/import/import.spec.ts index cf8233e936..8f0f774772 100644 --- a/frontend/cypress/integration/import/import.spec.ts +++ b/frontend/cypress/integration/import/import.spec.ts @@ -101,6 +101,10 @@ describe('imports', () => { cy.get("[data-testid='VALIDATE_BUTTON']").should('be.disabled'); + cy.intercept('POST', '/api/admin/features-batch/import').as( + 'featureImported', + ); + // cypress can only work with input@file that is visible cy.get('input[type=file]') .invoke('attr', 'style', 'display: block') @@ -111,9 +115,9 @@ describe('imports', () => { }); cy.get("[data-testid='VALIDATE_BUTTON']").click(); cy.get("[data-testid='IMPORT_CONFIGURATION_BUTTON']").click(); - // cy.contains('Import completed'); - cy.wait(1500); + cy.wait('@featureImported'); + cy.contains('Import completed'); cy.request({ url: `/api/admin/projects/default/features/${randomFeatureName}`,