From 897036f00f330bb3591258c1bf54006878ddafb7 Mon Sep 17 00:00:00 2001 From: Kruchinin Date: Wed, 25 Nov 2020 08:55:15 +0300 Subject: [PATCH 1/4] 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 2/4] 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 3/4] 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 3a7fdb2c96be1cf019ce88e95c73abdd11285ade Mon Sep 17 00:00:00 2001 From: Kruchinin Date: Wed, 25 Nov 2020 16:57:42 +0300 Subject: [PATCH 4/4] Apply comments. --- .../case_19_all_image_rotate_features.js | 9 +++++++++ 1 file changed, 9 insertions(+) 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 a33e5003..69a06717 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 @@ -23,6 +23,12 @@ context('Rotate all images feature.', () => { cy.get('#cvat_canvas_background').should('have.attr', 'style').and('contain', `rotate(${deg}deg);`); } + function checkFrameNum(frameNum) { + cy.get('.cvat-player-frame-selector').within(() => { + cy.get('input[role="spinbutton"]').should('have.value', frameNum); + }); + } + before(() => { cy.openTaskJob(taskName); }); @@ -36,6 +42,7 @@ context('Rotate all images feature.', () => { it("Go to the next frame. It wasn't rotated.", () => { cy.get('.cvat-player-next-button').click(); + checkFrameNum(1); checkDegRotate(0); }); @@ -52,8 +59,10 @@ 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(); + checkFrameNum(0); checkDegRotate(180); cy.get('.cvat-player-next-button').click(); + checkFrameNum(1); checkDegRotate(180); }); });