This is an automated email from the ASF dual-hosted git repository. porcelli pushed a commit to branch 0.9.0-prerelease in repository https://gitbox.apache.org/repos/asf/incubator-kie-tools-temporary-rnd-do-not-use.git
commit 101cc3cec75f02833fe3b5d98e4d5705f8566bef Author: Dominik HanĂ¡k <[email protected]> AuthorDate: Tue Apr 27 22:40:06 2021 +0200 [backport][tests]KOGITO-4912: Implement work item definition it coverage in standalone editors (#488) * KOGITO-4912: Implement work item definition it coverage in standalone editors (#475) * KOGITO-4912: Implement work item definition it coverage in standalone editors Introduce usage of ResourceContent Include more complex WID, include it in resources Refactor framework to work with new type Expand workitems tests across properties and data IO assignments * Fix double call of addFile, refactor assignments checks * Replace then with better suited within() * Add workaround for RHPAM-3629 https://issues.redhat.com/browse/RHPAM-3629 * Apply workaround for RHPAM-3606 https://issues.redhat.com/browse/RHPAM-3606 --- .../it-tests/cypress/fixtures/default.wid | 37 +++ .../it-tests/cypress/fixtures/process-wid.bpmn | 120 +++++++++ .../cypress/integration/bpmn-workitem.spec.ts | 268 ++++++++++++++++++++- .../it-tests/cypress/support/commands.d.ts | 2 +- .../it-tests/src/components/EditorComponent.tsx | 45 ++-- .../it-tests/src/components/FileLoader.tsx | 2 +- .../it-tests/src/pages/page.tsx | 8 +- .../it-tests/src/pages/processWithWidDefinition.js | 122 ++++++++++ .../it-tests/src/pages/widDefinitions.js | 20 +- .../it-tests/src/util/ResourcesHolder.ts | 28 +-- 10 files changed, 611 insertions(+), 41 deletions(-) diff --git a/packages/kie-editors-standalone/it-tests/cypress/fixtures/default.wid b/packages/kie-editors-standalone/it-tests/cypress/fixtures/default.wid new file mode 100644 index 0000000000..b9ba3d7c0f --- /dev/null +++ b/packages/kie-editors-standalone/it-tests/cypress/fixtures/default.wid @@ -0,0 +1,37 @@ +[ + [ + "name" : "CreateCustomer", + "version" : "1.0.0", + "documentation" : "Calls internal service that creates the customer in database server.", + "displayName" : "Create Customer Internal Service", + "parameters" : [ + "in_customer_id" : new StringDataType(), + "in_customer_level_id" : new IntegerDataType(), + "in_customer_initial_balance" : new FloatDataType(), + "in_customer_level_label" : new EnumDataType(), + "in_customer_roles" : new ListDataType(), + "in_security_token" : new ObjectDataType(), + "in_message" : new UndefinedDataType(), + ], + "parameterValues" : [ + "in_customer_id" : "MrIncognito", + ], + "results" : [ + "out_operation_success" : new BooleanDataType() + ], + "icon" : "defaultemailicon.gif", + ], + [ + "name" : "Email", + "displayName" : "Email", + "parameters" : [ + "to" : new StringDataType(), + "from" : new StringDataType(), + "subject" : new StringDataType() + ], + "results" : [ + "reply" : new StringDataType() + ], + "icon" : "defaultemailicon.gif", + ] +] \ No newline at end of file diff --git a/packages/kie-editors-standalone/it-tests/cypress/fixtures/process-wid.bpmn b/packages/kie-editors-standalone/it-tests/cypress/fixtures/process-wid.bpmn new file mode 100644 index 0000000000..cf7dd6ecce --- /dev/null +++ b/packages/kie-editors-standalone/it-tests/cypress/fixtures/process-wid.bpmn @@ -0,0 +1,120 @@ +<bpmn2:definitions xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:bpmn2="http://www.omg.org/spec/BPMN/20100524/MODEL" xmlns:bpmndi="http://www.omg.org/spec/BPMN/20100524/DI" xmlns:bpsim="http://www.bpsim.org/schemas/1.0" xmlns:dc="http://www.omg.org/spec/DD/20100524/DC" xmlns:di="http://www.omg.org/spec/DD/20100524/DI" xmlns:drools="http://www.jboss.org/drools" id="_nCB7kIl5EDmizbwd8_oqEQ" xsi:schemaLocation="http://www.omg.org/spec/BPMN/20100524/MODEL BPMN20.xsd http://www. [...] + <bpmn2:itemDefinition id="__5A0F59BB-0760-40A9-A889-528D95DEA503_in_customer_idInputXItem" structureRef="String"/> + <bpmn2:itemDefinition id="__5A0F59BB-0760-40A9-A889-528D95DEA503_in_customer_initial_balanceInputXItem" structureRef="Float"/> + <bpmn2:itemDefinition id="__5A0F59BB-0760-40A9-A889-528D95DEA503_in_customer_level_idInputXItem" structureRef="Integer"/> + <bpmn2:itemDefinition id="__5A0F59BB-0760-40A9-A889-528D95DEA503_in_customer_level_labelInputXItem" structureRef="java.lang.Object"/> + <bpmn2:itemDefinition id="__5A0F59BB-0760-40A9-A889-528D95DEA503_in_customer_rolesInputXItem" structureRef="java.util.List"/> + <bpmn2:itemDefinition id="__5A0F59BB-0760-40A9-A889-528D95DEA503_in_messageInputXItem" structureRef="java.lang.Object"/> + <bpmn2:itemDefinition id="__5A0F59BB-0760-40A9-A889-528D95DEA503_in_security_tokenInputXItem" structureRef="java.lang.Object"/> + <bpmn2:itemDefinition id="__5A0F59BB-0760-40A9-A889-528D95DEA503_out_operation_successOutputXItem" structureRef="Boolean"/> + <bpmn2:process id="process_wid" drools:packageName="com.example" drools:version="1.0" drools:adHoc="false" name="process-wid" isExecutable="true" processType="Public"> + <bpmn2:sequenceFlow id="_A4CA7B8A-5F99-4DEE-A703-5F606FCFAA97" sourceRef="_5A0F59BB-0760-40A9-A889-528D95DEA503" targetRef="_98609158-4B3D-4A94-B74B-B7F1A3A5BEA0"/> + <bpmn2:sequenceFlow id="_1A053C7C-BD89-447E-9FC1-9B9A88F1ED96" sourceRef="_CCEC3FEE-9967-427C-B62C-E1C6584F6F6B" targetRef="_5A0F59BB-0760-40A9-A889-528D95DEA503"/> + <bpmn2:task id="_5A0F59BB-0760-40A9-A889-528D95DEA503" drools:taskName="CreateCustomer" name="Create Customer Internal Service"> + <bpmn2:documentation><![CDATA[Calls internal service that creates the customer in database server.]]></bpmn2:documentation> + <bpmn2:extensionElements> + <drools:metaData name="elementname"> + <drools:metaValue><![CDATA[Create Customer Internal Service]]></drools:metaValue> + </drools:metaData> + </bpmn2:extensionElements> + <bpmn2:incoming>_1A053C7C-BD89-447E-9FC1-9B9A88F1ED96</bpmn2:incoming> + <bpmn2:outgoing>_A4CA7B8A-5F99-4DEE-A703-5F606FCFAA97</bpmn2:outgoing> + <bpmn2:ioSpecification> + <bpmn2:dataInput id="_5A0F59BB-0760-40A9-A889-528D95DEA503_in_customer_idInputX" drools:dtype="String" itemSubjectRef="__5A0F59BB-0760-40A9-A889-528D95DEA503_in_customer_idInputXItem" name="in_customer_id"/> + <bpmn2:dataInput id="_5A0F59BB-0760-40A9-A889-528D95DEA503_in_customer_initial_balanceInputX" drools:dtype="Float" itemSubjectRef="__5A0F59BB-0760-40A9-A889-528D95DEA503_in_customer_initial_balanceInputXItem" name="in_customer_initial_balance"/> + <bpmn2:dataInput id="_5A0F59BB-0760-40A9-A889-528D95DEA503_in_customer_level_idInputX" drools:dtype="Integer" itemSubjectRef="__5A0F59BB-0760-40A9-A889-528D95DEA503_in_customer_level_idInputXItem" name="in_customer_level_id"/> + <bpmn2:dataInput id="_5A0F59BB-0760-40A9-A889-528D95DEA503_in_customer_level_labelInputX" drools:dtype="java.lang.Object" itemSubjectRef="__5A0F59BB-0760-40A9-A889-528D95DEA503_in_customer_level_labelInputXItem" name="in_customer_level_label"/> + <bpmn2:dataInput id="_5A0F59BB-0760-40A9-A889-528D95DEA503_in_customer_rolesInputX" drools:dtype="java.util.List" itemSubjectRef="__5A0F59BB-0760-40A9-A889-528D95DEA503_in_customer_rolesInputXItem" name="in_customer_roles"/> + <bpmn2:dataInput id="_5A0F59BB-0760-40A9-A889-528D95DEA503_in_messageInputX" drools:dtype="java.lang.Object" itemSubjectRef="__5A0F59BB-0760-40A9-A889-528D95DEA503_in_messageInputXItem" name="in_message"/> + <bpmn2:dataInput id="_5A0F59BB-0760-40A9-A889-528D95DEA503_in_security_tokenInputX" drools:dtype="java.lang.Object" itemSubjectRef="__5A0F59BB-0760-40A9-A889-528D95DEA503_in_security_tokenInputXItem" name="in_security_token"/> + <bpmn2:dataInput id="_5A0F59BB-0760-40A9-A889-528D95DEA503_TaskNameInputX" drools:dtype="Object" name="TaskName"/> + <bpmn2:dataOutput id="_5A0F59BB-0760-40A9-A889-528D95DEA503_out_operation_successOutputX" drools:dtype="Boolean" itemSubjectRef="__5A0F59BB-0760-40A9-A889-528D95DEA503_out_operation_successOutputXItem" name="out_operation_success"/> + <bpmn2:inputSet> + <bpmn2:dataInputRefs>_5A0F59BB-0760-40A9-A889-528D95DEA503_in_customer_idInputX</bpmn2:dataInputRefs> + <bpmn2:dataInputRefs>_5A0F59BB-0760-40A9-A889-528D95DEA503_in_customer_initial_balanceInputX</bpmn2:dataInputRefs> + <bpmn2:dataInputRefs>_5A0F59BB-0760-40A9-A889-528D95DEA503_in_customer_level_idInputX</bpmn2:dataInputRefs> + <bpmn2:dataInputRefs>_5A0F59BB-0760-40A9-A889-528D95DEA503_in_customer_level_labelInputX</bpmn2:dataInputRefs> + <bpmn2:dataInputRefs>_5A0F59BB-0760-40A9-A889-528D95DEA503_in_customer_rolesInputX</bpmn2:dataInputRefs> + <bpmn2:dataInputRefs>_5A0F59BB-0760-40A9-A889-528D95DEA503_in_messageInputX</bpmn2:dataInputRefs> + <bpmn2:dataInputRefs>_5A0F59BB-0760-40A9-A889-528D95DEA503_in_security_tokenInputX</bpmn2:dataInputRefs> + <bpmn2:dataInputRefs>_5A0F59BB-0760-40A9-A889-528D95DEA503_TaskNameInputX</bpmn2:dataInputRefs> + </bpmn2:inputSet> + <bpmn2:outputSet> + <bpmn2:dataOutputRefs>_5A0F59BB-0760-40A9-A889-528D95DEA503_out_operation_successOutputX</bpmn2:dataOutputRefs> + </bpmn2:outputSet> + </bpmn2:ioSpecification> + <bpmn2:dataInputAssociation> + <bpmn2:targetRef>_5A0F59BB-0760-40A9-A889-528D95DEA503_TaskNameInputX</bpmn2:targetRef> + <bpmn2:assignment> + <bpmn2:from xsi:type="bpmn2:tFormalExpression"><![CDATA[CreateCustomer]]></bpmn2:from> + <bpmn2:to xsi:type="bpmn2:tFormalExpression"><![CDATA[_5A0F59BB-0760-40A9-A889-528D95DEA503_TaskNameInputX]]></bpmn2:to> + </bpmn2:assignment> + </bpmn2:dataInputAssociation> + </bpmn2:task> + <bpmn2:endEvent id="_98609158-4B3D-4A94-B74B-B7F1A3A5BEA0"> + <bpmn2:incoming>_A4CA7B8A-5F99-4DEE-A703-5F606FCFAA97</bpmn2:incoming> + </bpmn2:endEvent> + <bpmn2:startEvent id="_CCEC3FEE-9967-427C-B62C-E1C6584F6F6B"> + <bpmn2:outgoing>_1A053C7C-BD89-447E-9FC1-9B9A88F1ED96</bpmn2:outgoing> + </bpmn2:startEvent> + </bpmn2:process> + <bpmndi:BPMNDiagram> + <bpmndi:BPMNPlane bpmnElement="process_wid"> + <bpmndi:BPMNShape id="shape__CCEC3FEE-9967-427C-B62C-E1C6584F6F6B" bpmnElement="_CCEC3FEE-9967-427C-B62C-E1C6584F6F6B"> + <dc:Bounds height="56" width="56" x="364" y="219"/> + </bpmndi:BPMNShape> + <bpmndi:BPMNShape id="shape__98609158-4B3D-4A94-B74B-B7F1A3A5BEA0" bpmnElement="_98609158-4B3D-4A94-B74B-B7F1A3A5BEA0"> + <dc:Bounds height="56" width="56" x="1000" y="219"/> + </bpmndi:BPMNShape> + <bpmndi:BPMNShape id="shape__5A0F59BB-0760-40A9-A889-528D95DEA503" bpmnElement="_5A0F59BB-0760-40A9-A889-528D95DEA503"> + <dc:Bounds height="102" width="154" x="516" y="196"/> + </bpmndi:BPMNShape> + <bpmndi:BPMNEdge id="edge_shape__CCEC3FEE-9967-427C-B62C-E1C6584F6F6B_to_shape__5A0F59BB-0760-40A9-A889-528D95DEA503" bpmnElement="_1A053C7C-BD89-447E-9FC1-9B9A88F1ED96"> + <di:waypoint x="392" y="247"/> + <di:waypoint x="593" y="247"/> + </bpmndi:BPMNEdge> + <bpmndi:BPMNEdge id="edge_shape__5A0F59BB-0760-40A9-A889-528D95DEA503_to_shape__98609158-4B3D-4A94-B74B-B7F1A3A5BEA0" bpmnElement="_A4CA7B8A-5F99-4DEE-A703-5F606FCFAA97"> + <di:waypoint x="593" y="247"/> + <di:waypoint x="1028" y="247"/> + </bpmndi:BPMNEdge> + </bpmndi:BPMNPlane> + </bpmndi:BPMNDiagram> + <bpmn2:relationship type="BPSimData"> + <bpmn2:extensionElements> + <bpsim:BPSimData> + <bpsim:Scenario id="default" name="Simulationscenario"> + <bpsim:ScenarioParameters/> + <bpsim:ElementParameters elementRef="_CCEC3FEE-9967-427C-B62C-E1C6584F6F6B"> + <bpsim:TimeParameters> + <bpsim:ProcessingTime> + <bpsim:NormalDistribution mean="0" standardDeviation="0"/> + </bpsim:ProcessingTime> + </bpsim:TimeParameters> + </bpsim:ElementParameters> + <bpsim:ElementParameters elementRef="_5A0F59BB-0760-40A9-A889-528D95DEA503"> + <bpsim:TimeParameters> + <bpsim:ProcessingTime> + <bpsim:NormalDistribution mean="0" standardDeviation="0"/> + </bpsim:ProcessingTime> + </bpsim:TimeParameters> + <bpsim:ResourceParameters> + <bpsim:Availability> + <bpsim:FloatingParameter value="0"/> + </bpsim:Availability> + <bpsim:Quantity> + <bpsim:FloatingParameter value="0"/> + </bpsim:Quantity> + </bpsim:ResourceParameters> + <bpsim:CostParameters> + <bpsim:UnitCost> + <bpsim:FloatingParameter value="0"/> + </bpsim:UnitCost> + </bpsim:CostParameters> + </bpsim:ElementParameters> + </bpsim:Scenario> + </bpsim:BPSimData> + </bpmn2:extensionElements> + <bpmn2:source>_nCB7kIl5EDmizbwd8_oqEQ</bpmn2:source> + <bpmn2:target>_nCB7kIl5EDmizbwd8_oqEQ</bpmn2:target> + </bpmn2:relationship> +</bpmn2:definitions> \ No newline at end of file diff --git a/packages/kie-editors-standalone/it-tests/cypress/integration/bpmn-workitem.spec.ts b/packages/kie-editors-standalone/it-tests/cypress/integration/bpmn-workitem.spec.ts index aa0f1278a2..16c934d532 100644 --- a/packages/kie-editors-standalone/it-tests/cypress/integration/bpmn-workitem.spec.ts +++ b/packages/kie-editors-standalone/it-tests/cypress/integration/bpmn-workitem.spec.ts @@ -14,13 +14,18 @@ * limitations under the License. */ -describe("Bpmn Workitem.", () => { +describe("Bpmn Workitem E2E Test.", () => { + + const NAME_INPUT_LOCATOR: string = "input[data-field='name']"; + const DATATYPE_SELECT_LOCATOR: string = "select[data-field='dataType']" + + before("Visit page", () => { cy.visit("localhost:9001/bpmn-workitem"); cy.loadEditor("bpmn-workitem"); }); - it("Test Open Editor With Custom Workitem", () => { + it("Loads custom workitem definition to Palette on open", () => { cy.editor("bpmn-workitem") .find("[data-field='kie-palette']") .should("be.visible") @@ -46,4 +51,263 @@ describe("Bpmn Workitem.", () => { .should("exist") .should("contain.text", "CreateCustomer"); }); + + + it("Loads the Custom Workitem in diagram explorer", () => { + cy.editor("bpmn-workitem") + .find("[data-title='Explore Diagram']") + .should("be.visible") + .click({ force: true }); + + cy.editor("bpmn-workitem") + .find("[data-field='explorerPanelBody']") + .scrollIntoView() + .should("be.visible") + .find("a.gwt-Anchor") + .should("have.length", 4) + .then($links => { + expect($links.eq(0)).to.contain.text("process-wid"); + expect($links.eq(1)).to.contain.text("Start"); + expect($links.eq(2)).to.contain.text("End"); + expect($links.eq(3)).to.contain.text("Create Customer Internal Service"); + + cy.wrap($links.eq(3)).click(); + + cy.editor("bpmn-workitem") + .ouiaId("docks-item", "docks-item-DiagramEditorPropertiesScreen") + .find("button") + .first() + .should("be.visible") + .click(); // open Properties + + cy.editor("bpmn-workitem") + .ouiaId("expanded-docks-bar", "expanded-docks-bar-E") + .should("be.visible"); + }); + }); + + describe("Custom workitem task has expected properties.", () => { + let propertyItems: JQuery<HTMLElement> + + it("Properties have expected length", () => { + cy.editor("bpmn-workitem") + .ouiaId("expanded-docks-bar", "expanded-docks-bar-E") + .within($properties => { + cy.wrap($properties) + .find("[id='mainContainer']") + .should("be.visible") + .children(".row") + .should("have.length", 11) + .then($items => { + propertyItems = $items; + }); + }); + }); + + it("Custom workitem has expected name",() => { + cy.wrap(propertyItems) + .find("textarea[name*='general.name']") + .should("have.value", "Create Customer Internal Service") + .should("not.be", "disabled"); + }); + + it("Custom workitem has expected documentation",() => { + cy.wrap(propertyItems) + .find("textarea[name*='general.documentation']") + .should("have.value", "Calls internal service that creates the customer in database server.") + .should("not.be", "disabled"); + }); + + it("Custom workitem has expected isAsync value", () => { + cy.wrap(propertyItems) + .find("input[name*='executionSet.isAsync']") + .should("not.be.checked") + .should("not.be.disabled"); + }); + + it("Custom workitem has expected AdHoc Autostart value", () => { + cy.wrap(propertyItems) + .find("input[name*='executionSet.adHocAutostart']") + .should("not.be.checked") + .should("not.be.disabled"); + }); + + it("Custom workitem has expected SLA Due Date",() => { + cy.wrap(propertyItems) + .find("input[name*='executionSet.slaDueDate']") + .should("have.value", "") + .should("not.be", "disabled"); + }); + + it("Custom workitem has expected data assignment size",() => { + cy.wrap(propertyItems) + .find("input[id='assignmentsTextBox']") + .should("have.value", "7 data inputs, 1 data output") + .should("not.be", "disabled"); + }); + + it("Data assignments of custom work item tasks are not disabled", () => { + cy.wrap(propertyItems) + .find("a") + .contains("Data Assignments") + .should("not.be.disabled") + .click() + .scrollIntoView(); + }); + + describe("Custom workitem task has expected data inputs and data output assignments.", () => { + let dataAssignments: JQuery<HTMLElement> + after(() => { + // Close open modal after checking the assignments + cy.editor("bpmn-workitem") + .find(".modal-body") + .contains("button", "OK") + .click(); + }) + + it("Custom workitem has expected size of data assignments when opened for edit", () => { + cy.wrap(propertyItems) + .find("button[id='assignmentsButton']") + .should("not.be", "disabled") + .click(); + + cy.editor("bpmn-workitem") + .find('.modal-content') + .should("be.visible") + .within(() => { + cy.get(".modal-title") + .should("have.text", "Create Customer Internal Service Data I/O"); + + cy.get("tr[id='assignment']") + .should("have.length", 8) + .then($assignments => { + dataAssignments = $assignments; + }) + }) + }); + + it("Custom workitem has correct in_customer_id data input assignments",() => { + cy.wrap(dataAssignments.eq(0)).within(() => { + cy.get(NAME_INPUT_LOCATOR) + .should("have.value", "in_customer_id") + .get(DATATYPE_SELECT_LOCATOR) + .should("have.value", "String"); + }); + }); + + it("Custom workitem has correct in_customer_initial_balance data input assignment",() => { + cy.wrap(dataAssignments.eq(1)).within(() => { + cy.get(NAME_INPUT_LOCATOR) + .should("have.value", "in_customer_initial_balance") + .get(DATATYPE_SELECT_LOCATOR) + .should("have.value", "Float"); + }); + }); + + it("Custom workitem has correct in_customer_level_id data input assignments",() => { + cy.wrap(dataAssignments.eq(2)).within(() => { + cy.get(NAME_INPUT_LOCATOR) + .should("have.value", "in_customer_level_id") + .get(DATATYPE_SELECT_LOCATOR) + .should("have.value", "Integer"); + }); + }); + + it("Custom workitem has correct in_customer_level_label data input assignment",() => { + cy.wrap(dataAssignments.eq(3)).within(() => { + cy.get(NAME_INPUT_LOCATOR) + .should("have.value", "in_customer_level_label") + .get(DATATYPE_SELECT_LOCATOR) + .should("have.value", "java.lang.Object"); + }); + }); + + it("Custom workitem has correct in_customer_roles data input assignment",() => { + cy.wrap(dataAssignments.eq(4)).within(() => { + cy.get(NAME_INPUT_LOCATOR) + .should("have.value", "in_customer_roles") + .get(DATATYPE_SELECT_LOCATOR) + .should("have.value", "java.util.List"); + }); + }); + + it("Custom workitem has correct in_message data input assignment",() => { + cy.wrap(dataAssignments.eq(5)).within(() => { + cy.get(NAME_INPUT_LOCATOR) + .should("have.value", "in_message") + .get(DATATYPE_SELECT_LOCATOR) + .should("have.value", "java.lang.Object"); + }); + }); + + it("Custom workitem has correct in_security_token data input assignment",() => { + cy.wrap(dataAssignments.eq(6)).within(() => { + cy.get(NAME_INPUT_LOCATOR) + .should("have.value", "in_security_token") + .get(DATATYPE_SELECT_LOCATOR) + .should("have.value", "java.lang.Object"); + }); + }); + + it("Custom workitem has correct out_operation_success data output assignment",() => { + cy.wrap(dataAssignments.eq(7)).within(() => { + cy.get(NAME_INPUT_LOCATOR) + .should("have.value", "out_operation_success") + .get(DATATYPE_SELECT_LOCATOR) + .should("have.value", "Boolean"); + }); + }); + }); + }); + + describe.skip("Unknown custom workitem task has expected properties.", () => { + let unknownCustomWorkitemProperties: JQuery<HTMLElement>; + + it("Loads the unkown custom workitem in diagram explorer", () => { + cy.editor("bpmn-workitem") + .find("[data-title='Explore Diagram']") + .should("be.visible") + .click({ force: true }); + + cy.editor("bpmn-workitem") + .find("[data-field='explorerPanelBody']") + .scrollIntoView() + .should("be.visible") + .find("a.gwt-Anchor") + .should("have.length", 5) + .then($links => { + expect($links.eq(2)).to.contain.text("Email"); + cy.wrap($links.eq(2)).click(); + + cy.editor("bpmn-workitem") + .ouiaId("docks-item", "docks-item-DiagramEditorPropertiesScreen") + .find("button") + .first() + .should("be.visible") + .click(); // open Properties + + cy.editor("bpmn-workitem") + .ouiaId("expanded-docks-bar", "expanded-docks-bar-E") + .should("be.visible"); + }); + }); + + // Skipped due to missing fix for https://issues.redhat.com/browse/RHPAM-3588 in 7.52.Final + it.skip("Unkown custom workitem properties have expected length.", () => { + cy.editor("bpmn-workitem") + .ouiaId("expanded-docks-bar", "expanded-docks-bar-E") + .within($properties => { + cy.wrap($properties) + .find("[id='mainContainer']") + .should("be.visible") + .children(".row") + .should("have.length", 11) + .then($items => { + unknownCustomWorkitemProperties = $items; + }); + }); + + }); + + }) }); diff --git a/packages/kie-editors-standalone/it-tests/cypress/support/commands.d.ts b/packages/kie-editors-standalone/it-tests/cypress/support/commands.d.ts index 10562c4362..da3ccd209a 100644 --- a/packages/kie-editors-standalone/it-tests/cypress/support/commands.d.ts +++ b/packages/kie-editors-standalone/it-tests/cypress/support/commands.d.ts @@ -34,7 +34,7 @@ declare namespace Cypress { ouiaType(type: string, opts?: Record<string, any>): Chainable<Element>; /** - * Make sure the ditor is loaded. + * Make sure the editor is loaded. * @param editorIds string ids of the editor elements * @param options config object */ diff --git a/packages/kie-editors-standalone/it-tests/src/components/EditorComponent.tsx b/packages/kie-editors-standalone/it-tests/src/components/EditorComponent.tsx index 59cdbcc43c..44e7c3cb7f 100644 --- a/packages/kie-editors-standalone/it-tests/src/components/EditorComponent.tsx +++ b/packages/kie-editors-standalone/it-tests/src/components/EditorComponent.tsx @@ -17,26 +17,31 @@ import * as React from "react"; import { useRef, useEffect, useState } from "react"; -import { ContentType } from "@kogito-tooling/channel-common-api/dist"; +import { ContentType, ResourceContent } from "@kogito-tooling/channel-common-api/dist"; import { StandaloneEditorApi } from "@kogito-tooling/kie-editors-standalone/dist/common/Editor"; import { FileLoader } from "./FileLoader"; -import { ResourcesHolder, ResourcesHolderItem, Resource } from "../util/ResourcesHolder"; +import { ResourcesHolder, ResourcesHolderItem } from "../util/ResourcesHolder"; interface EditorOpenProps { container: Element; initialContent?: Promise<string>; readOnly?: boolean; origin?: string; - resources?: Map<string, Resource>; + resources?: InternalEditorOpenResources; } +export type InternalEditorOpenResources = Map<string, { + contentType: ContentType; + content: Promise<string>; +}> + export interface Props { id: string; initialContent?: Promise<string>; readOnly?: boolean; origin?: string; - resources?: Map<string, Resource>; + resources?: Map<string, ResourceContent>; } interface InternalProps { @@ -45,7 +50,7 @@ interface InternalProps { initialContent?: Promise<string>; readOnly?: boolean; origin?: string; - resources?: Map<string, Resource>; + resources?: Map<string, ResourceContent>; defaultModelName?: string; } const divstyle = { @@ -80,7 +85,7 @@ export const EditorComponent: React.FC<InternalProps> = ({ initialContent, readOnly, origin, - resources: filesHolder.resources + resources: createResourceContentCompatibleResources(filesHolder.resources) }); ed.subscribeToContentChanges(isDirty => { setDirty(isDirty); @@ -92,12 +97,18 @@ export const EditorComponent: React.FC<InternalProps> = ({ }, [id]); const setEditorContents = (resource: ResourcesHolderItem) => { - return resource.value.content.then((value: string) => { - editor!.setContent(value, value); - setModelName(resource.name); - }); + editor!.setContent(resource.value.content, resource.value.content); + setModelName(resource.name); }; + const createResourceContentCompatibleResources = (resources: Map<string, ResourceContent>): InternalEditorOpenResources => { + let compatibleResources: InternalEditorOpenResources = new Map(); + resources.forEach((value, key) => { + compatibleResources.set(key, {content: Promise.resolve(value.content), contentType: value.type}) + }); + return compatibleResources; + } + const appendLog = (message: string) => { logs.push(message); }; @@ -109,11 +120,13 @@ export const EditorComponent: React.FC<InternalProps> = ({ editor!.redo(); }; const editorSave = () => { - filesHolder.addFile( - { name: modelName, value: { contentType: ContentType.TEXT, content: editor!.getContent() } }, - forceUpdate - ); - editor?.markAsSaved(); + editor!.getContent().then((result) => { + filesHolder.addFile( + { name: modelName, value: { path: modelName, type: ContentType.TEXT, content: result } }, + forceUpdate + ); + editor?.markAsSaved(); + }); }; const editorSvg = () => { editor!.getPreview().then(content => { @@ -177,4 +190,4 @@ export const EditorComponent: React.FC<InternalProps> = ({ <div id={id} data-ouia-component-type="editor" data-ouia-component-id={id} ref={container} style={divstyle} /> </> ); -}; +}; \ No newline at end of file diff --git a/packages/kie-editors-standalone/it-tests/src/components/FileLoader.tsx b/packages/kie-editors-standalone/it-tests/src/components/FileLoader.tsx index 1339e3d8b6..e8ec70c877 100644 --- a/packages/kie-editors-standalone/it-tests/src/components/FileLoader.tsx +++ b/packages/kie-editors-standalone/it-tests/src/components/FileLoader.tsx @@ -118,4 +118,4 @@ export const FileLoader: React.FC<Props> = ({ {renderFiles()} </div> ); -}; +}; \ No newline at end of file diff --git a/packages/kie-editors-standalone/it-tests/src/pages/page.tsx b/packages/kie-editors-standalone/it-tests/src/pages/page.tsx index 8737fd402a..b7c809dd98 100644 --- a/packages/kie-editors-standalone/it-tests/src/pages/page.tsx +++ b/packages/kie-editors-standalone/it-tests/src/pages/page.tsx @@ -20,6 +20,7 @@ import { DmnEditorComponent } from "../components/DmnEditorComponent"; import { BpmnEditorComponent } from "../components/BpmnEditorComponent"; import { ContentType } from "@kogito-tooling/channel-common-api"; import { customWorkItemWid } from "./widDefinitions"; +import { processWithWidDefinition } from "./processWithWidDefinition.js" export const EditorPage: React.FC<{}> = () => { return ( @@ -102,14 +103,15 @@ export const EditorPage: React.FC<{}> = () => { key="bpmn-workitem" id="bpmn-workitem" readOnly={false} - initialContent={Promise.resolve("")} + initialContent={Promise.resolve(processWithWidDefinition)} resources={ new Map([ [ "custom-workitem.wid", { - contentType: ContentType.TEXT, - content: Promise.resolve(customWorkItemWid) + type: ContentType.TEXT, + content: customWorkItemWid, + path: "custom-workitem.wid" } ] ]) diff --git a/packages/kie-editors-standalone/it-tests/src/pages/processWithWidDefinition.js b/packages/kie-editors-standalone/it-tests/src/pages/processWithWidDefinition.js new file mode 100644 index 0000000000..a8ca9de69c --- /dev/null +++ b/packages/kie-editors-standalone/it-tests/src/pages/processWithWidDefinition.js @@ -0,0 +1,122 @@ +export const processWithWidDefinition =` +<bpmn2:definitions xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:bpmn2="http://www.omg.org/spec/BPMN/20100524/MODEL" xmlns:bpmndi="http://www.omg.org/spec/BPMN/20100524/DI" xmlns:bpsim="http://www.bpsim.org/schemas/1.0" xmlns:dc="http://www.omg.org/spec/DD/20100524/DC" xmlns:di="http://www.omg.org/spec/DD/20100524/DI" xmlns:drools="http://www.jboss.org/drools" id="_nCB7kIl5EDmizbwd8_oqEQ" xsi:schemaLocation="http://www.omg.org/spec/BPMN/20100524/MODEL BPMN20.xsd http://www. [...] + <bpmn2:itemDefinition id="__5A0F59BB-0760-40A9-A889-528D95DEA503_in_customer_idInputXItem" structureRef="String"/> + <bpmn2:itemDefinition id="__5A0F59BB-0760-40A9-A889-528D95DEA503_in_customer_initial_balanceInputXItem" structureRef="Float"/> + <bpmn2:itemDefinition id="__5A0F59BB-0760-40A9-A889-528D95DEA503_in_customer_level_idInputXItem" structureRef="Integer"/> + <bpmn2:itemDefinition id="__5A0F59BB-0760-40A9-A889-528D95DEA503_in_customer_level_labelInputXItem" structureRef="java.lang.Object"/> + <bpmn2:itemDefinition id="__5A0F59BB-0760-40A9-A889-528D95DEA503_in_customer_rolesInputXItem" structureRef="java.util.List"/> + <bpmn2:itemDefinition id="__5A0F59BB-0760-40A9-A889-528D95DEA503_in_messageInputXItem" structureRef="java.lang.Object"/> + <bpmn2:itemDefinition id="__5A0F59BB-0760-40A9-A889-528D95DEA503_in_security_tokenInputXItem" structureRef="java.lang.Object"/> + <bpmn2:itemDefinition id="__5A0F59BB-0760-40A9-A889-528D95DEA503_out_operation_successOutputXItem" structureRef="Boolean"/> + <bpmn2:process id="process_wid" drools:packageName="com.example" drools:version="1.0" drools:adHoc="false" name="process-wid" isExecutable="true" processType="Public"> + <bpmn2:sequenceFlow id="_A4CA7B8A-5F99-4DEE-A703-5F606FCFAA97" sourceRef="_5A0F59BB-0760-40A9-A889-528D95DEA503" targetRef="_98609158-4B3D-4A94-B74B-B7F1A3A5BEA0"/> + <bpmn2:sequenceFlow id="_1A053C7C-BD89-447E-9FC1-9B9A88F1ED96" sourceRef="_CCEC3FEE-9967-427C-B62C-E1C6584F6F6B" targetRef="_5A0F59BB-0760-40A9-A889-528D95DEA503"/> + <bpmn2:task id="_5A0F59BB-0760-40A9-A889-528D95DEA503" drools:taskName="CreateCustomer" name="Create Customer Internal Service"> + <bpmn2:documentation><![CDATA[Calls internal service that creates the customer in database server.]]></bpmn2:documentation> + <bpmn2:extensionElements> + <drools:metaData name="elementname"> + <drools:metaValue><![CDATA[Create Customer Internal Service]]></drools:metaValue> + </drools:metaData> + </bpmn2:extensionElements> + <bpmn2:incoming>_1A053C7C-BD89-447E-9FC1-9B9A88F1ED96</bpmn2:incoming> + <bpmn2:outgoing>_A4CA7B8A-5F99-4DEE-A703-5F606FCFAA97</bpmn2:outgoing> + <bpmn2:ioSpecification> + <bpmn2:dataInput id="_5A0F59BB-0760-40A9-A889-528D95DEA503_in_customer_idInputX" drools:dtype="String" itemSubjectRef="__5A0F59BB-0760-40A9-A889-528D95DEA503_in_customer_idInputXItem" name="in_customer_id"/> + <bpmn2:dataInput id="_5A0F59BB-0760-40A9-A889-528D95DEA503_in_customer_initial_balanceInputX" drools:dtype="Float" itemSubjectRef="__5A0F59BB-0760-40A9-A889-528D95DEA503_in_customer_initial_balanceInputXItem" name="in_customer_initial_balance"/> + <bpmn2:dataInput id="_5A0F59BB-0760-40A9-A889-528D95DEA503_in_customer_level_idInputX" drools:dtype="Integer" itemSubjectRef="__5A0F59BB-0760-40A9-A889-528D95DEA503_in_customer_level_idInputXItem" name="in_customer_level_id"/> + <bpmn2:dataInput id="_5A0F59BB-0760-40A9-A889-528D95DEA503_in_customer_level_labelInputX" drools:dtype="java.lang.Object" itemSubjectRef="__5A0F59BB-0760-40A9-A889-528D95DEA503_in_customer_level_labelInputXItem" name="in_customer_level_label"/> + <bpmn2:dataInput id="_5A0F59BB-0760-40A9-A889-528D95DEA503_in_customer_rolesInputX" drools:dtype="java.util.List" itemSubjectRef="__5A0F59BB-0760-40A9-A889-528D95DEA503_in_customer_rolesInputXItem" name="in_customer_roles"/> + <bpmn2:dataInput id="_5A0F59BB-0760-40A9-A889-528D95DEA503_in_messageInputX" drools:dtype="java.lang.Object" itemSubjectRef="__5A0F59BB-0760-40A9-A889-528D95DEA503_in_messageInputXItem" name="in_message"/> + <bpmn2:dataInput id="_5A0F59BB-0760-40A9-A889-528D95DEA503_in_security_tokenInputX" drools:dtype="java.lang.Object" itemSubjectRef="__5A0F59BB-0760-40A9-A889-528D95DEA503_in_security_tokenInputXItem" name="in_security_token"/> + <bpmn2:dataInput id="_5A0F59BB-0760-40A9-A889-528D95DEA503_TaskNameInputX" drools:dtype="Object" name="TaskName"/> + <bpmn2:dataOutput id="_5A0F59BB-0760-40A9-A889-528D95DEA503_out_operation_successOutputX" drools:dtype="Boolean" itemSubjectRef="__5A0F59BB-0760-40A9-A889-528D95DEA503_out_operation_successOutputXItem" name="out_operation_success"/> + <bpmn2:inputSet> + <bpmn2:dataInputRefs>_5A0F59BB-0760-40A9-A889-528D95DEA503_in_customer_idInputX</bpmn2:dataInputRefs> + <bpmn2:dataInputRefs>_5A0F59BB-0760-40A9-A889-528D95DEA503_in_customer_initial_balanceInputX</bpmn2:dataInputRefs> + <bpmn2:dataInputRefs>_5A0F59BB-0760-40A9-A889-528D95DEA503_in_customer_level_idInputX</bpmn2:dataInputRefs> + <bpmn2:dataInputRefs>_5A0F59BB-0760-40A9-A889-528D95DEA503_in_customer_level_labelInputX</bpmn2:dataInputRefs> + <bpmn2:dataInputRefs>_5A0F59BB-0760-40A9-A889-528D95DEA503_in_customer_rolesInputX</bpmn2:dataInputRefs> + <bpmn2:dataInputRefs>_5A0F59BB-0760-40A9-A889-528D95DEA503_in_messageInputX</bpmn2:dataInputRefs> + <bpmn2:dataInputRefs>_5A0F59BB-0760-40A9-A889-528D95DEA503_in_security_tokenInputX</bpmn2:dataInputRefs> + <bpmn2:dataInputRefs>_5A0F59BB-0760-40A9-A889-528D95DEA503_TaskNameInputX</bpmn2:dataInputRefs> + </bpmn2:inputSet> + <bpmn2:outputSet> + <bpmn2:dataOutputRefs>_5A0F59BB-0760-40A9-A889-528D95DEA503_out_operation_successOutputX</bpmn2:dataOutputRefs> + </bpmn2:outputSet> + </bpmn2:ioSpecification> + <bpmn2:dataInputAssociation> + <bpmn2:targetRef>_5A0F59BB-0760-40A9-A889-528D95DEA503_TaskNameInputX</bpmn2:targetRef> + <bpmn2:assignment> + <bpmn2:from xsi:type="bpmn2:tFormalExpression"><![CDATA[CreateCustomer]]></bpmn2:from> + <bpmn2:to xsi:type="bpmn2:tFormalExpression"><![CDATA[_5A0F59BB-0760-40A9-A889-528D95DEA503_TaskNameInputX]]></bpmn2:to> + </bpmn2:assignment> + </bpmn2:dataInputAssociation> + </bpmn2:task> + <bpmn2:endEvent id="_98609158-4B3D-4A94-B74B-B7F1A3A5BEA0"> + <bpmn2:incoming>_A4CA7B8A-5F99-4DEE-A703-5F606FCFAA97</bpmn2:incoming> + </bpmn2:endEvent> + <bpmn2:startEvent id="_CCEC3FEE-9967-427C-B62C-E1C6584F6F6B"> + <bpmn2:outgoing>_1A053C7C-BD89-447E-9FC1-9B9A88F1ED96</bpmn2:outgoing> + </bpmn2:startEvent> + </bpmn2:process> + <bpmndi:BPMNDiagram> + <bpmndi:BPMNPlane bpmnElement="process_wid"> + <bpmndi:BPMNShape id="shape__CCEC3FEE-9967-427C-B62C-E1C6584F6F6B" bpmnElement="_CCEC3FEE-9967-427C-B62C-E1C6584F6F6B"> + <dc:Bounds height="56" width="56" x="364" y="219"/> + </bpmndi:BPMNShape> + <bpmndi:BPMNShape id="shape__98609158-4B3D-4A94-B74B-B7F1A3A5BEA0" bpmnElement="_98609158-4B3D-4A94-B74B-B7F1A3A5BEA0"> + <dc:Bounds height="56" width="56" x="1000" y="219"/> + </bpmndi:BPMNShape> + <bpmndi:BPMNShape id="shape__5A0F59BB-0760-40A9-A889-528D95DEA503" bpmnElement="_5A0F59BB-0760-40A9-A889-528D95DEA503"> + <dc:Bounds height="102" width="154" x="516" y="196"/> + </bpmndi:BPMNShape> + <bpmndi:BPMNEdge id="edge_shape__CCEC3FEE-9967-427C-B62C-E1C6584F6F6B_to_shape__5A0F59BB-0760-40A9-A889-528D95DEA503" bpmnElement="_1A053C7C-BD89-447E-9FC1-9B9A88F1ED96"> + <di:waypoint x="392" y="247"/> + <di:waypoint x="593" y="247"/> + </bpmndi:BPMNEdge> + <bpmndi:BPMNEdge id="edge_shape__5A0F59BB-0760-40A9-A889-528D95DEA503_to_shape__98609158-4B3D-4A94-B74B-B7F1A3A5BEA0" bpmnElement="_A4CA7B8A-5F99-4DEE-A703-5F606FCFAA97"> + <di:waypoint x="593" y="247"/> + <di:waypoint x="1028" y="247"/> + </bpmndi:BPMNEdge> + </bpmndi:BPMNPlane> + </bpmndi:BPMNDiagram> + <bpmn2:relationship type="BPSimData"> + <bpmn2:extensionElements> + <bpsim:BPSimData> + <bpsim:Scenario id="default" name="Simulationscenario"> + <bpsim:ScenarioParameters/> + <bpsim:ElementParameters elementRef="_CCEC3FEE-9967-427C-B62C-E1C6584F6F6B"> + <bpsim:TimeParameters> + <bpsim:ProcessingTime> + <bpsim:NormalDistribution mean="0" standardDeviation="0"/> + </bpsim:ProcessingTime> + </bpsim:TimeParameters> + </bpsim:ElementParameters> + <bpsim:ElementParameters elementRef="_5A0F59BB-0760-40A9-A889-528D95DEA503"> + <bpsim:TimeParameters> + <bpsim:ProcessingTime> + <bpsim:NormalDistribution mean="0" standardDeviation="0"/> + </bpsim:ProcessingTime> + </bpsim:TimeParameters> + <bpsim:ResourceParameters> + <bpsim:Availability> + <bpsim:FloatingParameter value="0"/> + </bpsim:Availability> + <bpsim:Quantity> + <bpsim:FloatingParameter value="0"/> + </bpsim:Quantity> + </bpsim:ResourceParameters> + <bpsim:CostParameters> + <bpsim:UnitCost> + <bpsim:FloatingParameter value="0"/> + </bpsim:UnitCost> + </bpsim:CostParameters> + </bpsim:ElementParameters> + </bpsim:Scenario> + </bpsim:BPSimData> + </bpmn2:extensionElements> + <bpmn2:source>_nCB7kIl5EDmizbwd8_oqEQ</bpmn2:source> + <bpmn2:target>_nCB7kIl5EDmizbwd8_oqEQ</bpmn2:target> + </bpmn2:relationship> +</bpmn2:definitions> +` \ No newline at end of file diff --git a/packages/kie-editors-standalone/it-tests/src/pages/widDefinitions.js b/packages/kie-editors-standalone/it-tests/src/pages/widDefinitions.js index 9931a2f99e..c05afab4da 100644 --- a/packages/kie-editors-standalone/it-tests/src/pages/widDefinitions.js +++ b/packages/kie-editors-standalone/it-tests/src/pages/widDefinitions.js @@ -2,10 +2,24 @@ export const customWorkItemWid = ` [ [ "name" : "CreateCustomer", + "version" : "1.0.0", + "documentation" : "Calls internal service that creates the customer in database server.", + "displayName" : "Create Customer Internal Service", "parameters" : [ - "in_customer_id" : new StringDataType() + "in_customer_id" : new StringDataType(), + "in_customer_level_id" : new IntegerDataType(), + "in_customer_initial_balance" : new FloatDataType(), + "in_customer_level_label" : new EnumDataType(), + "in_customer_roles" : new ListDataType(), + "in_security_token" : new ObjectDataType(), + "in_message" : new UndefinedDataType(), ], - "displayName" : "Create Customer", - "icon" : "defaultemailicon.gif" + "parameterValues" : [ + "in_customer_id" : "MrIncognito", + ], + "results" : [ + "out_operation_success" : new BooleanDataType() + ], + "icon" : "defaultemailicon.gif", ] ]`; diff --git a/packages/kie-editors-standalone/it-tests/src/util/ResourcesHolder.ts b/packages/kie-editors-standalone/it-tests/src/util/ResourcesHolder.ts index e02beb0ea4..ef1d0c3d29 100644 --- a/packages/kie-editors-standalone/it-tests/src/util/ResourcesHolder.ts +++ b/packages/kie-editors-standalone/it-tests/src/util/ResourcesHolder.ts @@ -14,21 +14,15 @@ * limitations under the License. */ -import { ContentType } from "@kogito-tooling/channel-common-api/dist"; +import { ContentType, ResourceContent } from "@kogito-tooling/channel-common-api/dist"; export interface ResourcesHolderItem { name: string; - value: Resource; + value: ResourceContent; } - -export interface Resource { - contentType: ContentType; - content: Promise<string>; -} - export class ResourcesHolder { - public resources: Map<string, Resource>; - constructor(res?: Map<string, Resource>) { + public resources: Map<string, ResourceContent>; + constructor(res?: Map<string, ResourceContent>) { if (res) { this.resources = res; } else { @@ -51,10 +45,14 @@ export class ResourcesHolder { }; public loadFile(file: File, onResourceChanged?: () => void): ResourcesHolder { const name: string = file.name; - this.addFile( - { name, value: { contentType: ContentType.TEXT, content: this.readUploadedFileAsText(file) } }, - onResourceChanged - ); + let fileContent; + this.readUploadedFileAsText(file).then((result) => { + fileContent = result; + this.addFile( + { name, value: { path: name, type: ContentType.TEXT, content: result} }, + onResourceChanged + ); + }); return this; } public addFile(resource: ResourcesHolderItem, onResourceChanged?: () => void): ResourcesHolder { @@ -66,4 +64,4 @@ export class ResourcesHolder { public removeFile(file: ResourcesHolderItem): void { this.resources.delete(file.name); } -} +} \ No newline at end of file --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
