Skip to content
This repository was archived by the owner on Aug 10, 2022. It is now read-only.

Commit a6d7602

Browse files
author
Igor Kozyrenko
authored
Bugfix trello 2583 layout is skewed off coded selector (#351)
* docs: update CHANGELOG.md * fix: offset subscreenshot's frame_location_in_screenshot by original screenshot scroll position * refactor: set APPLITOOLS_BATCH_NAME in travis.yml * test: add test_layout_region_calculation_within_frame * test: avoid using deprecated abort_if_not_closed * test: bump appium and ios version in generated tests to avoid saucelabs crashes. * test: pass PYTHON variables to tests in tox
1 parent a5a7c89 commit a6d7602

7 files changed

Lines changed: 29 additions & 9 deletions

File tree

.travis.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -150,6 +150,7 @@ jobs:
150150
- TOX_ENV=selenium-generated
151151
- TEST_PLATFORM=Linux
152152
- TEST_BROWSERS=chrome
153+
- APPLITOOLS_BATCH_NAME="Python Coverage Tests"
153154
before_install:
154155
- git submodule update --init --remote --recursive
155156
- nvm install node

CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
## [vNext]
2+
### Fixed
3+
- Layout is skewed off coded selector [Trello 2583](https://trello.com/c/wxtUJtI5)
4+
15
## [4.21.0] - 2021-05-28
26
### Added
37
- Allow Python Proxy via ProxySettings object [Trello 1583](https://trello.com/c/qQAooLih)

coverage-tests/test/conftest.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,7 @@ def android_desired_capabilities(request, dev, app):
7878
desired_caps["automationName"] = "UiAutomator2"
7979
desired_caps["name"] = "AndroidNativeApp checkWindow"
8080
desired_caps["deviceOrientation"] = "portrait"
81-
desired_caps["appiumVersion"] = "1.13.0"
81+
desired_caps["appiumVersion"] = "1.19.2"
8282
return desired_caps
8383

8484

@@ -89,14 +89,14 @@ def ios_desired_capabilities(request, dev, app):
8989
desired_caps["NATIVE_APP"] = True
9090
desired_caps["browserName"] = ""
9191
desired_caps["deviceName"] = "iPhone XS Simulator"
92-
desired_caps["platformVersion"] = "12.2"
92+
desired_caps["platformVersion"] = "13.4"
9393
desired_caps["platformName"] = "iOS"
9494
desired_caps["clearSystemFiles"] = True
9595
desired_caps["noReset"] = True
9696
desired_caps["automationName"] = "XCUITest"
9797
desired_caps["name"] = "iOSNativeApp checkWindow"
9898
desired_caps["deviceOrientation"] = "portrait"
99-
desired_caps["appiumVersion"] = "1.13.0"
99+
desired_caps["appiumVersion"] = "1.19.2"
100100
return desired_caps
101101

102102

@@ -288,6 +288,6 @@ def eyes_setup(runner, batch_info, stitch_mode, emulation):
288288
eyes.add_property("Page", page)
289289
yield eyes
290290
# If the test was aborted before eyes.close was called, ends the test as aborted.
291-
eyes.abort_if_not_closed()
291+
eyes.abort()
292292
if runner is not None:
293293
runner.get_all_test_results(False)

coverage-tests/test/pytest.ini

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
11
[pytest]
22
python_files = *.py
33
python_functions = Check* Should* Acme* Appium* test_* VariantId* Adopted*
4-
env =
5-
APPLITOOLS_BATCH_NAME='Python Coverage Tests'

eyes_selenium/applitools/selenium/capture/eyes_webdriver_screenshot.py

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -80,14 +80,14 @@ def create_entire_element(
8080

8181
@classmethod
8282
def from_screenshot(
83-
cls, driver, image, screenshot_region, frame_location_in_parent_screenshot
83+
cls, driver, image, screenshot_region, frame_location_in_screenshot
8484
):
8585
# type: (EyesWebDriver, Image.Image, Region, Point) -> EyesWebDriverScreenshot
8686
return cls(
8787
driver,
8888
image,
8989
ScreenshotType.ENTIRE_FRAME,
90-
frame_location_in_parent_screenshot - screenshot_region.location,
90+
frame_location_in_screenshot,
9191
frame_window=Region.from_(Point.ZERO(), screenshot_region.size),
9292
)
9393

@@ -198,7 +198,9 @@ def sub_screenshot(self, region, throw_if_clipped=False):
198198
self._driver,
199199
sub_image,
200200
Region(region.left, region.top, sub_image.width, sub_image.height),
201-
self._frame_location_in_screenshot,
201+
self._frame_location_in_screenshot
202+
- as_is_sub_screenshot_region.location
203+
- self._current_frame_scroll_position,
202204
)
203205

204206
CONTEXT_RELATIVE = CoordinatesType.CONTEXT_RELATIVE

tests/functional/eyes_selenium/selenium/test_eyes.py

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -133,3 +133,17 @@ def test_scrollable_modal_on_scrolled_down_page(driver):
133133
eyes.check(Target.region(content).scroll_root_element(content).fully())
134134

135135
eyes.close()
136+
137+
138+
def test_layout_region_calculation_within_frame(driver, fake_connector_class):
139+
eyes = Eyes()
140+
eyes.server_connector = fake_connector_class()
141+
driver = eyes.open(driver, "a", "b", RectangleSize(width=1024, height=768))
142+
driver.get("https://applitools.github.io/demo/TestPages/CorsTestPage/index.html")
143+
144+
eyes.check(Target.frame("frame1").region("body").layout("#inner-frame-div"))
145+
146+
_, match_data = eyes.server_connector.calls["match_window"]
147+
assert match_data.options.image_match_settings.layout_regions == [
148+
Region(0, 0, 304, 184)
149+
]

tox.ini

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,7 @@ passenv =
3939
APPLITOOLS_BATCH_NAME
4040
TEST_REPORT_SANDBOX
4141
APPDATA
42+
PYTHON*
4243
deps =
4344
invoke
4445
mock

0 commit comments

Comments
 (0)