diff --git a/tests/cypress/integration/actions_users/issue_2440_value_must_be_a_user_instance.js b/tests/cypress/integration/actions_users/issue_2440_value_must_be_a_user_instance.js new file mode 100644 index 00000000..fbe424ed --- /dev/null +++ b/tests/cypress/integration/actions_users/issue_2440_value_must_be_a_user_instance.js @@ -0,0 +1,45 @@ +// Copyright (C) 2020 Intel Corporation +// +// SPDX-License-Identifier: MIT + +/// + +import { taskName } from '../../support/const'; + +context('Value must be a user instance.', () => { + const issueId = '2440'; + + before(() => { + cy.openTask(taskName); + }); + + describe(`Testing issue "${issueId}"`, () => { + it('Assign a task to a user', () => { + cy.get('.cvat-task-details-user-block').within(() => { + cy.get('.cvat-user-search-field').click(); + }); + cy.get('.ant-select-dropdown') + .not('.ant-select-dropdown-hidden') + .contains(new RegExp(`^${Cypress.env('user')}$`, 'g')) + .click(); + cy.get('.cvat-spinner').should('exist'); + }); + it('Assign the task to the same user again', () => { + cy.get('.cvat-task-details-user-block').within(() => { + cy.get('.cvat-user-search-field').click(); + }); + cy.get('.ant-select-dropdown') + .not('.ant-select-dropdown-hidden') + .contains(new RegExp(`^${Cypress.env('user')}$`, 'g')) + .click(); + // Before fix: + // The following error originated from your application code, not from Cypress. + // > Value must be a user instance + cy.get('.cvat-spinner').should('exist'); + // Remove the user's assignment for next tests. + cy.get('.cvat-task-details-user-block').within(() => { + cy.get('[type="text"]').click().clear().type('{Enter}'); + }); + }); + }); +});