1
0
mirror of https://github.com/Unleash/unleash.git synced 2024-12-22 19:07:54 +01:00

chore: wait for post to finish instead of waiting a fixed time (#5851)

This will hopefully make the test faster and more stable
This commit is contained in:
Gard Rimestad 2024-01-11 11:03:01 +01:00 committed by GitHub
parent 3779a6f0fb
commit 42bc522582
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -101,6 +101,10 @@ describe('imports', () => {
cy.get("[data-testid='VALIDATE_BUTTON']").should('be.disabled'); 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 // cypress can only work with input@file that is visible
cy.get('input[type=file]') cy.get('input[type=file]')
.invoke('attr', 'style', 'display: block') .invoke('attr', 'style', 'display: block')
@ -111,9 +115,9 @@ describe('imports', () => {
}); });
cy.get("[data-testid='VALIDATE_BUTTON']").click(); cy.get("[data-testid='VALIDATE_BUTTON']").click();
cy.get("[data-testid='IMPORT_CONFIGURATION_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({ cy.request({
url: `/api/admin/projects/default/features/${randomFeatureName}`, url: `/api/admin/projects/default/features/${randomFeatureName}`,