Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cypress test for issue 1919 #2013

Merged
merged 3 commits into from
Aug 12, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions tests/cypress.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
"baseUrl": "http://localhost:8080",
"viewportWidth": 1300,
"viewportHeight": 960,
"defaultCommandTimeout": 10000,
"testFiles": [
"auth_page.js",
"issue_*.js"
Expand Down
55 changes: 55 additions & 0 deletions tests/cypress/integration/issue_1919_check_text_attr.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
/*
* Copyright (C) 2020 Intel Corporation
*
* SPDX-License-Identifier: MIT
*/

/// <reference types="cypress" />

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.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('Open object menu', () => {
cy.get('#cvat_canvas_shape_1').trigger('mousemove').rightclick()
})
it('Open object menu 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')
.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-state-item-1')
.find('.cvat-object-item-text-attribute')
.should('have.value', newLabelAttrValue)
})
})
})
18 changes: 18 additions & 0 deletions tests/cypress/support/commands.js
Original file line number Diff line number Diff line change
Expand Up @@ -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',
Expand All @@ -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()
Expand Down