From 979bd33ccd3f8e1fd87fa9b2a158e21b9ef1cff9 Mon Sep 17 00:00:00 2001 From: DmitriyOparin <35344996+DmitriyOparin@users.noreply.github.com> Date: Tue, 22 Dec 2020 22:03:51 +0300 Subject: [PATCH] Cypress test. Always show object details feature. (#2581) * add test * removed create several objects * fix number test Co-authored-by: Dmitriy Oparin --- ...e_36_always_show_object_details_feature.js | 79 +++++++++++++++++++ 1 file changed, 79 insertions(+) create mode 100644 tests/cypress/integration/actions_tasks_objects/case_36_always_show_object_details_feature.js diff --git a/tests/cypress/integration/actions_tasks_objects/case_36_always_show_object_details_feature.js b/tests/cypress/integration/actions_tasks_objects/case_36_always_show_object_details_feature.js new file mode 100644 index 000000000..b915eafd3 --- /dev/null +++ b/tests/cypress/integration/actions_tasks_objects/case_36_always_show_object_details_feature.js @@ -0,0 +1,79 @@ +// Copyright (C) 2020 Intel Corporation +// +// SPDX-License-Identifier: MIT + +/// + +import { taskName, labelName } from '../../support/const'; + +context('Always show object details feature', () => { + const caseId = '36'; + const rectangleShape2Points = { + points: 'By 2 Points', + type: 'Shape', + labelName: labelName, + firstX: 400, + firstY: 100, + secondX: 500, + secondY: 200, + }; + const polygonTrack = { + reDraw: false, + type: 'Track', + labelName: labelName, + pointsMap: [ + { x: 400, y: 300 }, + { x: 500, y: 300 }, + { x: 450, y: 350 }, + ], + complete: true, + numberOfPoints: null, + }; + + function checkShowDetails(stateFirstDetails, stateSecondDetails) { + cy.get('#cvat_canvas_text_content').within(() => { + cy.contains(`${labelName} 1`).should(stateFirstDetails); + cy.contains(`${labelName} 2`).should(stateSecondDetails); + }); + } + + before(() => { + cy.openTaskJob(taskName); + + // create objects + cy.createRectangle(rectangleShape2Points); + cy.createPolygon(polygonTrack); + }); + + describe(`Testing case "${caseId}"`, () => { + it('Show details only on activated object', () => { + // deactivate objects + cy.get('body').click(); + checkShowDetails('not.exist', 'not.exist'); + + // activate first object + cy.get('#cvat_canvas_shape_1') + .should('not.have.class', 'cvat_canvas_shape_activated') + .trigger('mousemove') + .should('have.class', 'cvat_canvas_shape_activated'); + checkShowDetails('be.visible', 'not.exist'); + }); + + it('Show details all object', () => { + // deactivate objects + cy.get('body').click(); + checkShowDetails('not.exist', 'not.exist'); + + // set checkbox show text always + cy.openSettings(); + cy.get('.cvat-settings-modal').within(() => { + cy.contains('Workspace').click(); + cy.get('.cvat-workspace-settings-show-text-always').within(() => { + cy.get('[type="checkbox"]').check(); + }); + }); + cy.closeSettings(); + checkShowDetails('be.visible', 'be.visible'); + }); + }); +}); -- GitLab