From 6f8a2539f9bae981dfe127402240c7eab7c48ca0 Mon Sep 17 00:00:00 2001 From: Kruchinin Date: Thu, 26 Nov 2020 17:25:58 +0300 Subject: [PATCH] Reducing the number of labels and objects created --- .../case_18_filters_functionality.js | 137 +++++------------- 1 file changed, 34 insertions(+), 103 deletions(-) diff --git a/tests/cypress/integration/actions_tasks_objects/case_18_filters_functionality.js b/tests/cypress/integration/actions_tasks_objects/case_18_filters_functionality.js index a07f89e4..5853dc12 100644 --- a/tests/cypress/integration/actions_tasks_objects/case_18_filters_functionality.js +++ b/tests/cypress/integration/actions_tasks_objects/case_18_filters_functionality.js @@ -8,44 +8,14 @@ import { taskName } from '../../support/const'; context('Filters functionality.', () => { const caseId = '18'; - const labelPolygonShape = 'polygon shape'; - const additionalAttrsLabelPolygonShape = [ + const labelShape = 'shape 3 points'; + const additionalAttrsLabelShape = [ { additionalAttrName: 'type', additionalValue: 'shape', typeAttribute: 'Text' }, { additionalAttrName: 'count points', additionalValue: '3', typeAttribute: 'Text' }, { additionalAttrName: 'polygon', additionalValue: 'True', typeAttribute: 'Checkbox' }, ]; - const labelRectangleTrack2Points = 'rectangle track by 2 points'; - const additionalAttrsLabelRectangleTrack2Points = [ - { additionalAttrName: 'type', additionalValue: 'track', typeAttribute: 'Text' }, - { additionalAttrName: 'rectangle', additionalValue: 'True', typeAttribute: 'Checkbox' }, - { additionalAttrName: 'count points', additionalValue: '2', typeAttribute: 'Text' }, - ]; - const labelCuboidShape4Points = 'cuboid shape by 4 points'; - const additionalAttrsLabelCuboidShape4Points = [ - { additionalAttrName: 'type', additionalValue: 'shape', typeAttribute: 'Text' }, - { additionalAttrName: 'cuboid', additionalValue: 'True', typeAttribute: 'Checkbox' }, - { additionalAttrName: 'count points', additionalValue: '4', typeAttribute: 'Text' }, - ]; - const labelPolylinesShape = 'polylines shape'; - const additionalAttrsLabelPolylinesShape = [ - { additionalAttrName: 'type', additionalValue: 'shape', typeAttribute: 'Text' }, - { additionalAttrName: 'polylines', additionalValue: 'True', typeAttribute: 'Checkbox' }, - { additionalAttrName: 'count points', additionalValue: '3', typeAttribute: 'Text' }, - ]; - const labelPointsShape = 'points shape'; - const additionalAttrsLabelPointsShape = [ - { additionalAttrName: 'type', additionalValue: 'shape', typeAttribute: 'Text' }, - { additionalAttrName: 'points', additionalValue: 'True', typeAttribute: 'Checkbox' }, - { additionalAttrName: 'count points', additionalValue: '1', typeAttribute: 'Text' }, - ]; - const labelRectangleShape4Points = 'rectangle shape by 4 points'; - const additionalAttrsLabelRectangleShape4Points = [ - { additionalAttrName: 'type', additionalValue: 'shape', typeAttribute: 'Text' }, - { additionalAttrName: 'rectangle', additionalValue: 'True', typeAttribute: 'Checkbox' }, - { additionalAttrName: 'count points', additionalValue: '4', typeAttribute: 'Text' }, - ]; - const labelPolygonTrack = 'polygon track'; - const additionalAttrsLabelPolygonTrack = [ + const labelTrack = 'track 4 points'; + const additionalAttrsLabelTrack = [ { additionalAttrName: 'type', additionalValue: 'track', typeAttribute: 'Text' }, { additionalAttrName: 'polygon', additionalValue: 'True', typeAttribute: 'Checkbox' }, { additionalAttrName: 'count points', additionalValue: '4', typeAttribute: 'Text' }, @@ -54,7 +24,7 @@ context('Filters functionality.', () => { const createPolygonShape = { reDraw: false, type: 'Shape', - labelName: labelPolygonShape, + labelName: labelShape, pointsMap: [ { x: 200, y: 200 }, { x: 250, y: 200 }, @@ -66,47 +36,16 @@ context('Filters functionality.', () => { const createRectangleTrack2Points = { points: 'By 2 Points', type: 'Track', - labelName: labelRectangleTrack2Points, + labelName: labelTrack, firstX: 260, firstY: 200, secondX: 360, secondY: 250, }; - const createCuboidShape4Points = { - points: 'By 4 Points', - type: 'Shape', - labelName: labelCuboidShape4Points, - firstX: 400, - firstY: 350, - secondX: 500, - secondY: 320, - thirdX: 500, - thirdY: 450, - fourthX: 400, - fourthY: 450, - }; - const createPolylinesShape = { - type: 'Shape', - labelName: labelPolylinesShape, - pointsMap: [ - { x: 600, y: 200 }, - { x: 650, y: 200 }, - { x: 650, y: 250 }, - ], - complete: true, - numberOfPoints: null, - }; - const createPointsShape = { - type: 'Shape', - labelName: labelPointsShape, - pointsMap: [{ x: 700, y: 200 }], - complete: true, - numberOfPoints: null, - }; const createRectangleShape4Points = { points: 'By 4 Points', type: 'Shape', - labelName: labelRectangleShape4Points, + labelName: labelShape, firstX: 550, firstY: 350, secondX: 650, @@ -119,7 +58,7 @@ context('Filters functionality.', () => { const createPolygonTrack = { reDraw: false, type: 'Track', - labelName: labelPolygonTrack, + labelName: labelTrack, pointsMap: [ { x: 700, y: 350 }, { x: 850, y: 350 }, @@ -145,13 +84,8 @@ context('Filters functionality.', () => { before(() => { cy.openTask(taskName); - cy.addNewLabel(labelPolygonShape, additionalAttrsLabelPolygonShape); - cy.addNewLabel(labelRectangleTrack2Points, additionalAttrsLabelRectangleTrack2Points); - cy.addNewLabel(labelCuboidShape4Points, additionalAttrsLabelCuboidShape4Points); - cy.addNewLabel(labelPolylinesShape, additionalAttrsLabelPolylinesShape); - cy.addNewLabel(labelPointsShape, additionalAttrsLabelPointsShape); - cy.addNewLabel(labelRectangleShape4Points, additionalAttrsLabelRectangleShape4Points); - cy.addNewLabel(labelPolygonTrack, additionalAttrsLabelPolygonTrack); + cy.addNewLabel(labelShape, additionalAttrsLabelShape); + cy.addNewLabel(labelTrack, additionalAttrsLabelTrack); cy.openJob(); }); @@ -159,9 +93,6 @@ context('Filters functionality.', () => { it('Draw several objects (different shapes, tracks, labels)', () => { cy.createPolygon(createPolygonShape); cy.createRectangle(createRectangleTrack2Points); - cy.createCuboid(createCuboidShape4Points); - cy.createPolyline(createPolylinesShape); - cy.createPoint(createPointsShape); cy.createRectangle(createRectangleShape4Points); cy.createPolygon(createPolygonTrack); cy.get('.cvat_canvas_shape').then(($cvatCanvasShapeList) => { @@ -171,42 +102,42 @@ context('Filters functionality.', () => { }); }); - it('Filter: shape=="cuboid". Only the cuboid exist.', () => { - cy.writeFilterValue(false, 'shape=="cuboid"'); // #cvat_canvas_shape_3, #cvat-objects-sidebar-state-item-3 - checkingFilterApplication([3]); + it('Filter: shape=="polygon". Only the polygon exist.', () => { + cy.writeFilterValue(false, 'shape=="polygon"'); // #cvat_canvas_shape_1,4, #cvat-objects-sidebar-state-item-1,4 + checkingFilterApplication([1, 4]); }); - it('Filter: shape=="polygon" | shape=="cuboid". Only the cuboid and polygon exist.', () => { - cy.writeFilterValue(true, 'shape=="polygon" | shape=="cuboid"'); // #cvat_canvas_shape_1,3,7, #cvat-objects-sidebar-state-item-1,3,7 - checkingFilterApplication([1, 3, 7]); + it('Filter: shape=="polygon" | shape=="rectangle". Only the rectangle and polygon exist.', () => { + cy.writeFilterValue(true, 'shape=="polygon" | shape=="rectangle"'); // #cvat_canvas_shape_1,2,3,4, #cvat-objects-sidebar-state-item-1,2,3,4 + checkingFilterApplication([1, 2, 3, 4]); }); it('Filter: type=="shape". Only the objects with shape type exist.', () => { - cy.writeFilterValue(true, 'type=="shape"'); // #cvat_canvas_shape_1,3-6, #cvat-objects-sidebar-state-item-1,3-6 - checkingFilterApplication([1, 3, 4, 5, 6]); + cy.writeFilterValue(true, 'type=="shape"'); // #cvat_canvas_shape_1,3, #cvat-objects-sidebar-state-item-1,3 + checkingFilterApplication([1, 3]); }); - it('Filter: label=="polygon shape". Only the polygon exist.', () => { - cy.writeFilterValue(true, `label=="${labelPolygonShape}"`); // #cvat_canvas_shape_1, #cvat-objects-sidebar-state-item-1 - checkingFilterApplication([1]); + it('Filter: label=="track 4 points". Only the polygon exist.', () => { + cy.writeFilterValue(true, `label=="${labelTrack}"`); // #cvat_canvas_shape_2,4, #cvat-objects-sidebar-state-item-2,4 + checkingFilterApplication([2, 4]); }); it('Filter: attr["count points"] == "4". Only the objects with same attr exist.', () => { - cy.writeFilterValue(true, 'attr["count points"] == "4"'); // #cvat_canvas_shape_3,6,7, #cvat-objects-sidebar-state-item-3,6,7 - checkingFilterApplication([3, 6, 7]); + cy.writeFilterValue(true, 'attr["count points"] == "4"'); // #cvat_canvas_shape_2,4, #cvat-objects-sidebar-state-item-2,4 + checkingFilterApplication([2, 4]); }); - it('Filter: width >= height. All objects except polyline exist.', () => { - cy.writeFilterValue(true, 'width >= height'); // #cvat_canvas_shape_1-3,5-7, #cvat-objects-sidebar-state-item-1-3,5-7 - checkingFilterApplication([1, 2, 3, 5, 6, 7]); + it('Filter: width >= height. All objects exist.', () => { + cy.writeFilterValue(true, 'width >= height'); // #cvat_canvas_shape_1,2,3,4, #cvat-objects-sidebar-state-item-1,2,3,4 + checkingFilterApplication([1, 2, 3, 4]); }); - it('Filter: clientID == 7. Only the objects with same id exist (polygon track).', () => { - cy.writeFilterValue(true, 'clientID == 7'); // #cvat_canvas_shape_7, #cvat-objects-sidebar-state-item-7 - checkingFilterApplication([7]); + it('Filter: clientID == 4. Only the objects with same id exist (polygon track).', () => { + cy.writeFilterValue(true, 'clientID == 4'); // #cvat_canvas_shape_7, #cvat-objects-sidebar-state-item-4 + checkingFilterApplication([4]); }); - it('Filter: (label=="polylines shape" & attr["polylines"]==true) | (label=="rectangle shape by 4 points" & width > 50). Only the objects polyline and rectangle exist.', () => { + it('Filter: (label=="shape 3 points" & attr["polylines"]==true) | (label=="track 4 points" & width > 60). Only the objects polygon and rectangle exist.', () => { cy.writeFilterValue( true, - '(label=="polylines shape" & attr["polylines"]==true) | (label=="rectangle shape by 4 points" & width > 50)', - ); // #cvat_canvas_shape_4,6, #cvat-objects-sidebar-state-item-4,6 - checkingFilterApplication([4, 6]); + '(label=="shape 3 points" & attr["polylines"]==true) | (label=="track 4 points" & width > 60)', + ); // #cvat_canvas_shape_2,4, #cvat-objects-sidebar-state-item-2,4 + checkingFilterApplication([2, 4]); }); - it('Filter: (( label==["points shape"]) | (attr["type"]=="shape" & width > 50)) & (height > 50 & (clientID == serverID))). All objects not exist.', () => { + it('Filter: (( label==["shape 3 points"]) | (attr["type"]=="shape" & width > 50)) & (height > 50 & (clientID == serverID))). All objects not exist.', () => { cy.writeFilterValue( true, '(( label==["points shape"]) | (attr["type"]=="shape" & width > 50)) & (height > 50 & (clientID == serverID)))',