Cypress test to check task parameters frame (#2164)

* Cypress test to check if parameters "startFrame", "stopFrame", "frameStep" works as expected

* Apply comments.

Co-authored-by: Dmitry Kruchinin <dmitryx.kruchinin@intel.com>
main
Dmitry Kruchinin 5 years ago committed by GitHub
parent 59b338994d
commit b5b872fa97
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -0,0 +1,79 @@
/*
* Copyright (C) 2020 Intel Corporation
*
* SPDX-License-Identifier: MIT
*/
/// <reference types="cypress" />
context('Check if parameters "startFrame", "stopFrame", "frameStep" works as expected', () => {
const caseId = '3'
const labelName = `Case ${caseId}`
const taskName = `New annotation task for ${labelName}`
const attrName = `Attr for ${labelName}`
const textDefaultValue = 'Some default value for type Text'
const imagesCount = 10
const imageFileName = `image_${labelName.replace(' ', '_').toLowerCase()}`
let images = []
for ( let i = 1; i <= imagesCount; i++) {
images.push(`${imageFileName}_${i}.png`)
}
const width = 800
const height = 800
const posX = 10
const posY = 10
const color = 'gray'
const archiveName = `${imageFileName}.zip`
const archivePath = `cypress/fixtures/${archiveName}`
const imagesFolder = `cypress/fixtures/${imageFileName}`
const directoryToArchive = imagesFolder
const advancedConfigurationParams = {
multiJobs: false,
sssFrame: true,
startFrame: 2,
stopFrame: 8,
frameStep: 2
}
before(() => {
cy.visit('auth/login')
cy.login()
for (let img of images) {
cy.imageGenerator(imagesFolder, img, width, height, color, posX, posY, labelName)
}
cy.createZipArchive(directoryToArchive, archivePath)
})
describe(`Testing "${labelName}"`, () => {
it('Create a task. Open the task.', () => {
cy.createAnnotationTask(taskName, labelName, attrName, textDefaultValue, archiveName,
null, advancedConfigurationParams)
cy.openTaskJob(taskName)
})
it('Parameters "startFrame", "stopFrame", "frameStep" works as expected ', () => {
cy.get('.cvat-player-filename-wrapper')
.should('contain', `${imageFileName}_${advancedConfigurationParams.startFrame}.png`)
cy.get('.cvat-player-frame-selector').within(() => {
cy.get('input[role="spinbutton"]')
.should('have.value', '0')
})
cy.get('.cvat-player-next-button')
.click()
cy.get('.cvat-player-filename-wrapper')
.should('contain', `${imageFileName}_${advancedConfigurationParams.startFrame + advancedConfigurationParams.frameStep}.png`)
cy.get('.cvat-player-frame-selector').within(() => {
cy.get('input[role="spinbutton"]')
.should('have.value', '1')
})
cy.get('.cvat-player-last-button')
.click()
cy.get('.cvat-player-filename-wrapper')
.should('contain', `${imageFileName}_${advancedConfigurationParams.stopFrame}.png`)
cy.get('.cvat-player-frame-selector').within(() => {
cy.get('input[role="spinbutton"]')
.should('have.value', '3')
})
})
})
})

@ -19,9 +19,11 @@ context('The highlighted attribute in AAM should correspond to the chosen attrib
const posX = 10
const posY = 10
const color = 'gray'
const additionalAttrName = `Attr 2`
const additionalValue = `Attr value 2`
const typeAttribute = 'Text'
const multiAttrParams = {
additionalAttrName: `Attr 2`,
additionalValue: `Attr value 2`,
typeAttribute: 'Text'
}
let textValue = ''
before(() => {
@ -32,7 +34,7 @@ context('The highlighted attribute in AAM should correspond to the chosen attrib
describe(`Testing issue "${issueId}"`, () => {
it('Create a task with multiple attributes, create a object', () => {
cy.createAnnotationTask(taskName, labelName, attrName, textDefaultValue, image, false, 1, true, additionalAttrName, typeAttribute, additionalValue)
cy.createAnnotationTask(taskName, labelName, attrName, textDefaultValue, image, multiAttrParams)
cy.openTaskJob(taskName)
cy.createShape(309, 431, 616, 671)
})

@ -27,7 +27,10 @@ context('Being able to return to the job list for a task and start a new job wit
const archivePath = `cypress/fixtures/${archiveName}`
const imagesFolder = `cypress/fixtures/image_issue_${issueId}`
const directoryToArchive = imagesFolder
const multiJobs = true
const advancedConfigurationParams = {
multiJobs: true,
segmentSize: 1
}
before(() => {
cy.visit('auth/login')
@ -40,7 +43,8 @@ context('Being able to return to the job list for a task and start a new job wit
describe(`Testing issue "${issueId}"`, () => {
it('Create a multijob task', () => {
cy.createAnnotationTask(taskName, labelName, attrName, textDefaultValue, archiveName, multiJobs)
cy.createAnnotationTask(taskName, labelName, attrName, textDefaultValue, archiveName,
null, advancedConfigurationParams)
})
it('Open the task. Open first job', () => {
cy.openTaskJob(taskName)

@ -40,12 +40,9 @@ Cypress.Commands.add('createAnnotationTask', (taksName='New annotation task',
attrName='Some attr name',
textDefaultValue='Some default value for type Text',
image='image.png',
multiJobs=false,
segmentSize=1,
multiAttr=false,
additionalAttrName,
typeAttribute,
additionalValue) => {
multiAttrParams,
advancedConfigurationParams
) => {
cy.get('#cvat-create-task-button').click()
cy.url().should('include', '/tasks/create')
cy.get('[id="name"]').type(taksName)
@ -56,15 +53,13 @@ Cypress.Commands.add('createAnnotationTask', (taksName='New annotation task',
cy.get('div[title="Select"]').click()
cy.get('li').contains('Text').click()
cy.get('[placeholder="Default value"]').type(textDefaultValue)
if (multiAttr) {
cy.updateAttributes(additionalAttrName, typeAttribute, additionalValue)
if (multiAttrParams) {
cy.updateAttributes(multiAttrParams)
}
cy.contains('button', 'Done').click()
cy.get('input[type="file"]').attachFile(image, { subjectType: 'drag-n-drop' })
if (multiJobs) {
cy.contains('Advanced configuration').click()
cy.get('#segmentSize')
.type(segmentSize)
if (advancedConfigurationParams) {
cy.advancedConfiguration(advancedConfigurationParams)
}
cy.contains('button', 'Submit').click()
cy.contains('The task has been created')
@ -213,12 +208,12 @@ Cypress.Commands.add('createCuboid', (mode, firstX, firstY, lastX, lastY) => {
.click(lastX, lastY)
})
Cypress.Commands.add('updateAttributes', (additionalAttrName, typeAttribute, additionalValue) => {
Cypress.Commands.add('updateAttributes', (multiAttrParams) => {
cy.contains('button', 'Add an attribute').click()
cy.get('[placeholder="Name"]').first().type(additionalAttrName)
cy.get('[placeholder="Name"]').first().type(multiAttrParams.additionalAttrName)
cy.get('div[title="Select"]').first().click()
cy.get('.ant-select-dropdown').last().contains(typeAttribute).click()
cy.get('[placeholder="Default value"]').first().type(additionalValue)
cy.get('.ant-select-dropdown').last().contains(multiAttrParams.typeAttribute).click()
cy.get('[placeholder="Default value"]').first().type(multiAttrParams.additionalValue)
})
Cypress.Commands.add('createPolyline', (mode,
@ -264,3 +259,16 @@ Cypress.Commands.add('deleteTask', (taskName, taskID) => {
.click()
})
})
Cypress.Commands.add('advancedConfiguration', (advancedConfigurationParams) => {
cy.contains('Advanced configuration').click()
if (advancedConfigurationParams.multiJobs) {
cy.get('#segmentSize')
.type(advancedConfigurationParams.segmentSize)
}
if (advancedConfigurationParams.sssFrame) {
cy.get('#startFrame').type(advancedConfigurationParams.startFrame)
cy.get('#stopFrame').type(advancedConfigurationParams.stopFrame)
cy.get('#frameStep').type(advancedConfigurationParams.frameStep)
}
})

Loading…
Cancel
Save