diff --git a/tests/cypress.json b/tests/cypress.json index 4f32312dc758..51422aa13a7f 100644 --- a/tests/cypress.json +++ b/tests/cypress.json @@ -3,6 +3,7 @@ "baseUrl": "http://localhost:8080", "viewportWidth": 1300, "viewportHeight": 960, + "defaultCommandTimeout": 10000, "testFiles": [ "auth_page.js", "issue_*.js" diff --git a/tests/cypress/integration/issue_1870_cursor_not_jump_to_end.js b/tests/cypress/integration/issue_1870_cursor_not_jump_to_end.js new file mode 100644 index 000000000000..e44ea21ce4bd --- /dev/null +++ b/tests/cypress/integration/issue_1870_cursor_not_jump_to_end.js @@ -0,0 +1,43 @@ +/* + * Copyright (C) 2020 Intel Corporation + * + * SPDX-License-Identifier: MIT + */ + +/// + +context('Checks that the cursor doesn\'t automatically jump to the end of a word when the attribute value changes', () => { + + const issueId = '1870' + const labelName = `Issue ${issueId}` + const taskName = `New annotation task for ${labelName}` + const attrName = `Attr for ${labelName}` + const textDefaultValue = 'text' + const image = `image_${issueId}.png` + const newLabelAttrValue = 'teeext' + 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) + cy.createShape(309, 431, 616, 671) + }) + + describe(`Testing issue "${issueId}"`, () => { + it('Enter 2 characters in the middle of the word attribute value and check the result', () => { + cy.get('#cvat-objects-sidebar-state-item-1') + .find('.ant-collapse-item') + .click() + .find('.cvat-object-item-text-attribute') + .type('{leftarrow}{leftarrow}ee') + .should('have.value', newLabelAttrValue) + }) + }) +}) diff --git a/tests/cypress/support/commands.js b/tests/cypress/support/commands.js index 1601e60b36da..d8c338c87c21 100644 --- a/tests/cypress/support/commands.js +++ b/tests/cypress/support/commands.js @@ -12,6 +12,7 @@ require('../plugins/imageGenerator/imageGeneratorCommand') Cypress.Commands.add('login', (username='admin', password='12qwaszx') => { cy.get('[placeholder="Username"]').type(username) cy.get('[placeholder="Password"]').type(password) + cy.get('[type="submit"]').click() }) Cypress.Commands.add('createAnnotationTask', (taksName='New annotation task', @@ -37,6 +38,23 @@ Cypress.Commands.add('createAnnotationTask', (taksName='New annotation task', cy.url().should('include', '/tasks?page=') }) +Cypress.Commands.add('openTask', (taskName) => { + cy.contains('strong', taskName) + .parents('.cvat-tasks-list-item') + .contains('a', 'Open') + .click() +}) + +Cypress.Commands.add('openJob', () => { + cy.contains('a', 'Job #').click() + cy.url().should('include', '/jobs') +}) + +Cypress.Commands.add('openTaskJob', (taskName) => { + cy.openTask(taskName) + cy.openJob() +}) + Cypress.Commands.add('createShape', (ferstX, ferstY, lastX, lastY) => { cy.get(':nth-child(8) > svg').trigger('mousemove').click() cy.get(':nth-child(6) > :nth-child(1) > .ant-btn').click()