def close_eyes_session(self, includeEyesLog=False, httpDebugLog=False): """ Closes a session and returns the results of the session. If a test is running, aborts it. Otherwise, does nothing. The RobotAppEyesTest.txt test will fail after the first run, this is because a baseline is being created and will be accepted automatically by Applitools Eyes. A second test run will show a successful comparison between screens and the test will pass. Arguments: | 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 Region By Selector | LINK TEXT | RESOURCES | NaviNetLinkTextElement | | | | | Close Eyes Session | | | | | | | """ if includeEyesLog is True: logger.set_logger(StdoutLogger()) logger.open_() if httpDebugLog is True: httplib.HTTPConnection.debuglevel = 1 eyes.close() eyes.abort_if_not_closed()
def check_eyes_region(self, element, width, height, name, includeEyesLog=False, httpDebugLog=False): """ Takes a snapshot of the given region from the browser using the web driver to locate an xpath element with a certain width and height and matches it with the expected output. The width and the height cannot be greater than the width and the height specified in the open_eyes_session keyword. Arguments: | Element (string) | This needs to be passed in as an xpath e.g. //*[@id="navbar"]/div/div | | Width (int) | The width of the region that is tested e.g. 500 | | Height (int) | The height of the region that is tested e.g. 120 | | 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 Region | //*[@id="navbar"]/div/div | 500 | 120 | NaviNet Navbar | | | | Close Eyes Session | False | | | | | | """ if includeEyesLog is True: logger.set_logger(StdoutLogger()) logger.open_() if httpDebugLog is True: httplib.HTTPConnection.debuglevel = 1 intwidth = int(width) intheight = int(height) searchElement = driver.find_element_by_xpath(element) location = searchElement.location region = Region(location["x"], location["y"], intwidth, intheight) eyes.check_region(region, name)
def check_eyes_window(self, name, force_full_page_screenshot=False, 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. | | Force Full Page Screenshot (default=False) | Will force the browser to take a screenshot of whole page. | | 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.force_full_page_screenshot = force_full_page_screenshot eyes.check_window(name)
def check_eyes_region_by_selector(self, selector, value, name, includeEyesLog=False, httpDebugLog=False, force_full_page_screenshot=True): """ Takes a snapshot of the region of the element found by calling find_element(by, value) from the browser using the web driver and matches it with the expected output. With a choice from eight selectors, listed below to check by. Arguments: | Selector (string) | This will decide what element will be located. Supported selectors: 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 | | 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. | | Force Full Page Screenshot (default=True) | Will force the browser to check the whole page for the value, rather than only search the viewable viewport. | 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 Region By Selector | CSS SELECTOR | .first.expanded.dropdown | NaviNetCssElement | | | | | Close Eyes Session | False | | | | | | NOTE: Breaks when attempting to find region to screenshot """ if includeEyesLog is True: logger.set_logger(StdoutLogger()) logger.open_() if httpDebugLog is True: http.client.HTTPConnection.debuglevel = 1 eyes.force_full_page_screenshot = force_full_page_screenshot searchElement = None searchByDict = { 'CSS SELECTOR': By.CSS_SELECTOR, 'XPATH': By.XPATH, 'ID': By.ID, 'LINK TEXT': By.LINK_TEXT, 'PARTIAL LINK TEXT': By.PARTIAL_LINK_TEXT, 'NAME': By.NAME, 'TAG NAME': By.TAG_NAME, 'CLASS NAME': By.CLASS_NAME } selector = selector.upper() if selector in searchByDict: searchElement = searchByDict[selector] else: raise InvalidElementStateException( 'Please select a valid selector: CSS SELECTOR, XPATH, ID, LINK TEXT, PARTIAL LINK TEXT, NAME, TAG NAME, CLASS NAME' ) eyes.check_region_by_selector(searchElement, value, name)
def check_eyes_region_by_selector(self, selector, value, name, includeEyesLog=False, httpDebugLog=False): """ Takes a snapshot of the region of the element found by calling find_element(by, value) from the browser using the web driver and matches it with the expected output. With a choice from eight selectors, listed below to check by. 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 | | 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 Region By Selector | CSS SELECTOR | .first.expanded.dropdown | NaviNetCssElement | | | | | Close Eyes Session | False | | | | | | """ 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.check_region_by_selector(searchElement, value, name)
def compare_image(self, path, imagename=None, target=None, ignore_mismatch=False, includeEyesLog=False, httpDebugLog=False): """ Select an image and send it to Eyes for comparison. A name can be used in place of the image's file name. Arguments: | Path | Path of the image to send to eyes for visual comparison. | | imagename (default=None) | Can manually set the name desired for the image passed in. If no name is passed in it will default file name of the image. | | 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 | | Compare Image | selenium-screenshot-1.png | Image Name Example | | | | | | Close Eyes Session | | | | | | | """ if imagename is None: tag = os.path.basename(path) else: tag = imagename eyes._ensure_running_session() if includeEyesLog is True: logger.set_logger(StdoutLogger()) logger.open_() if httpDebugLog is True: http.client.HTTPConnection.debuglevel = 1 with open(path, 'rb') as image_file: screenshot64 = image_file.read().encode('base64') screenshot = image_utils.image_from_bytes( base64.b64decode(screenshot64)) screenshotBytes = EyesWebDriverScreenshot.create_from_image( screenshot, eyes._driver) title = eyes._title app_output = {'title': title, 'screenshot64': None} user_inputs = [] #TODO: Research this aspect if target is None: target = Target() prepare_match_data = eyes._match_window_task._create_match_data_bytes( app_output, user_inputs, tag, ignore_mismatch, screenshotBytes, eyes.default_match_settings, target) eyes._match_window_task._agent_connector.match_window( eyes._match_window_task._running_session, prepare_match_data)
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 check_eyes_region_by_element(self, selector, value, name, includeEyesLog=False, httpDebugLog=False): """ Takes a snapshot of the region of the given selector and element value from the browser using the web driver and matches it with the expected output. With a choice from four selectors, listed below, to check by. Arguments: | Selector (string) | This will decide what element will be located. The supported selectors include: XPATH, ID, CLASS NAME, CSS SELECTOR | | Value (string) | The specific value of the selector. e.g. an xpath value //*[@id="navbar"]/div/div | | 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 Region By Element | CLASS NAME | container | NaviNetClassElement | | | | | Close Eyes Session | False | | | | | | """ if includeEyesLog is True: logger.set_logger(StdoutLogger()) logger.open_() if httpDebugLog is True: httplib.HTTPConnection.debuglevel = 1 searchElement = None if selector.upper() == 'XPATH': searchElement = driver.find_element_by_xpath(value) elif selector.upper() == 'ID': searchElement = driver.find_element_by_id(value) elif selector.upper() == 'CLASS NAME': searchElement = driver.find_element_by_class_name(value) elif selector.upper() == 'CSS SELECTOR': searchElement = driver.find_element_by_css_selector(value) else: raise InvalidElementStateException( 'Please select a valid selector: XPATH, ID, CLASS NAME, CSS SELECTOR' ) eyes.check_region_by_element(searchElement, name)
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)))
def open_eyes_session(self, appname, testname, apikey, width=None, height=None, osname=None, browsername=None, matchlevel=None, includeEyesLog=False, httpDebugLog=False, baselineName=None, batchName=None, branchname=None, parentbranch=None): """ Starts a session with the Applitools Eyes Website. Arguments: | Application Name (string) | The name of the application under test. | | Test Name (string) | The test name. | | API Key (string) | User's Applitools Eyes key. | | (Optional) Width (int) | The width of the browser window e.g. 1280 | | (Optional) Height (int) | The height of the browser window e.g. 1000 | | (Optional) Operating System (string) | The operating system of the test, can be used to override the OS name to allow cross OS verfication | | (Optional) Browser Name (string) | The browser name for the test, can be used to override the browser name to allow cross browser verfication | | (Optional) Match Level (string) | The match level for the comparison - can be STRICT, LAYOUT or CONTENT | | 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. | | Branch Name (default=False) | The branch to use to check test | | Parent Branch (default=False) | Parent Branch to base the new Branch on | Creates an instance of the Selenium2Library webdriver. Defines a global driver and sets the Selenium2Library webdriver to the global driver. Checks if there has been a width or height value passed in. If there no are values passed in, eyes calls the method open without the width and height values. Otherwise eyes calls open with the width and height values defined. The Height resolution should not be greater than 1000, this is currently Applitools maximum setting. Starts a session with the Applitools Eyes Website. See https://eyes.applitools.com/app/sessions/ Example: | *Keywords* | *Parameters* | | Open Browser | http://www.navinet.net/ | gc | | | | | | | | | | | Open Eyes Session | RobotAppEyes_Test | NaviNet_RobotAppEyes_Test | YourApplitoolsKey | 1024 | 768 | OSOverrideName | BrowserOverrideName | matchlevel=LAYOUT | includeEyesLog=True | httpDebugLog=True | | Check Eyes Window | NaviNet Home | | | | | | | | | | | | Close Eyes Session | False | | | | | | | | | | | """ global driver global eyes eyes = Eyes() eyes.api_key = apikey s2l = BuiltIn().get_library_instance('Selenium2Library') webdriver = s2l._current_browser() driver = webdriver if includeEyesLog is True: logger.set_logger(StdoutLogger()) logger.open_() if httpDebugLog is True: httplib.HTTPConnection.debuglevel = 1 if osname is not None: eyes.host_os = osname # (str) if browsername is not None: eyes.host_app = browsername # (str) if baselineName is not None: eyes.baseline_name = baselineName # (str) if batchName is not None: batch = BatchInfo(batchName) eyes.batch = batch if matchlevel is not None: eyes.match_level = matchlevel if parentbranch is not None: eyes.parent_branch_name = parentbranch # (str) if branchname is not None: eyes.branch_name = branchname # (str) if width is None and height is None: eyes.open(driver, appname, testname) else: intwidth = int(width) intheight = int(height) eyes.open(driver, appname, testname, { 'width': intwidth, 'height': intheight })
def open_eyes_session(self, appname, testname, apikey, applitoolsurl='https://eyessdk.applitools.com', library='Selenium2Library', width=None, height=None, osname=None, browsername=None, matchlevel=None, includeEyesLog=False, httpDebugLog=False, fullPageScreenshot=False, baselineName=None, batchName=None, branchname=None, parentbranch=None): """ Starts a session with the Applitools Eyes Website. Arguments: | Application Name (string) | The name of the application under test. | | Test Name (string) | The test name. | | API Key (string) | User's Applitools Eyes key. | library (optional) | Standard:Selenium2Library. If you use another one, assign the right library. | applitoolsurl (optional) | Standard:eyes.applitools.com. If you run in a cloud version, assign the right applitoolsurl. | (Optional) Width (int) | The width of the browser window e.g. 1280 | | (Optional) Height (int) | The height of the browser window e.g. 1000 | | (Optional) Operating System (string) | The operating system of the test, can be used to override the OS name to allow cross OS verfication | | (Optional) Browser Name (string) | The browser name for the test, can be used to override the browser name to allow cross browser verfication | | (Optional) Match Level (string) | The match level for the comparison - can be STRICT, LAYOUT or CONTENT | | Force Full Page Screenshot (default=False) | Will force the browser to take a screenshot of whole page. | | 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. | | baselineName (default=None) | New tests will be automatically saved as baseline. | batchName (default=None) | Tests with the same batchname will be unified as one group in the Test Manager screen. | Branch Name (default=False) | The branch to use to check test | | Parent Branch (default=False) | Parent Branch to base the new Branch on | Force full page screenshot (default=false) | The whole page will be in the screen shot Creates an instance of the library webdriver. Defines a global driver and sets the library webdriver to the global driver. Checks if there has been a width or height value passed in. If there no are values passed in, eyes calls the method open without the width and height values. Otherwise eyes calls open with the width and height values defined. The Height resolution should not be greater than 1000, this is currently Applitools maximum setting. Starts a session with the Applitools Eyes Website. See https://eyes.applitools.com/app/sessions/ Example: | *Keywords* | *Parameters* | | | | | | | | | | | | | Open Browser | yourTestingUrl | gc | | | | | | | | | | | | Open Eyes Session | yourAppName | yourTestName | YourApplitoolsKey| cloudapplitoolsurl | library | 1024 | 768 | OSOverrideName | BrowserOverrideName | matchlevel=LAYOUT | includeEyesLog=True | httpDebugLog=True | | Check Eyes Window | NaviNet Home | | | | | | | | | | | | | Close Eyes Session | False | | | | | | | | | | | | """ global driver global eyes eyes = Eyes(applitoolsurl) eyes.api_key = apikey eyes.force_full_page_screenshot = fullPageScreenshot in [ True, 'True', 'true', '1', 1 ] s2l = BuiltIn().get_library_instance(library) webdriver = s2l._current_browser() driver = webdriver if includeEyesLog is True: logger.set_logger(StdoutLogger()) logger.open_() if httpDebugLog is True: httplib.HTTPConnection.debuglevel = 1 if osname is not None: eyes.host_os = osname # (str) if browsername is not None: eyes.host_app = browsername # (str) if baselineName is not None: eyes.baseline_name = baselineName # (str) if batchName is not None: batch = BatchInfo(batchName) eyes.batch = batch if matchlevel is not None: eyes.match_level = matchlevel if parentbranch is not None: eyes.parent_branch_name = parentbranch # (str) if branchname is not None: eyes.branch_name = branchname # (str) if width is None and height is None: eyes.open(driver, appname, testname) else: intwidth = int(width) intheight = int(height) eyes.open(driver, appname, testname, { 'width': intwidth, 'height': intheight })
def check_logging(includeEyesLog, httpDebugLog): if includeEyesLog is True: logger.set_logger(StdoutLogger()) logger.open_() if httpDebugLog is True: httplib.HTTPConnection.debuglevel = 1
from selenium import webdriver from applitools import logger from applitools.logger import StdoutLogger from applitools.eyes import Eyes from applitools.common import StitchMode import os #os.environ['HTTPS_PROXY'] = "http://localhost:8888" driver = webdriver.Chrome() eyes = Eyes() eyes.api_key = os.environ['APPLITOOLS_API_KEY'] logger.set_logger(StdoutLogger()) # Force Eyes to grab a full page screenshot. eyes.force_full_page_screenshot = True eyes.stitch_mode = StitchMode.CSS try: driver = eyes.open(driver, "Python app", "applitools", { 'width': 800, 'height': 600 }) driver.get('http://www.applitools.com') eyes.check_window("Home") automated_paragraph = driver.find_element_by_class_name("automated") eyes.check_region_by_element(automated_paragraph, "Automated Testing Paragraph")
def open_eyes_session(self, appname, testname, apikey, width=None, height=None, osname=None, browsername=None, matchlevel=None, includeEyesLog=False, httpDebugLog=False, baselineName=None, batchName=None, ApplitoolsJenkinsPlugin=False, branchname=None, parentbranch=None, hideScrollBar=False, fullPageScreenshot=False, matchTimeout=None, cssStitch=None): """ Starts a session with the Applitools Eyes Website. Arguments: | Application Name (string) | The name of the application under test. | | Test Name (string) | The test name. | | API Key (string) | User's Applitools Eyes key. | | (Optional) Width (int) | The width of the browser window e.g. 1280 | | (Optional) Height (int) | The height of the browser window e.g. 1000 | | (Optional) Operating System (string) | The operating system of the test, can be used to override the OS name to allow cross OS verfication | | (Optional) Browser Name (string) | The browser name for the test, can be used to override the browser name to allow cross browser verfication | | (Optional) Match Level (string) | The match level for the comparison - can be STRICT, LAYOUT or CONTENT | | 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. | | (Optional) Branch Name (default=None) | The branch to use to check test | For further information - http://support.applitools.com/customer/portal/articles/2142886 | (Optional)Parent Branch (default=None) | Parent Branch to base the new Branch on | For further information - http://support.applitools.com/customer/portal/articles/2142886 | (Optional) fullPageScrennshot (default=False) | Will force the browser to take a screenshot of whole page. | | (Optional) matchTimeout | The amount of time that Eyes will wait for an image to stabilize to a point that it is similar to the baseline image | For further information - http://support.applitools.com/customer/portal/articles/2099488 | (Optional) ApplitoolsJenkinsPlugin (Boolean) | Integration with Applitools Jenkins Plugin | For further information - http://support.applitools.com/customer/portal/articles/2689601 | (Optional) cssStitch (string) | Scrolling option either Scroll or CSS | For further information - http://support.applitools.com/customer/portal/articles/2249374 Creates an instance of the Selenium2Library webdriver. Defines a global driver and sets the Selenium2Library webdriver to the global driver. Checks if there has been a width or height value passed in. If there no are values passed in, eyes calls the method open without the width and height values. Otherwise eyes calls open with the width and height values defined. The Height resolution should not be greater than 1000, this is currently Applitools maximum setting. Starts a session with the Applitools Eyes Website. See https://eyes.applitools.com/app/sessions/ Example: | *Keywords* | *Parameters* | | Open Browser | http://www.navinet.net/ | gc | | | | | | | | | | | Open Eyes Session | RobotAppEyes_Test | NaviNet_RobotAppEyes_Test | YourApplitoolsKey | 1024 | 768 | OSOverrideName | BrowserOverrideName | matchlevel=LAYOUT | includeEyesLog=True | httpDebugLog=True | | Check Eyes Window | NaviNet Home | | | | | | | | | | | | Close Eyes Session | False | | | | | | | | | | | """ global driver global eyes eyes = Eyes() eyes.api_key = apikey self._eyes_set_batch(batchName,ApplitoolsJenkinsPlugin) eyes.force_full_page_screenshot = fullPageScreenshot eyes.hide_scrollbars = hideScrollBar if baselineName is not None: eyes.baseline_name = baselineName # (str) s2l = BuiltIn().get_library_instance('Selenium2Library') webdriver = s2l._current_browser() driver = webdriver if includeEyesLog is True: logger.set_logger(StdoutLogger()) logger.open_() if httpDebugLog is True: httplib.HTTPConnection.debuglevel = 1 if osname is not None: eyes.host_os = osname # (str) if browsername is not None: eyes.host_app = browsername # (str) if matchTimeout is not None: eyes._match_timeout= int(matchTimeout) if baselineName is not None: eyes.baseline_name = baselineName # (str) if matchlevel is not None: eyes.match_level = matchlevel if parentbranch is not None: eyes.parent_branch_name = parentbranch # (str) if branchname is not None: eyes.branch_name = branchname # (str) if cssStitch is not None: if cssStitch == 'CSS': eyes.stitch_mode = StitchMode.CSS elif cssStitch == 'Scroll': eyes.stitch_mode = StitchMode.Scroll if width is None and height is None: eyes.open(driver, appname, testname) else: intwidth = int(width) intheight = int(height) eyes.open(driver, appname, testname, {'width': intwidth, 'height': intheight})
def open_eyes_session(self, appname, testname, apikey, matchlevel=None, includeEyesLog=False, httpDebugLog=False, use_css_transition=False, baselineName=None, batch=None): """ Starts a session with the Applitools Eyes Website. Arguments: | Application Name (string) | The name of the application under test. | | Test Name (string) | The test name. | | API Key (string) | User's Applitools Eyes key. | | (Optional) Match Level (string) | The match level for the comparison - can be STRICT, LAYOUT or CONTENT | | 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. | | Use CSS Transition (default=False) | Uses CSS Transition instead of actual scrolling for full page screenshots. To activate, pass 'True' in the variable. | | (Optional) Baseline Name (string) | The name of the baseline to compare test to. Should be used for cross browser verification | | (Optional) Batch (BatchInfo) | The batch to place the test into. Should be a BatchInfo object | Defines a global driver, and eyes. Starts a session with the Applitools Eyes Website. See https://eyes.applitools.com/app/sessions/ Example: | *Keywords* | *Parameters* | | Open Browser | http://www.navinet.net/ | gc | | | | | | | | | | ${batch} | Create Eyes Batch | Batch Name | | | | | | | | | | Open Eyes Session | RobotAppEyes_Test | NaviNet_RobotAppEyes_Test | YourApplitoolsKey | matchlevel=LAYOUT | includeEyesLog=True | httpDebugLog=True | use_css_transition=True | baselineName='Baseline' | batch=${batch} | | Check Eyes Window | NaviNet Home | | | | | | | | | | | Close Eyes Session | False | | | | | | | | | | """ global driver global eyes eyes = Eyes() eyes.api_key = apikey driver = self.get_webdriver_instance() if includeEyesLog is True: logger.set_logger(StdoutLogger()) logger.open_() if httpDebugLog is True: http.client.HTTPConnection.debuglevel = 1 if baselineName is not None: eyes.baseline_branch_name = baselineName # (str) if batch is not None: eyes.batch = batch if matchlevel is not None: eyes.match_level = matchlevel stitch_mode = StitchMode.Scroll if isinstance(use_css_transition, bool): if use_css_transition == True: stitch_mode = StitchMode.CSS elif use_css_transition.lower() == 'true': stitch_mode = StitchMode.CSS eyes.stitch_mode = stitch_mode eyes.open(driver, appname, testname)