From c9de0b98798062bbeebfd5405fe10649e91df429 Mon Sep 17 00:00:00 2001 From: Kruchinin Date: Wed, 28 Oct 2020 15:09:41 +0300 Subject: [PATCH] Finish writing the test. --- .../case_13_merge_split_features.js | 86 +++++++++++++------ 1 file changed, 58 insertions(+), 28 deletions(-) diff --git a/tests/cypress/integration/actions_tasks_objects/case_13_merge_split_features.js b/tests/cypress/integration/actions_tasks_objects/case_13_merge_split_features.js index 21e64c1d..d67ec05b 100644 --- a/tests/cypress/integration/actions_tasks_objects/case_13_merge_split_features.js +++ b/tests/cypress/integration/actions_tasks_objects/case_13_merge_split_features.js @@ -26,8 +26,10 @@ context('Merge/split features', () => { secondX: createRectangleShape2Points.secondX + 300, secondY: createRectangleShape2Points.secondY, }; - let iconStarCss = ''; const frameNum = 0; + // Check the 'X' coordinate. 'Y' coordinate is the same. + let xCoordinatesObjectFirstFrame = 0; + let xCoordinatesObjectThirdFrame = 0; before(() => { cy.openTaskJob(taskName); @@ -43,11 +45,17 @@ context('Merge/split features', () => { it('Create rectangle shape on first frame', () => { checkFrameNumber(frameNum); cy.createRectangle(createRectangleShape2Points); + cy.get('#cvat_canvas_shape_1').should('have.attr', 'x').then(xCoords => { + xCoordinatesObjectFirstFrame = Math.floor(xCoords); + }); }); it('Create rectangle shape on third frame with another position', () => { cy.get('.cvat-player-next-button').click().click(); checkFrameNumber(frameNum + 2); cy.createRectangle(createRectangleShape2PointsSecond); + cy.get('#cvat_canvas_shape_2').should('have.attr', 'x').then(xCoords => { + xCoordinatesObjectThirdFrame = Math.floor(xCoords); + }); }); it('Merge the objects with "Merge button"', () => { cy.get('.cvat-merge-control').click(); @@ -59,44 +67,66 @@ context('Merge/split features', () => { }); it('Get a track with keyframes on first and third frame', () => { cy.get('#cvat_canvas_shape_3').should('exist').and('be.visible'); - cy.get('#cvat-objects-sidebar-state-item-3').should('contain', '3').and('contain', 'RECTANGLE TRACK'); - cy.get('#cvat-objects-sidebar-state-item-3').within(() => { - cy.get('.ant-row-flex').within(() => { - cy.get('.anticon-star').should('have.css', 'color').then($iconStarCss => { - iconStarCss = $iconStarCss; - expect(iconStarCss).to.be.eq('rgb(36, 36, 36)'); - }); - }); + cy.get('#cvat-objects-sidebar-state-item-3').should('contain', '3').and('contain', 'RECTANGLE TRACK').within(() => { + cy.get('.cvat-object-item-button-keyframe-enabled').should('exist'); }); cy.get('.cvat-player-next-button').click().click(); checkFrameNumber(frameNum + 2); cy.get('#cvat_canvas_shape_3').should('exist').and('be.visible'); - cy.get('#cvat-objects-sidebar-state-item-3').should('contain', '3').and('contain', 'RECTANGLE TRACK'); - cy.get('#cvat-objects-sidebar-state-item-3').within(() => { - cy.get('.ant-row-flex').within(() => { - cy.get('.anticon-star').should('have.css', 'color', iconStarCss); - }); + cy.get('#cvat-objects-sidebar-state-item-3').should('contain', '3').and('contain', 'RECTANGLE TRACK').within(() => { + cy.get('.cvat-object-item-button-keyframe-enabled').should('exist'); }); }); it('On the second frame and on the fourth frame the track is invisible', () => { cy.get('.cvat-player-previous-button').click(); - checkFrameNumber(frameNum + 1) + checkFrameNumber(frameNum + 1); cy.get('#cvat_canvas_shape_3').should('exist').and('be.hidden'); cy.get('.cvat-player-next-button').click().click(); - checkFrameNumber(frameNum + 3) + checkFrameNumber(frameNum + 3); cy.get('#cvat_canvas_shape_3').should('exist').and('be.hidden'); }); - // it('Go to the second frame and remove "outside" flag from the track. The track now visible.', () => { - // cy.get('.cvat-player-previous-button').click().click(); - // checkFrameNumber(frameNum + 1) - // cy.get('#cvat-objects-sidebar-state-item-3').within(() => { - // cy.get('.ant-row-flex').within(() => { - // cy.get('.anticon-star').should('have.css', 'color').then($iconStarCss => { - // iconStarCss = $iconStarCss - // expect(iconStarCss).to.be.eq('rgb(36, 36, 36)') - // }); - // }); - // }); - // }); + it('Go to the second frame and remove "outside" flag from the track. The track now visible.', () => { + cy.get('.cvat-player-previous-button').click().click(); + checkFrameNumber(frameNum + 1); + cy.get('#cvat-objects-sidebar-state-item-3').should('contain', '3').and('contain', 'RECTANGLE TRACK').within(() => { + cy.get('.cvat-object-item-button-outside').click(); + cy.get('.cvat-object-item-button-outside-enabled').should('not.exist'); + }); + cy.get('#cvat_canvas_shape_3').should('exist').and('be.visible'); + }); + it('Remove "keyframe" flag from the track. Track now interpolated between position on the first and the third frames.', () => { + cy.get('#cvat-objects-sidebar-state-item-3').should('contain', '3').and('contain', 'RECTANGLE TRACK').within(() => { + cy.get('.cvat-object-item-button-keyframe').click(); + cy.get('.cvat-object-item-button-keyframe-enabled').should('not.exist'); + }); + cy.get('#cvat_canvas_shape_3').should('have.attr', 'x').then(xCoords => { + // expected 9785 to be within 9642..9928 + expect(Math.floor(xCoords)).to.be.within(xCoordinatesObjectFirstFrame, xCoordinatesObjectThirdFrame); + }); + }); + it('On the fourth frame remove "keyframe" flag from the track. The track now visible and "outside" flag is disabled.', () => { + cy.get('.cvat-player-next-button').click().click(); + checkFrameNumber(frameNum + 3); + cy.get('#cvat-objects-sidebar-state-item-3').should('contain', '3').and('contain', 'RECTANGLE TRACK').within(() => { + cy.get('.cvat-object-item-button-keyframe').click(); + cy.get('.cvat-object-item-button-keyframe-enabled').should('not.exist'); + cy.get('.cvat-object-item-button-outside-enabled').should('not.exist'); + }); + cy.get('#cvat_canvas_shape_3').should('exist').and('be.visible'); + }); + it('Split a track with "split" button. Previous track became invisible (has "outside" flag). One more track and it is visible.', () => { + cy.get('.cvat-split-track-control').click(); + // A single click does not reproduce the split a track scenario in cypress test. + cy.get('#cvat_canvas_shape_3').click().click(); + cy.get('#cvat_canvas_shape_4').should('exist').and('be.hidden'); + cy.get('#cvat-objects-sidebar-state-item-4').should('contain', '4').and('contain', 'RECTANGLE TRACK').within(() => { + cy.get('.cvat-object-item-button-outside-enabled').should('exist'); + }); + cy.get('#cvat_canvas_shape_5').should('exist').and('be.visible'); + cy.get('#cvat-objects-sidebar-state-item-5').should('contain', '5').and('contain', 'RECTANGLE TRACK').within(() => { + cy.get('.cvat-object-item-button-outside-enabled').should('not.exist'); + cy.get('.cvat-object-item-button-keyframe-enabled').should('exist'); + }); + }); }); });