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
Dmitry Kruchinin 5 years ago committed by GitHub
parent 3745c70504
commit 534ad3940c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -10,9 +10,8 @@
},
"testFiles": [
"auth_page.js",
"issue_*.js",
"pr_*.js",
"case_*.js",
"actions_tasks_objects/*",
"actions_users/*",
"remove_users_tasks.js"
]
}

@ -6,21 +6,12 @@
/// <reference types="cypress" />
import {taskName, labelName} from '../../support/const'
context('Actions on polygon', () => {
const caseId = '10'
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 imageFileName = `image_${labelName.replace(' ', '_').toLowerCase()}`
const image = `${imageFileName}.png`
const newLabelName = `New ${labelName}`
const width = 800
const height = 800
const posX = 10
const posY = 10
const color = 'gray'
const newLabelName = `New label for case ${caseId}`
const createPolygonShape = {
reDraw: false,
type: 'Shape',
@ -99,10 +90,6 @@ context('Actions on polygon', () => {
}
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.openTask(taskName)
})
@ -166,7 +153,7 @@ context('Actions on polygon', () => {
cy.get('#cvat-objects-sidebar-state-item-6')
.should('contain', '6').and('contain', 'POLYGON TRACK').within(() => {
cy.get('.ant-select-selection-selected-value')
.should('contain', labelName)
.should('contain', newLabelName)
})
})
})

@ -7,21 +7,12 @@
/// <reference types="cypress" />
import {taskName, labelName} from '../../support/const'
context('Actions on polylines', () => {
const caseId = '11'
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 imageFileName = `image_${labelName.replace(' ', '_').toLowerCase()}`
const image = `${imageFileName}.png`
const newLabelName = `New ${labelName}`
const width = 800
const height = 800
const posX = 10
const posY = 10
const color = 'gray'
const newLabelName = `New label for case ${caseId}`
const createPolylinesShape = {
type: 'Shape',
switchLabel: false,
@ -94,10 +85,6 @@ context('Actions on polylines', () => {
}
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.openTask(taskName)
})
@ -161,7 +148,7 @@ context('Actions on polylines', () => {
cy.get('#cvat-objects-sidebar-state-item-6')
.should('contain', '6').and('contain', 'POLYLINE TRACK').within(() => {
cy.get('.ant-select-selection-selected-value')
.should('contain', labelName)
.should('contain', newLabelName)
})
})
})

@ -6,21 +6,12 @@
/// <reference types="cypress" />
import {taskName, labelName} from '../../support/const'
context('Actions on points', () => {
const caseId = '12'
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 imageFileName = `image_${labelName.replace(' ', '_').toLowerCase()}`
const image = `${imageFileName}.png`
const newLabelName = `New ${labelName}`
const width = 800
const height = 800
const posX = 10
const posY = 10
const color = 'gray'
const newLabelName = `New label for case ${caseId}`
const createPointsShape = {
type: 'Shape',
switchLabel: false,
@ -93,10 +84,6 @@ context('Actions on points', () => {
}
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.openTask(taskName)
})
@ -160,7 +147,7 @@ context('Actions on points', () => {
cy.get('#cvat-objects-sidebar-state-item-6')
.should('contain', '6').and('contain', 'POINTS TRACK').within(() => {
cy.get('.ant-select-selection-selected-value')
.should('contain', labelName)
.should('contain', newLabelName)
})
})
})

@ -15,10 +15,6 @@ context('Check if parameters "startFrame", "stopFrame", "frameStep" works as exp
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
@ -39,12 +35,17 @@ context('Check if parameters "startFrame", "stopFrame", "frameStep" works as exp
before(() => {
cy.visit('auth/login')
cy.login()
for (let img of images) {
cy.imageGenerator(imagesFolder, img, width, height, color, posX, posY, labelName)
}
cy.imageGenerator(imagesFolder, imageFileName, width, height, color, posX, posY, labelName, imagesCount)
cy.createZipArchive(directoryToArchive, archivePath)
})
after(() => {
cy.goToTaskList()
cy.getTaskID(taskName).then($taskID => {
cy.deleteTask(taskName, $taskID)
})
})
describe(`Testing "${labelName}"`, () => {
it('Create a task. Open the task.', () => {
cy.createAnnotationTask(taskName, labelName, attrName, textDefaultValue, archiveName,

@ -6,20 +6,11 @@
/// <reference types="cypress" />
import {taskName} from '../../support/const'
context('Check if the image is rotated', () => {
const caseId = '5'
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 imageFileName = `image_${labelName.replace(' ', '_').toLowerCase()}`
const image = `${imageFileName}.png`
const width = 800
const height = 800
const posX = 10
const posY = 10
const color = 'gray'
function imageRotate(direction='anticlockwise') {
cy.get('.cvat-rotate-canvas-control')
.trigger('mouseover')
@ -33,14 +24,10 @@ context('Check if the image is rotated', () => {
}
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)
})
describe(`Testing "${labelName}"`, () => {
describe(`Testing case "${caseId}"`, () => {
it('Rotate image clockwise 90deg', () => {
imageRotate('clockwise')
cy.get('#cvat_canvas_background')

@ -6,32 +6,19 @@
/// <reference types="cypress" />
import {taskName} from '../../support/const'
context('Check if the image is scaled and then fitted', () => {
const caseId = '6'
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 imageFileName = `image_${labelName.replace(' ', '_').toLowerCase()}`
const image = `${imageFileName}.png`
const width = 800
const height = 800
const posX = 10
const posY = 10
const color = 'gray'
let scaleBefore = 0
let scaleAfter = 0
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)
})
describe(`Testing "${labelName}"`, () => {
describe(`Testing case "${caseId}"`, () => {
it('Scale image', () => {
cy.get('#cvat_canvas_background')
.should('have.attr', 'style')

@ -6,32 +6,19 @@
/// <reference types="cypress" />
import {taskName} from '../../support/const'
context('Check if image was scaled to ROI', () => {
const caseId = '7'
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 imageFileName = `image_${labelName.replace(' ', '_').toLowerCase()}`
const image = `${imageFileName}.png`
const width = 800
const height = 800
const posX = 10
const posY = 10
const color = 'gray'
let scaleBefore = 0
let scaleAfter = 0
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)
})
describe(`Testing "${labelName}"`, () => {
describe(`Testing case "${caseId}"`, () => {
it('Create ROI', () => {
cy.get('#cvat_canvas_background')
.should('have.attr', 'style')

@ -6,21 +6,12 @@
/// <reference types="cypress" />
import {taskName, labelName} from '../../support/const'
context('Actions on rectangle', () => {
const caseId = '8'
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 imageFileName = `image_${labelName.replace(' ', '_').toLowerCase()}`
const image = `${imageFileName}.png`
const newLabelName = `New ${labelName}`
const width = 800
const height = 800
const posX = 10
const posY = 10
const color = 'gray'
const newLabelName = `New label for case ${caseId}`
const createRectangleShape2Points = {
points: 'By 2 Points',
type: 'Shape',
@ -91,10 +82,6 @@ context('Actions on rectangle', () => {
}
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.openTask(taskName)
})

@ -6,21 +6,12 @@
/// <reference types="cypress" />
import {taskName, labelName} from '../../support/const'
context('Actions on Cuboid', () => {
const caseId = '9'
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 imageFileName = `image_${labelName.replace(' ', '_').toLowerCase()}`
const image = `${imageFileName}.png`
const newLabelName = `New ${labelName}`
const width = 800
const height = 800
const posX = 10
const posY = 10
const color = 'gray'
const newLabelName = `New label for case ${caseId}`
const createCuboidShape2Points = {
points: 'From rectangle',
type: 'Shape',
@ -91,10 +82,6 @@ context('Actions on Cuboid', () => {
}
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.openTask(taskName)
})

@ -6,19 +6,11 @@
/// <reference types="cypress" />
import {taskName} from '../../support/const'
context('Check if UI not fails with shape dragging over sidebar', () => {
const issueId = '1216'
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 width = 800
const height = 800
const posX = 10
const posY = 10
const color = 'gray'
const createRectangleShape2Points = {
points: 'By 2 Points',
type: 'Shape',
@ -39,10 +31,6 @@ context('Check if UI not fails with shape dragging over sidebar', () => {
}
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)
})

@ -6,25 +6,11 @@
/// <reference types="cypress" />
import { taskName } from '../../support/const'
context('Points track it is still invisible on next frames', () => {
const issueId = '1368'
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 images = [`image_${issueId}_1.png`,
`image_${issueId}_2.png`,
`image_${issueId}_3.png`]
const width = 800
const height = 800
const posX = 10
const posY = 10
const color = 'white'
const archiveName = `images_issue_${issueId}.zip`
const archivePath = `cypress/fixtures/${archiveName}`
const imagesFolder = `cypress/fixtures/image_issue_${issueId}`
const directoryToArchive = imagesFolder
const createPointsTrack = {
type: 'Track',
switchLabel: false,
@ -36,13 +22,6 @@ context('Points track it is still invisible on next frames', () => {
}
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)
cy.createAnnotationTask(taskName, labelName, attrName, textDefaultValue, archiveName)
cy.openTaskJob(taskName)
})

@ -6,19 +6,11 @@
/// <reference types="cypress" />
import { taskName } from '../../support/const'
context('When delete a point, the required point is deleted.', () => {
const issueId = '1391'
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 width = 800
const height = 800
const posX = 10
const posY = 10
const color = 'white'
let pointsСoordinatesBeforeDeletePoint = []
let pointsСoordinatesAfterDeletePoint = []
const createPolylinesShape = {
@ -34,10 +26,6 @@ context('When delete a point, the required point is deleted.', () => {
}
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)
})

@ -6,24 +6,11 @@
/// <reference types="cypress" />
import { taskName } from '../../support/const'
context('The highlighted attribute in AAM should correspond to the chosen attribute', () => {
const issueId = '1425'
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 width = 800
const height = 800
const posX = 10
const posY = 10
const color = 'gray'
const multiAttrParams = {
additionalAttrName: `Attr 2`,
additionalValue: `Attr value 2`,
typeAttribute: 'Text'
}
let textValue = ''
const createRectangleShape2Points = {
points: 'By 2 Points',
@ -36,15 +23,11 @@ context('The highlighted attribute in AAM should correspond to the chosen attrib
}
before(() => {
cy.visit('auth/login')
cy.login()
cy.imageGenerator('cypress/fixtures', image, width, height, color, posX, posY, labelName)
cy.openTaskJob(taskName)
})
describe(`Testing issue "${issueId}"`, () => {
it('Create a task with multiple attributes, create a object', () => {
cy.createAnnotationTask(taskName, labelName, attrName, textDefaultValue, image, multiAttrParams)
cy.openTaskJob(taskName)
it('Create a object', () => {
cy.createRectangle(createRectangleShape2Points)
})
it('Go to AAM', () => {

@ -6,20 +6,13 @@
/// <reference types="cypress" />
import { taskName } from '../../support/const'
context('Check if the new label reflects in the options', () => {
const issueId = '1429'
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 newLabelName = `New ${labelName}`
const width = 800
const height = 800
const posX = 10
const posY = 10
const color = 'gray'
const createRectangleShape2Points = {
points: 'By 2 Points',
type: 'Shape',
@ -31,16 +24,10 @@ context('Check if the new label reflects in the options', () => {
}
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)
})
describe(`Testing issue "${issueId}"`, () => {
it('Open a task. Open a job', () => {
cy.openTaskJob(taskName)
})
it('Return to task page using browser button "previous page"', () => {
cy.go('back')
cy.url().should('include', '/tasks').and('not.contain', '/jobs')

@ -6,19 +6,11 @@
/// <reference types="cypress" />
import { taskName } from '../../support/const'
context('Check hide functionality (H)', () => {
const issueId = '1433'
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 width = 800
const height = 800
const posX = 10
const posY = 10
const color = 'gray'
const createRectangleShape2Points = {
points: 'By 2 Points',
type: 'Shape',
@ -30,16 +22,12 @@ context('Check hide functionality (H)', () => {
}
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.createRectangle(createRectangleShape2Points)
})
describe(`Testing issue "${issueId}"`, () => {
it('Object is hidden', () => {
cy.createRectangle(createRectangleShape2Points)
cy.get('#cvat_canvas_shape_1')
.trigger('mousemove')
.trigger('mouseover')

@ -6,19 +6,11 @@
/// <reference types="cypress" />
import { taskName } from '../../support/const'
context('Cancel "multiple paste". UI is not locked.', () => {
const issueId = '1438'
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 width = 800
const height = 800
const posX = 10
const posY = 10
const color = 'gray'
const createRectangleShape2Points = {
points: 'By 2 Points',
type: 'Shape',
@ -30,16 +22,12 @@ context('Cancel "multiple paste". UI is not locked.', () => {
}
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.createRectangle(createRectangleShape2Points)
})
describe(`Testing issue "${issueId}"`, () => {
it('Copy, paste opject. Cancel pasting.', () => {
cy.createRectangle(createRectangleShape2Points)
cy.get('#cvat_canvas_shape_1')
.trigger('mousemove')
.trigger('mouseover')

@ -6,19 +6,11 @@
/// <reference types="cypress" />
import { taskName, labelName } from '../../support/const'
context('Information about a blocked object disappears if hover the cursor over another object', () => {
const issueId = '1439'
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 width = 800
const height = 800
const posX = 10
const posY = 10
const color = 'gray'
const createRectangleShape2Points = {
points: 'By 2 Points',
type: 'Shape',
@ -39,10 +31,6 @@ context('Information about a blocked object disappears if hover the cursor over
}
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)
})

@ -6,19 +6,11 @@
/// <reference types="cypress" />
import { taskName } from '../../support/const'
context('Filter property "shape" work correctly', () => {
const issueId = '1444'
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 width = 800
const height = 800
const posX = 10
const posY = 10
const color = 'white'
const createRectangleShape2Points = {
points: 'By 2 Points',
type: 'Shape',
@ -42,10 +34,6 @@ context('Filter property "shape" work correctly', () => {
}
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)
})

@ -6,12 +6,11 @@
/// <reference types="cypress" />
import { taskName, labelName, attrName, textDefaultValue } from '../../support/const'
context('Message in UI when raw labels are wrong.', () => {
const issueId = '1498'
const labelName = `Issue ${issueId}`
const attrName = `Attr for ${labelName}`
const textDefaultValue = 'Some default value for type Text'
let taskRaw = [
{
name: labelName,
@ -32,10 +31,7 @@ context('Message in UI when raw labels are wrong.', () => {
]
before(() => {
cy.visit('auth/login')
cy.login()
cy.get('#cvat-create-task-button').click()
cy.url().should('include', '/tasks/create')
cy.openTask(taskName)
cy.get('[role="tab"]').contains('Raw').click()
})

@ -6,25 +6,13 @@
/// <reference types="cypress" />
import { taskName } from '../../support/const'
context('Check if the UI not to crash after remove a tag', () => {
const issueId = '1540'
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 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)
})

@ -6,19 +6,11 @@
/// <reference types="cypress" />
import { taskName } from '../../support/const'
context('Dump annotation if cuboid created', () => {
const issueId = '1568'
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 width = 800
const height = 800
const posX = 10
const posY = 10
const color = 'gray'
const createCuboidShape2Points = {
points: 'From rectangle',
type: 'Shape',
@ -29,14 +21,20 @@ context('Dump annotation if cuboid created', () => {
secondY: 450
}
function save() {
cy.get('button').contains('Save')
.click({force: true})
}
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)
})
after('Go to task list', () => {
cy.removeAnnotations()
save()
})
describe(`Testing issue "${issueId}"`, () => {
it('Create a cuboid', () => {
cy.createCuboid(createCuboidShape2Points)
@ -45,9 +43,7 @@ context('Dump annotation if cuboid created', () => {
})
it('Dump an annotation', () => {
cy.get('.cvat-annotation-header-left-group').within(() => {
cy.get('[title="Save current changes [Ctrl+S]"]')
cy.get('button').contains('Save')
.click({force: true})
save()
cy.get('button').contains('Menu')
.trigger('mouseover',{force: true})
})

@ -6,25 +6,11 @@
/// <reference types="cypress" />
import { taskName, labelName } from '../../support/const'
context('An error occurs in AAM when switching to 2 frames, if the frames have objects created in shape mode', () => {
const issueId = '1750'
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 images = [`image_${issueId}_1.png`,
`image_${issueId}_2.png`,
`image_${issueId}_3.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 createRectangleShape2Points = {
points: 'By 2 Points',
type: 'Shape',
@ -45,13 +31,6 @@ context('An error occurs in AAM when switching to 2 frames, if the frames have o
}
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)
cy.createAnnotationTask(taskName, labelName, attrName, textDefaultValue, archiveName)
cy.openTaskJob(taskName)
})

@ -6,25 +6,11 @@
/// <reference types="cypress" />
import { taskName, advancedConfigurationParams } from '../../support/const'
context('Check propagation work from the latest frame', () => {
const issueId = '1785'
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 images = [`image_${issueId}_1.png`,
`image_${issueId}_2.png`,
`image_${issueId}_3.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 createRectangleShape2Points = {
points: 'By 2 Points',
type: 'Shape',
@ -36,13 +22,6 @@ context('Check propagation work from the latest frame', () => {
}
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)
cy.createAnnotationTask(taskName, labelName, attrName, textDefaultValue, archiveName)
cy.openTaskJob(taskName)
})
@ -52,7 +31,7 @@ context('Check propagation work from the latest frame', () => {
.click()
cy.get('.cvat-player-frame-selector').within(() => {
cy.get('input[role="spinbutton"]')
.should('have.value', '2')
.should('have.value', advancedConfigurationParams.segmentSize - 1)
})
})
it('Create a rectangle shape', () => {

@ -6,25 +6,11 @@
/// <reference types="cypress" />
import { taskName, advancedConfigurationParams } from '../../support/const'
context('First part of a splitted track is visible', () => {
const issueId = '1819'
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 images = [`image_${issueId}_1.png`,
`image_${issueId}_2.png`,
`image_${issueId}_3.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 createRectangleTrack2Points = {
points: 'By 2 Points',
type: 'Track',
@ -36,13 +22,6 @@ context('First part of a splitted track is visible', () => {
}
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)
cy.createAnnotationTask(taskName, labelName, attrName, textDefaultValue, archiveName)
cy.openTaskJob(taskName)
})
@ -55,7 +34,7 @@ context('First part of a splitted track is visible', () => {
.click()
cy.get('.cvat-player-frame-selector').within(() => {
cy.get('input[role="spinbutton"]')
.should('have.value', '2')
.should('have.value', advancedConfigurationParams.segmentSize - 1)
})
})
it('Split track', () => {
@ -70,7 +49,7 @@ context('First part of a splitted track is visible', () => {
.click()
cy.get('.cvat-player-frame-selector').within(() => {
cy.get('input[role="spinbutton"]')
.should('have.value', '1')
.should('have.value', advancedConfigurationParams.segmentSize - 2)
})
})
it('First part of a splitted track is visible', () => {

@ -6,25 +6,13 @@
/// <reference types="cypress" />
import { taskName } from '../../support/const'
context('Tooltip does not interfere with interaction with elements.', () => {
const issueId = '1825'
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 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)
})

@ -6,19 +6,11 @@
/// <reference types="cypress" />
import { taskName } from '../../support/const'
context('Hidden objects mustn\'t consider when we want to group visible objects only and use an grouping area for it.', () => {
const issueId = '1841'
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 width = 800
const height = 800
const posX = 10
const posY = 10
const color = 'white'
let bgcolor = ''
const createFirstPointsShape = {
type: 'Shape',
@ -49,10 +41,6 @@ context('Hidden objects mustn\'t consider when we want to group visible objects
}
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)
})

@ -6,20 +6,11 @@
/// <reference types="cypress" />
import { taskName, textDefaultValue, attrName } from '../../support/const'
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'
const createRectangleShape2Points = {
points: 'By 2 Points',
type: 'Shape',
@ -31,22 +22,21 @@ context('Checks that the cursor doesn\'t automatically jump to the end of a word
}
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.createRectangle(createRectangleShape2Points)
})
describe(`Testing issue "${issueId}"`, () => {
it('Enter 2 characters in the middle of the word attribute value and check the result', () => {
cy.createRectangle(createRectangleShape2Points)
cy.get('#cvat-objects-sidebar-state-item-1')
.find('.ant-collapse-item')
.click()
.find('.cvat-object-item-text-attribute')
.type('{leftarrow}{leftarrow}ee')
.should('have.value', newLabelAttrValue)
cy.get('.cvat-object-item-attribute-wrapper')
.contains(attrName).parents('.cvat-object-item-attribute-wrapper').within(() => {
cy.get('.cvat-object-item-text-attribute')
.type('{leftarrow}{leftarrow}ee')
.should('have.value', textDefaultValue.replace('Text', 'Teeext'))
})
})
})
})

@ -6,19 +6,11 @@
/// <reference types="cypress" />
import { taskName } from '../../support/const'
context('The points of the previous polygon mustn\'t appear while polygon\'s interpolation.', () => {
const issueId = '1882'
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 width = 800
const height = 800
const posX = 10
const posY = 10
const color = 'white'
const createPolygonTrack = {
reDraw: false,
type: 'Track',
@ -45,10 +37,6 @@ context('The points of the previous polygon mustn\'t appear while polygon\'s int
}
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)
})

@ -6,27 +6,11 @@
/// <reference types="cypress" />
import { taskName, advancedConfigurationParams } from '../../support/const'
context('Point coordinates are not duplicated while polygon\'s interpolation.', () => {
const issueId = '1886'
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 = 'white'
const archiveName = `images_issue_${issueId}.zip`
const archivePath = `cypress/fixtures/${archiveName}`
const imagesFolder = `cypress/fixtures/image_issue_${issueId}`
const directoryToArchive = imagesFolder
let pointsСoordinates = []
const createPolygonTrack = {
reDraw: false,
@ -42,13 +26,6 @@ context('Point coordinates are not duplicated while polygon\'s interpolation.',
}
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)
cy.createAnnotationTask(taskName, labelName, attrName, textDefaultValue, archiveName)
cy.openTaskJob(taskName)
})
@ -62,7 +39,7 @@ context('Point coordinates are not duplicated while polygon\'s interpolation.',
cy.get('.cvat-player-forward-button').click()
cy.get('.cvat-player-frame-selector').within(() => {
cy.get('input[role="spinbutton"]')
.should('have.value', '3')
.should('have.value', advancedConfigurationParams.segmentSize - 1)
})
})
it('Set a keyframe for the polygon', () => {
@ -74,7 +51,7 @@ context('Point coordinates are not duplicated while polygon\'s interpolation.',
cy.get('.cvat-player-previous-button').click()
cy.get('.cvat-player-frame-selector').within(() => {
cy.get('input[role="spinbutton"]')
.should('have.value', '2')
.should('have.value', advancedConfigurationParams.segmentSize - 2)
})
cy.get('#cvat_canvas_shape_1').should('have.prop', 'animatedPoints')
.then(($pointsСoordinates) => {

@ -6,20 +6,12 @@
/// <reference types="cypress" />
import { taskName, textDefaultValue, attrName } from '../../support/const'
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'
const createRectangleShape2Points = {
points: 'By 2 Points',
type: 'Shape',
@ -31,16 +23,12 @@ context('Check label attribute changes', () => {
}
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.createRectangle(createRectangleShape2Points)
})
describe(`Testing issue "${issueId}"`, () => {
it('Open object menu', () => {
cy.createRectangle(createRectangleShape2Points)
cy.get('#cvat_canvas_shape_1').trigger('mousemove').rightclick()
})
it('Open object menu details', () => {
@ -50,15 +38,19 @@ context('Check label attribute changes', () => {
})
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)
.contains(attrName).parents('.cvat-object-item-attribute-wrapper').within(() => {
cy.get('.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)
.contains(attrName).parents('.cvat-object-item-attribute-wrapper').within(() => {
cy.get('.cvat-object-item-text-attribute')
.should('have.value', newLabelAttrValue)
})
})
})
})

@ -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)
})
})
})

@ -6,27 +6,11 @@
/// <reference types="cypress" />
import { taskName } from '../../support/const'
context('Check if the UI fails by moving to the next frame while dragging the object', () => {
const prId = '1370'
const labelName = `PR ${prId}`
const taskName = `New annotation task for ${labelName}`
const attrName = `Attr for ${labelName}`
const textDefaultValue = 'Some default value for type Text'
const imagesCount = 3
let images = []
for ( let i = 1; i <= imagesCount; i++) {
images.push(`image_${prId}_${i}.png`)
}
const width = 800
const height = 800
const posX = 10
const posY = 10
const color = 'gray'
const archiveName = `images_issue_${prId}.zip`
const archivePath = `cypress/fixtures/${archiveName}`
const imagesFolder = `cypress/fixtures/image_issue_${prId}`
const directoryToArchive = imagesFolder
const createRectangleShape2Points = {
points: 'By 2 Points',
type: 'Shape',
@ -38,13 +22,6 @@ context('Check if the UI fails by moving to the next frame while dragging the ob
}
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)
cy.createAnnotationTask(taskName, labelName, attrName, textDefaultValue, archiveName)
cy.openTaskJob(taskName)
})

@ -13,23 +13,29 @@ context('Create and delete a annotation task', () => {
const taskName = `New annotation task for ${labelName}`
const attrName = `Attr for ${labelName}`
const textDefaultValue = 'Some default value for type Text'
const image = `image_${labelName.replace(' ', '_').toLowerCase()}.png`
const imagesCount = 1
const imageFileName = `image_${labelName.replace(' ', '_').toLowerCase()}`
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
let taskID = ''
before(() => {
cy.visit('auth/login')
cy.login()
cy.imageGenerator('cypress/fixtures', image, width, height, color, posX, posY, labelName)
cy.imageGenerator(imagesFolder, imageFileName, width, height, color, posX, posY, labelName, imagesCount)
cy.createZipArchive(directoryToArchive, archivePath)
})
describe(`Testing "${labelName}"`, () => {
it('Create a task', () => {
cy.createAnnotationTask(taskName, labelName, attrName, textDefaultValue, image)
cy.createAnnotationTask(taskName, labelName, attrName, textDefaultValue, archiveName)
})
it('Delete the created task', () => {
cy.getTaskID(taskName).then($taskID => {

@ -12,12 +12,17 @@ context('Multiple users. Assign task, job.', () => {
const taskName = `New annotation task for ${labelName}`
const attrName = `Attr for ${labelName}`
const textDefaultValue = 'Some default value for type Text'
const image = `image_${labelName.replace(' ', '_').toLowerCase()}.png`
const imagesCount = 1
const imageFileName = `image_${labelName.replace(' ', '_').toLowerCase()}`
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 secondUserName = 'Seconduser'
const thirdUserName = 'Thirduser'
@ -34,15 +39,12 @@ context('Multiple users. Assign task, job.', () => {
password: 'Fv5Df3#f55g'
}
function closeModal() {
cy.get('.ant-modal-body').within(() => {
cy.get('.ant-modal-confirm-title')
.should('contain', 'Unsupported platform detected')
cy.get('.ant-modal-confirm-btns')
.contains('OK')
.click()
after(() => {
cy.login()
cy.getTaskID(taskName).then($taskID => {
cy.deleteTask(taskName, $taskID)
})
}
})
describe(`Testing case "${caseId}"`, () => {
// First user is "admin".
@ -55,11 +57,8 @@ context('Multiple users. Assign task, job.', () => {
cy.url().should('include', '/auth/login')
})
it('Register third user and logout.', () => {
cy.visit('auth/register')
cy.get('a[href="/auth/register"]').click()
cy.url().should('include', '/auth/register')
if (Cypress.browser.name === 'firefox') {
closeModal()
}
cy.userRegistration(thirdUser.firstName, thirdUser.lastName, thirdUserName, thirdUser.emailAddr, thirdUser.password)
cy.url().should('include', '/tasks')
cy.logout(thirdUserName)
@ -68,14 +67,15 @@ context('Multiple users. Assign task, job.', () => {
it('First user login and create a task', () => {
cy.login()
cy.url().should('include', '/tasks')
cy.imageGenerator('cypress/fixtures', image, width, height, color, posX, posY, labelName)
cy.createAnnotationTask(taskName, labelName, attrName, textDefaultValue, image)
cy.imageGenerator(imagesFolder, imageFileName, width, height, color, posX, posY, labelName, imagesCount)
cy.createZipArchive(directoryToArchive, archivePath)
cy.createAnnotationTask(taskName, labelName, attrName, textDefaultValue, archiveName)
})
it('Assign the task to the second user and logout', () => {
cy.openTask(taskName)
cy.get('.cvat-task-details').within(() => {
cy.get('.cvat-user-selector')
.click()
.click({force: true})
})
cy.contains(secondUserName)
.click()
@ -84,6 +84,7 @@ context('Multiple users. Assign task, job.', () => {
it('Second user login. The task can be opened. Logout', () => {
cy.login(secondUserName, secondUser.password)
cy.url().should('include', '/tasks')
cy.get('[value="tasks"]').click()
cy.contains('strong', taskName)
.should('exist')
cy.openTask(taskName)
@ -92,6 +93,7 @@ context('Multiple users. Assign task, job.', () => {
it('Third user login. The task not exist. Logout', () => {
cy.login(thirdUserName, thirdUser.password)
cy.url().should('include', '/tasks')
cy.get('[value="tasks"]').click()
cy.contains('strong', taskName)
.should('not.exist')
cy.logout(thirdUserName)
@ -99,10 +101,11 @@ context('Multiple users. Assign task, job.', () => {
it('First user login and assign the job to the third user. Logout', () => {
cy.login()
cy.url().should('include', '/tasks')
cy.get('[value="tasks"]').click()
cy.openTask(taskName)
cy.get('.cvat-task-job-list').within(() => {
cy.get('.cvat-user-selector')
.click()
.click({force: true})
})
cy.contains(thirdUserName)
.click()
@ -111,9 +114,11 @@ context('Multiple users. Assign task, job.', () => {
it('Third user login. The task can be opened.', () => {
cy.login(thirdUserName, thirdUser.password)
cy.url().should('include', '/tasks')
cy.get('[value="tasks"]').click()
cy.contains('strong', taskName)
.should('exist')
cy.openTask(taskName)
cy.logout(thirdUserName)
})
})
})

@ -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')
})
})
})

@ -19,15 +19,18 @@ function imageGenerator(args) {
const posY = args.posY
const message = args.message
const file = path.join(directory, fileName)
const count = args.count
return new Promise((resolve, reject) => {
const image = new jimp(width, height, color, function (err, image) {
if (err) reject(err)
jimp.loadFont(jimp.FONT_SANS_64_BLACK, function (err, font) {
for (let i=1; i<=count; i++) {
const image = new jimp(width, height, color, function (err, image) {
if (err) reject(err)
image.print(font, Number(posX), Number(posY), message)
.write(file)
jimp.loadFont(jimp.FONT_SANS_64_BLACK, function (err, font) {
if (err) reject(err)
image.print(font, Number(posX), Number(posY), `${message}. Num ${i}`)
.write(`${file}_${i}.png`)
})
})
})
}
setTimeout(() => resolve(null), '1000')
})
}

@ -11,7 +11,8 @@ Cypress.Commands.add('imageGenerator', (directory,
color,
posX,
posY,
message) => {
message,
count) => {
return cy.task('imageGenerator', {
directory: directory,
fileName: fileName,
@ -20,6 +21,7 @@ Cypress.Commands.add('imageGenerator', (directory,
color: color,
posX: posX,
posY: posY,
message: message
message: message,
count: count
})
})

@ -43,7 +43,7 @@ Cypress.Commands.add('createAnnotationTask', (taksName='New annotation task',
multiAttrParams,
advancedConfigurationParams
) => {
cy.get('#cvat-create-task-button').click()
cy.get('#cvat-create-task-button').click({force: true})
cy.url().should('include', '/tasks/create')
cy.get('[id="name"]').type(taksName)
cy.get('.cvat-constructor-viewer-new-item').click()
@ -71,15 +71,19 @@ Cypress.Commands.add('openTask', (taskName) => {
cy.contains('strong', taskName)
.parents('.cvat-tasks-list-item')
.contains('a', 'Open')
.click()
.click({force: true})
})
Cypress.Commands.add('openJob', (jobNumber=0) => {
let tdText = ''
cy.get('.ant-table-tbody')
.find('tr')
.eq(jobNumber)
.contains('a', 'Job #')
.click()
.contains(/^0-/).parent().find('td').eq(0).invoke('text')
.then(($tdText) => {
tdText = Number($tdText.match(/\d+/g)) + jobNumber
cy.get('.ant-table-tbody')
.contains('a', `Job #${tdText}`)
.click()
})
cy.url().should('include', '/jobs')
})
@ -326,3 +330,21 @@ Cypress.Commands.add('advancedConfiguration', (advancedConfigurationParams) => {
cy.get('#frameStep').type(advancedConfigurationParams.frameStep)
}
})
Cypress.Commands.add('removeAnnotations', () => {
cy.get('.cvat-annotation-header-button').eq(0)
.click()
cy.get('.cvat-annotation-menu').within(() => {
cy.contains('Remove annotations')
.click()
})
cy.get('.ant-modal-content').within(() => {
cy.get('.ant-btn-danger')
.click()
})
})
Cypress.Commands.add('goToTaskList', () => {
cy.get('a[value="tasks"]')
.click()
})

@ -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…
Cancel
Save