From 437a2c78fde2a608f76ed7a01429c389aabc94b9 Mon Sep 17 00:00:00 2001 From: Dmitriy Oparin Date: Fri, 13 Nov 2020 16:57:47 +0300 Subject: [PATCH 01/21] added test --- ...ror_сannot_read_property_at_saving_job.js | 50 +++++++++++++++++++ 1 file changed, 50 insertions(+) create mode 100644 tests/cypress/integration/actions_tasks_objects/pr_2203_error_сannot_read_property_at_saving_job.js diff --git a/tests/cypress/integration/actions_tasks_objects/pr_2203_error_сannot_read_property_at_saving_job.js b/tests/cypress/integration/actions_tasks_objects/pr_2203_error_сannot_read_property_at_saving_job.js new file mode 100644 index 00000000..a521efc7 --- /dev/null +++ b/tests/cypress/integration/actions_tasks_objects/pr_2203_error_сannot_read_property_at_saving_job.js @@ -0,0 +1,50 @@ +// Copyright (C) 2020 Intel Corporation +// +// SPDX-License-Identifier: MIT + +/// + +import { taskName, labelName } from '../../support/const'; + +context('Check error сannot read property at saving job', () => { + + const issueIds = '2053, 2202'; + const createRectangleShape2Points = { + points: 'By 2 Points', + type: 'Shape', + switchLabel: false, + firstX: 100, + firstY: 100, + secondX: 300, + secondY: 300, + }; + + before(() => { + cy.openTaskJob(taskName); + }); + + describe(`Testing issues "${issueIds}"`, () => { + it('Create an object in first frame', () => { + cy.createRectangle(createRectangleShape2Points); + }); + + it('Go to next frame and create an object in second frame', () => { + cy.get('body').type('f'); + cy.createRectangle(createRectangleShape2Points); + }); + + it('Go to AAM', () => { + cy.changeWorkspace('Attribute annotation', labelName); + }); + + it('Save job and go to previous frame at saving job', () => { + cy.get('button').contains('Save').click({ force: true }); + cy.get('body').type('d'); + }); + + it('Page with the error is missing', () => { + cy.wait(100); + cy.contains('Oops, something went wrong').should('not.exist'); + }); + }); +}); \ No newline at end of file From d930a2f8e2916bc4b13ace6bd556886d19f2fd71 Mon Sep 17 00:00:00 2001 From: Dmitriy Oparin Date: Fri, 13 Nov 2020 17:38:47 +0300 Subject: [PATCH 02/21] create function saveJob --- tests/cypress/support/commands.js | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/tests/cypress/support/commands.js b/tests/cypress/support/commands.js index c455e1d5..ff62523d 100644 --- a/tests/cypress/support/commands.js +++ b/tests/cypress/support/commands.js @@ -74,6 +74,12 @@ Cypress.Commands.add('openTask', (taskName) => { cy.contains('strong', taskName).parents('.cvat-tasks-list-item').contains('a', 'Open').click({ force: true }); }); +Cypress.Commands.add('saveJob', () => { + cy.get('button') + .contains('Save') + .click({ force: true }); +}); + Cypress.Commands.add('openJob', (jobNumber = 0) => { let tdText = ''; cy.get('.ant-table-tbody') From 52b517171a5b7cb65877fd3fe463873dfe088b3c Mon Sep 17 00:00:00 2001 From: Dmitriy Oparin Date: Fri, 13 Nov 2020 17:39:46 +0300 Subject: [PATCH 03/21] added step after and improvements test --- ...203_error_сannot_read_property_at_saving_job.js | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/tests/cypress/integration/actions_tasks_objects/pr_2203_error_сannot_read_property_at_saving_job.js b/tests/cypress/integration/actions_tasks_objects/pr_2203_error_сannot_read_property_at_saving_job.js index a521efc7..f0f68d50 100644 --- a/tests/cypress/integration/actions_tasks_objects/pr_2203_error_сannot_read_property_at_saving_job.js +++ b/tests/cypress/integration/actions_tasks_objects/pr_2203_error_сannot_read_property_at_saving_job.js @@ -8,7 +8,7 @@ import { taskName, labelName } from '../../support/const'; context('Check error сannot read property at saving job', () => { - const issueIds = '2053, 2202'; + const prId = '2203'; const createRectangleShape2Points = { points: 'By 2 Points', type: 'Shape', @@ -23,13 +23,18 @@ context('Check error сannot read property at saving job', () => { cy.openTaskJob(taskName); }); - describe(`Testing issues "${issueIds}"`, () => { + after('Go to task list', () => { + cy.removeAnnotations(); + cy.saveJob(); + }); + + describe(`Testing pr "${prId}"`, () => { it('Create an object in first frame', () => { cy.createRectangle(createRectangleShape2Points); }); it('Go to next frame and create an object in second frame', () => { - cy.get('body').type('f'); + cy.get('.cvat-player-next-button').click(); cy.createRectangle(createRectangleShape2Points); }); @@ -38,7 +43,7 @@ context('Check error сannot read property at saving job', () => { }); it('Save job and go to previous frame at saving job', () => { - cy.get('button').contains('Save').click({ force: true }); + cy.saveJob(); cy.get('body').type('d'); }); From 05e2d4b948bfe40dda3fb17102322d644ef0d514 Mon Sep 17 00:00:00 2001 From: Dmitriy Oparin Date: Fri, 13 Nov 2020 17:40:35 +0300 Subject: [PATCH 04/21] used function saveJob --- .../issue_1568_cuboid_dump_annotation.js | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/tests/cypress/integration/actions_tasks_objects/issue_1568_cuboid_dump_annotation.js b/tests/cypress/integration/actions_tasks_objects/issue_1568_cuboid_dump_annotation.js index 505444fa..ab405092 100644 --- a/tests/cypress/integration/actions_tasks_objects/issue_1568_cuboid_dump_annotation.js +++ b/tests/cypress/integration/actions_tasks_objects/issue_1568_cuboid_dump_annotation.js @@ -18,17 +18,13 @@ context('Dump annotation if cuboid created', () => { secondY: 450, }; - function save() { - cy.get('button').contains('Save').click({ force: true }); - } - before(() => { cy.openTaskJob(taskName); }); after('Go to task list', () => { cy.removeAnnotations(); - save(); + cy.saveJob(); }); describe(`Testing issue "${issueId}"`, () => { @@ -38,7 +34,7 @@ context('Dump annotation if cuboid created', () => { }); it('Dump an annotation', () => { cy.get('.cvat-annotation-header-left-group').within(() => { - save(); + cy.saveJob(); cy.get('button').contains('Menu').trigger('mouseover', { force: true }); }); cy.get('.cvat-annotation-menu').within(() => { From 075c6670372571a852a9d226e77241e6250f9e12 Mon Sep 17 00:00:00 2001 From: Dmitriy Oparin Date: Mon, 16 Nov 2020 09:12:30 +0300 Subject: [PATCH 05/21] rename step --- .../pr_2203_error_сannot_read_property_at_saving_job.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/cypress/integration/actions_tasks_objects/pr_2203_error_сannot_read_property_at_saving_job.js b/tests/cypress/integration/actions_tasks_objects/pr_2203_error_сannot_read_property_at_saving_job.js index f0f68d50..dce7ad15 100644 --- a/tests/cypress/integration/actions_tasks_objects/pr_2203_error_сannot_read_property_at_saving_job.js +++ b/tests/cypress/integration/actions_tasks_objects/pr_2203_error_сannot_read_property_at_saving_job.js @@ -23,7 +23,7 @@ context('Check error сannot read property at saving job', () => { cy.openTaskJob(taskName); }); - after('Go to task list', () => { + after('Remove annotations and save job', () => { cy.removeAnnotations(); cy.saveJob(); }); From ace75ca96d844840c17590eb7b3d6bca8bc9d385 Mon Sep 17 00:00:00 2001 From: Dmitriy Oparin Date: Mon, 16 Nov 2020 10:19:28 +0300 Subject: [PATCH 06/21] added EOF string --- .../pr_2203_error_сannot_read_property_at_saving_job.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/cypress/integration/actions_tasks_objects/pr_2203_error_сannot_read_property_at_saving_job.js b/tests/cypress/integration/actions_tasks_objects/pr_2203_error_сannot_read_property_at_saving_job.js index dce7ad15..e2132961 100644 --- a/tests/cypress/integration/actions_tasks_objects/pr_2203_error_сannot_read_property_at_saving_job.js +++ b/tests/cypress/integration/actions_tasks_objects/pr_2203_error_сannot_read_property_at_saving_job.js @@ -52,4 +52,4 @@ context('Check error сannot read property at saving job', () => { cy.contains('Oops, something went wrong').should('not.exist'); }); }); -}); \ No newline at end of file +}); From 02ea1881a78c4f2ad19f70213d8f0908fbdd00c2 Mon Sep 17 00:00:00 2001 From: Dmitriy Oparin Date: Wed, 18 Nov 2020 14:55:21 +0300 Subject: [PATCH 07/21] apply comments --- .../pr_2203_error_сannot_read_property_at_saving_job.js | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/tests/cypress/integration/actions_tasks_objects/pr_2203_error_сannot_read_property_at_saving_job.js b/tests/cypress/integration/actions_tasks_objects/pr_2203_error_сannot_read_property_at_saving_job.js index e2132961..bc6963fd 100644 --- a/tests/cypress/integration/actions_tasks_objects/pr_2203_error_сannot_read_property_at_saving_job.js +++ b/tests/cypress/integration/actions_tasks_objects/pr_2203_error_сannot_read_property_at_saving_job.js @@ -43,13 +43,14 @@ context('Check error сannot read property at saving job', () => { }); it('Save job and go to previous frame at saving job', () => { + cy.server().route('PATCH', '/api/v1/jobs/**').as('saveJob'); cy.saveJob(); cy.get('body').type('d'); + cy.wait('@saveJob').its('status').should('equal', 200); }); it('Page with the error is missing', () => { - cy.wait(100); - cy.contains('Oops, something went wrong').should('not.exist'); + cy.get('.cvat-global-boundary').should('not.exist'); }); }); }); From 53cbd4c9c5e485677fce225556737c8fc4f36767 Mon Sep 17 00:00:00 2001 From: Dmitriy Oparin Date: Mon, 23 Nov 2020 13:50:37 +0300 Subject: [PATCH 08/21] test adaptation for new develop --- .../pr_2203_error_сannot_read_property_at_saving_job.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/cypress/integration/actions_tasks_objects/pr_2203_error_сannot_read_property_at_saving_job.js b/tests/cypress/integration/actions_tasks_objects/pr_2203_error_сannot_read_property_at_saving_job.js index bc6963fd..8b398179 100644 --- a/tests/cypress/integration/actions_tasks_objects/pr_2203_error_сannot_read_property_at_saving_job.js +++ b/tests/cypress/integration/actions_tasks_objects/pr_2203_error_сannot_read_property_at_saving_job.js @@ -12,7 +12,7 @@ context('Check error сannot read property at saving job', () => { const createRectangleShape2Points = { points: 'By 2 Points', type: 'Shape', - switchLabel: false, + labelName: labelName, firstX: 100, firstY: 100, secondX: 300, From b0f4ad68421178e7f39af4dbf5cd334ed821000b Mon Sep 17 00:00:00 2001 From: Kruchinin Date: Mon, 23 Nov 2020 18:00:55 +0300 Subject: [PATCH 09/21] Cypress test. Issue 2440 --- ...ssue_2440_value_must_be_a_user_instance.js | 46 +++++++++++++++++++ 1 file changed, 46 insertions(+) create mode 100644 tests/cypress/integration/actions_users/issue_2440_value_must_be_a_user_instance.js 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..8b36c9fb --- /dev/null +++ b/tests/cypress/integration/actions_users/issue_2440_value_must_be_a_user_instance.js @@ -0,0 +1,46 @@ +// 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 + + // Remove the user's assignment for next tests. + cy.get('.cvat-spinner').should('exist'); + cy.get('.cvat-task-details-user-block').within(() => { + cy.get('[type="text"]').click().clear().type('{Enter}'); + }); + }); + }); +}); From 327e34ca3d018bb5fba719b1d193e30ddbd22c9d Mon Sep 17 00:00:00 2001 From: Kruchinin Date: Tue, 24 Nov 2020 08:12:57 +0300 Subject: [PATCH 10/21] Minor fix --- .../actions_users/issue_2440_value_must_be_a_user_instance.js | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) 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 index 8b36c9fb..fbe424ed 100644 --- 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 @@ -35,9 +35,8 @@ context('Value must be a user instance.', () => { // Before fix: // The following error originated from your application code, not from Cypress. // > Value must be a user instance - - // Remove the user's assignment for next tests. 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}'); }); From 08165c1b1781bb8f869a108007ed35bc2697eab5 Mon Sep 17 00:00:00 2001 From: Dmitriy Oparin Date: Tue, 24 Nov 2020 09:47:34 +0300 Subject: [PATCH 11/21] add test --- ..._error_canvas_is_busy_at_resize_element.js | 61 +++++++++++++++++++ 1 file changed, 61 insertions(+) create mode 100644 tests/cypress/integration/actions_tasks_objects/issue_1922_error_canvas_is_busy_at_resize_element.js diff --git a/tests/cypress/integration/actions_tasks_objects/issue_1922_error_canvas_is_busy_at_resize_element.js b/tests/cypress/integration/actions_tasks_objects/issue_1922_error_canvas_is_busy_at_resize_element.js new file mode 100644 index 00000000..ac68f7d4 --- /dev/null +++ b/tests/cypress/integration/actions_tasks_objects/issue_1922_error_canvas_is_busy_at_resize_element.js @@ -0,0 +1,61 @@ +// Copyright (C) 2020 Intel Corporation +// +// SPDX-License-Identifier: MIT + +/// + +import { taskName, labelName } from '../../support/const'; + +context('Check error canvas is busy at resize element', () => { + + const issueId = '1922'; + const createRectangleShape2Points = { + points: 'By 2 Points', + type: 'Shape', + labelName: labelName, + firstX: 100, + firstY: 100, + secondX: 300, + secondY: 300, + }; + + before(() => { + cy.openTaskJob(taskName); + }); + + after('Remove annotations and save job', () => { + cy.removeAnnotations(); + cy.saveJob(); + }); + + describe(`Testing issue "${issueId}"`, () => { + it('Create an object in first frame', () => { + cy.createRectangle(createRectangleShape2Points); + }); + + it('Go to next frame and create an object in second frame', () => { + cy.get('.cvat-player-next-button').click(); + cy.createRectangle(createRectangleShape2Points); + }); + + it('Switching mode of button on "back with a filter"', () => { + cy.get('.cvat-player-previous-button').rightclick(); + cy.get('.cvat-player-previous-filtered-inlined-button').click(); + }); + + it('Resize element on second frame and go to previous frame at resizing element', () => { + let secondX = createRectangleShape2Points['secondX']; + let secondY = createRectangleShape2Points['secondY']; + cy.get('.cvat-canvas-container') + .trigger('mousemove', secondX - 10, secondY - 10) // activate second shape + .trigger('mousedown', secondX, secondY, {button: 0}) + .trigger('mousemove', secondX + 100, secondY + 100) + .get('body').type('d') // go to previous frame + .trigger('mouseup'); + }); + + it('Page with the error is missing', () => { + cy.get('.cvat-global-boundary').should('not.exist'); + }); + }); +}); From 60e60f1bb69c8529609ac2aed6dedf28332facc1 Mon Sep 17 00:00:00 2001 From: Dmitriy Oparin Date: Tue, 24 Nov 2020 11:14:21 +0300 Subject: [PATCH 12/21] added function saveJob --- tests/cypress/support/commands.js | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/tests/cypress/support/commands.js b/tests/cypress/support/commands.js index 695007b3..4a98be69 100644 --- a/tests/cypress/support/commands.js +++ b/tests/cypress/support/commands.js @@ -74,6 +74,12 @@ Cypress.Commands.add('openTask', (taskName) => { cy.contains('strong', taskName).parents('.cvat-tasks-list-item').contains('a', 'Open').click({ force: true }); }); +Cypress.Commands.add('saveJob', () => { + cy.get('button') + .contains('Save') + .click({ force: true }); +}); + Cypress.Commands.add('openJob', (jobNumber = 0) => { let tdText = ''; cy.get('.ant-table-tbody') From ef93bac40310731c6ecced2cf12dcd8b179cc613 Mon Sep 17 00:00:00 2001 From: Dmitriy Oparin Date: Tue, 24 Nov 2020 12:24:27 +0300 Subject: [PATCH 13/21] minor fix --- .../issue_1922_error_canvas_is_busy_at_resize_element.js | 9 ++------- tests/cypress/support/commands.js | 6 ------ 2 files changed, 2 insertions(+), 13 deletions(-) diff --git a/tests/cypress/integration/actions_tasks_objects/issue_1922_error_canvas_is_busy_at_resize_element.js b/tests/cypress/integration/actions_tasks_objects/issue_1922_error_canvas_is_busy_at_resize_element.js index ac68f7d4..ace78490 100644 --- a/tests/cypress/integration/actions_tasks_objects/issue_1922_error_canvas_is_busy_at_resize_element.js +++ b/tests/cypress/integration/actions_tasks_objects/issue_1922_error_canvas_is_busy_at_resize_element.js @@ -23,11 +23,6 @@ context('Check error canvas is busy at resize element', () => { cy.openTaskJob(taskName); }); - after('Remove annotations and save job', () => { - cy.removeAnnotations(); - cy.saveJob(); - }); - describe(`Testing issue "${issueId}"`, () => { it('Create an object in first frame', () => { cy.createRectangle(createRectangleShape2Points); @@ -44,8 +39,8 @@ context('Check error canvas is busy at resize element', () => { }); it('Resize element on second frame and go to previous frame at resizing element', () => { - let secondX = createRectangleShape2Points['secondX']; - let secondY = createRectangleShape2Points['secondY']; + const secondX = createRectangleShape2Points.secondX; + const secondY = createRectangleShape2Points.secondY; cy.get('.cvat-canvas-container') .trigger('mousemove', secondX - 10, secondY - 10) // activate second shape .trigger('mousedown', secondX, secondY, {button: 0}) diff --git a/tests/cypress/support/commands.js b/tests/cypress/support/commands.js index 4a98be69..695007b3 100644 --- a/tests/cypress/support/commands.js +++ b/tests/cypress/support/commands.js @@ -74,12 +74,6 @@ Cypress.Commands.add('openTask', (taskName) => { cy.contains('strong', taskName).parents('.cvat-tasks-list-item').contains('a', 'Open').click({ force: true }); }); -Cypress.Commands.add('saveJob', () => { - cy.get('button') - .contains('Save') - .click({ force: true }); -}); - Cypress.Commands.add('openJob', (jobNumber = 0) => { let tdText = ''; cy.get('.ant-table-tbody') From bf8e9c252925ff04b1d9388b44df60518c63577d Mon Sep 17 00:00:00 2001 From: Kruchinin Date: Tue, 24 Nov 2020 13:38:13 +0300 Subject: [PATCH 14/21] Cypress test. Issue 1823. --- ...ntext_menu_when_switching_another_frame.js | 76 +++++++++++++++++++ tests/cypress/support/commands.js | 33 +++++--- 2 files changed, 99 insertions(+), 10 deletions(-) create mode 100644 tests/cypress/integration/actions_tasks_objects/issue_1823_opening_context_menu_when_switching_another_frame.js diff --git a/tests/cypress/integration/actions_tasks_objects/issue_1823_opening_context_menu_when_switching_another_frame.js b/tests/cypress/integration/actions_tasks_objects/issue_1823_opening_context_menu_when_switching_another_frame.js new file mode 100644 index 00000000..c2b2b75b --- /dev/null +++ b/tests/cypress/integration/actions_tasks_objects/issue_1823_opening_context_menu_when_switching_another_frame.js @@ -0,0 +1,76 @@ +// Copyright (C) 2020 Intel Corporation +// +// SPDX-License-Identifier: MIT + +/// + +context('Cannot read property label of undefined', () => { + const issueId = '1823'; + const labelName = `Issue ${issueId}`; + const taskName = `New annotation task for ${labelName}`; + const attrName = `Attr for ${labelName}`; + const textDefaultValue = 'Some default value for type Text'; + const imagesCount = 10; + const imageFileName = `image_${labelName.replace(' ', '_').toLowerCase()}`; + const width = 800; + const height = 800; + const posX = 10; + const posY = 10; + const color = 'gray'; + const archiveName = `${imageFileName}.zip`; + const archivePath = `cypress/fixtures/${archiveName}`; + const imagesFolder = `cypress/fixtures/${imageFileName}`; + const directoryToArchive = imagesFolder; + const advancedConfigurationParams = { + chunkSize: 1, + }; + + const createRectangleShape2Points = { + points: 'By 2 Points', + type: 'Shape', + labelName: labelName, + firstX: 250, + firstY: 350, + secondX: 350, + secondY: 450, + }; + + before(() => { + cy.visit('auth/login'); + cy.login(); + cy.imageGenerator(imagesFolder, imageFileName, width, height, color, posX, posY, labelName, imagesCount); + cy.createZipArchive(directoryToArchive, archivePath); + }); + + after(() => { + cy.goToTaskList(); + cy.getTaskID(taskName).then(($taskID) => { + cy.deleteTask(taskName, $taskID); + }); + }); + + describe(`Testing "${labelName}"`, () => { + it('Create a task with chunk size === 1. Open the task.', () => { + cy.createAnnotationTask( + taskName, + labelName, + attrName, + textDefaultValue, + archiveName, + null, + advancedConfigurationParams, + ); + cy.openTaskJob(taskName); + }); + it('Create a shape on the first frame.', () => { + cy.createRectangle(createRectangleShape2Points); + }); + it('Go to another frame. During this procedure open context menu for a shape.', () => { + cy.get('body').type('f'); + cy.get('#cvat_canvas_shape_1').trigger('mousemove').rightclick(); + }); + it('Page with the error is missing', () => { + cy.get('.cvat-global-boundary').should('not.exist'); + }); + }); +}); diff --git a/tests/cypress/support/commands.js b/tests/cypress/support/commands.js index 695007b3..c4454500 100644 --- a/tests/cypress/support/commands.js +++ b/tests/cypress/support/commands.js @@ -116,12 +116,17 @@ Cypress.Commands.add('createRectangle', (createRectangleParams) => { }); Cypress.Commands.add('switchLabel', (labelName, objectType) => { - const pattern = `^(Draw new|Setup) ${objectType}$` - const regex = new RegExp(pattern, 'g'); - cy.contains(regex).parents('.cvat-draw-shape-popover-content').within(() => { - cy.get('.ant-select-selection-selected-value').click(); - }); - cy.get('.ant-select-dropdown').not('.ant-select-dropdown-hidden').contains(new RegExp(`^${labelName}$`, 'g')).click(); + const pattern = `^(Draw new|Setup) ${objectType}$`; + const regex = new RegExp(pattern, 'g'); + cy.contains(regex) + .parents('.cvat-draw-shape-popover-content') + .within(() => { + cy.get('.ant-select-selection-selected-value').click(); + }); + cy.get('.ant-select-dropdown') + .not('.ant-select-dropdown-hidden') + .contains(new RegExp(`^${labelName}$`, 'g')) + .click(); }); Cypress.Commands.add('checkObjectParameters', (objectParameters, objectType) => { @@ -236,7 +241,10 @@ Cypress.Commands.add('changeLabelAAM', (labelName) => { cy.get('.attribute-annotation-sidebar-basics-editor').within(() => { cy.get('.ant-select-selection').click(); }); - cy.get('.ant-select-dropdown').not('.ant-select-dropdown-hidden').contains(new RegExp(`^${labelName}$`, 'g')).click(); + cy.get('.ant-select-dropdown') + .not('.ant-select-dropdown-hidden') + .contains(new RegExp(`^${labelName}$`, 'g')) + .click(); } }); }); @@ -326,6 +334,9 @@ Cypress.Commands.add('advancedConfiguration', (advancedConfigurationParams) => { cy.get('#stopFrame').type(advancedConfigurationParams.stopFrame); cy.get('#frameStep').type(advancedConfigurationParams.frameStep); } + if (advancedConfigurationParams.chunkSize) { + cy.get('#dataChunkSize').type(advancedConfigurationParams.chunkSize); + } }); Cypress.Commands.add('removeAnnotations', () => { @@ -360,7 +371,9 @@ Cypress.Commands.add('addNewLabel', (newLabelName) => { Cypress.Commands.add('createTag', (labelName) => { cy.get('.cvat-setup-tag-control').click(); cy.switchLabel(labelName, 'tag'); - cy.contains('Setup tag').parents('.cvat-draw-shape-popover-content').within(() => { - cy.get('button').click(); - }); + cy.contains('Setup tag') + .parents('.cvat-draw-shape-popover-content') + .within(() => { + cy.get('button').click(); + }); }); From 897036f00f330bb3591258c1bf54006878ddafb7 Mon Sep 17 00:00:00 2001 From: Kruchinin Date: Wed, 25 Nov 2020 08:55:15 +0300 Subject: [PATCH 15/21] Cypress test. Rotate all images feature. --- .../case_19_all_image_rotate_features.js | 60 +++++++++++++++++++ 1 file changed, 60 insertions(+) create mode 100644 tests/cypress/integration/actions_tasks_objects/case_19_all_image_rotate_features.js diff --git a/tests/cypress/integration/actions_tasks_objects/case_19_all_image_rotate_features.js b/tests/cypress/integration/actions_tasks_objects/case_19_all_image_rotate_features.js new file mode 100644 index 00000000..e2f337c9 --- /dev/null +++ b/tests/cypress/integration/actions_tasks_objects/case_19_all_image_rotate_features.js @@ -0,0 +1,60 @@ +// Copyright (C) 2020 Intel Corporation +// +// SPDX-License-Identifier: MIT + +/// + +import { taskName } from '../../support/const'; + +context('Check if the image is rotated', () => { + const caseId = '19'; + + function imageRotate(direction = 'anticlockwise') { + cy.get('.cvat-rotate-canvas-control').trigger('mouseover'); + if (direction === 'clockwise') { + cy.get('.cvat-rotate-canvas-controls-right').click(); + } else { + cy.get('.cvat-rotate-canvas-controls-left').click(); + } + } + + before(() => { + cy.openTaskJob(taskName); + }); + + describe(`Testing case "${caseId}"`, () => { + it('Rotate an image (once clockwise, twice anticlockwise)', () => { + imageRotate('clockwise'); + cy.get('#cvat_canvas_background').should('have.attr', 'style').and('contain', 'rotate(90deg);'); + imageRotate('anticlockwise'); + cy.get('#cvat_canvas_background').should('have.attr', 'style').and('contain', 'rotate(0deg);'); + imageRotate('anticlockwise'); + cy.get('#cvat_canvas_background').should('have.attr', 'style').and('contain', 'rotate(270deg);'); + }); + + it("Go to the next frame. It wasn't rotated.", () => { + cy.get('.cvat-player-next-button').click(); + cy.get('#cvat_canvas_background').should('have.attr', 'style').and('contain', 'rotate(0deg);'); + }); + + it('Go to settings, set "Rotate all images" to true.', () => { + cy.openSettings(); + cy.get('.cvat-player-settings-rotate-all-checkbox').click(); + cy.closeSettings(); + }); + + it('Rotate current frame 180 deg.', () => { + imageRotate('clockwise'); + cy.get('#cvat_canvas_background').should('have.attr', 'style').and('contain', 'rotate(90deg);'); + imageRotate('clockwise'); + cy.get('#cvat_canvas_background').should('have.attr', 'style').and('contain', 'rotate(180deg);'); + }); + + it('Go to the previous and to the next frame. They are also rotated 180 deg.', () => { + cy.get('.cvat-player-previous-button').click(); + cy.get('#cvat_canvas_background').should('have.attr', 'style').and('contain', 'rotate(180deg);'); + cy.get('.cvat-player-next-button').click(); + cy.get('#cvat_canvas_background').should('have.attr', 'style').and('contain', 'rotate(180deg);'); + }); + }); +}); From 4ca3c8bc32f996e8e85ffa7d0ec0aca56962def3 Mon Sep 17 00:00:00 2001 From: Kruchinin Date: Wed, 25 Nov 2020 09:01:36 +0300 Subject: [PATCH 16/21] Some updates. --- .../case_19_all_image_rotate_features.js | 20 ++++++++----------- 1 file changed, 8 insertions(+), 12 deletions(-) diff --git a/tests/cypress/integration/actions_tasks_objects/case_19_all_image_rotate_features.js b/tests/cypress/integration/actions_tasks_objects/case_19_all_image_rotate_features.js index e2f337c9..47730ea3 100644 --- a/tests/cypress/integration/actions_tasks_objects/case_19_all_image_rotate_features.js +++ b/tests/cypress/integration/actions_tasks_objects/case_19_all_image_rotate_features.js @@ -6,16 +6,17 @@ import { taskName } from '../../support/const'; -context('Check if the image is rotated', () => { +context('Rotate all images feature.', () => { const caseId = '19'; - function imageRotate(direction = 'anticlockwise') { + function imageRotate(direction = 'anticlockwise', deg) { cy.get('.cvat-rotate-canvas-control').trigger('mouseover'); if (direction === 'clockwise') { cy.get('.cvat-rotate-canvas-controls-right').click(); } else { cy.get('.cvat-rotate-canvas-controls-left').click(); } + cy.get('#cvat_canvas_background').should('have.attr', 'style').and('contain', `rotate(${deg}deg);`); } before(() => { @@ -24,12 +25,9 @@ context('Check if the image is rotated', () => { describe(`Testing case "${caseId}"`, () => { it('Rotate an image (once clockwise, twice anticlockwise)', () => { - imageRotate('clockwise'); - cy.get('#cvat_canvas_background').should('have.attr', 'style').and('contain', 'rotate(90deg);'); - imageRotate('anticlockwise'); - cy.get('#cvat_canvas_background').should('have.attr', 'style').and('contain', 'rotate(0deg);'); - imageRotate('anticlockwise'); - cy.get('#cvat_canvas_background').should('have.attr', 'style').and('contain', 'rotate(270deg);'); + imageRotate('clockwise', 90); + imageRotate('anticlockwise', 0); + imageRotate('anticlockwise', 270); }); it("Go to the next frame. It wasn't rotated.", () => { @@ -44,10 +42,8 @@ context('Check if the image is rotated', () => { }); it('Rotate current frame 180 deg.', () => { - imageRotate('clockwise'); - cy.get('#cvat_canvas_background').should('have.attr', 'style').and('contain', 'rotate(90deg);'); - imageRotate('clockwise'); - cy.get('#cvat_canvas_background').should('have.attr', 'style').and('contain', 'rotate(180deg);'); + imageRotate('clockwise', 90); + imageRotate('clockwise', 180); }); it('Go to the previous and to the next frame. They are also rotated 180 deg.', () => { From 7352d3970830956afee628fc0aa32c19ad6eff46 Mon Sep 17 00:00:00 2001 From: Kruchinin Date: Wed, 25 Nov 2020 09:35:44 +0300 Subject: [PATCH 17/21] Add/replace functions. --- .../case_19_all_image_rotate_features.js | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/tests/cypress/integration/actions_tasks_objects/case_19_all_image_rotate_features.js b/tests/cypress/integration/actions_tasks_objects/case_19_all_image_rotate_features.js index 47730ea3..a33e5003 100644 --- a/tests/cypress/integration/actions_tasks_objects/case_19_all_image_rotate_features.js +++ b/tests/cypress/integration/actions_tasks_objects/case_19_all_image_rotate_features.js @@ -16,6 +16,10 @@ context('Rotate all images feature.', () => { } else { cy.get('.cvat-rotate-canvas-controls-left').click(); } + checkDegRotate(deg); + } + + function checkDegRotate(deg) { cy.get('#cvat_canvas_background').should('have.attr', 'style').and('contain', `rotate(${deg}deg);`); } @@ -32,7 +36,7 @@ context('Rotate all images feature.', () => { it("Go to the next frame. It wasn't rotated.", () => { cy.get('.cvat-player-next-button').click(); - cy.get('#cvat_canvas_background').should('have.attr', 'style').and('contain', 'rotate(0deg);'); + checkDegRotate(0); }); it('Go to settings, set "Rotate all images" to true.', () => { @@ -48,9 +52,9 @@ context('Rotate all images feature.', () => { it('Go to the previous and to the next frame. They are also rotated 180 deg.', () => { cy.get('.cvat-player-previous-button').click(); - cy.get('#cvat_canvas_background').should('have.attr', 'style').and('contain', 'rotate(180deg);'); + checkDegRotate(180); cy.get('.cvat-player-next-button').click(); - cy.get('#cvat_canvas_background').should('have.attr', 'style').and('contain', 'rotate(180deg);'); + checkDegRotate(180); }); }); }); From 1f43a2b96e2c7dfae509da622e27c609ddaa7b68 Mon Sep 17 00:00:00 2001 From: Boris Sekachev Date: Wed, 25 Nov 2020 15:11:38 +0300 Subject: [PATCH 18/21] Added css classes for cypress --- .../objects-side-bar/objects-list-header.tsx | 6 +++++- .../components/header/settings-modal/player-settings.tsx | 7 +++++-- 2 files changed, 10 insertions(+), 3 deletions(-) diff --git a/cvat-ui/src/components/annotation-page/standard-workspace/objects-side-bar/objects-list-header.tsx b/cvat-ui/src/components/annotation-page/standard-workspace/objects-side-bar/objects-list-header.tsx index b1d2e068..2652f418 100644 --- a/cvat-ui/src/components/annotation-page/standard-workspace/objects-side-bar/objects-list-header.tsx +++ b/cvat-ui/src/components/annotation-page/standard-workspace/objects-side-bar/objects-list-header.tsx @@ -23,7 +23,11 @@ function StatesOrderingSelectorComponent(props: StatesOrderingSelectorComponentP return ( Sort by - {StatesOrdering.ID_DESCENT} diff --git a/cvat-ui/src/components/header/settings-modal/player-settings.tsx b/cvat-ui/src/components/header/settings-modal/player-settings.tsx index b0cf037a..943188fb 100644 --- a/cvat-ui/src/components/header/settings-modal/player-settings.tsx +++ b/cvat-ui/src/components/header/settings-modal/player-settings.tsx @@ -138,13 +138,13 @@ export default function PlayerSettingsComponent(props: Props): JSX.Element { onChangeCanvasBackgroundColor(e.hex)} /> - } + )} overlayClassName='canvas-background-color-picker-popover' trigger='click' > @@ -169,6 +169,7 @@ export default function PlayerSettingsComponent(props: Props): JSX.Element { Grid size Grid color