Fixed merged tests

main
Boris Sekachev 5 years ago
parent b771780d68
commit bf21c29219

@ -8,7 +8,12 @@ import Button from 'antd/lib/button';
import Modal from 'antd/lib/modal'; import Modal from 'antd/lib/modal';
import Tooltip from 'antd/lib/tooltip'; import Tooltip from 'antd/lib/tooltip';
import Icon, { import Icon, {
LinkOutlined, CopyOutlined, BlockOutlined, GatewayOutlined, RetweetOutlined, DeleteOutlined, LinkOutlined,
CopyOutlined,
BlockOutlined,
GatewayOutlined,
RetweetOutlined,
DeleteOutlined,
} from '@ant-design/icons'; } from '@ant-design/icons';
import { import {
BackgroundIcon, ForegroundIcon, ResetPerspectiveIcon, ColorizeIcon, BackgroundIcon, ForegroundIcon, ResetPerspectiveIcon, ColorizeIcon,
@ -200,7 +205,7 @@ function RemoveItem(props: ItemProps): JSX.Element {
onClick={(): void => { onClick={(): void => {
if (locked) { if (locked) {
Modal.confirm({ Modal.confirm({
className: 'cvat-modal-confirm', className: 'cvat-modal-confirm',
title: 'Object is locked', title: 'Object is locked',
content: 'Are you sure you want to remove it?', content: 'Are you sure you want to remove it?',
onOk() { onOk() {

@ -23,66 +23,58 @@ context('Delete unlock/lock object', () => {
cy.get('.cvat-objects-sidebar-state-item').within(() => { cy.get('.cvat-objects-sidebar-state-item').within(() => {
cy.get('.cvat-object-item-button-lock').click(); cy.get('.cvat-object-item-button-lock').click();
}); });
}; }
function deleteObjectViaShortcut(shortcut, stateLockObject) { function deleteObjectViaShortcut(shortcut, stateLockObject) {
if (stateLockObject == 'unlock') { if (stateLockObject == 'unlock') {
cy.get('.cvat-canvas-container').within(() => { cy.get('.cvat-canvas-container').within(() => {
cy.get('.cvat_canvas_shape') cy.get('.cvat_canvas_shape').trigger('mousemove').should('have.class', 'cvat_canvas_shape_activated');
.trigger('mousemove')
.should('have.class', 'cvat_canvas_shape_activated');
}); });
}; }
cy.get('body') cy.get('body').type(shortcut);
.type(shortcut); }
};
function clickRemoveOnDropdownMenu() { function clickRemoveOnDropdownMenu() {
cy.get('.cvat-object-item-menu') cy.get('.cvat-object-item-menu').contains(new RegExp('^Remove$', 'g')).click({ force: true });
.contains(new RegExp('^Remove$', 'g')) }
.click({ force: true });
};
function deleteObjectViaGUIFromSidebar() { function deleteObjectViaGUIFromSidebar() {
cy.get('.cvat-objects-sidebar-states-list').within(() => { cy.get('.cvat-objects-sidebar-states-list').within(() => {
cy.get('.cvat-objects-sidebar-state-item').within(() => { cy.get('.cvat-objects-sidebar-state-item').within(() => {
cy.get('[aria-label="icon: more"]').click(); cy.get('span[aria-label="more"]').click();
}); });
}); });
clickRemoveOnDropdownMenu(); clickRemoveOnDropdownMenu();
}; }
function deleteObjectViaGUIFromObject() { function deleteObjectViaGUIFromObject() {
cy.get('.cvat-canvas-container').within(() => { cy.get('.cvat-canvas-container').within(() => {
cy.get('.cvat_canvas_shape') cy.get('.cvat_canvas_shape').trigger('mousemove').rightclick();
.trigger('mousemove')
.rightclick();
}); });
cy.get('.cvat-canvas-context-menu').within(() => { cy.get('.cvat-canvas-context-menu').within(() => {
cy.get('.cvat-objects-sidebar-state-item').within(() => { cy.get('.cvat-objects-sidebar-state-item').within(() => {
cy.get('[aria-label="icon: more"]').click(); cy.get('span[aria-label="more"]').click();
}); });
}); });
clickRemoveOnDropdownMenu(); clickRemoveOnDropdownMenu();
}; }
function actionOnConfirmWindow(textBuntton) { function actionOnConfirmWindow(textBuntton) {
cy.get('.cvat-modal-confirm').within(() => { cy.get('.cvat-modal-confirm').within(() => {
cy.contains(new RegExp(`^${textBuntton}$`, 'g')) cy.contains(new RegExp(`^${textBuntton}$`, 'g')).click();
.click();
}); });
}; }
function checkFailDeleteLockObject(shortcut) { function checkFailDeleteLockObject(shortcut) {
deleteObjectViaShortcut(shortcut, 'lock'); deleteObjectViaShortcut(shortcut, 'lock');
checkExistObject('exist'); checkExistObject('exist');
cy.get('.cvat-notification-notice-remove-object-failed').should('exist'); cy.get('.cvat-notification-notice-remove-object-failed').should('exist');
}; }
function checkExistObject(state) { function checkExistObject(state) {
cy.get('.cvat_canvas_shape').should(state); cy.get('.cvat_canvas_shape').should(state);
cy.get('.cvat-objects-sidebar-state-item').should(state); cy.get('.cvat-objects-sidebar-state-item').should(state);
}; }
before(() => { before(() => {
cy.openTaskJob(taskName); cy.openTaskJob(taskName);

Loading…
Cancel
Save