Merge branch 'develop' into upstream/do/cypress_test_issue_2174_reset_zoom_in_tag_annotation_mode
commit
e8de702ba4
@ -0,0 +1,145 @@
|
||||
// Copyright (C) 2020 Intel Corporation
|
||||
//
|
||||
// SPDX-License-Identifier: MIT
|
||||
|
||||
/// <reference types="cypress" />
|
||||
|
||||
import { projectName } from '../../support/const_project';
|
||||
|
||||
const randomString = (isPassword) => {
|
||||
let result = '';
|
||||
const characters = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz';
|
||||
for (let i = 0; i <= 8; i++) {
|
||||
result += characters.charAt(Math.floor(Math.random() * characters.length));
|
||||
}
|
||||
return isPassword ? `${result}${Math.floor(Math.random() * 10)}` : result;
|
||||
};
|
||||
|
||||
context('Base actions on the project', () => {
|
||||
const labelName = `Base label for ${projectName}`;
|
||||
const taskName = {
|
||||
firstTask: `First task for ${projectName}`,
|
||||
secondTask: `Second task for ${projectName}`,
|
||||
};
|
||||
const attrName = `Attr for ${labelName}`;
|
||||
const textDefaultValue = 'Some default value for type Text';
|
||||
const imagesCount = 1;
|
||||
const imageFileName = `image_${taskName.firstTask.replace(/\s+/g, '_').toLowerCase()}`;
|
||||
const width = 800;
|
||||
const height = 800;
|
||||
const posX = 10;
|
||||
const posY = 10;
|
||||
const color = 'white';
|
||||
const archiveName = `${imageFileName}.zip`;
|
||||
const archivePath = `cypress/fixtures/${archiveName}`;
|
||||
const imagesFolder = `cypress/fixtures/${imageFileName}`;
|
||||
const directoryToArchive = imagesFolder;
|
||||
const advancedConfigurationParams = false;
|
||||
const forProject = true;
|
||||
const attachToProject = {
|
||||
yes: true,
|
||||
no: false,
|
||||
};
|
||||
const multiAttrParams = false;
|
||||
const newLabelName1 = `First label ${projectName}`;
|
||||
const newLabelName2 = `Second label ${projectName}`;
|
||||
const newLabelName3 = `Third label ${projectName}`;
|
||||
const newLabelName4 = `Fourth label ${projectName}`;
|
||||
const firstName = `${randomString()}`;
|
||||
const lastName = `${randomString()}`;
|
||||
const userName = `${randomString()}`;
|
||||
const emailAddr = `${userName}@local.local`;
|
||||
const password = `${randomString(true)}`;
|
||||
let projectID = '';
|
||||
|
||||
before(() => {
|
||||
cy.openProject(projectName);
|
||||
});
|
||||
|
||||
describe(`Testing "Base actions on the project"`, () => {
|
||||
it('Add some labels to project.', () => {
|
||||
cy.addNewLabel(newLabelName1);
|
||||
cy.addNewLabel(newLabelName2);
|
||||
cy.addNewLabel(newLabelName3);
|
||||
cy.addNewLabel(newLabelName4);
|
||||
});
|
||||
it('Create a first task for the project. Project field is completed with proper project name and labels editor is not accessible.', () => {
|
||||
cy.imageGenerator(imagesFolder, imageFileName, width, height, color, posX, posY, labelName, imagesCount);
|
||||
cy.createZipArchive(directoryToArchive, archivePath);
|
||||
cy.createAnnotationTask(
|
||||
taskName.firstTask,
|
||||
labelName,
|
||||
attrName,
|
||||
textDefaultValue,
|
||||
archiveName,
|
||||
multiAttrParams,
|
||||
advancedConfigurationParams,
|
||||
forProject,
|
||||
attachToProject.no,
|
||||
projectName,
|
||||
);
|
||||
});
|
||||
it('Create a second task from task list page and attach to the created project. Assign first user.', () => {
|
||||
cy.goToTaskList();
|
||||
cy.createAnnotationTask(
|
||||
taskName.secondTask,
|
||||
labelName,
|
||||
attrName,
|
||||
textDefaultValue,
|
||||
archiveName,
|
||||
multiAttrParams,
|
||||
advancedConfigurationParams,
|
||||
forProject,
|
||||
attachToProject.yes,
|
||||
projectName,
|
||||
);
|
||||
cy.goToProjectsList();
|
||||
cy.openProject(projectName);
|
||||
cy.openTask(taskName.secondTask);
|
||||
cy.assignTaskToUser(Cypress.env('user'));
|
||||
});
|
||||
it('The task is successfully opened. No label editor on task page.', () => {
|
||||
cy.goToProjectsList();
|
||||
cy.openProject(projectName);
|
||||
cy.getProjectID(projectName).then(($projectID) => {
|
||||
projectID = $projectID;
|
||||
});
|
||||
cy.get('.cvat-tasks-list-item').then((countTasks) => {
|
||||
// The number of created tasks is greater than zero
|
||||
expect(countTasks.length).to.be.gt(0);
|
||||
});
|
||||
cy.openTask(taskName.firstTask);
|
||||
cy.get('.cvat-constructor-viewer').should('not.exist');
|
||||
});
|
||||
it('Logout first user, register second user, logout.', () => {
|
||||
cy.logout();
|
||||
cy.goToRegisterPage();
|
||||
cy.userRegistration(firstName, lastName, userName, emailAddr, password);
|
||||
cy.logout(userName);
|
||||
});
|
||||
it('Login first user. Assing project to second user. Logout.', () => {
|
||||
cy.login();
|
||||
cy.goToProjectsList();
|
||||
cy.openProject(projectName);
|
||||
cy.assignProjectToUser(userName);
|
||||
cy.logout();
|
||||
});
|
||||
it('Login second user. The project and first tasks available for that user. Logout.', () => {
|
||||
cy.login(userName, password);
|
||||
cy.goToProjectsList();
|
||||
cy.openProject(projectName);
|
||||
cy.goToTaskList();
|
||||
cy.contains('strong', taskName.secondTask).should('not.exist');
|
||||
cy.openTask(taskName.firstTask);
|
||||
cy.logout(userName);
|
||||
});
|
||||
it('Delete the project. Deleted project not exist. Checking the availability of tasks.', () => {
|
||||
cy.login();
|
||||
cy.goToProjectsList();
|
||||
cy.deleteProject(projectName, projectID);
|
||||
cy.goToTaskList();
|
||||
cy.contains('strong', taskName.firstTask).should('not.exist');
|
||||
cy.contains('strong', taskName.secondTask).should('not.exist');
|
||||
});
|
||||
});
|
||||
});
|
||||
@ -0,0 +1,69 @@
|
||||
// Copyright (C) 2020 Intel Corporation
|
||||
//
|
||||
// SPDX-License-Identifier: MIT
|
||||
|
||||
/// <reference types="cypress" />
|
||||
|
||||
import { taskName } from '../../support/const';
|
||||
|
||||
context('Rotate all images feature.', () => {
|
||||
const caseId = '19';
|
||||
|
||||
function imageRotate(direction = 'anticlockwise', deg) {
|
||||
cy.get('.cvat-rotate-canvas-control').trigger('mouseover');
|
||||
if (direction === 'clockwise') {
|
||||
cy.get('.cvat-rotate-canvas-controls-right').click();
|
||||
} else {
|
||||
cy.get('.cvat-rotate-canvas-controls-left').click();
|
||||
}
|
||||
checkDegRotate(deg);
|
||||
}
|
||||
|
||||
function checkDegRotate(deg) {
|
||||
cy.get('#cvat_canvas_background').should('have.attr', 'style').and('contain', `rotate(${deg}deg);`);
|
||||
}
|
||||
|
||||
function checkFrameNum(frameNum) {
|
||||
cy.get('.cvat-player-frame-selector').within(() => {
|
||||
cy.get('input[role="spinbutton"]').should('have.value', frameNum);
|
||||
});
|
||||
}
|
||||
|
||||
before(() => {
|
||||
cy.openTaskJob(taskName);
|
||||
});
|
||||
|
||||
describe(`Testing case "${caseId}"`, () => {
|
||||
it('Rotate an image (once clockwise, twice anticlockwise)', () => {
|
||||
imageRotate('clockwise', 90);
|
||||
imageRotate('anticlockwise', 0);
|
||||
imageRotate('anticlockwise', 270);
|
||||
});
|
||||
|
||||
it("Go to the next frame. It wasn't rotated.", () => {
|
||||
cy.get('.cvat-player-next-button').click();
|
||||
checkFrameNum(1);
|
||||
checkDegRotate(0);
|
||||
});
|
||||
|
||||
it('Go to settings, set "Rotate all images" to true.', () => {
|
||||
cy.openSettings();
|
||||
cy.get('.cvat-player-settings-rotate-all-checkbox').click();
|
||||
cy.closeSettings();
|
||||
});
|
||||
|
||||
it('Rotate current frame 180 deg.', () => {
|
||||
imageRotate('clockwise', 90);
|
||||
imageRotate('clockwise', 180);
|
||||
});
|
||||
|
||||
it('Go to the previous and to the next frame. They are also rotated 180 deg.', () => {
|
||||
cy.get('.cvat-player-previous-button').click();
|
||||
checkFrameNum(0);
|
||||
checkDegRotate(180);
|
||||
cy.get('.cvat-player-next-button').click();
|
||||
checkFrameNum(1);
|
||||
checkDegRotate(180);
|
||||
});
|
||||
});
|
||||
});
|
||||
@ -0,0 +1,76 @@
|
||||
// Copyright (C) 2020 Intel Corporation
|
||||
//
|
||||
// SPDX-License-Identifier: MIT
|
||||
|
||||
/// <reference types="cypress" />
|
||||
|
||||
context('Cannot read property label of undefined', () => {
|
||||
const issueId = '1823';
|
||||
const labelName = `Issue ${issueId}`;
|
||||
const taskName = `New annotation task for ${labelName}`;
|
||||
const attrName = `Attr for ${labelName}`;
|
||||
const textDefaultValue = 'Some default value for type Text';
|
||||
const imagesCount = 10;
|
||||
const imageFileName = `image_${labelName.replace(' ', '_').toLowerCase()}`;
|
||||
const width = 800;
|
||||
const height = 800;
|
||||
const posX = 10;
|
||||
const posY = 10;
|
||||
const color = 'gray';
|
||||
const archiveName = `${imageFileName}.zip`;
|
||||
const archivePath = `cypress/fixtures/${archiveName}`;
|
||||
const imagesFolder = `cypress/fixtures/${imageFileName}`;
|
||||
const directoryToArchive = imagesFolder;
|
||||
const advancedConfigurationParams = {
|
||||
chunkSize: 1,
|
||||
};
|
||||
|
||||
const createRectangleShape2Points = {
|
||||
points: 'By 2 Points',
|
||||
type: 'Shape',
|
||||
labelName: labelName,
|
||||
firstX: 250,
|
||||
firstY: 350,
|
||||
secondX: 350,
|
||||
secondY: 450,
|
||||
};
|
||||
|
||||
before(() => {
|
||||
cy.visit('auth/login');
|
||||
cy.login();
|
||||
cy.imageGenerator(imagesFolder, imageFileName, width, height, color, posX, posY, labelName, imagesCount);
|
||||
cy.createZipArchive(directoryToArchive, archivePath);
|
||||
});
|
||||
|
||||
after(() => {
|
||||
cy.goToTaskList();
|
||||
cy.getTaskID(taskName).then(($taskID) => {
|
||||
cy.deleteTask(taskName, $taskID);
|
||||
});
|
||||
});
|
||||
|
||||
describe(`Testing "${labelName}"`, () => {
|
||||
it('Create a task with chunk size === 1. Open the task.', () => {
|
||||
cy.createAnnotationTask(
|
||||
taskName,
|
||||
labelName,
|
||||
attrName,
|
||||
textDefaultValue,
|
||||
archiveName,
|
||||
null,
|
||||
advancedConfigurationParams,
|
||||
);
|
||||
cy.openTaskJob(taskName);
|
||||
});
|
||||
it('Create a shape on the first frame.', () => {
|
||||
cy.createRectangle(createRectangleShape2Points);
|
||||
});
|
||||
it('Go to another frame. During this procedure open context menu for a shape.', () => {
|
||||
cy.get('body').type('f');
|
||||
cy.get('#cvat_canvas_shape_1').trigger('mousemove').rightclick();
|
||||
});
|
||||
it('Page with the error is missing', () => {
|
||||
cy.get('.cvat-global-boundary').should('not.exist');
|
||||
});
|
||||
});
|
||||
});
|
||||
@ -0,0 +1,56 @@
|
||||
// Copyright (C) 2020 Intel Corporation
|
||||
//
|
||||
// SPDX-License-Identifier: MIT
|
||||
|
||||
/// <reference types="cypress" />
|
||||
|
||||
import { taskName, labelName } from '../../support/const';
|
||||
|
||||
context('Check error canvas is busy at resize element', () => {
|
||||
|
||||
const issueId = '1922';
|
||||
const createRectangleShape2Points = {
|
||||
points: 'By 2 Points',
|
||||
type: 'Shape',
|
||||
labelName: labelName,
|
||||
firstX: 100,
|
||||
firstY: 100,
|
||||
secondX: 300,
|
||||
secondY: 300,
|
||||
};
|
||||
|
||||
before(() => {
|
||||
cy.openTaskJob(taskName);
|
||||
});
|
||||
|
||||
describe(`Testing issue "${issueId}"`, () => {
|
||||
it('Create an object in first frame', () => {
|
||||
cy.createRectangle(createRectangleShape2Points);
|
||||
});
|
||||
|
||||
it('Go to next frame and create an object in second frame', () => {
|
||||
cy.get('.cvat-player-next-button').click();
|
||||
cy.createRectangle(createRectangleShape2Points);
|
||||
});
|
||||
|
||||
it('Switching mode of button on "back with a filter"', () => {
|
||||
cy.get('.cvat-player-previous-button').rightclick();
|
||||
cy.get('.cvat-player-previous-filtered-inlined-button').click();
|
||||
});
|
||||
|
||||
it('Resize element on second frame and go to previous frame at resizing element', () => {
|
||||
const secondX = createRectangleShape2Points.secondX;
|
||||
const secondY = createRectangleShape2Points.secondY;
|
||||
cy.get('.cvat-canvas-container')
|
||||
.trigger('mousemove', secondX - 10, secondY - 10) // activate second shape
|
||||
.trigger('mousedown', secondX, secondY, {button: 0})
|
||||
.trigger('mousemove', secondX + 100, secondY + 100)
|
||||
.get('body').type('d') // go to previous frame
|
||||
.trigger('mouseup');
|
||||
});
|
||||
|
||||
it('Page with the error is missing', () => {
|
||||
cy.get('.cvat-global-boundary').should('not.exist');
|
||||
});
|
||||
});
|
||||
});
|
||||
@ -0,0 +1,45 @@
|
||||
// Copyright (C) 2020 Intel Corporation
|
||||
//
|
||||
// SPDX-License-Identifier: MIT
|
||||
|
||||
/// <reference types="cypress" />
|
||||
|
||||
import { taskName } from '../../support/const';
|
||||
|
||||
context('Value must be a user instance.', () => {
|
||||
const issueId = '2440';
|
||||
|
||||
before(() => {
|
||||
cy.openTask(taskName);
|
||||
});
|
||||
|
||||
describe(`Testing issue "${issueId}"`, () => {
|
||||
it('Assign a task to a user', () => {
|
||||
cy.get('.cvat-task-details-user-block').within(() => {
|
||||
cy.get('.cvat-user-search-field').click();
|
||||
});
|
||||
cy.get('.ant-select-dropdown')
|
||||
.not('.ant-select-dropdown-hidden')
|
||||
.contains(new RegExp(`^${Cypress.env('user')}$`, 'g'))
|
||||
.click();
|
||||
cy.get('.cvat-spinner').should('exist');
|
||||
});
|
||||
it('Assign the task to the same user again', () => {
|
||||
cy.get('.cvat-task-details-user-block').within(() => {
|
||||
cy.get('.cvat-user-search-field').click();
|
||||
});
|
||||
cy.get('.ant-select-dropdown')
|
||||
.not('.ant-select-dropdown-hidden')
|
||||
.contains(new RegExp(`^${Cypress.env('user')}$`, 'g'))
|
||||
.click();
|
||||
// Before fix:
|
||||
// The following error originated from your application code, not from Cypress.
|
||||
// > Value must be a user instance
|
||||
cy.get('.cvat-spinner').should('exist');
|
||||
// Remove the user's assignment for next tests.
|
||||
cy.get('.cvat-task-details-user-block').within(() => {
|
||||
cy.get('[type="text"]').click().clear().type('{Enter}');
|
||||
});
|
||||
});
|
||||
});
|
||||
});
|
||||
@ -0,0 +1,75 @@
|
||||
// Copyright (C) 2020 Intel Corporation
|
||||
//
|
||||
// SPDX-License-Identifier: MIT
|
||||
|
||||
/// <reference types="cypress" />
|
||||
|
||||
Cypress.Commands.add('goToProjectsList', () => {
|
||||
cy.get('[value="projects"]').click();
|
||||
cy.url().should('include', '/projects');
|
||||
});
|
||||
|
||||
Cypress.Commands.add('createProjects', (projectName, labelName, attrName, textDefaultValue, multiAttrParams) => {
|
||||
cy.get('#cvat-create-project-button').click();
|
||||
cy.get('#name').type(projectName);
|
||||
cy.get('.cvat-constructor-viewer-new-item').click();
|
||||
cy.get('[placeholder="Label name"]').type(labelName);
|
||||
cy.get('.cvat-new-attribute-button').click();
|
||||
cy.get('[placeholder="Name"]').type(attrName);
|
||||
cy.get('div[title="Select"]').click();
|
||||
cy.get('li').contains('Text').click();
|
||||
cy.get('[placeholder="Default value"]').type(textDefaultValue);
|
||||
if (multiAttrParams) {
|
||||
cy.updateAttributes(multiAttrParams);
|
||||
}
|
||||
cy.contains('button', 'Done').click();
|
||||
cy.get('.cvat-create-project-content').within(() => {
|
||||
cy.contains('Submit').click();
|
||||
});
|
||||
cy.contains('The project has been created').should('exist');
|
||||
cy.goToProjectsList();
|
||||
});
|
||||
|
||||
Cypress.Commands.add('openProject', (projectName) => {
|
||||
cy.contains(projectName).click({ force: true });
|
||||
cy.get('.cvat-project-details').should('exist');
|
||||
});
|
||||
|
||||
Cypress.Commands.add('getProjectID', (projectName) => {
|
||||
cy.contains('h4', projectName)
|
||||
.parents('.cvat-project-details')
|
||||
.within(() => {
|
||||
cy.get('span')
|
||||
.invoke('text')
|
||||
.then((text) => {
|
||||
return String(text.match(/#\d+/g)).replace(/[^\d]/g, '');
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
Cypress.Commands.add('deleteProject', (projectName, projectID) => {
|
||||
cy.contains(projectName)
|
||||
.parents('.cvat-projects-project-item-card')
|
||||
.within(() => {
|
||||
cy.get('.cvat-porjects-project-item-description').within(() => {
|
||||
cy.get('[type="button"]').trigger('mouseover');
|
||||
});
|
||||
});
|
||||
cy.get('.cvat-project-actions-menu').contains('Delete').click();
|
||||
cy.get('.ant-modal-content')
|
||||
.should('contain', `The project ${projectID} will be deleted`)
|
||||
.within(() => {
|
||||
cy.contains('button', 'Delete').click();
|
||||
});
|
||||
cy.get('.cvat-projects-project-item-card').should('have.css', 'opacity', '0.5');
|
||||
});
|
||||
|
||||
Cypress.Commands.add('assignProjectToUser', (user) => {
|
||||
cy.get('.cvat-project-details').within(() => {
|
||||
cy.get('.cvat-user-search-field').click();
|
||||
});
|
||||
cy.get('.ant-select-dropdown')
|
||||
.not('.ant-select-dropdown-hidden')
|
||||
.contains(new RegExp(`^${user}$`, 'g'))
|
||||
.click();
|
||||
});
|
||||
@ -0,0 +1,35 @@
|
||||
// Copyright (C) 2020 Intel Corporation
|
||||
//
|
||||
// SPDX-License-Identifier: MIT
|
||||
|
||||
/// <reference types="cypress" />
|
||||
|
||||
export const projectName = 'Main project';
|
||||
export const labelName = `Base label for ${projectName}`;
|
||||
export const attrName = `Attr for ${labelName}`;
|
||||
export const textDefaultValue = 'Some default value for type Text';
|
||||
export const multiAttrParams = {
|
||||
additionalAttrName: `Attr 2`,
|
||||
additionalValue: `Attr value 2`,
|
||||
typeAttribute: 'Text',
|
||||
};
|
||||
|
||||
it('Prepare to testing', () => {
|
||||
cy.visit('/');
|
||||
cy.login();
|
||||
cy.goToProjectsList();
|
||||
cy.get('.cvat-projects-page').should('exist');
|
||||
let listItems = [];
|
||||
cy.document().then((doc) => {
|
||||
const collection = Array.from(doc.querySelectorAll('.cvat-projects-project-item-title'));
|
||||
for (let i = 0; i < collection.length; i++) {
|
||||
listItems.push(collection[i].innerText);
|
||||
}
|
||||
if (listItems.indexOf(projectName) === -1) {
|
||||
cy.task('log', "A project doesn't exist. Creating.");
|
||||
cy.createProjects(projectName, labelName, attrName, textDefaultValue, multiAttrParams);
|
||||
} else {
|
||||
cy.task('log', 'The project exist. Skipping creation.');
|
||||
}
|
||||
});
|
||||
});
|
||||
Loading…
Reference in New Issue