@wdio/visual-service 4.1.2 → 5.0.0

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 CHANGED
@@ -1,5 +1,68 @@
1
1
  # @wdio/visual-service
2
2
 
3
+ ## 5.0.0
4
+
5
+ ### Major Changes
6
+
7
+ - 66b9f11: # 💥 Breaking
8
+
9
+ This PR replaces Canvas as a dependency with Jimp. This removes the need to use system dependencies and will reduce the number of system dependency errors/issues (node-gyp/canvas and so on). This will, in the end, make the life of our end users way easier due to:
10
+
11
+ - less errors
12
+ - less complex test environments
13
+
14
+ > [!note]
15
+ > Extensive research has been done and we have chosen to "fork" ResembleJS, adjust it by making use of Jimp instead of Canvas and break the browser API because the fork will only be used in a nodejs environment
16
+ > Investigation showed that creating a wrapper would even make it slower, so we went for the breaking change in the API by just replacing Canvas with Jimp
17
+
18
+ > [!important]
19
+ > There is a performance impact where Canvas is around 70% faster than Jimp. This has been measured without using WebdriverIO and only comparing images. When the "old" implementation with WebdriverIO combined with Canvas or Jimp is compared, we hardly see a performance impact.
20
+
21
+ # 🚀 New Features
22
+
23
+ Update the baseline images through the command line by adding the argument `--update-visual-baseline`. This will
24
+
25
+ - automatically copy the actual take screenshot and put it in the baseline folder
26
+ - if there are differences it will let the test pass because the baseline has been updated
27
+
28
+ **Usage:**
29
+
30
+ ```sh
31
+ npm run test.local.desktop --update-visual-baseline
32
+ ```
33
+
34
+ When running logs info/debug mode you will see the following logs added
35
+
36
+ ```logs
37
+ [0-0] ..............
38
+ [0-0] #####################################################################################
39
+ [0-0] INFO:
40
+ [0-0] Updated the actual image to
41
+ [0-0] /Users/wswebcreation/Git/wdio/visual-testing/localBaseline/chromel/demo-chrome-1366x768.png
42
+ [0-0] #####################################################################################
43
+ [0-0] ..........
44
+ ```
45
+
46
+ # 💅 Polish
47
+
48
+ - remove Vitest fix
49
+ - add app images
50
+ - update the build
51
+
52
+ ### Patch Changes
53
+
54
+ - Updated dependencies [66b9f11]
55
+ - webdriver-image-comparison@6.0.0
56
+
57
+ ## 4.1.3
58
+
59
+ ### Patch Changes
60
+
61
+ # 🐛 Bug Fixes
62
+
63
+ - Fixes https://github.com/webdriverio/visual-testing/issues/286
64
+ - Fixes https://github.com/webdriverio/visual-testing/issues/333
65
+
3
66
  ## 4.1.2
4
67
 
5
68
  ### Patch Changes
package/dist/matcher.js CHANGED
@@ -30,13 +30,13 @@ function compareResult(result, expected) {
30
30
  */
31
31
  if (typeof expected === 'number') {
32
32
  return {
33
- pass: result.misMatchPercentage === expected,
34
- message: () => (`Expected image to have a mismatch percentage of ${expected}%, but was ${result.misMatchPercentage}%\n` +
35
- 'Please compare the images manually and update the baseline if the new screenshot is correct.\n' +
33
+ pass: result.misMatchPercentage <= expected,
34
+ message: () => (`Expected image mismatch percentage to be at most ${expected}%, but was ${result.misMatchPercentage}%.\n` +
35
+ 'If this is acceptable, you may need to adjust the threshold or update the baseline image if the changes are intentional.\n' +
36
36
  `\nBaseline: ${result.folders.baseline}\n` +
37
37
  `Actual Screenshot: ${result.folders.actual}\n` +
38
38
  `Difference: ${result.folders.diff}\n` +
39
- '\nSee https://webdriver.io/docs/api/visual-regression.html for more information.')
39
+ '\nFor guidance on handling visual discrepancies, refer to: https://webdriver.io/docs/api/visual-regression.html')
40
40
  };
41
41
  }
42
42
  throw new Error(`Invalid matcher, expect either a number or an asymmetric matcher, but found ${expected}`);
@@ -1 +1 @@
1
- {"version":3,"file":"service.d.ts","sourceRoot":"","sources":["../src/service.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAgB,UAAU,EAAE,MAAM,aAAa,CAAA;AAC3D,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,4BAA4B,CAAA;AAC9D,OAAO,EACH,SAAS,EAUZ,MAAM,4BAA4B,CAAA;AAqBnC,MAAM,CAAC,OAAO,OAAO,0BAA2B,SAAQ,SAAS;;IAI7D,OAAO,CAAC,QAAQ,CAAC,CAAsD;IACvE,OA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jE,UAAU,CAAC,IAAI,EAAE,UAAU,CAAC,IAAI;IAMhC,YAAY,CAAE,WAAW,EAAC,MAAM,EAAE,KAAK,EAAC,MAAM,EAAE,EAAE,MAAM,EAAC,MAAM,GAAC,MAAM,EAAE,KAAK,EAAC,GAAG;CAgIpF"}
package/dist/types.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- import type { ScreenshotOutput, ImageCompareResult, CheckScreenMethodOptions, SaveScreenMethodOptions, CheckElementMethodOptions, SaveElementMethodOptions, CheckFullPageMethodOptions, SaveFullPageMethodOptions } from 'webdriver-image-comparison';
1
+ import type { ScreenshotOutput, ImageCompareResult, CheckScreenMethodOptions, SaveScreenMethodOptions, CheckElementMethodOptions, SaveElementMethodOptions, CheckFullPageMethodOptions, SaveFullPageMethodOptions, ClassOptions } from 'webdriver-image-comparison';
2
2
  type MultiOutput = {
3
3
  [browserName: string]: ScreenshotOutput;
4
4
  };
@@ -26,5 +26,7 @@ export interface WdioCheckElementMethodOptions extends Omit<CheckElementMethodOp
26
26
  }
27
27
  export interface WdioCheckScreenMethodOptions extends Omit<CheckScreenMethodOptions, keyof WdioIcsCommonOptions>, WdioIcsCommonOptions {
28
28
  }
29
+ export interface VisualServiceOptions extends ClassOptions {
30
+ }
29
31
  export {};
30
32
  //# sourceMappingURL=types.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACR,gBAAgB,EAChB,kBAAkB,EAClB,wBAAwB,EACxB,uBAAuB,EACvB,yBAAyB,EACzB,wBAAwB,EACxB,0BAA0B,EAC1B,yBAAyB,EAC5B,MAAM,4BAA4B,CAAA;AAEnC,KAAK,WAAW,GAAG;IACf,CAAC,WAAW,EAAE,MAAM,GAAG,gBAAgB,CAAC;CAC3C,CAAC;AACF,MAAM,MAAM,MAAM,GAAG,WAAW,GAAG,gBAAgB,CAAC;AACpD,KAAK,WAAW,GAAG;IACf,CAA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@@
1
- {"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../src/utils.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EACR,OAAO,EACP,YAAY,EACZ,wBAAwB,EACxB,uBAAuB,EACvB,0BAA0B,EAC1B,yBAAyB,EACzB,yBAAyB,EACzB,wBAAwB,EAC3B,MAAM,4BAA4B,CAAA;AAQnC;;;;;GAKG;AACH,KAAK,sBAAsB,GACrB,yBAAyB,GACzB,0BAA0B,GAC1B,wBAAwB,GACxB,wBAAwB,GACxB,yBAAyB,GACzB,uBAAuB,CAAC;AAE9B,wBAAgB,UAAU,CACtB,aAAa,EAAE,sBAAsB,EACrC,OAAO,EAAE,OAAO,EAChB,eAAe,EAAE,MAAM,GACxB,OAAO,CAMT;AAED;;GAEG;AACH,wBAAgB,iBAAiB,CAAC,UAAU,EAAE,MAAM,EAAE,iBAAiB,SAAI,GAAG;IAC1E,MAAM,EAAE,MAAM,CAAC;IACf,KAAK,EAAE,MAAM,CAAC;CACjB,CAKA;AAED;;GAEG;AACH,wBAAgB,mBAAmB,CAAC,UAAU,EAAE,MAAM,EAAE,gBAAgB,EAAE;IAAC,MAAM,EAAC,MAAM,CAAC;IAAC,KAAK,EAAE,MAAM,CAAA;CAAC,GAAG,MAAM,CAOhH;AA4GD;;GAEG;AACH,wBAAsB,eAAe,CAAC,cAAc,EAAE,WAAW,CAAC,OAAO,GAAG,OAAO,CAAC,YAAY,CAAC,CA4DhG;AAED;;GAEG;AACH,wBAAgB,gBAAgB,CAAE,IAAI,EAAE,WAAW,CAAC,OAAO,GAAG,WAAW,CAAC,OAAO,GAAG,WAAW,CAAC,OAAO,CAGtG;AAED;;GAEG;AACH,wBAAgB,sBAAsB,CAClC,MAAM,EAAE,WAAW,CAAC,OAAO,GAAG,WAAW,CAAC,kBAAkB,GAC7D,OAAO,CAQT"}
1
+ {"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../src/utils.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EACR,OAAO,EACP,YAAY,EACZ,wBAAwB,EACxB,uBAAuB,EACvB,0BAA0B,EAC1B,yBAAyB,EACzB,yBAAyB,EACzB,wBAAwB,EAC3B,MAAM,4BAA4B,CAAA;AAQnC;;;;;GAKG;AACH,KAAK,sBAAsB,GACrB,yBAAyB,GACzB,0BAA0B,GAC1B,wBAAwB,GACxB,wBAAwB,GACxB,yBAAyB,GACzB,uBAAuB,CAAC;AAE9B,wBAAgB,UAAU,CACtB,aAAa,EAAE,sBAAsB,EACrC,OAAO,EAAE,OAAO,EAChB,eAAe,EAAE,MAAM,GACxB,OAAO,CAMT;AAED;;GAEG;AACH,wBAAgB,iBAAiB,CAAC,UAAU,EAAE,MAAM,EAAE,iBAAiB,SAAI,GAAG;IAC1E,MAAM,EAAE,MAAM,CAAC;IACf,KAAK,EAAE,MAAM,CAAC;CACjB,CAKA;AAED;;GAEG;AACH,wBAAgB,mBAAmB,CAAC,UAAU,EAAE,MAAM,EAAE,gBAAgB,EAAE;IAAC,MAAM,EAAC,MAAM,CAAC;IAAC,KAAK,EAAE,MAAM,CAAA;CAAC,GAAG,MAAM,CAOhH;AA4GD;;GAEG;AACH,wBAAsB,eAAe,CAAC,cAAc,EAAE,WAAW,CAAC,OAAO,GAAG,OAAO,CAAC,YAAY,CAAC,CA4DhG;AAED;;GAEG;AACH,wBAAgB,gBAAgB,CAAE,IAAI,EAAE,WAAW,CAAC,OAAO,GAAG,WAAW,CAAC,OAAO,GAAG,WAAW,CAAC,OAAO,CAGtG;AAED;;GAEG;AACH,wBAAgB,sBAAsB,CAClC,MAAM,EAAE,WAAW,CAAC,OAAO,GAAG,WAAW,CAAC,kBAAkB,GAC7D,OAAO,CAaT"}
package/dist/utils.js CHANGED
@@ -175,7 +175,9 @@ export function getBrowserObject(elem) {
175
175
  export function determineNativeContext(driver) {
176
176
  if (driver.isMobile) {
177
177
  return !!driver.requestedCapabilities?.browserName === false
178
- && driver.requestedCapabilities?.['appium:app'] !== undefined
178
+ && (driver.requestedCapabilities?.['appium:app'] !== undefined
179
+ || driver.requestedCapabilities?.['appium:bundleId'] !== undefined
180
+ || driver.requestedCapabilities?.['appium:appPackage'] !== undefined)
179
181
  && driver.requestedCapabilities?.['appium:autoWebview'] !== true;
180
182
  }
181
183
  return false;
package/package.json CHANGED
@@ -2,7 +2,7 @@
2
2
  "name": "@wdio/visual-service",
3
3
  "author": "Wim Selles - wswebcreation",
4
4
  "description": "Image comparison / visual regression testing for WebdriverIO",
5
- "version": "4.1.2",
5
+ "version": "5.0.0",
6
6
  "license": "MIT",
7
7
  "homepage": "https://webdriver.io/docs/visual-testing",
8
8
  "repository": {
@@ -20,16 +20,17 @@
20
20
  "type": "module",
21
21
  "types": "./dist/index.d.ts",
22
22
  "dependencies": {
23
- "@wdio/logger": "^8.28.0",
24
- "@wdio/types": "^8.36.1",
25
- "@wdio/globals": "^8.36.1",
23
+ "@wdio/globals": "^8.38.2",
24
+ "@wdio/logger": "^8.38.0",
25
+ "@wdio/types": "^8.38.2",
26
26
  "node-fetch": "^3.3.2",
27
- "webdriver-image-comparison": "^5.1.0"
27
+ "webdriver-image-comparison": "^6.0.0"
28
28
  },
29
+ "devDependencies": {},
29
30
  "scripts": {
30
31
  "build": "run-s clean build:*",
31
32
  "build:tsc": "tsc --project ./tsconfig.json",
32
- "clean": "rimraf coverage build .tmp",
33
+ "clean": "rimraf coverage dist .tmp",
33
34
  "watch": "pnpm run build:tsc -w"
34
35
  }
35
36
  }