Skip to content

Commit

Permalink
test(drilldown): re-structure specs + verify additional cases
Browse files Browse the repository at this point in the history
  • Loading branch information
nikku committed May 29, 2024
1 parent 5e1dd8d commit b3fdbdf
Show file tree
Hide file tree
Showing 5 changed files with 118 additions and 25 deletions.
95 changes: 78 additions & 17 deletions test/spec/features/drilldown/DrilldownSpec.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import {
} from 'test/TestHelper';

import coreModule from 'lib/core';
import DrilldownModule from 'lib/features/drilldown';
import drilldownModule from 'lib/features/drilldown';
import modelingModule from 'lib/features/modeling';
import { bootstrapModeler, getBpmnJS } from '../../../helper';
import { classes } from 'min-dom';
Expand All @@ -14,7 +14,7 @@ describe('features - drilldown', function() {
var testModules = [
coreModule,
modelingModule,
DrilldownModule
drilldownModule
];

var collaborationXML = require('./collaboration-subprocesses.bpmn');
Expand Down Expand Up @@ -537,32 +537,93 @@ describe('features/drilldown - integration', function() {

var testModules = [
coreModule,
DrilldownModule
modelingModule,
drilldownModule
];

var missingDiXML = require('./missing-di-bpmndiagram-plane.bpmn');
var workingXML = require('./nested-subprocesses.bpmn');

var multiLayerXML = require('./nested-subprocesses.bpmn');
beforeEach(bootstrapModeler(workingXML, { modules: testModules }));

beforeEach(bootstrapModeler(multiLayerXML, { modules: testModules }));

describe('error handling - should handle broken DI', function() {

const subprocessMissingDi_XML = require('./subprocess-missing-di.bpmn');
const subprocessMissingBpmnDiagram_XML = require('./subprocess-missing-bpmndiagram.bpmn');
const processMissingBpmnDiagram_XML = require('./process-missing-bpmndiagram.bpmn');

describe('error handling', function() {
const planeMissingBpmnElement_XML = require('./plane-missing-bpmnelement.bpmn');
const diagramMissingPlane_XML = require('./diagram-missing-plane.bpmn');

it('should import diagram with missing BPMNDiagram#plane', inject(
async function(bpmnjs) {

let error;
async function importXML(xml) {
const bpmnJS = getBpmnJS();

try {
await bpmnjs.importXML(missingDiXML);
} catch (_error) {
error = _error;
}
let result;

expect(error).not.to.exist;
try {
result = await bpmnJS.importXML(xml);
} catch (error) {
result = {
error,
warnings: error.warnings
};
}
));

return result;
}


it('no <bpmndi:BPMNDiagram#plane />', async function() {

const {
error,
warnings
} = await importXML(diagramMissingPlane_XML);

// then
expect(error).not.to.exist;
expect(warnings).to.be.empty;
});


it('no <bpmndi:BPMNPlane#bpmnElement />', async function() {

const {
error,
warnings
} = await importXML(planeMissingBpmnElement_XML);

// then
expect(error).not.to.exist;
expect(warnings).to.be.empty;
});


it('no <bpmndi:BPMNShape /> for sub process', async function() {

const {
error,
warnings
} = await importXML(subprocessMissingDi_XML);

// then
expect(error).not.to.exist;
expect(warnings).to.be.empty;
});


it('no <bpmndi:BPMNDiagram /> for sub process', async function() {

const {
error,
warnings
} = await importXML(subprocessMissingBpmnDiagram_XML);

// then
expect(error).not.to.exist;
expect(warnings).to.be.empty;
});

});

Expand Down
10 changes: 10 additions & 0 deletions test/spec/features/drilldown/diagram-missing-plane.bpmn
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
<?xml version="1.0" encoding="UTF-8"?>
<bpmn:definitions xmlns:bpmn="http://www.omg.org/spec/BPMN/20100524/MODEL" xmlns:bpmndi="http://www.omg.org/spec/BPMN/20100524/DI" xmlns:dc="http://www.omg.org/spec/DD/20100524/DC" xmlns:modeler="http://camunda.org/schema/modeler/1.0" id="DEFINITIONS" targetNamespace="http://bpmn.io/schema/bpmn" exporter="Camunda Modeler" exporterVersion="5.12.0" modeler:executionPlatform="Camunda Platform" modeler:executionPlatformVersion="7.19.0">
<bpmn:process id="PROCESS" isExecutable="true">
</bpmn:process>
<bpmndi:BPMNDiagram id="BPMNDiagram_1">
<bpmndi:BPMNPlane id="BPMNPlane_1" bpmnElement="PROCESS"></bpmndi:BPMNPlane>
</bpmndi:BPMNDiagram>
<bpmndi:BPMNDiagram id="BPMNDiagram_2">
</bpmndi:BPMNDiagram>
</bpmn:definitions>
11 changes: 11 additions & 0 deletions test/spec/features/drilldown/plane-missing-bpmnelement.bpmn
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
<?xml version="1.0" encoding="UTF-8"?>
<bpmn:definitions xmlns:bpmn="http://www.omg.org/spec/BPMN/20100524/MODEL" xmlns:bpmndi="http://www.omg.org/spec/BPMN/20100524/DI" xmlns:dc="http://www.omg.org/spec/DD/20100524/DC" xmlns:modeler="http://camunda.org/schema/modeler/1.0" id="DEFINITIONS" targetNamespace="http://bpmn.io/schema/bpmn" exporter="Camunda Modeler" exporterVersion="5.12.0" modeler:executionPlatform="Camunda Platform" modeler:executionPlatformVersion="7.19.0">
<bpmn:process id="PROCESS" isExecutable="true">
</bpmn:process>
<bpmndi:BPMNDiagram id="BPMNDiagram_1">
<bpmndi:BPMNPlane id="BPMNPlane_1" bpmnElement="PROCESS"></bpmndi:BPMNPlane>
</bpmndi:BPMNDiagram>
<bpmndi:BPMNDiagram id="BPMNDiagram_2">
<bpmndi:BPMNPlane id="BPMNPlane_2"></bpmndi:BPMNPlane>
</bpmndi:BPMNDiagram>
</bpmn:definitions>
Original file line number Diff line number Diff line change
@@ -1,17 +1,13 @@
<?xml version="1.0" encoding="UTF-8"?>
<bpmn:definitions xmlns:bpmn="http://www.omg.org/spec/BPMN/20100524/MODEL" xmlns:bpmndi="http://www.omg.org/spec/BPMN/20100524/DI" xmlns:dc="http://www.omg.org/spec/DD/20100524/DC" xmlns:modeler="http://camunda.org/schema/modeler/1.0" id="DEFINITIONS" targetNamespace="http://bpmn.io/schema/bpmn" exporter="Camunda Modeler" exporterVersion="5.23.0" modeler:executionPlatform="Camunda Platform" modeler:executionPlatformVersion="7.21.0">
<bpmn:definitions xmlns:bpmn="http://www.omg.org/spec/BPMN/20100524/MODEL" xmlns:bpmndi="http://www.omg.org/spec/BPMN/20100524/DI" xmlns:dc="http://www.omg.org/spec/DD/20100524/DC" xmlns:modeler="http://camunda.org/schema/modeler/1.0" id="DEFINITIONS" targetNamespace="http://bpmn.io/schema/bpmn" exporter="Camunda Modeler" exporterVersion="5.12.0" modeler:executionPlatform="Camunda Platform" modeler:executionPlatformVersion="7.19.0">
<bpmn:process id="PROCESS" isExecutable="true">
<bpmn:subProcess id="SUB_PROCESS">
<bpmn:subProcess id="SUB_PROCESS_NESTED_NO_DI" />
</bpmn:subProcess>
<bpmn:subProcess id="SUB_PROCESS"></bpmn:subProcess>
</bpmn:process>
<bpmndi:BPMNDiagram id="BPMNDiagram_1">
<bpmndi:BPMNPlane id="BPMNPlane_1" bpmnElement="PROCESS">
<bpmndi:BPMNShape id="SUB_PROCESS_di" bpmnElement="SUB_PROCESS" isExpanded="false">
<dc:Bounds x="355" y="160" width="100" height="80" />
<dc:Bounds x="160" y="90" width="100" height="80" />
</bpmndi:BPMNShape>
</bpmndi:BPMNPlane>
</bpmndi:BPMNDiagram>
<bpmndi:BPMNDiagram id="BPMNDiagram_2">
</bpmndi:BPMNDiagram>
</bpmn:definitions>
</bpmn:definitions>
15 changes: 15 additions & 0 deletions test/spec/features/drilldown/subprocess-missing-di.bpmn
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
<?xml version="1.0" encoding="UTF-8"?>
<bpmn:definitions xmlns:bpmn="http://www.omg.org/spec/BPMN/20100524/MODEL" xmlns:bpmndi="http://www.omg.org/spec/BPMN/20100524/DI" xmlns:dc="http://www.omg.org/spec/DD/20100524/DC" xmlns:modeler="http://camunda.org/schema/modeler/1.0" id="DEFINITIONS" targetNamespace="http://bpmn.io/schema/bpmn" exporter="Camunda Modeler" exporterVersion="5.12.0" modeler:executionPlatform="Camunda Platform" modeler:executionPlatformVersion="7.19.0">
<bpmn:process id="PROCESS" isExecutable="true">
<bpmn:subProcess id="SUB_PROCESS_NO_DI">
</bpmn:subProcess>
</bpmn:process>
<bpmndi:BPMNDiagram id="BPMNDiagram_1">
<bpmndi:BPMNPlane id="BPMNPlane_1" bpmnElement="PROCESS">
</bpmndi:BPMNPlane>
</bpmndi:BPMNDiagram>
<bpmndi:BPMNDiagram id="BPMNDiagram_2">
<bpmndi:BPMNPlane id="BPMNPlane_2" bpmnElement="SUB_PROCESS_NO_DI">
</bpmndi:BPMNPlane>
</bpmndi:BPMNDiagram>
</bpmn:definitions>

0 comments on commit b3fdbdf

Please sign in to comment.