def test_check_region_in_frame2_fluent(self): self.eyes.check( "Fluent - Inner frame div 1", Target.frame("frame1").region("#inner-frame-div").fully().timeout( 5000).ignore(Region(50, 50, 100, 100)), ) self.eyes.check( "Fluent - Inner frame div 2", Target.frame("frame1").region("#inner-frame-div").fully().ignore( Region(50, 50, 100, 100)).ignore(Region(70, 170, 90, 90)), ) self.eyes.check( "Fluent - Inner frame div 3", Target.frame("frame1").region("#inner-frame-div").fully().timeout( 5000), ) self.eyes.check( "Fluent - Inner frame div 4", Target.frame("frame1").region("#inner-frame-div").fully(), ) self.eyes.check( "Fluent - Full frame with floating region", Target.frame("frame1").fully().layout().floating( 25, Region(200, 200, 150, 150)), )
def test_charts_with_scroll_root_fluent(eyes_opened): eyes_opened.configure.add_property("Fluent", True) eyes_opened.check( Target.frame("mainFrame").frame("angularContainerIframe").region( "mv-temperature-sensor-graph").scroll_root_element( "mat-sidenav-content")) eyes_opened.check( Target.frame("mainFrame").frame("angularContainerIframe").region( "mv-humidity-sensor-graph").scroll_root_element( "mat-sidenav-content"))
def test_check_many(eyes_opened): eyes_opened.check( Target.region("#overflowing-div-image").with_name( "overflowing div image"), Target.region("overflowing-div").with_name("overflowing div"), Target.region("overflowing-div-image").fully().with_name( "overflowing div image (fully)"), Target.frame("frame1").frame("frame1-1").fully().with_name( "Full Frame in Frame"), Target.frame("frame1").with_name("frame1"), Target.region(Region(30, 50, 300, 620)).with_name("rectangle"), )
def test_check_frame_in_frame_fully_fluent2(self): self.eyes.check("Fluent - Window with Ignore region 2", Target.window().fully()) self.eyes.check( "Fluent - Full Frame in Frame 2", Target.frame("frame1").frame("frame1-1").fully(), )
def test_duo_v3_default(eyes, driver): driver.get( "http://front-end-testing.appspot.com/duo_v3_default/[email protected]" ) driver = eyes.open(driver, "region", "test region", {"width": 1000, "height": 800}) eyes.check("Frame", Target.frame("duo_iframe")) eyes.close()
def test_check_region_by_coordinate_in_frame_fluent(self): self.eyes.check( "Fluent - Inner frame coordinates", Target.frame("frame1").region( Region(30, 40, 400, 1200, CoordinatesType.CONTEXT_RELATIVE)).fully(), )
def test_scrollbars_hidden_and_returned_fluent(self): self.eyes.check("Fluent - Window (Before)", Target.window().fully()) self.eyes.check( "Fluent - Inner frame div", Target.frame("frame1").region("#inner-frame-div").fully(), ) self.eyes.check("Fluent - Window (After)", Target.window().fully())
def test_scrollbars_hidden_and_returned__fluent(eyes_opened): eyes_opened.check("Fluent - Window (Before)", Target.window().fully()) eyes_opened.check( "Fluent - Inner frame div", Target.frame("frame1").region("#inner-frame-div").fully(), ) eyes_opened.check("Fluent - Window (After)", Target.window().fully())
def check_eyes_region_in_frame_by_selector(self, framereference, name, enable_http_debug_log=None, matchtimeout=None, hidescrollbars=None): """ Takes a snapshot of the region of the element found by calling find_element(by, value) inside a specific frame, and matches it with the expected output. With a choice from eight selectors, to check by on `Using Selectors` section. | =Arguments= | =Description= | | Frame Reference (str, int or WebElement) | *Mandatory* - Defines the frame to be checked. See below what arguments must be used as frame reference | | Value (str) | *Mandatory* - The specific value of the selector. e.g. a CSS SELECTOR value .first.expanded.dropdown | | Name (str) | *Mandatory* - Name that will be given to region in Eyes | | Selector (str) | *Mandatory* - The strategy to locate the element. The supported selectors are specified in `Using Selectors` | | Enable Eyes Log (bool) | Determines if the trace logs of Applitools Eyes SDK are activated for this checkpoint. Overrides the argument set on `Open Eyes Session` | | Enable HTTP Debug Log (bool) | The HTTP Debug logs will not be included by default. To activate, pass 'True' in the variable | | Match Timeout (int) | Determines how much time in milliseconds Eyes continue to retry the matching before declaring a mismatch on this test | | Target (Target) | The intended Target. See `Defining Ignore and Floating Regions` | | Hide Scrollbars (bool) | Sets if the scrollbars are hidden in the checkpoint, by passing 'True' or 'False' in the variable | | Wait Before Screenshots (int) | Determines the number of milliseconds that Eyes will wait before capturing the screenshot of this checkpoint. Overrides the argument set on `Open Eyes Session` | | Send DOM (bool) | Sets if DOM information should be sent for this checkpoint | | Stitch Content (bool) | Determines if Eyes will scroll this element to take a full element screenshot, when the element is scrollable | | Match Level (str) | The match level for the comparison of this checkpoint - can be STRICT, LAYOUT, CONTENT or EXACT | | Is Disabled (bool) | Determines whether or not interactions with Eyes will be silently ignored for this checkpoint | *Example:* | Check Eyes Region In Frame By Selector | FrameName | .first.expanded.dropdown | Css Element | css selector | ${true} | ${true} | 5000 | *Frame Reference* In order to locate the correct frame, you must use one of the following references: - Str: Name of the frame - Int: Index of frame, relative to the list of frames on the page - EyesWebElement or WebElement: The frame element *Note (Safari on mobile):* When checking an element, provide osname=iOS and browsername=Safari on `Open Eyes Session`. Due to an issue regarding the height of the address bar not being taken into account when the screenshot is taken, a temporary workaround is in place. In order to screenshot the correct element, it is added the value of 71 to the y coordinate of the element. """ original_properties = utils.save_current_properties() utils.update_properties(None, enable_http_debug_log, hidescrollbars) variables.eyes.check( name, Target.frame(framereference).timeout(matchtimeout)) utils.update_properties(**original_properties)
def test_w3schools_iframe(eyes, driver): driver = eyes.open( driver, app_name="Python SDK", test_name="W3 Schools frame", viewport_size={"width": 800, "height": 600}, ) driver.get("https://www.w3schools.com/tags/tryit.asp?filename=tryhtml_iframe") eyes.check( "Entire Frame", Target.frame("iframeResult").region([By.TAG_NAME, "body"]) ) eyes.close()
def test_layout_region_calculation_for_frame_target(driver, fake_connector_class): eyes = Eyes() eyes.server_connector = fake_connector_class() driver = eyes.open(driver, "a", "b", RectangleSize(height=1024, width=768)) driver.get( "https://applitools.github.io/demo/TestPages/CorsTestPage/index.html") eyes.check( Target.frame([By.CSS_SELECTOR, "body>iframe"]).layout([By.ID, "inner-frame-div"])) _, match_data = eyes.server_connector.calls["match_window"] assert match_data.options.image_match_settings.layout_regions == [ Region(8, 8, 304, 184) ]
def check_frame_by_element( self, element, # type: AnyWebElement tag=None, # type: Optional[Text] *check_settings_keywords # type: tuple[Any] ): # type: (...) -> MatchResult """ Check specified frame by element | =Arguments= | =Description= | | Element | *Mandatory* - The frame to check | *Example:* | Eyes Check Frame By Element | ${element} | """ is_webelement_guard(element) check_settings_keywords, tag = try_resolve_tag_and_keyword( tag, check_settings_keywords, self.defined_keywords) check_settings = collect_check_settings(Target.frame(element), self.defined_keywords, *check_settings_keywords) return self.current_eyes.check(check_settings, tag)
def check_frame_by_index( self, frame_index, # type: int tag=None, # type: Optional[Text] *check_settings_keywords # type: tuple[Any] ): # type: (...) -> MatchResult """ Check specified frame by index | =Arguments= | =Description= | | Frame Index | *Mandatory* - Index of the frame to check. | *Example:* | Eyes Check Frame By Index | 2 | """ argument_guard.is_a(frame_index, int) check_settings_keywords, tag = try_resolve_tag_and_keyword( tag, check_settings_keywords, self.defined_keywords) check_settings = collect_check_settings(Target.frame(frame_index), self.defined_keywords, *check_settings_keywords) return self.current_eyes.check(check_settings, tag)
def check_frame_by_name( self, frame_name, # type: Text tag=None, # type: Optional[Text] *check_settings_keywords # type: tuple[Any] ): # type: (...) -> MatchResult """ Check specified frame by name | =Arguments= | =Description= | | Frame Name | *Mandatory* - Name of the frame to check. | *Example:* | Eyes Check Frame By Name | frameName | """ argument_guard.is_a(frame_name, basestring) check_settings_keywords, tag = try_resolve_tag_and_keyword( tag, check_settings_keywords, self.defined_keywords) check_settings = collect_check_settings(Target.frame(frame_name), self.defined_keywords, *check_settings_keywords) return self.current_eyes.check(check_settings, tag)
def check_frame_by_selector( self, selector, # type: Text tag=None, # type: Optional[Text] *check_settings_keywords # type: tuple[Any] ): # type: (...) -> MatchResult """ Check specified frame by name | =Arguments= | =Description= | | Selector | *Mandatory* - Selector of the frame to check. | *Example:* | Eyes Check Frame By Selector | css:#selector | """ argument_guard.is_a(selector, basestring) check_settings_keywords, tag = try_resolve_tag_and_keyword( tag, check_settings_keywords, self.defined_keywords) check_settings = collect_check_settings( Target.frame(self.from_locator_to_supported_form(selector)), self.defined_keywords, *check_settings_keywords) return self.current_eyes.check(check_settings, tag)
def test_check_region_in_frame_fluent(self): self.eyes.check( "Fluent - Region in Frame in Frame", Target.frame("frame1").frame("frame1-1").region( By.TAG_NAME, "img").fully(), )
def test_check_frame__fluent(eyes_opened): eyes_opened.hide_scrollbars = False eyes_opened.check("Fluent - Frame", Target.frame("frame1"))
def test_check_frame_in_frame__fully__fluent(eyes_opened): eyes_opened.check("Fluent - Full Frame in Frame", Target.frame("frame1").frame("frame1-1").fully())
def test_check_region_in_frame__fluent(eyes_opened): eyes_opened.check( "Fluent - Region in Frame in Frame", Target.frame("frame1").region([By.ID, "inner-frame-div"]).fully(), )
def test_check_region_in_frame_in_frame__fluent(eyes_opened): eyes_opened.check( "Fluent - Region in Frame in Frame", Target.frame("frame1").frame("frame1-1").region("img").fully(), )
def test_check_region_in_frame_fluent(self): self.eyes.check( "Fluent - Region in Frame in Frame", Target.frame("frame1").region([By.ID, "inner-frame-div"]).fully(), )
def test_check_frame_in_frame_fully_fluent(self): self.eyes.check( "Fluent - Full Frame in Frame", Target.frame("frame1").frame("frame1-1").fully(), )
def test_check_frame_fluent(self): self.eyes.check("Fluent - Frame", Target.frame("frame1"))
def test_check_region_in_a_very_big_frame(self): self.eyes.check("map", Target.frame("frame1").region((By.TAG_NAME, "img")))
def test_check_region_in_frame3__fluent(eyes_opened): eyes_opened.check( "Fluent - Full frame with floating region", Target.frame("frame1").fully().layout().floating( 25, Region(200, 200, 150, 150)), )
def test_check_region_in_a_very_big_frame(eyes_opened): eyes_opened.check("map", Target.frame("frame1").region([By.TAG_NAME, "img"]))
def test_check_region_by_coordinate_in_frame_fully__fluent(eyes_opened): eyes_opened.check( "Fluent - Inner frame coordinates", Target.frame("frame1").region(Region(30, 40, 400, 1200)).fully(), )
def test_check_region_by_coordinate_in_frame__fluent(eyes_opened): eyes_opened.hide_scrollbars = False eyes_opened.check( "Fluent - Inner frame coordinates", Target.frame("frame1").region(Region(30, 40, 400, 1200)), )
def test_check_frame_in_frame__fully__fluent2(eyes_opened): eyes_opened.check("Fluent - Window", Target.window().fully()) eyes_opened.check( "Fluent - Full Frame in Frame 2", Target.frame("frame1").frame("frame1-1").fully(), )