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

Commit b9fdbc0

Browse files
authored
Release 4.0.9 (#46)
* feat: add device info for mobile devices * refactor: replace implicit methods and attr to explicit in Eyes class * refactor: prevent raise and log exception in get_viewport_size with native apps it's expected that on mobile app windows size required and attempt to get viewport size with JS would raise an exception so just return windows size directly in this case * fix: prevent shoving warning msg related to dom capture with mobile app While capture dom for native apps, appium throw an exception "Method is not implemented" which shown in output as a warning msg and mislead users. * fix: close and quit methods were broken in EyesWebDriver * fix: cut to viewport on ios * fix: wrong viewport screenshot when scrolled * fix: wrong detection of mobile app when using appActivity or appPackage * fix: add missing method * fix: log msg when frame has no reference or scroll_root_element * fix: add Linux OSNames * fix: frame lookup by id * fix: update missing fields of EyesWebElement * test: update test_set_get_scale_ratio * test: add test to check screenshot with scroll viewport in IE * test: update test_cut_header_and_bottom_of_screenshot_on_ios
1 parent 6da1065 commit b9fdbc0

File tree

13 files changed

+406
-108
lines changed

13 files changed

+406
-108
lines changed

eyes_common/applitools/common/metadata.py

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,11 +4,12 @@
44

55
from .match import ImageMatchSettings
66
from .server import SessionType
7+
from .utils.compat import basestring
78
from .utils.json_utils import JsonInclude
89

910
if typing.TYPE_CHECKING:
1011
from applitools.common import DeviceName, BatchInfo
11-
from typing import Optional, Text
12+
from typing import Optional, Text, Union
1213

1314
__all__ = ("RunningSession", "AppEnvironment", "SessionStartInfo")
1415

@@ -29,7 +30,9 @@ class RunningSession(object):
2930

3031

3132
def _to_device_info(v):
32-
# type: (Optional[DeviceName]) -> Text
33+
# type: (Optional[Union[DeviceName, Text]]) -> Text
34+
if isinstance(v, basestring):
35+
return v
3336
return "Desktop" if v is None else "{} (Chrome emulation)".format(v.value)
3437

3538

eyes_selenium/applitools/selenium/capture/screenshot_utils.py

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -42,15 +42,20 @@ def cut_to_viewport_size_if_required(driver, image):
4242
# type: (EyesWebDriver, Image) -> Image
4343
# Some browsers return always full page screenshot (IE).
4444
# So we cut such images to viewport size
45-
position_provider = get_cur_position_provider(driver)
46-
curr_frame_scroll = get_updated_scroll_position(position_provider)
45+
46+
cur_position = driver.eyes._original_scroll_position
47+
if cur_position:
48+
top = cur_position.y
49+
else:
50+
top = 0
51+
4752
screenshot_type = update_screenshot_type(None, image, driver)
4853
if screenshot_type != ScreenshotType.VIEWPORT:
4954
viewport_size = driver.eyes.viewport_size
5055
image = image_utils.crop_image(
5156
image,
5257
region_to_crop=Region(
53-
top=curr_frame_scroll.x,
58+
top=top,
5459
left=0,
5560
height=viewport_size["height"],
5661
width=viewport_size["width"],

0 commit comments

Comments
 (0)