Package tlib :: Package base :: Module SelendroidTester |
[hide private]
[frames] | no frames]

# Source Code for Module tlib.base.SelendroidTester

     1  # noinspection PyPackageRequirements
     2  import pytest
     3  # noinspection PyPackageRequirements
     4  from selenium import webdriver
     5  # noinspection PyPackageRequirements
     6  from WebDriverTester import WebDriverTester
     7  from TestHelper import Singleton
     8  import time
     9
    10
    11  # noinspection PyMethodParameters
    12  # noinspection PyUnresolvedReferences
    13 -class SelendroidTester(WebDriverTester):
    14      __metaclass__ = Singleton
    15 -    def _get_driver(self):
    16          """
    17          Returns Instance of the WebDriver remote driver
    18          @rtype: webdriver.Remote
    19          """
    20          return self._driver
    21
    22 -    def _set_driver(self, driver):
    23          """
    24          Instance of the WebDriver remote driver
    25          @type driver: webdriver.Remote
    26          """
    27          self._driver = driver
    28
    29      driver = property(_get_driver, _set_driver)
    30
    31
    32      @pytest.fixture(scope='function', autouse=True)
    33 -    def setup_selendroid_test(self, request, test_logger, driver):
    34          """
    35          Launch the application on mobile device for each test case, unless marker skipsetup is given
    36          """
    37          if not request.node.function.__dict__.has_key('skipsetup'):
    38              pass
    39          else:
    40              test_logger.info("Skipping setup")
    41          self.driver = driver
    42
    43 -    def wait_for_page_loaded(self, timeout=10):
    44          """
    45          Waist until document.readyState is equal to complete
    46          @type timeout: Integer
    47          @param timeout: Number of seconds before timing out
    48          """
    49          #TODO:
    50          # Find a proper way to see if the app is loaded or not
    51          time.sleep(1.0)
    52          pass
    53
    54          self.tlib_logger.debug("Page '%s' finished loading" % self._driver.current_url)
    55