From 8b719e4959b43644f0cdfd0c3df30dde02cc2e22 Mon Sep 17 00:00:00 2001 From: Kirill Lakhov Date: Wed, 28 Sep 2022 14:42:38 +0300 Subject: [PATCH] Fixed unstable e2e restore tests (#5010) --- CHANGELOG.md | 1 + .../actions_tasks2/case_97_export_import_task.js | 8 ++++++-- tests/cypress/support/commands_projects.js | 10 ++++++---- 3 files changed, 13 insertions(+), 6 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 25301862..b14cd2af 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -28,6 +28,7 @@ non-ascii paths while adding files from "Connected file share" (issue #4428) () - Project import/export with skeletons (, ) +- Unstable e2e restore tests () ### Security - TDB diff --git a/tests/cypress/integration/actions_tasks2/case_97_export_import_task.js b/tests/cypress/integration/actions_tasks2/case_97_export_import_task.js index 4b841b29..dc5ff8ba 100644 --- a/tests/cypress/integration/actions_tasks2/case_97_export_import_task.js +++ b/tests/cypress/integration/actions_tasks2/case_97_export_import_task.js @@ -113,8 +113,12 @@ context('Export, import an annotation task.', { browser: '!firefox' }, () => { cy.wait('@importTask').its('response.statusCode').should('equal', 201); cy.wait('@importTask').its('response.statusCode').should('equal', 204); cy.wait('@importTask').its('response.statusCode').should('equal', 202); - cy.wait('@importTask', { timeout: 5000 }).its('response.statusCode').should('equal', 202); - cy.wait('@importTask').its('response.statusCode').should('equal', 201); + cy.wait('@importTask').then((interception) => { + cy.wrap(interception).its('response.statusCode').should('be.oneOf', [201, 202]); + if (interception.response.statusCode === 202) { + cy.wait('@importTask').its('response.statusCode').should('equal', 201); + } + }); cy.contains('The task has been restored succesfully. Click here to open').should('exist').and('be.visible'); cy.closeNotification('.ant-notification-notice-info'); cy.openTask(taskName); diff --git a/tests/cypress/support/commands_projects.js b/tests/cypress/support/commands_projects.js index a835c88a..b40b7fbc 100644 --- a/tests/cypress/support/commands_projects.js +++ b/tests/cypress/support/commands_projects.js @@ -213,13 +213,15 @@ Cypress.Commands.add('restoreProject', (archiveWithBackup, sourceStorage = null) cy.wait('@restoreProject').its('response.statusCode').should('equal', 201); cy.wait('@restoreProject').its('response.statusCode').should('equal', 204); cy.wait('@restoreProject').its('response.statusCode').should('equal', 202); - cy.wait('@restoreProject', { timeout: 5000 }).its('response.statusCode').should('equal', 202); - cy.wait('@restoreProject').its('response.statusCode').should('equal', 201); } else { cy.wait('@restoreProject').its('response.statusCode').should('equal', 202); - cy.wait('@restoreProject', { timeout: 3000 }).its('response.statusCode').should('equal', 202); - cy.wait('@restoreProject').its('response.statusCode').should('equal', 201); } + cy.wait('@restoreProject').then((interception) => { + cy.wrap(interception).its('response.statusCode').should('be.oneOf', [201, 202]); + if (interception.response.statusCode === 202) { + cy.wait('@restoreProject').its('response.statusCode').should('equal', 201); + } + }); cy.contains('The project has been restored succesfully. Click here to open') .should('exist')