Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update Cypress tests. Added the use of the "Done" button. #3505

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

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

context('Actions on polygon', () => {
context('Actions on polygon.', () => {
const caseId = '10';
const newLabelName = `New label for case ${caseId}`;
const createPolygonShape = {
Expand All @@ -18,8 +18,6 @@ context('Actions on polygon', () => {
{ x: 250, y: 200 },
{ x: 250, y: 250 },
],
complete: true,
numberOfPoints: null,
};
const createPolygonTrack = {
reDraw: false,
Expand All @@ -30,8 +28,6 @@ context('Actions on polygon', () => {
{ x: 350, y: 200 },
{ x: 350, y: 350 },
],
complete: true,
numberOfPoints: null,
};
const createPolygonShapePoints = {
reDraw: false,
Expand Down Expand Up @@ -68,8 +64,7 @@ context('Actions on polygon', () => {
{ x: 650, y: 200 },
{ x: 650, y: 250 },
],
complete: true,
numberOfPoints: null,
finishWithButton: true,
};
const createPolygonTrackSwitchLabel = {
reDraw: false,
Expand All @@ -80,8 +75,7 @@ context('Actions on polygon', () => {
{ x: 750, y: 200 },
{ x: 750, y: 250 },
],
complete: true,
numberOfPoints: null,
finishWithButton: true,
};

before(() => {
Expand All @@ -101,7 +95,7 @@ context('Actions on polygon', () => {
cy.createPolygon(createPolygonTrackPoints);
});

it('Draw a polygon shape, track with second label.', () => {
it('Draw a polygon shape, track with second label and "Done" button.', () => {
cy.createPolygon(createPolygonShapeSwitchLabel);
cy.createPolygon(createPolygonTrackSwitchLabel);
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

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

context('Actions on polylines', () => {
context('Actions on polylines.', () => {
const caseId = '11';
const newLabelName = `New label for case ${caseId}`;
const createPolylinesShape = {
Expand All @@ -17,8 +17,6 @@ context('Actions on polylines', () => {
{ x: 250, y: 200 },
{ x: 250, y: 250 },
],
complete: true,
numberOfPoints: null,
};
const createPolylinesTrack = {
type: 'Track',
Expand All @@ -28,8 +26,6 @@ context('Actions on polylines', () => {
{ x: 350, y: 200 },
{ x: 350, y: 350 },
],
complete: true,
numberOfPoints: null,
};
const createPolylinesShapePoints = {
type: 'Shape',
Expand Down Expand Up @@ -63,8 +59,7 @@ context('Actions on polylines', () => {
{ x: 650, y: 200 },
{ x: 650, y: 250 },
],
complete: true,
bsekachev marked this conversation as resolved.
Show resolved Hide resolved
numberOfPoints: null,
finishWithButton: true,
};
const createPolylinesTrackSwitchLabel = {
type: 'Track',
Expand All @@ -74,8 +69,7 @@ context('Actions on polylines', () => {
{ x: 750, y: 200 },
{ x: 750, y: 250 },
],
complete: true,
numberOfPoints: null,
finishWithButton: true,
};

before(() => {
Expand All @@ -95,7 +89,7 @@ context('Actions on polylines', () => {
cy.createPolyline(createPolylinesTrackPoints);
});

it('Draw a polylines shape, track with second label.', () => {
it('Draw a polylines shape, track with second label and "Done" button.', () => {
cy.createPolyline(createPolylinesShapeSwitchLabel);
cy.createPolyline(createPolylinesTrackSwitchLabel);
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

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

context('Actions on points', () => {
context('Actions on points.', () => {
const caseId = '12';
const newLabelName = `New label for case ${caseId}`;
const createPointsShape = {
Expand All @@ -17,8 +17,6 @@ context('Actions on points', () => {
{ x: 250, y: 200 },
{ x: 250, y: 250 },
],
complete: true,
numberOfPoints: null,
};
const createPointsTrack = {
type: 'Track',
Expand All @@ -28,8 +26,6 @@ context('Actions on points', () => {
{ x: 350, y: 200 },
{ x: 350, y: 350 },
],
complete: true,
numberOfPoints: null,
};
const createPointsShapePoints = {
type: 'Shape',
Expand Down Expand Up @@ -63,8 +59,7 @@ context('Actions on points', () => {
{ x: 650, y: 200 },
{ x: 650, y: 250 },
],
complete: true,
numberOfPoints: null,
finishWithButton: true,
};
const createPointsTrackSwitchLabel = {
type: 'Track',
Expand All @@ -74,8 +69,7 @@ context('Actions on points', () => {
{ x: 750, y: 200 },
{ x: 750, y: 250 },
],
complete: true,
numberOfPoints: null,
finishWithButton: true,
};

before(() => {
Expand All @@ -85,15 +79,17 @@ context('Actions on points', () => {
});

describe(`Testing case "${caseId}"`, () => {
it('Draw a points shape, track', () => {
it('Draw a points shape, track.', () => {
cy.createPoint(createPointsShape);
cy.createPoint(createPointsTrack);
});
it('Draw a points shape, track with use parameter "number of points"', () => {

it('Draw a points shape, track with use parameter "number of points".', () => {
cy.createPoint(createPointsShapePoints);
cy.createPoint(createPointsTrackPoints);
});
it('Draw a points shape, track with second label', () => {

it('Draw a points shape, track with second label and "Done" button.', () => {
cy.createPoint(createPointsShapeSwitchLabel);
cy.createPoint(createPointsTrackSwitchLabel);
});
Expand Down
45 changes: 27 additions & 18 deletions tests/cypress/support/commands.js
Original file line number Diff line number Diff line change
Expand Up @@ -304,19 +304,22 @@ Cypress.Commands.add('createPoint', (createPointParams) => {
selectedValueGlobal = $labelValue.text();
});
if (createPointParams.numberOfPoints) {
createPointParams.complete = false;
cy.get('.ant-input-number-input').clear().type(createPointParams.numberOfPoints);
}
cy.contains('button', createPointParams.type).click();
});
createPointParams.pointsMap.forEach((element) => {
cy.get('.cvat-canvas-container').click(element.x, element.y);
});
if (createPointParams.complete) {
const keyCodeN = 78;
cy.get('.cvat-canvas-container')
.trigger('keydown', { keyCode: keyCodeN })
.trigger('keyup', { keyCode: keyCodeN });
if (createPointParams.finishWithButton) {
cy.contains('span', 'Done').click();
} else {
if (! createPointParams.numberOfPoints) {
const keyCodeN = 78;
cy.get('.cvat-canvas-container')
.trigger('keydown', { keyCode: keyCodeN })
.trigger('keyup', { keyCode: keyCodeN });
}
}
cy.checkObjectParameters(createPointParams, 'POINTS');
});
Expand Down Expand Up @@ -348,7 +351,6 @@ Cypress.Commands.add('createPolygon', (createPolygonParams) => {
selectedValueGlobal = $labelValue.text();
});
if (createPolygonParams.numberOfPoints) {
createPolygonParams.complete = false;
cy.get('.ant-input-number-input').clear().type(createPolygonParams.numberOfPoints);
}
cy.contains('button', createPolygonParams.type).click();
Expand All @@ -357,11 +359,15 @@ Cypress.Commands.add('createPolygon', (createPolygonParams) => {
createPolygonParams.pointsMap.forEach((element) => {
cy.get('.cvat-canvas-container').click(element.x, element.y);
});
if (createPolygonParams.complete) {
const keyCodeN = 78;
cy.get('.cvat-canvas-container')
.trigger('keydown', { keyCode: keyCodeN })
.trigger('keyup', { keyCode: keyCodeN });
if (createPolygonParams.finishWithButton) {
cy.contains('span', 'Done').click();
} else {
if (! createPolygonParams.numberOfPoints) {
const keyCodeN = 78;
cy.get('.cvat-canvas-container')
.trigger('keydown', { keyCode: keyCodeN })
.trigger('keyup', { keyCode: keyCodeN });
}
}
cy.checkObjectParameters(createPolygonParams, 'POLYGON');
});
Expand Down Expand Up @@ -490,19 +496,22 @@ Cypress.Commands.add('createPolyline', (createPolylineParams) => {
selectedValueGlobal = $labelValue.text();
});
if (createPolylineParams.numberOfPoints) {
createPolylineParams.complete = false;
cy.get('.ant-input-number-input').clear().type(createPolylineParams.numberOfPoints);
}
cy.contains('button', createPolylineParams.type).click();
});
createPolylineParams.pointsMap.forEach((element) => {
cy.get('.cvat-canvas-container').click(element.x, element.y);
});
if (createPolylineParams.complete) {
const keyCodeN = 78;
cy.get('.cvat-canvas-container')
.trigger('keydown', { keyCode: keyCodeN })
.trigger('keyup', { keyCode: keyCodeN });
if (createPolylineParams.finishWithButton) {
cy.contains('span', 'Done').click();
} else {
if (! createPolylineParams.numberOfPoints) {
const keyCodeN = 78;
cy.get('.cvat-canvas-container')
.trigger('keydown', { keyCode: keyCodeN })
.trigger('keyup', { keyCode: keyCodeN });
}
}
cy.checkObjectParameters(createPolylineParams, 'POLYLINE');
});
Expand Down