process-analytics / bpmn-visualization-js

A TypeScript library for visualizing process execution data on BPMN diagrams
https://process-analytics.github.io/bpmn-visualization-js/
Apache License 2.0
224 stars 30 forks source link

test(e2e): restore report generation and fix location of received images #3145

Closed tbouffard closed 2 months ago

tbouffard commented 2 months ago

When an test failure occurred, the report was not generated and the development server did not stop at the end of the test execution. This was due to our custom function toMatchImageSnapshot becoming asynchronous in commit bffd25b. The original function is synchronous, so the custom function must be too.

In addition to this fix, the logic of the code managing image attachments has been improved, mainly to better separate responsibilities. Storing the expected image copy and calculating the image location are specific to j-i-s, so there's no need to do this. to j-i-s, and are therefore performed first. The function for attaching images to the report only uses the previously calculated image location and is unaware that j-i-s is being used.

For tests that redefined the location of output images (usually in a subfolder), the path to the received images was not updated accordingly. It was stored in the same location for each test, so only one file was kept and not stored with the diff and the expected image.

Also regenerate the image for the “subprocess.03.collapsed.with.elements” test.

Notes

First detection of problems fixed in this PR:

Error reproductions and progressive fix with the "overlays" e2e tests

Command run: DEBUG=bv:test:jest:img npm run test:e2e -- --runTestsByPath test/e2e/overlays.rendering.test.ts

Examples of reports generated with all tests involving "custom received directory"

tbouffard commented 2 months ago

ℹ️ Converted to draft to take the time to integrate review feedback.

sonarcloud[bot] commented 2 months ago

Quality Gate Passed Quality Gate passed

Issues
0 New issues
0 Accepted issues

Measures
0 Security Hotspots
0.0% Coverage on New Code
0.0% Duplication on New Code

See analysis details on SonarCloud