Skip to content

Commit

Permalink
Added default value test, refactored tests (cvat-ai#6529)
Browse files Browse the repository at this point in the history
<!-- Raise an issue to propose your change
(https://github.com/opencv/cvat/issues).
It helps to avoid duplication of efforts from multiple independent
contributors.
Discuss your ideas with maintainers to be sure that changes will be
approved and merged.
Read the [Contribution
guide](https://opencv.github.io/cvat/docs/contributing/). -->

<!-- Provide a general summary of your changes in the Title above -->

### Motivation and context
<!-- Why is this change required? What problem does it solve? If it
fixes an open
issue, please link to the issue here. Describe your changes in detail,
add
screenshots. -->

### How has this been tested?
<!-- Please describe in detail how you tested your changes.
Include details of your testing environment, and the tests you ran to
see how your change affects other areas of the code, etc. -->

### Checklist
<!-- Go over all the following points, and put an `x` in all the boxes
that apply.
If an item isn't applicable for some reason, then ~~explicitly
strikethrough~~ the whole
line. If you don't do that, GitHub will show incorrect progress for the
pull request.
If you're unsure about any of these, don't hesitate to ask. We're here
to help! -->
- [x] I submit my changes into the `develop` branch
- [ ] I have added a description of my changes into the
[CHANGELOG](https://github.com/opencv/cvat/blob/develop/CHANGELOG.md)
file
- [ ] I have updated the documentation accordingly
- [x] I have added tests to cover my changes
- [ ] I have linked related issues (see [GitHub docs](

https://help.github.com/en/github/managing-your-work-on-github/linking-a-pull-request-to-an-issue#linking-a-pull-request-to-an-issue-using-a-keyword))
- [ ] I have increased versions of npm packages if it is necessary

([cvat-canvas](https://github.com/opencv/cvat/tree/develop/cvat-canvas#versioning),

[cvat-core](https://github.com/opencv/cvat/tree/develop/cvat-core#versioning),

[cvat-data](https://github.com/opencv/cvat/tree/develop/cvat-data#versioning)
and

[cvat-ui](https://github.com/opencv/cvat/tree/develop/cvat-ui#versioning))

### License

- [x] I submit _my code changes_ under the same [MIT License](
https://github.com/opencv/cvat/blob/develop/LICENSE) that covers the
project.
  Feel free to contact the maintainers if that's a concern.
  • Loading branch information
bsekachev authored Jul 20, 2023
1 parent 791604a commit 1da005c
Show file tree
Hide file tree
Showing 31 changed files with 294 additions and 206 deletions.
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
// Copyright (C) 2021-2022 Intel Corporation
// Copyright (C) 2023 CVAT.ai Corporation
//
// SPDX-License-Identifier: MIT

Expand Down Expand Up @@ -26,7 +27,7 @@ context('Save filtered object in AAM.', () => {
// Getting list of labels and create a label if neccessary
const labelsList = Array.from(doc.querySelectorAll('.cvat-constructor-viewer-item'));
if (labelsList.length < 2) {
cy.addNewLabel(newLabelName);
cy.addNewLabel({ name: newLabelName });
}
});
cy.document().then((doc) => {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
// Copyright (C) 2020-2022 Intel Corporation
// Copyright (C) 2023 CVAT.ai Corporation
//
// SPDX-License-Identifier: MIT

Expand Down Expand Up @@ -80,7 +81,7 @@ context('Actions on polygon.', () => {

before(() => {
cy.openTask(taskName);
cy.addNewLabel(newLabelName);
cy.addNewLabel({ name: newLabelName });
cy.openJob();
});

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
// Copyright (C) 2022 Intel Corporation
// Copyright (C) 2023 CVAT.ai Corporation
//
// SPDX-License-Identifier: MIT

Expand Down Expand Up @@ -58,7 +59,7 @@ context('Actions on ellipse.', () => {

before(() => {
cy.openTask(taskName);
cy.addNewLabel(newLabelName);
cy.addNewLabel({ name: newLabelName });
cy.openJob();
});

Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// Copyright (C) 2020-2022 Intel Corporation
//
// Copyright (C) 2023 CVAT.ai Corporation
// SPDX-License-Identifier: MIT

/// <reference types="cypress" />
Expand Down Expand Up @@ -74,7 +74,7 @@ context('Actions on polylines.', () => {

before(() => {
cy.openTask(taskName);
cy.addNewLabel(newLabelName);
cy.addNewLabel({ name: newLabelName });
cy.openJob();
});

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
// Copyright (C) 2020-2022 Intel Corporation
// Copyright (C) 2023 CVAT.ai Corporation
//
// SPDX-License-Identifier: MIT

Expand Down Expand Up @@ -74,7 +75,7 @@ context('Actions on points.', () => {

before(() => {
cy.openTask(taskName);
cy.addNewLabel(newLabelName);
cy.addNewLabel({ name: newLabelName });
cy.openJob();
});

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
// Copyright (C) 2020-2022 Intel Corporation
// Copyright (C) 2023 CVAT.ai Corporation
//
// SPDX-License-Identifier: MIT

Expand Down Expand Up @@ -95,10 +96,9 @@ context('Lock/hide features.', () => {

before(() => {
cy.openTask(taskName);
cy.addNewLabel(newLabelName1);
cy.addNewLabel(newLabelName2);
cy.addNewLabel(newLabelName3);
cy.addNewLabel(newLabelName4);
[newLabelName1, newLabelName2, newLabelName3, newLabelName4].forEach((name) => {
cy.addNewLabel({ name });
});
cy.openJob();
});

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
// Copyright (C) 2020-2022 Intel Corporation
// Copyright (C) 2023 CVAT.ai Corporation
//
// SPDX-License-Identifier: MIT

Expand Down Expand Up @@ -78,7 +79,7 @@ context('Actions on rectangle', () => {

before(() => {
cy.openTask(taskName);
cy.addNewLabel(newLabelName);
cy.addNewLabel({ name: newLabelName });
cy.openJob();
});

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
// Copyright (C) 2020-2022 Intel Corporation
// Copyright (C) 2023 CVAT.ai Corporation
//
// SPDX-License-Identifier: MIT

Expand Down Expand Up @@ -78,7 +79,7 @@ context('Actions on Cuboid', () => {

before(() => {
cy.openTask(taskName);
cy.addNewLabel(newLabelName);
cy.addNewLabel({ name: newLabelName });
cy.openJob();
});

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
// Copyright (C) 2020-2022 Intel Corporation
// Copyright (C) 2023 CVAT.ai Corporation
//
// SPDX-License-Identifier: MIT

Expand Down Expand Up @@ -65,10 +66,9 @@ context('Base actions on the project', () => {

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);
[newLabelName1, newLabelName2, newLabelName3, newLabelName4].forEach((name) => {
cy.addNewLabel({ name });
});
});
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);
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
// Copyright (C) 2021-2022 Intel Corporation
// Copyright (C) 2023 CVAT.ai Corporation
//
// SPDX-License-Identifier: MIT

Expand Down Expand Up @@ -39,7 +40,7 @@ context('Create a task with set an issue tracker.', () => {
describe(`Testing "${labelName}"`, () => {
it('Creating a task with incorrect issue tracker URL. The error notification is shown.', () => {
cy.get('[id="name"]').type(taskName);
cy.addNewLabel(labelName);
cy.addNewLabel({ name: labelName });
cy.get('input[type="file"]').attachFile(archiveName, { subjectType: 'drag-n-drop' });
cy.contains('Advanced configuration').click();
cy.get('#bugTracker').type(incorrectBugTrackerUrl);
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
// Copyright (C) 2021-2022 Intel Corporation
// Copyright (C) 2023 CVAT.ai Corporation
//
// SPDX-License-Identifier: MIT

Expand Down Expand Up @@ -43,7 +44,7 @@ context('Rename a label via raw editor.', () => {
cy.createZipArchive(directoryToArchive, archivePath);
cy.createAnnotationTask(taskName, labelName, attrName, textDefaultValue, archiveName);
cy.openTask(taskName);
cy.addNewLabel(labelName);
cy.addNewLabel({ name: labelName });
});

after(() => {
Expand Down
10 changes: 5 additions & 5 deletions tests/cypress/e2e/actions_tasks/case_72_hotkeys_change_labels.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// Copyright (C) 2021-2022 Intel Corporation
// Copyright (C) 2022 CVAT.ai Corporation
// Copyright (C) 2022-2023 CVAT.ai Corporation
//
// SPDX-License-Identifier: MIT

Expand All @@ -24,9 +24,9 @@ context('Hotkeys to change labels feature.', () => {
const directoryToArchive = imagesFolder;
const secondLabel = `Case ${caseId} second`;
const additionalAttrsSecondLabel = [{
additionalAttrName: attrName,
additionalValue: '0;3;1',
typeAttribute: 'Number',
name: attrName,
values: '0;3;1',
type: 'Number',
mutable: false,
}];
let firstLabelCurrentVal = '';
Expand Down Expand Up @@ -54,7 +54,7 @@ context('Hotkeys to change labels feature.', () => {
cy.createZipArchive(directoryToArchive, archivePath);
cy.createAnnotationTask(taskName, labelName, attrName, textDefaultValue, archiveName);
cy.openTask(taskName);
cy.addNewLabel(secondLabel, additionalAttrsSecondLabel);
cy.addNewLabel({ name: secondLabel }, additionalAttrsSecondLabel);
cy.openJob();
});

Expand Down
16 changes: 8 additions & 8 deletions tests/cypress/e2e/actions_tasks/mutable_attributes.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ context('Mutable attribute.', () => {
const labelName = 'car';
const additionalAttrsLabelShape = [
{
additionalAttrName: 'tree', additionalValue: 'birch tree', typeAttribute: 'Text', mutable: true,
name: 'tree', values: 'birch tree', type: 'Text', mutable: true,
},
];

Expand Down Expand Up @@ -45,7 +45,7 @@ context('Mutable attribute.', () => {

before(() => {
cy.openTask(taskName);
cy.addNewLabel(labelName, additionalAttrsLabelShape);
cy.addNewLabel({ name: labelName }, additionalAttrsLabelShape);
cy.openJob();
cy.createRectangle(createRectangleTrack2Points);
});
Expand All @@ -54,7 +54,7 @@ context('Mutable attribute.', () => {
it('Go to AAM. For the 2nd and 3rd frames, change the attribute value.', () => {
cy.changeWorkspace('Attribute annotation');
cy.changeLabelAAM(labelName);
testChangingAttributeValue(additionalAttrsLabelShape[0].additionalValue, attrValueSecondFrame);
testChangingAttributeValue(additionalAttrsLabelShape[0].values, attrValueSecondFrame);
testChangingAttributeValue(attrValueSecondFrame, attrValueThirdFrame);
});

Expand All @@ -66,12 +66,12 @@ context('Mutable attribute.', () => {
[
[
0,
`${additionalAttrsLabelShape[0].additionalAttrName}: ${
additionalAttrsLabelShape[0].additionalValue}`,
`${additionalAttrsLabelShape[0].name}: ${
additionalAttrsLabelShape[0].values}`,
],
[1, `${additionalAttrsLabelShape[0].additionalAttrName}: ${attrValueSecondFrame}`],
[2, `${additionalAttrsLabelShape[0].additionalAttrName}: ${attrValueThirdFrame}`],
[3, `${additionalAttrsLabelShape[0].additionalAttrName}: ${attrValueThirdFrame}`],
[1, `${additionalAttrsLabelShape[0].name}: ${attrValueSecondFrame}`],
[2, `${additionalAttrsLabelShape[0].name}: ${attrValueThirdFrame}`],
[3, `${additionalAttrsLabelShape[0].name}: ${attrValueThirdFrame}`],
].forEach(([num, val]) => {
checkObjectDetailValue(num, val);
});
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
// Copyright (C) 2020-2022 Intel Corporation
// Copyright (C) 2023 CVAT.ai Corporation
//
// SPDX-License-Identifier: MIT

Expand Down Expand Up @@ -59,9 +60,9 @@ context('Label constructor. Color label. Label name editing', () => {

describe(`Testing case "${caseId}"`, () => {
it('To add multiple labels with a color change.', () => {
cy.addNewLabel(colorRed, labelAdditionalAttrs, labelColor.redHex);
cy.addNewLabel(colorGreen, labelAdditionalAttrs, labelColor.greenHex);
cy.addNewLabel(colorBlue, labelAdditionalAttrs, labelColor.blueHex);
cy.addNewLabel({ name: colorRed, color: labelColor.redHex }, labelAdditionalAttrs);
cy.addNewLabel({ name: colorGreen, color: labelColor.greenHex }, labelAdditionalAttrs);
cy.addNewLabel({ name: colorBlue, color: labelColor.blueHex }, labelAdditionalAttrs);
});

it('Check color for created labels.', () => {
Expand Down Expand Up @@ -130,7 +131,7 @@ context('Label constructor. Color label. Label name editing', () => {
cy.goToTaskList();
cy.openTask(taskName);
// Adding a label without setting a color
cy.addNewLabel(`Case ${caseId}`);
cy.addNewLabel({ name: `Case ${caseId}` });
cy.get('.cvat-constructor-viewer').should('be.visible');
cy.contains('.cvat-constructor-viewer-item', `Case ${caseId}`)
.invoke('attr', 'style')
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
// Copyright (C) 2021-2022 Intel Corporation
// Copyright (C) 2023 CVAT.ai Corporation
//
// SPDX-License-Identifier: MIT

Expand Down Expand Up @@ -49,7 +50,7 @@ context('Try to create a task without necessary arguments.', () => {
});

it('Input task labels. A task is not created.', () => {
cy.addNewLabel(labelName);
cy.addNewLabel({ name: labelName });
cy.contains('button', 'Submit & Continue').click();
cy.get('.cvat-notification-create-task-fail').should('exist');
cy.closeNotification('.cvat-notification-create-task-fail');
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
// Copyright (C) 2021-2022 Intel Corporation
// Copyright (C) 2023 CVAT.ai Corporation
//
// SPDX-License-Identifier: MIT

Expand Down Expand Up @@ -35,7 +36,7 @@ context('Try to create a task with an incorrect dataset repository.', () => {
describe(`Testing "${labelName}"`, () => {
it('Try create task with incorrect dataset repo URL.', () => {
cy.get('[id="name"]').type(taskName);
cy.addNewLabel(labelName);
cy.addNewLabel({ name: labelName });
cy.get('input[type="file"]').attachFile(archiveName, { subjectType: 'drag-n-drop' });
cy.contains('.cvat-title', 'Advanced configuration').click();
cy.get('#repository').type(incorrectDatasetRepoUrl);
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
// Copyright (C) 2021-2022 Intel Corporation
// Copyright (C) 2023 CVAT.ai Corporation
//
// SPDX-License-Identifier: MIT

Expand Down Expand Up @@ -47,7 +48,7 @@ context('Export, import an annotation task.', { browser: '!firefox' }, () => {
const [link] = url.split('?');
taskId = Number(link.split('/').slice(-1)[0]);
});
cy.addNewLabel(newLabelName);
cy.addNewLabel({ name: newLabelName });
cy.openJob();
cy.createRectangle(createRectangleShape2Points).then(() => {
Cypress.config('scrollBehavior', false);
Expand Down
Loading

0 comments on commit 1da005c

Please sign in to comment.