bpmn-io / bpmn-auto-layout

Layout BPMN diagrams, generating missing DI information.
https://bpmn-io.github.io/bpmn-auto-layout/
52 stars 41 forks source link

Introduce snapshot testing #66

Closed philippfromme closed 2 months ago

philippfromme commented 2 months ago

Proposed Changes

Allows us to easily compare before and after for the defined test cases. Could be added to the CI so the CI only passes once all snapshots pass meaning you either haven't changed the algorithm or you did and you updated the snapshots.

brave_jawCRplABm

### Checklist To ensure you provided everything we need to look at your PR: * [x] **Brief textual description** of the changes present * [x] **Visual demo** attached * [ ] **Steps to try out** present, i.e. [using the `@bpmn-io/sr` tool](https://github.com/bpmn-io/sr) * [ ] Related issue linked via `Closes {LINK_TO_ISSUE}` or `Related to {LINK_TO_ISSUE}`
nikku commented 2 months ago

Let's get this incorporated soonish, in order to test the other open PRs.

philippfromme commented 2 months ago

I'll get this PR ready.

barmac commented 2 months ago

@philippfromme looks that we need to make sure our snapshots are initially valid.

philippfromme commented 2 months ago

@barmac Thought I'd done that 🙈

abdul99ahad commented 2 months ago

Some of the test cases are not showing in the left panel. image

philippfromme commented 2 months ago

Some of the test cases are not showing in the left panel.

This is because the original diagram doesn't contain any graphical information. While the use case of the library is to create missing graphical information for the snapshot tests it's actually more convinient to have a diagram with graphical information. The library will then simply replace that. I'll update the diagrams that have no DI.

philippfromme commented 2 months ago

I updated the diagrams without DI and also added an error indication if the import fails completely. Should be clearer now.

brave_kVlMfV6NoR

philippfromme commented 2 months ago

Ready for review.

abdul99ahad commented 2 months ago

Ready for review.

Looks good to me 🚀

nikku commented 2 months ago

Updated with a minor hint regarding test updates:

image