コード例 #1
0
def step_impl(context, expect_shown, which_day):

    form_object = get_page_object('weather_home', context.browser)

    if 'not' in expect_shown:
        expect_shown = False
    else:
        expect_shown = True

    form_object.check_details_visible(which_day, expected_vis=expect_shown)
コード例 #2
0
def step_impl(context, day):
    form_object = get_page_object('weather_home', context.browser)
    max_temp = form_object.get_daily_maximum_temp(day)

    # tidy up the text - remove the degrees symbol
    max_temp = util.clean_text_string_return_ascii(max_temp)
    logging.info(max_temp)

    assert max_temp == context.summary_max,\
        'Summary max temp for day %s is not as expected - the average' \
        ' hourly temp is %s , but summary shows: %s' \
        % (day, context.summary_max, max_temp)
コード例 #3
0
def step_impl(context, day):

    form_object = get_page_object('weather_home', context.browser)
    summary_max_temps = form_object.get_hourly_maximum_temps(day)
    logging.info('Hourly max temps shown for day %s are %s' %
                 (day, summary_max_temps))

    total_max = sum(summary_max_temps)

    average = total_max / len(summary_max_temps)
    # add the average to the context so we can use it again
    context.summary_max = average
コード例 #4
0
def impl_start_app(context):

    # Create a page object and start the app
    weather_form = get_page_object("weather_start", context.browser,
                                   context.base_url)
    return weather_form
コード例 #5
0
def get_ui_data_test_data(context):
    form_object = get_page_object('weather_home', context.browser)
    ui_data_dict = form_object.get_all_data_test_elements_to_dict()
    logging.info(ui_data_dict)
    return ui_data_dict
コード例 #6
0
def check_five_days_listed(context):
    form_object = get_page_object('weather_home', context.browser)
    all_summaries = form_object.return_summary_elements()
    count_shown = len(all_summaries)
    assert count_shown == 5,\
        'We did not find summary data for 5 days - got %i' % count_shown
コード例 #7
0
def impl_city_search(context, city):

    form_object = get_page_object('weather_home', context.browser)
    form_object.enter_search_criteria(city)
コード例 #8
0
def step_impl(context, which_day):

    form_object = get_page_object('weather_home', context.browser)
    form_object.click_specified_day(which_day)