setting up some basic tests - just to assure things are working correctly.
This commit is contained in:
parent
8a244e5dc9
commit
228478426b
|
@ -12,6 +12,5 @@ const bpmnModeler = new BpmnModeler({
|
|||
moddleExtensions: {}
|
||||
});
|
||||
|
||||
|
||||
// import XML
|
||||
bpmnModeler.importXML(diagramXML).then(() => {})
|
||||
bpmnModeler.importXML(diagramXML).then(() => {});
|
||||
|
|
|
@ -0,0 +1,48 @@
|
|||
'use strict';
|
||||
|
||||
module.exports = function(karma) {
|
||||
karma.set({
|
||||
|
||||
frameworks: [
|
||||
'browserify',
|
||||
'mocha',
|
||||
'sinon-chai'
|
||||
],
|
||||
|
||||
files: [
|
||||
'test/spec/**/*Spec.js',
|
||||
],
|
||||
|
||||
reporters: [ 'dots' ],
|
||||
|
||||
preprocessors: {
|
||||
'test/spec/**/*Spec.js': [ 'browserify' ]
|
||||
},
|
||||
|
||||
browsers: [ 'Chrome'],
|
||||
|
||||
browserNoActivityTimeout: 30000,
|
||||
|
||||
singleRun: true,
|
||||
autoWatch: false,
|
||||
|
||||
// browserify configuration
|
||||
browserify: {
|
||||
debug: true,
|
||||
transform: [
|
||||
[ 'babelify', {
|
||||
global: true,
|
||||
babelrc: false,
|
||||
presets: [ 'env' ]
|
||||
} ],
|
||||
[ 'stringify', {
|
||||
global: true,
|
||||
extensions: [
|
||||
'.bpmn',
|
||||
'.css'
|
||||
]
|
||||
} ]
|
||||
]
|
||||
}
|
||||
});
|
||||
};
|
File diff suppressed because it is too large
Load Diff
22
package.json
22
package.json
|
@ -3,13 +3,14 @@
|
|||
"version": "0.0.0",
|
||||
"description": "Extensions and modifications of BPMN.js to improve BPMN development for SpiffWorkflow",
|
||||
"scripts": {
|
||||
"all": "run-s lint build",
|
||||
"all": "run-s lint test build",
|
||||
"build": "webpack --mode production",
|
||||
"build:watch": "webpack --watch",
|
||||
"dev": "run-p build:watch serve",
|
||||
"serve": "sirv public --dev",
|
||||
"lint": "eslint .",
|
||||
"start": "run-s build serve"
|
||||
"start": "run-s build serve",
|
||||
"test": "karma start karma.conf.js"
|
||||
},
|
||||
"repository": {
|
||||
"type": "git",
|
||||
|
@ -31,18 +32,35 @@
|
|||
],
|
||||
"license": "MIT",
|
||||
"devDependencies": {
|
||||
"@types/mocha": "^9.1.1",
|
||||
"babel-core": "^6.26.3",
|
||||
"babel-preset-env": "^1.7.0",
|
||||
"babelify": "^8.0.0",
|
||||
"browserify": "^17.0.0",
|
||||
"chai": "^4.3.6",
|
||||
"copy-webpack-plugin": "^11.0.0",
|
||||
"eslint": "^7.32.0",
|
||||
"eslint-plugin-bpmn-io": "^0.13.0",
|
||||
"karma": "^6.3.4",
|
||||
"karma-browserify": "^8.1.0",
|
||||
"karma-chrome-launcher": "^3.1.1",
|
||||
"karma-mocha": "^2.0.1",
|
||||
"karma-sinon-chai": "^2.0.2",
|
||||
"mocha": "^10.0.0",
|
||||
"mocha-test-container-support": "^0.2.0",
|
||||
"npm-run-all": "^4.1.5",
|
||||
"raw-loader": "^4.0.2",
|
||||
"sinon": "^14.0.0",
|
||||
"sinon-chai": "^3.7.0",
|
||||
"sirv-cli": "^2.0.2",
|
||||
"stringify": "^5.2.0",
|
||||
"webpack": "^5.73.0",
|
||||
"webpack-cli": "^4.9.2"
|
||||
},
|
||||
"dependencies": {
|
||||
"bpmn-js": "^9.2.0",
|
||||
"diagram-js": "^8.5.0",
|
||||
"inherits": "^2.0.4",
|
||||
"min-dash": "^3.8.1"
|
||||
}
|
||||
}
|
||||
|
|
|
@ -0,0 +1,3 @@
|
|||
{
|
||||
"extends": "plugin:bpmn-io/mocha"
|
||||
}
|
|
@ -0,0 +1,73 @@
|
|||
import TestContainer from 'mocha-test-container-support';
|
||||
import Modeler from 'bpmn-js/lib/Modeler';
|
||||
import spiffworkflow from '../../app/spiffworkflow';
|
||||
import coreModule from 'bpmn-js/lib/core';
|
||||
import createModule from 'diagram-js/lib/features/create';
|
||||
import modelingModule from 'bpmn-js/lib/features/modeling';
|
||||
import paletteModule from 'bpmn-js/lib/features/palette';
|
||||
|
||||
import {
|
||||
setBpmnJS,
|
||||
clearBpmnJS,
|
||||
} from 'bpmn-js/test/helper';
|
||||
import {
|
||||
query as domQuery,
|
||||
queryAll as domQueryAll
|
||||
} from 'min-dom';
|
||||
|
||||
describe('BPMN Input / Output', function() {
|
||||
|
||||
let container;
|
||||
let modeler;
|
||||
|
||||
beforeEach(function() {
|
||||
container = TestContainer.get(this);
|
||||
});
|
||||
|
||||
function createModeler(xml) {
|
||||
|
||||
clearBpmnJS();
|
||||
let testModules = [
|
||||
coreModule,
|
||||
createModule,
|
||||
modelingModule,
|
||||
paletteModule
|
||||
];
|
||||
|
||||
modeler = new Modeler({
|
||||
container: container,
|
||||
modules: testModules,
|
||||
propertiesPanel: {
|
||||
parent: container,
|
||||
},
|
||||
additionalModules: [ spiffworkflow ]
|
||||
});
|
||||
|
||||
setBpmnJS(modeler);
|
||||
|
||||
return modeler.importXML(xml).then(function(result) {
|
||||
return { error: null, warnings: result.warnings, modeler: modeler };
|
||||
}).catch(function(err) {
|
||||
return { error: err, warnings: err.warnings, modeler: modeler };
|
||||
});
|
||||
}
|
||||
|
||||
it('should open diagram', function() {
|
||||
let xml = require('./diagram.bpmn');
|
||||
return createModeler(xml).then(function(result) {
|
||||
expect(result.error).not.to.exist;
|
||||
});
|
||||
});
|
||||
|
||||
|
||||
it('should have a data input and data output in the properties panel', function() {
|
||||
let xml = require('./diagram.bpmn');
|
||||
return createModeler(xml).then(function(result) {
|
||||
expect(result.error).not.to.exist;
|
||||
var paletteElement = domQuery('.djs-palette', container);
|
||||
var entries = domQueryAll('.entry', paletteElement);
|
||||
expect(entries[11].title).to.equals('Create DataInput');
|
||||
expect(entries[12].title).to.equals('Create DataOutput');
|
||||
});
|
||||
});
|
||||
});
|
|
@ -0,0 +1,69 @@
|
|||
<?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:di="http://www.omg.org/spec/DD/20100524/DI" xmlns:modeler="http://camunda.org/schema/modeler/1.0" id="Definitions_19o7vxg" targetNamespace="http://bpmn.io/schema/bpmn" exporter="Camunda Modeler" exporterVersion="5.0.0" modeler:executionPlatform="Camunda Platform" modeler:executionPlatformVersion="7.17.0">
|
||||
<bpmn:process id="Process_1mzevep" isExecutable="true">
|
||||
<bpmn:ioSpecification>
|
||||
<bpmn:dataInput id="ID_3" name="num_dogs" />
|
||||
<bpmn:dataOutput id="ID_5" name="happy_index" />
|
||||
</bpmn:ioSpecification>
|
||||
<bpmn:startEvent id="StartEvent_1">
|
||||
<bpmn:outgoing>Flow_1mezzcx</bpmn:outgoing>
|
||||
</bpmn:startEvent>
|
||||
<bpmn:endEvent id="Event_14wzv4j">
|
||||
<bpmn:incoming>Flow_0q4oys2</bpmn:incoming>
|
||||
</bpmn:endEvent>
|
||||
<bpmn:sequenceFlow id="Flow_01jg677" sourceRef="Activity_15zz6ya" targetRef="Activity_0hv5ukl" />
|
||||
<bpmn:sequenceFlow id="Flow_1mezzcx" sourceRef="StartEvent_1" targetRef="Activity_15zz6ya" />
|
||||
<bpmn:manualTask id="Activity_15zz6ya" name="eat hot dog">
|
||||
<bpmn:incoming>Flow_1mezzcx</bpmn:incoming>
|
||||
<bpmn:outgoing>Flow_01jg677</bpmn:outgoing>
|
||||
<bpmn:standardLoopCharacteristics />
|
||||
</bpmn:manualTask>
|
||||
<bpmn:sequenceFlow id="Flow_0q4oys2" sourceRef="Activity_0hv5ukl" targetRef="Event_14wzv4j" />
|
||||
<bpmn:serviceTask id="Activity_0hv5ukl" name="calculate contentment">
|
||||
<bpmn:incoming>Flow_01jg677</bpmn:incoming>
|
||||
<bpmn:outgoing>Flow_0q4oys2</bpmn:outgoing>
|
||||
</bpmn:serviceTask>
|
||||
</bpmn:process>
|
||||
<bpmndi:BPMNDiagram id="BPMNDiagram_1">
|
||||
<bpmndi:BPMNPlane id="BPMNPlane_1" bpmnElement="Process_1mzevep">
|
||||
<bpmndi:BPMNShape id="dataInput_1" bpmnElement="ID_3">
|
||||
<dc:Bounds x="179" y="85" width="36" height="50" />
|
||||
<bpmndi:BPMNLabel>
|
||||
<dc:Bounds x="172" y="135" width="52" height="14" />
|
||||
</bpmndi:BPMNLabel>
|
||||
</bpmndi:BPMNShape>
|
||||
<bpmndi:BPMNShape id="dataInput_2" bpmnElement="ID_5">
|
||||
<dc:Bounds x="582" y="85" width="36" height="50" />
|
||||
<bpmndi:BPMNLabel>
|
||||
<dc:Bounds x="569" y="142" width="63" height="14" />
|
||||
</bpmndi:BPMNLabel>
|
||||
</bpmndi:BPMNShape>
|
||||
<bpmndi:BPMNEdge id="Flow_1mezzcx_di" bpmnElement="Flow_1mezzcx">
|
||||
<di:waypoint x="215" y="197" />
|
||||
<di:waypoint x="280" y="197" />
|
||||
</bpmndi:BPMNEdge>
|
||||
<bpmndi:BPMNEdge id="Flow_01jg677_di" bpmnElement="Flow_01jg677">
|
||||
<di:waypoint x="380" y="197" />
|
||||
<di:waypoint x="420" y="197" />
|
||||
</bpmndi:BPMNEdge>
|
||||
<bpmndi:BPMNEdge id="Flow_0q4oys2_di" bpmnElement="Flow_0q4oys2">
|
||||
<di:waypoint x="520" y="197" />
|
||||
<di:waypoint x="582" y="197" />
|
||||
</bpmndi:BPMNEdge>
|
||||
<bpmndi:BPMNShape id="_BPMNShape_StartEvent_2" bpmnElement="StartEvent_1">
|
||||
<dc:Bounds x="179" y="179" width="36" height="36" />
|
||||
</bpmndi:BPMNShape>
|
||||
<bpmndi:BPMNShape id="Event_14wzv4j_di" bpmnElement="Event_14wzv4j">
|
||||
<dc:Bounds x="582" y="179" width="36" height="36" />
|
||||
</bpmndi:BPMNShape>
|
||||
<bpmndi:BPMNShape id="Activity_1cu44y8_di" bpmnElement="Activity_0hv5ukl">
|
||||
<dc:Bounds x="420" y="157" width="100" height="80" />
|
||||
<bpmndi:BPMNLabel />
|
||||
</bpmndi:BPMNShape>
|
||||
<bpmndi:BPMNShape id="Activity_0t7iwfm_di" bpmnElement="Activity_15zz6ya">
|
||||
<dc:Bounds x="280" y="157" width="100" height="80" />
|
||||
<bpmndi:BPMNLabel />
|
||||
</bpmndi:BPMNShape>
|
||||
</bpmndi:BPMNPlane>
|
||||
</bpmndi:BPMNDiagram>
|
||||
</bpmn:definitions>
|
Loading…
Reference in New Issue