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})
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") eyes.close() finally:
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)