コード例 #1
0
    def __init__(self, webdriver_provider=None, screenshot_util=None):
        '''
        Constructor.

        Kwargs:
            webdriver_provider: Override the default WebdriverManager instance.
            screenshot_util: Override the default screenshot util method.

        '''
        if WTF_CONFIG_READER.get(self.CAPTURE_SCREENSHOT_SETTING, True):
            self.capture_screenshot = True
        else:
            self.capture_screenshot = False
        self.max_screenshot_name_len = int(
            WTF_CONFIG_READER.get(self.MAX_SCREENSHOT_NAME_LEN_SETTING, 20))

        if webdriver_provider == None:
            self._webdriver_provider = WTF_WEBDRIVER_MANAGER
        else:
            self._webdriver_provider = webdriver_provider

        if screenshot_util == None:
            self._screenshot_util = WebScreenShotUtil
        else:
            self._screenshot_util = screenshot_util
コード例 #2
0
    def __init__(self, webdriver_provider=None, screenshot_util=None):
        '''
        Constructor.

        Kwargs:
            webdriver_provider: Override the default WebdriverManager instance.
            screenshot_util: Override the default screenshot util method.

        '''
        if WTF_CONFIG_READER.get(self.CAPTURE_SCREENSHOT_SETTING, True):
            self.capture_screenshot = True
        else:
            self.capture_screenshot = False
        self.max_screenshot_name_len = int(
            WTF_CONFIG_READER.get(self.MAX_SCREENSHOT_NAME_LEN_SETTING, 20))

        if webdriver_provider == None:
            self._webdriver_provider = WTF_WEBDRIVER_MANAGER
        else:
            self._webdriver_provider = webdriver_provider

        if screenshot_util == None:
            self._screenshot_util = WebScreenShotUtil
        else:
            self._screenshot_util = screenshot_util
コード例 #3
0
    def test_createWebDriver_WithLocalBrowser(self):
        '''
        This will test this by opening firefox and trying to fetch Google with it.

        This test will normally be commented out since it spawns annoying browser windows.
        When making changes to WebDriverFactory, please run this test manually.
        '''
        config_reader = mock(ConfigReader)
        when(config_reader).get(
            WebDriverFactory.DRIVER_TYPE_CONFIG).thenReturn("LOCAL")
        when(config_reader).get(
            WebDriverFactory.BROWSER_TYPE_CONFIG).thenReturn("PHANTOMJS")

        try:
            phantom_js_path = WTF_CONFIG_READER.get(
                WebDriverFactory.PHANTOMEJS_EXEC_PATH)
            when(config_reader).get(
                WebDriverFactory.PHANTOMEJS_EXEC_PATH).thenReturn(
                    phantom_js_path)
        except KeyError:
            when(config_reader).get(
                WebDriverFactory.PHANTOMEJS_EXEC_PATH).thenRaise(KeyError())

        driver_factory = WebDriverFactory(config_reader)
        self._driver = driver_factory.create_webdriver()

        # This whould open a local instance of Firefox.
        self._driver.get("http://www.google.com")

        # Check if we can use this instance of webdriver.
        self._driver.find_element_by_name('q')  # google's famous q element.
コード例 #4
0
    def test_create_phantomjs_driver(self):
        config_reader = mock(ConfigReader)
        when(config_reader).get(
            WebDriverFactory.DRIVER_TYPE_CONFIG).thenReturn("LOCAL")
        when(config_reader).get(
            WebDriverFactory.BROWSER_TYPE_CONFIG).thenReturn("PHANTOMJS")

        # Check if the person running this test has a config specified for
        # phantom JS, otherwise use default.
        try:
            path = WTF_CONFIG_READER.get(WebDriverFactory.PHANTOMEJS_EXEC_PATH)
            when(config_reader).get(
                WebDriverFactory.PHANTOMEJS_EXEC_PATH).thenReturn(path)
        except KeyError:
            when(config_reader).get(
                WebDriverFactory.PHANTOMEJS_EXEC_PATH).thenRaise(KeyError())

        driver_factory = WebDriverFactory(config_reader)
        self._driver = driver_factory.create_webdriver()

        # This whould open a local instance of Firefox.
        self._driver.get("http://www.google.com")

        # Check if we can use this instance of webdriver.
        self._driver.find_element_by_name('q')  # google's famous q element.
コード例 #5
0
    def test_createWebDriver_WithLocalBrowser(self):
        '''
        This will test this by opening firefox and trying to fetch Google with it.

        This test will normally be commented out since it spawns annoying browser windows.
        When making changes to WebDriverFactory, please run this test manually.
        '''
        config_reader = mock(ConfigReader)
        when(config_reader).get(
            WebDriverFactory.DRIVER_TYPE_CONFIG).thenReturn("LOCAL")
        when(config_reader).get(
            WebDriverFactory.BROWSER_TYPE_CONFIG).thenReturn("PHANTOMJS")

        try:
            phantom_js_path = WTF_CONFIG_READER.get(WebDriverFactory.PHANTOMEJS_EXEC_PATH)
            when(config_reader).get(
                WebDriverFactory.PHANTOMEJS_EXEC_PATH).thenReturn(phantom_js_path)
        except KeyError:
            when(config_reader).get(
                WebDriverFactory.PHANTOMEJS_EXEC_PATH).thenRaise(KeyError())

        driver_factory = WebDriverFactory(config_reader)
        self._driver = driver_factory.create_webdriver()

        # This whould open a local instance of Firefox.
        self._driver.get("http://www.google.com")

        # Check if we can use this instance of webdriver.
        self._driver.find_element_by_name('q')  # google's famous q element.
コード例 #6
0
    def setUp(self):
        self.expected_subject = WTF_CONFIG_READER.get("email.expected_subject")
        self.expected_message = WTF_CONFIG_READER.get("email.expected_message")
        
        email_config = WTF_CONFIG_READER.get("email")
        account_config = email_config['primary']

        email_server = account_config['server']
        username = account_config['username']
        password = account_config['password']

        email_type = account_config['type']
        if email_type == 'IMAP':
            self.mail = IMapEmailAccountObject(email_server, username, password)
        else:
            raise TypeError("Unsupported email type '{0}'".format(type)) 
コード例 #7
0
    def test_create_phantomjs_driver(self):
        config_reader = mock(ConfigReader)
        when(config_reader).get(
            WebDriverFactory.DRIVER_TYPE_CONFIG).thenReturn("LOCAL")
        when(config_reader).get(
            WebDriverFactory.BROWSER_TYPE_CONFIG).thenReturn("PHANTOMJS")

        # Check if the person running this test has a config specified for
        # phantom JS, otherwise use default.
        try:
            path = WTF_CONFIG_READER.get(WebDriverFactory.PHANTOMEJS_EXEC_PATH)
            when(config_reader).get(
                WebDriverFactory.PHANTOMEJS_EXEC_PATH).thenReturn(path)
        except KeyError:
            when(config_reader).get(
                WebDriverFactory.PHANTOMEJS_EXEC_PATH).thenRaise(KeyError())

        driver_factory = WebDriverFactory(config_reader)
        self._driver = driver_factory.create_webdriver()

        # This whould open a local instance of Firefox.
        self._driver.get("http://www.google.com")

        # Check if we can use this instance of webdriver.
        self._driver.find_element_by_name('q')  # google's famous q element.
コード例 #8
0
    def setUp(self):
        self.expected_subject = WTF_CONFIG_READER.get("email.expected_subject")
        self.expected_message = WTF_CONFIG_READER.get("email.expected_message")

        email_config = WTF_CONFIG_READER.get("email")
        account_config = email_config['primary']

        email_server = account_config['server']
        username = account_config['username']
        password = account_config['password']

        email_type = account_config['type']
        if email_type == 'IMAP':
            self.mail = IMapEmailAccountObject(email_server, username,
                                               password)
        else:
            raise TypeError("Unsupported email type '{0}'".format(type))
コード例 #9
0
ファイル: debug_utils.py プロジェクト: JunDeng/wtframework
def print_debug(*args, **kwargs):
    """
    Print if and only if the debug flag is set true in the config.yaml file.
    
    Args:
        args : var args of print arguments.

    """
    if WTF_CONFIG_READER.get("debug", False) == True:
        print(*args, **kwargs)
コード例 #10
0
def print_debug(*args, **kwargs):
    """
    Print if and only if the debug flag is set true in the config.yaml file.
    
    Args:
        args : var args of print arguments.

    """
    if WTF_CONFIG_READER.get("debug", False) == True:
        print(*args, **kwargs)
コード例 #11
0
 def __init__(self):
     config = """
     selenium:
         type: REMOTE
         remote_url: {0}
         browser: FIREFOX
         desired_capabilities:
             platform: WINDOWS
             name: Unit Testing WD-acceptance-tests WebDriverFactory
     """.format(WTF_CONFIG_READER.get("selenium.remote_url"))
     # TODO: Might be good to replace this with a local grid to avoid using up SauceLab automation hours.
     self.map = yaml.load(config)
コード例 #12
0
 def __init__(self):
     config = """
     selenium:
         type: REMOTE
         remote_url: {0}
         browser: FIREFOX
         desired_capabilities:
             platform: Windows 7
             name: Unit Testing WD-acceptance-tests WebDriverFactory
     """.format(WTF_CONFIG_READER.get("selenium.remote_url"))
     # TODO: Might be good to replace this with a local grid to avoid using up SauceLab automation hours.
     self.map = yaml.load(config)
コード例 #13
0
 def __init__(self):
     config = """
     selenium:
         type: REMOTE
         remote_url: {0}
         browser: FIREFOX
         desired_capabilities:
             platform: WINDOWS
             name: Unit Testing WD-acceptance-tests WebDriverFactory
     """.format(WTF_CONFIG_READER.get("selenium.remote_url"))
     # Currently using free open source sauce account loaded from encrpyed env var to test this
     # on Travis CI.
     self.map = yaml.load(config)
コード例 #14
0
 def __init__(self):
     config = """
     selenium:
         type: REMOTE
         remote_url: {0}
         browser: FIREFOX
         desired_capabilities:
             platform: WINDOWS
             name: Unit Testing WD-acceptance-tests WebDriverFactory
     """.format(WTF_CONFIG_READER.get("selenium.remote_url"))
     # Currently using free open source sauce account loaded from encrpyed env var to test this
     # on Travis CI.
     self.map = yaml.load(config)
コード例 #15
0
 def __init__(self):
     config = """
     selenium:
         type: REMOTE
         remote_url: {0}
         browser: OTHER
         desired_capabilities:
             platform: OS X 10.9
             version: 7
             device-orientation: portrait
             device: iPhone Simulator
             name: Unit Testing WD-acceptance-tests WebDriverFactory
     """.format(WTF_CONFIG_READER.get("selenium.remote_url"))
     # Currently using free open source sauce account loaded from encrpyed env var to test this
     # on Travis CI.
     self.map = yaml.load(config)
コード例 #16
0
 def __init__(self):
     config = """
     selenium:
         type: REMOTE
         remote_url: {0}
         browser: OTHER
         desired_capabilities:
             platform: OS X 10.9
             version: 7
             device-orientation: portrait
             device: iPhone Simulator
             name: Unit Testing WD-acceptance-tests WebDriverFactory
     """.format(WTF_CONFIG_READER.get("selenium.remote_url"))
     # Currently using free open source sauce account loaded from encrpyed env var to test this
     # on Travis CI.
     self.map = yaml.load(config)
コード例 #17
0
    def __init__(self, webdriver_provider=None, screenshot_util=None):
        '''
        Constructor
        '''
        if WTF_CONFIG_READER.get("selenium.take_screenshot", True):
            self.capture_screenshot = True
        else:
            self.capture_screenshot = False
        
        if webdriver_provider == None:
            self._webdriver_provider = WTF_WEBDRIVER_MANAGER
        else:
            self._webdriver_provider = webdriver_provider

        if screenshot_util == None:
            self._screenshot_util = WebScreenShotUtil
        else:
            self._screenshot_util = screenshot_util 
コード例 #18
0
ファイル: test_watchers.py プロジェクト: JunDeng/wtframework
    def __init__(self, webdriver_provider=None, screenshot_util=None):
        '''
        Constructor.
        
        Kwargs:
            webdriver_provider: Override the default WebdriverManager instance.
            screenshot_util: Override the default screenshot util method.

        '''
        if WTF_CONFIG_READER.get("selenium.take_screenshot", True):
            self.capture_screenshot = True
        else:
            self.capture_screenshot = False
        
        if webdriver_provider == None:
            self._webdriver_provider = WTF_WEBDRIVER_MANAGER
        else:
            self._webdriver_provider = webdriver_provider

        if screenshot_util == None:
            self._screenshot_util = WebScreenShotUtil
        else:
            self._screenshot_util = screenshot_util 
コード例 #19
0
ファイル: settings.py プロジェクト: tokarthik/wtframework
def get_admin_user():
    return WTF_CONFIG_READER.get("admin_user", "admin")
コード例 #20
0
def password():
    "Correct password"
    return WTF_CONFIG_READER.get('test_data.password')
コード例 #21
0
def login():
    "Correct login"
    return WTF_CONFIG_READER.get('test_data.login')
コード例 #22
0
 def setUp(self):
     self.driver = WTF_WEBDRIVER_MANAGER.new_driver()
     self.base_url = WTF_CONFIG_READER.get("selenium.baseurl")
コード例 #23
0
ファイル: settings.py プロジェクト: Hellspam/wtframework
def get_search_provider():
    "Configure this via the 'search_provider' setting."
    return WTF_CONFIG_READER.get("search_provider", "http://www.google.com")
コード例 #24
0
ファイル: settings.py プロジェクト: Hellspam/wtframework
def get_admin_password():
    return WTF_CONFIG_READER.get("admin_password", "password")
コード例 #25
0
ファイル: settings.py プロジェクト: Hellspam/wtframework
def get_admin_user():
    return WTF_CONFIG_READER.get("admin_user", "admin")
コード例 #26
0
ファイル: settings.py プロジェクト: szymonjan/mobile_tests
def url_address():
    "Application under test URL"
    return WTF_CONFIG_READER.get('test_data.url')
コード例 #27
0
ファイル: settings.py プロジェクト: tokarthik/wtframework
def get_search_provider():
    "Configure this via the 'search_provider' setting."
    return WTF_CONFIG_READER.get("search_provider", "http://www.google.com")
コード例 #28
0
ファイル: settings.py プロジェクト: tokarthik/wtframework
def get_admin_password():
    return WTF_CONFIG_READER.get("admin_password", "password")