From bdd002a426573b37dbb2fbe9a687f91a2a532551 Mon Sep 17 00:00:00 2001 From: Boris Sekachev Date: Thu, 1 Feb 2024 21:52:21 +0200 Subject: [PATCH] Stabilized cypress test: issue_2900_creating_more_one_tasks_from_project_per_time.js (#7423) --- cvat-ui/src/components/tasks-page/task-item.tsx | 14 +++++++++----- ...reating_more_one_tasks_from_project_per_time.js | 4 +++- 2 files changed, 12 insertions(+), 6 deletions(-) diff --git a/cvat-ui/src/components/tasks-page/task-item.tsx b/cvat-ui/src/components/tasks-page/task-item.tsx index 3799c722896b..f689c8cf8c01 100644 --- a/cvat-ui/src/components/tasks-page/task-item.tsx +++ b/cvat-ui/src/components/tasks-page/task-item.tsx @@ -72,12 +72,16 @@ class TaskItemComponent extends React.PureComponent { if (!this.#isUnmounted) { this.setState({ importingState: null }); + setTimeout(() => { - const { taskInstance: currentTaskInstance } = this.props; - if (currentTaskInstance.size !== createdTask.size) { - // update state only if it was not updated anywhere else - // for example in createTaskAsync - updateTaskInState(createdTask); + if (!this.#isUnmounted) { + // check again, because the component may be unmounted to this moment + const { taskInstance: currentTaskInstance } = this.props; + if (currentTaskInstance.size !== createdTask.size) { + // update state only if it was not updated anywhere else + // for example in createTaskAsync + updateTaskInState(createdTask); + } } }, 1000); } diff --git a/tests/cypress/e2e/actions_projects_models/issue_2900_creating_more_one_tasks_from_project_per_time.js b/tests/cypress/e2e/actions_projects_models/issue_2900_creating_more_one_tasks_from_project_per_time.js index de4131bba520..a06d56ff6dfe 100644 --- a/tests/cypress/e2e/actions_projects_models/issue_2900_creating_more_one_tasks_from_project_per_time.js +++ b/tests/cypress/e2e/actions_projects_models/issue_2900_creating_more_one_tasks_from_project_per_time.js @@ -34,7 +34,9 @@ context('Create more than one task per time when create from project.', () => { cy.get('.cvat-constructor-viewer-new-item').should('not.exist'); cy.get('input[type="file"]').attachFile(archiveName, { subjectType: 'drag-n-drop' }); cy.contains('button', 'Submit & Continue').click(); - cy.get('.cvat-notification-create-task-success').should('exist'); + cy.get('.cvat-notification-create-task-success').should('exist').within(() => { + cy.get('.anticon-close').click(); + }); cy.get('.cvat-notification-create-task-fail').should('not.exist'); }