Internal Classes

class holmium.core.pageobject.ElementDict(instance, *args, **kwargs)[source]

proxy to a standard dict which would be stored in a holmium.core.Page.

class holmium.core.pageobject.ElementList(instance, *args, **kwargs)[source]

proxy to a standard list which would be stored in a holmium.core.Page.

class holmium.core.pageobject.ElementGetter(locator_type, query_string, base_element=None, timeout=1, value=<function <lambda> at 0x40e1b18>)[source]

internal class to encapsulate the logic used by holmium.core.Element & holmium.core.Elements

holmium.core.pageobject.enhanced(web_element)[source]

incase a higher level abstraction for a WebElement is available we will use that in Pages. (e.g. a select element is converted into selenium.webdriver.support.ui.Select)

class holmium.core.HolmiumNose

nose plugin to allow bootstrapping testcases with a selenium driver

class holmium.core.Config(dct, environment={'holmium': {'environment': 'development'}})

Dictionary like helper class for maintaining test data configurations per environment.

holmium.core.TestCase and holmium.core.HolmiumNose both look for either a config.json or config.py file in the same directory as the test file, and will make a config object available to the test case instance.

The holmium.core.Config object is aware of the environment (specified with --holmium-env when using nose or HO_ENV as an environment variable and will return the config variable from that environment or from the default key.

Values in the config file can use jinja2.Template templates to access either values from itself, environment variables or a select magic holmium variables: holmium.environment, holmium.browser, holmium.user_agent and holmium.remote.

Example config structure (which uses a magic variable holmium.environment and an environment variable $PATH).

JSON

{
        'default': { 'url': 'http://localhost'
                    , 'path':"{{PATH}}"
                    , 'login_url': '{{default.url}}/{{holmium.environment}}/login'}
                    , 'username' : '{{holmium.environment}}user'}
        ,'production': {'password': 'sekret'}
        ,'development': {'password': 'password'}
}

Python

config = {
    {
        'default': { 'url': 'http://localhost'
                    , 'path':"{{PATH}}"
                    , 'login_url': '{{default.url}}/{{holmium.environment}}/login'}
                    , 'username' : '{{holmium.environment}}user'}
        ,'production': {'password': 'sekret'}
        ,'development': {'password': 'password'}
    }
}

When accessing self.config within a test, due to the default:

  • self.config['path'] will always return the value of the environment variable PATH,
  • self.config['password'] will always return ‘sekret’
  • self.config['url'] will always return ‘http://localhost

if HO_ENV or --holmium-env are production:

  • self.config['username'] will return productionuser
  • self.config['password'] will return sekret
  • self.config['login_url'] will return http://localhost/production/login

if HO_ENV or --holmium-env are development:

  • self.config['username'] will return developmentuser
  • self.config['password'] will return password
  • self.config['login_url'] will return http://localhost/development/login

Table Of Contents

This Page