-
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.
- Loading branch information
1 parent
fb17dca
commit 105999b
Showing
1 changed file
with
63 additions
and
0 deletions.
There are no files selected for viewing
63 changes: 63 additions & 0 deletions
63
tests/cypress/integration/actions_tasks_objects/issue_2807_polyline_editing.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,63 @@ | ||
// Copyright (C) 2021 Intel Corporation | ||
// | ||
// SPDX-License-Identifier: MIT | ||
|
||
/// <reference types="cypress" /> | ||
|
||
import { taskName, labelName } from '../../support/const'; | ||
|
||
context('After draw correcting line and press the latest drawn point then it closes editing mode.', () => { | ||
const issueId = '2807'; | ||
const createPolylinesShapePoints = { | ||
type: 'Shape', | ||
labelName: labelName, | ||
pointsMap: [ | ||
{ x: 400, y: 400 }, | ||
{ x: 600, y: 250 }, | ||
{ x: 800, y: 300 }, | ||
], | ||
numberOfPoints: 3, | ||
}; | ||
let svgJsCircle = []; | ||
let svgJsCircleAfterCorrection = []; | ||
|
||
function getCircleAndWriteToArr(array) { | ||
cy.get('circle').then((circle) => { | ||
for (let i = 0; i < circle.length; i++) { | ||
if (circle[i].id.match(/^SvgjsCircle\d+$/)) { | ||
array.push(circle[i]); | ||
} | ||
} | ||
}); | ||
} | ||
|
||
before(() => { | ||
cy.openTaskJob(taskName); | ||
cy.createPolyline(createPolylinesShapePoints); | ||
}); | ||
|
||
describe(`Testing issue "${issueId}"`, () => { | ||
it('Draw correcting line', () => { | ||
cy.get('.cvat-canvas-container').trigger('mousemove', 600, 250).trigger('mouseover', 600, 250); | ||
cy.get('#cvat_canvas_shape_1').should('have.class', 'cvat_canvas_shape_activated'); | ||
getCircleAndWriteToArr(svgJsCircle); // Getting a list of "SvgjsCircleNNNN" objects | ||
cy.get('.cvat-canvas-container').click(600, 250, { shiftKey: true }); // Activate editing move | ||
// There is no "cvat_canvas_shape_activated" class during the activated change mode | ||
cy.get('#cvat_canvas_shape_1').should('not.have.class', 'cvat_canvas_shape_activated'); | ||
cy.get('.cvat-canvas-container') | ||
.trigger('mousemove', 500, 250) | ||
.click(500, 250) | ||
.trigger('mousemove', 500, 240) | ||
.trigger('mousemove', 500, 250) | ||
.click(500, 250); | ||
getCircleAndWriteToArr(svgJsCircleAfterCorrection); | ||
}); | ||
|
||
it('The count of the "circle" objects after the correction is the same.', () => { | ||
// There is "cvat_canvas_shape_activated" class during the disabled change mode. | ||
cy.get('#cvat_canvas_shape_1').should('have.class', 'cvat_canvas_shape_activated'); | ||
// The number of "SvgjsCircleNNNN" objects remained the same | ||
expect(svgJsCircle.length).to.be.equal(svgJsCircleAfterCorrection.length); // expected 3 to equal 3 | ||
}); | ||
}); | ||
}); |