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