Merge branch 'develop' of https://github.com/openvinotoolkit/cvat into dkru/cypress-test-check-email-verification

main
Kruchinin 5 years ago
commit 4202c8195b

@ -11,7 +11,6 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
- Added basic projects implementation (<https://github.com/openvinotoolkit/cvat/pull/2255>)
### Changed
- PATCH requests from cvat-core submit only changed fields (<https://github.com/openvinotoolkit/cvat/pull/2445>)

@ -2072,31 +2072,6 @@
"semver": "^6.3.0"
}
},
"jest-config": {
"version": "26.6.3",
"resolved": "https://registry.npmjs.org/jest-config/-/jest-config-26.6.3.tgz",
"integrity": "sha512-t5qdIj/bCj2j7NFVHb2nFB4aUdfucDn3JRKgrZnplb8nieAirAzRSHP8uDEd+qV6ygzg9Pz4YG7UTJf94LPSyg==",
"requires": {
"@babel/core": "^7.1.0",
"@jest/test-sequencer": "^26.6.3",
"@jest/types": "^26.6.2",
"babel-jest": "^26.6.3",
"chalk": "^4.0.0",
"deepmerge": "^4.2.2",
"glob": "^7.1.1",
"graceful-fs": "^4.2.4",
"jest-environment-jsdom": "^26.6.2",
"jest-environment-node": "^26.6.2",
"jest-get-type": "^26.3.0",
"jest-jasmine2": "^26.6.3",
"jest-regex-util": "^26.0.0",
"jest-resolve": "^26.6.2",
"jest-util": "^26.6.2",
"jest-validate": "^26.6.2",
"micromatch": "^4.0.2",
"pretty-format": "^26.6.2"
}
},
"jest-diff": {
"version": "26.6.2",
"resolved": "https://registry.npmjs.org/jest-diff/-/jest-diff-26.6.2.tgz",
@ -2116,18 +2091,6 @@
"detect-newline": "^3.0.0"
}
},
"jest-each": {
"version": "26.6.2",
"resolved": "https://registry.npmjs.org/jest-each/-/jest-each-26.6.2.tgz",
"integrity": "sha512-Mer/f0KaATbjl8MCJ+0GEpNdqmnVmDYqCTJYTvoo7rqmRiDllmp2AYN+06F93nXcY3ur9ShIjS+CO/uD+BbH4A==",
"requires": {
"@jest/types": "^26.6.2",
"chalk": "^4.0.0",
"jest-get-type": "^26.3.0",
"jest-util": "^26.6.2",
"pretty-format": "^26.6.2"
}
},
"jest-get-type": {
"version": "26.3.0",
"resolved": "https://registry.npmjs.org/jest-get-type/-/jest-get-type-26.3.0.tgz",
@ -2154,31 +2117,6 @@
"walker": "^1.0.7"
}
},
"jest-jasmine2": {
"version": "26.6.3",
"resolved": "https://registry.npmjs.org/jest-jasmine2/-/jest-jasmine2-26.6.3.tgz",
"integrity": "sha512-kPKUrQtc8aYwBV7CqBg5pu+tmYXlvFlSFYn18ev4gPFtrRzB15N2gW/Roew3187q2w2eHuu0MU9TJz6w0/nPEg==",
"requires": {
"@babel/traverse": "^7.1.0",
"@jest/environment": "^26.6.2",
"@jest/source-map": "^26.6.2",
"@jest/test-result": "^26.6.2",
"@jest/types": "^26.6.2",
"@types/node": "*",
"chalk": "^4.0.0",
"co": "^4.6.0",
"expect": "^26.6.2",
"is-generator-fn": "^2.0.0",
"jest-each": "^26.6.2",
"jest-matcher-utils": "^26.6.2",
"jest-message-util": "^26.6.2",
"jest-runtime": "^26.6.3",
"jest-snapshot": "^26.6.2",
"jest-util": "^26.6.2",
"pretty-format": "^26.6.2",
"throat": "^5.0.0"
}
},
"jest-leak-detector": {
"version": "26.6.2",
"resolved": "https://registry.npmjs.org/jest-leak-detector/-/jest-leak-detector-26.6.2.tgz",
@ -2773,9 +2711,9 @@
"dev": true
},
"@types/node": {
"version": "14.14.9",
"resolved": "https://registry.npmjs.org/@types/node/-/node-14.14.9.tgz",
"integrity": "sha512-JsoLXFppG62tWTklIoO4knA+oDTYsmqWxHRvd4lpmfQRNhX6osheUOWETP2jMoV/2bEHuMra8Pp3Dmo/stBFcw=="
"version": "14.14.10",
"resolved": "https://registry.npmjs.org/@types/node/-/node-14.14.10.tgz",
"integrity": "sha512-J32dgx2hw8vXrSbu4ZlVhn1Nm3GbeCFNw2FWL8S5QKucHGY0cyNwjdQdO+KMBZ4wpmC7KhLCiNsdk1RFRIYUQQ=="
},
"@types/normalize-package-data": {
"version": "2.4.0",
@ -14283,14 +14221,14 @@
}
},
"jest-config": {
"version": "26.6.2",
"resolved": "https://registry.npmjs.org/jest-config/-/jest-config-26.6.2.tgz",
"integrity": "sha512-0ApZqPd+L/BUWvNj1GHcptb5jwF23lo+BskjgJV/Blht1hgpu6eIwaYRgHPrS6I6HrxwRfJvlGbzoZZVb3VHTA==",
"version": "26.6.3",
"resolved": "https://registry.npmjs.org/jest-config/-/jest-config-26.6.3.tgz",
"integrity": "sha512-t5qdIj/bCj2j7NFVHb2nFB4aUdfucDn3JRKgrZnplb8nieAirAzRSHP8uDEd+qV6ygzg9Pz4YG7UTJf94LPSyg==",
"requires": {
"@babel/core": "^7.1.0",
"@jest/test-sequencer": "^26.6.2",
"@jest/test-sequencer": "^26.6.3",
"@jest/types": "^26.6.2",
"babel-jest": "^26.6.2",
"babel-jest": "^26.6.3",
"chalk": "^4.0.0",
"deepmerge": "^4.2.2",
"glob": "^7.1.1",
@ -14298,7 +14236,7 @@
"jest-environment-jsdom": "^26.6.2",
"jest-environment-node": "^26.6.2",
"jest-get-type": "^26.3.0",
"jest-jasmine2": "^26.6.2",
"jest-jasmine2": "^26.6.3",
"jest-regex-util": "^26.0.0",
"jest-resolve": "^26.6.2",
"jest-util": "^26.6.2",
@ -14581,31 +14519,6 @@
"semver": "^6.3.0"
}
},
"jest-config": {
"version": "26.6.3",
"resolved": "https://registry.npmjs.org/jest-config/-/jest-config-26.6.3.tgz",
"integrity": "sha512-t5qdIj/bCj2j7NFVHb2nFB4aUdfucDn3JRKgrZnplb8nieAirAzRSHP8uDEd+qV6ygzg9Pz4YG7UTJf94LPSyg==",
"requires": {
"@babel/core": "^7.1.0",
"@jest/test-sequencer": "^26.6.3",
"@jest/types": "^26.6.2",
"babel-jest": "^26.6.3",
"chalk": "^4.0.0",
"deepmerge": "^4.2.2",
"glob": "^7.1.1",
"graceful-fs": "^4.2.4",
"jest-environment-jsdom": "^26.6.2",
"jest-environment-node": "^26.6.2",
"jest-get-type": "^26.3.0",
"jest-jasmine2": "^26.6.3",
"jest-regex-util": "^26.0.0",
"jest-resolve": "^26.6.2",
"jest-util": "^26.6.2",
"jest-validate": "^26.6.2",
"micromatch": "^4.0.2",
"pretty-format": "^26.6.2"
}
},
"jest-diff": {
"version": "26.6.2",
"resolved": "https://registry.npmjs.org/jest-diff/-/jest-diff-26.6.2.tgz",
@ -14756,6 +14669,7 @@
"exit": "^0.1.2",
"glob": "^7.1.3",
"graceful-fs": "^4.2.4",
"jest-config": "^26.6.3",
"jest-haste-map": "^26.6.2",
"jest-message-util": "^26.6.2",
"jest-mock": "^26.6.2",

@ -39,7 +39,7 @@
"detect-browser": "^5.2.0",
"error-stack-parser": "^2.0.2",
"form-data": "^2.5.0",
"jest-config": "^26.6.2",
"jest-config": "^26.6.3",
"js-cookie": "^2.2.0",
"jsonpath": "^1.0.2",
"platform": "^1.3.5",

@ -23,7 +23,11 @@ function StatesOrderingSelectorComponent(props: StatesOrderingSelectorComponentP
return (
<Col span={16}>
<Text strong>Sort by</Text>
<Select value={statesOrdering} onChange={changeStatesOrdering}>
<Select
className='cvat-objects-sidebar-ordering-selector'
value={statesOrdering}
onChange={changeStatesOrdering}
>
<Select.Option key={StatesOrdering.ID_DESCENT} value={StatesOrdering.ID_DESCENT}>
{StatesOrdering.ID_DESCENT}
</Select.Option>

@ -138,13 +138,13 @@ export default function PlayerSettingsComponent(props: Props): JSX.Element {
<Row type='flex' className='cvat-player-settings-canvas-background'>
<Col>
<Popover
content={
content={(
<CompactPicker
colors={consts.CANVAS_BACKGROUND_COLORS}
color={canvasBackgroundColor}
onChange={(e) => onChangeCanvasBackgroundColor(e.hex)}
/>
}
)}
overlayClassName='canvas-background-color-picker-popover'
trigger='click'
>
@ -169,6 +169,7 @@ export default function PlayerSettingsComponent(props: Props): JSX.Element {
<Col span={8} className='cvat-player-settings-grid-size'>
<Text className='cvat-text-color'> Grid size </Text>
<InputNumber
className='cvat-player-settings-grid-size-input'
min={minGridSize}
max={maxGridSize}
value={gridSize}
@ -183,6 +184,7 @@ export default function PlayerSettingsComponent(props: Props): JSX.Element {
<Col span={8} className='cvat-player-settings-grid-color'>
<Text className='cvat-text-color'> Grid color </Text>
<Select
className='cvat-player-settings-grid-color-input'
value={gridColor}
disabled={!grid}
onChange={(color: GridColor): void => {
@ -209,6 +211,7 @@ export default function PlayerSettingsComponent(props: Props): JSX.Element {
<Col span={8} className='cvat-player-settings-grid-opacity'>
<Text className='cvat-text-color'> Grid opacity </Text>
<Slider
className='cvat-player-settings-grid-opacity-input'
min={0}
max={100}
value={gridOpacity}

@ -9,5 +9,11 @@
"email": "admin@localhost.company",
"password": "12qwaszx"
},
"testFiles": ["auth_page.js", "actions_tasks_objects/*", "actions_users/**/*", "remove_users_tasks.js"]
"testFiles": [
"auth_page.js",
"actions_tasks_objects/*",
"actions_users/**/*",
"actions_projects/*",
"remove_users_tasks_projects.js"
]
}

@ -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);
});
});
});

@ -28,7 +28,6 @@ context('Create and delete a annotation task', () => {
cy.login();
cy.imageGenerator(imagesFolder, imageFileName, width, height, color, posX, posY, labelName, imagesCount);
cy.createZipArchive(directoryToArchive, archivePath);
cy.goToTaskList();
});
describe(`Testing "${labelName}"`, () => {

@ -34,7 +34,6 @@ context('Check if parameters "startFrame", "stopFrame", "frameStep" works as exp
cy.login();
cy.imageGenerator(imagesFolder, imageFileName, width, height, color, posX, posY, labelName, imagesCount);
cy.createZipArchive(directoryToArchive, archivePath);
cy.goToTaskList();
});
after(() => {

@ -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');
});
});
});

@ -14,11 +14,9 @@ context('When clicking on the Logout button, get the user session closed.', () =
describe(`Testing issue "${issueId}"`, () => {
it('Login', () => {
cy.login();
cy.url().should('include', '/tasks');
});
it('Logout', () => {
cy.logout();
cy.url().should('include', '/auth/login');
});
});
});

@ -30,7 +30,6 @@ context('Register user, change password, login with new password', () => {
describe(`Testing "Case ${caseId}"`, () => {
it('Register user, change password', () => {
cy.userRegistration(firstName, lastName, userName, emailAddr, password);
cy.url().should('include', '/tasks');
cy.get('.cvat-right-header')
.find('.cvat-header-menu-dropdown')
.should('have.text', userName)
@ -46,11 +45,9 @@ context('Register user, change password, login with new password', () => {
});
it('Logout', () => {
cy.logout(userName);
cy.url().should('include', '/auth/login');
});
it('Login with the new password', () => {
cy.login(userName, newPassword);
cy.url().should('include', '/tasks');
});
});
});

@ -39,7 +39,6 @@ context('Multiple users. Assign task, job.', () => {
after(() => {
cy.login();
cy.goToTaskList();
cy.getTaskID(taskName).then(($taskID) => {
cy.deleteTask(taskName, $taskID);
});
@ -57,9 +56,7 @@ context('Multiple users. Assign task, job.', () => {
secondUser.emailAddr,
secondUser.password,
);
cy.url().should('include', '/tasks');
cy.logout(secondUserName);
cy.url().should('include', '/auth/login');
});
it('Register third user and logout.', () => {
cy.get('a[href="/auth/register"]').click();
@ -71,14 +68,10 @@ context('Multiple users. Assign task, job.', () => {
thirdUser.emailAddr,
thirdUser.password,
);
cy.url().should('include', '/tasks');
cy.logout(thirdUserName);
cy.url().should('include', '/auth/login');
});
it('First user login and create a task', () => {
cy.login();
cy.url().should('include', '/tasks');
cy.goToTaskList();
cy.imageGenerator(imagesFolder, imageFileName, width, height, color, posX, posY, labelName, imagesCount);
cy.createZipArchive(directoryToArchive, archivePath);
cy.createAnnotationTask(taskName, labelName, attrName, textDefaultValue, archiveName);
@ -93,23 +86,17 @@ context('Multiple users. Assign task, job.', () => {
});
it('Second user login. The task can be opened. Logout', () => {
cy.login(secondUserName, secondUser.password);
cy.url().should('include', '/tasks');
cy.goToTaskList();
cy.contains('strong', taskName).should('exist');
cy.openTask(taskName);
cy.logout(secondUserName);
});
it('Third user login. The task not exist. Logout', () => {
cy.login(thirdUserName, thirdUser.password);
cy.url().should('include', '/tasks');
cy.goToTaskList();
cy.contains('strong', taskName).should('not.exist');
cy.logout(thirdUserName);
});
it('First user login and assign the job to the third user. Logout', () => {
cy.login();
cy.url().should('include', '/tasks');
cy.goToTaskList();
cy.openTask(taskName);
cy.get('.cvat-task-job-list').within(() => {
cy.get('.cvat-user-search-field').click({ force: true });
@ -119,8 +106,6 @@ context('Multiple users. Assign task, job.', () => {
});
it('Third user login. The task can be opened.', () => {
cy.login(thirdUserName, thirdUser.password);
cy.url().should('include', '/tasks');
cy.goToTaskList();
cy.contains('strong', taskName).should('exist');
cy.openTask(taskName);
cy.logout(thirdUserName);

@ -62,4 +62,24 @@ describe('Delete users and tasks created during the test run.', () => {
}
});
});
it('Get a list of projects and delete them all', () => {
cy.request({
url: '/api/v1/projects?page_size=all',
headers: {
Authorization: `Token ${authKey}`,
},
}).then(async (responce) => {
const responceResult = await responce['body']['results'];
for (let tasks of responceResult) {
let taskId = tasks['id'];
cy.request({
method: 'DELETE',
url: `/api/v1/projects/${taskId}`,
headers: {
Authorization: `Token ${authKey}`,
},
});
}
});
});
});

@ -14,14 +14,15 @@ Cypress.Commands.add('login', (username = Cypress.env('user'), password = Cypres
cy.get('[placeholder="Username"]').type(username);
cy.get('[placeholder="Password"]').type(password);
cy.get('[type="submit"]').click();
cy.url().should('include', '/tasks');
});
Cypress.Commands.add('logout', (username = Cypress.env('user')) => {
cy.get('.cvat-right-header')
.find('.cvat-header-menu-dropdown')
.should('have.text', username)
.trigger('mouseover', { which: 1 });
cy.get('.cvat-right-header').within(() => {
cy.get('.cvat-header-menu-dropdown').should('have.text', username).trigger('mouseover', { which: 1 });
});
cy.get('.anticon-logout').click();
cy.url().should('include', '/auth/login');
});
Cypress.Commands.add('userRegistration', (firstName, lastName, userName, emailAddr, password) => {
@ -32,6 +33,7 @@ Cypress.Commands.add('userRegistration', (firstName, lastName, userName, emailAd
cy.get('#password1').type(password);
cy.get('#password2').type(password);
cy.get('.register-form-button').click();
cy.url().should('include', '/tasks');
});
Cypress.Commands.add(
@ -44,40 +46,59 @@ Cypress.Commands.add(
image = 'image.png',
multiAttrParams,
advancedConfigurationParams,
forProject = false,
attachToProject = false,
projectName,
) => {
cy.get('#cvat-create-task-button').click({ force: true });
cy.url().should('include', '/tasks/create');
cy.get('[id="name"]').type(taksName);
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);
if (!forProject) {
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();
} else {
if (attachToProject) {
cy.get('.cvat-project-search-field').click();
cy.get('.ant-select-dropdown')
.not('.ant-select-dropdown-hidden')
.contains(new RegExp(`^${projectName}$`, 'g'))
.click();
}
cy.get('.cvat-project-search-field').within(() => {
cy.get('[type="text"]').should('have.value', projectName);
});
cy.get('.cvat-constructor-viewer-new-item').should('not.exist');
}
cy.contains('button', 'Done').click();
cy.get('input[type="file"]').attachFile(image, { subjectType: 'drag-n-drop' });
if (advancedConfigurationParams) {
cy.advancedConfiguration(advancedConfigurationParams);
}
cy.contains('button', 'Submit').click();
cy.contains('The task has been created');
cy.get('[value="tasks"]').click();
cy.url().should('include', '/tasks?page=');
if (!forProject) {
cy.goToTaskList();
} else {
cy.goToProjectsList();
}
},
);
Cypress.Commands.add('openTask', (taskName) => {
cy.contains('strong', taskName).parents('.cvat-tasks-list-item').contains('a', 'Open').click({ force: true });
cy.get('.cvat-task-details').should('exist');
});
Cypress.Commands.add('saveJob', () => {
cy.get('button')
.contains('Save')
.click({ force: true });
cy.get('button').contains('Save').click({ force: true });
});
Cypress.Commands.add('openJob', (jobNumber = 0) => {
@ -93,6 +114,7 @@ Cypress.Commands.add('openJob', (jobNumber = 0) => {
cy.get('.ant-table-tbody').contains('a', `Job #${tdText}`).click();
});
cy.url().should('include', '/jobs');
cy.get('.cvat-canvas-container').should('exist');
});
Cypress.Commands.add('openTaskJob', (taskName, jobNumber = 0) => {
@ -122,12 +144,17 @@ Cypress.Commands.add('createRectangle', (createRectangleParams) => {
});
Cypress.Commands.add('switchLabel', (labelName, objectType) => {
const pattern = `^(Draw new|Setup) ${objectType}$`
const regex = new RegExp(pattern, 'g');
cy.contains(regex).parents('.cvat-draw-shape-popover-content').within(() => {
cy.get('.ant-select-selection-selected-value').click();
});
cy.get('.ant-select-dropdown').not('.ant-select-dropdown-hidden').contains(new RegExp(`^${labelName}$`, 'g')).click();
const pattern = `^(Draw new|Setup) ${objectType}$`;
const regex = new RegExp(pattern, 'g');
cy.contains(regex)
.parents('.cvat-draw-shape-popover-content')
.within(() => {
cy.get('.ant-select-selection-selected-value').click();
});
cy.get('.ant-select-dropdown')
.not('.ant-select-dropdown-hidden')
.contains(new RegExp(`^${labelName}$`, 'g'))
.click();
});
Cypress.Commands.add('checkObjectParameters', (objectParameters, objectType) => {
@ -242,7 +269,10 @@ Cypress.Commands.add('changeLabelAAM', (labelName) => {
cy.get('.attribute-annotation-sidebar-basics-editor').within(() => {
cy.get('.ant-select-selection').click();
});
cy.get('.ant-select-dropdown').not('.ant-select-dropdown-hidden').contains(new RegExp(`^${labelName}$`, 'g')).click();
cy.get('.ant-select-dropdown')
.not('.ant-select-dropdown-hidden')
.contains(new RegExp(`^${labelName}$`, 'g'))
.click();
}
});
});
@ -332,6 +362,9 @@ Cypress.Commands.add('advancedConfiguration', (advancedConfigurationParams) => {
cy.get('#stopFrame').type(advancedConfigurationParams.stopFrame);
cy.get('#frameStep').type(advancedConfigurationParams.frameStep);
}
if (advancedConfigurationParams.chunkSize) {
cy.get('#dataChunkSize').type(advancedConfigurationParams.chunkSize);
}
});
Cypress.Commands.add('removeAnnotations', () => {
@ -346,10 +379,12 @@ Cypress.Commands.add('removeAnnotations', () => {
Cypress.Commands.add('goToTaskList', () => {
cy.get('a[value="tasks"]').click();
cy.url().should('include', '/tasks');
});
Cypress.Commands.add('addNewLabel', (newLabelName) => {
let listCvatConstructorViewerItemText = [];
cy.get('.cvat-constructor-viewer').should('exist');
cy.document().then((doc) => {
const labels = Array.from(doc.querySelectorAll('.cvat-constructor-viewer-item'));
for (let i = 0; i < labels.length; i++) {
@ -366,7 +401,24 @@ Cypress.Commands.add('addNewLabel', (newLabelName) => {
Cypress.Commands.add('createTag', (labelName) => {
cy.get('.cvat-setup-tag-control').click();
cy.switchLabel(labelName, 'tag');
cy.contains('Setup tag').parents('.cvat-draw-shape-popover-content').within(() => {
cy.get('button').click();
cy.contains('Setup tag')
.parents('.cvat-draw-shape-popover-content')
.within(() => {
cy.get('button').click();
});
});
Cypress.Commands.add('goToRegisterPage', () => {
cy.get('a[href="/auth/register"]').click();
cy.url().should('include', '/auth/register');
});
Cypress.Commands.add('assignTaskToUser', (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(`^${user}$`, 'g'))
.click();
});

@ -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();
});

@ -9,7 +9,7 @@ export const taskName = `New annotation task for ${labelName}`;
export const attrName = `Attr for ${labelName}`;
export const textDefaultValue = 'Some default value for type Text';
export const imagesCount = 50;
export const imageFileName = `image_${labelName.replace(' ', '_').toLowerCase()}`;
export const imageFileName = `image_${labelName.replace(/\s+/g, '_').toLowerCase()}`;
export const width = 800;
export const height = 800;
export const posX = 10;
@ -36,7 +36,6 @@ export const multiAttrParams = {
it('Prepare to testing', () => {
cy.visit('/');
cy.login();
cy.goToTaskList();
cy.get('.cvat-tasks-page').should('exist');
let listItems = [];
cy.document().then((doc) => {

@ -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.');
}
});
});

@ -3,6 +3,7 @@
// SPDX-License-Identifier: MIT
require('./commands');
require('./commands_projects');
require('@cypress/code-coverage/support');
before(() => {

Loading…
Cancel
Save