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)
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")
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
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()
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(" ", "_"))
def navigate_to_home(context): context.browser.get(get_config().get("webapp", "url"))
def navigate_to_dimensions_data(context): context.browser.get(get_config().get("webapp", "reset_password"))
def navigate_to_dimensions_data(context): context.browser.get(get_config().get("webapp", "facts"))