diff --git a/tests/cypress/integration/canvas3d_functionality/case_78_canvas3d_functionality_cuboid_label.js b/tests/cypress/integration/canvas3d_functionality/case_78_canvas3d_functionality_cuboid_label.js new file mode 100644 index 0000000000000000000000000000000000000000..7002154e126d6b64002244d35007ec04d35b74ea --- /dev/null +++ b/tests/cypress/integration/canvas3d_functionality/case_78_canvas3d_functionality_cuboid_label.js @@ -0,0 +1,176 @@ +// Copyright (C) 2021 Intel Corporation +// +// SPDX-License-Identifier: MIT + +/// + +import { taskName, labelName } from '../../support/const_canvas3d'; + +context('Canvas 3D functionality. Interaction with cuboid via sidebar.', () => { + const caseId = '78'; + const secondLabel = 'car'; + + const screenshotsPath = 'cypress/screenshots/canvas3d_functionality/case_78_canvas3d_functionality_cuboid_label.js'; + const cuboidCreationParams = { + labelName: labelName, + }; + + before(() => { + cy.openTask(taskName) + cy.addNewLabel(secondLabel); + cy.openJob(); + cy.wait(1000); // Waiting for the point cloud to display + cy.get('.cvat-canvas3d-perspective').screenshot('canvas3d_perspective_before_all'); + ['topview', 'sideview', 'frontview'].forEach((view) => { + cy.get(`.cvat-canvas3d-${view}`) + .find('.cvat-canvas3d-fullsize') + .screenshot(`canvas3d_${view}_before_all`); + }); + cy.create3DCuboid(cuboidCreationParams); + }); + + describe(`Testing case "${caseId}"`, () => { + it('Activate a cuboid on sidear.', () => { + cy.get('#cvat-objects-sidebar-state-item-1') + .trigger('mouseover') + .should('have.class', 'cvat-objects-sidebar-state-active-item') + .wait(1000); //Wating for cuboid activation + cy.get('.cvat-canvas3d-perspective').screenshot('canvas3d_perspective_after_activating_cuboid'); + cy.compareImagesAndCheckResult( + `${screenshotsPath}/canvas3d_perspective_before_all.png`, + `${screenshotsPath}/canvas3d_perspective_after_activating_cuboid.png`, + ); + ['topview', 'sideview', 'frontview'].forEach((view) => { + cy.get(`.cvat-canvas3d-${view}`) + .find('.cvat-canvas3d-fullsize') + .screenshot(`canvas3d_${view}_activating_cuboid`); + }); + [ + ['canvas3d_topview_before_all.png', 'canvas3d_topview_activating_cuboid.png'], + ['canvas3d_sideview_before_all.png', 'canvas3d_sideview_activating_cuboid.png'], + ['canvas3d_frontview_before_all.png', 'canvas3d_frontview_activating_cuboid.png'], + ].forEach(([viewBefore, viewAfterCubiodActivation]) => { + cy.compareImagesAndCheckResult(`${screenshotsPath}/${viewBefore}`, `${screenshotsPath}/${viewAfterCubiodActivation}`); + }); + }); + + it('Change a label via sidear.', () => { + cy.get('#cvat-objects-sidebar-state-item-1') + .find('.cvat-objects-sidebar-state-item-label-selector') + .type(`${secondLabel}{Enter}`) + .trigger('mouseout'); + cy.get('.cvat-canvas3d-perspective').screenshot('canvas3d_perspective_after_change_label_cuboid'); + cy.compareImagesAndCheckResult( + `${screenshotsPath}/canvas3d_perspective_after_activating_cuboid.png`, + `${screenshotsPath}/canvas3d_perspective_after_change_label_cuboid.png`, + ); + ['topview', 'sideview', 'frontview'].forEach((view) => { + cy.get(`.cvat-canvas3d-${view}`) + .find('.cvat-canvas3d-fullsize') + .screenshot(`canvas3d_${view}_change_label_cuboid`); + }); + [ + ['canvas3d_topview_activating_cuboid.png', 'canvas3d_topview_change_label_cuboid.png'], + ['canvas3d_sideview_activating_cuboid.png', 'canvas3d_sideview_change_label_cuboid.png'], + ['canvas3d_frontview_activating_cuboid.png', 'canvas3d_frontview_change_label_cuboid.png'], + ].forEach(([viewAfterCubiodActivation, viewAfterCubiodChangeLabel]) => { + cy.compareImagesAndCheckResult(`${screenshotsPath}/${viewAfterCubiodActivation}`, `${screenshotsPath}/${viewAfterCubiodChangeLabel}`); + }); + }); + + it('Lock/unlock a cuboid via sidear. The control points of the cuboid on the top/side/front view are locked/unlocked.', () => { + cy.get('#cvat-objects-sidebar-state-item-1') + .find('.cvat-object-item-button-lock') + .click(); // Lock the cubiod + cy.get('.cvat-object-item-button-lock-enabled').should('exist').trigger('mouseout'); + ['topview', 'sideview', 'frontview'].forEach((view) => { + cy.get(`.cvat-canvas3d-${view}`) + .find('.cvat-canvas3d-fullsize') + .screenshot(`canvas3d_${view}_lock_cuboid`); + }); + [ + ['canvas3d_topview_change_label_cuboid.png', 'canvas3d_topview_lock_cuboid.png'], + ['canvas3d_sideview_change_label_cuboid.png', 'canvas3d_sideview_lock_cuboid.png'], + ['canvas3d_frontview_change_label_cuboid.png', 'canvas3d_frontview_lock_cuboid.png'], + ].forEach(([viewAfterCubiodChangeLabel, viewAfterCubiodLock]) => { + cy.compareImagesAndCheckResult(`${screenshotsPath}/${viewAfterCubiodChangeLabel}`, `${screenshotsPath}/${viewAfterCubiodLock}`); + }); + cy.get('.cvat-object-item-button-lock-enabled').click(); // Unlock the cubiod + cy.get('.cvat-object-item-button-lock').should('exist').trigger('mouseout'); + ['topview', 'sideview', 'frontview'].forEach((view) => { + cy.get(`.cvat-canvas3d-${view}`) + .find('.cvat-canvas3d-fullsize') + .screenshot(`canvas3d_${view}_unlock_cuboid`); + }); + [ + ['canvas3d_topview_lock_cuboid.png', 'canvas3d_topview_unlock_cuboid.png'], + ['canvas3d_sideview_lock_cuboid.png', 'canvas3d_sideview_unlock_cuboid.png'], + ['canvas3d_frontview_lock_cuboid.png', 'canvas3d_frontview_unlock_cuboid.png'], + ].forEach(([viewAfterCubiodLock, viewAfterCubiodUnlock]) => { + cy.compareImagesAndCheckResult(`${screenshotsPath}/${viewAfterCubiodLock}`, `${screenshotsPath}/${viewAfterCubiodUnlock}`); + }); + }); + + it('Switch occluded property for a cuboid via sidear. The cuboid on the perpective view are occluded.', () => { + cy.get('#cvat-objects-sidebar-state-item-1') + .find('.cvat-object-item-button-occluded') + .click(); // Switch occluded property + cy.get('.cvat-object-item-button-occluded-enabled').should('exist').trigger('mouseout'); + cy.get('.cvat-canvas3d-perspective').screenshot('canvas3d_perspective_enable_occlud_cuboid'); + cy.compareImagesAndCheckResult( + `${screenshotsPath}/canvas3d_perspective_after_activating_cuboid.png`, + `${screenshotsPath}/canvas3d_perspective_enable_occlud_cuboid.png`, + ); + cy.get('.cvat-object-item-button-occluded-enabled').click(); // Switch occluded property again + cy.get('.cvat-object-item-button-occluded').should('exist').trigger('mouseout'); + cy.get('.cvat-canvas3d-perspective').screenshot('canvas3d_perspective_disable_occlud_cuboid'); + cy.compareImagesAndCheckResult( + `${screenshotsPath}/canvas3d_perspective_enable_occlud_cuboid.png`, + `${screenshotsPath}/canvas3d_perspective_disable_occlud_cuboid.png`, + ); + }); + + it('Hide/unhide a cuboid via sidear. The cuboid on the perpective/top/side/front view be hidden/unhidden.', () => { + cy.get('#cvat-objects-sidebar-state-item-1') + .find('.cvat-object-item-button-hidden') + .click(); // Hide the cuboid + cy.get('.cvat-object-item-button-hidden-enabled').should('exist').trigger('mouseout'); + cy.get('.cvat-canvas3d-perspective').screenshot('canvas3d_perspective_hide_cuboid'); + cy.compareImagesAndCheckResult( + `${screenshotsPath}/canvas3d_perspective_disable_occlud_cuboid.png`, + `${screenshotsPath}/canvas3d_perspective_hide_cuboid.png`, + ); + ['topview', 'sideview', 'frontview'].forEach((view) => { + cy.get(`.cvat-canvas3d-${view}`) + .find('.cvat-canvas3d-fullsize') + .screenshot(`canvas3d_${view}_hide_cuboid`); + }); + [ + ['canvas3d_topview_unlock_cuboid.png', 'canvas3d_topview_hide_cuboid.png'], + ['canvas3d_sideview_unlock_cuboid.png', 'canvas3d_sideview_hide_cuboid.png'], + ['canvas3d_frontview_unlock_cuboid.png', 'canvas3d_frontview_hide_cuboid.png'], + ].forEach(([viewAfterCubiodUnlock, viewAfterCubiodHide]) => { + cy.compareImagesAndCheckResult(`${screenshotsPath}/${viewAfterCubiodUnlock}`, `${screenshotsPath}/${viewAfterCubiodHide}`); + }); + cy.get('.cvat-object-item-button-hidden-enabled').click(); // Unhide the cuboid + cy.get('.cvat-object-item-button-hidden').should('exist').trigger('mouseout'); + cy.get('.cvat-canvas3d-perspective').screenshot('canvas3d_perspective_unhide_cuboid'); + cy.compareImagesAndCheckResult( + `${screenshotsPath}/canvas3d_perspective_hide_cuboid.png`, + `${screenshotsPath}/canvas3d_perspective_unhide_cuboid.png`, + ); + ['topview', 'sideview', 'frontview'].forEach((view) => { + cy.get(`.cvat-canvas3d-${view}`) + .find('.cvat-canvas3d-fullsize') + .screenshot(`canvas3d_${view}_unhide_cuboid`); + }); + [ + ['canvas3d_topview_hide_cuboid.png', 'canvas3d_topview_unhide_cuboid.png'], + ['canvas3d_sideview_hide_cuboid.png', 'canvas3d_sideview_unhide_cuboid.png'], + ['canvas3d_frontview_hide_cuboid.png', 'canvas3d_frontview_unhide_cuboid.png'], + ].forEach(([viewAfterCubiodHide, viewAfterCubiodUnhide]) => { + cy.compareImagesAndCheckResult(`${screenshotsPath}/${viewAfterCubiodHide}`, `${screenshotsPath}/${viewAfterCubiodUnhide}`); + }); + }); + }); +}); diff --git a/tests/cypress/integration/canvas3d_functionality/case_79_canvas3d_functionality_cuboid_context_menu.js b/tests/cypress/integration/canvas3d_functionality/case_79_canvas3d_functionality_cuboid_context_menu.js new file mode 100644 index 0000000000000000000000000000000000000000..5f348c323d039751e478cc109aff302e26607fde --- /dev/null +++ b/tests/cypress/integration/canvas3d_functionality/case_79_canvas3d_functionality_cuboid_context_menu.js @@ -0,0 +1,33 @@ +// Copyright (C) 2021 Intel Corporation +// +// SPDX-License-Identifier: MIT + +/// + +import { taskName, labelName } from '../../support/const_canvas3d'; + +context('Canvas 3D functionality. Cuboid context menu.', () => { + const caseId = '79'; + const cuboidCreationParams = { + labelName: labelName, + }; + + before(() => { + cy.openTask(taskName) + cy.openJob(); + cy.wait(1000); // Waiting for the point cloud to display + cy.create3DCuboid(cuboidCreationParams); + }); + + describe(`Testing case "${caseId}"`, () => { + it('Right click on the cuboid. Context menu should exist.', () => { + cy.get('.cvat-canvas3d-perspective').rightclick(); + cy.get('.cvat-canvas-context-menu').should('exist'); + }); + + it('Right click outside the cuboid. Context menu should not exist.', () => { + cy.get('.cvat-canvas3d-perspective').click(100, 100); + cy.get('.cvat-canvas-context-menu').should('not.exist'); + }); + }); +}); diff --git a/tests/cypress/integration/canvas3d_functionality/case_80_canvas3d_functionality_cuboid_make_copy.js b/tests/cypress/integration/canvas3d_functionality/case_80_canvas3d_functionality_cuboid_make_copy.js new file mode 100644 index 0000000000000000000000000000000000000000..f501db1d08eb619af073c79757b4483a482b7046 --- /dev/null +++ b/tests/cypress/integration/canvas3d_functionality/case_80_canvas3d_functionality_cuboid_make_copy.js @@ -0,0 +1,52 @@ +// Copyright (C) 2021 Intel Corporation +// +// SPDX-License-Identifier: MIT + +/// + +import { taskName, labelName } from '../../support/const_canvas3d'; + +context('Canvas 3D functionality. Make a copy.', () => { + const caseId = '80'; + const secondLabel = 'car'; + const cuboidCreationParams = { + labelName: labelName, + }; + + before(() => { + cy.openTask(taskName) + cy.addNewLabel(secondLabel); + cy.openJob(); + cy.wait(1000); // Waiting for the point cloud to display + cy.create3DCuboid(cuboidCreationParams); + }); + + describe(`Testing case "${caseId}"`, () => { + it('Change a label and make a copy via sidebar.', () => { + cy.get('#cvat-objects-sidebar-state-item-1') + .find('.cvat-objects-sidebar-state-item-label-selector') + .type(`${secondLabel}{Enter}`) + .trigger('mouseout'); + cy.get('#cvat-objects-sidebar-state-item-1') + .find('[aria-label="more"]') + .click(); + cy.get('.ant-dropdown-menu').not('.ant-dropdown-menu-hidden').find('[aria-label="copy"]').click(); + cy.get('.cvat-canvas3d-perspective').trigger('mousemove', 300, 200).dblclick(300, 200); + cy.get('#cvat-objects-sidebar-state-item-1').invoke('attr', 'style').then((bgColor) => { + cy.get('#cvat-objects-sidebar-state-item-2').should('have.attr', 'style').and('equal', bgColor); + }); + }); + + it('Make a copy via hot keys.', () => { + cy.get('.cvat-canvas3d-perspective').trigger('mousemove', 100, 200).trigger('mousemove', 300, 200); + cy.get('body').type('{Ctrl}c').type('{Ctrl}v'); + cy.get('.cvat-canvas3d-perspective').trigger('mousemove', 350, 200).dblclick(350, 200); + cy.get('.cvat-objects-sidebar-state-item').then((sideBarItems) => { + expect(sideBarItems.length).to.be.equal(3); + }); + cy.get('#cvat-objects-sidebar-state-item-2').invoke('attr', 'style').then((bgColor) => { + cy.get('#cvat-objects-sidebar-state-item-3').should('have.attr', 'style').and('equal', bgColor); + }); + }); + }); +}); diff --git a/tests/cypress/integration/canvas3d_functionality/case_81_canvas3d_functionality_cuboid_propagate.js b/tests/cypress/integration/canvas3d_functionality/case_81_canvas3d_functionality_cuboid_propagate.js new file mode 100644 index 0000000000000000000000000000000000000000..c8e54896bff0d78271f959bb21b507205af34e37 --- /dev/null +++ b/tests/cypress/integration/canvas3d_functionality/case_81_canvas3d_functionality_cuboid_propagate.js @@ -0,0 +1,39 @@ +// Copyright (C) 2021 Intel Corporation +// +// SPDX-License-Identifier: MIT + +/// + +import { taskName, labelName } from '../../support/const_canvas3d'; + +context('Canvas 3D functionality. Cuboid propagate.', () => { + const caseId = '81'; + const cuboidCreationParams = { + labelName: labelName, + }; + + before(() => { + cy.openTask(taskName) + cy.openJob(); + cy.wait(1000); // Waiting for the point cloud to display + cy.create3DCuboid(cuboidCreationParams); + }); + + describe(`Testing case "${caseId}"`, () => { + it('Cuboid propagate.', () => { + cy.get('#cvat-objects-sidebar-state-item-1') + .find('[aria-label="more"]') + .click(); + cy.get('.ant-dropdown-menu').not('.ant-dropdown-menu-hidden').find('[aria-label="block"]').click(); + cy.get('.cvat-propagate-confirm-object-on-frames').should('exist'); + cy.contains('button', 'Yes').click(); + }); + + it('On a other frames the cuboid should exist.', () => { + cy.get('.cvat-player-next-button').click(); + cy.get('#cvat-objects-sidebar-state-item-2').should('exist'); + cy.get('.cvat-player-next-button').click(); + cy.get('#cvat-objects-sidebar-state-item-3').should('exist'); + }); + }); +}); diff --git a/tests/cypress/integration/canvas3d_functionality/case_82_canvas3d_functionality_cuboid_opacity_outlined_borders.js b/tests/cypress/integration/canvas3d_functionality/case_82_canvas3d_functionality_cuboid_opacity_outlined_borders.js new file mode 100644 index 0000000000000000000000000000000000000000..364ecb837ce9e34be8799bc1a120b423cdfcceb5 --- /dev/null +++ b/tests/cypress/integration/canvas3d_functionality/case_82_canvas3d_functionality_cuboid_opacity_outlined_borders.js @@ -0,0 +1,81 @@ +// Copyright (C) 2021 Intel Corporation +// +// SPDX-License-Identifier: MIT + +/// + +import { taskName, labelName } from '../../support/const_canvas3d'; + +context('Canvas 3D functionality. Opacity. Outlined borders.', () => { + const caseId = '82'; + const screenshotsPath = 'cypress/screenshots/canvas3d_functionality/case_82_canvas3d_functionality_cuboid_opacity_outlined_borders.js'; + const cuboidCreationParams = { + labelName: labelName, + x: 250, + y: 250, + }; + + before(() => { + cy.openTask(taskName) + cy.openJob(); + cy.wait(1000); // Waiting for the point cloud to display + cy.create3DCuboid(cuboidCreationParams); + cy.get('.cvat-canvas3d-perspective').trigger('mousemove').click(); // Deactivate the cuboiud + cy.get('.cvat-canvas3d-perspective').screenshot('canvas3d_perspective_deactivate_cuboid'); + }); + + describe(`Testing case "${caseId}"`, () => { + it('Change opacity to 100. To 0.', () => { + cy.get('.cvat-appearance-opacity-slider').click('right'); + cy.get('.cvat-appearance-opacity-slider').find('[role="slider"]').should('have.attr', 'aria-valuenow', 100); + cy.get('.cvat-canvas3d-perspective').screenshot('canvas3d_perspective_opacty_100'); + cy.compareImagesAndCheckResult( + `${screenshotsPath}/canvas3d_perspective_deactivate_cuboid.png`, + `${screenshotsPath}/canvas3d_perspective_opacty_100.png`, + ); + cy.get('.cvat-appearance-opacity-slider').click('left'); + cy.get('.cvat-appearance-opacity-slider').find('[role="slider"]').should('have.attr', 'aria-valuenow', 0); + cy.get('.cvat-canvas3d-perspective').screenshot('canvas3d_perspective_opacty_0'); + cy.compareImagesAndCheckResult( + `${screenshotsPath}/canvas3d_perspective_opacty_100.png`, + `${screenshotsPath}/canvas3d_perspective_opacty_0.png`, + ); + }); + + it('Change selected opacity to 100. To 0.', () => { + cy.get('.cvat-appearance-selected-opacity-slider').click('right'); + cy.get('.cvat-appearance-selected-opacity-slider').find('[role="slider"]').should('have.attr', 'aria-valuenow', 100); + cy.get('.cvat-canvas3d-perspective').trigger('mousemove').trigger('mousemove', 250, 250).wait(1000); // Waiting for the cuboid activation + cy.get('.cvat-canvas3d-perspective').screenshot('canvas3d_perspective_selected_opacty_100'); + cy.compareImagesAndCheckResult( + `${screenshotsPath}/canvas3d_perspective_opacty_100.png`, + `${screenshotsPath}/canvas3d_perspective_selected_opacty_100.png`, + true, // No diff between the images + ); + cy.get('.cvat-appearance-selected-opacity-slider').click('left'); + cy.get('.cvat-appearance-selected-opacity-slider').find('[role="slider"]').should('have.attr', 'aria-valuenow', 0); + cy.get('.cvat-canvas3d-perspective').screenshot('canvas3d_perspective_selected_opacty_0'); + cy.compareImagesAndCheckResult( + `${screenshotsPath}/canvas3d_perspective_opacty_0.png`, + `${screenshotsPath}/canvas3d_perspective_selected_opacty_0.png`, + true, // No diff between the images + ); + }); + + it('Enable/disable outlined borders.', () => { + cy.get('.cvat-appearance-outlinded-borders-checkbox').find('[type="checkbox"]').check(); + cy.get('.cvat-canvas3d-perspective').screenshot('canvas3d_perspective_enable_outlined_borders'); + cy.compareImagesAndCheckResult( + `${screenshotsPath}/canvas3d_perspective_enable_outlined_borders.png`, + `${screenshotsPath}/canvas3d_perspective_selected_opacty_0.png`, + ); + cy.get('.cvat-appearance-outlinded-borders-checkbox').find('[type="checkbox"]').uncheck(); + cy.get('.cvat-canvas3d-perspective').screenshot('canvas3d_perspective_disable_outlined_borders'); + cy.compareImagesAndCheckResult( + `${screenshotsPath}/canvas3d_perspective_disable_outlined_borders.png`, + `${screenshotsPath}/canvas3d_perspective_selected_opacty_0.png`, + true, // No diff between the images + ); + }); + }); +}); diff --git a/tests/cypress/integration/canvas3d_functionality/case_83_canvas3d_functionality_cuboid_grouping.js b/tests/cypress/integration/canvas3d_functionality/case_83_canvas3d_functionality_cuboid_grouping.js new file mode 100644 index 0000000000000000000000000000000000000000..6837d5d5c25fc8376db5ca83c31f79c2c0eb90df --- /dev/null +++ b/tests/cypress/integration/canvas3d_functionality/case_83_canvas3d_functionality_cuboid_grouping.js @@ -0,0 +1,100 @@ +// Copyright (C) 2021 Intel Corporation +// +// SPDX-License-Identifier: MIT + +/// + +import { taskName, labelName } from '../../support/const_canvas3d'; + +context('Canvas 3D functionality. Grouping.', () => { + const caseId = '83'; + const screenshotsPath = 'cypress/screenshots/canvas3d_functionality/case_83_canvas3d_functionality_cuboid_grouping.js'; + const firstCuboidCreationParams = { + labelName: labelName, + x: 350, + y: 250, + }; + const secondCuboidCreationParams = { + labelName: labelName, + x: 450, + y: 250, + }; + const thirdCuboidCreationParams = { + labelName: labelName, + x: 450, + y: 350, + }; + const fourthCuboidCreationParams = { + labelName: labelName, + x: 350, + y: 350, + }; + const yellowHex = 'fcbe03'; + const yellowRgb = '252, 190, 3'; + const shapeSidebarItemArray = ['#cvat-objects-sidebar-state-item-2', '#cvat-objects-sidebar-state-item-3']; + + function changeGroupColor(object, color) { + cy.get(object).within(() => { + cy.get('[aria-label="more"]').click(); + }); + cy.wait(300); + cy.get('.ant-dropdown') + .not('.ant-dropdown-hidden') + .within(() => { + cy.contains('Change group color').click(); + }); + cy.changeColorViaBadge(color); + } + + before(() => { + cy.openTask(taskName) + cy.openJob(); + cy.wait(1000); // Waiting for the point cloud to display + cy.create3DCuboid(firstCuboidCreationParams); + cy.create3DCuboid(secondCuboidCreationParams); + cy.create3DCuboid(thirdCuboidCreationParams); + cy.create3DCuboid(fourthCuboidCreationParams); + cy.get('.cvat-canvas3d-perspective').screenshot('canvas3d_perspective_cuboid_creation'); + }); + + describe(`Testing case "${caseId}"`, () => { + it('Grouping two cuboids.', () => { + cy.get('.cvat-group-control').click(); + cy.get('.cvat-canvas3d-perspective').trigger('mousemove', 450, 250).click(450, 250); + cy.get('.cvat-canvas3d-perspective').trigger('mousemove', 450, 350).click(450, 350); + cy.get('.cvat-group-control').click(); + cy.changeAppearance('Group'); + cy.get('#cvat-objects-sidebar-state-item-1').invoke('attr', 'style').then((bgColorItem1) => { + cy.get('#cvat-objects-sidebar-state-item-4').invoke('attr', 'style').then((bgColorItem4) => { + expect(bgColorItem1).to.be.equal(bgColorItem4); + }); + cy.get('#cvat-objects-sidebar-state-item-2').invoke('attr', 'style').then((bgColorItem2) => { + expect(bgColorItem1).not.be.equal(bgColorItem2); + }); + cy.get('#cvat-objects-sidebar-state-item-3').invoke('attr', 'style').then((bgColorItem3) => { + expect(bgColorItem1).not.be.equal(bgColorItem3); + }); + }); + cy.get('.cvat-canvas3d-perspective').screenshot('canvas3d_perspective_cuboid_grouping'); + cy.compareImagesAndCheckResult( + `${screenshotsPath}/canvas3d_perspective_cuboid_creation.png`, + `${screenshotsPath}/canvas3d_perspective_cuboid_grouping.png`, + ); + }); + + it('Change group color.', () => { + changeGroupColor('#cvat-objects-sidebar-state-item-2', yellowHex); + cy.get('.cvat-label-color-picker').should('be.hidden'); + for (const groupedSidebarItemShape of shapeSidebarItemArray) { + cy.get(groupedSidebarItemShape) + .should('have.attr', 'style') + .and('contain', `background-color: rgba(${yellowRgb}`); + } + cy.get('.cvat-canvas3d-perspective').screenshot('canvas3d_perspective_change_group_color'); + cy.compareImagesAndCheckResult( + `${screenshotsPath}/canvas3d_perspective_cuboid_grouping.png`, + `${screenshotsPath}/canvas3d_perspective_change_group_color.png`, + ); + }); + }); +}); diff --git a/tests/cypress/integration/canvas3d_functionality/case_84_canvas3d_functionality_cuboid_redraw.js b/tests/cypress/integration/canvas3d_functionality/case_84_canvas3d_functionality_cuboid_redraw.js new file mode 100644 index 0000000000000000000000000000000000000000..829b4a4ff59d98125fc357a8999ac067c5397477 --- /dev/null +++ b/tests/cypress/integration/canvas3d_functionality/case_84_canvas3d_functionality_cuboid_redraw.js @@ -0,0 +1,31 @@ +// Copyright (C) 2021 Intel Corporation +// +// SPDX-License-Identifier: MIT + +/// + +import { taskName, labelName } from '../../support/const_canvas3d'; + +context('Canvas 3D functionality. Redraw.', () => { + const caseId = '84'; + const cuboidCreationParams = { + labelName: labelName, + }; + + before(() => { + cy.openTask(taskName) + cy.openJob(); + cy.create3DCuboid(cuboidCreationParams); + }); + + describe(`Testing case "${caseId}"`, () => { + it('Redraw a cuboid.', () => { + cy.get('.cvat-canvas3d-perspective').trigger('mousemove'); + cy.get('body').type('{Shift}n'); + cy.get('.cvat-canvas3d-perspective').trigger('mousemove', 450, 250).dblclick(450, 250); + cy.get('.cvat-objects-sidebar-state-item').then((sidebarStateItems) => { + expect(sidebarStateItems.length).to.be.equal(1); + }); + }); + }); +}); diff --git "a/tests/cypress/integration/canvas3d_functionality/case_85_canvas3d_functionality_cuboid_\321\201ancel_drawing.js" "b/tests/cypress/integration/canvas3d_functionality/case_85_canvas3d_functionality_cuboid_\321\201ancel_drawing.js" new file mode 100644 index 0000000000000000000000000000000000000000..5dcab0ad6bd6dc007b89bb4ec3c94ae6acc98c08 --- /dev/null +++ "b/tests/cypress/integration/canvas3d_functionality/case_85_canvas3d_functionality_cuboid_\321\201ancel_drawing.js" @@ -0,0 +1,40 @@ +// Copyright (C) 2021 Intel Corporation +// +// SPDX-License-Identifier: MIT + +/// + +import { taskName, labelName } from '../../support/const_canvas3d'; + +context('Canvas 3D functionality. Cancel drawing.', () => { + const caseId = '85'; + const screenshotsPath = 'cypress/screenshots/canvas3d_functionality/case_85_canvas3d_functionality_cuboid_сancel_drawing.js'; + + before(() => { + cy.openTask(taskName) + cy.openJob(); + cy.wait(1000); // Waiting for the point cloud to display + }); + + describe(`Testing case "${caseId}"`, () => { + it('Cancel drawing.', () => { + cy.get('.cvat-draw-cuboid-control').trigger('mouseover'); + cy.get('.cvat-draw-cuboid-popover-visible').find('[type="search"]').click({ force: true }); + cy.get('.ant-select-dropdown') + .not('.ant-select-dropdown-hidden') + .within(() => { + cy.contains(new RegExp(`^${labelName}$`)).click(); + }); + cy.get('.cvat-draw-cuboid-popover-visible').find('button').click(); + cy.get('.cvat-canvas3d-perspective').trigger('mousemove'); + cy.get('.cvat-canvas3d-perspective').screenshot('canvas3d_perspective_drawning'); + cy.get('body').type('{Esc}'); + cy.get('.cvat-active-canvas-control').should('exist'); + cy.get('.cvat-canvas3d-perspective').screenshot('canvas3d_perspective_cancel_drawning'); + cy.compareImagesAndCheckResult( + `${screenshotsPath}/canvas3d_perspective_drawning.png`, + `${screenshotsPath}/canvas3d_perspective_cancel_drawning.png`, + ); + }); + }); +}); diff --git a/tests/cypress/integration/canvas3d_functionality/case_86_canvas3d_functionality_move_image_button.js b/tests/cypress/integration/canvas3d_functionality/case_86_canvas3d_functionality_move_image_button.js new file mode 100644 index 0000000000000000000000000000000000000000..b610fa8d03cc97f8d3fe5aa8e921bc3c1dc7d52b --- /dev/null +++ b/tests/cypress/integration/canvas3d_functionality/case_86_canvas3d_functionality_move_image_button.js @@ -0,0 +1,65 @@ +// Copyright (C) 2021 Intel Corporation +// +// SPDX-License-Identifier: MIT + +/// + +import { taskName, labelName } from '../../support/const_canvas3d'; + +context('Canvas 3D functionality. "Move the image" button interaction.', () => { + const caseId = '86'; + const screenshotsPath = 'cypress/screenshots/canvas3d_functionality/case_86_canvas3d_functionality_move_image_button.js'; + const cuboidCreationParams = { + labelName: labelName, + }; + + before(() => { + cy.openTask(taskName) + cy.openJob(); + cy.wait(1000); // Waiting for the point cloud to display + cy.create3DCuboid(cuboidCreationParams); + cy.get('.cvat-canvas3d-perspective').screenshot('canvas3d_perspective_after_add_cuboid'); + ['topview', 'sideview', 'frontview'].forEach((view) => { + cy.get(`.cvat-canvas3d-${view}`) + .find('.cvat-canvas3d-fullsize') + .screenshot(`canvas3d_${view}_after_add_cuboid`); + }); + }); + + describe(`Testing case "${caseId}"`, () => { + it('Click to "Move the image" button. The cuboid on the top/side/front view should be hidden.', () => { + cy.get('.cvat-move-control').click(); + cy.get('.cvat-canvas3d-perspective').trigger('mousemove', 300, 200); // Interacting with the canvas before interacting with the cuboid. + cy.get('.cvat-canvas3d-perspective').trigger('mousemove'); + cy.get('#cvat-objects-sidebar-state-item-1').should('not.have.class', 'cvat-objects-sidebar-state-active-item'); + cy.get('.cvat-canvas3d-perspective').screenshot('canvas3d_perspective_move_the_image_clicked'); + ['topview', 'sideview', 'frontview'].forEach((view) => { + cy.get(`.cvat-canvas3d-${view}`) + .find('.cvat-canvas3d-fullsize') + .screenshot(`canvas3d_${view}_move_the_image_clicked`); + }); + cy.compareImagesAndCheckResult( + `${screenshotsPath}/canvas3d_perspective_after_add_cuboid.png`, + `${screenshotsPath}/canvas3d_perspective_move_the_image_clicked.png`, + ); + [ + ['canvas3d_topview_after_add_cuboid.png', 'canvas3d_topview_move_the_image_clicked.png'], + ['canvas3d_sideview_after_add_cuboid.png', 'canvas3d_sideview_move_the_image_clicked.png'], + ['canvas3d_frontview_after_add_cuboid.png', 'canvas3d_frontview_move_the_image_clicked.png'], + ].forEach(([viewAfterAddCuboid, viewMoveTheImageClicked]) => { + cy.compareImagesAndCheckResult( + `${screenshotsPath}/${viewAfterAddCuboid}`, + `${screenshotsPath}/${viewMoveTheImageClicked}`, + ); + }); + }); + + it('Cancel "Move the image" activity. "Cursor" button should be active.', () => { + cy.get('body').type('{Esc}'); + cy.get('.cvat-active-canvas-control').should('exist'); + cy.get('.cvat-canvas3d-perspective').trigger('mousemove', 300, 200); // Interacting with the canvas before interacting with the cuboid. + cy.get('.cvat-canvas3d-perspective').trigger('mousemove'); + cy.get('#cvat-objects-sidebar-state-item-1').should('have.class', 'cvat-objects-sidebar-state-active-item'); + }); + }); +}); diff --git a/tests/cypress/integration/canvas3d_functionality/case_87_canvas3d_functionality_cuboid_delete.js b/tests/cypress/integration/canvas3d_functionality/case_87_canvas3d_functionality_cuboid_delete.js new file mode 100644 index 0000000000000000000000000000000000000000..7a4d591a0a29dc60b6f8c29e5d5e19dd0b0795df --- /dev/null +++ b/tests/cypress/integration/canvas3d_functionality/case_87_canvas3d_functionality_cuboid_delete.js @@ -0,0 +1,31 @@ +// Copyright (C) 2021 Intel Corporation +// +// SPDX-License-Identifier: MIT + +/// + +import { taskName, labelName } from '../../support/const_canvas3d'; + +context('Canvas 3D functionality. Delete a cuboid.', () => { + const caseId = '87'; + const cuboidCreationParams = { + labelName: labelName, + }; + + before(() => { + cy.openTask(taskName) + cy.openJob(); + cy.create3DCuboid(cuboidCreationParams); + }); + + describe(`Testing case "${caseId}"`, () => { + it('Delete a cuboid.', () => { + cy.get('.cvat-canvas3d-perspective').trigger('mousemove', 300, 200).click(300, 200); // Deactivate the cuboid + cy.get('#cvat-objects-sidebar-state-item-1').should('not.have.class', 'cvat-objects-sidebar-state-active-item'); + cy.get('.cvat-canvas3d-perspective').trigger('mousemove'); + cy.get('#cvat-objects-sidebar-state-item-1').should('have.class', 'cvat-objects-sidebar-state-active-item'); + cy.get('body').type('{Del}'); + cy.get('#cvat-objects-sidebar-state-item-1').should('not.exist'); + }); + }); +}); diff --git a/tests/cypress/integration/canvas3d_functionality/case_88_canvas3d_functionality_save_job_remove_annotation.js b/tests/cypress/integration/canvas3d_functionality/case_88_canvas3d_functionality_save_job_remove_annotation.js new file mode 100644 index 0000000000000000000000000000000000000000..f82700f97e9e5a4a9c554eecba176e777fff0d07 --- /dev/null +++ b/tests/cypress/integration/canvas3d_functionality/case_88_canvas3d_functionality_save_job_remove_annotation.js @@ -0,0 +1,52 @@ +// Copyright (C) 2021 Intel Corporation +// +// SPDX-License-Identifier: MIT + +/// + +import { taskName, labelName } from '../../support/const_canvas3d'; + +context('Canvas 3D functionality. Save a job. Remove annotations.', () => { + const caseId = '88'; + const screenshotsPath = 'cypress/screenshots/canvas3d_functionality/case_88_canvas3d_functionality_save_job_remove_annotation.js'; + const cuboidCreationParams = { + labelName: labelName, + }; + + before(() => { + cy.openTask(taskName) + cy.openJob(); + cy.wait(1000); // Waiting for the point cloud to display + cy.get('.cvat-canvas3d-topview').find('.cvat-canvas3d-fullsize').screenshot('canvas3d_topview_before_all'); + cy.create3DCuboid(cuboidCreationParams); + }); + + describe(`Testing case "${caseId}"`, () => { + it('Save a job. Reopen the job.', () => { + cy.saveJob('PATCH', 200, 'saveJob'); + cy.goToTaskList(); + cy.openTaskJob(taskName); + cy.wait(1000); // Waiting for the point cloud to display + cy.get('.cvat-objects-sidebar-state-item').then((sidebarStateItem) => { + expect(sidebarStateItem.length).to.be.equal(1); + }); + cy.get('.cvat-canvas3d-topview').find('.cvat-canvas3d-fullsize').screenshot('canvas3d_topview_after_reopen_job'); + cy.compareImagesAndCheckResult( + `${screenshotsPath}/canvas3d_topview_before_all.png`, + `${screenshotsPath}/canvas3d_topview_after_reopen_job.png`, + ); + }); + + it('Remove annotations. Save the job.', () => { + cy.removeAnnotations(); + cy.saveJob('PUT'); + cy.contains('Saving changes on the server').should('be.hidden'); + cy.get('.cvat-objects-sidebar-state-item').should('not.exist'); + cy.get('.cvat-canvas3d-topview').find('.cvat-canvas3d-fullsize').screenshot('canvas3d_topview_after_remove_annotations'); + cy.compareImagesAndCheckResult( + `${screenshotsPath}/canvas3d_topview_after_reopen_job.png`, + `${screenshotsPath}/canvas3d_topview_after_remove_annotations.png`, + ); + }); + }); +}); diff --git a/tests/cypress/integration/canvas3d_functionality/case_89_canvas3d_functionality_filters.js b/tests/cypress/integration/canvas3d_functionality/case_89_canvas3d_functionality_filters.js new file mode 100644 index 0000000000000000000000000000000000000000..f67fab071d8886c427d6e27a10ac241d55123353 --- /dev/null +++ b/tests/cypress/integration/canvas3d_functionality/case_89_canvas3d_functionality_filters.js @@ -0,0 +1,75 @@ +// Copyright (C) 2021 Intel Corporation +// +// SPDX-License-Identifier: MIT + +/// + +import { taskName, labelName } from '../../support/const_canvas3d'; + +context('Canvas 3D functionality. Filters.', () => { + const caseId = '89'; + const secondLabel = 'car' + const screenshotsPath = 'cypress/screenshots/canvas3d_functionality/case_89_canvas3d_functionality_filters.js'; + const firstCuboidCreationParams = { + labelName: labelName, + x: 350, + y: 250, + }; + const secondCuboidCreationParams = { + labelName: secondLabel, + x: 450, + y: 250, + }; + + before(() => { + cy.openTask(taskName) + cy.addNewLabel(secondLabel); + cy.openJob(); + cy.wait(1000); // Waiting for the point cloud to display + cy.create3DCuboid(firstCuboidCreationParams); + cy.create3DCuboid(secondCuboidCreationParams); + cy.get('.cvat-canvas3d-perspective').screenshot('canvas3d_perspective_after_add_cuboids'); + }); + + describe(`Testing case "${caseId}"`, () => { + it('Set filter "label=points cloud"', () => { + cy.addFiltersRule(0); + cy.setFilter({ + groupIndex: 0, + ruleIndex: 0, + field: 'Label', + operator: '==', + value: labelName, + submit: true, + }); + cy.get('#cvat-objects-sidebar-state-item-1').should('exist'); + cy.get('#cvat-objects-sidebar-state-item-2').should('not.exist'); + cy.get('.cvat-canvas3d-perspective').screenshot('canvas3d_perspective_set_filter_label'); + cy.compareImagesAndCheckResult( + `${screenshotsPath}/canvas3d_perspective_after_add_cuboids.png`, + `${screenshotsPath}/canvas3d_perspective_set_filter_label.png`, + ); + cy.clearFilters(); + }); + + it('Set filter "ObjectID=2"', () => { + cy.addFiltersRule(0); + cy.setFilter({ + groupIndex: 0, + ruleIndex: 0, + field: 'ObjectID', + operator: '==', + value: '2', + submit: true, + }); + cy.get('#cvat-objects-sidebar-state-item-1').should('not.exist'); + cy.get('#cvat-objects-sidebar-state-item-2').should('exist'); + cy.get('.cvat-canvas3d-perspective').screenshot('canvas3d_perspective_set_filter_objectid'); + cy.compareImagesAndCheckResult( + `${screenshotsPath}/canvas3d_perspective_set_filter_objectid.png`, + `${screenshotsPath}/canvas3d_perspective_set_filter_label.png`, + ); + cy.clearFilters(); + }); + }); +}); diff --git a/tests/cypress/support/commands_filters_feature.js b/tests/cypress/support/commands_filters_feature.js index b8b62df5658ceba96dea1438f30040996b866cd2..4258a762e176b2ed58dc627c2d1e2c54d5588a61 100644 --- a/tests/cypress/support/commands_filters_feature.js +++ b/tests/cypress/support/commands_filters_feature.js @@ -36,6 +36,8 @@ Cypress.Commands.add('collectRuleID', () => { Cypress.Commands.add('clearFilters', () => { cy.сheckFiltersModalOpened(); cy.contains('button', 'Clear filters').click(); + cy.get('.cvat-filters-modal-visible').should('not.exist'); + cy.get('.cvat-filters-modal').should('be.hidden'); }); Cypress.Commands.add('addFiltersGroup', (groupIndex) => { @@ -117,9 +119,13 @@ Cypress.Commands.add( if (valueSource) { cy.get('.ant-dropdown').not('.ant-dropdown-hidden').contains('[role="menuitem"]', value).click(); } - cy.get('.cvat-filters-modal').within(() => { - submit ? cy.contains('button', 'Submit').click() : null; - }); + if (submit) { + cy.get('.cvat-filters-modal-visible').within(() => { + cy.contains('button', 'Submit').click(); + }); + cy.get('.cvat-filters-modal-visible').should('not.exist'); + cy.get('.cvat-filters-modal').should('be.hidden'); + } }); }); }, @@ -133,7 +139,9 @@ Cypress.Commands.add('selectFilterValue', (filterValue) => { .within(() => { cy.contains('[role="menuitem"]', new RegExp(`^${filterValue}$`)).click(); }); - cy.get('.cvat-filters-modal').within(() => { + cy.get('.cvat-filters-modal-visible').within(() => { cy.contains('button', 'Submit').click(); }); + cy.get('.cvat-filters-modal-visible').should('not.exist'); + cy.get('.cvat-filters-modal').should('be.hidden'); });