diff --git a/.gitignore b/.gitignore index 98cbbde..99c1d72 100644 --- a/.gitignore +++ b/.gitignore @@ -2,6 +2,7 @@ RELEASE-VERSION .idea *.pyc *.egg-info +*.egg *.log report.html log.html @@ -9,4 +10,6 @@ output.xml \#*\# *~ nosetests.xml -po_log.txt \ No newline at end of file +po_log.txt +libdoc.xml + diff --git a/.travis.yml b/.travis.yml index 3d443ad..01ba5d5 100755 --- a/.travis.yml +++ b/.travis.yml @@ -1,17 +1,23 @@ -env: - global: +env: + global: secure: aStjr7/mZJDdPqJ210HPRZygxXA36SzXyBraK9x6eqaDR+yqZpGJBIYMlRzqV1Fwlh1BUFbOYNczmLEQs+Sf3uPxyEWhFc5L0qKlvUE98fsf6IJuFJdwfwBG1/vrJTNm0JviBI/6lPlB2/EYtJJBWmYQGsrXXoP5Cc38T+z/a0s= language: python python: - - "2.7" + - 2.7 + - 3.5 +matrix: + allow_failures: + - python: 3.5 install: + # for Python 3 we need robotframework-selenium2library 1.8.x + - if [ $TRAVIS_PYTHON_VERSION == 3.5 ]; then pip install -U https://github.com/HelioGuilherme66/robotframework-selenium2library/archive/v1.8.0b3.tar.gz; fi - pip install . script: - - nosetests -vs --with-xunit tests/test_unit.py tests/test_functional.py + - nosetests -vs --with-xunit robotpageobjects/tests/test_unit.py robotpageobjects/tests/test_functional.py deploy: provider: pypi user: hellmanj - password: + password: secure: D5T3Wo8DGHxxU5+7kE+y6uVVrxoOhLfiCZl9q3BEE9OrbnGmzFngRfP1o37ulk78v7PQGNqtn+95nWOWthJcp4897eB6YhKsa1Q8+HSlNynsf/7WW2cgTEgSWppZNaMoUF+my1NW2baKbmcgwRt3Hsxz9HkOvoFfQAR0ZovUy1U= on: tags: true diff --git a/Makefile b/Makefile new file mode 100644 index 0000000..9dad33d --- /dev/null +++ b/Makefile @@ -0,0 +1,8 @@ +SHELL := /bin/bash +CURRENT_DIR:=$(shell dirname $(realpath $(lastword $(MAKEFILE_LIST)))) + +all: test + +test: + @echo "Run Tests" + nosetests -vs --with-xunit robotpageobjects/tests/test_unit.py robotpageobjects/tests/test_functional.py diff --git a/requirements.txt b/requirements.txt index fb94389..a5dfc43 100755 --- a/requirements.txt +++ b/requirements.txt @@ -1,5 +1,6 @@ decorator mock==1.0.1 requests==2.1.0 -robotframework-selenium2library==1.7.2 +robotframework-selenium2library +six uritemplate==0.6 diff --git a/robotpageobjects/__init__.py b/robotpageobjects/__init__.py index 589b28c..b4c5c8c 100755 --- a/robotpageobjects/__init__.py +++ b/robotpageobjects/__init__.py @@ -1,4 +1,3 @@ -from .base import Override, robot_alias, not_keyword -from .page import Page -from .component import Component - +from robotpageobjects.base import Override, robot_alias, not_keyword +from robotpageobjects.page import Page +from robotpageobjects.component import Component diff --git a/robotpageobjects/abstractedlogger.py b/robotpageobjects/abstractedlogger.py index 0cac87a..d057537 100755 --- a/robotpageobjects/abstractedlogger.py +++ b/robotpageobjects/abstractedlogger.py @@ -3,8 +3,8 @@ import robot.api.logger import robot.output.pyloggingconf as robot_logging_conf -from optionhandler import OptionHandler -from context import Context +from robotpageobjects.optionhandler import OptionHandler +from robotpageobjects.context import Context class Logger(object): diff --git a/robotpageobjects/base.py b/robotpageobjects/base.py index ba4b11b..3351082 100755 --- a/robotpageobjects/base.py +++ b/robotpageobjects/base.py @@ -11,10 +11,10 @@ from Selenium2Library import Selenium2Library from Selenium2Library.keywords.keywordgroup import KeywordGroupMetaClass -from . import abstractedlogger -from . import exceptions -from .context import Context -from .optionhandler import OptionHandler +from robotpageobjects.abstractedlogger import Logger +from robotpageobjects import exceptions +from robotpageobjects.context import Context +from robotpageobjects.optionhandler import OptionHandler class _Keywords(object): @@ -537,7 +537,7 @@ class _BaseActions(_S2LWrapper): Helper class that defines actions for PageObjectLibrary. """ - _abstracted_logger = abstractedlogger.Logger() + _abstracted_logger = Logger() def __init__(self, *args, **kwargs): """ @@ -718,7 +718,7 @@ def _element_find(self, locator, *args, **kwargs): self.driver.implicitly_wait(our_wait) - + if locator in self.selectors: locator = self.resolve_selector(locator) diff --git a/robotpageobjects/component.py b/robotpageobjects/component.py index b599ea0..e12ee74 100755 --- a/robotpageobjects/component.py +++ b/robotpageobjects/component.py @@ -1,4 +1,4 @@ -from .base import _BaseActions, _SelectorsManager, _ComponentsManager, not_keyword +from robotpageobjects.base import _BaseActions, _SelectorsManager, _ComponentsManager, not_keyword from Selenium2Library.locators.elementfinder import ElementFinder diff --git a/robotpageobjects/context.py b/robotpageobjects/context.py index ef20c1a..db81b35 100755 --- a/robotpageobjects/context.py +++ b/robotpageobjects/context.py @@ -1,6 +1,6 @@ from robot.libraries.BuiltIn import BuiltIn from robot.running.context import EXECUTION_CONTEXTS -from monkeypatches import do_monkeypatches +from robotpageobjects.monkeypatches import do_monkeypatches do_monkeypatches() @@ -39,11 +39,11 @@ def in_robot(): @classmethod def set_keywords_exposed(cls): cls._keywords_exposed = True - + @classmethod def set_cache(cls, cache): cls._cache = cache - + @classmethod def get_cache(cls): return cls._cache diff --git a/robotpageobjects/monkeypatches.py b/robotpageobjects/monkeypatches.py index d387b29..c90220a 100755 --- a/robotpageobjects/monkeypatches.py +++ b/robotpageobjects/monkeypatches.py @@ -17,8 +17,8 @@ def _make_phantomjs(self , remote , desired_capabilities , profile_dir): try: browser = self._generic_make_browser(webdriver.PhantomJS, webdriver.DesiredCapabilities.PHANTOMJS, remote, desired_capabilities) - except WebDriverException, e: - print "Couldn't connect to webdriver. WebDriverException was: " + str(e) + except WebDriverException as e: + print("Couldn't connect to webdriver. WebDriverException was: " + str(e)) browser = None tries += 1 if browser: @@ -29,17 +29,17 @@ def _make_phantomjs(self , remote , desired_capabilities , profile_dir): Selenium2Library._make_phantomjs = _make_phantomjs ### BEGIN QAR-48165 monkey patch - ### This adds consistent support for negative indexes in Robot keywords. - - __old_tef_init = TableElementFinder.__init__.__func__ + ### This adds consistent support for negative indexes in Robot keywords. + + __old_tef_init = TableElementFinder.__init__ def __new_tef_init(self, *args, **kwargs): """ - The _locator_suffixes data attribute is used at the end of built-in + The _locator_suffixes data attribute is used at the end of built-in locator strings used by Selenium2Library. - - Monkey patch: added support for negative indexes (QAR-48165). The + + Monkey patch: added support for negative indexes (QAR-48165). The additional locator suffixes are used by the monkey-patched methods - 'find_by_row' and 'find_by_col' defined below. + 'find_by_row' and 'find_by_col' defined below. """ __old_tef_init(self, *args, **kwargs) self._locator_suffixes[('css', 'last-row')] = [' tr:nth-last-child(%s)'] @@ -51,12 +51,12 @@ def __new_tef_init(self, *args, **kwargs): TableElementFinder.__init__ = __new_tef_init def find_by_row(self, browser, table_locator, row, content): - """ + """ Selenium2Library locator method used by _TableElementKeywords.table_row_should_contain This in turn is used by the built-in Robot keyword 'Table Row Should Contain'. - + Monkey patch: added support for negative indexes (QAR-48165). - """ + """ location_method = "row" if "-" == row[0]: row = row[1:] @@ -68,11 +68,11 @@ def find_by_row(self, browser, table_locator, row, content): TableElementFinder.find_by_row = find_by_row def find_by_col(self, browser, table_locator, col, content): - """ + """ Selenium2Library locator method used by _TableElementKeywords.table_row_should_contain - + Monkey patch: added support for negative indexes (QAR-48165). - """ + """ location_method = "col" if "-" == col[0]: col = col[1:] @@ -80,7 +80,7 @@ def find_by_col(self, browser, table_locator, col, content): locators = self._parse_table_locator(table_locator, location_method) locators = [locator % str(col) for locator in locators] return self._search_in_locators(browser, locators, content) - + TableElementFinder.find_by_col = find_by_col def get_table_cell(self, table_locator, row, column, loglevel='INFO'): @@ -88,12 +88,12 @@ def get_table_cell(self, table_locator, row, column, loglevel='INFO'): Row and column number start from 1. Header and footer rows are included in the count. A negative row or column number can be used - to get rows counting from the end (end: -1) This means that also - cell content from header or footer rows can be obtained with this + to get rows counting from the end (end: -1) This means that also + cell content from header or footer rows can be obtained with this keyword. To understand how tables are identified, please take a look at the `introduction`. - - Monkey patch: added support for negative indexes (QAR-48165). + + Monkey patch: added support for negative indexes (QAR-48165). get_table_cell is used by the built-in keyword 'Table Cell Should Contain'. """ row = int(row) @@ -105,13 +105,13 @@ def get_table_cell(self, table_locator, row, column, loglevel='INFO'): table = self._table_element_finder.find(self._current_browser(), table_locator) if table is not None: rows = table.find_elements_by_xpath("./thead/tr") - if row_index >= len(rows) or row_index < 0: + if row_index >= len(rows) or row_index < 0: rows.extend(table.find_elements_by_xpath("./tbody/tr")) - if row_index >= len(rows) or row_index < 0: + if row_index >= len(rows) or row_index < 0: rows.extend(table.find_elements_by_xpath("./tfoot/tr")) if row_index < len(rows): columns = rows[row_index].find_elements_by_tag_name('th') - if column_index >= len(columns) or column_index < 0: + if column_index >= len(columns) or column_index < 0: columns.extend(rows[row_index].find_elements_by_tag_name('td')) if column_index < len(columns): return columns[column_index].text diff --git a/robotpageobjects/optionhandler.py b/robotpageobjects/optionhandler.py index a56b0fb..918d80c 100755 --- a/robotpageobjects/optionhandler.py +++ b/robotpageobjects/optionhandler.py @@ -1,9 +1,10 @@ import re import os import imp +import six -from context import Context -import exceptions +from robotpageobjects.context import Context +from robotpageobjects import exceptions from robot.libraries.BuiltIn import BuiltIn @@ -24,7 +25,10 @@ def __new__(cls, *args, **kwargs): # Singleton pattern... if cls._instance is None: - cls._instance = super(OptionHandler, cls).__new__(cls, *args, **kwargs) + if six.PY2: + cls._instance = super(OptionHandler, cls).__new__(cls, *args, **kwargs) + else: + cls._instance = super().__new__(cls) cls._new_called += 1 return cls._instance @@ -61,7 +65,7 @@ def _get_opts_from_var_file(self): try: vars_mod = imp.load_source("vars", abs_var_file_path) - except (ImportError, IOError), e: + except (ImportError, IOError) as e: raise exceptions.VarFileImportErrorError( "Couldn't import variable file: %s. Ensure it exists and is importable." % var_file_path) @@ -85,7 +89,7 @@ def _normalize(self, opts): Convert an option keyname to lower-cased robot format, or convert all the keys in a dictionary to robot format. """ - if isinstance(opts, basestring): + if isinstance(opts, six.string_types): name = opts.lower() rmatch = re.search("\$\{(.+)\}", name) return rmatch.group(1) if rmatch else name diff --git a/robotpageobjects/page.py b/robotpageobjects/page.py index fb0e51b..1c79fa2 100755 --- a/robotpageobjects/page.py +++ b/robotpageobjects/page.py @@ -21,7 +21,11 @@ from __future__ import print_function import inspect import re -import urllib2 +try: + import urllib.request as urllib2 +except ImportError: + import urllib2 +import six import decorator from Selenium2Library import Selenium2Library @@ -29,10 +33,10 @@ from selenium.common.exceptions import WebDriverException import uritemplate -from .base import _ComponentsManagerMeta, not_keyword, robot_alias, _BaseActions, _Keywords, Override, _SelectorsManager, _ComponentsManager -from . import exceptions -from .context import Context -from .sig import get_method_sig +from robotpageobjects.base import _ComponentsManagerMeta, not_keyword, robot_alias, _BaseActions, _Keywords, Override, _SelectorsManager, _ComponentsManager +from robotpageobjects import exceptions +from robotpageobjects.context import Context +from robotpageobjects.sig import get_method_sig # determine if libdoc is running to avoid generating docs for automatically generated aliases @@ -241,7 +245,7 @@ def get_keyword_names(self): def _attempt_screenshot(self): try: self.capture_page_screenshot() - except Exception, e: + except Exception as e: if e.message.find("No browser is open") != -1: pass @@ -435,7 +439,7 @@ def _resolve_url(self, *args): first_arg = args[0] if not self._is_robot: - if isinstance(first_arg, basestring): + if isinstance(first_arg, six.string_types): # In Python, if the first argument is a string and not a dict, it's a url or path. arg_type = "url" else: @@ -574,7 +578,7 @@ class MyPageObject(PageObject): try: self.open_browser(resolved_url, self.browser, remote_url=remote_url, desired_capabilities=caps) - except (urllib2.HTTPError, WebDriverException, ValueError), e: + except (urllib2.HTTPError, WebDriverException, ValueError) as e: raise exceptions.SauceConnectionError("Unable to run Sauce job.\n%s\n" "Sauce variables were:\n" "sauce_platform: %s\n" diff --git a/tests/README.md b/robotpageobjects/tests/README.md similarity index 100% rename from tests/README.md rename to robotpageobjects/tests/README.md diff --git a/tests/scenarios/__init__.py b/robotpageobjects/tests/__init__.py similarity index 100% rename from tests/scenarios/__init__.py rename to robotpageobjects/tests/__init__.py diff --git a/tests/basetestcase.py b/robotpageobjects/tests/basetestcase.py similarity index 99% rename from tests/basetestcase.py rename to robotpageobjects/tests/basetestcase.py index 18746e8..62ab8ec 100755 --- a/tests/basetestcase.py +++ b/robotpageobjects/tests/basetestcase.py @@ -287,7 +287,7 @@ def write_var_file(self, *args, **kwargs): for i in kwargs: line = "%s = '%s'\n" % (i, kwargs[i]) f.write(line) - except Exception, e: + except Exception as e: raise Exception("Problem creating vars file: %s" % e) finally: if f: diff --git a/tests/sauce_vars.py b/robotpageobjects/tests/sauce_vars.py similarity index 100% rename from tests/sauce_vars.py rename to robotpageobjects/tests/sauce_vars.py diff --git a/tests/scenarios/po/__init__.py b/robotpageobjects/tests/scenarios/__init__.py old mode 100644 new mode 100755 similarity index 100% rename from tests/scenarios/po/__init__.py rename to robotpageobjects/tests/scenarios/__init__.py diff --git a/tests/__init.__.py b/robotpageobjects/tests/scenarios/po/__init__.py old mode 100755 new mode 100644 similarity index 100% rename from tests/__init.__.py rename to robotpageobjects/tests/scenarios/po/__init__.py diff --git a/robotpageobjects/tests/scenarios/po/basepageobjects/__init__.py b/robotpageobjects/tests/scenarios/po/basepageobjects/__init__.py new file mode 100755 index 0000000..5f5f443 --- /dev/null +++ b/robotpageobjects/tests/scenarios/po/basepageobjects/__init__.py @@ -0,0 +1,2 @@ +from robotpageobjects.tests.scenarios.po.basepageobjects.homepage import BaseHomePage +from robotpageobjects.tests.scenarios.po.basepageobjects.resultspage import BaseResultsPage diff --git a/tests/scenarios/po/basepageobjects/homepage.py b/robotpageobjects/tests/scenarios/po/basepageobjects/homepage.py similarity index 100% rename from tests/scenarios/po/basepageobjects/homepage.py rename to robotpageobjects/tests/scenarios/po/basepageobjects/homepage.py diff --git a/tests/scenarios/po/basepageobjects/resultspage.py b/robotpageobjects/tests/scenarios/po/basepageobjects/resultspage.py similarity index 100% rename from tests/scenarios/po/basepageobjects/resultspage.py rename to robotpageobjects/tests/scenarios/po/basepageobjects/resultspage.py diff --git a/tests/scenarios/po/keyword_naming.py b/robotpageobjects/tests/scenarios/po/keyword_naming.py similarity index 100% rename from tests/scenarios/po/keyword_naming.py rename to robotpageobjects/tests/scenarios/po/keyword_naming.py diff --git a/tests/scenarios/po/loggingpage.py b/robotpageobjects/tests/scenarios/po/loggingpage.py similarity index 100% rename from tests/scenarios/po/loggingpage.py rename to robotpageobjects/tests/scenarios/po/loggingpage.py diff --git a/robotpageobjects/tests/scenarios/po/mydbpageobjects/__init__.py b/robotpageobjects/tests/scenarios/po/mydbpageobjects/__init__.py new file mode 100755 index 0000000..22f4396 --- /dev/null +++ b/robotpageobjects/tests/scenarios/po/mydbpageobjects/__init__.py @@ -0,0 +1,2 @@ +from robotpageobjects.tests.scenarios.po.mydbpageobjects.homepage import MyDBHomePage +from robotpageobjects.tests.scenarios.po.mydbpageobjects.resultspage import MyDBResultsPage diff --git a/tests/scenarios/po/mydbpageobjects/homepage.py b/robotpageobjects/tests/scenarios/po/mydbpageobjects/homepage.py similarity index 100% rename from tests/scenarios/po/mydbpageobjects/homepage.py rename to robotpageobjects/tests/scenarios/po/mydbpageobjects/homepage.py diff --git a/tests/scenarios/po/mydbpageobjects/resultspage.py b/robotpageobjects/tests/scenarios/po/mydbpageobjects/resultspage.py similarity index 100% rename from tests/scenarios/po/mydbpageobjects/resultspage.py rename to robotpageobjects/tests/scenarios/po/mydbpageobjects/resultspage.py diff --git a/tests/scenarios/po/ncbi.py b/robotpageobjects/tests/scenarios/po/ncbi.py similarity index 100% rename from tests/scenarios/po/ncbi.py rename to robotpageobjects/tests/scenarios/po/ncbi.py diff --git a/tests/scenarios/po/nouripage.py b/robotpageobjects/tests/scenarios/po/nouripage.py similarity index 100% rename from tests/scenarios/po/nouripage.py rename to robotpageobjects/tests/scenarios/po/nouripage.py diff --git a/tests/scenarios/po/page_with_component.py b/robotpageobjects/tests/scenarios/po/page_with_component.py similarity index 100% rename from tests/scenarios/po/page_with_component.py rename to robotpageobjects/tests/scenarios/po/page_with_component.py diff --git a/tests/scenarios/po/result_component.py b/robotpageobjects/tests/scenarios/po/result_component.py similarity index 100% rename from tests/scenarios/po/result_component.py rename to robotpageobjects/tests/scenarios/po/result_component.py diff --git a/tests/scenarios/po/selectors_duplicate.py b/robotpageobjects/tests/scenarios/po/selectors_duplicate.py similarity index 100% rename from tests/scenarios/po/selectors_duplicate.py rename to robotpageobjects/tests/scenarios/po/selectors_duplicate.py diff --git a/tests/scenarios/po/selectors_page.py b/robotpageobjects/tests/scenarios/po/selectors_page.py similarity index 100% rename from tests/scenarios/po/selectors_page.py rename to robotpageobjects/tests/scenarios/po/selectors_page.py diff --git a/tests/scenarios/po/stacktracepage.py b/robotpageobjects/tests/scenarios/po/stacktracepage.py similarity index 100% rename from tests/scenarios/po/stacktracepage.py rename to robotpageobjects/tests/scenarios/po/stacktracepage.py diff --git a/tests/scenarios/po/widget_no_uri_attr.py b/robotpageobjects/tests/scenarios/po/widget_no_uri_attr.py similarity index 86% rename from tests/scenarios/po/widget_no_uri_attr.py rename to robotpageobjects/tests/scenarios/po/widget_no_uri_attr.py index edaf867..32ecfc4 100755 --- a/tests/scenarios/po/widget_no_uri_attr.py +++ b/robotpageobjects/tests/scenarios/po/widget_no_uri_attr.py @@ -10,7 +10,7 @@ class SearchResultPage(Page): @robot_alias("__name__should_have_results") def should_have_results(self, expected): len_results = len(self.find_elements("xpath=id('results')/li", required=False)) - asserts.assert_equals(len_results, int(expected), "Unexpected number of results found on %s, got %s, " + asserts.assert_equal(len_results, int(expected), "Unexpected number of results found on %s, got %s, " "expected %s" %( self.name, len_results, expected)) diff --git a/tests/scenarios/po/widget_rel_uri_attr.py b/robotpageobjects/tests/scenarios/po/widget_rel_uri_attr.py similarity index 86% rename from tests/scenarios/po/widget_rel_uri_attr.py rename to robotpageobjects/tests/scenarios/po/widget_rel_uri_attr.py index cde1c85..5bec179 100755 --- a/tests/scenarios/po/widget_rel_uri_attr.py +++ b/robotpageobjects/tests/scenarios/po/widget_rel_uri_attr.py @@ -30,20 +30,20 @@ def click_delayed_content_button(self): def delayed_content_should_exist(self): text = self.get_text("delayed content") - asserts.assert_equals(text, "I took about 2 seconds to be inserted") + asserts.assert_equal(text, "I took about 2 seconds to be inserted") return self def delayed_content_should_exist_explicit(self): # This should raise a ValueError, since we told find_element not to wait. text = self.find_element("delayed content", wait=0).text - asserts.assert_equals(text, "I took about 2 seconds to be inserted") + asserts.assert_equal(text, "I took about 2 seconds to be inserted") return self def delayed_content_should_exist_explicit_calling_find_elements(self): # This should raise a ValueError, since we told find_element not to wait. els = self.find_elements("delayed content", wait=0) text = els[0].text - asserts.assert_equals(text, "I took about 2 seconds to be inserted") + asserts.assert_equal(text, "I took about 2 seconds to be inserted") return self def get_templated_selector_element_text(self): @@ -61,7 +61,7 @@ class SearchResultPage(Page): @robot_alias("__name__should_have_results") def should_have_results(self, expected): len_results = len(self.find_elements("results")) - asserts.assert_equals(len_results, int(expected), "Unexpected number of results found on %s, got %s, " + asserts.assert_equal(len_results, int(expected), "Unexpected number of results found on %s, got %s, " "expected %s" %(self.name, len_results, expected)) return self diff --git a/tests/scenarios/po/widget_rel_uri_no_name_attr.py b/robotpageobjects/tests/scenarios/po/widget_rel_uri_no_name_attr.py similarity index 86% rename from tests/scenarios/po/widget_rel_uri_no_name_attr.py rename to robotpageobjects/tests/scenarios/po/widget_rel_uri_no_name_attr.py index acf3394..401ed6b 100755 --- a/tests/scenarios/po/widget_rel_uri_no_name_attr.py +++ b/robotpageobjects/tests/scenarios/po/widget_rel_uri_no_name_attr.py @@ -19,7 +19,7 @@ class WidgetSearchResultPage(Page): @robot_alias("__name__should_have_results") def should_have_results(self, expected): len_results = len(self.find_elements("xpath=id('results')/li", required=False)) - asserts.assert_equals(len_results, int(expected), "Unexpected number of results found on %s, got %s, " + asserts.assert_equal(len_results, int(expected), "Unexpected number of results found on %s, got %s, " "expected %s" %( self.name, len_results, expected)) return self diff --git a/tests/scenarios/po/widget_template.py b/robotpageobjects/tests/scenarios/po/widget_template.py similarity index 100% rename from tests/scenarios/po/widget_template.py rename to robotpageobjects/tests/scenarios/po/widget_template.py diff --git a/tests/scenarios/site/category/home-and-garden/123.html b/robotpageobjects/tests/scenarios/site/category/home-and-garden/123.html similarity index 100% rename from tests/scenarios/site/category/home-and-garden/123.html rename to robotpageobjects/tests/scenarios/site/category/home-and-garden/123.html diff --git a/tests/scenarios/site/index.html b/robotpageobjects/tests/scenarios/site/index.html similarity index 100% rename from tests/scenarios/site/index.html rename to robotpageobjects/tests/scenarios/site/index.html diff --git a/tests/scenarios/site/result.html b/robotpageobjects/tests/scenarios/site/result.html similarity index 100% rename from tests/scenarios/site/result.html rename to robotpageobjects/tests/scenarios/site/result.html diff --git a/tests/scenarios/test_bad_selector.py b/robotpageobjects/tests/scenarios/test_bad_selector.py similarity index 100% rename from tests/scenarios/test_bad_selector.py rename to robotpageobjects/tests/scenarios/test_bad_selector.py diff --git a/tests/scenarios/test_can_call_aliased_method_with_page_name.robot b/robotpageobjects/tests/scenarios/test_can_call_aliased_method_with_page_name.robot similarity index 100% rename from tests/scenarios/test_can_call_aliased_method_with_page_name.robot rename to robotpageobjects/tests/scenarios/test_can_call_aliased_method_with_page_name.robot diff --git a/tests/scenarios/test_can_call_aliased_method_without_page_name.robot b/robotpageobjects/tests/scenarios/test_can_call_aliased_method_without_page_name.robot similarity index 100% rename from tests/scenarios/test_can_call_aliased_method_without_page_name.robot rename to robotpageobjects/tests/scenarios/test_can_call_aliased_method_without_page_name.robot diff --git a/tests/scenarios/test_can_call_unaliased_method_with_page_name.robot b/robotpageobjects/tests/scenarios/test_can_call_unaliased_method_with_page_name.robot similarity index 100% rename from tests/scenarios/test_can_call_unaliased_method_with_page_name.robot rename to robotpageobjects/tests/scenarios/test_can_call_unaliased_method_with_page_name.robot diff --git a/tests/scenarios/test_does_not_return.robot b/robotpageobjects/tests/scenarios/test_does_not_return.robot similarity index 100% rename from tests/scenarios/test_does_not_return.robot rename to robotpageobjects/tests/scenarios/test_does_not_return.robot diff --git a/tests/scenarios/test_dont_have_to_specify_page_name_for_keyword_when_2_page_objects_define_it.robot b/robotpageobjects/tests/scenarios/test_dont_have_to_specify_page_name_for_keyword_when_2_page_objects_define_it.robot similarity index 100% rename from tests/scenarios/test_dont_have_to_specify_page_name_for_keyword_when_2_page_objects_define_it.robot rename to robotpageobjects/tests/scenarios/test_dont_have_to_specify_page_name_for_keyword_when_2_page_objects_define_it.robot diff --git a/tests/scenarios/test_dont_have_to_specify_page_name_in_keyword_when_2_page_objects_inherit_it.robot b/robotpageobjects/tests/scenarios/test_dont_have_to_specify_page_name_in_keyword_when_2_page_objects_inherit_it.robot similarity index 100% rename from tests/scenarios/test_dont_have_to_specify_page_name_in_keyword_when_2_page_objects_inherit_it.robot rename to robotpageobjects/tests/scenarios/test_dont_have_to_specify_page_name_in_keyword_when_2_page_objects_inherit_it.robot diff --git a/tests/scenarios/test_dont_have_to_specify_page_name_when_extending_se2lib_keyword.robot b/robotpageobjects/tests/scenarios/test_dont_have_to_specify_page_name_when_extending_se2lib_keyword.robot similarity index 100% rename from tests/scenarios/test_dont_have_to_specify_page_name_when_extending_se2lib_keyword.robot rename to robotpageobjects/tests/scenarios/test_dont_have_to_specify_page_name_when_extending_se2lib_keyword.robot diff --git a/tests/scenarios/test_fail.py b/robotpageobjects/tests/scenarios/test_fail.py similarity index 100% rename from tests/scenarios/test_fail.py rename to robotpageobjects/tests/scenarios/test_fail.py diff --git a/tests/scenarios/test_fail.robot b/robotpageobjects/tests/scenarios/test_fail.robot similarity index 100% rename from tests/scenarios/test_fail.robot rename to robotpageobjects/tests/scenarios/test_fail.robot diff --git a/tests/scenarios/test_fail_se2lib_keyword.robot b/robotpageobjects/tests/scenarios/test_fail_se2lib_keyword.robot similarity index 100% rename from tests/scenarios/test_fail_se2lib_keyword.robot rename to robotpageobjects/tests/scenarios/test_fail_se2lib_keyword.robot diff --git a/tests/scenarios/test_find_elements_with_selector.py b/robotpageobjects/tests/scenarios/test_find_elements_with_selector.py similarity index 100% rename from tests/scenarios/test_find_elements_with_selector.py rename to robotpageobjects/tests/scenarios/test_find_elements_with_selector.py diff --git a/tests/scenarios/test_go_to.py b/robotpageobjects/tests/scenarios/test_go_to.py similarity index 100% rename from tests/scenarios/test_go_to.py rename to robotpageobjects/tests/scenarios/test_go_to.py diff --git a/tests/scenarios/test_go_to.robot b/robotpageobjects/tests/scenarios/test_go_to.robot similarity index 100% rename from tests/scenarios/test_go_to.robot rename to robotpageobjects/tests/scenarios/test_go_to.robot diff --git a/tests/scenarios/test_implicit_se_wait.py b/robotpageobjects/tests/scenarios/test_implicit_se_wait.py similarity index 100% rename from tests/scenarios/test_implicit_se_wait.py rename to robotpageobjects/tests/scenarios/test_implicit_se_wait.py diff --git a/tests/scenarios/test_implicit_se_wait_0.py b/robotpageobjects/tests/scenarios/test_implicit_se_wait_0.py similarity index 100% rename from tests/scenarios/test_implicit_se_wait_0.py rename to robotpageobjects/tests/scenarios/test_implicit_se_wait_0.py diff --git a/tests/scenarios/test_is_visible.py b/robotpageobjects/tests/scenarios/test_is_visible.py similarity index 100% rename from tests/scenarios/test_is_visible.py rename to robotpageobjects/tests/scenarios/test_is_visible.py diff --git a/tests/scenarios/test_location_should_be_for_absolute_path.py b/robotpageobjects/tests/scenarios/test_location_should_be_for_absolute_path.py similarity index 100% rename from tests/scenarios/test_location_should_be_for_absolute_path.py rename to robotpageobjects/tests/scenarios/test_location_should_be_for_absolute_path.py diff --git a/tests/scenarios/test_location_should_be_for_relative_path.py b/robotpageobjects/tests/scenarios/test_location_should_be_for_relative_path.py similarity index 100% rename from tests/scenarios/test_location_should_be_for_relative_path.py rename to robotpageobjects/tests/scenarios/test_location_should_be_for_relative_path.py diff --git a/tests/scenarios/test_log_above_threshold.robot b/robotpageobjects/tests/scenarios/test_log_above_threshold.robot similarity index 100% rename from tests/scenarios/test_log_above_threshold.robot rename to robotpageobjects/tests/scenarios/test_log_above_threshold.robot diff --git a/tests/scenarios/test_log_at_threshold.py b/robotpageobjects/tests/scenarios/test_log_at_threshold.py similarity index 100% rename from tests/scenarios/test_log_at_threshold.py rename to robotpageobjects/tests/scenarios/test_log_at_threshold.py diff --git a/tests/scenarios/test_log_at_threshold.robot b/robotpageobjects/tests/scenarios/test_log_at_threshold.robot similarity index 100% rename from tests/scenarios/test_log_at_threshold.robot rename to robotpageobjects/tests/scenarios/test_log_at_threshold.robot diff --git a/tests/scenarios/test_log_at_threshold_is_console_false.py b/robotpageobjects/tests/scenarios/test_log_at_threshold_is_console_false.py similarity index 100% rename from tests/scenarios/test_log_at_threshold_is_console_false.py rename to robotpageobjects/tests/scenarios/test_log_at_threshold_is_console_false.py diff --git a/tests/scenarios/test_log_below_threshold.py b/robotpageobjects/tests/scenarios/test_log_below_threshold.py similarity index 100% rename from tests/scenarios/test_log_below_threshold.py rename to robotpageobjects/tests/scenarios/test_log_below_threshold.py diff --git a/tests/scenarios/test_log_below_threshold.robot b/robotpageobjects/tests/scenarios/test_log_below_threshold.robot similarity index 100% rename from tests/scenarios/test_log_below_threshold.robot rename to robotpageobjects/tests/scenarios/test_log_below_threshold.robot diff --git a/tests/scenarios/test_log_below_threshold_is_console_false.py b/robotpageobjects/tests/scenarios/test_log_below_threshold_is_console_false.py similarity index 100% rename from tests/scenarios/test_log_below_threshold_is_console_false.py rename to robotpageobjects/tests/scenarios/test_log_below_threshold_is_console_false.py diff --git a/tests/scenarios/test_log_below_threshold_is_console_false.robot b/robotpageobjects/tests/scenarios/test_log_below_threshold_is_console_false.robot similarity index 100% rename from tests/scenarios/test_log_below_threshold_is_console_false.robot rename to robotpageobjects/tests/scenarios/test_log_below_threshold_is_console_false.robot diff --git a/tests/scenarios/test_manual_screen_shot.py b/robotpageobjects/tests/scenarios/test_manual_screen_shot.py similarity index 100% rename from tests/scenarios/test_manual_screen_shot.py rename to robotpageobjects/tests/scenarios/test_manual_screen_shot.py diff --git a/tests/scenarios/test_manual_screen_shot.robot b/robotpageobjects/tests/scenarios/test_manual_screen_shot.robot similarity index 100% rename from tests/scenarios/test_manual_screen_shot.robot rename to robotpageobjects/tests/scenarios/test_manual_screen_shot.robot diff --git a/tests/scenarios/test_negative_index_in_table_keywords.robot b/robotpageobjects/tests/scenarios/test_negative_index_in_table_keywords.robot similarity index 100% rename from tests/scenarios/test_negative_index_in_table_keywords.robot rename to robotpageobjects/tests/scenarios/test_negative_index_in_table_keywords.robot diff --git a/tests/scenarios/test_no_selector.py b/robotpageobjects/tests/scenarios/test_no_selector.py similarity index 100% rename from tests/scenarios/test_no_selector.py rename to robotpageobjects/tests/scenarios/test_no_selector.py diff --git a/tests/scenarios/test_no_uri.robot b/robotpageobjects/tests/scenarios/test_no_uri.robot similarity index 100% rename from tests/scenarios/test_no_uri.robot rename to robotpageobjects/tests/scenarios/test_no_uri.robot diff --git a/tests/scenarios/test_page_override_without_override_class.py b/robotpageobjects/tests/scenarios/test_page_override_without_override_class.py similarity index 100% rename from tests/scenarios/test_page_override_without_override_class.py rename to robotpageobjects/tests/scenarios/test_page_override_without_override_class.py diff --git a/tests/scenarios/test_page_with_component.robot b/robotpageobjects/tests/scenarios/test_page_with_component.robot similarity index 100% rename from tests/scenarios/test_page_with_component.robot rename to robotpageobjects/tests/scenarios/test_page_with_component.robot diff --git a/tests/scenarios/test_pass_explicit_wait_to_find_element.py b/robotpageobjects/tests/scenarios/test_pass_explicit_wait_to_find_element.py similarity index 100% rename from tests/scenarios/test_pass_explicit_wait_to_find_element.py rename to robotpageobjects/tests/scenarios/test_pass_explicit_wait_to_find_element.py diff --git a/tests/scenarios/test_rel_uri_attr.py b/robotpageobjects/tests/scenarios/test_rel_uri_attr.py similarity index 100% rename from tests/scenarios/test_rel_uri_attr.py rename to robotpageobjects/tests/scenarios/test_rel_uri_attr.py diff --git a/tests/scenarios/test_rel_uri_attr.robot b/robotpageobjects/tests/scenarios/test_rel_uri_attr.robot similarity index 100% rename from tests/scenarios/test_rel_uri_attr.robot rename to robotpageobjects/tests/scenarios/test_rel_uri_attr.robot diff --git a/tests/scenarios/test_rel_uri_attr_no_name_attr.robot b/robotpageobjects/tests/scenarios/test_rel_uri_attr_no_name_attr.robot similarity index 100% rename from tests/scenarios/test_rel_uri_attr_no_name_attr.robot rename to robotpageobjects/tests/scenarios/test_rel_uri_attr_no_name_attr.robot diff --git a/tests/scenarios/test_s2l_imported_multiple_a.robot b/robotpageobjects/tests/scenarios/test_s2l_imported_multiple_a.robot similarity index 100% rename from tests/scenarios/test_s2l_imported_multiple_a.robot rename to robotpageobjects/tests/scenarios/test_s2l_imported_multiple_a.robot diff --git a/tests/scenarios/test_s2l_imported_multiple_b.robot b/robotpageobjects/tests/scenarios/test_s2l_imported_multiple_b.robot similarity index 100% rename from tests/scenarios/test_s2l_imported_multiple_b.robot rename to robotpageobjects/tests/scenarios/test_s2l_imported_multiple_b.robot diff --git a/tests/scenarios/test_s2l_keyword_with_selector.robot b/robotpageobjects/tests/scenarios/test_s2l_keyword_with_selector.robot similarity index 100% rename from tests/scenarios/test_s2l_keyword_with_selector.robot rename to robotpageobjects/tests/scenarios/test_s2l_keyword_with_selector.robot diff --git a/tests/scenarios/test_sauce.py b/robotpageobjects/tests/scenarios/test_sauce.py similarity index 100% rename from tests/scenarios/test_sauce.py rename to robotpageobjects/tests/scenarios/test_sauce.py diff --git a/tests/scenarios/test_sauce.robot b/robotpageobjects/tests/scenarios/test_sauce.robot similarity index 100% rename from tests/scenarios/test_sauce.robot rename to robotpageobjects/tests/scenarios/test_sauce.robot diff --git a/tests/scenarios/test_se2lib_called_before_po.robot b/robotpageobjects/tests/scenarios/test_se2lib_called_before_po.robot similarity index 100% rename from tests/scenarios/test_se2lib_called_before_po.robot rename to robotpageobjects/tests/scenarios/test_se2lib_called_before_po.robot diff --git a/tests/scenarios/test_se2lib_imported_before_po.robot b/robotpageobjects/tests/scenarios/test_se2lib_imported_before_po.robot similarity index 100% rename from tests/scenarios/test_se2lib_imported_before_po.robot rename to robotpageobjects/tests/scenarios/test_se2lib_imported_before_po.robot diff --git a/tests/scenarios/test_selector_self_ref.py b/robotpageobjects/tests/scenarios/test_selector_self_ref.py similarity index 100% rename from tests/scenarios/test_selector_self_ref.py rename to robotpageobjects/tests/scenarios/test_selector_self_ref.py diff --git a/tests/scenarios/test_selector_with_se2lib_keyword.robot b/robotpageobjects/tests/scenarios/test_selector_with_se2lib_keyword.robot similarity index 100% rename from tests/scenarios/test_selector_with_se2lib_keyword.robot rename to robotpageobjects/tests/scenarios/test_selector_with_se2lib_keyword.robot diff --git a/tests/scenarios/test_stack_trace.robot b/robotpageobjects/tests/scenarios/test_stack_trace.robot similarity index 100% rename from tests/scenarios/test_stack_trace.robot rename to robotpageobjects/tests/scenarios/test_stack_trace.robot diff --git a/tests/scenarios/test_template_passed.py b/robotpageobjects/tests/scenarios/test_template_passed.py similarity index 100% rename from tests/scenarios/test_template_passed.py rename to robotpageobjects/tests/scenarios/test_template_passed.py diff --git a/tests/scenarios/test_template_passed.robot b/robotpageobjects/tests/scenarios/test_template_passed.robot similarity index 100% rename from tests/scenarios/test_template_passed.robot rename to robotpageobjects/tests/scenarios/test_template_passed.robot diff --git a/tests/scenarios/test_templated_selector.py b/robotpageobjects/tests/scenarios/test_templated_selector.py similarity index 100% rename from tests/scenarios/test_templated_selector.py rename to robotpageobjects/tests/scenarios/test_templated_selector.py diff --git a/tests/scenarios/test_templated_selector_wrong_num.py b/robotpageobjects/tests/scenarios/test_templated_selector_wrong_num.py similarity index 100% rename from tests/scenarios/test_templated_selector_wrong_num.py rename to robotpageobjects/tests/scenarios/test_templated_selector_wrong_num.py diff --git a/tests/scenarios/test_threshold_at_warning_log_warning_logs_warning_to_file_and_stdout_python.py b/robotpageobjects/tests/scenarios/test_threshold_at_warning_log_warning_logs_warning_to_file_and_stdout_python.py similarity index 100% rename from tests/scenarios/test_threshold_at_warning_log_warning_logs_warning_to_file_and_stdout_python.py rename to robotpageobjects/tests/scenarios/test_threshold_at_warning_log_warning_logs_warning_to_file_and_stdout_python.py diff --git a/tests/scenarios/test_wait_until_not_visible.py b/robotpageobjects/tests/scenarios/test_wait_until_not_visible.py similarity index 95% rename from tests/scenarios/test_wait_until_not_visible.py rename to robotpageobjects/tests/scenarios/test_wait_until_not_visible.py index 1fd0f4c..6d7f447 100755 --- a/tests/scenarios/test_wait_until_not_visible.py +++ b/robotpageobjects/tests/scenarios/test_wait_until_not_visible.py @@ -21,7 +21,7 @@ def test_wait_until_element_not_visible_throws_exception(self): try: self.p.click_element("delayed-content-button") self.p.wait_until_element_is_not_visible("para-to-be-hidden", 8) - except Exception, e: + except Exception as e: self.assertTrue(isinstance(e, AssertionError)) self.assertIn("still matched after", e.message) @@ -29,7 +29,7 @@ def test_wait_for_element_not_visible_throws_exception(self): try: self.p.click_element("delayed-content-button") self.p.wait_for(lambda: not self.p.is_visible("para-to-be-hidden"), 8, 'Element did not disappear') - except Exception, e: + except Exception as e: self.assertIn("Element did not disappear", e.msg) def tearDown(self): diff --git a/tests/test_functional.py b/robotpageobjects/tests/test_functional.py similarity index 99% rename from tests/test_functional.py rename to robotpageobjects/tests/test_functional.py index b1d5305..86bf577 100755 --- a/tests/test_functional.py +++ b/robotpageobjects/tests/test_functional.py @@ -7,10 +7,10 @@ from nose.tools import raises from robotpageobjects import Page, exceptions -from scenarios.po.result_component import ResultPage, ResultPageWithDOMStrategyLocator, HomePage, \ +from robotpageobjects.tests.scenarios.po.result_component import ResultPage, ResultPageWithDOMStrategyLocator, HomePage, \ HomePageWithDOMAdvancedToggler, TwoComponentsPage, ParaComponent, TwoComponentsSubPage -from scenarios.po.loggingpage import LoggingPage -from basetestcase import BaseTestCase +from robotpageobjects.tests.scenarios.po.loggingpage import LoggingPage +from robotpageobjects.tests.basetestcase import BaseTestCase class SmokeTestCase(BaseTestCase): diff --git a/tests/test_unit.py b/robotpageobjects/tests/test_unit.py similarity index 98% rename from tests/test_unit.py rename to robotpageobjects/tests/test_unit.py index 1b6d524..2977df4 100755 --- a/tests/test_unit.py +++ b/robotpageobjects/tests/test_unit.py @@ -8,7 +8,7 @@ import selenium from selenium import webdriver -from basetestcase import BaseTestCase +from robotpageobjects.tests.basetestcase import BaseTestCase from robotpageobjects import exceptions from robotpageobjects.page import Page, _Keywords, Override, not_keyword from robotpageobjects.optionhandler import OptionHandler @@ -18,7 +18,7 @@ po_dir = os.path.join(scenario_dir, "po") sys.path.append(po_dir) -from basepageobjects import BaseHomePage, BaseResultsPage +from robotpageobjects.tests.scenarios.po.basepageobjects import BaseHomePage, BaseResultsPage class InheritFromSe2LibTestCase(BaseTestCase): @@ -91,7 +91,7 @@ def test_robot_can_get_vars_from_env(self, mock_get_variables): try: handler = OptionHandler(MockPage()) self.assertEquals(handler.get("browser"), "opera") - except Exception, e: + except Exception as e: raise e finally: del os.environ["PO_BROWSER"] @@ -103,7 +103,7 @@ def test_robot_env_overrides_var_file(self, mock_get_variables): try: handler = OptionHandler(MockPage()) self.assertEquals(handler.get("author"), "Twain") - except Exception, e: + except Exception as e: raise e finally: del os.environ["PO_AUTHOR"] @@ -116,7 +116,7 @@ def test_robot_cmd_line_var_overrides_env_var(self, mock_get_variables): try: handler = OptionHandler(MockPage()) self.assertEquals(handler.get("browser"), "chrome") - except Exception, e: + except Exception as e: raise e finally: del os.environ["PO_BROWSER"] @@ -128,11 +128,11 @@ def test_robot_cmd_line_var_overrides_var_file(self, mock_get_variables): try: handler = OptionHandler(MockPage()) self.assertEquals(handler.get("author"), "Twain") - except Exception, e: + except Exception as e: raise e finally: del os.environ["PO_VAR_FILE"] - + def test_get_options_from_page_object(self): p = MockPage() p.options = {'author': 'Twain'} @@ -609,7 +609,7 @@ class P(Page):pass self.assertTrue(isinstance(service_args, list), "Service args is a list") self.assertEquals(len(service_args), 1, "Service args property has 1 member") self.assertEquals( - service_args[0], - "--cookies-file=foo.txt", + service_args[0], + "--cookies-file=foo.txt", "Service args is what we set it to be" ) diff --git a/tests/vars.py b/robotpageobjects/tests/vars.py similarity index 100% rename from tests/vars.py rename to robotpageobjects/tests/vars.py diff --git a/tests/scenarios/po/basepageobjects/__init__.py b/tests/scenarios/po/basepageobjects/__init__.py deleted file mode 100755 index 0e931af..0000000 --- a/tests/scenarios/po/basepageobjects/__init__.py +++ /dev/null @@ -1,2 +0,0 @@ -from homepage import BaseHomePage -from resultspage import BaseResultsPage \ No newline at end of file diff --git a/tests/scenarios/po/mydbpageobjects/__init__.py b/tests/scenarios/po/mydbpageobjects/__init__.py deleted file mode 100755 index 3760d35..0000000 --- a/tests/scenarios/po/mydbpageobjects/__init__.py +++ /dev/null @@ -1,2 +0,0 @@ -from homepage import MyDBHomePage -from resultspage import MyDBResultsPage \ No newline at end of file