Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Ws/canvas 2 jimp #362

Merged
merged 14 commits into from
Jun 11, 2024
Merged

Ws/canvas 2 jimp #362

merged 14 commits into from
Jun 11, 2024

Conversation

wswebcreation
Copy link
Member

@wswebcreation wswebcreation commented Jun 2, 2024

💥 Breaking

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:

  • less errors
  • less complex test environments

Note

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
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

Important

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.

🚀 New Features

Update the baseline images through the command line by adding the argument --update-visual-baseline. This will

  • automatically copy the actual take screenshot and put it in the baseline folder
  • if there are differences it will let the test pass because the baseline has been updated

Usage:

npm run test.local.desktop  --update-visual-baseline

When running logs info/debug mode you will see the following logs added

[0-0] ..............
[0-0] #####################################################################################
[0-0]  INFO:
[0-0]  Updated the actual image to
[0-0]  /Users/wswebcreation/Git/wdio/visual-testing/localBaseline/chromel/demo-chrome-1366x768.png
[0-0] #####################################################################################
[0-0] ..........

💅 Polish

  • remove Vitest fix
  • add app images
  • update the build

Copy link

changeset-bot bot commented Jun 2, 2024

🦋 Changeset detected

Latest commit: f78704c

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 2 packages
Name Type
webdriver-image-comparison Major
@wdio/visual-service Major

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@wswebcreation wswebcreation marked this pull request as ready for review June 4, 2024 07:33
@wswebcreation
Copy link
Member Author

wswebcreation commented Jun 6, 2024

Docs changes for WebdriverIO can be found here and depend on releasing this version. Once both are released I'll port it to main

Copy link
Member

@christian-bromann christian-bromann left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Amazing work once again 🎉

@nextlevelbeard
Copy link
Member

Legend, great work!
Tried it recently and was turned off by Canvas errors/issues.

@wswebcreation
Copy link
Member Author

Tnx guys

I’m in Athens now with my company, will merge it beginning of next week

@wswebcreation wswebcreation merged commit 66b9f11 into main Jun 11, 2024
14 of 15 checks passed
@wswebcreation wswebcreation deleted the ws/canvas-2-jimp branch June 11, 2024 04:56
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants