<commit_before>import os
import random
import string

from lettuce import *

from selenium import webdriver
import lettuce_webdriver.webdriver
import time


from lettuce_webdriver.webdriver import contains_content

@step('I fill in "(.*)" with "(.*)" year')
def fill_in_year_type(step, field, value):
    year_field = world.browser.find_element_by_xpath('.//input[@id="%s"][@type="year"]' % field)
    year_field.clear()
    year_field.send_keys(value)

@step('I fill in "(.*)" with random text')
def fill_in_year_type(step, field):
    field = find_field_only(field)
    value = generate_random_str(8)
    field.clear()
    field.send_keys(value)

@step('I log in as "(.*)" with "(.*)" password expects "(.*)"')
def login_as_user_with_expectations(step, username, password, expectation):
    username_field = world.browser.find_element_by_xpath('.//input[@name="username"]')
    username_field.send_keys(username)
    password_field = world.browser.find_element_by_xpath('.//input[@name="password"]')
    password_field.send_keys(password)
    password_field.submit()
    assert contains_content(world.browser, expectation)

@step('I log in as "(.*)" with "(.*)" password')
def login_as_user(step, username, password):
    time.sleep(5)
    username_field = world.browser.find_element_by_xpath('.//input[@name="username"]')
    username_field.send_keys(username)
    password_field = world.browser.find_element_by_xpath('.//input[@name="password"]')
    password_field.send_keys(password)
    password_field.submit()
    
@step('I choose "(.*)" radio')
def radio_button(step, field):
    radio = world.browser.find_element_by_xpath('.//input[@id="%s"][@type="radio"]' % field)
    radio.click()

@step('Given I go to "(.*)"')
def our_goto(step, relative_url):
    """
    NB. This allows tests to run in different contexts ( locally, staging.)
    We delegate to the library supplied version of the step with the same pattern after fixing the path
    """
    absolute_url = world.site_url + relative_url
    lettuce_webdriver.webdriver.goto(step, absolute_url)

@step('Then I should see "(.*)"')
def eventually(step, expectation):
    number_of_seconds_to_wait = getattr(world,"wait_seconds", 30)
    lettuce_webdriver.webdriver.should_see_in_seconds(step, expectation, number_of_seconds_to_wait)


def generate_random_str(length):<commit_msg>Extra sleeps for staging lettuce tests ... ( I get 100% success on staging on command line running lettuce against rdrf_site_url of https://staging.ccgapps.com.au/rdrf )<commit_after>import os
import random
import string

from lettuce import *

from selenium import webdriver
import lettuce_webdriver.webdriver
import time


from lettuce_webdriver.webdriver import contains_content

@step('I fill in "(.*)" with "(.*)" year')
def fill_in_year_type(step, field, value):
    year_field = world.browser.find_element_by_xpath('.//input[@id="%s"][@type="year"]' % field)
    year_field.clear()
    year_field.send_keys(value)

@step('I fill in "(.*)" with random text')
def fill_in_year_type(step, field):
    field = find_field_only(field)
    value = generate_random_str(8)
    field.clear()
    field.send_keys(value)

@step('I log in as "(.*)" with "(.*)" password expects "(.*)"')
def login_as_user_with_expectations(step, username, password, expectation):
    username_field = world.browser.find_element_by_xpath('.//input[@name="username"]')
    username_field.send_keys(username)
    password_field = world.browser.find_element_by_xpath('.//input[@name="password"]')
    password_field.send_keys(password)
    password_field.submit()
    assert contains_content(world.browser, expectation)

@step('I log in as "(.*)" with "(.*)" password')
def login_as_user(step, username, password):
    time.sleep(15)
    username_field = world.browser.find_element_by_xpath('.//input[@name="username"]')
    username_field.send_keys(username)
    password_field = world.browser.find_element_by_xpath('.//input[@name="password"]')
    password_field.send_keys(password)
    password_field.submit()
    
@step('I choose "(.*)" radio')
def radio_button(step, field):
    radio = world.browser.find_element_by_xpath('.//input[@id="%s"][@type="radio"]' % field)
    radio.click()

@step('Given I go to "(.*)"')
def our_goto(step, relative_url):
    """
    NB. This allows tests to run in different contexts ( locally, staging.)
    We delegate to the library supplied version of the step with the same pattern after fixing the path
    """
    absolute_url = world.site_url + relative_url
    lettuce_webdriver.webdriver.goto(step, absolute_url)
    time.sleep(15)

@step('Then I should see "(.*)"')
def eventually(step, expectation):
    number_of_seconds_to_wait = getattr(world,"wait_seconds", 30)
    lettuce_webdriver.webdriver.should_see_in_seconds(step, expectation, number_of_seconds_to_wait)


def generate_random_str(length):
{'fraction_non_alphanumeric': 0.13974517057131114, 'fraction_numerical': 0.002877106452938759, 'mean_word_length': 5.106649937264743, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 1, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3468845', 'n_tokens_mistral': 1580, 'n_tokens_neox': 1544, 'n_words': 333}