merge checkExistObject and checkNotExistObject functions

main
Dmitriy Oparin 5 years ago
parent 70b67ccdca
commit 127e1ca37b

@ -76,18 +76,13 @@ context('Delete unlock/lock object', () => {
function checkFailDeleteLockObject(shortcut) { function checkFailDeleteLockObject(shortcut) {
deleteObjectViaShortcut(shortcut, 'lock'); deleteObjectViaShortcut(shortcut, 'lock');
checkExistObject(); checkExistObject('exist');
cy.get('.ant-notification-topRight').should('exist'); cy.get('.ant-notification-topRight').should('exist');
}; };
function checkExistObject() { function checkExistObject(state) {
cy.get('.cvat_canvas_shape').should('exist'); cy.get('.cvat_canvas_shape').should(state);
cy.get('.cvat-objects-sidebar-state-item').should('exist'); cy.get('.cvat-objects-sidebar-state-item').should(state);
};
function checkNotExistObject() {
cy.get('.cvat_canvas_shape').should('not.exist');
cy.get('.cvat-objects-sidebar-state-item').should('not.exist');
}; };
before(() => { before(() => {
@ -98,13 +93,13 @@ context('Delete unlock/lock object', () => {
it('Create and delete object via "Delete" shortcut', () => { it('Create and delete object via "Delete" shortcut', () => {
cy.createRectangle(createRectangleShape2Points); cy.createRectangle(createRectangleShape2Points);
deleteObjectViaShortcut('{del}', 'unlock'); deleteObjectViaShortcut('{del}', 'unlock');
checkNotExistObject(); checkExistObject('not.exist');
}); });
it('Create and delete object via GUI from sidebar', () => { it('Create and delete object via GUI from sidebar', () => {
cy.createRectangle(createRectangleShape2Points); cy.createRectangle(createRectangleShape2Points);
deleteObjectViaGUIFromSidebar(); deleteObjectViaGUIFromSidebar();
checkNotExistObject(); checkExistObject('not.exist');
}); });
it('Create, lock and delete object via "Shift+Delete" shortcuts', () => { it('Create, lock and delete object via "Shift+Delete" shortcuts', () => {
@ -112,7 +107,7 @@ context('Delete unlock/lock object', () => {
lockObject(); lockObject();
checkFailDeleteLockObject('{del}'); checkFailDeleteLockObject('{del}');
deleteObjectViaShortcut('{shift}{del}', 'lock'); deleteObjectViaShortcut('{shift}{del}', 'lock');
checkNotExistObject(); checkExistObject('not.exist');
}); });
it('Create, lock and delete object via GUI from sidebar', () => { it('Create, lock and delete object via GUI from sidebar', () => {
@ -120,7 +115,7 @@ context('Delete unlock/lock object', () => {
lockObject(); lockObject();
deleteObjectViaGUIFromSidebar(); deleteObjectViaGUIFromSidebar();
actionOnConfirmWindow('OK'); actionOnConfirmWindow('OK');
checkNotExistObject(); checkExistObject('not.exist');
}); });
it('Create, lock and cancel delete object via GUI from object', () => { it('Create, lock and cancel delete object via GUI from object', () => {
@ -128,7 +123,7 @@ context('Delete unlock/lock object', () => {
lockObject(); lockObject();
deleteObjectViaGUIFromObject(); deleteObjectViaGUIFromObject();
actionOnConfirmWindow('Cancel'); actionOnConfirmWindow('Cancel');
checkExistObject(); checkExistObject('exist');
}); });
}); });
}); });

Loading…
Cancel
Save