Update tests for 3D. (#3331)

main
Dmitry Kruchinin 5 years ago committed by GitHub
parent 4db6cc9dd8
commit 85e57c11e4
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -32,6 +32,7 @@ context('Canvas 3D functionality. Grouping.', () => {
const yellowHex = 'fcbe03'; const yellowHex = 'fcbe03';
const yellowRgb = '252, 190, 3'; const yellowRgb = '252, 190, 3';
const shapeSidebarItemArray = ['#cvat-objects-sidebar-state-item-2', '#cvat-objects-sidebar-state-item-3']; const shapeSidebarItemArray = ['#cvat-objects-sidebar-state-item-2', '#cvat-objects-sidebar-state-item-3'];
let bgColorItem;
function changeGroupColor(object, color) { function changeGroupColor(object, color) {
cy.get(object).within(() => { cy.get(object).within(() => {
@ -67,6 +68,7 @@ context('Canvas 3D functionality. Grouping.', () => {
cy.get('#cvat-objects-sidebar-state-item-1').invoke('attr', 'style').then((bgColorItem1) => { cy.get('#cvat-objects-sidebar-state-item-1').invoke('attr', 'style').then((bgColorItem1) => {
cy.get('#cvat-objects-sidebar-state-item-4').invoke('attr', 'style').then((bgColorItem4) => { cy.get('#cvat-objects-sidebar-state-item-4').invoke('attr', 'style').then((bgColorItem4) => {
expect(bgColorItem1).to.be.equal(bgColorItem4); expect(bgColorItem1).to.be.equal(bgColorItem4);
bgColorItem = bgColorItem1;
}); });
cy.get('#cvat-objects-sidebar-state-item-2').invoke('attr', 'style').then((bgColorItem2) => { cy.get('#cvat-objects-sidebar-state-item-2').invoke('attr', 'style').then((bgColorItem2) => {
expect(bgColorItem1).not.be.equal(bgColorItem2); expect(bgColorItem1).not.be.equal(bgColorItem2);
@ -96,5 +98,24 @@ context('Canvas 3D functionality. Grouping.', () => {
`${screenshotsPath}/canvas3d_perspective_change_group_color.png`, `${screenshotsPath}/canvas3d_perspective_change_group_color.png`,
); );
}); });
it('Reset group.', () => {
cy.get('.cvat-canvas3d-perspective').screenshot('canvas3d_perspective_before_reset_group');
cy.get('.cvat-group-control').click();
cy.get('.cvat-canvas3d-perspective').trigger('mousemove', 450, 250).click(450, 250);
cy.get('.cvat-canvas3d-perspective').trigger('mousemove', 450, 350).click(450, 350);
cy.get('body').type('{Shift}g');
cy.get('#cvat-objects-sidebar-state-item-2').invoke('attr', 'style').then((bgColorItem2) => {
expect(bgColorItem).to.be.equal(bgColorItem2);
});
cy.get('#cvat-objects-sidebar-state-item-3').invoke('attr', 'style').then((bgColorItem3) => {
expect(bgColorItem).to.be.equal(bgColorItem3);
});
cy.get('.cvat-canvas3d-perspective').screenshot('canvas3d_perspective_after_reset_group');
cy.compareImagesAndCheckResult(
`${screenshotsPath}/canvas3d_perspective_before_reset_group.png`,
`${screenshotsPath}/canvas3d_perspective_after_reset_group.png`,
);
});
}); });
}); });

@ -36,5 +36,14 @@ context('Canvas 3D functionality. Cancel drawing.', () => {
`${screenshotsPath}/canvas3d_perspective_cancel_drawning.png`, `${screenshotsPath}/canvas3d_perspective_cancel_drawning.png`,
); );
}); });
it('Repeat draw.', () => {
cy.get('body').type('n');
cy.get('.cvat-canvas3d-perspective').trigger('mousemove');
cy.get('.cvat-canvas3d-perspective').trigger('mousemove', 450, 250).dblclick(450, 250);
cy.get('.cvat-objects-sidebar-state-item').then((sidebarStateItems) => {
expect(sidebarStateItems.length).to.be.equal(1);
});
});
}); });
}); });

Loading…
Cancel
Save