From ed0377eae99c62449d53cae1800369397bb0b147 Mon Sep 17 00:00:00 2001 From: LiranApplitools Date: Tue, 10 Jan 2017 15:05:12 +0200 Subject: [PATCH 1/7] Batched bugs fix, hidescrollbars, forceful page screenshot Fixing bug in Branches - Adding capabilities of setting matchTimeout and hide scroll bar Moving the eyes.force_full_page_screenshot to the open_eyes_session instead of eyes_check_window --- RobotAppEyes/RobotAppEyes.py | 27 +++++++++++++++++++++------ 1 file changed, 21 insertions(+), 6 deletions(-) diff --git a/RobotAppEyes/RobotAppEyes.py b/RobotAppEyes/RobotAppEyes.py index f339e44..6a9e48c 100644 --- a/RobotAppEyes/RobotAppEyes.py +++ b/RobotAppEyes/RobotAppEyes.py @@ -72,6 +72,13 @@ class RobotAppEyes: """ ROBOT_LIBRARY_SCOPE = 'GLOBAL' ROBOT_LIBRARY_VERSION = VERSION + BatchDic=dict() + + def _eyes_set_batch(self,batchName): + if batchName is not None: + if batchName not in self.BatchDic.keys(): + self.BatchDic[batchName]=BatchInfo(batchName) + eyes.batch=self.BatchDic[batchName] def open_eyes_session(self, appname, @@ -87,7 +94,10 @@ def open_eyes_session(self, baselineName=None, batchName=None, branchname=None, - parentbranch=None): + parentbranch=None, + hideScrollBar=False, + fullPageScrennshot=False, + matchTimeout=None): """ Starts a session with the Applitools Eyes Website. @@ -129,6 +139,12 @@ def open_eyes_session(self, global eyes eyes = Eyes() eyes.api_key = apikey + self._eyes_set_batch(batchName) + eyes.force_full_page_screenshot = fullPageScrennshot + 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 @@ -142,11 +158,10 @@ def open_eyes_session(self, 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 batchName is not None: - batch =BatchInfo(batchName) - eyes.batch = batch if matchlevel is not None: eyes.match_level = matchlevel if parentbranch is not None: @@ -161,7 +176,8 @@ def open_eyes_session(self, eyes.open(driver, appname, testname, {'width': intwidth, 'height': intheight}) - def check_eyes_window(self, name, force_full_page_screenshot=False, + + def check_eyes_window(self, name, includeEyesLog=False, httpDebugLog=False): """ Takes a snapshot from the browser using the web driver and matches it with @@ -188,7 +204,6 @@ def check_eyes_window(self, name, force_full_page_screenshot=False, 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(self, element, width, height, name, includeEyesLog=False, httpDebugLog=False): From 92e8d4f79a460fa7df2e4151997a142e8b7547f8 Mon Sep 17 00:00:00 2001 From: LiranApplitools Date: Tue, 10 Jan 2017 16:08:20 +0200 Subject: [PATCH 2/7] Batches, MatchTimeout, Hidescrollbars example Adding an example from Applitools with Batches and MatchTimeout and Hidescrollbars. In addition fixing comments in RobotAppEyes --- RobotAppEyes/RobotAppEyes.py | 27 +++++++++++++------------ Tests/acceptance/DemoTest.robot | 36 +++++++++++++++++++++++++++++++++ 2 files changed, 50 insertions(+), 13 deletions(-) create mode 100644 Tests/acceptance/DemoTest.robot diff --git a/RobotAppEyes/RobotAppEyes.py b/RobotAppEyes/RobotAppEyes.py index 6a9e48c..50cfec0 100644 --- a/RobotAppEyes/RobotAppEyes.py +++ b/RobotAppEyes/RobotAppEyes.py @@ -102,18 +102,20 @@ def open_eyes_session(self, 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 | + | 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 Creates an instance of the Selenium2Library webdriver. Defines a global driver and sets the Selenium2Library webdriver to the global driver. @@ -185,7 +187,6 @@ def check_eyes_window(self, name, 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. | diff --git a/Tests/acceptance/DemoTest.robot b/Tests/acceptance/DemoTest.robot new file mode 100644 index 0000000..acf99a2 --- /dev/null +++ b/Tests/acceptance/DemoTest.robot @@ -0,0 +1,36 @@ +*** Settings *** +Library Selenium2Library +Library RobotAppEyes + +*** Variables *** +### Selenium2Library Variables ### +${Timeout} 15 + +### Css Variables ### +${Features} css=.features>a + +### Applitools Variables ### +${Applitools-url} https://www.applitools.com/ +${Applitools-AppName} MyAppName +${Applitools-TestName} MyTestName +${Applitools-Key} YOUR_API_KEY +${Width} 1000 +${Height} 800 +${MatchLevel} LAYOUT2 +${True} True +${False} False +${batchName} MyBatchName +${matchTimeout} 3 + +*** Test Cases *** + +Test1 + [Documentation] + Open Browser ${Applitools-url} Chrome + Open Eyes Session appname=${Applitools-AppName} testname=${Applitools-TestName} apikey=${Applitools-Key} width=${Width} height=${Height} matchlevel=${MatchLevel} fullPageScrennshot=${False} hideScrollBar=${True} batchName=${batchName} matchTimeout=${matchTimeout} + Check Eyes Window Main Page New + Close Browser + Close Eyes Session + + + From 827e32ba2c0ce126c65d9636e77ca086392112f9 Mon Sep 17 00:00:00 2001 From: LiranApplitools Date: Wed, 11 Jan 2017 12:32:32 +0200 Subject: [PATCH 3/7] removing typo --- RobotAppEyes/RobotAppEyes.py | 2 +- Tests/acceptance/DemoTest.robot | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/RobotAppEyes/RobotAppEyes.py b/RobotAppEyes/RobotAppEyes.py index 50cfec0..e1000cb 100644 --- a/RobotAppEyes/RobotAppEyes.py +++ b/RobotAppEyes/RobotAppEyes.py @@ -96,7 +96,7 @@ def open_eyes_session(self, branchname=None, parentbranch=None, hideScrollBar=False, - fullPageScrennshot=False, + fullPageScreenshot=False, matchTimeout=None): """ Starts a session with the Applitools Eyes Website. diff --git a/Tests/acceptance/DemoTest.robot b/Tests/acceptance/DemoTest.robot index acf99a2..9fb7d13 100644 --- a/Tests/acceptance/DemoTest.robot +++ b/Tests/acceptance/DemoTest.robot @@ -27,7 +27,7 @@ ${matchTimeout} 3 Test1 [Documentation] Open Browser ${Applitools-url} Chrome - Open Eyes Session appname=${Applitools-AppName} testname=${Applitools-TestName} apikey=${Applitools-Key} width=${Width} height=${Height} matchlevel=${MatchLevel} fullPageScrennshot=${False} hideScrollBar=${True} batchName=${batchName} matchTimeout=${matchTimeout} + Open Eyes Session appname=${Applitools-AppName} testname=${Applitools-TestName} apikey=${Applitools-Key} width=${Width} height=${Height} matchlevel=${MatchLevel} fullPageScreenshot=${False} hideScrollBar=${True} batchName=${batchName} matchTimeout=${matchTimeout} Check Eyes Window Main Page New Close Browser Close Eyes Session From c304d3ff18f5f4771a978dfb0cd9113f9c3d0645 Mon Sep 17 00:00:00 2001 From: LiranApplitools Date: Wed, 11 Jan 2017 13:43:42 +0200 Subject: [PATCH 4/7] Demo test - ellaboration updating the example to demonstrate usage of number of batches in the same run. --- Tests/acceptance/DemoTest.robot | 21 +++++++++++++++++++-- 1 file changed, 19 insertions(+), 2 deletions(-) diff --git a/Tests/acceptance/DemoTest.robot b/Tests/acceptance/DemoTest.robot index 9fb7d13..ad8ccab 100644 --- a/Tests/acceptance/DemoTest.robot +++ b/Tests/acceptance/DemoTest.robot @@ -19,7 +19,8 @@ ${Height} 800 ${MatchLevel} LAYOUT2 ${True} True ${False} False -${batchName} MyBatchName +${firstBatchName} MyBatchName +${secondBatchName} MyBatchName ${matchTimeout} 3 *** Test Cases *** @@ -27,10 +28,26 @@ ${matchTimeout} 3 Test1 [Documentation] Open Browser ${Applitools-url} Chrome - Open Eyes Session appname=${Applitools-AppName} testname=${Applitools-TestName} apikey=${Applitools-Key} width=${Width} height=${Height} matchlevel=${MatchLevel} fullPageScreenshot=${False} hideScrollBar=${True} batchName=${batchName} matchTimeout=${matchTimeout} + Open Eyes Session appname=${Applitools-AppName} testname=${Applitools-TestName} apikey=${Applitools-Key} width=${Width} height=${Height} matchlevel=${MatchLevel} fullPageScreenshot=${False} hideScrollBar=${True} batchName=${firstBatchName} matchTimeout=${matchTimeout} Check Eyes Window Main Page New Close Browser Close Eyes Session +Test2 + [Documentation] + Open Browser ${Applitools-url} Chrome + Open Eyes Session appname=${Applitools-AppName} testname=${Applitools-TestName} apikey=${Applitools-Key} width=${Width} height=${Height} matchlevel=${MatchLevel} fullPageScreenshot=${False} hideScrollBar=${True} batchName=${secondBatchName} matchTimeout=${matchTimeout} + Check Eyes Window Main Page New + Close Browser + Close Eyes Session + + +Test3 + [Documentation] + Open Browser ${Applitools-url} Chrome + Open Eyes Session appname=${Applitools-AppName} testname=${Applitools-TestName} apikey=${Applitools-Key} width=${Width} height=${Height} matchlevel=${MatchLevel} fullPageScreenshot=${False} hideScrollBar=${True} batchName=${firstBatchName} matchTimeout=${matchTimeout} + Check Eyes Window Main Page New + Close Browser + Close Eyes Session \ No newline at end of file From 3a81dbd99bb6d8b23a828e9b1917df03ea7f8717 Mon Sep 17 00:00:00 2001 From: LiranApplitools Date: Wed, 18 Jan 2017 19:49:37 +0200 Subject: [PATCH 5/7] fix typo in screenshot --- RobotAppEyes/RobotAppEyes.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/RobotAppEyes/RobotAppEyes.py b/RobotAppEyes/RobotAppEyes.py index e1000cb..b9a74c6 100644 --- a/RobotAppEyes/RobotAppEyes.py +++ b/RobotAppEyes/RobotAppEyes.py @@ -142,7 +142,7 @@ def open_eyes_session(self, eyes = Eyes() eyes.api_key = apikey self._eyes_set_batch(batchName) - eyes.force_full_page_screenshot = fullPageScrennshot + eyes.force_full_page_screenshot = fullPageScreenshot eyes.hide_scrollbars = hideScrollBar if baselineName is not None: eyes.baseline_name = baselineName # (str) From 862f30837893883ef7d9cf1a3067078da55982aa Mon Sep 17 00:00:00 2001 From: LiranApplitools Date: Mon, 27 Mar 2017 12:39:08 +0300 Subject: [PATCH 6/7] JenkinsPlugin Addition --- RobotAppEyes/RobotAppEyes.py | 18 +++++++---- Tests/acceptance/DemoTest.robot | 8 ++--- Tests/acceptance/DemoTestJenkinsPlugin.robot | 33 ++++++++++++++++++++ 3 files changed, 49 insertions(+), 10 deletions(-) create mode 100644 Tests/acceptance/DemoTestJenkinsPlugin.robot diff --git a/RobotAppEyes/RobotAppEyes.py b/RobotAppEyes/RobotAppEyes.py index b9a74c6..5cc5d77 100644 --- a/RobotAppEyes/RobotAppEyes.py +++ b/RobotAppEyes/RobotAppEyes.py @@ -74,10 +74,14 @@ class RobotAppEyes: ROBOT_LIBRARY_VERSION = VERSION BatchDic=dict() - def _eyes_set_batch(self,batchName): - if batchName is not None: - if batchName not in self.BatchDic.keys(): - self.BatchDic[batchName]=BatchInfo(batchName) + def _eyes_set_batch(self,batchName,ApplitoolsJenkinsPlugin): + batch = BatchInfo(batchName) + if ApplitoolsJenkinsPlugin is True: + batch.id = os.environ('APPLITOOLS_BATCH_ID') + if batchName is None: + batch.name = os.environ('JOB_NAME') + if batchName not in self.BatchDic.keys(): + self.BatchDic[batchName]=batch eyes.batch=self.BatchDic[batchName] def open_eyes_session(self, @@ -93,6 +97,7 @@ def open_eyes_session(self, httpDebugLog=False, baselineName=None, batchName=None, + ApplitoolsJenkinsPlugin=False, branchname=None, parentbranch=None, hideScrollBar=False, @@ -116,6 +121,7 @@ def open_eyes_session(self, | (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 Creates an instance of the Selenium2Library webdriver. Defines a global driver and sets the Selenium2Library webdriver to the global driver. @@ -141,7 +147,7 @@ def open_eyes_session(self, global eyes eyes = Eyes() eyes.api_key = apikey - self._eyes_set_batch(batchName) + self._eyes_set_batch(batchName,ApplitoolsJenkinsPlugin) eyes.force_full_page_screenshot = fullPageScreenshot eyes.hide_scrollbars = hideScrollBar if baselineName is not None: @@ -161,7 +167,7 @@ def open_eyes_session(self, if browsername is not None: eyes.host_app = browsername # (str) if matchTimeout is not None: - eyes.match_timeout(int(matchTimeout)) + eyes._match_timeout= int(matchTimeout) if baselineName is not None: eyes.baseline_name = baselineName # (str) if matchlevel is not None: diff --git a/Tests/acceptance/DemoTest.robot b/Tests/acceptance/DemoTest.robot index ad8ccab..869e642 100644 --- a/Tests/acceptance/DemoTest.robot +++ b/Tests/acceptance/DemoTest.robot @@ -19,16 +19,16 @@ ${Height} 800 ${MatchLevel} LAYOUT2 ${True} True ${False} False -${firstBatchName} MyBatchName -${secondBatchName} MyBatchName -${matchTimeout} 3 +${firstBatchName} MyBatchName +${secondBatchName} MyBatchName2 +${matchTimeout} 3000 *** Test Cases *** Test1 [Documentation] Open Browser ${Applitools-url} Chrome - Open Eyes Session appname=${Applitools-AppName} testname=${Applitools-TestName} apikey=${Applitools-Key} width=${Width} height=${Height} matchlevel=${MatchLevel} fullPageScreenshot=${False} hideScrollBar=${True} batchName=${firstBatchName} matchTimeout=${matchTimeout} + Open Eyes Session appname=${Applitools-AppName} testname=${Applitools-TestName} apikey=${Applitools-Key} width=${Width} height=${Height} matchlevel=${MatchLevel} batchName=${firstBatchName} fullPageScreenshot=${False} hideScrollBar=${True} matchTimeout=${matchTimeout} Check Eyes Window Main Page New Close Browser Close Eyes Session diff --git a/Tests/acceptance/DemoTestJenkinsPlugin.robot b/Tests/acceptance/DemoTestJenkinsPlugin.robot new file mode 100644 index 0000000..98207f4 --- /dev/null +++ b/Tests/acceptance/DemoTestJenkinsPlugin.robot @@ -0,0 +1,33 @@ +*** Settings *** +Library Selenium2Library +Library RobotAppEyes + +*** Variables *** +### Selenium2Library Variables ### +${Timeout} 15 + +### Css Variables ### +${Features} css=.features>a + +### Applitools Variables ### +${Applitools-url} https://www.applitools.com/ +${Applitools-AppName} MyAppName +${Applitools-TestName} MyTestName +${Applitools-Key} YOUR_API_KEY +${Width} 1000 +${Height} 800 +${MatchLevel} LAYOUT2 +${True} True +${False} False +${firstBatchName} MyBatchName +${matchTimeout} 3000 + +*** Test Cases *** + +Test1 + [Documentation] + Open Browser ${Applitools-url} Chrome + Open Eyes Session appname=${Applitools-AppName} testname=${Applitools-TestName} apikey=${Applitools-Key} width=${Width} height=${Height} matchlevel=${MatchLevel} batchName=${firstBatchName} ApplitoolsJenkinsPlugin=${True} fullPageScreenshot=${False} hideScrollBar=${True} matchTimeout=${matchTimeout} + Check Eyes Window Main Page New + Close Browser + Close Eyes Session From f0fef79b3ecd9d40d0bb5f1591fac333eb284c9e Mon Sep 17 00:00:00 2001 From: LiranApplitools Date: Wed, 29 Mar 2017 15:19:46 +0300 Subject: [PATCH 7/7] Read environment variable fix. --- RobotAppEyes/RobotAppEyes.py | 6 +- log.html | 2109 ++++++++++++++++++++++++++++++++++ 2 files changed, 2112 insertions(+), 3 deletions(-) create mode 100644 log.html diff --git a/RobotAppEyes/RobotAppEyes.py b/RobotAppEyes/RobotAppEyes.py index 5cc5d77..5f04377 100644 --- a/RobotAppEyes/RobotAppEyes.py +++ b/RobotAppEyes/RobotAppEyes.py @@ -77,12 +77,12 @@ class RobotAppEyes: def _eyes_set_batch(self,batchName,ApplitoolsJenkinsPlugin): batch = BatchInfo(batchName) if ApplitoolsJenkinsPlugin is True: - batch.id = os.environ('APPLITOOLS_BATCH_ID') + batch.id = os.environ['APPLITOOLS_BATCH_ID'] if batchName is None: - batch.name = os.environ('JOB_NAME') + batch.name = os.environ['JOB_NAME'] if batchName not in self.BatchDic.keys(): self.BatchDic[batchName]=batch - eyes.batch=self.BatchDic[batchName] + eyes.batch=self.BatchDic[batchName] def open_eyes_session(self, appname, diff --git a/log.html b/log.html new file mode 100644 index 0000000..5b10ebd --- /dev/null +++ b/log.html @@ -0,0 +1,2109 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+

Opening Robot Framework log failed

+
    +
  • Verify that you have JavaScript enabled in your browser.
  • +
  • Make sure you are using a modern enough browser. Firefox 3.5, IE 8, or equivalent is required, newer browsers are recommended.
  • +
  • Check are there messages in your browser's JavaScript error log. Please report the problem if you suspect you have encountered a bug.
  • +
+
+ + + +
+ + + + + + + + + + + + + + + + + + + + + + + + +