Cypress test optimization. (#2343)
* First step * Second step * Third step * Change css class to find a task. * Increase image count to 50, segmentSize to 10 Test adaptation. Some fix. Co-authored-by: Kruchinin <dmitryx.kruchinin@intel.com>main
parent
3745c70504
commit
534ad3940c
@ -0,0 +1,36 @@
|
||||
/*
|
||||
* Copyright (C) 2020 Intel Corporation
|
||||
*
|
||||
* SPDX-License-Identifier: MIT
|
||||
*/
|
||||
|
||||
/// <reference types="cypress" />
|
||||
|
||||
import { taskName, advancedConfigurationParams } from '../../support/const'
|
||||
|
||||
context('Being able to return to the job list for a task and start a new job without an infinite loading screen.', () => {
|
||||
|
||||
const issueId = '1944'
|
||||
|
||||
before(() => {
|
||||
cy.openTaskJob(taskName)
|
||||
})
|
||||
|
||||
describe(`Testing issue "${issueId}"`, () => {
|
||||
it('The first job opened', () => {
|
||||
cy.get('input[role="spinbutton"]')
|
||||
.should('have.value', '0')
|
||||
})
|
||||
it('Return to tasks page', () => {
|
||||
cy.get('[value="tasks"]').click()
|
||||
cy.url().should('include', '/tasks').and('not.contain', '/jobs')
|
||||
})
|
||||
it('Open the task. Open second job', () => {
|
||||
cy.openTaskJob(taskName, 1)
|
||||
cy.get('.cvat-annotation-header')
|
||||
.should('exist')
|
||||
cy.get('input[role="spinbutton"]')
|
||||
.should('have.value', advancedConfigurationParams.segmentSize)
|
||||
})
|
||||
})
|
||||
})
|
||||
@ -1,66 +0,0 @@
|
||||
/*
|
||||
* Copyright (C) 2020 Intel Corporation
|
||||
*
|
||||
* SPDX-License-Identifier: MIT
|
||||
*/
|
||||
|
||||
/// <reference types="cypress" />
|
||||
|
||||
context('Being able to return to the job list for a task and start a new job without an infinite loading screen.', () => {
|
||||
|
||||
const issueId = '1944'
|
||||
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 imagesCount = 4
|
||||
let images = []
|
||||
for ( let i = 1; i <= imagesCount; i++) {
|
||||
images.push(`image_${issueId}_${i}.png`)
|
||||
}
|
||||
const width = 800
|
||||
const height = 800
|
||||
const posX = 10
|
||||
const posY = 10
|
||||
const color = 'gray'
|
||||
const archiveName = `images_issue_${issueId}.zip`
|
||||
const archivePath = `cypress/fixtures/${archiveName}`
|
||||
const imagesFolder = `cypress/fixtures/image_issue_${issueId}`
|
||||
const directoryToArchive = imagesFolder
|
||||
const advancedConfigurationParams = {
|
||||
multiJobs: true,
|
||||
segmentSize: 1
|
||||
}
|
||||
|
||||
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 issue "${issueId}"`, () => {
|
||||
it('Create a multijob task', () => {
|
||||
cy.createAnnotationTask(taskName, labelName, attrName, textDefaultValue, archiveName,
|
||||
null, advancedConfigurationParams)
|
||||
})
|
||||
it('Open the task. Open first job', () => {
|
||||
cy.openTaskJob(taskName)
|
||||
cy.get('input[role="spinbutton"]')
|
||||
.should('have.value', '0')
|
||||
})
|
||||
it('Return to tasks page', () => {
|
||||
cy.get('[value="tasks"]').click()
|
||||
cy.url().should('include', '/tasks').and('not.contain', '/jobs')
|
||||
})
|
||||
it('Open the task. Open second job', () => {
|
||||
cy.openTaskJob(taskName, 1)
|
||||
cy.get('.cvat-annotation-header')
|
||||
.should('exist')
|
||||
cy.get('input[role="spinbutton"]')
|
||||
.should('have.value', '1')
|
||||
})
|
||||
})
|
||||
})
|
||||
@ -0,0 +1,58 @@
|
||||
/*
|
||||
* Copyright (C) 2020 Intel Corporation
|
||||
*
|
||||
* SPDX-License-Identifier: MIT
|
||||
*/
|
||||
|
||||
/// <reference types="cypress" />
|
||||
|
||||
export const labelName = `Main task`
|
||||
export const taskName = `New annotation task for ${labelName}`
|
||||
export const attrName = `Attr for ${labelName}`
|
||||
export const textDefaultValue = 'Some default value for type Text'
|
||||
export const imagesCount = 50
|
||||
export const imageFileName = `image_${labelName.replace(' ', '_').toLowerCase()}`
|
||||
export const width = 800
|
||||
export const height = 800
|
||||
export const posX = 10
|
||||
export const posY = 10
|
||||
export const color = 'gray'
|
||||
export const archiveName = `${imageFileName}.zip`
|
||||
export const archivePath = `cypress/fixtures/${archiveName}`
|
||||
export const imagesFolder = `cypress/fixtures/${imageFileName}`
|
||||
export const directoryToArchive = imagesFolder
|
||||
export const advancedConfigurationParams = {
|
||||
multiJobs: true,
|
||||
segmentSize: 10,
|
||||
sssFrame: true,
|
||||
startFrame: 2,
|
||||
stopFrame: imagesCount,
|
||||
frameStep: 2
|
||||
}
|
||||
export const multiAttrParams = {
|
||||
additionalAttrName: `Attr 2`,
|
||||
additionalValue: `Attr value 2`,
|
||||
typeAttribute: 'Text'
|
||||
}
|
||||
|
||||
it('Prepare to testing', () => {
|
||||
cy.visit('/')
|
||||
cy.login()
|
||||
cy.get('.cvat-tasks-page').should('exist')
|
||||
let listItems = []
|
||||
cy.document().then((doc) => {
|
||||
const collection = Array.from(doc.querySelectorAll('.cvat-item-task-name'))
|
||||
for (let i = 0; i < collection.length; i++) {
|
||||
listItems.push(collection[i].innerText)
|
||||
}
|
||||
if (listItems.indexOf(taskName) === -1) {
|
||||
cy.task('log', 'A task doesn\'t exist. Creating.')
|
||||
cy.imageGenerator(imagesFolder, imageFileName, width, height, color, posX, posY, labelName, imagesCount)
|
||||
cy.createZipArchive(directoryToArchive, archivePath)
|
||||
cy.createAnnotationTask(taskName, labelName, attrName, textDefaultValue, archiveName,
|
||||
multiAttrParams, advancedConfigurationParams)
|
||||
} else {
|
||||
cy.task('log', 'The task exist. Skipping creation.')
|
||||
}
|
||||
})
|
||||
})
|
||||
Loading…
Reference in New Issue