Fix most ESLint errors/warnings in tests (#5647)

After this, there's only 12 files with ESLint errors left. I didn't fix
those because they all have at least one
`cypress/no-unnecessary-waiting` error, and I don't have enough Cypress
expertise to fix those.
main
Roman Donchenko 3 years ago committed by GitHub
parent 3775bc2557
commit f82d7f520e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -11,7 +11,7 @@ context('Edit handler.', () => {
const createPolygonShape = { const createPolygonShape = {
redraw: false, redraw: false,
type: 'Shape', type: 'Shape',
labelName: labelName, labelName,
pointsMap: [ pointsMap: [
{ x: 450, y: 350 }, { x: 450, y: 350 },
{ x: 550, y: 350 }, { x: 550, y: 350 },
@ -22,7 +22,7 @@ context('Edit handler.', () => {
}; };
const createPolylinesShape = { const createPolylinesShape = {
type: 'Shape', type: 'Shape',
labelName: labelName, labelName,
pointsMap: [ pointsMap: [
{ x: 700, y: 350 }, { x: 700, y: 350 },
{ x: 800, y: 350 }, { x: 800, y: 350 },
@ -33,7 +33,7 @@ context('Edit handler.', () => {
}; };
const createPointsShape = { const createPointsShape = {
type: 'Shape', type: 'Shape',
labelName: labelName, labelName,
pointsMap: [{ x: 200, y: 400 }], pointsMap: [{ x: 200, y: 400 }],
complete: true, complete: true,
numberOfPoints: null, numberOfPoints: null,
@ -64,10 +64,8 @@ context('Edit handler.', () => {
cy.get('#cvat_canvas_shape_1') cy.get('#cvat_canvas_shape_1')
.should('have.class', 'cvat_canvas_shape_activated') .should('have.class', 'cvat_canvas_shape_activated')
.invoke('attr', 'points') .invoke('attr', 'points')
.then(($points) => { .then(($pointsBefore) => {
const pointsCountBefore = $points.split(' ').filter(function (el) { const pointsCountBefore = $pointsBefore.split(' ').filter((el) => el.length !== 0).length;
return el.length != 0;
}).length;
cy.get('.cvat-canvas-container') cy.get('.cvat-canvas-container')
.click(550, 350, { shiftKey: true }) .click(550, 350, { shiftKey: true })
.then(() => { .then(() => {
@ -80,10 +78,8 @@ context('Edit handler.', () => {
cy.get('.cvat_canvas_shape_drawing').should('not.exist'); cy.get('.cvat_canvas_shape_drawing').should('not.exist');
cy.get('#cvat_canvas_shape_1') cy.get('#cvat_canvas_shape_1')
.invoke('attr', 'points') .invoke('attr', 'points')
.then(($points) => { .then(($pointsAfter) => {
const pointsCountAfter = $points.split(' ').filter(function (el) { const pointsCountAfter = $pointsAfter.split(' ').filter((el) => el.length !== 0).length;
return el.length != 0;
}).length;
expect(pointsCountBefore).not.equal(pointsCountAfter); // expected 3 to not equal 4 expect(pointsCountBefore).not.equal(pointsCountAfter); // expected 3 to not equal 4
}); });
// Splitting polygon // Splitting polygon
@ -116,10 +112,8 @@ context('Edit handler.', () => {
.dblclick(530, 400); .dblclick(530, 400);
cy.get('#cvat_canvas_shape_1') cy.get('#cvat_canvas_shape_1')
.invoke('attr', 'points') .invoke('attr', 'points')
.then(($points) => { .then(($pointsAfterSplitting) => {
const pointsCountAfterSplitting = $points.split(' ').filter(function (el) { const pointsCountAfterSplitting = $pointsAfterSplitting.split(' ').filter((el) => el.length !== 0).length;
return el.length != 0;
}).length;
expect(pointsCountAfterSplitting).to.be.equal(5); // expected 3 to equal 3 expect(pointsCountAfterSplitting).to.be.equal(5); // expected 3 to equal 3
}); });
}); });
@ -152,7 +146,8 @@ context('Edit handler.', () => {
cy.get('#cvat_canvas_shape_2') cy.get('#cvat_canvas_shape_2')
.invoke('attr', 'points') .invoke('attr', 'points')
.then(($pointsCordsAfter) => { .then(($pointsCordsAfter) => {
// expected '10071.4287109375,9788.5712890625 ...' to not equal '10166.6669921875,9883.8095703125 ...' // expected '10071.4287109375,9788.5712890625 ...'
// to not equal '10166.6669921875,9883.8095703125 ...'
expect($pointsCordsBefore).to.not.equal($pointsCordsAfter); expect($pointsCordsBefore).to.not.equal($pointsCordsAfter);
}); });
}); });
@ -207,9 +202,7 @@ context('Edit handler.', () => {
.invoke('attr', 'points') .invoke('attr', 'points')
.then(($points) => { .then(($points) => {
expect( expect(
$points.split(' ').filter(function (el) { $points.split(' ').filter((el) => el.length !== 0).length,
return el.length != 0;
}).length,
).to.be.equal(11); ).to.be.equal(11);
}); });
testActivatingShape(750, 500, '#cvat_canvas_shape_2'); testActivatingShape(750, 500, '#cvat_canvas_shape_2');

@ -13,7 +13,7 @@ context('Save filtered object in AAM.', () => {
const createCuboidShape2Points = { const createCuboidShape2Points = {
points: 'From rectangle', points: 'From rectangle',
type: 'Shape', type: 'Shape',
labelName: labelName, labelName,
firstX: 250, firstX: 250,
firstY: 350, firstY: 350,
secondX: 350, secondX: 350,
@ -51,7 +51,7 @@ context('Save filtered object in AAM.', () => {
}); });
}); });
it(`Go to AAM and change a label for the shape. Save the changes. UI is not failed.`, () => { it('Go to AAM and change a label for the shape. Save the changes. UI is not failed.', () => {
cy.changeWorkspace('Attribute annotation'); cy.changeWorkspace('Attribute annotation');
cy.changeLabelAAM(secondLabel); cy.changeLabelAAM(secondLabel);
cy.saveJob(); cy.saveJob();

@ -12,7 +12,7 @@ context('Actions on polygon.', () => {
const createPolygonShape = { const createPolygonShape = {
reDraw: false, reDraw: false,
type: 'Shape', type: 'Shape',
labelName: labelName, labelName,
pointsMap: [ pointsMap: [
{ x: 200, y: 200 }, { x: 200, y: 200 },
{ x: 250, y: 200 }, { x: 250, y: 200 },
@ -22,7 +22,7 @@ context('Actions on polygon.', () => {
const createPolygonTrack = { const createPolygonTrack = {
reDraw: false, reDraw: false,
type: 'Track', type: 'Track',
labelName: labelName, labelName,
pointsMap: [ pointsMap: [
{ x: 300, y: 200 }, { x: 300, y: 200 },
{ x: 350, y: 200 }, { x: 350, y: 200 },
@ -32,7 +32,7 @@ context('Actions on polygon.', () => {
const createPolygonShapePoints = { const createPolygonShapePoints = {
reDraw: false, reDraw: false,
type: 'Shape', type: 'Shape',
labelName: labelName, labelName,
pointsMap: [ pointsMap: [
{ x: 400, y: 200 }, { x: 400, y: 200 },
{ x: 450, y: 200 }, { x: 450, y: 200 },
@ -45,7 +45,7 @@ context('Actions on polygon.', () => {
const createPolygonTrackPoints = { const createPolygonTrackPoints = {
reDraw: false, reDraw: false,
type: 'Track', type: 'Track',
labelName: labelName, labelName,
pointsMap: [ pointsMap: [
{ x: 500, y: 200 }, { x: 500, y: 200 },
{ x: 550, y: 200 }, { x: 550, y: 200 },
@ -101,11 +101,11 @@ context('Actions on polygon.', () => {
}); });
it('Set start point.', () => { it('Set start point.', () => {
let notFirtsPointCoords = { const notFirtsPointCoords = {
x: 0, x: 0,
y: 0, y: 0,
}; };
let firtsPointCoords = { const firtsPointCoords = {
x: 0, x: 0,
y: 0, y: 0,
}; };
@ -133,7 +133,7 @@ context('Actions on polygon.', () => {
.should('have.class', 'cvat_canvas_shape_activated'); .should('have.class', 'cvat_canvas_shape_activated');
cy.get('.cvat_canvas_poly_direction').then((polyDirection) => { cy.get('.cvat_canvas_poly_direction').then((polyDirection) => {
polyDirectionAttrDataAngle = polyDirection.attr('data-angle'); polyDirectionAttrDataAngle = polyDirection.attr('data-angle');
}).click({scrollBehavior: false}) }).click({ scrollBehavior: false });
cy.get('.cvat_canvas_poly_direction').then((afterChangePolyDirection) => { cy.get('.cvat_canvas_poly_direction').then((afterChangePolyDirection) => {
expect(polyDirectionAttrDataAngle).not.equal(afterChangePolyDirection.attr('data-angle')); expect(polyDirectionAttrDataAngle).not.equal(afterChangePolyDirection.attr('data-angle'));
}); });

@ -11,7 +11,7 @@ context('Actions on polylines.', () => {
const newLabelName = `New label for case ${caseId}`; const newLabelName = `New label for case ${caseId}`;
const createPolylinesShape = { const createPolylinesShape = {
type: 'Shape', type: 'Shape',
labelName: labelName, labelName,
pointsMap: [ pointsMap: [
{ x: 200, y: 200 }, { x: 200, y: 200 },
{ x: 250, y: 200 }, { x: 250, y: 200 },
@ -20,7 +20,7 @@ context('Actions on polylines.', () => {
}; };
const createPolylinesTrack = { const createPolylinesTrack = {
type: 'Track', type: 'Track',
labelName: labelName, labelName,
pointsMap: [ pointsMap: [
{ x: 300, y: 200 }, { x: 300, y: 200 },
{ x: 350, y: 200 }, { x: 350, y: 200 },
@ -29,7 +29,7 @@ context('Actions on polylines.', () => {
}; };
const createPolylinesShapePoints = { const createPolylinesShapePoints = {
type: 'Shape', type: 'Shape',
labelName: labelName, labelName,
pointsMap: [ pointsMap: [
{ x: 400, y: 200 }, { x: 400, y: 200 },
{ x: 450, y: 200 }, { x: 450, y: 200 },
@ -41,7 +41,7 @@ context('Actions on polylines.', () => {
}; };
const createPolylinesTrackPoints = { const createPolylinesTrackPoints = {
type: 'Track', type: 'Track',
labelName: labelName, labelName,
pointsMap: [ pointsMap: [
{ x: 500, y: 200 }, { x: 500, y: 200 },
{ x: 550, y: 200 }, { x: 550, y: 200 },
@ -95,11 +95,11 @@ context('Actions on polylines.', () => {
}); });
it('Change direction.', () => { it('Change direction.', () => {
let firtsPointCoords = { const firtsPointCoords = {
x: 0, x: 0,
y: 0, y: 0,
}; };
let lastPointCoords = { const lastPointCoords = {
x: 0, x: 0,
y: 0, y: 0,
}; };
@ -115,11 +115,11 @@ context('Actions on polylines.', () => {
lastPointCoords.y = lastPoint.attr('cy'); lastPointCoords.y = lastPoint.attr('cy');
cy.get('.cvat_canvas_first_poly_point') cy.get('.cvat_canvas_first_poly_point')
.should('have.attr', 'cx', firtsPointCoords.x) .should('have.attr', 'cx', firtsPointCoords.x)
.and('have.attr', 'cy', firtsPointCoords.y) .and('have.attr', 'cy', firtsPointCoords.y);
cy.get('.cvat_canvas_poly_direction').click({ scrollBehavior: false }); cy.get('.cvat_canvas_poly_direction').click({ scrollBehavior: false });
cy.get('.cvat_canvas_first_poly_point') cy.get('.cvat_canvas_first_poly_point')
.should('have.attr', 'cx', lastPointCoords.x) .should('have.attr', 'cx', lastPointCoords.x)
.and('have.attr', 'cy', lastPointCoords.y) .and('have.attr', 'cy', lastPointCoords.y);
}); });
}); });
}); });

@ -11,7 +11,7 @@ context('Actions on points.', () => {
const newLabelName = `New label for case ${caseId}`; const newLabelName = `New label for case ${caseId}`;
const createPointsShape = { const createPointsShape = {
type: 'Shape', type: 'Shape',
labelName: labelName, labelName,
pointsMap: [ pointsMap: [
{ x: 200, y: 200 }, { x: 200, y: 200 },
{ x: 250, y: 200 }, { x: 250, y: 200 },
@ -20,7 +20,7 @@ context('Actions on points.', () => {
}; };
const createPointsTrack = { const createPointsTrack = {
type: 'Track', type: 'Track',
labelName: labelName, labelName,
pointsMap: [ pointsMap: [
{ x: 300, y: 200 }, { x: 300, y: 200 },
{ x: 350, y: 200 }, { x: 350, y: 200 },
@ -29,7 +29,7 @@ context('Actions on points.', () => {
}; };
const createPointsShapePoints = { const createPointsShapePoints = {
type: 'Shape', type: 'Shape',
labelName: labelName, labelName,
pointsMap: [ pointsMap: [
{ x: 400, y: 200 }, { x: 400, y: 200 },
{ x: 450, y: 200 }, { x: 450, y: 200 },
@ -41,7 +41,7 @@ context('Actions on points.', () => {
}; };
const createPointsTrackPoints = { const createPointsTrackPoints = {
type: 'Track', type: 'Track',
labelName: labelName, labelName,
pointsMap: [ pointsMap: [
{ x: 500, y: 200 }, { x: 500, y: 200 },
{ x: 550, y: 200 }, { x: 550, y: 200 },

@ -15,7 +15,7 @@ context('Appearance features', () => {
const createRectangleShape2Points = { const createRectangleShape2Points = {
points: 'By 2 Points', points: 'By 2 Points',
type: 'Shape', type: 'Shape',
labelName: labelName, labelName,
firstX: 100, firstX: 100,
firstY: 350, firstY: 350,
secondX: 200, secondX: 200,
@ -24,7 +24,7 @@ context('Appearance features', () => {
const createPolygonShape = { const createPolygonShape = {
reDraw: false, reDraw: false,
type: 'Shape', type: 'Shape',
labelName: labelName, labelName,
pointsMap: [ pointsMap: [
{ x: 250, y: 350 }, { x: 250, y: 350 },
{ x: 300, y: 300 }, { x: 300, y: 300 },
@ -35,7 +35,7 @@ context('Appearance features', () => {
}; };
const createPolylinesShape = { const createPolylinesShape = {
type: 'Shape', type: 'Shape',
labelName: labelName, labelName,
pointsMap: [ pointsMap: [
{ x: 350, y: 350 }, { x: 350, y: 350 },
{ x: 400, y: 300 }, { x: 400, y: 300 },
@ -48,7 +48,7 @@ context('Appearance features', () => {
const createCuboidShape2Points = { const createCuboidShape2Points = {
points: 'From rectangle', points: 'From rectangle',
type: 'Shape', type: 'Shape',
labelName: labelName, labelName,
firstX: 450, firstX: 450,
firstY: 350, firstY: 350,
secondX: 550, secondX: 550,
@ -56,7 +56,7 @@ context('Appearance features', () => {
}; };
const createPointsShape = { const createPointsShape = {
type: 'Shape', type: 'Shape',
labelName: labelName, labelName,
pointsMap: [{ x: 650, y: 350 }], pointsMap: [{ x: 650, y: 350 }],
complete: true, complete: true,
numberOfPoints: null, numberOfPoints: null,
@ -100,7 +100,7 @@ context('Appearance features', () => {
} else { } else {
expect(Number(object.attr('fill-opacity'))).to.be.gt(Number(fillOpacity)); // expected 1 to be above 0.03 expect(Number(object.attr('fill-opacity'))).to.be.gt(Number(fillOpacity)); // expected 1 to be above 0.03
} }
}) });
}); });
}); });
}); });
@ -163,7 +163,7 @@ context('Appearance features', () => {
if (!(text.includes('POLYLINE') || text.includes('POINTS'))) { if (!(text.includes('POLYLINE') || text.includes('POINTS'))) {
expect(object.css('fill')).to.be.equal('rgb(224, 224, 224)'); // expected rgb(224, 224, 224) to equal rgb(224, 224, 224) expect(object.css('fill')).to.be.equal('rgb(224, 224, 224)'); // expected rgb(224, 224, 224) to equal rgb(224, 224, 224)
} }
}) });
}); });
}); });

@ -12,7 +12,7 @@ context('Actions on polygon', () => {
const createPolygonShapeFirst = { const createPolygonShapeFirst = {
reDraw: false, reDraw: false,
type: 'Shape', type: 'Shape',
labelName: labelName, labelName,
pointsMap: [ pointsMap: [
{ x: 340, y: 200 }, { x: 340, y: 200 },
{ x: 590, y: 200 }, { x: 590, y: 200 },
@ -24,7 +24,7 @@ context('Actions on polygon', () => {
const createPolygonShapeSecond = { const createPolygonShapeSecond = {
reDraw: false, reDraw: false,
type: 'Shape', type: 'Shape',
labelName: labelName, labelName,
pointsMap: [ pointsMap: [
{ x: 190, y: 210 }, { x: 190, y: 210 },
{ x: 440, y: 210 }, { x: 440, y: 210 },

@ -16,7 +16,7 @@ context('Lock/hide features.', () => {
const createPolygonShape = { const createPolygonShape = {
reDraw: false, reDraw: false,
type: 'Shape', type: 'Shape',
labelName: labelName, labelName,
pointsMap: [ pointsMap: [
{ x: 200, y: 200 }, { x: 200, y: 200 },
{ x: 250, y: 200 }, { x: 250, y: 200 },
@ -28,7 +28,7 @@ context('Lock/hide features.', () => {
const createRectangleTrack2Points = { const createRectangleTrack2Points = {
points: 'By 2 Points', points: 'By 2 Points',
type: 'Track', type: 'Track',
labelName: labelName, labelName,
firstX: 260, firstX: 260,
firstY: 200, firstY: 200,
secondX: 360, secondX: 360,
@ -37,7 +37,7 @@ context('Lock/hide features.', () => {
const createCuboidShape4Points = { const createCuboidShape4Points = {
points: 'By 4 Points', points: 'By 4 Points',
type: 'Shape', type: 'Shape',
labelName: labelName, labelName,
firstX: 400, firstX: 400,
firstY: 350, firstY: 350,
secondX: 500, secondX: 500,
@ -198,7 +198,8 @@ context('Lock/hide features.', () => {
cy.get('#cvat_canvas_shape_6') cy.get('#cvat_canvas_shape_6')
.should('have.attr', 'width') .should('have.attr', 'width')
.then(($shapeWidth) => { .then(($shapeWidth) => {
expect(Math.floor(shapeWidth)).to.be.lessThan(Math.floor($shapeWidth)); // expected 95 to be below 104 // expected 95 to be below 104
expect(Math.floor(shapeWidth)).to.be.lessThan(Math.floor($shapeWidth));
}); });
}); });
it('Go to polygon. Pinned is set to true by default. Set it to false. Polygon can be moved.', () => { it('Go to polygon. Pinned is set to true by default. Set it to false. Polygon can be moved.', () => {
@ -254,7 +255,8 @@ context('Lock/hide features.', () => {
cy.get('.ant-select-selection-item').click({ force: true }); cy.get('.ant-select-selection-item').click({ force: true });
}); });
cy.get('.ant-select-dropdown').last().contains(labelName).click({ force: true }); cy.get('.ant-select-dropdown').last().contains(labelName).click({ force: true });
// Checking that the css parameter "background-color" has become the same as the ".cvat-objects-sidebar-state-item" with "Main task" label. // Checking that the css parameter "background-color" has become the same as
// the ".cvat-objects-sidebar-state-item" with "Main task" label.
cy.get(objectSidebarList[i]).should( cy.get(objectSidebarList[i]).should(
'have.css', 'have.css',
'background-color', 'background-color',

@ -11,7 +11,7 @@ context('Cropping polygon in some corner cases.', () => {
const createPolygonShapeRightSide = { const createPolygonShapeRightSide = {
reDraw: false, reDraw: false,
type: 'Shape', type: 'Shape',
labelName: labelName, labelName,
pointsMap: [ pointsMap: [
{ x: 500, y: 120 }, { x: 500, y: 120 },
{ x: 900, y: 10 }, { x: 900, y: 10 },
@ -25,7 +25,7 @@ context('Cropping polygon in some corner cases.', () => {
const createPolygonShapeLeftSide = { const createPolygonShapeLeftSide = {
reDraw: false, reDraw: false,
type: 'Shape', type: 'Shape',
labelName: labelName, labelName,
pointsMap: [ pointsMap: [
{ x: 500, y: 120 }, { x: 500, y: 120 },
{ x: 30, y: 10 }, { x: 30, y: 10 },

@ -12,7 +12,7 @@ context('Actions on Cuboid', () => {
const createCuboidShape2Points = { const createCuboidShape2Points = {
points: 'From rectangle', points: 'From rectangle',
type: 'Shape', type: 'Shape',
labelName: labelName, labelName,
firstX: 250, firstX: 250,
firstY: 350, firstY: 350,
secondX: 350, secondX: 350,
@ -21,7 +21,7 @@ context('Actions on Cuboid', () => {
const createCuboidShape4Points = { const createCuboidShape4Points = {
points: 'By 4 Points', points: 'By 4 Points',
type: 'Shape', type: 'Shape',
labelName: labelName, labelName,
firstX: 400, firstX: 400,
firstY: 350, firstY: 350,
secondX: 500, secondX: 500,
@ -34,7 +34,7 @@ context('Actions on Cuboid', () => {
const createCuboidTrack2Points = { const createCuboidTrack2Points = {
points: 'From rectangle', points: 'From rectangle',
type: 'Track', type: 'Track',
labelName: labelName, labelName,
firstX: createCuboidShape2Points.firstX, firstX: createCuboidShape2Points.firstX,
firstY: createCuboidShape2Points.firstY - 150, firstY: createCuboidShape2Points.firstY - 150,
secondX: createCuboidShape2Points.secondX, secondX: createCuboidShape2Points.secondX,
@ -43,7 +43,7 @@ context('Actions on Cuboid', () => {
const createCuboidTrack4Points = { const createCuboidTrack4Points = {
points: 'By 4 Points', points: 'By 4 Points',
type: 'Track', type: 'Track',
labelName: labelName, labelName,
firstX: createCuboidShape4Points.firstX, firstX: createCuboidShape4Points.firstX,
firstY: createCuboidShape4Points.firstY - 150, firstY: createCuboidShape4Points.firstY - 150,
secondX: createCuboidShape4Points.secondX - 100, secondX: createCuboidShape4Points.secondX - 100,

@ -11,7 +11,7 @@ context('Settings "Intelligent polygon cropping".', () => {
const createPolygonShape = { const createPolygonShape = {
redraw: false, redraw: false,
type: 'Shape', type: 'Shape',
labelName: labelName, labelName,
pointsMap: [ pointsMap: [
{ x: 450, y: 350 }, { x: 450, y: 350 },
{ x: 550, y: 350 }, { x: 550, y: 350 },
@ -28,9 +28,7 @@ context('Settings "Intelligent polygon cropping".', () => {
.invoke('attr', 'points') .invoke('attr', 'points')
.then(($points) => { .then(($points) => {
expect( expect(
$points.split(' ').filter(function (el) { $points.split(' ').filter((el) => el.length !== 0).length,
return el.length != 0;
}).length,
).to.be.equal(expectedCount); ).to.be.equal(expectedCount);
}); });
} }
@ -42,16 +40,18 @@ context('Settings "Intelligent polygon cropping".', () => {
function testCheckedIntelligentPolygonCropping(uncheck) { function testCheckedIntelligentPolygonCropping(uncheck) {
cy.openSettings(); cy.openSettings();
cy.contains('[role="tab"]', 'Workspace').click(); cy.contains('[role="tab"]', 'Workspace').click();
uncheck if (uncheck) {
? cy cy
.get('.cvat-workspace-settings-intelligent-polygon-cropping') .get('.cvat-workspace-settings-intelligent-polygon-cropping')
.find('[type="checkbox"]') .find('[type="checkbox"]')
.uncheck() .uncheck()
.should('not.be.checked') .should('not.be.checked');
: cy } else {
cy
.get('.cvat-workspace-settings-intelligent-polygon-cropping') .get('.cvat-workspace-settings-intelligent-polygon-cropping')
.find('[type="checkbox"]') .find('[type="checkbox"]')
.should('be.checked'); .should('be.checked');
}
cy.closeSettings(); cy.closeSettings();
} }
@ -62,7 +62,8 @@ context('Settings "Intelligent polygon cropping".', () => {
describe(`Testing case "${caseId}"`, () => { describe(`Testing case "${caseId}"`, () => {
it('Check settings "Intelligent polygon cropping".', () => { it('Check settings "Intelligent polygon cropping".', () => {
testCheckedIntelligentPolygonCropping(); // Check settings "Intelligent polygon cropping". Should be checked by default // Check settings "Intelligent polygon cropping". Should be checked by default
testCheckedIntelligentPolygonCropping();
cy.get('#cvat_canvas_shape_1') cy.get('#cvat_canvas_shape_1')
.trigger('mousemove', { scrollBehavior: false }) .trigger('mousemove', { scrollBehavior: false })
.should('have.class', 'cvat_canvas_shape_activated'); .should('have.class', 'cvat_canvas_shape_activated');

@ -10,7 +10,9 @@ context('Mutable attribute.', () => {
const caseId = '70'; const caseId = '70';
const labelTrack = `Case ${caseId}`; const labelTrack = `Case ${caseId}`;
const additionalAttrsLabelShape = [ const additionalAttrsLabelShape = [
{ additionalAttrName: 'tree', additionalValue: 'birch tree', typeAttribute: 'Text', mutable: true }, {
additionalAttrName: 'tree', additionalValue: 'birch tree', typeAttribute: 'Text', mutable: true,
},
]; ];
const createRectangleTrack2Points = { const createRectangleTrack2Points = {
@ -64,7 +66,8 @@ context('Mutable attribute.', () => {
[ [
[ [
0, 0,
`${additionalAttrsLabelShape[0].additionalAttrName}: ${additionalAttrsLabelShape[0].additionalValue}`, `${additionalAttrsLabelShape[0].additionalAttrName}: ${
additionalAttrsLabelShape[0].additionalValue}`,
], ],
[1, `${additionalAttrsLabelShape[0].additionalAttrName}: ${attrValueSecondFrame}`], [1, `${additionalAttrsLabelShape[0].additionalAttrName}: ${attrValueSecondFrame}`],
[2, `${additionalAttrsLabelShape[0].additionalAttrName}: ${attrValueThirdFrame}`], [2, `${additionalAttrsLabelShape[0].additionalAttrName}: ${attrValueThirdFrame}`],

@ -11,7 +11,7 @@ context('Create an object, save, undo, save, redo, save.', () => {
const createRectangleShape2Points = { const createRectangleShape2Points = {
points: 'By 2 Points', points: 'By 2 Points',
type: 'Shape', type: 'Shape',
labelName: labelName, labelName,
firstX: 250, firstX: 250,
firstY: 350, firstY: 350,
secondX: 350, secondX: 350,

@ -34,7 +34,7 @@ context('Canvas brightness/contrast/saturation feature', () => {
describe(`Testing case "${caseId}"`, () => { describe(`Testing case "${caseId}"`, () => {
it('Check apply of settings', () => { it('Check apply of settings', () => {
let stringAction = generateString(countActionMoveSlider, 'rightarrow'); const stringAction = generateString(countActionMoveSlider, 'rightarrow');
cy.get('.cvat-canvas-image-setups-content').within(() => { cy.get('.cvat-canvas-image-setups-content').within(() => {
cy.wrap(classNameSliders).each(($el) => { cy.wrap(classNameSliders).each(($el) => {
cy.wrap($el) cy.wrap($el)

@ -11,7 +11,7 @@ context('Undo/redo feature', () => {
const firstRectangleShape2Points = { const firstRectangleShape2Points = {
points: 'By 2 Points', points: 'By 2 Points',
type: 'Shape', type: 'Shape',
labelName: labelName, labelName,
firstX: 100, firstX: 100,
firstY: 100, firstY: 100,
secondX: 150, secondX: 150,
@ -20,7 +20,7 @@ context('Undo/redo feature', () => {
const secondRectangleShape2Points = { const secondRectangleShape2Points = {
points: 'By 2 Points', points: 'By 2 Points',
type: 'Shape', type: 'Shape',
labelName: labelName, labelName,
firstX: 150, firstX: 150,
firstY: 150, firstY: 150,
secondX: 200, secondX: 200,
@ -29,7 +29,7 @@ context('Undo/redo feature', () => {
const thirdRectangleShape2Points = { const thirdRectangleShape2Points = {
points: 'By 2 Points', points: 'By 2 Points',
type: 'Shape', type: 'Shape',
labelName: labelName, labelName,
firstX: 200, firstX: 200,
firstY: 200, firstY: 200,
secondX: 250, secondX: 250,
@ -45,7 +45,7 @@ context('Undo/redo feature', () => {
cy.get('#cvat-objects-sidebar-state-item-1').should(stateFirstObject); cy.get('#cvat-objects-sidebar-state-item-1').should(stateFirstObject);
cy.get('#cvat-objects-sidebar-state-item-2').should(stateSecondObject); cy.get('#cvat-objects-sidebar-state-item-2').should(stateSecondObject);
cy.get('#cvat-objects-sidebar-state-item-3').should(stateThirdObject); cy.get('#cvat-objects-sidebar-state-item-3').should(stateThirdObject);
}; }
before(() => { before(() => {
cy.openTaskJob(taskName); cy.openTaskJob(taskName);

@ -11,7 +11,7 @@ context('Settings. "Show all interpolation tracks" option.', () => {
const createRectangleTrack2Points = { const createRectangleTrack2Points = {
points: 'By 2 Points', points: 'By 2 Points',
type: 'Track', type: 'Track',
labelName: labelName, labelName,
firstX: 250, firstX: 250,
firstY: 350, firstY: 350,
secondX: 350, secondX: 350,

@ -21,7 +21,7 @@ context('Check if the image is rotated', () => {
} }
function scaleFitImage() { function scaleFitImage() {
let scaleBefore, scaleAfter; let scaleBefore;
cy.get('#cvat_canvas_background') cy.get('#cvat_canvas_background')
.should('have.attr', 'style') .should('have.attr', 'style')
.then(($styles) => { .then(($styles) => {
@ -31,7 +31,7 @@ context('Check if the image is rotated', () => {
cy.get('#cvat_canvas_background') cy.get('#cvat_canvas_background')
.should('have.attr', 'style') .should('have.attr', 'style')
.then(($styles) => { .then(($styles) => {
scaleAfter = Number($styles.match(/scale\((\d\.\d+)\)/m)[1]); const scaleAfter = Number($styles.match(/scale\((\d\.\d+)\)/m)[1]);
cy.expect(scaleBefore).to.be.greaterThan(scaleAfter); cy.expect(scaleBefore).to.be.greaterThan(scaleAfter);
cy.get('#cvat_canvas_content').dblclick(); cy.get('#cvat_canvas_content').dblclick();
cy.get('#cvat_canvas_background').should('have.attr', 'style').and('contain', scaleBefore); cy.get('#cvat_canvas_background').should('have.attr', 'style').and('contain', scaleBefore);

@ -5,7 +5,6 @@
/// <reference types="cypress" /> /// <reference types="cypress" />
context('Email confirmation page.', () => { context('Email confirmation page.', () => {
const caseId = 106; const caseId = 106;
describe(`Testing "Case ${caseId}."`, () => { describe(`Testing "Case ${caseId}."`, () => {

@ -9,11 +9,11 @@ import { taskName, labelName } from '../../support/const_canvas3d';
context('Canvas 3D functionality. Redraw.', () => { context('Canvas 3D functionality. Redraw.', () => {
const caseId = '84'; const caseId = '84';
const cuboidCreationParams = { const cuboidCreationParams = {
labelName: labelName, labelName,
}; };
before(() => { before(() => {
cy.openTask(taskName) cy.openTask(taskName);
cy.openJob(); cy.openJob();
cy.create3DCuboid(cuboidCreationParams); cy.create3DCuboid(cuboidCreationParams);
}); });

@ -9,11 +9,11 @@ import { taskName, labelName } from '../../support/const_canvas3d';
context('Canvas 3D functionality. Delete a cuboid.', () => { context('Canvas 3D functionality. Delete a cuboid.', () => {
const caseId = '87'; const caseId = '87';
const cuboidCreationParams = { const cuboidCreationParams = {
labelName: labelName, labelName,
}; };
before(() => { before(() => {
cy.openTask(taskName) cy.openTask(taskName);
cy.openJob(); cy.openJob();
cy.create3DCuboid(cuboidCreationParams); cy.create3DCuboid(cuboidCreationParams);
}); });

@ -4,7 +4,9 @@
/// <reference types="cypress" /> /// <reference types="cypress" />
import { taskName, textDefaultValue, attrName, labelName } from '../../support/const'; import {
taskName, textDefaultValue, attrName, labelName,
} from '../../support/const';
context('Check label attribute changes', () => { context('Check label attribute changes', () => {
const issueId = '1919'; const issueId = '1919';
@ -12,7 +14,7 @@ context('Check label attribute changes', () => {
const createRectangleShape2Points = { const createRectangleShape2Points = {
points: 'By 2 Points', points: 'By 2 Points',
type: 'Shape', type: 'Shape',
labelName: labelName, labelName,
firstX: 250, firstX: 250,
firstY: 350, firstY: 350,
secondX: 350, secondX: 350,

@ -11,7 +11,7 @@ context('Check error canvas is busy at resize element', () => {
const createRectangleShape2Points = { const createRectangleShape2Points = {
points: 'By 2 Points', points: 'By 2 Points',
type: 'Shape', type: 'Shape',
labelName: labelName, labelName,
firstX: 100, firstX: 100,
firstY: 100, firstY: 100,
secondX: 300, secondX: 300,
@ -38,8 +38,7 @@ context('Check error canvas is busy at resize element', () => {
}); });
it('Resize element on second frame and go to previous frame at resizing element', () => { it('Resize element on second frame and go to previous frame at resizing element', () => {
const secondX = createRectangleShape2Points.secondX; const { secondX, secondY } = createRectangleShape2Points;
const secondY = createRectangleShape2Points.secondY;
cy.get('.cvat-canvas-container') cy.get('.cvat-canvas-container')
.trigger('mousemove', secondX - 10, secondY - 10) // activate second shape .trigger('mousemove', secondX - 10, secondY - 10) // activate second shape
.trigger('mousedown', secondX, secondY, { button: 0 }) .trigger('mousedown', secondX, secondY, { button: 0 })

@ -21,9 +21,9 @@ context('Reset zoom in tag annotation', () => {
cy.get('.ant-modal-content').within(() => { cy.get('.ant-modal-content').within(() => {
cy.contains('Player').click(); cy.contains('Player').click();
cy.get('.cvat-player-settings-reset-zoom-checkbox').within(() => { cy.get('.cvat-player-settings-reset-zoom-checkbox').within(() => {
if (value == 'check') { if (value === 'check') {
cy.get('[type="checkbox"]').check(); cy.get('[type="checkbox"]').check();
} else if (value == 'uncheck') { } else if (value === 'uncheck') {
cy.get('[type="checkbox"]').uncheck(); cy.get('[type="checkbox"]').uncheck();
} }
}); });

@ -10,7 +10,7 @@ context('Draw a point shape, specify one point', () => {
const issueId = '2306'; const issueId = '2306';
const createPointsShape = { const createPointsShape = {
type: 'Shape', type: 'Shape',
labelName: labelName, labelName,
pointsMap: [{ x: 500, y: 200 }], pointsMap: [{ x: 500, y: 200 }],
numberOfPoints: 1, numberOfPoints: 1,
}; };

@ -11,7 +11,7 @@ context('Check hide/unhide functionality from label tab for object and tag with
const createRectangleShape2Points = { const createRectangleShape2Points = {
points: 'By 2 Points', points: 'By 2 Points',
type: 'Shape', type: 'Shape',
labelName: labelName, labelName,
firstX: 260, firstX: 260,
firstY: 200, firstY: 200,
secondX: 360, secondX: 360,

@ -11,7 +11,7 @@ context('Navigation to empty frames', () => {
const createRectangleShape2Points = { const createRectangleShape2Points = {
points: 'By 2 Points', points: 'By 2 Points',
type: 'Shape', type: 'Shape',
labelName: labelName, labelName,
firstX: 250, firstX: 250,
firstY: 350, firstY: 350,
secondX: 350, secondX: 350,

@ -11,7 +11,7 @@ context("Object can't be draggable/resizable in AAM", () => {
const createRectangleShape2Points = { const createRectangleShape2Points = {
points: 'By 2 Points', points: 'By 2 Points',
type: 'Shape', type: 'Shape',
labelName: labelName, labelName,
firstX: 250, firstX: 250,
firstY: 350, firstY: 350,
secondX: 350, secondX: 350,

@ -15,7 +15,7 @@ context('Call HOC component each render.', () => {
const createPolygonShapePoints = { const createPolygonShapePoints = {
reDraw: false, reDraw: false,
type: 'Shape', type: 'Shape',
labelName: labelName, labelName,
pointsMap: [ pointsMap: [
{ x: 200, y: 200 }, { x: 200, y: 200 },
{ x: 250, y: 200 }, { x: 250, y: 200 },
@ -26,7 +26,7 @@ context('Call HOC component each render.', () => {
}; };
const createPolylinesTrackPoints = { const createPolylinesTrackPoints = {
type: 'Track', type: 'Track',
labelName: labelName, labelName,
pointsMap: [ pointsMap: [
{ x: 300, y: 200 }, { x: 300, y: 200 },
{ x: 350, y: 200 }, { x: 350, y: 200 },
@ -38,7 +38,7 @@ context('Call HOC component each render.', () => {
}; };
const createPointsShapePoints = { const createPointsShapePoints = {
type: 'Shape', type: 'Shape',
labelName: labelName, labelName,
pointsMap: [ pointsMap: [
{ x: 400, y: 200 }, { x: 400, y: 200 },
{ x: 450, y: 200 }, { x: 450, y: 200 },

@ -10,7 +10,7 @@ context('After draw correcting line and press the latest drawn point then it clo
const issueId = '2807'; const issueId = '2807';
const createPolylinesShapePoints = { const createPolylinesShapePoints = {
type: 'Shape', type: 'Shape',
labelName: labelName, labelName,
pointsMap: [ pointsMap: [
{ x: 400, y: 400 }, { x: 400, y: 400 },
{ x: 600, y: 250 }, { x: 600, y: 250 },
@ -18,8 +18,8 @@ context('After draw correcting line and press the latest drawn point then it clo
], ],
numberOfPoints: 3, numberOfPoints: 3,
}; };
let svgJsCircle = []; const svgJsCircle = [];
let svgJsCircleAfterCorrection = []; const svgJsCircleAfterCorrection = [];
function getCircleAndWriteToArr(array) { function getCircleAndWriteToArr(array) {
cy.get('circle').then((circle) => { cy.get('circle').then((circle) => {

@ -12,7 +12,7 @@ context('Crop polygon properly.', () => {
const createPolygonShape = { const createPolygonShape = {
reDraw: false, reDraw: false,
type: 'Shape', type: 'Shape',
labelName: labelName, labelName,
pointsMap: [ pointsMap: [
{ x: 200, y: 500 }, { x: 200, y: 500 },
{ x: 200, y: 200 }, { x: 200, y: 200 },

@ -11,7 +11,7 @@ context('Check if the UI fails by moving to the next frame while dragging the ob
const createRectangleShape2Points = { const createRectangleShape2Points = {
points: 'By 2 Points', points: 'By 2 Points',
type: 'Shape', type: 'Shape',
labelName: labelName, labelName,
firstX: 250, firstX: 250,
firstY: 350, firstY: 350,
secondX: 350, secondX: 350,

@ -11,7 +11,7 @@ context('Check if UI not fails with shape dragging over sidebar', () => {
const createRectangleShape2Points = { const createRectangleShape2Points = {
points: 'By 2 Points', points: 'By 2 Points',
type: 'Shape', type: 'Shape',
labelName: labelName, labelName,
firstX: 250, firstX: 250,
firstY: 350, firstY: 350,
secondX: 350, secondX: 350,
@ -20,7 +20,7 @@ context('Check if UI not fails with shape dragging over sidebar', () => {
const createRectangleShape2PointsSecond = { const createRectangleShape2PointsSecond = {
points: 'By 2 Points', points: 'By 2 Points',
type: 'Shape', type: 'Shape',
labelName: labelName, labelName,
firstX: createRectangleShape2Points.firstX, firstX: createRectangleShape2Points.firstX,
firstY: createRectangleShape2Points.firstY - 150, firstY: createRectangleShape2Points.firstY - 150,
secondX: createRectangleShape2Points.secondX, secondX: createRectangleShape2Points.secondX,

@ -10,7 +10,7 @@ context('Points track it is still invisible on next frames', () => {
const issueId = '1368'; const issueId = '1368';
const createPointsTrack = { const createPointsTrack = {
type: 'Track', type: 'Track',
labelName: labelName, labelName,
pointsMap: [{ x: 300, y: 410 }], pointsMap: [{ x: 300, y: 410 }],
complete: true, complete: true,
numberOfPoints: null, numberOfPoints: null,

@ -12,7 +12,7 @@ context('The highlighted attribute in AAM should correspond to the chosen attrib
const createRectangleShape2Points = { const createRectangleShape2Points = {
points: 'By 2 Points', points: 'By 2 Points',
type: 'Shape', type: 'Shape',
labelName: labelName, labelName,
firstX: 250, firstX: 250,
firstY: 350, firstY: 350,
secondX: 350, secondX: 350,
@ -34,7 +34,7 @@ context('The highlighted attribute in AAM should correspond to the chosen attrib
it('Check if highlighted attribute correspond to the chosen attribute in right panel', () => { it('Check if highlighted attribute correspond to the chosen attribute in right panel', () => {
cy.get('.cvat_canvas_text').within(() => { cy.get('.cvat_canvas_text').within(() => {
cy.get('[style="fill: red;"]').then(($textValue) => { cy.get('[style="fill: red;"]').then(($textValue) => {
textValue = $textValue.text().split(': ')[1]; [, textValue] = $textValue.text().split(': ');
}); });
}); });
cy.get('.cvat-attribute-annotation-sidebar-attr-editor').within(() => { cy.get('.cvat-attribute-annotation-sidebar-attr-editor').within(() => {
@ -45,7 +45,7 @@ context('The highlighted attribute in AAM should correspond to the chosen attrib
cy.get('.cvat-attribute-annotation-sidebar-attribute-switcher-right').click(); cy.get('.cvat-attribute-annotation-sidebar-attribute-switcher-right').click();
cy.get('.cvat_canvas_text').within(() => { cy.get('.cvat_canvas_text').within(() => {
cy.get('[style="fill: red;"]').then(($textValue) => { cy.get('[style="fill: red;"]').then(($textValue) => {
textValue = $textValue.text().split(': ')[1]; [, textValue] = $textValue.text().split(': ');
}); });
}); });
cy.get('.cvat-attribute-annotation-sidebar-attr-editor').within(() => { cy.get('.cvat-attribute-annotation-sidebar-attr-editor').within(() => {

@ -12,7 +12,7 @@ context('Check if the new label reflects in the options', () => {
const createRectangleShape2Points = { const createRectangleShape2Points = {
points: 'By 2 Points', points: 'By 2 Points',
type: 'Shape', type: 'Shape',
labelName: labelName, labelName,
firstX: 250, firstX: 250,
firstY: 350, firstY: 350,
secondX: 350, secondX: 350,

@ -11,7 +11,7 @@ context('Cancel "multiple paste". UI is not locked.', () => {
const createRectangleShape2Points = { const createRectangleShape2Points = {
points: 'By 2 Points', points: 'By 2 Points',
type: 'Shape', type: 'Shape',
labelName: labelName, labelName,
firstX: 250, firstX: 250,
firstY: 350, firstY: 350,
secondX: 350, secondX: 350,

@ -11,7 +11,7 @@ context('Filter property "shape" work correctly', () => {
const createRectangleShape2Points = { const createRectangleShape2Points = {
points: 'By 2 Points', points: 'By 2 Points',
type: 'Shape', type: 'Shape',
labelName: labelName, labelName,
firstX: 250, firstX: 250,
firstY: 350, firstY: 350,
secondX: 350, secondX: 350,
@ -20,7 +20,7 @@ context('Filter property "shape" work correctly', () => {
const createPolygonShape = { const createPolygonShape = {
reDraw: false, reDraw: false,
type: 'Shape', type: 'Shape',
labelName: labelName, labelName,
pointsMap: [ pointsMap: [
{ x: 300, y: 100 }, { x: 300, y: 100 },
{ x: 400, y: 400 }, { x: 400, y: 400 },

@ -4,11 +4,13 @@
/// <reference types="cypress" /> /// <reference types="cypress" />
import { taskName, labelName, attrName, textDefaultValue } from '../../support/const'; import {
taskName, labelName, attrName, textDefaultValue,
} from '../../support/const';
context('Message in UI when raw labels are wrong.', () => { context('Message in UI when raw labels are wrong.', () => {
const issueId = '1498'; const issueId = '1498';
let taskRaw = [ const taskRaw = [
{ {
name: labelName, name: labelName,
id: 1, id: 1,
@ -45,9 +47,9 @@ context('Message in UI when raw labels are wrong.', () => {
}); });
}); });
it('Label "name" as a number.', () => { it('Label "name" as a number.', () => {
let taskRawNameNumber = JSON.parse(JSON.stringify(taskRaw)); const taskRawNameNumber = JSON.parse(JSON.stringify(taskRaw));
taskRawNameNumber[0].name = 1; taskRawNameNumber[0].name = 1;
let jsonNameNumber = JSON.stringify(taskRawNameNumber); const jsonNameNumber = JSON.stringify(taskRawNameNumber);
cy.get('#labels').type(jsonNameNumber, { parseSpecialCharSequences: false }); cy.get('#labels').type(jsonNameNumber, { parseSpecialCharSequences: false });
cy.get('.ant-form-item-explain') cy.get('.ant-form-item-explain')
.should('exist') .should('exist')
@ -57,9 +59,9 @@ context('Message in UI when raw labels are wrong.', () => {
}); });
}); });
it('Label "id" as a string.', () => { it('Label "id" as a string.', () => {
let taskRawLabelString = JSON.parse(JSON.stringify(taskRaw)); const taskRawLabelString = JSON.parse(JSON.stringify(taskRaw));
taskRawLabelString[0].id = '1'; taskRawLabelString[0].id = '1';
let jsonLabelString = JSON.stringify(taskRawLabelString); const jsonLabelString = JSON.stringify(taskRawLabelString);
cy.get('#labels').type(jsonLabelString, { parseSpecialCharSequences: false }); cy.get('#labels').type(jsonLabelString, { parseSpecialCharSequences: false });
cy.get('.ant-form-item-explain') cy.get('.ant-form-item-explain')
.should('exist') .should('exist')
@ -69,9 +71,9 @@ context('Message in UI when raw labels are wrong.', () => {
}); });
}); });
it('Label "attributes" as a number.', () => { it('Label "attributes" as a number.', () => {
let taskRawAttrNumber = JSON.parse(JSON.stringify(taskRaw)); const taskRawAttrNumber = JSON.parse(JSON.stringify(taskRaw));
taskRawAttrNumber[0].attributes = 1; taskRawAttrNumber[0].attributes = 1;
let jsonAttrNumber = JSON.stringify(taskRawAttrNumber); const jsonAttrNumber = JSON.stringify(taskRawAttrNumber);
cy.get('#labels').type(jsonAttrNumber, { parseSpecialCharSequences: false }); cy.get('#labels').type(jsonAttrNumber, { parseSpecialCharSequences: false });
cy.get('.ant-form-item-explain') cy.get('.ant-form-item-explain')
.should('exist') .should('exist')
@ -81,9 +83,9 @@ context('Message in UI when raw labels are wrong.', () => {
}); });
}); });
it('Label "color" as a number.', () => { it('Label "color" as a number.', () => {
let taskRawColorNumber = JSON.parse(JSON.stringify(taskRaw)); const taskRawColorNumber = JSON.parse(JSON.stringify(taskRaw));
taskRawColorNumber[0].color = 1; taskRawColorNumber[0].color = 1;
let jsonColorNumber = JSON.stringify(taskRawColorNumber); const jsonColorNumber = JSON.stringify(taskRawColorNumber);
cy.get('#labels').type(jsonColorNumber, { parseSpecialCharSequences: false }); cy.get('#labels').type(jsonColorNumber, { parseSpecialCharSequences: false });
cy.get('.ant-form-item-explain') cy.get('.ant-form-item-explain')
.should('exist') .should('exist')
@ -93,9 +95,9 @@ context('Message in UI when raw labels are wrong.', () => {
}); });
}); });
it('Label "attributes id" as a string.', () => { it('Label "attributes id" as a string.', () => {
let taskRawAttrIdString = JSON.parse(JSON.stringify(taskRaw)); const taskRawAttrIdString = JSON.parse(JSON.stringify(taskRaw));
taskRawAttrIdString[0].attributes[0].id = '1'; taskRawAttrIdString[0].attributes[0].id = '1';
let jsonAttrIdString = JSON.stringify(taskRawAttrIdString); const jsonAttrIdString = JSON.stringify(taskRawAttrIdString);
cy.get('#labels').type(jsonAttrIdString, { parseSpecialCharSequences: false }); cy.get('#labels').type(jsonAttrIdString, { parseSpecialCharSequences: false });
cy.get('.ant-form-item-explain') cy.get('.ant-form-item-explain')
.should('exist') .should('exist')
@ -106,10 +108,10 @@ context('Message in UI when raw labels are wrong.', () => {
}); });
it('Label "attributes input_type" is incorrect.', () => { it('Label "attributes input_type" is incorrect.', () => {
const inputTypes = ['select radio', 'textt', 'nnumber']; const inputTypes = ['select radio', 'textt', 'nnumber'];
let taskRawAttrTypeNumber = JSON.parse(JSON.stringify(taskRaw)); const taskRawAttrTypeNumber = JSON.parse(JSON.stringify(taskRaw));
for (let type of inputTypes) { for (const type of inputTypes) {
taskRawAttrTypeNumber[0].attributes[0].input_type = type; taskRawAttrTypeNumber[0].attributes[0].input_type = type;
let jsonAttrTypeNumber = JSON.stringify(taskRawAttrTypeNumber); const jsonAttrTypeNumber = JSON.stringify(taskRawAttrTypeNumber);
cy.get('#labels').type(jsonAttrTypeNumber, { parseSpecialCharSequences: false }); cy.get('#labels').type(jsonAttrTypeNumber, { parseSpecialCharSequences: false });
cy.get('.ant-form-item-explain') cy.get('.ant-form-item-explain')
.should('exist') .should('exist')
@ -121,9 +123,9 @@ context('Message in UI when raw labels are wrong.', () => {
} }
}); });
it('Label "attributes mutable" as a number.', () => { it('Label "attributes mutable" as a number.', () => {
let taskRawAttrMutableNumber = JSON.parse(JSON.stringify(taskRaw)); const taskRawAttrMutableNumber = JSON.parse(JSON.stringify(taskRaw));
taskRawAttrMutableNumber[0].attributes[0].mutable = 1; taskRawAttrMutableNumber[0].attributes[0].mutable = 1;
let jsonAttrMutableNumber = JSON.stringify(taskRawAttrMutableNumber); const jsonAttrMutableNumber = JSON.stringify(taskRawAttrMutableNumber);
cy.get('#labels').type(jsonAttrMutableNumber, { parseSpecialCharSequences: false }); cy.get('#labels').type(jsonAttrMutableNumber, { parseSpecialCharSequences: false });
cy.get('.ant-form-item-explain') cy.get('.ant-form-item-explain')
.should('exist') .should('exist')
@ -133,9 +135,9 @@ context('Message in UI when raw labels are wrong.', () => {
}); });
}); });
it('Label "attributes values" as a number.', () => { it('Label "attributes values" as a number.', () => {
let taskRawAttrValuesNumber = JSON.parse(JSON.stringify(taskRaw)); const taskRawAttrValuesNumber = JSON.parse(JSON.stringify(taskRaw));
taskRawAttrValuesNumber[0].attributes[0].values = 1; taskRawAttrValuesNumber[0].attributes[0].values = 1;
let jsonAttrValueNumber = JSON.stringify(taskRawAttrValuesNumber); const jsonAttrValueNumber = JSON.stringify(taskRawAttrValuesNumber);
cy.get('#labels').type(jsonAttrValueNumber, { parseSpecialCharSequences: false }); cy.get('#labels').type(jsonAttrValueNumber, { parseSpecialCharSequences: false });
cy.get('.ant-form-item-explain') cy.get('.ant-form-item-explain')
.should('exist') .should('exist')
@ -145,9 +147,9 @@ context('Message in UI when raw labels are wrong.', () => {
}); });
}); });
it('Label "attributes values" as a array with number.', () => { it('Label "attributes values" as a array with number.', () => {
let taskRawAttrValuesNumberArr = JSON.parse(JSON.stringify(taskRaw)); const taskRawAttrValuesNumberArr = JSON.parse(JSON.stringify(taskRaw));
taskRawAttrValuesNumberArr[0].attributes[0].values = [1]; taskRawAttrValuesNumberArr[0].attributes[0].values = [1];
let jsonAttrValuesNumberArr = JSON.stringify(taskRawAttrValuesNumberArr); const jsonAttrValuesNumberArr = JSON.stringify(taskRawAttrValuesNumberArr);
cy.get('#labels').type(jsonAttrValuesNumberArr, { parseSpecialCharSequences: false }); cy.get('#labels').type(jsonAttrValuesNumberArr, { parseSpecialCharSequences: false });
cy.get('.ant-form-item-explain') cy.get('.ant-form-item-explain')
.should('exist') .should('exist')
@ -157,9 +159,9 @@ context('Message in UI when raw labels are wrong.', () => {
}); });
}); });
it('Label "attributes name" as a number.', () => { it('Label "attributes name" as a number.', () => {
let taskRawAttrNameNumber = JSON.parse(JSON.stringify(taskRaw)); const taskRawAttrNameNumber = JSON.parse(JSON.stringify(taskRaw));
taskRawAttrNameNumber[0].attributes[0].name = 1; taskRawAttrNameNumber[0].attributes[0].name = 1;
let jsonAttrNameNumber = JSON.stringify(taskRawAttrNameNumber); const jsonAttrNameNumber = JSON.stringify(taskRawAttrNameNumber);
cy.get('#labels').type(jsonAttrNameNumber, { parseSpecialCharSequences: false }); cy.get('#labels').type(jsonAttrNameNumber, { parseSpecialCharSequences: false });
cy.get('.ant-form-item-explain') cy.get('.ant-form-item-explain')
.should('exist') .should('exist')
@ -169,9 +171,9 @@ context('Message in UI when raw labels are wrong.', () => {
}); });
}); });
it('Label "attributes values" as a empty array.', () => { it('Label "attributes values" as a empty array.', () => {
let taskRawAttrValuesEmptyArr = JSON.parse(JSON.stringify(taskRaw)); const taskRawAttrValuesEmptyArr = JSON.parse(JSON.stringify(taskRaw));
taskRawAttrValuesEmptyArr[0].attributes[0].values = []; taskRawAttrValuesEmptyArr[0].attributes[0].values = [];
let jsonAttrValuesEmptyArr = JSON.stringify(taskRawAttrValuesEmptyArr); const jsonAttrValuesEmptyArr = JSON.stringify(taskRawAttrValuesEmptyArr);
cy.get('#labels').type(jsonAttrValuesEmptyArr, { parseSpecialCharSequences: false }); cy.get('#labels').type(jsonAttrValuesEmptyArr, { parseSpecialCharSequences: false });
cy.get('.ant-form-item-explain') cy.get('.ant-form-item-explain')
.should('exist') .should('exist')

@ -11,7 +11,7 @@ context('An error occurs in AAM when switching to 2 frames, if the frames have o
const createRectangleShape2Points = { const createRectangleShape2Points = {
points: 'By 2 Points', points: 'By 2 Points',
type: 'Shape', type: 'Shape',
labelName: labelName, labelName,
firstX: 250, firstX: 250,
firstY: 350, firstY: 350,
secondX: 350, secondX: 350,
@ -20,7 +20,7 @@ context('An error occurs in AAM when switching to 2 frames, if the frames have o
const createRectangleShape2PointsSecond = { const createRectangleShape2PointsSecond = {
points: 'By 2 Points', points: 'By 2 Points',
type: 'Shape', type: 'Shape',
labelName: labelName, labelName,
firstX: createRectangleShape2Points.firstX, firstX: createRectangleShape2Points.firstX,
firstY: createRectangleShape2Points.firstY - 150, firstY: createRectangleShape2Points.firstY - 150,
secondX: createRectangleShape2Points.secondX, secondX: createRectangleShape2Points.secondX,

@ -43,7 +43,7 @@ context('Cannot read property label of undefined', { browser: ['!chrome', '!fire
const createRectangleShape2Points = { const createRectangleShape2Points = {
points: 'By 2 Points', points: 'By 2 Points',
type: 'Shape', type: 'Shape',
labelName: labelName, labelName,
firstX: 250, firstX: 250,
firstY: 350, firstY: 350,
secondX: 350, secondX: 350,

@ -13,21 +13,21 @@ context(
let bgcolor = ''; let bgcolor = '';
const createFirstPointsShape = { const createFirstPointsShape = {
type: 'Shape', type: 'Shape',
labelName: labelName, labelName,
pointsMap: [{ x: 300, y: 410 }], pointsMap: [{ x: 300, y: 410 }],
complete: true, complete: true,
numberOfPoints: null, numberOfPoints: null,
}; };
const createSecondPointsShape = { const createSecondPointsShape = {
type: 'Shape', type: 'Shape',
labelName: labelName, labelName,
pointsMap: [{ x: 350, y: 410 }], pointsMap: [{ x: 350, y: 410 }],
complete: true, complete: true,
numberOfPoints: null, numberOfPoints: null,
}; };
const createThirdPointsShape = { const createThirdPointsShape = {
type: 'Shape', type: 'Shape',
labelName: labelName, labelName,
pointsMap: [{ x: 400, y: 410 }], pointsMap: [{ x: 400, y: 410 }],
complete: true, complete: true,
numberOfPoints: null, numberOfPoints: null,

@ -4,7 +4,9 @@
/// <reference types="cypress" /> /// <reference types="cypress" />
import { taskName, textDefaultValue, attrName, labelName } from '../../support/const'; import {
taskName, textDefaultValue, attrName, labelName,
} from '../../support/const';
context( context(
"Checks that the cursor doesn't automatically jump to the end of a word when the attribute value changes", "Checks that the cursor doesn't automatically jump to the end of a word when the attribute value changes",
@ -13,7 +15,7 @@ context(
const createRectangleShape2Points = { const createRectangleShape2Points = {
points: 'By 2 Points', points: 'By 2 Points',
type: 'Shape', type: 'Shape',
labelName: labelName, labelName,
firstX: 250, firstX: 250,
firstY: 350, firstY: 350,
secondX: 350, secondX: 350,

@ -2,9 +2,6 @@
// //
// SPDX-License-Identifier: MIT // SPDX-License-Identifier: MIT
// eslint-disable-next-line no-undef
exports.compareImages = compareImages;
const Jimp = require('jimp'); const Jimp = require('jimp');
async function compareImages(args) { async function compareImages(args) {
@ -14,3 +11,5 @@ async function compareImages(args) {
return diff.percent; return diff.percent;
} }
exports.compareImages = compareImages;

@ -2,9 +2,10 @@
// //
// SPDX-License-Identifier: MIT // SPDX-License-Identifier: MIT
Cypress.Commands.add('compareImages', function (imgBase, imgAfterChanges) { Cypress.Commands.add(
return cy.task('compareImages', { 'compareImages',
imgBase: imgBase, (imgBase, imgAfterChanges) => cy.task('compareImages', {
imgAfterChanges: imgAfterChanges, imgBase,
}); imgAfterChanges,
}); }),
);

@ -4,8 +4,8 @@
/// <reference types="cypress" /> /// <reference types="cypress" />
export const labelName = `points cloud`; export const labelName = 'points cloud';
export const taskName = `Canvas 3D functionality`; export const taskName = 'Canvas 3D functionality';
export const pcdPngZipArr = '../../cypress/integration/canvas3d_functionality/assets/test_canvas3d.zip'; export const pcdPngZipArr = '../../cypress/integration/canvas3d_functionality/assets/test_canvas3d.zip';
export const attrName = `Attr for ${labelName}`; export const attrName = `Attr for ${labelName}`;
export const textDefaultValue = 'Some default value for type Text'; export const textDefaultValue = 'Some default value for type Text';
@ -16,7 +16,7 @@ it('Prepare to testing', () => {
cy.visit('/'); cy.visit('/');
cy.login(); cy.login();
cy.get('.cvat-tasks-page').should('exist'); cy.get('.cvat-tasks-page').should('exist');
let listItems = []; const listItems = [];
cy.document().then((doc) => { cy.document().then((doc) => {
const collection = Array.from(doc.querySelectorAll('.cvat-item-task-name')); const collection = Array.from(doc.querySelectorAll('.cvat-item-task-name'));
for (let i = 0; i < collection.length; i++) { for (let i = 0; i < collection.length; i++) {

@ -9,8 +9,8 @@ export const labelName = `Base label for ${projectName}`;
export const attrName = `Attr for ${labelName}`; export const attrName = `Attr for ${labelName}`;
export const textDefaultValue = 'Some default value for type Text'; export const textDefaultValue = 'Some default value for type Text';
export const multiAttrParams = { export const multiAttrParams = {
additionalAttrName: `Attr 2`, additionalAttrName: 'Attr 2',
additionalValue: `Attr value 2`, additionalValue: 'Attr value 2',
typeAttribute: 'Text', typeAttribute: 'Text',
}; };
@ -19,7 +19,7 @@ it('Prepare to testing', () => {
cy.login(); cy.login();
cy.goToProjectsList(); cy.goToProjectsList();
cy.get('.cvat-projects-page').should('exist'); cy.get('.cvat-projects-page').should('exist');
let listItems = []; const listItems = [];
cy.document().then((doc) => { cy.document().then((doc) => {
const collection = Array.from(doc.querySelectorAll('.cvat-projects-project-item-title')); const collection = Array.from(doc.querySelectorAll('.cvat-projects-project-item-title'));
for (let i = 0; i < collection.length; i++) { for (let i = 0; i < collection.length; i++) {

Loading…
Cancel
Save