From 165cf0fe5b8d59e18a501f010b0d092520e08f63 Mon Sep 17 00:00:00 2001 From: Dmitry Kruchinin <33020454+dvkruchinin@users.noreply.github.com> Date: Tue, 26 Jan 2021 10:29:24 +0300 Subject: [PATCH] Cypress test. Creating a label with existing label name. (#2705) --- ...3_create_label_with_existing_label_name.js | 34 +++++++++++++++++++ 1 file changed, 34 insertions(+) create mode 100644 tests/cypress/integration/actions_tasks_objects/case_43_create_label_with_existing_label_name.js diff --git a/tests/cypress/integration/actions_tasks_objects/case_43_create_label_with_existing_label_name.js b/tests/cypress/integration/actions_tasks_objects/case_43_create_label_with_existing_label_name.js new file mode 100644 index 000000000000..198f77889868 --- /dev/null +++ b/tests/cypress/integration/actions_tasks_objects/case_43_create_label_with_existing_label_name.js @@ -0,0 +1,34 @@ +// Copyright (C) 2021 Intel Corporation +// +// SPDX-License-Identifier: MIT + +/// + +import { taskName } from '../../support/const'; + +context('Creating a label with existing label name.', () => { + const caseId = '43'; + let firstLabelName = ''; + + before(() => { + cy.openTask(taskName); + }); + + describe(`Testing case "${caseId}"`, () => { + it('Try to create a label with existing name. Should not be successful.', () => { + // Get the name of the first existing label. + cy.get('.cvat-constructor-viewer-item') + .first() + .then((firstLabel) => { + firstLabelName = firstLabel.text(); + // Try to create a label with existing label name + cy.get('.cvat-constructor-viewer-new-item').click(); + cy.get('[placeholder="Label name"]').type(firstLabelName); + cy.contains('[type="submit"]', 'Done').click(); + }); + cy.get('.cvat-notification-notice-update-task-failed') + .should('exist') + .and('contain.text', 'label names must be unique'); + }); + }); +});