예제 #1
0
def complete_login_form(context):
    username = get_config().get("user", "username")
    password = get_config().get("user", "password")

    context.browser.find_element(
        *HomePage.username_field_locator).send_keys(username)
    context.browser.find_element(
        *HomePage.password_field_locator).send_keys(password)
예제 #2
0
def assert_login(context):
    login_form = context.browser.find_element(*HomePage.login_form_locator)
    login_form.find_element(*HomePage.login_btn_locator).click()

    loged_in_name = context.browser.find_element(
        *HomePage.logged_in_name_locator).text
    assert loged_in_name == get_config().get("user", "username")
예제 #3
0
def assert_reset_password(context):
    sleep(3)
    username = get_config().get("user", "username")
    url = "http://{}/emails?recipient={}".format(
        _get_config().get("test_framework", "db"), username)
    emails_count = len(get_until_not_empty(url))

    assert context.emails_count + 1 == emails_count
예제 #4
0
def reset_password(context):
    username = get_config().get("user", "username")
    url = "http://{}/emails?recipient={}".format(
        _get_config().get("test_framework", "db"), username)
    context.emails_count = len(get_until_not_empty(url))
    context.browser.find_element(
        *ResetPasswordPage.username_field_locator).send_keys(username)
    context.browser.find_element(
        *ResetPasswordPage.reset_pass_btn_locator).click()
예제 #5
0
def before_scenario(context, scenario):
    options = Options()
    browser = os.getenv("BROWSER")
    context.browser = WebDriver("http://{}:4444/wd/hub".format(
        get_config().get("browser", "host")),
                                desired_capabilities={"browserName": browser},
                                options=options)
    if browser == "firefox":
        options.set_preference("browser.tabs.remote.autostart", False)
        options.set_preference("security.insecure_password.ui.enabled", False)
        options.set_preference(
            "security.insecure_field_warning.contextual.enabled", False)
    context.browser.set_page_load_timeout(60)
    context.browser.implicitly_wait(60)

    os.makedirs(join(context.screenshots_dir, scenario.name.replace(" ", "_")),
                exist_ok=True)
    context.screenshots_dir = join(context.screenshots_dir,
                                   scenario.name.replace(" ", "_"))
예제 #6
0
def navigate_to_home(context):
    context.browser.get(get_config().get("webapp", "url"))
예제 #7
0
def navigate_to_dimensions_data(context):
    context.browser.get(get_config().get("webapp", "reset_password"))
예제 #8
0
def navigate_to_dimensions_data(context):
    context.browser.get(get_config().get("webapp", "facts"))