<commit_before># -*- coding: utf-8 -*-

import time
from behave import when, then, given
from toxicbuild.ui import settings
from tests.webui.steps.base_steps import (  # noqa f811
    given_logged_in_webui, user_sees_main_main_page_login)


# Scenario: Someone try to access a page without being logged.

@when('someone tries to access a waterfall url without being logged')
def step_impl(context):
    browser = context.browser
    base_url = 'http://{}:{}/'.format(settings.TEST_WEB_HOST,
                                      settings.TORNADO_PORT)

    url = base_url + 'waterfall/some-repo'

    browser.get(url)


@then('he sees the login page')  # noqa f401
def step_impl(context):
    browser = context.browser
    el = browser.find_element_by_id('inputUsername')
    assert el


# Scenario: Do login

@given('the user is in the login page')  # noqa f401
def step_impl(context):
    browser = context.browser
    base_url = 'http://{}:{}/'.format(settings.TEST_WEB_HOST,<commit_msg>Change auth selenium test to use wait_element_become_present<commit_after># -*- coding: utf-8 -*-

import time
from behave import when, then, given
from toxicbuild.ui import settings
from tests.webui.steps.base_steps import (  # noqa f811
    given_logged_in_webui, user_sees_main_main_page_login)


# Scenario: Someone try to access a page without being logged.

@when('someone tries to access a waterfall url without being logged')
def step_impl(context):
    browser = context.browser
    base_url = 'http://{}:{}/'.format(settings.TEST_WEB_HOST,
                                      settings.TORNADO_PORT)

    url = base_url + 'waterfall/some-repo'

    browser.get(url)


@then('he sees the login page')  # noqa f401
def step_impl(context):
    browser = context.browser

    def fn():
        try:
            el = browser.find_element_by_id('inputUsername')
        except Exception:
            el = None

        return el

    el = browser.wait_element_become_present(fn)

    assert el


# Scenario: Do login

@given('the user is in the login page')  # noqa f401
def step_impl(context):
    browser = context.browser
    base_url = 'http://{}:{}/'.format(settings.TEST_WEB_HOST,
{'fraction_non_alphanumeric': 0.10362219165520403, 'fraction_numerical': 0.009170105456212746, 'mean_word_length': 3.204238921001927, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 2, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1874792', 'n_tokens_mistral': 708, 'n_tokens_neox': 671, 'n_words': 188}