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 1870 #2016

Merged
merged 2 commits into from
Aug 12, 2020
Merged
Changes from 1 commit
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
57 changes: 57 additions & 0 deletions tests/cypress/integration/issue_1870_cursor_not_jump_to_end.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
/*
* Copyright (C) 2020 Intel Corporation
*
* SPDX-License-Identifier: MIT
*/

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

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.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('Check what cursor doesn\'t automatically jumps at the end of the word', () => {
cy.get('.ant-row > .ant-collapse > .ant-collapse-item > .ant-collapse-header > span')
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not really reliable selector. It is better to use an identificator before. Here can be a lot of collapses in the future.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I tried to shorten selector.

.should('contain', 'Details')
.click()
cy.get('.ant-input')
.type('{leftarrow}{leftarrow}ee')
cy.get('.ant-input')
.should('have.value', newLabelAttrValue)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we unite it to the same chain without extra cy.get()?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, we can. I've reworked this part of the code a bit.

})
})
})