import TestContainer from 'mocha-test-container-support'; import { bootstrapPropertiesPanel, expectSelected, findEntry, findGroupEntry, findInput, findSelect, findTextarea } from './helpers'; import { BpmnPropertiesPanelModule, BpmnPropertiesProviderModule } from 'bpmn-js-properties-panel'; import spiffModdleExtension from '../../app/spiffworkflow/moddle/spiffworkflow.json'; import messages from '../../app/spiffworkflow/messages'; describe('Messages should work', function() { let xml = require('./bpmn/collaboration.bpmn').default; let container; beforeEach(function() { container = TestContainer.get(this); }); beforeEach(bootstrapPropertiesPanel(xml, { container, debounceInput: false, additionalModules: [ messages, BpmnPropertiesPanelModule, BpmnPropertiesProviderModule, ], moddleExtensions: { spiffworkflow: spiffModdleExtension }, })); it('should allow you to see the collaborations section', async function() { // THEN - a select Data Object section should appear in the properties panel let entry = findGroupEntry('correlation_keys', container); expect(entry).to.exist; }); it('should show a Message Properties group when a send task is selected',async function() { // Select the send Task const send_shape = await expectSelected('ActivitySendLetter'); expect(send_shape, "Can't find Send Task").to.exist; // THEN - a select Data Object section should appear in the properties panel let entry = findGroupEntry('messages', container); expect(entry, "Can't find the message group in the properties panel").to.exist; }); it('should show a list of messages in a drop down inside the message group',async function() { // Select the send Task const send_shape = await expectSelected('ActivitySendLetter'); expect(send_shape, "Can't find Send Task").to.exist; // THEN - there are two options to choose from. let entry = findEntry('selectMessage', container); expect(entry, "Can't find the message select list").to.exist; // AND - There should be two entries in it, one for each message. let selector = findSelect(entry); expect(selector).to.exist; expect(selector.length).to.equal(2); }); it('should show the payload inside the message group',async function() { // Select the second Task const send_shape = await expectSelected('ActivitySendLetter'); expect(send_shape, "Can't find Send Task").to.exist; // THEN - there is a payload. let payload = findEntry('messagePayload', container); expect(payload, "Can't find the message payload").to.exist; let textArea = findTextarea('bio-properties-panel-messagePayload', container); expect(textArea, "Can't find the payload text").to.exist; expect(textArea.innerHTML, "Can't find innerHTML").to.exist; console.log('innerHTML', textArea.innerHTML); }); });