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 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, 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})
from applitools import logger from applitools.eyes import Eyes import os # Appium session configuration. from applitools.logger import StdoutLogger desired_capabilities = {'platformName': 'Android', 'platformVersion': '4.2', 'deviceName': 'Samsung Galaxy S5', 'app': os.environ['ANDROID_NOTES_LIST_APP'], 'app-package': 'com.example.android.notepad', 'app-activity': '.NotesList', 'newCommandTimeout': 300} # Assuming Appium is running on localhost. driver = webdriver.Remote('http://127.0.0.1:4723/wd/hub', desired_capabilities) driver.orientation = 'LANDSCAPE' logger.set_logger(StdoutLogger()) eyes = Eyes("https://localhost.applitools.com") eyes.api_key = os.environ['APPLITOOLS_API_KEY'] eyes.baseline_name = "NotesList 1080x1794" try: eyes.open(driver, 'Appium', 'Notes list') eyes.check_window('Opening screen') eyes.close() finally: driver.quit() eyes.abort_if_not_closed()