From a6884427d4d29e9de4fa8f783c5cc77a5262bc6d Mon Sep 17 00:00:00 2001 From: Dmitry Kruchinin <33020454+dvkruchinin@users.noreply.github.com> Date: Tue, 1 Sep 2020 12:06:03 +0300 Subject: [PATCH] Cypress test for issue 1540. (#2096) Co-authored-by: Dmitry Kruchinin --- .../integration/issue_1540_add_remove_tag.js | 52 +++++++++++++++++++ tests/cypress/support/commands.js | 10 ++++ 2 files changed, 62 insertions(+) create mode 100644 tests/cypress/integration/issue_1540_add_remove_tag.js diff --git a/tests/cypress/integration/issue_1540_add_remove_tag.js b/tests/cypress/integration/issue_1540_add_remove_tag.js new file mode 100644 index 00000000..683985b6 --- /dev/null +++ b/tests/cypress/integration/issue_1540_add_remove_tag.js @@ -0,0 +1,52 @@ +/* + * Copyright (C) 2020 Intel Corporation + * + * SPDX-License-Identifier: MIT + */ + +/// + +context('Check if the UI not to crash after remove a tag', () => { + + const issueId = '1540' + const labelName = `Issue ${issueId}` + const taskName = `New annotation task for ${labelName}` + const attrName = `Attr for ${labelName}` + const textDefaultValue = 'Some default value for type Text' + const image = `image_${issueId}.png` + const width = 800 + const height = 800 + const posX = 10 + const posY = 10 + const color = 'gray' + + before(() => { + cy.visit('auth/login') + cy.login() + cy.imageGenerator('cypress/fixtures', image, width, height, color, posX, posY, labelName) + cy.createAnnotationTask(taskName, labelName, attrName, textDefaultValue, image) + cy.openTaskJob(taskName) + }) + + describe(`Testing issue "${issueId}"`, () => { + it('Add a tag', () => { + cy.changeAnnotationMode('Tag annotation') + cy.get('.cvat-tag-annotation-sidebar-buttons').within(() => { + cy.get('button') + .contains('Add tag') + .click({force: true}) + }) + cy.changeAnnotationMode('Standard') + }) + it('Remove the tag', () => { + cy.get('#cvat-objects-sidebar-state-item-1') + .should('contain', '1').and('contain', 'TAG') + .trigger('mouseover') + .trigger('keydown', {key: 'Delete'}) + }) + it('Page with the error is missing', () => { + cy.contains('Oops, something went wrong') + .should('not.exist') + }) + }) +}) diff --git a/tests/cypress/support/commands.js b/tests/cypress/support/commands.js index 519a4433..b0274a4a 100644 --- a/tests/cypress/support/commands.js +++ b/tests/cypress/support/commands.js @@ -170,3 +170,13 @@ Cypress.Commands.add('closeSettings', () => { cy.contains('button', 'Close').click() }) }) + +Cypress.Commands.add('changeAnnotationMode', (mode) => { + cy.get('.cvat-workspace-selector') + .click() + cy.get('.ant-select-dropdown-menu-item') + .contains(mode) + .click() + cy.get('.cvat-workspace-selector') + .should('contain.text', mode) +})