-
Notifications
You must be signed in to change notification settings - Fork 3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Cypress tests for issues 1882, 1886.
- Loading branch information
Dmitry Kruchinin
committed
Aug 24, 2020
1 parent
9e05ffc
commit 9580b94
Showing
3 changed files
with
178 additions
and
0 deletions.
There are no files selected for viewing
72 changes: 72 additions & 0 deletions
72
tests/cypress/integration/issue_1882_polygon_interpolation.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,72 @@ | ||
/* | ||
* Copyright (C) 2020 Intel Corporation | ||
* | ||
* SPDX-License-Identifier: MIT | ||
*/ | ||
|
||
/// <reference types="cypress" /> | ||
|
||
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' | ||
|
||
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('Create a poligon', () => { | ||
cy.createPolygon('Track', [ | ||
{x: 309, y: 431}, | ||
{x: 360, y: 500}, | ||
{x: 320, y: 300}, | ||
]) | ||
cy.get('#cvat-objects-sidebar-state-item-1') | ||
.should('contain', '1').and('contain', 'POLYGON TRACK') | ||
}) | ||
it('Redraw the polygon', () => { | ||
cy.get('#cvat_canvas_shape_1') | ||
.trigger('mousemove', {force: true}) | ||
.trigger('keydown', {key: 'n', shiftKey: true}) | ||
.trigger('keyup', {force: true}, {key: 'n', shiftKey: true}) | ||
cy.createPolygon('Track', [ | ||
{x: 359, y: 431}, | ||
{x: 410, y: 500}, | ||
{x: 370, y: 300}, | ||
], | ||
false, true) | ||
}) | ||
it('Activate auto bordering mode', () => { | ||
cy.get('.cvat-right-header') | ||
.find('.cvat-header-menu-dropdown') | ||
.trigger('mouseover', {which: 1}) | ||
cy.get('.anticon-setting') | ||
.click() | ||
cy.get('.ant-modal-content').within(() => { | ||
cy.contains('Workspace').click() | ||
cy.get('.cvat-workspace-settings-autoborders').within(() => { | ||
cy.get('[type="checkbox"]').check() | ||
}) | ||
cy.contains('button', 'Close').click() | ||
}) | ||
}) | ||
it('Old points invisible', () => { | ||
cy.get('.cvat_canvas_autoborder_point') | ||
.should('not.exist') | ||
}) | ||
}) | ||
}) |
84 changes: 84 additions & 0 deletions
84
tests/cypress/integration/issue_1886_point_coordinates_not_duplicated.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,84 @@ | ||
/* | ||
* Copyright (C) 2020 Intel Corporation | ||
* | ||
* SPDX-License-Identifier: MIT | ||
*/ | ||
|
||
/// <reference types="cypress" /> | ||
|
||
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 = [] | ||
|
||
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) | ||
}) | ||
|
||
describe(`Testing issue "${issueId}"`, () => { | ||
it('Create a poligon', () => { | ||
cy.createPolygon('Track', [ | ||
{x: 300, y: 450}, | ||
{x: 400, y: 450}, | ||
{x: 400, y: 550}, | ||
]) | ||
cy.get('#cvat-objects-sidebar-state-item-1') | ||
.should('contain', '1').and('contain', 'POLYGON TRACK') | ||
}) | ||
it('Go next with a step', () => { | ||
cy.get('.cvat-player-forward-button').click() | ||
cy.get('.cvat-player-frame-selector').within(() => { | ||
cy.get('input[role="spinbutton"]') | ||
.should('have.value', '3') | ||
}) | ||
}) | ||
it('Set a keyframe for the polygon', () => { | ||
cy.get('#cvat-objects-sidebar-state-item-1').within(() => { | ||
cy.get('[data-icon="star"]').click() | ||
}) | ||
}) | ||
it('Go to previous frame and getting point`s coordinates', () => { | ||
cy.get('.cvat-player-buttons > :nth-child(3) > svg').click() | ||
cy.get('.cvat-player-frame-selector').within(() => { | ||
cy.get('input[role="spinbutton"]') | ||
.should('have.value', '2') | ||
}) | ||
cy.get('#cvat_canvas_shape_1').should('have.prop', 'animatedPoints') | ||
.then(($pointsСoordinates) => { | ||
for (let i of $pointsСoordinates) { | ||
pointsСoordinates.push(`${i.x}, ${i.y}`) | ||
} | ||
}) | ||
}) | ||
it('The coordinates of the points are not duplicated', () => { | ||
for(let i = 0; i < pointsСoordinates.length - 1; i++) { | ||
cy.expect(pointsСoordinates[i]).not.equal(pointsСoordinates[i+1]) | ||
} | ||
}) | ||
}) | ||
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters