From 4379642bb0f01fbeb71384b47edb4e6e5df1fea4 Mon Sep 17 00:00:00 2001 From: Kruchinin Date: Mon, 30 Nov 2020 11:51:57 +0300 Subject: [PATCH 1/3] Cypress test. Canvas grid feature. --- .../case_23_canvas_grid_feature.js | 53 +++++++++++++++++++ 1 file changed, 53 insertions(+) create mode 100644 tests/cypress/integration/actions_tasks_objects/case_23_canvas_grid_feature.js diff --git a/tests/cypress/integration/actions_tasks_objects/case_23_canvas_grid_feature.js b/tests/cypress/integration/actions_tasks_objects/case_23_canvas_grid_feature.js new file mode 100644 index 00000000..92e2d303 --- /dev/null +++ b/tests/cypress/integration/actions_tasks_objects/case_23_canvas_grid_feature.js @@ -0,0 +1,53 @@ +// Copyright (C) 2020 Intel Corporation +// +// SPDX-License-Identifier: MIT + +/// + +import { taskName } from '../../support/const'; + +context('Canvas color feature', () => { + const caseId = '23'; + const settingsGridSize = 50; + const gridColor = 'Black'; + const gridOpacity = 49; + + before(() => { + cy.openTaskJob(taskName); + }); + + describe(`Testing case "${caseId}"`, () => { + it('Go to settings.', () => { + cy.openSettings(); + }); + it('Set "Show grid" to true.', () => { + cy.get('.cvat-player-settings-grid').click(); + }); + it('Set "Grid size" to 50.', () => { + cy.get('.cvat-player-settings-grid-size-input').within(() => { + cy.get('[role="spinbutton"]').clear().type(settingsGridSize); + }); + }); + it('Set "Grid color" to black.', () => { + cy.get('.cvat-player-settings-grid-color-input').click(); + cy.get('.ant-select-dropdown') + .not('.ant-select-dropdown-hidden') + .contains(new RegExp(`^${gridColor}$`, 'g')) + .click(); + }); + it('Set "Grid opacity" to 49%.', () => { + cy.get('.cvat-player-settings-grid-opacity-input') + .click() + .within(() => { + cy.get('[role="slider"]').should('have.attr', 'aria-valuenow', gridOpacity); + }); + }); + it('Canvas has grid drawn, it is black, cells are 50x50px and it has 49% opacity.', () => { + cy.get('#cvat_canvas_grid_pattern') + .should('exist') // expected to exist in the DOM + .and('have.attr', 'width', settingsGridSize) // expected to have attribute width with the value '50' + .and('have.attr', 'height', settingsGridSize) // expected to have attribute height with the value '50' + .and('have.attr', 'style', `stroke: ${gridColor.toLowerCase()}; opacity: ${gridOpacity / 100};`); // expected to have attribute style with the value stroke: black; opacity: 0.49; + }); + }); +}); From 6510e121d1147120f22832bb8c2c0313603447db Mon Sep 17 00:00:00 2001 From: Kruchinin Date: Mon, 30 Nov 2020 12:55:01 +0300 Subject: [PATCH 2/3] Minor fix. --- .../actions_tasks_objects/case_23_canvas_grid_feature.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/cypress/integration/actions_tasks_objects/case_23_canvas_grid_feature.js b/tests/cypress/integration/actions_tasks_objects/case_23_canvas_grid_feature.js index 92e2d303..fe17bf02 100644 --- a/tests/cypress/integration/actions_tasks_objects/case_23_canvas_grid_feature.js +++ b/tests/cypress/integration/actions_tasks_objects/case_23_canvas_grid_feature.js @@ -6,7 +6,7 @@ import { taskName } from '../../support/const'; -context('Canvas color feature', () => { +context('Canvas grid feature', () => { const caseId = '23'; const settingsGridSize = 50; const gridColor = 'Black'; From 627562fe09351a4cc36135dd9cbdb34e0988fd35 Mon Sep 17 00:00:00 2001 From: Kruchinin Date: Tue, 1 Dec 2020 08:04:12 +0300 Subject: [PATCH 3/3] Apply comments. --- .../case_23_canvas_grid_feature.js | 17 ++++++++++++----- 1 file changed, 12 insertions(+), 5 deletions(-) diff --git a/tests/cypress/integration/actions_tasks_objects/case_23_canvas_grid_feature.js b/tests/cypress/integration/actions_tasks_objects/case_23_canvas_grid_feature.js index fe17bf02..61863a37 100644 --- a/tests/cypress/integration/actions_tasks_objects/case_23_canvas_grid_feature.js +++ b/tests/cypress/integration/actions_tasks_objects/case_23_canvas_grid_feature.js @@ -43,11 +43,18 @@ context('Canvas grid feature', () => { }); }); it('Canvas has grid drawn, it is black, cells are 50x50px and it has 49% opacity.', () => { - cy.get('#cvat_canvas_grid_pattern') - .should('exist') // expected to exist in the DOM - .and('have.attr', 'width', settingsGridSize) // expected to have attribute width with the value '50' - .and('have.attr', 'height', settingsGridSize) // expected to have attribute height with the value '50' - .and('have.attr', 'style', `stroke: ${gridColor.toLowerCase()}; opacity: ${gridOpacity / 100};`); // expected to have attribute style with the value stroke: black; opacity: 0.49; + cy.get('#cvat_canvas_grid') + .should('be.visible') // expected to be visible + .within(() => { + cy.get('#cvat_canvas_grid_pattern') + .and('have.attr', 'width', settingsGridSize) // expected to have attribute width with the value '50' + .and('have.attr', 'height', settingsGridSize) // expected to have attribute height with the value '50' + .and( + 'have.attr', + 'style', + `stroke: ${gridColor.toLowerCase()}; opacity: ${gridOpacity / 100};`, + ); // expected to have attribute style with the value stroke: black; opacity: 0.49; + }); }); }); });