Skip to content

Commit

Permalink
Merge branch 'develop' of https://github.com/openvinotoolkit/cvat int…
Browse files Browse the repository at this point in the history
…o dkru/case-40-create-task-without-necessary-arguments
  • Loading branch information
dvkruchinin committed Jan 26, 2021
2 parents 96bdc8e + 165cf0f commit 2985fe9
Show file tree
Hide file tree
Showing 7 changed files with 150 additions and 11 deletions.
12 changes: 6 additions & 6 deletions cvat-ui/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions cvat-ui/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -48,12 +48,12 @@
},
"dependencies": {
"@ant-design/icons": "^4.3.0",
"@types/lodash": "^4.14.166",
"@types/lodash": "^4.14.167",
"@types/platform": "^1.3.3",
"@types/react": "^16.14.2",
"@types/react-color": "^3.0.4",
"@types/react-dom": "^16.9.10",
"@types/react-redux": "^7.1.14",
"@types/react-redux": "^7.1.15",
"@types/react-router": "^5.1.9",
"@types/react-router-dom": "^5.1.7",
"@types/react-share": "^3.0.3",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -146,6 +146,7 @@ function AnnotationsFiltersInput(props: StateToProps & DispatchToProps): JSX.Ele
width: 700,
title: 'How to use filters?',
content: filtersHelpModalContent(searchForwardShortcut, searchBackwardShortcut),
className: 'cvat-annotations-filters-help-modal-window',
});
}}
onMouseEnter={() => setDropdownVisible(false)}
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,71 @@
// Copyright (C) 2021 Intel Corporation
//
// SPDX-License-Identifier: MIT

/// <reference types="cypress" />

context('Add/delete labels and attributes.', () => {
const caseId = '41';
const labelName = `Case ${caseId}`;
const attrName = `Attr for ${labelName}`;
const textDefaultValue = 'Some default value for type Text';

before(() => {
cy.visit('auth/login');
cy.login();
cy.get('#cvat-create-task-button').click();
});

describe(`Testing "${labelName}"`, () => {
it('Start adding a label. Press Cancel. The label is not created.', () => {
cy.get('.cvat-constructor-viewer-new-item').click(); // Open label constructor
cy.get('[placeholder="Label name"]').type(labelName);
cy.contains('[type="button"]', 'Cancel').click();
cy.get('.cvat-constructor-viewer-item').should('not.exist');
});

it('Start adding a label. Start adding an attribute. Press Cancel. The label is not created.', () => {
cy.get('.cvat-constructor-viewer-new-item').click();
cy.get('[placeholder="Label name"]').type(labelName);
cy.get('.cvat-new-attribute-button').click();
cy.get('.cvat-attribute-name-input').type(attrName);
cy.get('.cvat-attribute-type-input').click();
cy.get('.cvat-attribute-type-input-text').click();
cy.get('.cvat-attribute-values-input').type(textDefaultValue);
cy.contains('[type="button"]', 'Cancel').click();
cy.get('.cvat-constructor-viewer-item').should('not.exist');
});

it('Start adding a label. Add an attribute. Press Done. The label should be created.', () => {
cy.get('.cvat-constructor-viewer-new-item').click();
cy.get('[placeholder="Label name"]').type(labelName);
cy.get('.cvat-new-attribute-button').click();
cy.get('.cvat-attribute-name-input').type(attrName);
cy.get('.cvat-attribute-type-input').click();
cy.get('.cvat-attribute-type-input-text').click();
cy.get('.cvat-attribute-values-input').type(textDefaultValue);
cy.contains('[type="submit"]', 'Done').click();
cy.get('.cvat-constructor-viewer-item').should('exist');
});

it('Start to edit the label. Attribute should exist. Remove the atrribute. Press Done.', () => {
cy.get('.cvat-constructor-viewer-item').find('[aria-label="edit"]').click();
cy.get('.cvat-attribute-inputs-wrapper')
.should('exist')
.within(() => {
cy.get('.cvat-delete-attribute-button').click();
});
cy.get('.cvat-attribute-inputs-wrapper').should('not.exist');
cy.contains('[type="submit"]', 'Done').click();
// After deleting the attribute and saving the changes, check that the attribute is missing.
cy.get('.cvat-constructor-viewer-item').find('[aria-label="edit"]').click();
cy.get('.cvat-attribute-inputs-wrapper').should('not.exist');
cy.contains('[type="button"]', 'Cancel').click();
});

it('Delete the added label. The label removed.', () => {
cy.get('.cvat-constructor-viewer-item').find('[aria-label="close"]').click();
cy.get('.cvat-constructor-viewer-item').should('not.exist');
});
});
});
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
// Copyright (C) 2021 Intel Corporation
//
// SPDX-License-Identifier: MIT

/// <reference types="cypress" />

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

context('Creating a label with existing label name.', () => {
const caseId = '43';
let firstLabelName = '';

before(() => {
cy.openTask(taskName);
});

describe(`Testing case "${caseId}"`, () => {
it('Try to create a label with existing name. Should not be successful.', () => {
// Get the name of the first existing label.
cy.get('.cvat-constructor-viewer-item')
.first()
.then((firstLabel) => {
firstLabelName = firstLabel.text();
// Try to create a label with existing label name
cy.get('.cvat-constructor-viewer-new-item').click();
cy.get('[placeholder="Label name"]').type(firstLabelName);
cy.contains('[type="submit"]', 'Done').click();
});
cy.get('.cvat-notification-notice-update-task-failed')
.should('exist')
.and('contain.text', 'label names must be unique');
});
});
});
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
// Copyright (C) 2021 Intel Corporation
//
// SPDX-License-Identifier: MIT

/// <reference types="cypress" />

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

context('Annotation filter help dialog window.', () => {
const issueId = '2690';

before(() => {
cy.openTaskJob(taskName);
});

describe(`Testing issue "${issueId}"`, () => {
it('Open annotation filters help dialog window. The window is visible.', () => {
cy.get('.cvat-annotations-filters-input').within(() => {
// class="ant-select-selection-placeholder" has CSS pointer-events: none
cy.get('.ant-select-selection-placeholder').invoke('css', 'pointer-events', 'auto'); // Replace CSS "pointer-events" to auto
cy.get('[aria-label="filter"]').click();
});
cy.get('.cvat-annotations-filters-help-modal-window').should('exist').and('be.visible');
});

it('Close annotation filters help dialog window. The window is closed.', () => {
cy.get('.cvat-annotations-filters-help-modal-window').within(() => {
cy.contains('button', 'OK').click();
});
cy.get('.cvat-annotations-filters-help-modal-window').should('not.exist');
});
});
});
6 changes: 3 additions & 3 deletions tests/cypress/support/commands.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Copyright (C) 2020 Intel Corporation
// Copyright (C) 2020-2021 Intel Corporation
//
// SPDX-License-Identifier: MIT

Expand Down Expand Up @@ -523,7 +523,7 @@ Cypress.Commands.add('getScaleValue', () => {
Cypress.Commands.add('writeFilterValue', (clear, filterValue) => {
if (clear) {
cy.get('.cvat-annotations-filters-input').within(() => {
cy.get('.ant-select-selection-item-remove').click();
cy.get('[aria-label="close-circle"]').click();
});
}
cy.get('.cvat-annotations-filters-input')
Expand All @@ -536,7 +536,7 @@ Cypress.Commands.add('writeFilterValue', (clear, filterValue) => {
Cypress.Commands.add('selectFilterValue', (clear, filterValue) => {
if (clear) {
cy.get('.cvat-annotations-filters-input').within(() => {
cy.get('.ant-select-selection-item-remove').click();
cy.get('[aria-label="close-circle"]').click();
});
}
cy.get('body').click();
Expand Down

0 comments on commit 2985fe9

Please sign in to comment.