Skip to content

Commit

Permalink
Merge pull request #2518 from dvkruchinin/dkru/cypress-test-issue-2486
Browse files Browse the repository at this point in the history
Cypress test. Check ability to edit positions in AAM.
  • Loading branch information
Boris Sekachev authored Dec 6, 2020
2 parents 434eb0e + d9221f4 commit c1d3a78
Showing 1 changed file with 63 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
// Copyright (C) 2020 Intel Corporation
//
// SPDX-License-Identifier: MIT

/// <reference types="cypress" />

import { taskName, labelName } from '../../support/const';

context("Object can't be draggable/resizable in AAM", () => {
const issueId = '2486';
const createRectangleShape2Points = {
points: 'By 2 Points',
type: 'Shape',
labelName: labelName,
firstX: 250,
firstY: 350,
secondX: 350,
secondY: 450,
};

let shapeXPos = 0;

before(() => {
cy.openTaskJob(taskName);
});

describe(`Testing issue "${issueId}"`, () => {
it('Create, acttivate a object', () => {
cy.createRectangle(createRectangleShape2Points);
cy.get('#cvat_canvas_shape_1')
.should('not.have.class', 'cvat_canvas_shape_activated')
.trigger('mousemove')
.should('have.class', 'cvat_canvas_shape_activated');
});

it('Go to AAM', () => {
cy.changeWorkspace('Attribute annotation', labelName);
cy.get('#cvat_canvas_shape_1')
.then((shape) => {
shapeXPos = Math.floor(shape.attr('x'));
})
.trigger('mousemove')
.should('not.have.class', 'cvat_canvas_shape_activated');
cy.get('circle').then((circle) => {
for (let i = 0; i < circle.length; i++) {
if (circle[i].id.match(/^SvgjsCircle\d+$/)) {
cy.get(circle[i]).should('not.exist'); // id='SvgjsCircleNNNN' should not exist. Because of this can't change the object size.
}
}
});
});

it('Try to move/resize the object', () => {
cy.get('.cvat-canvas-container')
.trigger('mousedown', { button: 0 })
.trigger('mousemove', 550, 251)
.trigger('mouseup');
cy.get('#cvat_canvas_shape_1').then((shapeAam) => {
expect(shapeXPos).to.be.equal(Math.floor(shapeAam.attr('x'))); // The object didn't move.
});
});
});
});

0 comments on commit c1d3a78

Please sign in to comment.