Skip to content

Commit e46f485

Browse files
authored
Merge pull request #118 from procesor2017/master
- better log to image
2 parents 79bda29 + 28856aa commit e46f485

File tree

5 files changed

+35
-14
lines changed

5 files changed

+35
-14
lines changed

README.md

Lines changed: 22 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -4,14 +4,6 @@
44

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

7-
## Important notice for users
8-
9-
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.
10-
11-
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.
12-
13-
Version 1.x.x is no longer supported, but it is still available on [Pypi](pip install WatchUI==1.0.11).
14-
157
### Basic Info
168

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

5446
<img src="assets/example-difference.jpg">
47+
48+
49+
## Important notice for users
50+
51+
## For users with Windows
52+
53+
The scikit image library is used for image matching. Unfortunately, this is a scientific library.
54+
You need to have these libraries for installed to use them properly on windows:
55+
- Windows 10 SDK
56+
- C++ x64/x86 build tools
57+
58+
These libraries can be downloaded by using [VS studio](https://visualstudio.microsoft.com/cs/) (not vscode) and installing the msbuild tool from VS studio.
59+
Alternatively, [this library](https://visualstudio.microsoft.com/cs/visual-cpp-build-tools/) should also work.
60+
61+
62+
## WatchUI 1.0 vs 2.x.x
63+
64+
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.
65+
66+
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.
67+
68+
Version 1.x.x is no longer supported, but it is still available on [Pypi](pip install WatchUI==1.0.11).

WatchUI/keywords/Image.py

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -98,7 +98,8 @@ def _write_and_log(
9898
url: str = f"{checked_save_folder}/Img{time_}{img_format}"
9999
# Show image
100100
if score < ssim:
101-
cv.imwrite(url, target_image)
101+
img_diff: Any = cv.hconcat([base_image, target_image])
102+
cv.imwrite(url, img_diff)
102103
self.set_log_message(
103104
work_object="Image", type_of_messages="Error", path_to_image=url
104105
)
@@ -133,7 +134,7 @@ def compare_images(
133134
base_image_path (str): path to base image
134135
compared_image_path (str): path to compared image
135136
save_folder (str): path to the save folder
136-
ssim (float): SSIM threshold value
137+
ssim (float): SSIM threshold value 0 to 1 e.g. "0.5"
137138
image_format (str): image format, e.g. "png", "jpg"
138139
Raises:
139140
TypeError:
@@ -182,7 +183,7 @@ def compare_screen_without_areas(
182183
base_image_path (str): path to the base image
183184
compared_image_path (str): path to the compared image
184185
save_folder (str): path to the save folder
185-
ssim (float): SSIM threshold value
186+
ssim (float): SSIM threshold value 0 to 1 e.g. "0.5"
186187
image_format (str): format of the image, e.g. "png", "jpg"
187188
"""
188189
checked_save_folder, my_ssim, img_format = self._do_checks(

pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[tool.poetry]
22
name = "WatchUI"
3-
version = "2.0.11"
3+
version = "2.0.12"
44
description = "RobotFramework library package for automated visual testing."
55
readme = "README.md"
66
repository = "https://github.com/Tesena-smart-testing/WatchUI"

setup.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,4 +2,4 @@
22

33
# setup for development purposes
44
# run with python setup.py develop
5-
setup(name="WatchUI", version="2.0.11", packages=find_packages())
5+
setup(name="WatchUI", version="2.0.12", packages=find_packages())

tests/test.robot

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
*** Variables ***
22
${TESERACT_PATH} /usr/bin/tesseract
33
${BASELINE_IMAGE} assets/img.jpg
4+
${IMAGE_1} resource/data/forpres.png
5+
${IMAGE_2} resource/data/forpres1.png
46
${PDF_FILE} assets/ok.pdf
57
68
@@ -10,7 +12,11 @@ Library ../WatchUI/ outputs_folder=tests/outputs tesseract_pa
1012
1113
*** Test Cases ***
1214
Compare Same Images
13-
Compare images ${BASELINE_IMAGE} ${BASELINE_IMAGE}
15+
Compare images ${BASELINE_IMAGE} ${BASELINE_IMAGE}
16+
17+
Compare different Images
18+
[Tags] 1
19+
Compare images ${IMAGE_1} ${IMAGE_2} ssim=0.5
1420
1521
Check Compare Screen Without Areas
1622
Compare screen without areas ${BASELINE_IMAGE} ${BASELINE_IMAGE} 0 0 100 100 125 125 250 250

0 commit comments

Comments
 (0)