Skip to content

Commit 8d1dab2

Browse files
committed
Merge branch 'master' into deps/lodash-es
2 parents 3729e7d + 12e06e4 commit 8d1dab2

11 files changed

Lines changed: 326 additions & 270 deletions

package-lock.json

Lines changed: 248 additions & 245 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "bpmn-visualization",
3-
"version": "0.34.0-post",
3+
"version": "0.34.1-post",
44
"description": "A TypeScript library for visualizing process execution data on BPMN diagrams",
55
"keywords": [
66
"typescript",
@@ -101,23 +101,23 @@
101101
"strnum": "1.0.5"
102102
},
103103
"devDependencies": {
104-
"@microsoft/api-extractor": "~7.34.4",
105-
"@rollup/plugin-commonjs": "~24.1.0",
104+
"@microsoft/api-extractor": "~7.34.9",
105+
"@rollup/plugin-commonjs": "~25.0.0",
106106
"@rollup/plugin-node-resolve": "~15.0.2",
107107
"@rollup/plugin-terser": "~0.4.1",
108108
"@types/debug": "~4.1.7",
109109
"@types/jest-image-snapshot": "~6.1.0",
110110
"@types/lodash-es": "~4.17.7",
111111
"@types/minimist": "~1.2.2",
112-
"@typescript-eslint/eslint-plugin": "~5.59.1",
113-
"@typescript-eslint/parser": "~5.59.1",
112+
"@typescript-eslint/eslint-plugin": "~5.59.6",
113+
"@typescript-eslint/parser": "~5.59.6",
114114
"asciidoctor": "~2.2.6",
115115
"autoprefixer": "~10.4.14",
116116
"clipboardy": "~3.0.0",
117117
"cross-env": "~7.0.3",
118-
"cssnano": "~6.0.0",
118+
"cssnano": "~6.0.1",
119119
"debug": "~4.3.4",
120-
"eslint": "~8.39.0",
120+
"eslint": "~8.40.0",
121121
"eslint-config-prettier": "~8.8.0",
122122
"eslint-plugin-jest": "~27.2.1",
123123
"eslint-plugin-notice": "~0.9.10",
@@ -138,20 +138,20 @@
138138
"minimist": "~1.2.8",
139139
"npm-run-all": "~4.1.5",
140140
"pinst": "~3.0.0",
141-
"playwright": "~1.30.0",
141+
"playwright": "~1.33.0",
142142
"postcss": "~8.4.23",
143143
"postcss-cli": "~10.1.0",
144144
"prettier": "~2.8.8",
145145
"rimraf": "~5.0.0",
146-
"rollup": "~3.21.2",
147-
"rollup-plugin-node-externals": "~5.1.2",
146+
"rollup": "~3.21.8",
147+
"rollup-plugin-node-externals": "~6.0.1",
148148
"rollup-plugin-sizes": "~1.0.5",
149149
"rollup-plugin-typescript2": "~0.34.1",
150150
"tailwindcss": "~3.3.2",
151151
"ts-jest": "~29.1.0",
152-
"typedoc": "~0.24.6",
152+
"typedoc": "~0.24.7",
153153
"typescript": "~5.0.4",
154-
"vite": "~4.3.4"
154+
"vite": "~4.3.6"
155155
},
156156
"overrides": {
157157
"@types/node": "^16.18.0"

sonar-project.properties

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ sonar.organization=process-analytics
44

55
# This is the name and version displayed in the SonarCloud UI.
66
sonar.projectName=bpmn-visualization
7-
sonar.projectVersion=0.34.0-post
7+
sonar.projectVersion=0.34.1-post
88

99
# Path is relative to the sonar-project.properties file. Replace "\" by "/" on Windows.
1010
sonar.sources=src

src/component/version.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ import { mxgraph } from './mxgraph/initializer';
1818

1919
// WARN: this constant is automatically updated at release time by the 'manage-version-in-files.mjs' script.
2020
// So, if you modify the name of this file or this constant, please update the script accordingly.
21-
const libVersion = '0.34.0-post';
21+
const libVersion = '0.34.1-post';
2222

2323
/**
2424
* @internal

test/config/jest-playwright.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,7 @@ const computeConfigurationForDevServerUsage = defaultBrowsers => {
9090
command: `npm run dev`,
9191
port: 10001,
9292
basePath: '/dev/public/index.html',
93-
// if default or tcp, the test starts right await whereas the dev server is not available on http
93+
// if default or tcp, the test starts right away whereas the dev server is not available on http
9494
// for more details, see https://github.com/process-analytics/bpmn-visualization-js/pull/1056
9595
protocol: 'http',
9696
// high value mainly for GitHub Workflows running on macOS (slow machines) and to build the bundle before start

test/config/jest.image.ts

Lines changed: 20 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -14,13 +14,15 @@ See the License for the specific language governing permissions and
1414
limitations under the License.
1515
*/
1616

17+
import debugLogger from 'debug';
1718
import type { MatchImageSnapshotOptions } from 'jest-image-snapshot';
1819
import { toMatchImageSnapshot } from 'jest-image-snapshot';
19-
import { copyFileSync } from 'node:fs';
2020
import { addAttach } from 'jest-html-reporters/helper';
21+
import { copyFileSync } from 'node:fs';
2122
import MatcherContext = jest.MatcherContext;
2223
import CustomMatcherResult = jest.CustomMatcherResult;
2324

25+
const jestLog = debugLogger('bv:test:jest:img');
2426
const toMatchImageSnapshotWithRealSignature = toMatchImageSnapshot as (received: unknown, options?: MatchImageSnapshotOptions) => CustomMatcherResult;
2527

2628
// The path is relative from the jest-html-reporters page to the folder storing the images
@@ -39,11 +41,15 @@ class RetriesCounter {
3941
private readonly retryTimes = parseInt(global[Symbol.for('RETRY_TIMES')], 10) || 0;
4042

4143
hasReachMaxRetries(testId: unknown): boolean {
42-
return !this.retryTimes || this.timesCalled.get(testId) > this.retryTimes;
44+
return !this.retryTimes || this.getExecutionCount(testId) > this.retryTimes;
4345
}
4446

4547
incrementExecutionCount(testId: unknown): void {
46-
this.timesCalled.set(testId, (this.timesCalled.get(testId) || 0) + 1);
48+
this.timesCalled.set(testId, this.getExecutionCount(testId) + 1);
49+
}
50+
51+
getExecutionCount(testId: unknown): number {
52+
return this.timesCalled.get(testId) ?? 0;
4753
}
4854
}
4955

@@ -108,19 +114,27 @@ function saveAndRegisterImages(matcherContext: MatcherContext, received: Buffer,
108114
// All options properties used here are always set in bpmn-visualization tests
109115
// If the following implementation would be done directly in jest-image-snapshot, this won't be required as it set default values we cannot access here
110116
function toMatchImageSnapshotCustom(this: MatcherContext, received: Buffer, options: MatchImageSnapshotOptions): CustomMatcherResult {
117+
const testId = this.currentTestName;
118+
retriesCounter.incrementExecutionCount(testId);
119+
jestLog("Test: '%s' (test file path: '%s')", this.currentTestName, this.testPath);
120+
const executionCount = retriesCounter.getExecutionCount(testId);
121+
jestLog('Ready to execute toMatchImageSnapshot, execution count: %s', executionCount);
111122
const result = toMatchImageSnapshotWithRealSignature.call(this, received, options);
123+
jestLog('toMatchImageSnapshot executed');
124+
112125
if (!result.pass) {
113-
const testId = this.currentTestName;
114-
retriesCounter.incrementExecutionCount(testId);
126+
jestLog('Result: failure');
115127
if (retriesCounter.hasReachMaxRetries(testId)) {
116128
saveAndRegisterImages(this, received, options);
117129
}
118130

119131
// Add configured failure threshold in the error message
120132
const messages = result.message().split('\n');
121133
// For generalization, check options.failureThresholdType for percentage/pixel
122-
const newMessage = [`${messages[0]} Failure threshold was set to ${options.failureThreshold * 100}%.`, ...messages.slice(1)].join('\n');
134+
const newMessage = [`${messages[0]} Failure threshold was set to ${options.failureThreshold * 100}%. Execution count: ${executionCount}.`, ...messages.slice(1)].join('\n');
123135
result.message = () => newMessage;
136+
} else {
137+
jestLog('Result: success');
124138
}
125139

126140
return result;

test/config/jest.retries.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,4 +19,4 @@ limitations under the License.
1919
import envUtils = require('@test/shared/environment-utils.js');
2020

2121
const onCi = envUtils.isRunningOnCi();
22-
jest.retryTimes(onCi ? 3 : 0);
22+
jest.retryTimes(onCi ? 3 : 0, { logErrorsBeforeRetry: true });

test/e2e/diagram.navigation.zoom.pan.test.ts

Lines changed: 22 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ See the License for the specific language governing permissions and
1414
limitations under the License.
1515
*/
1616

17+
import debugLogger from 'debug';
1718
import 'jest-playwright-preset';
1819
import { join } from 'node:path';
1920
import type { Page } from 'playwright';
@@ -23,6 +24,8 @@ import type { ImageSnapshotThresholdConfig } from './helpers/visu/image-snapshot
2324
import { ImageSnapshotConfigurator, MultiBrowserImageSnapshotThresholds } from './helpers/visu/image-snapshot-config';
2425
import { ZoomType } from '@lib/component/options';
2526

27+
const log = debugLogger('bv:test:e2e:navigation:zoom-pan');
28+
2629
class MouseNavigationImageSnapshotThresholds extends MultiBrowserImageSnapshotThresholds {
2730
constructor() {
2831
super({ chromium: 0.0005 / 100, firefox: 0.04 / 100, webkit: 0 });
@@ -62,23 +65,40 @@ describe('diagram navigation - zoom and pan with mouse', () => {
6265
let containerCenter: Point;
6366

6467
beforeEach(async () => {
68+
log("Start test: '%s' (test file path: '%s')", expect.getState().currentTestName, expect.getState().testPath);
69+
6570
await pageTester.gotoPageAndLoadBpmnDiagram(bpmnDiagramName);
6671
containerCenter = await pageTester.getContainerCenter();
6772
});
73+
afterEach(() => {
74+
log("End test: '%s' (test file path: '%s')", expect.getState().currentTestName, expect.getState().testPath);
75+
});
6876

6977
it('mouse panning', async () => {
78+
log('Starting mouse panning checks');
79+
log('Doing mouse panning');
7080
await pageTester.mousePanning({ originPoint: containerCenter, destinationPoint: { x: containerCenter.x + 150, y: containerCenter.y + 40 } });
81+
log('Mouse panning done');
7182

83+
log('Checking image match');
7284
const image = await page.screenshot({ fullPage: true });
7385
const config = imageSnapshotConfigurator.getConfig(bpmnDiagramName);
7486
expect(image).toMatchImageSnapshot({
7587
...config,
7688
customSnapshotIdentifier: 'mouse.panning',
7789
});
90+
log('Image match OK');
7891
});
7992

80-
describe.each([ZoomType.In, ZoomType.Out])(`ctrl + mouse: zoom %s`, (zoomType: ZoomType) => {
81-
it.each([1, 3])('zoom %s times', async (xTimes: number) => {
93+
describe.each([ZoomType.In, ZoomType.Out])(`ctrl + mouse: zoom [%s]`, (zoomType: ZoomType) => {
94+
beforeEach(() => {
95+
log("Start test: '%s' (test file path: '%s')", expect.getState().currentTestName, expect.getState().testPath);
96+
});
97+
afterEach(() => {
98+
log("End test: '%s' (test file path: '%s')", expect.getState().currentTestName, expect.getState().testPath);
99+
});
100+
101+
it.each([1, 3])('zoom [%s times]', async (xTimes: number) => {
82102
await pageTester.mouseZoom({ x: containerCenter.x + 200, y: containerCenter.y }, zoomType, xTimes);
83103

84104
const image = await page.screenshot({ fullPage: true });

test/e2e/jest.config.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,8 @@ module.exports = {
2424
rootDir: '../..',
2525
roots: ['./test/e2e'],
2626
testMatch: ['**/?(*.)+(spec|test).[t]s'],
27-
testTimeout: 200000,
27+
testTimeout: 100_000,
28+
verbose: false, // if true, report each individual test run with execution time
2829
transform: {
2930
'^.+\\.ts?$': [
3031
'ts-jest',

test/e2e/overlays.rendering.test.ts

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,9 @@ import type { Point } from '@test/shared/visu/bpmn-page-utils';
2525
import { AvailableTestPages, PageTester } from '@test/shared/visu/bpmn-page-utils';
2626
import type { ImageSnapshotThresholdConfig } from './helpers/visu/image-snapshot-config';
2727
import { ImageSnapshotConfigurator, MultiBrowserImageSnapshotThresholds } from './helpers/visu/image-snapshot-config';
28+
import debugLogger from 'debug';
29+
30+
const log = debugLogger('bv:test:e2e:overlays');
2831

2932
class ImageSnapshotThresholds extends MultiBrowserImageSnapshotThresholds {
3033
constructor() {
@@ -320,24 +323,35 @@ describe('Overlay navigation', () => {
320323
const imageSnapshotConfigurator = new ImageSnapshotConfigurator(new OverlayNavigationImageSnapshotThresholds(), 'overlays');
321324

322325
beforeEach(async () => {
326+
log("Start test: '%s' (test file path: '%s')", expect.getState().currentTestName, expect.getState().testPath);
323327
await pageTester.gotoPageAndLoadBpmnDiagram(bpmnDiagramName);
324328
containerCenter = await pageTester.getContainerCenter();
325329

330+
log('Adding overlays');
326331
await pageTester.addOverlays('StartEvent_1', 'bottom-center');
327332
await pageTester.addOverlays('Activity_1', 'middle-right');
328333
await pageTester.addOverlays('Gateway_1', 'top-right');
329334
await pageTester.addOverlays('Flow_1', 'start');
335+
log('Overlays added');
336+
});
337+
afterEach(() => {
338+
log("End test: '%s' (test file path: '%s')", expect.getState().currentTestName, expect.getState().testPath);
330339
});
331340

332341
it('panning', async () => {
342+
log('Starting mouse panning checks');
343+
log('Doing mouse panning');
333344
await pageTester.mousePanning({ originPoint: containerCenter, destinationPoint: { x: containerCenter.x + 150, y: containerCenter.y + 40 } });
345+
log('Mouse panning done');
334346

347+
log('Checking image match');
335348
const image = await page.screenshot({ fullPage: true });
336349
const config = imageSnapshotConfigurator.getConfig(bpmnDiagramName);
337350
expect(image).toMatchImageSnapshot({
338351
...config,
339352
customSnapshotIdentifier: 'panning',
340353
});
354+
log('Image match OK');
341355
});
342356

343357
it(`zoom out`, async () => {

0 commit comments

Comments
 (0)