From 2f0d492880dcc82c5ca2e24c7ed7702a023233fb Mon Sep 17 00:00:00 2001 From: Dmitry Kruchinin <33020454+dvkruchinin@users.noreply.github.com> Date: Tue, 26 Jan 2021 12:00:53 +0300 Subject: [PATCH] Cypress test. Changing a label name via label constructor. (#2703) * Cypress test. Changing a label name via label constructor. * Add force true to click. * Apply comments. --- ...change_label_name_via_label_constructor.js | 48 +++++++++++++++++++ 1 file changed, 48 insertions(+) create mode 100644 tests/cypress/integration/actions_tasks_objects/case_42_change_label_name_via_label_constructor.js diff --git a/tests/cypress/integration/actions_tasks_objects/case_42_change_label_name_via_label_constructor.js b/tests/cypress/integration/actions_tasks_objects/case_42_change_label_name_via_label_constructor.js new file mode 100644 index 00000000..13dbf140 --- /dev/null +++ b/tests/cypress/integration/actions_tasks_objects/case_42_change_label_name_via_label_constructor.js @@ -0,0 +1,48 @@ +// Copyright (C) 2021 Intel Corporation +// +// SPDX-License-Identifier: MIT + +/// + +context('Changing a label name via label constructor.', () => { + const caseId = '42'; + const firstLabelName = `First case ${caseId}`; + const secondLabelName = `Second case ${caseId}`; + + before(() => { + cy.visit('auth/login'); + cy.login(); + cy.get('#cvat-create-task-button').click(); + }); + + describe(`Testing case "${caseId}"`, () => { + it('Set empty label name. Press "Done" button. Alert exist.', () => { + cy.get('.cvat-constructor-viewer-new-item').click(); // Open label constructor + cy.contains('[type="submit"]', 'Done').click(); + cy.contains('[role="alert"]', 'Please specify a name').should('exist').and('be.visible'); + }); + + it('Change label name to any other correct value. Press "Done" button. The label created.', () => { + cy.get('[placeholder="Label name"]').type(firstLabelName); + cy.contains('[type="submit"]', 'Done').click(); + cy.get('.cvat-constructor-viewer-item').should('exist').and('have.text', firstLabelName); + }); + + it('Change label name to any other correct value. Press "Cancel". Label name is not changed.', () => { + cy.get('.cvat-constructor-viewer-item').find('[aria-label="edit"]').click(); + cy.get('[placeholder="Label name"]').clear().type(secondLabelName); + cy.contains('[type="button"]', 'Cancel').click(); + cy.get('.cvat-constructor-viewer-item').should('exist').and('have.text', firstLabelName); + }); + + it('Change label name to any other correct value. Press "Done". Label name changed.', () => { + cy.get('.cvat-constructor-viewer-item').find('[aria-label="edit"]').click(); + cy.get('[placeholder="Label name"]').clear().type(secondLabelName); + cy.contains('[type="submit"]', 'Done').click(); + cy.get('.cvat-constructor-viewer-item') + .should('exist') + .and('have.length', 1) + .and('have.text', secondLabelName); + }); + }); +});