Skip to content

Commit

Permalink
Cypress test. Cropping polygon in some corner cases. (cvat-ai#3196)
Browse files Browse the repository at this point in the history
  • Loading branch information
dvkruchinin committed May 17, 2021
1 parent 2dfb3d0 commit 9a018cc
Showing 1 changed file with 59 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
// Copyright (C) 2021 Intel Corporation
//
// SPDX-License-Identifier: MIT

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

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

context('Cropping polygon in some corner cases.', () => {
const caseId = '77';
const createPolygonShapeRightSide = {
reDraw: false,
type: 'Shape',
labelName: labelName,
pointsMap: [
{ x: 500, y: 120 },
{ x: 900, y: 10 },
{ x: 850, y: 800 },
{ x: 500, y: 750 },
],
complete: true,
numberOfPoints: null,
};

const createPolygonShapeLeftSide = {
reDraw: false,
type: 'Shape',
labelName: labelName,
pointsMap: [
{ x: 500, y: 120 },
{ x: 30, y: 10 },
{ x: 50, y: 800 },
{ x: 500, y: 750 },
],
complete: true,
numberOfPoints: null,
};

before(() => {
cy.openTask(taskName);
cy.openJob();
});

describe(`Testing case "${caseId}"`, () => {
it('Checking the right side of the canvas.', () => {
cy.get('.cvat-canvas-container').trigger('wheel', { deltaY: 5 }).trigger('wheel', { deltaY: 5 });
cy.createPolygon(createPolygonShapeRightSide);
cy.get('.cvat-canvas-container').trigger('mousemove', 650, 250); // Hover over a point that was free of the shape before the fix
cy.get('#cvat_canvas_shape_1').should('have.class', 'cvat_canvas_shape_activated');
});

it('Checking the lift side of the canvas.', () => {
cy.removeAnnotations();
cy.createPolygon(createPolygonShapeLeftSide);
cy.get('.cvat-canvas-container').trigger('mousemove', 300, 250); // Hover over a point that was free of the shape before the fix
cy.get('#cvat_canvas_shape_1').should('have.class', 'cvat_canvas_shape_activated');
});
});
});

0 comments on commit 9a018cc

Please sign in to comment.