Skip to content

Commit

Permalink
Merge pull request #118 from procesor2017/master
Browse files Browse the repository at this point in the history
- better log to image
  • Loading branch information
janegermaier authored Mar 26, 2023
2 parents 79bda29 + 28856aa commit e46f485
Show file tree
Hide file tree
Showing 5 changed files with 35 additions and 14 deletions.
30 changes: 22 additions & 8 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,6 @@

## [Documentation](https://tesena-smart-testing.github.io/WatchUI/) | [Tesena](https://www.tesena.com/) | [Pypi](https://pypi.org/project/WatchUI/)

## Important notice for users

WatchUI 2.0 brings breaking changes. Dev team decided to streamline the library and focus it solely on the image and text comparison. This allows us to remove the implicit dependency on browser automation libraries - namely SeleniumLibrary, which was implicit part of the library via RF `BuiltIn()` import of the SeleniumLibrary instance.

This is no longer the case - user of the WatchUI therefore **can and have to choose, what UI automation library will use** and provide screenshots to the WatchUI keywords to be compared. It could be now used with SeleniumLibrary, Browser library, Sikuli, Appium or any other UI library where visual validation is required.

Version 1.x.x is no longer supported, but it is still available on [Pypi](pip install WatchUI==1.0.11).

### Basic Info

Custom library for works with image, pdf and tesseract with RF.
Expand Down Expand Up @@ -52,3 +44,25 @@ _Image where the differences are stored + You can see two black box in left corn
_The red rectangles outlining missing elements on compared screens_

<img src="assets/example-difference.jpg">


## Important notice for users

## For users with Windows

The scikit image library is used for image matching. Unfortunately, this is a scientific library.
You need to have these libraries for installed to use them properly on windows:
- Windows 10 SDK
- C++ x64/x86 build tools

These libraries can be downloaded by using [VS studio](https://visualstudio.microsoft.com/cs/) (not vscode) and installing the msbuild tool from VS studio.
Alternatively, [this library](https://visualstudio.microsoft.com/cs/visual-cpp-build-tools/) should also work.


## WatchUI 1.0 vs 2.x.x

WatchUI 2.0 brings breaking changes. Dev team decided to streamline the library and focus it solely on the image and text comparison. This allows us to remove the implicit dependency on browser automation libraries - namely SeleniumLibrary, which was implicit part of the library via RF `BuiltIn()` import of the SeleniumLibrary instance.

This is no longer the case - user of the WatchUI therefore **can and have to choose, what UI automation library will use** and provide screenshots to the WatchUI keywords to be compared. It could be now used with SeleniumLibrary, Browser library, Sikuli, Appium or any other UI library where visual validation is required.

Version 1.x.x is no longer supported, but it is still available on [Pypi](pip install WatchUI==1.0.11).
7 changes: 4 additions & 3 deletions WatchUI/keywords/Image.py
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,8 @@ def _write_and_log(
url: str = f"{checked_save_folder}/Img{time_}{img_format}"
# Show image
if score < ssim:
cv.imwrite(url, target_image)
img_diff: Any = cv.hconcat([base_image, target_image])
cv.imwrite(url, img_diff)
self.set_log_message(
work_object="Image", type_of_messages="Error", path_to_image=url
)
Expand Down Expand Up @@ -133,7 +134,7 @@ def compare_images(
base_image_path (str): path to base image
compared_image_path (str): path to compared image
save_folder (str): path to the save folder
ssim (float): SSIM threshold value
ssim (float): SSIM threshold value 0 to 1 e.g. "0.5"
image_format (str): image format, e.g. "png", "jpg"
Raises:
TypeError:
Expand Down Expand Up @@ -182,7 +183,7 @@ def compare_screen_without_areas(
base_image_path (str): path to the base image
compared_image_path (str): path to the compared image
save_folder (str): path to the save folder
ssim (float): SSIM threshold value
ssim (float): SSIM threshold value 0 to 1 e.g. "0.5"
image_format (str): format of the image, e.g. "png", "jpg"
"""
checked_save_folder, my_ssim, img_format = self._do_checks(
Expand Down
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[tool.poetry]
name = "WatchUI"
version = "2.0.11"
version = "2.0.12"
description = "RobotFramework library package for automated visual testing."
readme = "README.md"
repository = "https://github.com/Tesena-smart-testing/WatchUI"
Expand Down
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,4 @@

# setup for development purposes
# run with python setup.py develop
setup(name="WatchUI", version="2.0.11", packages=find_packages())
setup(name="WatchUI", version="2.0.12", packages=find_packages())
8 changes: 7 additions & 1 deletion tests/test.robot
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
*** Variables ***
${TESERACT_PATH} /usr/bin/tesseract
${BASELINE_IMAGE} assets/img.jpg
${IMAGE_1} resource/data/forpres.png
${IMAGE_2} resource/data/forpres1.png
${PDF_FILE} assets/ok.pdf
Expand All @@ -10,7 +12,11 @@ Library ../WatchUI/ outputs_folder=tests/outputs tesseract_pa
*** Test Cases ***
Compare Same Images
Compare images ${BASELINE_IMAGE} ${BASELINE_IMAGE}
Compare images ${BASELINE_IMAGE} ${BASELINE_IMAGE}
Compare different Images
[Tags] 1
Compare images ${IMAGE_1} ${IMAGE_2} ssim=0.5
Check Compare Screen Without Areas
Compare screen without areas ${BASELINE_IMAGE} ${BASELINE_IMAGE} 0 0 100 100 125 125 250 250
Expand Down

0 comments on commit e46f485

Please sign in to comment.