From cf4b37153a5841dbbe8d6738b88a317014684083 Mon Sep 17 00:00:00 2001 From: Dmitry Kruchinin Date: Tue, 11 Aug 2020 12:05:07 +0300 Subject: [PATCH 1/3] Cypress test for issue 1919 --- .../integration/issue_1919_check_text_attr.js | 64 +++++++++++++++++++ 1 file changed, 64 insertions(+) create mode 100644 tests/cypress/integration/issue_1919_check_text_attr.js diff --git a/tests/cypress/integration/issue_1919_check_text_attr.js b/tests/cypress/integration/issue_1919_check_text_attr.js new file mode 100644 index 000000000000..3f64abe326b5 --- /dev/null +++ b/tests/cypress/integration/issue_1919_check_text_attr.js @@ -0,0 +1,64 @@ +/* + * Copyright (C) 2020 Intel Corporation + * + * SPDX-License-Identifier: MIT + */ + +/// + +context('Check label attribute changes', () => { + + const issueId='1919' + 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 newLabelAttrValue = 'New attribute value' + const width='800' + const height='800' + const posX=10 + const posY=10 + const color='gray' + + before(() => { + cy.visit('auth/login') + cy.login() + cy.get('[type="submit"]').click() + cy.imageGenerator('cypress/fixtures', image, width, height, color, posX, posY, labelName) + cy.createAnnotationTask(taskName, labelName, attrName, textDefaultValue, image) + }) + + describe(`Open task "${taskName}"`, () => { + it('The annotation task present in the list', () => { + cy.contains('strong', taskName) + .parent() + .parent() + .parent() + .contains('a', 'Open').click() + }) + it('Open a job', () => { + cy.contains('a', 'Job #').click() + cy.url().should('include', '/jobs') + }) + it('Create a shape', () => { + cy.createShape(309, 431, 616, 671) + }) + it('Open object menu on the created shape', () => { + cy.get('#cvat_canvas_shape_1').trigger('mousemove').rightclick() + }) + it('Open object menu details', () => { + cy.get('.cvat-canvas-context-menu > [style="display: flex; margin-bottom: 1px;"] > #cvat-objects-sidebar-state-item-1 > .ant-row > .ant-collapse > .ant-collapse-item > .ant-collapse-header > span') + .should('contain', 'Details') + .click() + }) + it('Clear field of text attribute and write new value', () => { + cy.get('.cvat-canvas-context-menu > [style="display: flex; margin-bottom: 1px;"] > #cvat-objects-sidebar-state-item-1 > .ant-row > .ant-collapse > .ant-collapse-item > .ant-collapse-content > .ant-collapse-content-box > .ant-row-flex > .ant-col-16 > .ant-input') + .clear().type(newLabelAttrValue) + }) + it('Check what value of right panel is changed too', () => { + cy.get('.cvat-objects-sidebar-states-list > [style="display: flex; margin-bottom: 1px;"] > #cvat-objects-sidebar-state-item-1 > .ant-row > .ant-collapse > .ant-collapse-item > .ant-collapse-content > .ant-collapse-content-box > .ant-row-flex > .ant-col-16 > .ant-input') + .should('have.value', newLabelAttrValue) + }) + }) +}) From 54c5371cae15a8625b95147160013e5202d7edfb Mon Sep 17 00:00:00 2001 From: Dmitry Kruchinin Date: Tue, 11 Aug 2020 14:25:11 +0300 Subject: [PATCH 2/3] Increase value of "defaultCommandTimeout" to 10000ms --- tests/cypress.json | 1 + 1 file changed, 1 insertion(+) 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" From 3aebacc6430d5e44701cd242eb0cdb4caaad5429 Mon Sep 17 00:00:00 2001 From: Dmitry Kruchinin Date: Wed, 12 Aug 2020 12:50:49 +0300 Subject: [PATCH 3/3] Appying comments. --- .../integration/issue_1919_check_text_attr.js | 57 ++++++++----------- tests/cypress/support/commands.js | 18 ++++++ 2 files changed, 42 insertions(+), 33 deletions(-) diff --git a/tests/cypress/integration/issue_1919_check_text_attr.js b/tests/cypress/integration/issue_1919_check_text_attr.js index 3f64abe326b5..ea6fca779eac 100644 --- a/tests/cypress/integration/issue_1919_check_text_attr.js +++ b/tests/cypress/integration/issue_1919_check_text_attr.js @@ -8,56 +8,47 @@ context('Check label attribute changes', () => { - const issueId='1919' - 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 issueId = '1919' + 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 newLabelAttrValue = 'New attribute value' - const width='800' - const height='800' - const posX=10 - const posY=10 - const color='gray' + const width = 800 + const height = 800 + const posX = 10 + const posY = 10 + const color = 'gray' before(() => { cy.visit('auth/login') cy.login() - cy.get('[type="submit"]').click() 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(`Open task "${taskName}"`, () => { - it('The annotation task present in the list', () => { - cy.contains('strong', taskName) - .parent() - .parent() - .parent() - .contains('a', 'Open').click() - }) - it('Open a job', () => { - cy.contains('a', 'Job #').click() - cy.url().should('include', '/jobs') - }) - it('Create a shape', () => { - cy.createShape(309, 431, 616, 671) - }) - it('Open object menu on the created shape', () => { + describe(`Testing issue "${issueId}"`, () => { + it('Open object menu', () => { cy.get('#cvat_canvas_shape_1').trigger('mousemove').rightclick() }) it('Open object menu details', () => { - cy.get('.cvat-canvas-context-menu > [style="display: flex; margin-bottom: 1px;"] > #cvat-objects-sidebar-state-item-1 > .ant-row > .ant-collapse > .ant-collapse-item > .ant-collapse-header > span') - .should('contain', 'Details') + cy.get('.cvat-canvas-context-menu') + .contains('Details') .click() }) it('Clear field of text attribute and write new value', () => { - cy.get('.cvat-canvas-context-menu > [style="display: flex; margin-bottom: 1px;"] > #cvat-objects-sidebar-state-item-1 > .ant-row > .ant-collapse > .ant-collapse-item > .ant-collapse-content > .ant-collapse-content-box > .ant-row-flex > .ant-col-16 > .ant-input') - .clear().type(newLabelAttrValue) + cy.get('.cvat-canvas-context-menu') + .find('.cvat-object-item-text-attribute') + .should('have.value', textDefaultValue) + .clear() + .type(newLabelAttrValue) }) it('Check what value of right panel is changed too', () => { - cy.get('.cvat-objects-sidebar-states-list > [style="display: flex; margin-bottom: 1px;"] > #cvat-objects-sidebar-state-item-1 > .ant-row > .ant-collapse > .ant-collapse-item > .ant-collapse-content > .ant-collapse-content-box > .ant-row-flex > .ant-col-16 > .ant-input') + cy.get('#cvat-objects-sidebar-state-item-1') + .find('.cvat-object-item-text-attribute') .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()