some cleanup of the tests w/ burnettk
This commit is contained in:
parent
2a15c5e004
commit
882f5b6472
|
@ -11,9 +11,9 @@ import {
|
|||
// findInput,
|
||||
findSelect,
|
||||
findTextarea,
|
||||
findButtonByClass,
|
||||
pressButton,
|
||||
findDivByClass,
|
||||
// findButtonByClass,
|
||||
// pressButton,
|
||||
// findDivByClass,
|
||||
} from './helpers';
|
||||
import spiffModdleExtension from '../../app/spiffworkflow/moddle/spiffworkflow.json';
|
||||
import messages from '../../app/spiffworkflow/messages';
|
||||
|
@ -45,23 +45,25 @@ describe('Messages should work', function () {
|
|||
// THEN - a select Data Object section should appear in the properties panel
|
||||
const entry = findGroupEntry('correlation_keys', container);
|
||||
expect(entry).to.exist;
|
||||
await expectSelected('my_collaboration');
|
||||
});
|
||||
|
||||
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;
|
||||
const sendShape = await expectSelected('ActivitySendLetter');
|
||||
expect(sendShape, "Can't find Send Task").to.exist;
|
||||
|
||||
// THEN - a select Data Object section should appear in the properties panel
|
||||
const entry = findGroupEntry('messages', container);
|
||||
expect(entry, "Can't find the message group in the properties panel").to
|
||||
.exist;
|
||||
await expectSelected('my_collaboration');
|
||||
});
|
||||
|
||||
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;
|
||||
const sendShape = await expectSelected('ActivitySendLetter');
|
||||
expect(sendShape, "Can't find Send Task").to.exist;
|
||||
|
||||
// THEN - there are two options to choose from.
|
||||
const entry = findEntry('selectMessage', container);
|
||||
|
@ -71,12 +73,13 @@ describe('Messages should work', function () {
|
|||
const selector = findSelect(entry);
|
||||
expect(selector).to.exist;
|
||||
expect(selector.length).to.equal(2);
|
||||
await expectSelected('my_collaboration');
|
||||
});
|
||||
|
||||
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;
|
||||
const sendShape = await expectSelected('ActivitySendLetter');
|
||||
expect(sendShape, "Can't find Send Task").to.exist;
|
||||
|
||||
// THEN - there is a payload.
|
||||
const payload = findEntry('messagePayload', container);
|
||||
|
@ -89,29 +92,30 @@ describe('Messages should work', function () {
|
|||
expect(textArea, "Can't find the payload textarea").to.exist;
|
||||
expect(textArea.value, "Can't find payload value").to.exist;
|
||||
expect(textArea.value).to.include("'to': { 'name': my_lover_variable }");
|
||||
await expectSelected('my_collaboration');
|
||||
});
|
||||
|
||||
it('should show the correlations 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;
|
||||
const sendShape = await expectSelected('ActivitySendLetter');
|
||||
expect(sendShape, "Can't find Send Task").to.exist;
|
||||
|
||||
// THEN - there are correlations.
|
||||
const correlations = findGroupEntry('messageCorrelations', container);
|
||||
const correlations = findGroupEntry('correlationProperties', container);
|
||||
expect(correlations, "Can't find the message correlations").to.exist;
|
||||
await expectSelected('my_collaboration');
|
||||
});
|
||||
|
||||
// it('should add a new correlation when clicked', async function () {
|
||||
// // Select the second Task
|
||||
// const send_shape = await expectSelected('ActivitySendLetter');
|
||||
// expect(send_shape, "Can't find Send Task").to.exist;
|
||||
// const sendShape = await expectSelected('ActivitySendLetter');
|
||||
// expect(sendShape, "Can't find Send Task").to.exist;
|
||||
//
|
||||
// const buttonClass =
|
||||
// 'bio-properties-panel-group-header-button bio-properties-panel-add-entry';
|
||||
// const button = findButtonByClass(buttonClass, container);
|
||||
// pressButton(button);
|
||||
//
|
||||
// console.log(button);
|
||||
// });
|
||||
//
|
||||
// it('should add a new Correlation Key when clicked', async function () {
|
||||
|
|
|
@ -1,31 +1,30 @@
|
|||
import {
|
||||
query as domQuery,
|
||||
} from 'min-dom';
|
||||
import { query as domQuery } from 'min-dom';
|
||||
import { act, fireEvent } from '@testing-library/preact';
|
||||
|
||||
import {
|
||||
getBpmnJS,
|
||||
bootstrapBpmnJS,
|
||||
inject,
|
||||
insertCSS,
|
||||
} from 'bpmn-js/test/helper';
|
||||
import Modeler from 'bpmn-js/lib/Modeler';
|
||||
import TestContainer from 'mocha-test-container-support';
|
||||
import { bootstrapBpmnJS, inject, insertCSS } from 'bpmn-js/test/helper';
|
||||
import {getBusinessObject} from 'bpmn-js/lib/util/ModelUtil';
|
||||
import {createMoveEvent} from 'diagram-js/lib/features/mouse/Mouse';
|
||||
import { getBusinessObject } from 'bpmn-js/lib/util/ModelUtil';
|
||||
import { createMoveEvent } from 'diagram-js/lib/features/mouse/Mouse';
|
||||
|
||||
export let PROPERTIES_PANEL_CONTAINER;
|
||||
export let CONTAINER;
|
||||
|
||||
export function bootstrapPropertiesPanel(diagram, options, locals) {
|
||||
return async function() {
|
||||
let container = options.container;
|
||||
CONTAINER = container;
|
||||
return async function () {
|
||||
let { container } = options;
|
||||
if (!container) {
|
||||
container = TestContainer.get(this);
|
||||
}
|
||||
CONTAINER = container;
|
||||
|
||||
insertBpmnStyles();
|
||||
insertCoreStyles();
|
||||
|
||||
const createModeler = bootstrapBpmnJS(Modeler, diagram, options, locals);
|
||||
await act(() => createModeler.call(this));
|
||||
|
||||
|
@ -33,7 +32,7 @@ export function bootstrapPropertiesPanel(diagram, options, locals) {
|
|||
clearPropertiesPanelContainer();
|
||||
|
||||
// (3) attach properties panel
|
||||
const attachPropertiesPanel = inject(function(propertiesPanel) {
|
||||
const attachPropertiesPanel = inject(function (propertiesPanel) {
|
||||
PROPERTIES_PANEL_CONTAINER = document.createElement('div');
|
||||
PROPERTIES_PANEL_CONTAINER.classList.add('properties-container');
|
||||
|
||||
|
@ -56,10 +55,7 @@ export function insertCoreStyles() {
|
|||
'properties-panel.css',
|
||||
require('bpmn-js-properties-panel/dist/assets/properties-panel.css').default
|
||||
);
|
||||
insertCSS(
|
||||
'test.css',
|
||||
require('./test.css').default
|
||||
);
|
||||
insertCSS('test.css', require('./test.css').default);
|
||||
}
|
||||
|
||||
export function insertBpmnStyles() {
|
||||
|
@ -69,10 +65,7 @@ export function insertBpmnStyles() {
|
|||
);
|
||||
|
||||
// @barmac: this fails before bpmn-js@9
|
||||
insertCSS(
|
||||
'bpmn-js.css',
|
||||
require('bpmn-js/dist/assets/bpmn-js.css').default
|
||||
);
|
||||
insertCSS('bpmn-js.css', require('bpmn-js/dist/assets/bpmn-js.css').default);
|
||||
|
||||
insertCSS(
|
||||
'bpmn-font.css',
|
||||
|
@ -80,10 +73,8 @@ export function insertBpmnStyles() {
|
|||
);
|
||||
}
|
||||
|
||||
|
||||
|
||||
export function expectSelected(id) {
|
||||
return getBpmnJS().invoke(async function(elementRegistry, selection) {
|
||||
return getBpmnJS().invoke(async function (elementRegistry, selection) {
|
||||
const element = elementRegistry.get(id);
|
||||
|
||||
await act(() => {
|
||||
|
@ -98,29 +89,28 @@ export function getPropertiesPanel() {
|
|||
return PROPERTIES_PANEL_CONTAINER;
|
||||
}
|
||||
|
||||
|
||||
export function findEntry(id, container) {
|
||||
return domQuery(`[data-entry-id='${ id }']`, container);
|
||||
return domQuery(`[data-entry-id='${id}']`, container);
|
||||
}
|
||||
|
||||
export function findGroupEntry(id, container) {
|
||||
return domQuery(`[data-group-id='group-${ id }']`, container);
|
||||
return domQuery(`[data-group-id='group-${id}']`, container);
|
||||
}
|
||||
|
||||
export function findInput(type, container) {
|
||||
return domQuery(`input[type='${ type }']`, container);
|
||||
return domQuery(`input[type='${type}']`, container);
|
||||
}
|
||||
|
||||
export function findTextarea(id, container) {
|
||||
return domQuery(`textarea[id='${ id }']`, container);
|
||||
return domQuery(`textarea[id='${id}']`, container);
|
||||
}
|
||||
|
||||
export function findButton(id, container) {
|
||||
return domQuery(`button[id='${ id }']`, container);
|
||||
return domQuery(`button[id='${id}']`, container);
|
||||
}
|
||||
|
||||
export function findButtonByClass(buttonClass, container) {
|
||||
return domQuery(`button[class='${ buttonClass }']`, container)
|
||||
return domQuery(`button[class='${buttonClass}']`, container);
|
||||
}
|
||||
|
||||
export function findSelect(container) {
|
||||
|
@ -136,23 +126,19 @@ export function pressButton(button) {
|
|||
}
|
||||
|
||||
export function findDivByClass(divClass, container) {
|
||||
return domQuery(`div[class='${ divClass }']`, container)
|
||||
return domQuery(`div[class='${divClass}']`, container);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Drags an element from the palette onto the canvas.
|
||||
* @param id
|
||||
*/
|
||||
export function triggerPaletteEntry(id) {
|
||||
getBpmnJS().invoke(function(palette) {
|
||||
var entry = palette.getEntries()[ id ];
|
||||
getBpmnJS().invoke(function (palette) {
|
||||
const entry = palette.getEntries()[id];
|
||||
|
||||
if (entry && entry.action && entry.action.click) {
|
||||
entry.action.click(createMoveEvent(0, 0));
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue