|
|
|
|
@ -10,6 +10,8 @@ require('cypress-file-upload');
|
|
|
|
|
require('../plugins/imageGenerator/imageGeneratorCommand');
|
|
|
|
|
require('../plugins/createZipArchive/createZipArchiveCommand');
|
|
|
|
|
|
|
|
|
|
let selectedValueGlobal = '';
|
|
|
|
|
|
|
|
|
|
Cypress.Commands.add('login', (username = Cypress.env('user'), password = Cypress.env('password')) => {
|
|
|
|
|
cy.get('[placeholder="Username"]').type(username);
|
|
|
|
|
cy.get('[placeholder="Password"]').type(password);
|
|
|
|
|
@ -99,17 +101,21 @@ Cypress.Commands.add('createRectangle', (createRectangleParams) => {
|
|
|
|
|
if (createRectangleParams.switchLabel) {
|
|
|
|
|
cy.switchLabel(createRectangleParams.labelName);
|
|
|
|
|
}
|
|
|
|
|
cy.get('.cvat-draw-shape-popover-content').contains(createRectangleParams.points).click();
|
|
|
|
|
cy.get('.cvat-draw-shape-popover-content')
|
|
|
|
|
.find('button')
|
|
|
|
|
.contains(createRectangleParams.type)
|
|
|
|
|
.click({ force: true });
|
|
|
|
|
cy.contains('Draw new rectangle')
|
|
|
|
|
.parents('.cvat-draw-shape-popover-content').within(() => {
|
|
|
|
|
cy.get('.ant-select-selection-selected-value').then(($labelValue) => {
|
|
|
|
|
selectedValueGlobal = $labelValue.text();
|
|
|
|
|
});
|
|
|
|
|
cy.get('.ant-radio-wrapper').contains(createRectangleParams.points).click();
|
|
|
|
|
cy.get('button').contains(createRectangleParams.type).click({ force: true });
|
|
|
|
|
})
|
|
|
|
|
cy.get('.cvat-canvas-container').click(createRectangleParams.firstX, createRectangleParams.firstY);
|
|
|
|
|
cy.get('.cvat-canvas-container').click(createRectangleParams.secondX, createRectangleParams.secondY);
|
|
|
|
|
if (createRectangleParams.points === 'By 4 Points') {
|
|
|
|
|
cy.get('.cvat-canvas-container').click(createRectangleParams.thirdX, createRectangleParams.thirdY);
|
|
|
|
|
cy.get('.cvat-canvas-container').click(createRectangleParams.fourthX, createRectangleParams.fourthY);
|
|
|
|
|
}
|
|
|
|
|
cy.checkObjectParameters(createRectangleParams, 'RECTANGLE');
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
Cypress.Commands.add('switchLabel', (labelName) => {
|
|
|
|
|
@ -117,6 +123,16 @@ Cypress.Commands.add('switchLabel', (labelName) => {
|
|
|
|
|
cy.get('.ant-select-dropdown-menu').contains(labelName).click();
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
Cypress.Commands.add('checkObjectParameters', (objectParameters, objectType) => {
|
|
|
|
|
cy.get('.cvat-objects-sidebar-state-item').then((objectSidebar) => {
|
|
|
|
|
cy.get(`#cvat_canvas_shape_${objectSidebar.length}`).should('exist').and('be.visible');
|
|
|
|
|
cy.get(`#cvat-objects-sidebar-state-item-${objectSidebar.length}`)
|
|
|
|
|
.should('contain', objectSidebar.length).and('contain', `${objectType} ${objectParameters.type.toUpperCase()}`).within(() => {
|
|
|
|
|
cy.get('.ant-select-selection-selected-value').should('have.text', selectedValueGlobal);
|
|
|
|
|
});
|
|
|
|
|
});
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
Cypress.Commands.add('createPoint', (createPointParams) => {
|
|
|
|
|
cy.get('.cvat-draw-points-control').click();
|
|
|
|
|
if (createPointParams.switchLabel) {
|
|
|
|
|
@ -125,6 +141,9 @@ Cypress.Commands.add('createPoint', (createPointParams) => {
|
|
|
|
|
cy.contains('Draw new points')
|
|
|
|
|
.parents('.cvat-draw-shape-popover-content')
|
|
|
|
|
.within(() => {
|
|
|
|
|
cy.get('.ant-select-selection-selected-value').then(($labelValue) => {
|
|
|
|
|
selectedValueGlobal = $labelValue.text();
|
|
|
|
|
});
|
|
|
|
|
if (createPointParams.numberOfPoints) {
|
|
|
|
|
createPointParams.complete = false;
|
|
|
|
|
cy.get('.ant-input-number-input').clear().type(createPointParams.numberOfPoints);
|
|
|
|
|
@ -137,6 +156,7 @@ Cypress.Commands.add('createPoint', (createPointParams) => {
|
|
|
|
|
if (createPointParams.complete) {
|
|
|
|
|
cy.get('.cvat-canvas-container').trigger('keydown', { key: 'n' }).trigger('keyup', { key: 'n' });
|
|
|
|
|
}
|
|
|
|
|
cy.checkObjectParameters(createPointParams, 'POINTS');
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
Cypress.Commands.add('changeAppearance', (colorBy) => {
|
|
|
|
|
@ -165,6 +185,9 @@ Cypress.Commands.add('createPolygon', (createPolygonParams) => {
|
|
|
|
|
cy.contains('Draw new polygon')
|
|
|
|
|
.parents('.cvat-draw-shape-popover-content')
|
|
|
|
|
.within(() => {
|
|
|
|
|
cy.get('.ant-select-selection-selected-value').then(($labelValue) => {
|
|
|
|
|
selectedValueGlobal = $labelValue.text();
|
|
|
|
|
});
|
|
|
|
|
if (createPolygonParams.numberOfPoints) {
|
|
|
|
|
createPolygonParams.complete = false;
|
|
|
|
|
cy.get('.ant-input-number-input').clear().type(createPolygonParams.numberOfPoints);
|
|
|
|
|
@ -178,6 +201,7 @@ Cypress.Commands.add('createPolygon', (createPolygonParams) => {
|
|
|
|
|
if (createPolygonParams.complete) {
|
|
|
|
|
cy.get('.cvat-canvas-container').trigger('keydown', { key: 'n' }).trigger('keyup', { key: 'n' });
|
|
|
|
|
}
|
|
|
|
|
cy.checkObjectParameters(createPolygonParams, 'POLYGON');
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
Cypress.Commands.add('openSettings', () => {
|
|
|
|
|
@ -208,6 +232,9 @@ Cypress.Commands.add('createCuboid', (createCuboidParams) => {
|
|
|
|
|
cy.contains('Draw new cuboid')
|
|
|
|
|
.parents('.cvat-draw-shape-popover-content')
|
|
|
|
|
.within(() => {
|
|
|
|
|
cy.get('.ant-select-selection-selected-value').then(($labelValue) => {
|
|
|
|
|
selectedValueGlobal = $labelValue.text();
|
|
|
|
|
});
|
|
|
|
|
cy.get('button').contains(createCuboidParams.type).click({ force: true });
|
|
|
|
|
});
|
|
|
|
|
cy.get('.cvat-canvas-container').click(createCuboidParams.firstX, createCuboidParams.firstY);
|
|
|
|
|
@ -216,6 +243,7 @@ Cypress.Commands.add('createCuboid', (createCuboidParams) => {
|
|
|
|
|
cy.get('.cvat-canvas-container').click(createCuboidParams.thirdX, createCuboidParams.thirdY);
|
|
|
|
|
cy.get('.cvat-canvas-container').click(createCuboidParams.fourthX, createCuboidParams.fourthY);
|
|
|
|
|
}
|
|
|
|
|
cy.checkObjectParameters(createCuboidParams, 'CUBOID');
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
Cypress.Commands.add('updateAttributes', (multiAttrParams) => {
|
|
|
|
|
@ -234,6 +262,9 @@ Cypress.Commands.add('createPolyline', (createPolylineParams) => {
|
|
|
|
|
cy.contains('Draw new polyline')
|
|
|
|
|
.parents('.cvat-draw-shape-popover-content')
|
|
|
|
|
.within(() => {
|
|
|
|
|
cy.get('.ant-select-selection-selected-value').then(($labelValue) => {
|
|
|
|
|
selectedValueGlobal = $labelValue.text();
|
|
|
|
|
});
|
|
|
|
|
if (createPolylineParams.numberOfPoints) {
|
|
|
|
|
createPolylineParams.complete = false;
|
|
|
|
|
cy.get('.ant-input-number-input').clear().type(createPolylineParams.numberOfPoints);
|
|
|
|
|
@ -246,6 +277,7 @@ Cypress.Commands.add('createPolyline', (createPolylineParams) => {
|
|
|
|
|
if (createPolylineParams.complete) {
|
|
|
|
|
cy.get('.cvat-canvas-container').trigger('keydown', { key: 'n' }).trigger('keyup', { key: 'n' });
|
|
|
|
|
}
|
|
|
|
|
cy.checkObjectParameters(createPolylineParams, 'POLYLINE');
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
Cypress.Commands.add('getTaskID', (taskName) => {
|
|
|
|
|
|