-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Deleting messages and changing message properties was not possible if…
… correlation key reused between messages (#125) * avoid error when message ref doesn't exist on correlation property (rare, but ran into it). When deleting an object with a message, be aware that you might be deeply nested in other things. * MatchingConditionArray, TaskEventMessageProvider.js - fixing the ids of div elements to make them easier to find in tests. MessageHelpers - And added a deleteMessage function that will remove a message AND it's correlation properties. (The reason I came here) MessageHelpers, MessageInterceptor.js - fixing the misspelled name of syncCorrelationProperties. MessageCorrSpec tests that when you update a message through a message editor, it will correctly update the correlation properties, and not leave invalid properties lying around. MessageSelect - will now remove the old message definition (including correlation properties), and replace it with the new message definition when a message is returned from the message editor. As we do this when we receive a new message,there is no need for the cleanupOldMessage function when selecting a different message. MessageSpec - a hell of a time with this. "spiffExtensionOptions" is a constant that I could not seem to clear out between differest spec file tests. I finally resorted to creating a "clearMessages" function that would force the list of messages to get cleared out when needed. Co-authored-by: burnettk Co-authored-by: jasquat * forgot a test file in last commit. * fixing a minor error. * Update test/spec/MessagesSpec.js Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com> * Update test/spec/MessagesSpec.js Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com> --------- Co-authored-by: Kevin Burnett <18027+burnettk@users.noreply.github.com> Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com>
- Loading branch information
1 parent
e8b5073
commit 74db55f
Showing
9 changed files
with
244 additions
and
60 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,92 @@ | ||
import TestContainer from 'mocha-test-container-support'; | ||
import { | ||
query as domQuery, | ||
queryAll as domQueryAll, | ||
} from 'min-dom'; | ||
import { | ||
BpmnPropertiesPanelModule, | ||
BpmnPropertiesProviderModule, | ||
} from 'bpmn-js-properties-panel'; | ||
import { | ||
bootstrapPropertiesPanel, | ||
expectSelected, | ||
findEntry, | ||
findGroupEntry, | ||
findSelect, | ||
findTextarea, | ||
findInput, | ||
pressButton, | ||
findButtonByClass, | ||
getPropertiesPanel, | ||
changeInput, | ||
findDivByClass | ||
} from './helpers'; | ||
import spiffModdleExtension from '../../app/spiffworkflow/moddle/spiffworkflow.json'; | ||
import messages from '../../app/spiffworkflow/messages'; | ||
import { fireEvent } from '@testing-library/preact'; | ||
import { getBpmnJS, inject } from 'bpmn-js/test/helper'; | ||
import { findCorrelationProperties, findMessageModdleElements } from '../../app/spiffworkflow/messages/MessageHelpers'; | ||
import {spiffExtensionOptions} from "../../app/spiffworkflow/extensions/propertiesPanel/SpiffExtensionSelect"; | ||
|
||
describe('Multiple messages should work', function () { | ||
const xml = require('./bpmn/two_messages.bpmn').default; | ||
let container; | ||
|
||
beforeEach(function () { | ||
container = TestContainer.get(this); | ||
}); | ||
|
||
beforeEach( | ||
bootstrapPropertiesPanel(xml, { | ||
container, | ||
debounceInput: false, | ||
additionalModules: [ | ||
messages, | ||
BpmnPropertiesPanelModule, | ||
BpmnPropertiesProviderModule, | ||
], | ||
moddleExtensions: { | ||
spiffworkflow: spiffModdleExtension, | ||
}, | ||
}) | ||
); | ||
|
||
|
||
const new_message_event = (eventBus) => { | ||
eventBus.fire('spiff.add_message.returned', { | ||
elementId: "ActivityA", | ||
name: "messageA", | ||
correlation_properties: | ||
{ "new_name": { retrieval_expression: "new_exp" }} | ||
}); | ||
}; | ||
|
||
|
||
it('and it should be possible to change a correlation property name', async function () { | ||
const modeler = getBpmnJS(); | ||
|
||
const sendShape = await expectSelected('ActivityA'); | ||
expect(sendShape, "Can't find Send Task").to.exist; | ||
|
||
const oldName = "old_name" | ||
const newName = "new_name" | ||
|
||
const labels = domQueryAll(`.bio-properties-panel-label`, container); | ||
const oldNameFound = Array.from(labels).some(label => label.textContent.includes(oldName)); | ||
expect(oldNameFound).to.be.true; | ||
|
||
//Update message | ||
new_message_event(modeler.get('eventBus')) | ||
const sendShape2 = await expectSelected('ActivityA'); | ||
|
||
// The old name should no longer be there, but the new name should exist. | ||
const labels2 = domQueryAll(`.bio-properties-panel-label`, container); | ||
const oldNameFound2 = Array.from(labels2).some(label => label.textContent.includes(oldName)); | ||
expect(oldNameFound2).to.be.false; | ||
const newNameFound2 = Array.from(labels2).some(label => label.textContent.includes(newName)); | ||
expect(newNameFound2).to.be.true; | ||
|
||
|
||
}); | ||
|
||
}); |
Oops, something went wrong.