From c26ead5aad4fd31d8548dbee45c27ef3d06d82e3 Mon Sep 17 00:00:00 2001 From: hellmanj Date: Wed, 17 Dec 2014 15:41:33 -0500 Subject: [PATCH 1/3] QAR-48091: change scope of Page to Test Suite instead of Global to get S2L re-imported for every suite --- robotpageobjects/page.py | 1 + 1 file changed, 1 insertion(+) diff --git a/robotpageobjects/page.py b/robotpageobjects/page.py index 35c52f8..f4a7266 100755 --- a/robotpageobjects/page.py +++ b/robotpageobjects/page.py @@ -119,6 +119,7 @@ class Page(_BaseActions, _SelectorsManager, _ComponentsManager): It is a robotframework library which implements the dynamic API. """ __metaclass__ = _PageMeta + ROBOT_LIBRARY_SCOPE = 'TEST SUITE' def __init__(self): """ From 2668e7eb61fc31f02996758f89f3d7b72cd0897d Mon Sep 17 00:00:00 2001 From: hellmanj Date: Wed, 17 Dec 2014 16:00:32 -0500 Subject: [PATCH 2/3] catch new form of sauce labs auth error --- robotpageobjects/base.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/robotpageobjects/base.py b/robotpageobjects/base.py index dfb327c..b364ec1 100755 --- a/robotpageobjects/base.py +++ b/robotpageobjects/base.py @@ -8,6 +8,7 @@ from robot.utils import asserts from selenium import webdriver from selenium.webdriver.support.ui import WebDriverWait +from selenium.common.exceptions import WebDriverException from Selenium2Library import Selenium2Library from Selenium2Library.keywords.keywordgroup import KeywordGroupMetaClass from . import abstractedlogger @@ -822,7 +823,7 @@ class MyPageObject(PageObject): try: self.open_browser(resolved_url, self.browser, remote_url=remote_url, desired_capabilities=caps) - except urllib2.HTTPError: + except (urllib2.HTTPError, WebDriverException): raise exceptions.SauceConnectionError("Unable to connect to sauce labs. Check your username and " "apikey") From a12aa9a05745adaa6bc0203e5a29e6954f1f3c57 Mon Sep 17 00:00:00 2001 From: hellmanj Date: Wed, 17 Dec 2014 16:26:49 -0500 Subject: [PATCH 3/3] QAR-48091: test s2l stays imported after importing the same PO in multiple suites --- tests/scenarios/test_s2l_imported_multiple_a.robot | 11 +++++++++++ tests/scenarios/test_s2l_imported_multiple_b.robot | 11 +++++++++++ tests/test_functional.py | 7 +++++++ 3 files changed, 29 insertions(+) create mode 100755 tests/scenarios/test_s2l_imported_multiple_a.robot create mode 100755 tests/scenarios/test_s2l_imported_multiple_b.robot diff --git a/tests/scenarios/test_s2l_imported_multiple_a.robot b/tests/scenarios/test_s2l_imported_multiple_a.robot new file mode 100755 index 0000000..ecd0cc1 --- /dev/null +++ b/tests/scenarios/test_s2l_imported_multiple_a.robot @@ -0,0 +1,11 @@ +*** Settings *** + +Documentation Tests for Robot Framework Page Object package. +Library widget_template.WidgetItemPage + +*** Test Cases *** + +Test Widget Site + Open Widget Item Page category=home-and-garden id=123 + Title Should Be Cool Widget + [Teardown] Close Widget Item Page diff --git a/tests/scenarios/test_s2l_imported_multiple_b.robot b/tests/scenarios/test_s2l_imported_multiple_b.robot new file mode 100755 index 0000000..ecd0cc1 --- /dev/null +++ b/tests/scenarios/test_s2l_imported_multiple_b.robot @@ -0,0 +1,11 @@ +*** Settings *** + +Documentation Tests for Robot Framework Page Object package. +Library widget_template.WidgetItemPage + +*** Test Cases *** + +Test Widget Site + Open Widget Item Page category=home-and-garden id=123 + Title Should Be Cool Widget + [Teardown] Close Widget Item Page diff --git a/tests/test_functional.py b/tests/test_functional.py index 7780075..f00acc2 100755 --- a/tests/test_functional.py +++ b/tests/test_functional.py @@ -615,3 +615,10 @@ def test_gen_doc(self): doc = kwentry.findall('./doc')[0] if 'DEBUG' not in doc.text: raise AssertionError('Expected to find "DEBUG" in docmentation for "Log" in %s' % outxml) + +class MultipleSuiteLibraryImport(BaseTestCase): + + def test_libraries_stay_imported(self): + self.set_baseurl_env() + run = self.run_scenario("test_s2l_imported_multiple_a.robot test_s2l_imported_multiple_b.robot") + self.assert_run(run, expected_returncode=0) \ No newline at end of file