From 565020cce20c291843232e0c84b2dba4ac01a1c7 Mon Sep 17 00:00:00 2001 From: Dmitry Kruchinin <33020454+dvkruchinin@users.noreply.github.com> Date: Wed, 9 Dec 2020 23:57:26 +0300 Subject: [PATCH] Fix some tests for antd4. (#2552) * Fix tests * Some fix Co-authored-by: Kruchinin --- .../case_4_assign_taks_job_users.js | 10 ++-------- tests/cypress/support/commands.js | 12 ++++++++++++ tests/cypress/support/index.js | 2 +- 3 files changed, 15 insertions(+), 9 deletions(-) diff --git a/tests/cypress/integration/actions_users/registration_involved/case_4_assign_taks_job_users.js b/tests/cypress/integration/actions_users/registration_involved/case_4_assign_taks_job_users.js index 7fcaead5..4dacb700 100644 --- a/tests/cypress/integration/actions_users/registration_involved/case_4_assign_taks_job_users.js +++ b/tests/cypress/integration/actions_users/registration_involved/case_4_assign_taks_job_users.js @@ -78,10 +78,7 @@ context('Multiple users. Assign task, job.', () => { }); it('Assign the task to the second user and logout', () => { cy.openTask(taskName); - cy.get('.cvat-task-details').within(() => { - cy.get('.cvat-user-search-field').click({ force: true }); - }); - cy.contains(secondUserName).click(); + cy.assignTaskToUser(secondUserName); cy.logout(); }); it('Second user login. The task can be opened. Logout', () => { @@ -98,10 +95,7 @@ context('Multiple users. Assign task, job.', () => { it('First user login and assign the job to the third user. Logout', () => { cy.login(); cy.openTask(taskName); - cy.get('.cvat-task-job-list').within(() => { - cy.get('.cvat-job-assignee-selector').click({ force: true }); - }); - cy.contains(thirdUserName).click(); + cy.assignJobToUser(thirdUserName); cy.logout(); }); it('Third user login. The task can be opened.', () => { diff --git a/tests/cypress/support/commands.js b/tests/cypress/support/commands.js index da144486..10aa88f0 100644 --- a/tests/cypress/support/commands.js +++ b/tests/cypress/support/commands.js @@ -480,6 +480,18 @@ Cypress.Commands.add('assignTaskToUser', (user) => { }); }); +Cypress.Commands.add('assignJobToUser', (user) => { + cy.get('.cvat-task-job-list').within(() => { + cy.get('.cvat-job-assignee-selector').click().type(user); + cy.wait(300); + }); + cy.get('.ant-select-dropdown') + .not('.ant-select-dropdown-hidden') + .within(() => { + cy.get(`.ant-select-item-option[title="${user}"]`).click(); + }); +}); + Cypress.Commands.add('getScaleValue', () => { cy.get('#cvat_canvas_background') .should('have.attr', 'style') diff --git a/tests/cypress/support/index.js b/tests/cypress/support/index.js index e6cec5b0..38656678 100644 --- a/tests/cypress/support/index.js +++ b/tests/cypress/support/index.js @@ -16,7 +16,7 @@ before(() => { } }); -const resizeObserverLoopErrRe = /^ResizeObserver loop limit exceeded/; +const resizeObserverLoopErrRe = /^[^(ResizeObserver loop limit exceeded)]/; Cypress.on('uncaught:exception', (err) => { if (resizeObserverLoopErrRe.test(err.message)) { // the exception is generated by cypress in some browsers