def test_sample_script(eyes, driver):
    driver = eyes.open(
        driver, "Python app", "TestSampleScript", {"width": 600, "height": 400}
    )
    driver.get("https://www.google.com/")
    eyes.check_window(
        "Search page",
        target=(
            Target()
            .ignore(IgnoreRegionBySelector(By.CLASS_NAME, "fbar"))
            .send_dom()
            .use_dom()
            .floating(
                FloatingRegion(Region(10, 20, 30, 40), FloatingBounds(10, 0, 20, 10))
            )
        ),
    )

    hero = driver.find_element_by_id("body")
    eyes.check_region_by_element(
        hero,
        "Search",
        target=(Target().ignore(Region(20, 20, 50, 50), Region(40, 40, 10, 20))),
    )
    eyes.close()
Beispiel #2
0
    def select_eyes_ignore_region_by_selector(self,
                                              selector,
                                              value,
                                              includeEyesLog=False,
                                              httpDebugLog=False):
        """
        Selects the element, which should be ignored in the comparison. In the screenshot you can see a border around that element.
        Arguments:
                |  Selector (string)                | This will decide what element will be located. The supported selectors include: CSS SELECTOR, XPATH, ID, LINK TEXT, PARTIAL LINK TEXT, NAME, TAG NAME, CLASS NAME.    |
                |  Value (string)                   | The specific value of the selector. e.g. a CSS SELECTOR value .first.expanded.dropdown.                                                                               |                                                                                                                          |
                |  Include Eyes Log (default=False) | The Eyes logs will not be included by default. To activate, pass 'True' in the variable.                                                                              |
                |  HTTP Debug Log (default=False)   | The HTTP Debug logs will not be included by default. To activate, pass 'True' in the variable.                                                                        |

        Example:
        | *Keywords*                            |  *Parameters*     |                |                   |      |       |
        | Open Browser                          |  yourTestingUrl   | gc             |                   |      |       |
        | Open Eyes Session                     | yourAppName       | yourTestName   | YourApplitoolsKey | 1024 |  768  |
        | Select Eyes Ignore Region By Selector |  ID               |  search-input  |                   |      |       |
        | Close Eyes Session                    |                   |                |                   |      |       |
        """

        check_logging(includeEyesLog, httpDebugLog)

        searchElement = get_search_element(selector)

        target = {}
        for i in value:
            target[i] = Target().ignore(
                IgnoreRegionBySelector(searchElement, value[i]))
        eyes.check_window(target=target)
Beispiel #3
0
 def test_check_region_in_a_very_big_frame_after_manual_switch_frame(self):
     with self.driver.switch_to.frame_and_back("frame1"):
         element = self.driver.find_element(By.CSS_SELECTOR, "img")
         # TODO #112: fix bug execute_script method calling with EyesWebElement
         self.driver.execute_script("arguments[0].scrollIntoView(true);",
                                    element.element)
         self.eyes.check("", Target.region(By.CSS_SELECTOR, "img"))
def test_check_window_with_ignore_region_fluent(eyes, driver):
    eyes.open(driver, "Eyes Selenium SDK - Fluent API", "TestCheckWindowWithIgnoreRegion_Fluent",
              {'width': 800, 'height': 600})
    driver.get('http://applitools.github.io/demo/TestPages/FramesTestPage/')
    driver.find_element_by_tag_name('input').send_keys('My Input')
    eyes.check_window("Fluent - Window with Ignore region", target=Target().ignore(
        Region(left=50, top=50, width=100, height=100)))
    eyes.close()
Beispiel #5
0
def test_server_connector(driver):
    eyes = Eyes('https://localhost.applitools.com')
    driver = eyes.open(driver, "Python SDK", "TestDelete", {'width': 800, 'height': 599})
    driver.get("https://applitools.com/helloworld")
    eyes.check("Hello", Target.window())
    results = eyes.close()
    results.delete()
    eyes.abort_if_not_closed()
def test_check_window_with_send_dom(eyes, driver):
    eyes.open(driver, "Eyes Selenium SDK - Fluent API", "TestCheckWindowWithSendDom",
              {'width': 800, 'height': 600})
    driver.get('http://applitools.github.io/demo/TestPages/FramesTestPage/')
    driver.find_element_by_tag_name('input').send_keys('My Input')
    eyes.check_window("Fluent - Window with Ignore region", target=Target().send_dom().use_dom())
    assert 'data-applitools-scroll' in driver.page_source
    assert 'data-applitools-original-overflow' in driver.page_source
    eyes.close()
def test_check_window_with_ignore_region_fluent(eyes, driver):
    eyes.force_full_page_screenshot = True
    eyes.open(driver, "Eyes Selenium SDK - Fluent API",
              "TestCheckWindowWithIgnoreRegion_Fluent", {
                  'width': 800,
                  'height': 600
              })
    driver.get('http://applitools.github.io/demo/TestPages/FramesTestPage/')
    eyes.check_window("Fluent - Window with Ignore region",
                      target=Target().ignore(
                          Region(left=50, top=50, width=100, height=100)))
    eyes.close()
    def check_eyes_window_with_ignore_region_by_selector(self, name, selector, selector_value, includeEyesLog=False, httpDebugLog=False):


        """
        Takes a snapshot from the browser using the web driver and matches it with
        the expected output.

        Arguments:
                |  Name (string)                                | Name that will be given to region in Eyes.                                                      |
                |  Include Eyes Log (default=False)             | The Eyes logs will not be included by default. To activate, pass 'True' in the variable.        |
                |  HTTP Debug Log (default=False)               | The HTTP Debug logs will not be included by default. To activate, pass 'True' in the variable.  |

        Example:

        | *Keywords*         |  *Parameters*                                                                                                    |
        | Open Browser       |  http://www.navinet.net/ | gc                |                            |                     |        |       |
        | Open Eyes Session  |  http://www.navinet.net/ | RobotAppEyes_Test |  NaviNet_RobotAppEyes_Test |  YourApplitoolsKey  |  1024  |  768  |
        | Check Eyes Window  |  NaviNet Home            | True              |                            |                     |        |       |
        | Close Eyes Session |  False                   |                   |                            |                     |        |       |

        """
        if includeEyesLog is True:
            logger.set_logger(StdoutLogger())
            logger.open_()
        if httpDebugLog is True:
            httplib.HTTPConnection.debuglevel = 1

        eyes.check_window(name)
        searchElement = None

        if selector.upper() == 'CSS_SELECTOR':
            searchElement = By.CSS_SELECTOR
        elif selector.upper() == 'XPATH':
            searchElement = By.XPATH
        elif selector.upper() == 'ID':
            searchElement = By.ID
        elif selector.upper() == 'LINK TEXT':
            searchElement = By.LINK_TEXT
        elif selector.upper() == 'PARTIAL LINK TEXT':
            searchElement = By.PARTIAL_LINK_TEXT
        elif selector.upper() == 'NAME':
            searchElement = By.NAME
        elif selector.upper() == 'TAG NAME':
            searchElement = By.TAG_NAME
        elif selector.upper() == 'CLASS NAME':
            searchElement = By.CLASS_NAME
        else:
            raise InvalidElementStateException(
                'Please select a valid selector: CSS SELECTOR, XPATH, ID, LINK TEXT, PARTIAL LINK TEXT, NAME, TAG NAME, CLASS NAME')

        eyes.check_window(tag=name, target=Target().ignore(IgnoreRegionBySelector(searchElement, selector_value)))
def test_sample_script(eyes, driver):
    eyes.force_full_page_screenshot = True
    eyes.stitch_mode = StitchMode.CSS

    driver = eyes.open(driver, "Python app", "applitools", {
        'width': 800,
        'height': 600
    })
    driver.get('http://www.applitools.com')
    eyes.check_window(
        "Home",
        target=(Target().ignore(
            IgnoreRegionBySelector(By.CLASS_NAME, 'hero-container')).floating(
                FloatingRegion(Region(10, 20, 30, 40),
                               FloatingBounds(10, 0, 20, 10)))))

    hero = driver.find_element_by_class_name("hero-container")
    eyes.check_region_by_element(hero,
                                 "Page Hero",
                                 target=(Target().ignore(
                                     Region(20, 20, 50, 50),
                                     Region(40, 40, 10, 20))))
    eyes.close()
Beispiel #10
0
    def check_eyes_window_ignore_region_by_selector(
            self,
            selector,
            value,
            name,
            force_full_page_screenshot=False,
            includeEyesLog=False,
            httpDebugLog=False):
        """This is a new addition to test the latest functionality of ignoring regions"""

        if includeEyesLog is True:
            logger.set_logger(StdoutLogger())
            logger.open_()
        if httpDebugLog is True:
            httplib.HTTPConnection.debuglevel = 1

        searchElement = None

        if selector.upper() == 'CSS SELECTOR':
            searchElement = By.CSS_SELECTOR
        elif selector.upper() == 'XPATH':
            searchElement = By.XPATH
        elif selector.upper() == 'ID':
            searchElement = By.ID
        elif selector.upper() == 'LINK TEXT':
            searchElement = By.LINK_TEXT
        elif selector.upper() == 'PARTIAL LINK TEXT':
            searchElement = By.PARTIAL_LINK_TEXT
        elif selector.upper() == 'NAME':
            searchElement = By.NAME
        elif selector.upper() == 'TAG NAME':
            searchElement = By.TAG_NAME
        elif selector.upper() == 'CLASS NAME':
            searchElement = By.CLASS_NAME
        else:
            raise InvalidElementStateException(
                'Please select a valid selector: CSS SELECTOR, XPATH, ID, LINK TEXT, PARTIAL LINK TEXT, NAME, TAG NAME, CLASS NAME'
            )

        eyes.force_full_page_screenshot = force_full_page_screenshot
        eyes.check_window(name,
                          target=Target().ignore(
                              IgnoreRegionBySelector(searchElement, value)))
Beispiel #11
0
    def select_eyes_floating_region_by_selector(self,
                                                selector,
                                                value,
                                                left,
                                                up,
                                                right,
                                                down,
                                                includeEyesLog=False,
                                                httpDebugLog=False):
        """
        Selects the element, which could be floating on the page. Then you have assign the floating area. In the screenshot you can see a border around that element and a second
        boarder which is the floating area.
        Arguments:
                |  Selector (string)                | This will decide what element will be located. The supported selectors include: CSS SELECTOR, XPATH, ID, LINK TEXT, PARTIAL LINK TEXT, NAME, TAG NAME, CLASS NAME.    |
                |  Value (string)                   | The specific value of the selector. e.g. a CSS SELECTOR value .first.expanded.dropdown.                                                                               |                                                                                                                          |
                |  up       (int)                   | These four variables are making the border around the element where the floating element can move.                                                                                       |
                |  down     (int)                   |                                                                                                                                                                       |
                |  Left     (int)                   |                                                                                                                                                                       |
                |  Right    (int)                   |                                                                                                                                                                       |
                |  Include Eyes Log (default=False) | The Eyes logs will not be included by default. To activate, pass 'True' in the variable.                                                                              |
                |  HTTP Debug Log (default=False)   | The HTTP Debug logs will not be included by default. To activate, pass 'True' in the variable.                                                                        |

        Example:
        | *Keywords*                                |  *Parameters*        |               |                   |       |       |    |
        | Open Browser                              |  yourTestingUrl      | gc            |                   |       |       |    |
        | Open Eyes Session                         | yourAppName          | yourTestName  | YourApplitoolsKey |  1024 |  768  |    |
        | Select Eyes Floating Region By Selector   |  ID                  |  search-input |  20               | 10    | 20    | 10 |
        | Close Eyes Session                        |                      |               |                   |       |       |    |
        """

        check_logging(includeEyesLog, httpDebugLog)

        searchElement = get_search_element(selector)

        floating = Target().floating(
            FloatingRegionBySelector(searchElement, value,
                                     FloatingBounds(left, up, right, down)))
        eyes.check_window(target=floating)
Beispiel #12
0
 def test_check_region_in_a_very_big_frame(self):
     self.eyes.check("map",
                     Target.frame("frame1").region(By.TAG_NAME, "img"))
Beispiel #13
0
 def test_check_window_with_floating_by_selector_fluent(self):
     self.eyes.check(
         "Fluent - Window with floating region by selector",
         Target.window().floating(By.ID, "overflowing-div", 3, 3, 20, 30))
Beispiel #14
0
 def test_check_window_with_ignore_by_selector_fluent(self):
     self.eyes.check("Fluent - Window with ignore region by selector",
                     Target.window().ignore(By.ID, "overflowing-div"))
Beispiel #15
0
 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())
Beispiel #16
0
 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())
Beispiel #17
0
 def test_check_frame_in_frame_fully_fluent(self):
     self.eyes.check("Fluent - Full Frame in Frame",
                     Target.frame("frame1").frame("frame1-1").fully())
Beispiel #18
0
 def test_check_frame_fluent(self):
     self.eyes.check("Fluent - Frame", Target.frame("frame1"))
Beispiel #19
0
 def test_check_region_with_ignore_region_fluent(self):
     self.eyes.check("Fluent - Region with Ignore region",
                     Target.region(By.ID, "overflowing-div")).ignore(
                         Region(left=50, top=50, width=100, height=100))
Beispiel #20
0
 def test_check_window_with_ignore_region_fluent(self):
     self.eyes.check("Fluent - Window with Ignore region",
                     Target.window()).fully().timeout(5000).ignore(
                         Region(left=50, top=50, width=100, height=100))
Beispiel #21
0
 def test_check_element_fluent(self):
     element = self.driver.find_element(By.ID, 'overflowing-div-image')
     self.eyes.check("Fluent - Region by element", Target.region(element))
Beispiel #22
0
 def test_check_element_with_ignore_region_by_element_fluent(self):
     element = self.driver.find_element(By.ID, 'overflowing-div-image')
     ignore_element = self.driver.find_element(By.ID, 'overflowing-div')
     self.eye.check("Fluent - Region by element - fully",
                    Target.region(element).ignore(ignore_element))
Beispiel #23
0
 def test_check_element_fully_fluent(self):
     element = self.driver.find_element(By.ID, "overflowing-div-image")
     self.eyes.check("Fluent - Region by element - fully",
                     Target.region(element).fully())