-
Notifications
You must be signed in to change notification settings - Fork 3.1k
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
Changes from 2 commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,64 @@ | ||
/* | ||
* 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.get('[type="submit"]').click() | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Shouldn't There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yes it's better that way. Moved. |
||
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() | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Can we get this button in a simpler way? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
|
||
}) | ||
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') | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Can we escape such long and complex selectors? They are extremely unreliable. Any minor UI change here and these tests will be broken. If you need more specific css selectors, I believe we can add them. In this case we might use for example something like this: The same comment to selectors below There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I tried to shorten the selector. |
||
.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) | ||
}) | ||
}) | ||
}) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why we use strings instead of numbers here?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Jimp successfully handles this format as well. But it is better to use a numeric format. Thanks.