ShaftHQ / SHAFT_ENGINE

SHAFT is a unified test automation engine for web, mobile, API, CLI, database, and desktop e2e testing. Powered by best-in-class frameworks, SHAFT provides a wizard-like syntax to drive your automation efficiently, maximize your ROI, and minimize your learning curve with no limitations! Stop reinventing the wheel! Upgrade now!
https://shafthq.github.io/
MIT License
332 stars 129 forks source link

[Feature Request]: Improving matchesReferenceImage() #1604

Open rsaveanu-salt opened 6 months ago

rsaveanu-salt commented 6 months ago

Summary:

In the current implementation of visual testing (image recognition) within Shaft Engine, reference images are named using a concatenation of the calling Java class method name and the element's xPath. This naming strategy ensures uniqueness but can lead to very long file names when dealing with complex xPaths, potentially exceeding the maximum character limit imposed by some operating systems

Feature Description: I propose two potential solutions to this issue:

  1. Hashing the Concatenated Name: Automatically generate a fixed-length hash (e.g., SHA-256) of the concatenation of the Java class method name and the path. This would significantly reduce the length of the file name while maintaining uniqueness.
  2. Allow Custom Naming via Method Parameter: Overloading the image validation method (public ValidationsExecutor matchesReferenceImage()) to accept an optional parameter representing the desired name for the image file. This would provide flexibility when necessary, particularly in complex testing frameworks. And it would allow for an improved organization of the image resources.
MohabMohie commented 5 months ago

We want to proceed with the hashing implementation. Would you like to contribute?