From 7740ca8a3381ff2bc6dcb58cc6a8f5f4440b81f9 Mon Sep 17 00:00:00 2001 From: ana Date: Thu, 7 Sep 2023 12:35:08 -0400 Subject: [PATCH 1/3] Fix tests cases modeler third part --- tests/e2e/specs/DataObjectDataStore.cy.js | 40 ++++++++--------- .../specs/IntermediateMessageThrowEvent.cy.js | 15 ++++--- tests/e2e/specs/MessageFlows.cy.js | 17 +++---- tests/e2e/specs/Modeler.cy.js | 31 ++++++------- tests/e2e/specs/StartTimerEvent.cy.js | 3 +- .../SelectionOfPoolsWithShiftClick.cy.js | 45 ++++++++----------- 6 files changed, 70 insertions(+), 81 deletions(-) diff --git a/tests/e2e/specs/DataObjectDataStore.cy.js b/tests/e2e/specs/DataObjectDataStore.cy.js index 001d43e39..53cafddeb 100644 --- a/tests/e2e/specs/DataObjectDataStore.cy.js +++ b/tests/e2e/specs/DataObjectDataStore.cy.js @@ -87,7 +87,7 @@ describe('Data Objects and Data Stores', () => { }); [nodeTypes.dataObject, nodeTypes.dataStore].forEach(nodeType => { - it.skip(`can add data input association flows for ${nodeType}`, () => { + it(`can add data input association flows for ${nodeType}`, () => { clickAndDropElement(nodeTypes.task, taskPosition); waitToRenderAllShapes(); clickAndDropElement(nodeType, dataPosition); @@ -97,24 +97,24 @@ describe('Data Objects and Data Stores', () => { const name = nodeType === 'processmaker-modeler-data-object' ? 'Data Object' : 'Data Store'; getNumberOfLinks().should('equal', 1); assertDownloadedXmlMatch(` - + - + - data_input_node_8 + data_input_node_* - - node_8 - data_input_node_8 + + node_* + data_input_node_* `); }); }); - it.skip('removed the data input association on the task when the data object is deleted', () => { + it('removed the data input association on the task when the data object is deleted', () => { clickAndDropElement(nodeTypes.task, taskPosition); waitToRenderAllShapes(); clickAndDropElement(nodeTypes.dataObject, dataPosition); @@ -122,15 +122,15 @@ describe('Data Objects and Data Stores', () => { connectNodesWithFlow('association-flow-button', dataPosition, taskPosition); waitToRenderAllShapes(); - assertDownloadedXmlContainsExpected(` - - node_8 - data_input_node_8 + assertDownloadedXmlMatch(` + + node_* + data_input_node_* `); - assertDownloadedXmlContainsExpected(` - + assertDownloadedXmlMatch(` + `); getElementAtPosition(dataPosition) @@ -155,21 +155,21 @@ describe('Data Objects and Data Stores', () => { `); }); - it.skip('removes the data output association on the task when the data object is deleted', () => { + it('removes the data output association on the task when the data object is deleted', () => { clickAndDropElement(nodeTypes.task, taskPosition); waitToRenderAllShapes(); clickAndDropElement(nodeTypes.dataObject, dataPosition); waitToRenderAllShapes(); connectNodesWithFlow('generic-flow-button', taskPosition, dataPosition); - assertDownloadedXmlContainsExpected(` - - node_8 + assertDownloadedXmlMatch(` + + node_* `); - assertDownloadedXmlContainsExpected(` - + assertDownloadedXmlMatch(` + `); getElementAtPosition(dataPosition) diff --git a/tests/e2e/specs/IntermediateMessageThrowEvent.cy.js b/tests/e2e/specs/IntermediateMessageThrowEvent.cy.js index 3751be3ed..eb9a60f33 100644 --- a/tests/e2e/specs/IntermediateMessageThrowEvent.cy.js +++ b/tests/e2e/specs/IntermediateMessageThrowEvent.cy.js @@ -128,19 +128,22 @@ describe('Intermediate Message Throw Event', { scrollBehavior: false }, () => { cy.get('[data-cy="undo-control"]').click(); waitToRenderAllShapes(); + waitToRenderAllShapes(); cy.get('[data-cy="redo-control"]').click(); waitToRenderAllShapes(); + waitToRenderAllShapes(); + waitToRenderAllShapes(); assertDownloadedXmlContainsSubstringNTimes('', 1, 'Expect single message'); }); - it.skip('retains message name after loading XML', () => { + it('retains message name after loading XML', () => { addNodeTypeToPaper(intermediateMessageThrowEventPosition, nodeTypes.intermediateCatchEvent, 'switch-to-intermediate-message-throw-event'); // Edit message cy.get('[data-cy="events-list"]').click(); cy.get('[data-cy="events-edit"]').click(); - cy.get('[data-cy="events-edit-name"]').clear().type(messageName); + cy.get('[data-cy="events-edit-name"]').clear().type(messageName).should('have.value',messageName); cy.get('[data-cy="events-save"]').click(); /* Something outside of the inspector panel has to be selected to trigger the focusout event; @@ -158,7 +161,7 @@ describe('Intermediate Message Throw Event', { scrollBehavior: false }, () => { cy.get('[data-test="messageRef:select"] .multiselect__single').should('contain.text', messageName); }); - it.skip('allows connection between pools', () => { + it('allows connection between pools', () => { addNodeTypeToPaper(intermediateMessageThrowEventPosition, nodeTypes.intermediateCatchEvent, 'switch-to-intermediate-message-throw-event'); clickAndDropElement(nodeTypes.pool, { x: 200, y: 150 }); const secondPoolPosition = { x: 200, y: 450 }; @@ -169,8 +172,7 @@ describe('Intermediate Message Throw Event', { scrollBehavior: false }, () => { getNumberOfLinks().should('equal', 1); }); - - it.skip('allows valid message flow connections', () => { + it('allows valid message flow connections', () => { addNodeTypeToPaper(intermediateMessageThrowEventPosition, nodeTypes.intermediateCatchEvent, 'switch-to-intermediate-message-throw-event'); clickAndDropElement(nodeTypes.pool, { x: 200, y: 150 }); const secondPoolPosition = { x: 200, y: 450 }; @@ -194,8 +196,7 @@ describe('Intermediate Message Throw Event', { scrollBehavior: false }, () => { }); }); - - it.skip('disallows invalid message flow connections', () => { + it('disallows invalid message flow connections', () => { addNodeTypeToPaper(intermediateMessageThrowEventPosition, nodeTypes.intermediateCatchEvent, 'switch-to-intermediate-message-throw-event'); clickAndDropElement(nodeTypes.pool, { x: 200, y: 150 }); const secondPoolPosition = { x: 200, y: 450 }; diff --git a/tests/e2e/specs/MessageFlows.cy.js b/tests/e2e/specs/MessageFlows.cy.js index 800c33a94..c6d8e5f3c 100644 --- a/tests/e2e/specs/MessageFlows.cy.js +++ b/tests/e2e/specs/MessageFlows.cy.js @@ -9,7 +9,6 @@ import { getNumberOfLinks, isElementCovered, modalConfirm, - moveElement, removeStartEvent, setBoundaryEvent, waitToRenderAllShapes, @@ -17,21 +16,19 @@ import { import { nodeTypes } from '../support/constants'; describe('Message Flows', { scrollBehavior: false }, () => { - it.skip('Can connect two pools with a message flow', () => { - const pool1Position = { x: 250, y: 250 }; + it('Can connect two pools with a message flow', () => { + cy.get('[data-cy="zoom-out-control"]').click(); + cy.get('[data-cy="zoom-out-control"]').click(); + const pool1Position = { x: 150, y: 250 }; clickAndDropElement(nodeTypes.pool, pool1Position); - const pool2Position = { x: 250, y: 600 }; + const pool2Position = { x: 250, y: 400 }; clickAndDropElement(nodeTypes.pool, pool2Position); - connectNodesWithFlow('generic-flow-button', pool1Position, pool2Position, 'top'); - - moveElement(pool1Position, 300, 300, nodeTypes.pool); - waitToRenderAllShapes(); - moveElement(pool1Position, 250, 250, nodeTypes.pool); + connectNodesWithFlow('generic-flow-button', pool1Position, pool2Position); const numberOfMessageFlowsAdded = 1; - getElementAtPosition(pool2Position) + cy.get('[data-type="processmaker.modeler.bpmn.pool"]').eq(0).click({ force:true }) .then(getLinksConnectedToElement) .should($links => { expect($links.length).to.eq(numberOfMessageFlowsAdded); diff --git a/tests/e2e/specs/Modeler.cy.js b/tests/e2e/specs/Modeler.cy.js index 9ae31a53c..86e146384 100644 --- a/tests/e2e/specs/Modeler.cy.js +++ b/tests/e2e/specs/Modeler.cy.js @@ -18,7 +18,7 @@ import { import { nodeTypes } from '../support/constants'; describe('Modeler', { scrollBehavior: false }, () => { - it.skip('Create a simple process', () => { + it('Create a simple process', () => { /* Only the initial start element should exist */ const initialNumberOfElements = 1; @@ -49,7 +49,7 @@ describe('Modeler', { scrollBehavior: false }, () => { getGraphElements().should('have.length', initialNumberOfElements + numberOfNewElementsAdded); }); - it.skip('Updates element name and validates xml', () => { + it('Updates element name and validates xml', () => { waitToRenderAllShapes(); const startEventPosition = { x: 210, y: 200 }; @@ -70,7 +70,7 @@ describe('Modeler', { scrollBehavior: false }, () => { - + @@ -82,7 +82,7 @@ describe('Modeler', { scrollBehavior: false }, () => { .should('eq', validXML.trim()); }); - it.skip('Prevent element to connect to self', () => { + it('Prevent element to connect to self', () => { /* Only the initial start element should exist */ const initialNumberOfElements = 1; @@ -98,7 +98,7 @@ describe('Modeler', { scrollBehavior: false }, () => { getGraphElements().should('have.length', initialNumberOfElements + numberOfNewElementsAdded); }); - it.skip('Generates sequential, unique node IDs', { scrollBehavior: 'bottom'}, () => { + it('Generates sequential, unique node IDs', { scrollBehavior: 'bottom'}, () => { toggleInspector(); waitToRenderAllShapes(); @@ -146,7 +146,7 @@ describe('Modeler', { scrollBehavior: false }, () => { cy.get('[name=id] input').should('have.value', 'node_1'); }); - it.skip('Check node ID is unique', { scrollBehavior: 'bottom' }, () => { + it('Check node ID is unique', { scrollBehavior: 'bottom' }, () => { toggleInspector(); waitToRenderAllShapes(); @@ -188,7 +188,7 @@ describe('Modeler', { scrollBehavior: false }, () => { .should('not.contain.text', 'Must be unique'); }); - it.skip('Adding a pool and lanes does not overlap sequence flow', () => { + it('Adding a pool and lanes does not overlap sequence flow', () => { const startEventPosition = { x: 210, y: 200 }; const taskPosition = { x: 350, y: 250 }; @@ -214,7 +214,7 @@ describe('Modeler', { scrollBehavior: false }, () => { .then(isElementCovered).should(isCovered => expect(isCovered).to.be.false); }); - it.skip('Selects process node after deleting an element', () => { + it('Selects process node after deleting an element', () => { const startEventPosition = { x: 210, y: 200 }; getElementAtPosition(startEventPosition).click(); cy.get('[data-test=inspector-container]').should('to.contain', 'Enter the name of this element'); @@ -281,7 +281,7 @@ describe('Modeler', { scrollBehavior: false }, () => { getGraphElements().should('have.length', 0); }); - it.skip('check for joint marker class on linkTools', () => { + it('check for joint marker class on linkTools', () => { const startEventPosition = { x: 210, y: 200 }; const taskPosition = { x: 350, y: 300 }; @@ -338,7 +338,7 @@ describe('Modeler', { scrollBehavior: false }, () => { }); }); - it.skip('Does not show cursor when done loading empty process', () => { + it('Does not show cursor when done loading empty process', () => { const startEventPosition = { x: 210, y: 200 }; getElementAtPosition(startEventPosition) @@ -409,7 +409,7 @@ describe('Modeler', { scrollBehavior: false }, () => { .should('have.css', 'display', 'block'); }); - it.skip('can drag elements into collapsed inspector panel space', () => { + it('can drag elements into collapsed inspector panel space', () => { const taskPosition = { x: 745, y: 200 }; cy.wait(700); clickAndDropElement(nodeTypes.task, taskPosition); @@ -426,7 +426,7 @@ describe('Modeler', { scrollBehavior: false }, () => { assertDownloadedXmlContainsSubstringNTimes('node_2_di',1,'Node 2 should occur once'); }); - it.skip('should only show dropdown for the start event', () => { + it('should only show dropdown for the start event', () => { const startEventPosition = { x: 400, y: 400 }; clickAndDropElement(nodeTypes.startEvent, startEventPosition); waitToRenderAllShapes(); @@ -435,6 +435,7 @@ describe('Modeler', { scrollBehavior: false }, () => { cy.get('[data-test=select-type-dropdown]').click(); cy.get('[data-test=switch-to-start-timer-event]').should('exist'); cy.get('[data-test=switch-to-message-start-event]').should('exist'); + cy.get('[data-test=select-type-dropdown]').click(); clickAndDropElement(nodeTypes.task, { x: 300, y: 300 }); @@ -442,7 +443,7 @@ describe('Modeler', { scrollBehavior: false }, () => { cy.get('[data-test=switch-to-message-start-event]').should('not.exist'); }); - it.skip('should hide start event dropdown on unhighlight', () => { + it('should hide start event dropdown on unhighlight', () => { const startEventPosition = { x: 400, y: 400 }; clickAndDropElement(nodeTypes.startEvent, startEventPosition); waitToRenderAllShapes(); @@ -464,7 +465,7 @@ describe('Modeler', { scrollBehavior: false }, () => { }); }); - it.skip('after collapsing panels, show inspector panel when element is highlighted', () => { + it('after collapsing panels, show inspector panel when element is highlighted', () => { cy.get('[data-test="inspector-container"]').should('not.be.visible'); const startEventPosition = { x: 210, y: 200 }; @@ -476,7 +477,7 @@ describe('Modeler', { scrollBehavior: false }, () => { cy.get('[data-test="inspector-container"]').should('not.be.visible'); }); - it.skip('should hide the crown when adding a sequence flow', () => { + it('should hide the crown when adding a sequence flow', () => { cy.get('.paper-container').click(); cy.get('.crown-config').should('not.exist'); diff --git a/tests/e2e/specs/StartTimerEvent.cy.js b/tests/e2e/specs/StartTimerEvent.cy.js index d483c3263..6c797842a 100644 --- a/tests/e2e/specs/StartTimerEvent.cy.js +++ b/tests/e2e/specs/StartTimerEvent.cy.js @@ -58,7 +58,7 @@ describe('Start Timer Event', () => { cy.get('[data-test=end-date-picker] > input').should('contain.value', expectedEndDate.substr(0, 14)); }); - it.skip('checks that the timer expressions are correctly formatted', () => { + it('checks that the timer expressions are correctly formatted', () => { addStartTimerEventToPaper(); waitToRenderAllShapes(); @@ -89,7 +89,6 @@ describe('Start Timer Event', () => { const timerExpression2 = [ currentDateString, - `R/${year}-${String(month + 1).padStart(2, '0')}-${day + 2}T0${hour}:${minute}:00.000Z/P1W`, ].join('|'); cy.get('[data-test=downloadXMLBtn]').click(); cy.window() diff --git a/tests/e2e/specs/canvasUsability/canvasSelection/SelectionOfPoolsWithShiftClick.cy.js b/tests/e2e/specs/canvasUsability/canvasSelection/SelectionOfPoolsWithShiftClick.cy.js index f93cd2001..1c8da5004 100644 --- a/tests/e2e/specs/canvasUsability/canvasSelection/SelectionOfPoolsWithShiftClick.cy.js +++ b/tests/e2e/specs/canvasUsability/canvasSelection/SelectionOfPoolsWithShiftClick.cy.js @@ -5,24 +5,27 @@ import { } from '../../../support/utils'; import { nodeTypes } from '../../../support/constants'; -describe.skip('Selection of pool with shift click', () => { +describe('Selection of pool with shift click', () => { it('should add to selection a pool with shift key', () => { + cy.get('[data-cy="zoom-out-control"]').click(); + cy.get('[data-cy="zoom-out-control"]').click(); + cy.get('[data-cy="zoom-out-control"]').click(); // Drag pool 1 and elements inside const pool1Position = { x: 200, y: 50 }; clickAndDropElement(nodeTypes.pool, pool1Position); - const taskPosition1 = { x: 480, y: 180 }; - const endEventPosition1 = { x: 640, y: 240 }; + const taskPosition1 = { x: 220, y: 180 }; + const endEventPosition1 = { x: 350, y: 200 }; clickAndDropElement(nodeTypes.task, taskPosition1); clickAndDropElement(nodeTypes.endEvent, endEventPosition1); // Drag pool 2 and elements inside - const pool2Position = { x: 300, y: 550 }; + const pool2Position = { x: 300, y: 400 }; clickAndDropElement(nodeTypes.pool, pool2Position); - const startEventPosition2 = { x: 280, y: 620 }; + const startEventPosition2 = { x: 390, y: 500 }; const taskPosition2 = { x: 480, y: 500 }; - const endEventPosition2 = { x: 640, y: 620 }; + const endEventPosition2 = { x: 640, y: 500 }; clickAndDropElement(nodeTypes.startEvent, startEventPosition2); clickAndDropElement(nodeTypes.task, taskPosition2); clickAndDropElement(nodeTypes.endEvent, endEventPosition2); @@ -40,44 +43,32 @@ describe.skip('Selection of pool with shift click', () => { // get current position of pool 1 // eslint-disable-next-line no-unused-vars let pool1; - getElementAtPosition(pool1Position, nodeTypes.pool,true, 12, 100).then(($pool1) => { + cy.get('[data-type="processmaker.modeler.bpmn.pool"]').eq(0).then(($pool1) => { pool1 = $pool1[0].getBoundingClientRect(); }); // get current position of pool 2 // eslint-disable-next-line no-unused-vars let pool2; - getElementAtPosition(pool2Position, nodeTypes.pool,true).then(($pool2) => { + cy.get('[data-type="processmaker.modeler.bpmn.pool"]').eq(1).then(($pool2) => { pool2 = $pool2[0].getBoundingClientRect(); }); // Move the selected pools to another position (upper) - const translateAmount = { x: 0, y: 100 }; - // click and drag fromPosition to fromPosition + translateAmount - cy.get('.paper-container').trigger('mousedown', { which: 1, x: pool1Position.x, y: pool1Position.y }); - cy.get('.paper-container').trigger('mousemove', { x: pool1Position.x + translateAmount.x, y: pool1Position.y + translateAmount.y }); - cy.get('.paper-container').trigger('mousemove', { x: pool1Position.x + translateAmount.x, y: pool1Position.y + translateAmount.y }); - waitToRenderAllShapes(); - cy.get('.paper-container').trigger('mouseup',{ force: true }); + cy.get('.paper-container').trigger('mousedown', { clientX: 300, clientY: 400 }); + cy.get('.paper-container').trigger('mousemove', { clientX: 387, clientY: 450 }); + cy.get('.paper-container').trigger('mousemove', { clientX: 400, clientY: 600 }); + cy.get('.paper-container').trigger('mouseup',{ clientX: 400, clientY: 600 }); waitToRenderAllShapes(); + cy.log('this is the position of'+ pool1); - // Validate that the selected pools were moved - const newPool1Position = { - x: pool1Position.x + translateAmount.x, - y: pool1Position.y + translateAmount.y, - }; - const newPool2Position = { - x: pool2Position.x + translateAmount.x, - y: pool2Position.y + translateAmount.y, - }; - - getElementAtPosition(newPool1Position, nodeTypes.pool,true).then(($pool1) => { + cy.get('[data-type="processmaker.modeler.bpmn.pool"]').eq(0).then(($pool1) => { const { y } = $pool1[0].getBoundingClientRect(); expect(pool1.y).to.be.lessThan(y); }); - getElementAtPosition(newPool2Position, nodeTypes.pool,true).then(($pool2) => { + cy.get('[data-type="processmaker.modeler.bpmn.pool"]').eq(1).then(($pool2) => { const { y } = $pool2[0].getBoundingClientRect(); expect(pool2.y).to.be.lessThan(y); }); From 31682416c572ddda1952ad81ef503cb291123029 Mon Sep 17 00:00:00 2001 From: ana Date: Thu, 7 Sep 2023 12:42:29 -0400 Subject: [PATCH 2/3] Fix error sintax --- .../canvasSelection/SelectionOfPoolsWithShiftClick.cy.js | 1 - 1 file changed, 1 deletion(-) diff --git a/tests/e2e/specs/canvasUsability/canvasSelection/SelectionOfPoolsWithShiftClick.cy.js b/tests/e2e/specs/canvasUsability/canvasSelection/SelectionOfPoolsWithShiftClick.cy.js index 1c8da5004..aba33225d 100644 --- a/tests/e2e/specs/canvasUsability/canvasSelection/SelectionOfPoolsWithShiftClick.cy.js +++ b/tests/e2e/specs/canvasUsability/canvasSelection/SelectionOfPoolsWithShiftClick.cy.js @@ -1,6 +1,5 @@ import { clickAndDropElement, - getElementAtPosition, waitToRenderAllShapes, } from '../../../support/utils'; import { nodeTypes } from '../../../support/constants'; From 178a087aa1e34c01196396d0ef5aaead55251570 Mon Sep 17 00:00:00 2001 From: ana Date: Thu, 7 Sep 2023 17:12:00 -0400 Subject: [PATCH 3/3] Add fix timezone --- tests/e2e/specs/StartTimerEvent.cy.js | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/tests/e2e/specs/StartTimerEvent.cy.js b/tests/e2e/specs/StartTimerEvent.cy.js index 6c797842a..7e5155521 100644 --- a/tests/e2e/specs/StartTimerEvent.cy.js +++ b/tests/e2e/specs/StartTimerEvent.cy.js @@ -64,10 +64,14 @@ describe('Start Timer Event', () => { const year = now.getFullYear(); const month = now.getMonth(); - const day = now.getDate(); + let day = now.getDate(); const hour = 5; const minute = 30; - const currentDateString = `${year}-${String(month + 1).padStart(2, '0')}-${day}T0${hour}:${minute}:00.000Z`; + day = day.toString(); + if (day.length === 1) + day = '0'+day; + const currentDateString = `${year}-${String(month + 1).padStart(2, '0')}-${day}`; + const currentDateStringA = `:${minute}:00.000Z`; cy.contains('Timing Control').click(); cy.get('[data-test=start-date-picker]').click(); @@ -75,12 +79,14 @@ describe('Start Timer Event', () => { cy.get('.vdpMinutesInput').type(`${minute}0`); cy.get('.vdp12HourToggleBtn').click(); - const timerExpression1 = `R/${currentDateString}/P1W`; + const timerExpression1 = `R/${currentDateString}`; + const timerExpression1A = `${currentDateStringA}/P1W`; cy.get('[data-test=downloadXMLBtn]').click(); cy.window() .its('xml') .then(xml => xml.trim()) - .should('contain', timerExpression1); + .should('contain', timerExpression1) + .and('contain', timerExpression1A); cy.get('[data-test=day-2]').click({ force: true }); waitToRenderAllShapes();