@wdio/image-comparison-core 1.1.3 → 1.1.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +16 -0
- package/dist/base.d.ts +2 -2
- package/dist/base.d.ts.map +1 -1
- package/dist/base.js +1 -5
- package/dist/base.test.js +4 -6
- package/dist/helpers/utils.d.ts +4 -0
- package/dist/helpers/utils.d.ts.map +1 -1
- package/dist/helpers/utils.js +10 -4
- package/dist/helpers/utils.test.js +89 -2
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,21 @@
|
|
|
1
1
|
# @wdio/image-comparison-core
|
|
2
2
|
|
|
3
|
+
## 1.1.4
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- 0a19d78: Fix `clearRuntimeFolder` clearing the actual and diff folders after each spec/feature execution instead of once before all workers start. This caused only the last spec's visual data to be present in the output when running multiple specs.
|
|
8
|
+
|
|
9
|
+
# Committers: 1
|
|
10
|
+
|
|
11
|
+
- Wim Selles ([@wswebcreation](https://github.com/wswebcreation))
|
|
12
|
+
|
|
13
|
+
- ce74703: Stop creating empty diff folders when no visual differences exist. The diff directory is now only created on disk when a diff image is actually saved, instead of being eagerly created during path preparation. Fixes #879.
|
|
14
|
+
|
|
15
|
+
# Committers: 1
|
|
16
|
+
|
|
17
|
+
- Wim Selles ([@wswebcreation](https://github.com/wswebcreation))
|
|
18
|
+
|
|
3
19
|
## 1.1.3
|
|
4
20
|
|
|
5
21
|
### Patch Changes
|
package/dist/base.d.ts
CHANGED
|
@@ -11,8 +11,8 @@ export default class BaseClass {
|
|
|
11
11
|
private _setupFolders;
|
|
12
12
|
/**
|
|
13
13
|
* Clear the runtime folders (actual and diff)
|
|
14
|
-
* @
|
|
14
|
+
* @protected
|
|
15
15
|
*/
|
|
16
|
-
|
|
16
|
+
protected _clearRuntimeFolders(): void;
|
|
17
17
|
}
|
|
18
18
|
//# sourceMappingURL=base.d.ts.map
|
package/dist/base.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"base.d.ts","sourceRoot":"","sources":["../src/base.ts"],"names":[],"mappings":"AAKA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,sBAAsB,CAAA;AACnD,OAAO,KAAK,EAAE,YAAY,EAAE,cAAc,EAAE,MAAM,iCAAiC,CAAA;AAInF,MAAM,CAAC,OAAO,OAAO,SAAS;IAC1B,cAAc,EAAE,cAAc,CAAA;IAC9B,OAAO,EAAE,OAAO,CAAA;gBAEJ,OAAO,EAAE,YAAY;
|
|
1
|
+
{"version":3,"file":"base.d.ts","sourceRoot":"","sources":["../src/base.ts"],"names":[],"mappings":"AAKA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,sBAAsB,CAAA;AACnD,OAAO,KAAK,EAAE,YAAY,EAAE,cAAc,EAAE,MAAM,iCAAiC,CAAA;AAInF,MAAM,CAAC,OAAO,OAAO,SAAS;IAC1B,cAAc,EAAE,cAAc,CAAA;IAC9B,OAAO,EAAE,OAAO,CAAA;gBAEJ,OAAO,EAAE,YAAY;IAQjC;;;OAGG;IACH,OAAO,CAAC,aAAa;IAgBrB;;;OAGG;IACH,SAAS,CAAC,oBAAoB,IAAI,IAAI;CAiBzC"}
|
package/dist/base.js
CHANGED
|
@@ -12,10 +12,6 @@ export default class BaseClass {
|
|
|
12
12
|
this.defaultOptions = defaultOptions(options);
|
|
13
13
|
// Setup folder structure
|
|
14
14
|
this.folders = this._setupFolders(options);
|
|
15
|
-
// Clear runtime folders if requested
|
|
16
|
-
if (options.clearRuntimeFolder) {
|
|
17
|
-
this._clearRuntimeFolders();
|
|
18
|
-
}
|
|
19
15
|
}
|
|
20
16
|
/**
|
|
21
17
|
* Setup the folder structure for screenshots
|
|
@@ -36,7 +32,7 @@ export default class BaseClass {
|
|
|
36
32
|
}
|
|
37
33
|
/**
|
|
38
34
|
* Clear the runtime folders (actual and diff)
|
|
39
|
-
* @
|
|
35
|
+
* @protected
|
|
40
36
|
*/
|
|
41
37
|
_clearRuntimeFolders() {
|
|
42
38
|
log.info('\x1b[33m\n##############################\n!!CLEARING RUNTIME FOLDERS!!\n##############################\x1b[0m');
|
package/dist/base.test.js
CHANGED
|
@@ -35,11 +35,9 @@ describe('BaseClass', () => {
|
|
|
35
35
|
expect(instance.folders.baselineFolder).toBe('functional/baseline');
|
|
36
36
|
expect(instance.folders.actualFolder).toContain('functional/screenshots');
|
|
37
37
|
});
|
|
38
|
-
it('
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
new BaseClass(options);
|
|
43
|
-
expect(rmSync).toHaveBeenCalledTimes(2);
|
|
38
|
+
it('should not clear runtime folders in the constructor - clearing should only happen once in the launcher (issue #683)', () => {
|
|
39
|
+
vi.mocked(rmSync).mockClear();
|
|
40
|
+
new BaseClass({ clearRuntimeFolder: true });
|
|
41
|
+
expect(rmSync).not.toHaveBeenCalled();
|
|
44
42
|
});
|
|
45
43
|
});
|
package/dist/helpers/utils.d.ts
CHANGED
|
@@ -2,6 +2,10 @@ import type { BaseExecuteCompareOptions, BuildBaseExecuteCompareOptionsOptions,
|
|
|
2
2
|
import type { ClassOptions, CompareOptions } from './options.interfaces.js';
|
|
3
3
|
import type { DeviceRectangles } from '../methods/rectangles.interfaces.js';
|
|
4
4
|
import type { BaseDimensions } from '../base.interfaces.js';
|
|
5
|
+
/**
|
|
6
|
+
* Resolve the folder path without creating it on disk
|
|
7
|
+
*/
|
|
8
|
+
export declare function getPath(folder: string, options: GetAndCreatePathOptions): string;
|
|
5
9
|
/**
|
|
6
10
|
* Get and create a folder
|
|
7
11
|
*/
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../src/helpers/utils.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EACR,yBAAyB,EACzB,qCAAqC,EACrC,yBAAyB,EACzB,oBAAoB,EACpB,mBAAmB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AAS,EAAE,OAAO,EAAE,GAAG,EAAE,MAAM,EAAE,KAAK,EAAE,CAAC,GAAG,MAAM,CAAC,MAAM,EAAE,CAAC,CAAC,GAAG,EAAE,CAE9G;AAED;;GAEG;AACH,wBAAgB,mBAAmB,CAAC,gBAAgB,EAAE,GAAG,GAAG,OAAO,CAElE;AAED;;GAEG;AACH,wBAAgB,2BAA2B,CACvC,OAAO,EAAE,kCAAkC,GAC5C,oBAAoB,CA6BtB;AAED;;GAEG;AACH,wBAAgB,kBAAkB,CAC9B,OAAO,EAAE,yBAAyB,GACnC,aAAa,CAcf;AAED;;GAEG;AACH,wBAAgB,8BAA8B,CAC1C,OAAO,EAAE,qCAAqC,GAC/C,yBAAyB,CAyC3B;AAED;;GAEG;AACH,wBAAgB,0BAA0B,CAAC,OAAO,EAAE,iCAAiC,GAAG,mBAAmB,CA2B1G"}
|
package/dist/helpers/utils.js
CHANGED
|
@@ -7,13 +7,19 @@ import { injectWebviewOverlay } from '../clientSideScripts/injectWebviewOverlay.
|
|
|
7
7
|
import { getMobileWebviewClickAndDimensions } from '../clientSideScripts/getMobileWebviewClickAndDimensions.js';
|
|
8
8
|
const log = logger('@wdio/visual-service:@wdio/image-comparison-core:utils');
|
|
9
9
|
/**
|
|
10
|
-
*
|
|
10
|
+
* Resolve the folder path without creating it on disk
|
|
11
11
|
*/
|
|
12
|
-
export function
|
|
12
|
+
export function getPath(folder, options) {
|
|
13
13
|
const { browserName = NOT_KNOWN, deviceName = NOT_KNOWN, isMobile, savePerInstance, } = options;
|
|
14
14
|
const instanceName = (isMobile ? deviceName : `${DESKTOP}_${browserName}`).replace(/ /g, '_');
|
|
15
15
|
const subFolder = savePerInstance ? instanceName : '';
|
|
16
|
-
|
|
16
|
+
return join(folder, subFolder);
|
|
17
|
+
}
|
|
18
|
+
/**
|
|
19
|
+
* Get and create a folder
|
|
20
|
+
*/
|
|
21
|
+
export function getAndCreatePath(folder, options) {
|
|
22
|
+
const folderName = getPath(folder, options);
|
|
17
23
|
mkdirSync(folderName, { recursive: true });
|
|
18
24
|
return folderName;
|
|
19
25
|
}
|
|
@@ -553,7 +559,7 @@ export function prepareComparisonFilePaths(options) {
|
|
|
553
559
|
const createFolderOptions = { browserName, deviceName, isMobile, savePerInstance };
|
|
554
560
|
const actualFolderPath = getAndCreatePath(actualFolder, createFolderOptions);
|
|
555
561
|
const baselineFolderPath = getAndCreatePath(baselineFolder, createFolderOptions);
|
|
556
|
-
const diffFolderPath =
|
|
562
|
+
const diffFolderPath = getPath(diffFolder, createFolderOptions);
|
|
557
563
|
const actualFilePath = join(actualFolderPath, fileName);
|
|
558
564
|
const baselineFilePath = join(baselineFolderPath, fileName);
|
|
559
565
|
const diffFilePath = join(diffFolderPath, fileName);
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { describe, it, expect, beforeEach, afterEach, vi } from 'vitest';
|
|
2
|
-
import { existsSync } from 'node:fs';
|
|
2
|
+
import { existsSync, mkdirSync } from 'node:fs';
|
|
3
3
|
import { join } from 'node:path';
|
|
4
4
|
vi.mock('node:fs', async () => {
|
|
5
5
|
const actual = await vi.importActual('node:fs');
|
|
@@ -10,7 +10,7 @@ vi.mock('node:fs', async () => {
|
|
|
10
10
|
};
|
|
11
11
|
});
|
|
12
12
|
import logger from '@wdio/logger';
|
|
13
|
-
import { buildBaseExecuteCompareOptions, buildFolderOptions, calculateDprData, canUseBidiScreenshot, checkAndroidChromeDriverScreenshot, checkAndroidNativeWebScreenshot, checkTestInBrowser, checkTestInMobileBrowser, createConditionalProperty, executeNativeClick, extractCommonCheckVariables, formatFileName, getAddressBarShadowPadding, getAndCreatePath, getBase64ScreenshotSize, getBooleanOption, getDevicePixelRatio, getIosBezelImageNames, getMethodOrWicOption, getMobileScreenSize, getMobileViewPortPosition, getToolBarShadowPadding, hasResizeDimensions, isObject, isStorybook, loadBase64Html, logAllDeprecatedCompareOptions, updateVisualBaseline, } from './utils.js';
|
|
13
|
+
import { buildBaseExecuteCompareOptions, buildFolderOptions, calculateDprData, canUseBidiScreenshot, checkAndroidChromeDriverScreenshot, checkAndroidNativeWebScreenshot, checkTestInBrowser, checkTestInMobileBrowser, createConditionalProperty, executeNativeClick, extractCommonCheckVariables, formatFileName, getAddressBarShadowPadding, getAndCreatePath, getBase64ScreenshotSize, getBooleanOption, getDevicePixelRatio, getIosBezelImageNames, getMethodOrWicOption, getMobileScreenSize, getMobileViewPortPosition, getPath, getToolBarShadowPadding, hasResizeDimensions, isObject, isStorybook, loadBase64Html, logAllDeprecatedCompareOptions, prepareComparisonFilePaths, updateVisualBaseline, } from './utils.js';
|
|
14
14
|
import { IMAGE_STRING } from '../mocks/image.js';
|
|
15
15
|
import { DEVICE_RECTANGLES } from './constants.js';
|
|
16
16
|
import { getMobileWebviewClickAndDimensions } from '../clientSideScripts/getMobileWebviewClickAndDimensions.js';
|
|
@@ -93,6 +93,93 @@ describe('utils', () => {
|
|
|
93
93
|
expect(existsSync(folder)).toMatchSnapshot();
|
|
94
94
|
});
|
|
95
95
|
});
|
|
96
|
+
describe('getPath', () => {
|
|
97
|
+
const folder = join(process.cwd(), '/.tmp/utils');
|
|
98
|
+
it('should return the folder path for a mobile device with savePerInstance', () => {
|
|
99
|
+
const options = {
|
|
100
|
+
browserName: '',
|
|
101
|
+
deviceName: 'deviceName',
|
|
102
|
+
isMobile: true,
|
|
103
|
+
savePerInstance: true,
|
|
104
|
+
};
|
|
105
|
+
expect(getPath(folder, options)).toEqual(join(folder, options.deviceName));
|
|
106
|
+
});
|
|
107
|
+
it('should return the folder path for a desktop browser with savePerInstance', () => {
|
|
108
|
+
const options = {
|
|
109
|
+
browserName: 'browser',
|
|
110
|
+
deviceName: '',
|
|
111
|
+
isMobile: false,
|
|
112
|
+
savePerInstance: true,
|
|
113
|
+
};
|
|
114
|
+
expect(getPath(folder, options)).toEqual(join(folder, `desktop_${options.browserName}`));
|
|
115
|
+
});
|
|
116
|
+
it('should return the base folder when savePerInstance is false', () => {
|
|
117
|
+
const options = {
|
|
118
|
+
browserName: 'browser',
|
|
119
|
+
deviceName: '',
|
|
120
|
+
isMobile: false,
|
|
121
|
+
savePerInstance: false,
|
|
122
|
+
};
|
|
123
|
+
expect(getPath(folder, options)).toEqual(folder);
|
|
124
|
+
});
|
|
125
|
+
it('should not create any directories on disk', () => {
|
|
126
|
+
vi.mocked(mkdirSync).mockClear();
|
|
127
|
+
const options = {
|
|
128
|
+
browserName: 'chrome',
|
|
129
|
+
deviceName: '',
|
|
130
|
+
isMobile: false,
|
|
131
|
+
savePerInstance: true,
|
|
132
|
+
};
|
|
133
|
+
getPath(folder, options);
|
|
134
|
+
expect(mkdirSync).not.toHaveBeenCalled();
|
|
135
|
+
});
|
|
136
|
+
});
|
|
137
|
+
describe('prepareComparisonFilePaths', () => {
|
|
138
|
+
beforeEach(() => {
|
|
139
|
+
vi.mocked(mkdirSync).mockClear();
|
|
140
|
+
});
|
|
141
|
+
it('should create actual and baseline folders but not the diff folder', () => {
|
|
142
|
+
const options = {
|
|
143
|
+
actualFolder: '/tmp/actual',
|
|
144
|
+
baselineFolder: '/tmp/baseline',
|
|
145
|
+
diffFolder: '/tmp/diff',
|
|
146
|
+
browserName: 'chrome',
|
|
147
|
+
deviceName: '',
|
|
148
|
+
isMobile: false,
|
|
149
|
+
savePerInstance: false,
|
|
150
|
+
fileName: 'test.png',
|
|
151
|
+
};
|
|
152
|
+
const result = prepareComparisonFilePaths(options);
|
|
153
|
+
expect(result.actualFolderPath).toEqual('/tmp/actual');
|
|
154
|
+
expect(result.baselineFolderPath).toEqual('/tmp/baseline');
|
|
155
|
+
expect(result.diffFolderPath).toEqual('/tmp/diff');
|
|
156
|
+
expect(result.actualFilePath).toEqual(join('/tmp/actual', 'test.png'));
|
|
157
|
+
expect(result.baselineFilePath).toEqual(join('/tmp/baseline', 'test.png'));
|
|
158
|
+
expect(result.diffFilePath).toEqual(join('/tmp/diff', 'test.png'));
|
|
159
|
+
const mkdirCalls = vi.mocked(mkdirSync).mock.calls.map(call => call[0]);
|
|
160
|
+
expect(mkdirCalls).toContain('/tmp/actual');
|
|
161
|
+
expect(mkdirCalls).toContain('/tmp/baseline');
|
|
162
|
+
expect(mkdirCalls).not.toContain('/tmp/diff');
|
|
163
|
+
});
|
|
164
|
+
it('should include instance subfolder in paths when savePerInstance is true', () => {
|
|
165
|
+
const options = {
|
|
166
|
+
actualFolder: '/tmp/actual',
|
|
167
|
+
baselineFolder: '/tmp/baseline',
|
|
168
|
+
diffFolder: '/tmp/diff',
|
|
169
|
+
browserName: 'chrome',
|
|
170
|
+
deviceName: '',
|
|
171
|
+
isMobile: false,
|
|
172
|
+
savePerInstance: true,
|
|
173
|
+
fileName: 'test.png',
|
|
174
|
+
};
|
|
175
|
+
const result = prepareComparisonFilePaths(options);
|
|
176
|
+
expect(result.actualFolderPath).toEqual(join('/tmp/actual', 'desktop_chrome'));
|
|
177
|
+
expect(result.baselineFolderPath).toEqual(join('/tmp/baseline', 'desktop_chrome'));
|
|
178
|
+
expect(result.diffFolderPath).toEqual(join('/tmp/diff', 'desktop_chrome'));
|
|
179
|
+
const mkdirCalls = vi.mocked(mkdirSync).mock.calls.map(call => call[0]);
|
|
180
|
+
expect(mkdirCalls).not.toContain(join('/tmp/diff', 'desktop_chrome'));
|
|
181
|
+
});
|
|
182
|
+
});
|
|
96
183
|
describe('formatFileName', () => {
|
|
97
184
|
const formatFileOptions = {
|
|
98
185
|
browserName: '',
|
package/package.json
CHANGED