Skip to content

Commit

Permalink
Merge pull request #1663 from ProcessMaker/fixTest/FOUR-10188
Browse files Browse the repository at this point in the history
Fix test cases e2e Modeler (Third Part)
  • Loading branch information
ryancooley authored Sep 9, 2023
2 parents 87bc8c6 + 178a087 commit 548c6f4
Show file tree
Hide file tree
Showing 6 changed files with 80 additions and 86 deletions.
40 changes: 20 additions & 20 deletions tests/e2e/specs/DataObjectDataStore.cy.js
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand All @@ -97,40 +97,40 @@ describe('Data Objects and Data Stores', () => {
const name = nodeType === 'processmaker-modeler-data-object' ? 'Data Object' : 'Data Store';
getNumberOfLinks().should('equal', 1);
assertDownloadedXmlMatch(`
<bpmn:task id="node_2" name="Form Task" pm:assignment="requester">
<bpmn:task id="node_*" name="Form Task" pm:assignment="requester">
<bpmn:ioSpecification id="*">
<bpmn:dataInput id="data_input_node_8" name="${name}" isCollection="false" />
<bpmn:dataInput id="data_input_node_*" name="${name}" isCollection="false" />
<bpmn:inputSet id="*">
<bpmn:dataInputRefs>data_input_node_8</bpmn:dataInputRefs>
<bpmn:dataInputRefs>data_input_node_*</bpmn:dataInputRefs>
</bpmn:inputSet>
<bpmn:outputSet id="*" />
</bpmn:ioSpecification>
<bpmn:dataInputAssociation id="node_9">
<bpmn:sourceRef>node_8</bpmn:sourceRef>
<bpmn:targetRef>data_input_node_8</bpmn:targetRef>
<bpmn:dataInputAssociation id="node_*">
<bpmn:sourceRef>node_*</bpmn:sourceRef>
<bpmn:targetRef>data_input_node_*</bpmn:targetRef>
</bpmn:dataInputAssociation>
</bpmn:task>
`);
});
});

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);
waitToRenderAllShapes();
connectNodesWithFlow('association-flow-button', dataPosition, taskPosition);
waitToRenderAllShapes();

assertDownloadedXmlContainsExpected(`
<bpmn:dataInputAssociation id="node_9">
<bpmn:sourceRef>node_8</bpmn:sourceRef>
<bpmn:targetRef>data_input_node_8</bpmn:targetRef>
assertDownloadedXmlMatch(`
<bpmn:dataInputAssociation id="node_*">
<bpmn:sourceRef>node_*</bpmn:sourceRef>
<bpmn:targetRef>data_input_node_*</bpmn:targetRef>
</bpmn:dataInputAssociation>
`);

assertDownloadedXmlContainsExpected(`
<bpmn:dataObjectReference id="node_8" name="Data Object" />
assertDownloadedXmlMatch(`
<bpmn:dataObjectReference id="node_*" name="Data Object" />
`);

getElementAtPosition(dataPosition)
Expand All @@ -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(`
<bpmn:dataOutputAssociation id="node_16">
<bpmn:targetRef>node_8</bpmn:targetRef>
assertDownloadedXmlMatch(`
<bpmn:dataOutputAssociation id="node_*">
<bpmn:targetRef>node_*</bpmn:targetRef>
</bpmn:dataOutputAssociation>
`);

assertDownloadedXmlContainsExpected(`
<bpmn:dataObjectReference id="node_8" name="Data Object" />
assertDownloadedXmlMatch(`
<bpmn:dataObjectReference id="node_*" name="Data Object" />
`);

getElementAtPosition(dataPosition)
Expand Down
15 changes: 8 additions & 7 deletions tests/e2e/specs/IntermediateMessageThrowEvent.cy.js
Original file line number Diff line number Diff line change
Expand Up @@ -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('<bpmn:message id=".*?" name=".*?" />', 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;
Expand All @@ -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 };
Expand All @@ -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 };
Expand All @@ -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 };
Expand Down
17 changes: 7 additions & 10 deletions tests/e2e/specs/MessageFlows.cy.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,29 +9,26 @@ import {
getNumberOfLinks,
isElementCovered,
modalConfirm,
moveElement,
removeStartEvent,
setBoundaryEvent,
waitToRenderAllShapes,
} from '../support/utils';
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);
Expand Down
31 changes: 16 additions & 15 deletions tests/e2e/specs/Modeler.cy.js
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down Expand Up @@ -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 };
Expand All @@ -70,7 +70,7 @@ describe('Modeler', { scrollBehavior: false }, () => {
<bpmndi:BPMNDiagram id="BPMNDiagram_1">
<bpmndi:BPMNPlane id="BPMNPlane_1" bpmnElement="Process_1">
<bpmndi:BPMNShape id="node_1_di" bpmnElement="node_1">
<dc:Bounds x="210" y="200" width="36" height="36" />
<dc:Bounds x="150" y="150" width="36" height="36" />
</bpmndi:BPMNShape>
</bpmndi:BPMNPlane>
</bpmndi:BPMNDiagram>
Expand All @@ -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;

Expand All @@ -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();

Expand Down Expand Up @@ -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();

Expand Down Expand Up @@ -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 };

Expand All @@ -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');
Expand Down Expand Up @@ -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 };

Expand Down Expand Up @@ -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)
Expand Down Expand Up @@ -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);
Expand All @@ -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();
Expand All @@ -435,14 +435,15 @@ 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 });

cy.get('[data-test=switch-to-start-timer-event]').should('not.exist');
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();
Expand All @@ -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 };
Expand All @@ -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');

Expand Down
17 changes: 11 additions & 6 deletions tests/e2e/specs/StartTimerEvent.cy.js
Original file line number Diff line number Diff line change
Expand Up @@ -58,29 +58,35 @@ 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();

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();
cy.get('.vdpHoursInput').type(hour, { force: true });
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();
Expand All @@ -89,7 +95,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()
Expand Down
Loading

0 comments on commit 548c6f4

Please sign in to comment.