From 89353237215eb5dd297aa0f7f57d83e08bff5f79 Mon Sep 17 00:00:00 2001 From: dvkruchinin Date: Mon, 15 Feb 2021 17:06:32 +0300 Subject: [PATCH 1/5] Add css classes --- .../annotation-page/standard-workspace/propagate-confirm.tsx | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/cvat-ui/src/components/annotation-page/standard-workspace/propagate-confirm.tsx b/cvat-ui/src/components/annotation-page/standard-workspace/propagate-confirm.tsx index 1ac36d169d14..6b5b6bd97fea 100644 --- a/cvat-ui/src/components/annotation-page/standard-workspace/propagate-confirm.tsx +++ b/cvat-ui/src/components/annotation-page/standard-workspace/propagate-confirm.tsx @@ -1,4 +1,4 @@ -// Copyright (C) 2020 Intel Corporation +// Copyright (C) 2020-2021 Intel Corporation // // SPDX-License-Identifier: MIT @@ -49,6 +49,7 @@ export default function PropagateConfirmComponent(props: Props): JSX.Element {
Do you want to make a copy of the object on 1 ? frames : frame } up to the Date: Mon, 15 Feb 2021 17:07:24 +0300 Subject: [PATCH 2/5] Cypress test. Propagate object. --- .../case_53_object_propagate.js | 52 +++++++++++++++++++ 1 file changed, 52 insertions(+) create mode 100644 tests/cypress/integration/actions_tasks_objects/case_53_object_propagate.js diff --git a/tests/cypress/integration/actions_tasks_objects/case_53_object_propagate.js b/tests/cypress/integration/actions_tasks_objects/case_53_object_propagate.js new file mode 100644 index 000000000000..d83bffbd72e5 --- /dev/null +++ b/tests/cypress/integration/actions_tasks_objects/case_53_object_propagate.js @@ -0,0 +1,52 @@ +// Copyright (C) 2021 Intel Corporation +// +// SPDX-License-Identifier: MIT + +/// + +import { taskName, labelName } from '../../support/const'; + +context('Object propagate.', () => { + const caseId = '53'; + const createCuboidShape2Points = { + points: 'From rectangle', + type: 'Shape', + labelName: labelName, + firstX: 250, + firstY: 350, + secondX: 350, + secondY: 450, + }; + let maxFrameNumber = 0; + + before(() => { + cy.openTaskJob(taskName); + cy.get('.cvat-player-last-button').click(); + cy.get('.cvat-player-frame-selector') + .find('input') + .then((frameSelector) => { + maxFrameNumber = frameSelector.val(); + }); + cy.get('.cvat-player-first-button').click(); + cy.createCuboid(createCuboidShape2Points); + }); + + describe(`Testing case "${caseId}"`, () => { + it('On the first frame propagate object on one frame.', () => { + cy.get('#cvat-objects-sidebar-state-item-1').find('[aria-label="more"]').trigger('mouseover'); + cy.get('.cvat-object-item-menu').within(() => { + cy.contains('button', 'Propagate').click(); + }); + cy.get('.cvat-propagate-confirm-object-on-frames') + .find('input') + .should('have.attr', 'value', maxFrameNumber) + .clear() + .type(10) // Checking to specify the number of frames more than in the current job. + .tab() + .should('have.attr', 'value', maxFrameNumber) //Must be equal to the maximum value of the number of frames + .clear() + .type(1); + cy.get('.cvat-propagate-confirm-object-up-to-frame').find('input').should('have.attr', 'value', 1); + }); + }); +}); From f7069503b00e5147cdc38fc8a246508c4cde1432 Mon Sep 17 00:00:00 2001 From: dvkruchinin Date: Thu, 25 Feb 2021 14:14:38 +0300 Subject: [PATCH 3/5] Cypress test. Object propagation no on last frame. --- .../case_53_object_propagate.js | 69 ++++++++++++++++--- 1 file changed, 60 insertions(+), 9 deletions(-) diff --git a/tests/cypress/integration/actions_tasks_objects/case_53_object_propagate.js b/tests/cypress/integration/actions_tasks_objects/case_53_object_propagate.js index d83bffbd72e5..f9e8d2e2654e 100644 --- a/tests/cypress/integration/actions_tasks_objects/case_53_object_propagate.js +++ b/tests/cypress/integration/actions_tasks_objects/case_53_object_propagate.js @@ -18,6 +18,15 @@ context('Object propagate.', () => { secondY: 450, }; let maxFrameNumber = 0; + const propagateOnOneFrame = 1; + const propagateOnTwoFrame = 2; + + function startPropagation() { + cy.get('#cvat-objects-sidebar-state-item-1').find('[aria-label="more"]').trigger('mouseover'); + cy.get('.cvat-object-item-menu').within(() => { + cy.contains('button', 'Propagate').click(); + }); + } before(() => { cy.openTaskJob(taskName); @@ -25,28 +34,70 @@ context('Object propagate.', () => { cy.get('.cvat-player-frame-selector') .find('input') .then((frameSelector) => { - maxFrameNumber = frameSelector.val(); + maxFrameNumber = Number(frameSelector.val()); }); cy.get('.cvat-player-first-button').click(); cy.createCuboid(createCuboidShape2Points); }); describe(`Testing case "${caseId}"`, () => { - it('On the first frame propagate object on one frame.', () => { - cy.get('#cvat-objects-sidebar-state-item-1').find('[aria-label="more"]').trigger('mouseover'); - cy.get('.cvat-object-item-menu').within(() => { - cy.contains('button', 'Propagate').click(); - }); + it('On the 1st frame propagate object on 1 frame.', () => { + startPropagation(); cy.get('.cvat-propagate-confirm-object-on-frames') .find('input') .should('have.attr', 'value', maxFrameNumber) .clear() - .type(10) // Checking to specify the number of frames more than in the current job. + .type(maxFrameNumber + 1) // Checking to specify the number of frames more than in the current job. .tab() .should('have.attr', 'value', maxFrameNumber) //Must be equal to the maximum value of the number of frames .clear() - .type(1); - cy.get('.cvat-propagate-confirm-object-up-to-frame').find('input').should('have.attr', 'value', 1); + .type(propagateOnOneFrame); + cy.get('.cvat-propagate-confirm-object-up-to-frame') + .find('input') + .should('have.attr', 'value', propagateOnOneFrame); + cy.contains('button', 'Yes').click(); + }); + + it('On the 1st and 2nd frames, the number of objects is equal to 1. On the 3rd frame is 0.', () => { + cy.get('.cvat_canvas_shape_cuboid').then(($cuboidCountFirstFrame) => { + cy.goCheckFrameNumber(1); // Go to 2nd frame + cy.get('.cvat_canvas_shape_cuboid').then(($cuboidCountSecondFrame) => { + expect($cuboidCountFirstFrame.length).to.be.equal($cuboidCountSecondFrame.length); + }); + }); + cy.goCheckFrameNumber(2); // Go to 3rd frame + cy.get('.cvat_canvas_shape_cuboid').should('not.exist'); + cy.get('.cvat-player-first-button').click(); + }); + + it('From the 1st frame propagate again on 2 frames.', () => { + startPropagation(); + cy.get('.cvat-propagate-confirm-object-on-frames') + .find('input') + .should('have.attr', 'value', propagateOnOneFrame) + .clear() + .type(propagateOnTwoFrame) + .tab() + .should('have.attr', 'value', propagateOnTwoFrame); + cy.get('.cvat-propagate-confirm-object-up-to-frame') + .find('input') + .should('have.attr', 'value', propagateOnTwoFrame); + cy.contains('button', 'Yes').click(); + }); + + it('On the 1st and 3rd frames the number of objects is equal to 1. On the 2nd frame equal to 2. On the 4th frame equal to 0', () => { + cy.get('.cvat_canvas_shape_cuboid').then(($cuboidCountFirstFrame) => { + cy.goCheckFrameNumber(2); // Go to 3rd frame + cy.get('.cvat_canvas_shape_cuboid').then(($cuboidCountThirdFrame) => { + expect($cuboidCountFirstFrame.length).to.be.equal($cuboidCountThirdFrame.length); + }); + }); + cy.goCheckFrameNumber(1); // Go to 2nd frame + cy.get('.cvat_canvas_shape_cuboid').then(($cuboidCountSecondFrame) => { + expect($cuboidCountSecondFrame.length).to.be.equal(2); + }); + cy.goCheckFrameNumber(3); // Go to 4th frame + cy.get('.cvat_canvas_shape_cuboid').should('not.exist'); }); }); }); From e28fcd33a091ac38c283c517499effbd4ae8242c Mon Sep 17 00:00:00 2001 From: dvkruchinin Date: Thu, 25 Feb 2021 15:28:20 +0300 Subject: [PATCH 4/5] Try fix eslint "Unable to resolve path to module" --- cvat-ui/.eslintrc.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cvat-ui/.eslintrc.js b/cvat-ui/.eslintrc.js index 0c726f0458bb..28d9241e9e38 100644 --- a/cvat-ui/.eslintrc.js +++ b/cvat-ui/.eslintrc.js @@ -59,7 +59,7 @@ module.exports = { settings: { 'import/resolver': { node: { - paths: ['src'], + paths: ['src', `${__dirname}/src`], }, }, }, From 703471902497e6ff46eed566f01ae72940a7a1f2 Mon Sep 17 00:00:00 2001 From: dvkruchinin Date: Fri, 26 Feb 2021 09:28:21 +0300 Subject: [PATCH 5/5] Apply comments. --- .../case_53_object_propagate.js | 31 +++++-------------- 1 file changed, 8 insertions(+), 23 deletions(-) diff --git a/tests/cypress/integration/actions_tasks_objects/case_53_object_propagate.js b/tests/cypress/integration/actions_tasks_objects/case_53_object_propagate.js index f9e8d2e2654e..4e3d0ffa7195 100644 --- a/tests/cypress/integration/actions_tasks_objects/case_53_object_propagate.js +++ b/tests/cypress/integration/actions_tasks_objects/case_53_object_propagate.js @@ -17,9 +17,8 @@ context('Object propagate.', () => { secondX: 350, secondY: 450, }; - let maxFrameNumber = 0; const propagateOnOneFrame = 1; - const propagateOnTwoFrame = 2; + const propagateOnTwoFrames = 2; function startPropagation() { cy.get('#cvat-objects-sidebar-state-item-1').find('[aria-label="more"]').trigger('mouseover'); @@ -30,29 +29,17 @@ context('Object propagate.', () => { before(() => { cy.openTaskJob(taskName); - cy.get('.cvat-player-last-button').click(); - cy.get('.cvat-player-frame-selector') - .find('input') - .then((frameSelector) => { - maxFrameNumber = Number(frameSelector.val()); - }); - cy.get('.cvat-player-first-button').click(); cy.createCuboid(createCuboidShape2Points); }); describe(`Testing case "${caseId}"`, () => { it('On the 1st frame propagate object on 1 frame.', () => { startPropagation(); - cy.get('.cvat-propagate-confirm-object-on-frames') + cy.get('.cvat-propagate-confirm-object-on-frames') // Change value in the "copy of the object on frame" field .find('input') - .should('have.attr', 'value', maxFrameNumber) - .clear() - .type(maxFrameNumber + 1) // Checking to specify the number of frames more than in the current job. - .tab() - .should('have.attr', 'value', maxFrameNumber) //Must be equal to the maximum value of the number of frames .clear() .type(propagateOnOneFrame); - cy.get('.cvat-propagate-confirm-object-up-to-frame') + cy.get('.cvat-propagate-confirm-object-up-to-frame') // Value of "up to the frame" field should be same .find('input') .should('have.attr', 'value', propagateOnOneFrame); cy.contains('button', 'Yes').click(); @@ -72,16 +59,14 @@ context('Object propagate.', () => { it('From the 1st frame propagate again on 2 frames.', () => { startPropagation(); - cy.get('.cvat-propagate-confirm-object-on-frames') + cy.get('.cvat-propagate-confirm-object-up-to-frame') // Change value in the "up to the frame" field .find('input') - .should('have.attr', 'value', propagateOnOneFrame) .clear() - .type(propagateOnTwoFrame) - .tab() - .should('have.attr', 'value', propagateOnTwoFrame); - cy.get('.cvat-propagate-confirm-object-up-to-frame') + .type(propagateOnTwoFrames) + .should('have.attr', 'value', propagateOnTwoFrames); + cy.get('.cvat-propagate-confirm-object-on-frames') // Value of "copy of the object on frames" field should be same .find('input') - .should('have.attr', 'value', propagateOnTwoFrame); + .should('have.attr', 'value', propagateOnTwoFrames); cy.contains('button', 'Yes').click(); });