From ec5ef71454b19628edb8aa13c12b5986e7b7c7e7 Mon Sep 17 00:00:00 2001 From: dvkruchinin Date: Mon, 19 Jul 2021 10:40:39 +0300 Subject: [PATCH 1/4] Cypress test. Save filtered object in AAM. --- .../case_99_save_filtered_object_in_AAM.js | 49 +++++++++++++++++++ 1 file changed, 49 insertions(+) create mode 100644 tests/cypress/integration/actions_objects2/case_99_save_filtered_object_in_AAM.js diff --git a/tests/cypress/integration/actions_objects2/case_99_save_filtered_object_in_AAM.js b/tests/cypress/integration/actions_objects2/case_99_save_filtered_object_in_AAM.js new file mode 100644 index 000000000000..7cbf823d5aa1 --- /dev/null +++ b/tests/cypress/integration/actions_objects2/case_99_save_filtered_object_in_AAM.js @@ -0,0 +1,49 @@ +// Copyright (C) 2021 Intel Corporation +// +// SPDX-License-Identifier: MIT + +/// + +import { labelName, taskName } from '../../support/const'; + +context('Save filtered object in AAM.', () => { + const caseId = '99'; + const newLabelName = `New label for case ${caseId}`; + const createCuboidShape2Points = { + points: 'From rectangle', + type: 'Shape', + labelName: labelName, + firstX: 250, + firstY: 350, + secondX: 350, + secondY: 450, + }; + + before(() => { + cy.openTask(taskName); + cy.addNewLabel(newLabelName); + cy.openJob(); + cy.createCuboid(createCuboidShape2Points); + }); + + describe(`Testing case "${caseId}"`, () => { + it(`Set filter label == “${labelName}”.`, () => { + cy.addFiltersRule(0); + cy.setFilter({ + groupIndex: 0, + ruleIndex: 0, + field: 'Label', + operator: '==', + value: labelName, + submit: true, + }); + }); + + it(`Go to AAM and change a label for the shape. Save the changes. UI is not failed.`, () => { + cy.changeWorkspace('Attribute annotation', newLabelName); + cy.saveJob(); + cy.get('#cvat_canvas_shape_1').should('not.exist'); + cy.get('.attribute-annotations-sidebar-not-found-wrapper').should('exist'); + }); + }); +}); From 854affe7f117494b9debc457c9eb5fb38897c1b6 Mon Sep 17 00:00:00 2001 From: dvkruchinin Date: Mon, 19 Jul 2021 11:19:37 +0300 Subject: [PATCH 2/4] Update cypress command --- tests/cypress/support/commands.js | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/tests/cypress/support/commands.js b/tests/cypress/support/commands.js index 90176c1efeff..217e23164f2a 100644 --- a/tests/cypress/support/commands.js +++ b/tests/cypress/support/commands.js @@ -398,10 +398,7 @@ Cypress.Commands.add('changeLabelAAM', (labelName) => { cy.get('.ant-select-selector').click(); }); cy.get('.ant-select-dropdown') - .not('.ant-select-dropdown-hidden') - .within(() => { - cy.get(`.ant-select-item-option[title="${labelName}"]`).click(); - }); + .not('.ant-select-dropdown-hidden').find(`[title="${labelName}"]`).click() } }); }); From 42609efa95ff567cff1216ff2a08da35da40ca70 Mon Sep 17 00:00:00 2001 From: dvkruchinin Date: Mon, 19 Jul 2021 12:13:23 +0300 Subject: [PATCH 3/4] Revert changes for cypress command. Moved the test. --- .../case_99_save_filtered_object_in_AAM.js | 0 tests/cypress/support/commands.js | 5 ++++- 2 files changed, 4 insertions(+), 1 deletion(-) rename tests/cypress/integration/{actions_objects2 => actions_objects}/case_99_save_filtered_object_in_AAM.js (100%) diff --git a/tests/cypress/integration/actions_objects2/case_99_save_filtered_object_in_AAM.js b/tests/cypress/integration/actions_objects/case_99_save_filtered_object_in_AAM.js similarity index 100% rename from tests/cypress/integration/actions_objects2/case_99_save_filtered_object_in_AAM.js rename to tests/cypress/integration/actions_objects/case_99_save_filtered_object_in_AAM.js diff --git a/tests/cypress/support/commands.js b/tests/cypress/support/commands.js index 217e23164f2a..90176c1efeff 100644 --- a/tests/cypress/support/commands.js +++ b/tests/cypress/support/commands.js @@ -398,7 +398,10 @@ Cypress.Commands.add('changeLabelAAM', (labelName) => { cy.get('.ant-select-selector').click(); }); cy.get('.ant-select-dropdown') - .not('.ant-select-dropdown-hidden').find(`[title="${labelName}"]`).click() + .not('.ant-select-dropdown-hidden') + .within(() => { + cy.get(`.ant-select-item-option[title="${labelName}"]`).click(); + }); } }); }); From 82199097b109b7e9faeb3702af13951853405f9a Mon Sep 17 00:00:00 2001 From: dvkruchinin Date: Mon, 19 Jul 2021 14:54:28 +0300 Subject: [PATCH 4/4] Splited "changeWorkspace" and "changeLabelAAM" commands. --- .../actions_objects/case_99_save_filtered_object_in_AAM.js | 3 ++- .../integration/actions_tasks/case_70_mutable_attribute.js | 3 ++- .../case_32_attribute_annotation_mode_zoom_margin_feature.js | 3 ++- .../integration/issues_prs/issue_2486_not_edit_object_aam.js | 3 ++- .../pr_2203_error_cannot_read_property_at_saving_job.js | 3 ++- ...e_1425_highlighted_attribute_correspond_chosen_attribute.js | 3 ++- .../issues_prs2/issue_1750_err_aam_switch_frames.js | 3 ++- tests/cypress/support/commands.js | 3 +-- 8 files changed, 15 insertions(+), 9 deletions(-) diff --git a/tests/cypress/integration/actions_objects/case_99_save_filtered_object_in_AAM.js b/tests/cypress/integration/actions_objects/case_99_save_filtered_object_in_AAM.js index 7cbf823d5aa1..eec692654695 100644 --- a/tests/cypress/integration/actions_objects/case_99_save_filtered_object_in_AAM.js +++ b/tests/cypress/integration/actions_objects/case_99_save_filtered_object_in_AAM.js @@ -40,7 +40,8 @@ context('Save filtered object in AAM.', () => { }); it(`Go to AAM and change a label for the shape. Save the changes. UI is not failed.`, () => { - cy.changeWorkspace('Attribute annotation', newLabelName); + cy.changeWorkspace('Attribute annotation'); + cy.changeLabelAAM(newLabelName); cy.saveJob(); cy.get('#cvat_canvas_shape_1').should('not.exist'); cy.get('.attribute-annotations-sidebar-not-found-wrapper').should('exist'); diff --git a/tests/cypress/integration/actions_tasks/case_70_mutable_attribute.js b/tests/cypress/integration/actions_tasks/case_70_mutable_attribute.js index f6906736a047..7fcdf0711823 100644 --- a/tests/cypress/integration/actions_tasks/case_70_mutable_attribute.js +++ b/tests/cypress/integration/actions_tasks/case_70_mutable_attribute.js @@ -50,7 +50,8 @@ context('Mutable attribute.', () => { describe(`Testing case "${caseId}"`, () => { it('Go to AAM. For the 2nd and 3rd frames, change the attribute value.', () => { - cy.changeWorkspace('Attribute annotation', labelTrack); + cy.changeWorkspace('Attribute annotation'); + cy.changeLabelAAM(labelTrack); testChangingAttributeValue(additionalAttrsLabelShape[0].additionalValue, attrValueSecondFrame); testChangingAttributeValue(attrValueSecondFrame, attrValueThirdFrame); }); diff --git a/tests/cypress/integration/actions_tasks2/case_32_attribute_annotation_mode_zoom_margin_feature.js b/tests/cypress/integration/actions_tasks2/case_32_attribute_annotation_mode_zoom_margin_feature.js index 2ad22d12983e..25ef0be73b4a 100644 --- a/tests/cypress/integration/actions_tasks2/case_32_attribute_annotation_mode_zoom_margin_feature.js +++ b/tests/cypress/integration/actions_tasks2/case_32_attribute_annotation_mode_zoom_margin_feature.js @@ -37,7 +37,8 @@ context('Attribute annotation mode (AAM) zoom margin feature', () => { cy.createTag(labelName); // go to AAM workspace - cy.changeWorkspace('Attribute annotation', labelName); + cy.changeWorkspace('Attribute annotation'); + cy.changeLabelAAM(labelName); }); describe(`Testing case "${caseId}"`, () => { diff --git a/tests/cypress/integration/issues_prs/issue_2486_not_edit_object_aam.js b/tests/cypress/integration/issues_prs/issue_2486_not_edit_object_aam.js index f66fb07b0ba7..2574d1632801 100644 --- a/tests/cypress/integration/issues_prs/issue_2486_not_edit_object_aam.js +++ b/tests/cypress/integration/issues_prs/issue_2486_not_edit_object_aam.js @@ -34,7 +34,8 @@ context("Object can't be draggable/resizable in AAM", () => { }); it.skip('Go to AAM', () => { - cy.changeWorkspace('Attribute annotation', labelName); + cy.changeWorkspace('Attribute annotation'); + cy.changeLabelAAM(labelName); cy.get('#cvat_canvas_shape_1') .then((shape) => { shapeXPos = Math.floor(shape.attr('x')); diff --git a/tests/cypress/integration/issues_prs/pr_2203_error_cannot_read_property_at_saving_job.js b/tests/cypress/integration/issues_prs/pr_2203_error_cannot_read_property_at_saving_job.js index 9e8b52d43abf..4202dd5718d6 100644 --- a/tests/cypress/integration/issues_prs/pr_2203_error_cannot_read_property_at_saving_job.js +++ b/tests/cypress/integration/issues_prs/pr_2203_error_cannot_read_property_at_saving_job.js @@ -33,7 +33,8 @@ context('Check error сannot read property at saving job', () => { }); it('Go to AAM', () => { - cy.changeWorkspace('Attribute annotation', labelName); + cy.changeWorkspace('Attribute annotation'); + cy.changeLabelAAM(labelName); }); it('Save job and go to previous frame at saving job', () => { diff --git a/tests/cypress/integration/issues_prs2/issue_1425_highlighted_attribute_correspond_chosen_attribute.js b/tests/cypress/integration/issues_prs2/issue_1425_highlighted_attribute_correspond_chosen_attribute.js index 0aed69a0adef..5a5b23fae8f9 100644 --- a/tests/cypress/integration/issues_prs2/issue_1425_highlighted_attribute_correspond_chosen_attribute.js +++ b/tests/cypress/integration/issues_prs2/issue_1425_highlighted_attribute_correspond_chosen_attribute.js @@ -28,7 +28,8 @@ context('The highlighted attribute in AAM should correspond to the chosen attrib cy.createRectangle(createRectangleShape2Points); }); it('Go to AAM', () => { - cy.changeWorkspace('Attribute annotation', labelName); + cy.changeWorkspace('Attribute annotation'); + cy.changeLabelAAM(labelName); }); it('Check if highlighted attribute correspond to the chosen attribute in right panel', () => { cy.get('.cvat_canvas_text').within(() => { diff --git a/tests/cypress/integration/issues_prs2/issue_1750_err_aam_switch_frames.js b/tests/cypress/integration/issues_prs2/issue_1750_err_aam_switch_frames.js index 98a2ac8b3b13..b867733ce347 100644 --- a/tests/cypress/integration/issues_prs2/issue_1750_err_aam_switch_frames.js +++ b/tests/cypress/integration/issues_prs2/issue_1750_err_aam_switch_frames.js @@ -37,7 +37,8 @@ context('An error occurs in AAM when switching to 2 frames, if the frames have o cy.createRectangle(createRectangleShape2PointsSecond); }); it('Go to AAM', () => { - cy.changeWorkspace('Attribute annotation', labelName); + cy.changeWorkspace('Attribute annotation'); + cy.changeLabelAAM(labelName); }); it('Go to next frame', () => { cy.get('.cvat-player-next-button').click(); diff --git a/tests/cypress/support/commands.js b/tests/cypress/support/commands.js index 90176c1efeff..764a4be5430d 100644 --- a/tests/cypress/support/commands.js +++ b/tests/cypress/support/commands.js @@ -380,14 +380,13 @@ Cypress.Commands.add('saveSettings', () => { }); }); -Cypress.Commands.add('changeWorkspace', (mode, labelName) => { +Cypress.Commands.add('changeWorkspace', (mode) => { cy.get('.cvat-workspace-selector').click(); cy.get('.cvat-workspace-selector-dropdown').within(() => { cy.get(`.ant-select-item-option[title="${mode}"]`).click(); }); cy.get('.cvat-workspace-selector').should('contain.text', mode); - cy.changeLabelAAM(labelName); }); Cypress.Commands.add('changeLabelAAM', (labelName) => {