diff --git a/test/e2e/ExpectModelUtils.ts b/test/e2e/ExpectModelUtils.ts index 32435a1ac0..f7f1c83f57 100644 --- a/test/e2e/ExpectModelUtils.ts +++ b/test/e2e/ExpectModelUtils.ts @@ -18,7 +18,7 @@ import { FlowKind } from '../../src/model/bpmn/internal/edge/FlowKind'; import { MessageVisibleKind } from '../../src/model/bpmn/internal/edge/MessageVisibleKind'; import { SequenceFlowKind } from '../../src/model/bpmn/internal/edge/SequenceFlowKind'; import BpmnVisualization from '../../src/component/BpmnVisualization'; -import { toBeCell, withGeometry, withFont, toBeSequenceFlow, toBeMessageFlow, toBeAssociationFlow, toBeShape, toBeCallActivity } from './matchers'; +import { toBeCell, withGeometry, withFont, toBeSequenceFlow, toBeMessageFlow, toBeAssociationFlow, toBeShape, toBeCallActivity, toBeTask } from './matchers'; declare global { // eslint-disable-next-line @typescript-eslint/no-namespace @@ -32,6 +32,7 @@ declare global { toBeAssociationFlow(modelElement: ExpectedEdgeModelElement): R; toBeShape(modelElement: ExpectedShapeModelElement): R; toBeCallActivity(modelElement: ExpectedShapeModelElement): R; + toBeTask(modelElement: ExpectedShapeModelElement): R; } } } @@ -45,6 +46,7 @@ expect.extend({ toBeAssociationFlow, toBeShape, toBeCallActivity, + toBeTask, }); export interface ExpectedFont { diff --git a/test/e2e/matchers/index.ts b/test/e2e/matchers/index.ts index 4833dcb309..80c5c75ad0 100644 --- a/test/e2e/matchers/index.ts +++ b/test/e2e/matchers/index.ts @@ -14,7 +14,7 @@ * limitations under the License. */ export { toBeSequenceFlow, toBeMessageFlow, toBeAssociationFlow } from './toBeEdge'; -export { toBeShape, toBeCallActivity } from './toBeShape'; +export { toBeShape, toBeCallActivity, toBeTask } from './toBeShape'; export { toBeCell } from './toBeCell'; export { withGeometry } from './withGeometry'; export { withFont } from './withFont'; diff --git a/test/e2e/matchers/toBeShape/index.ts b/test/e2e/matchers/toBeShape/index.ts index 0d4ff04966..bcb0748e8f 100644 --- a/test/e2e/matchers/toBeShape/index.ts +++ b/test/e2e/matchers/toBeShape/index.ts @@ -65,3 +65,7 @@ export function toBeShape(this: MatcherContext, received: string, expected: Expe export function toBeCallActivity(this: MatcherContext, received: string, expected: ExpectedShapeModelElement): CustomMatcherResult { return buildCellMatcher('toBeCallActivity', this, received, { ...expected, kind: ShapeBpmnElementKind.CALL_ACTIVITY }, 'Shape', buildExpectedCell); } + +export function toBeTask(this: MatcherContext, received: string, expected: ExpectedShapeModelElement): CustomMatcherResult { + return buildCellMatcher('toBeTask', this, received, { ...expected, kind: ShapeBpmnElementKind.TASK }, 'Shape', buildExpectedCell); +} diff --git a/test/e2e/mxGraph.model.test.ts b/test/e2e/mxGraph.model.test.ts index a3386e1b86..becd3527bd 100644 --- a/test/e2e/mxGraph.model.test.ts +++ b/test/e2e/mxGraph.model.test.ts @@ -730,27 +730,23 @@ describe('mxGraph model', () => { // activity // Task - expect('task_id').toBeShape({ kind: ShapeBpmnElementKind.TASK, label: 'Task', parentId: 'participant_1_id' }); - expect('task_with_loop_id').toBeShape({ - kind: ShapeBpmnElementKind.TASK, + expect('task_id').toBeTask({ label: 'Task', parentId: 'participant_1_id' }); + expect('task_with_loop_id').toBeTask({ label: 'Task With Loop', markers: [ShapeBpmnMarkerKind.LOOP], parentId: 'participant_1_id', }); - expect('task_with_sequential_multi_instance_id').toBeShape({ - kind: ShapeBpmnElementKind.TASK, + expect('task_with_sequential_multi_instance_id').toBeTask({ label: 'Task With Sequential Multi-instance', markers: [ShapeBpmnMarkerKind.MULTI_INSTANCE_SEQUENTIAL], parentId: 'participant_1_id', }); - expect('task_with_parallel_multi_instance_id').toBeShape({ - kind: ShapeBpmnElementKind.TASK, + expect('task_with_parallel_multi_instance_id').toBeTask({ label: 'Task With Parallel Multi-instance', markers: [ShapeBpmnMarkerKind.MULTI_INSTANCE_PARALLEL], parentId: 'participant_1_id', }); - expect('task_with_flows_id').toBeShape({ - kind: ShapeBpmnElementKind.TASK, + expect('task_with_flows_id').toBeTask({ font: { isBold: false, isItalic: false,