def tcid_3_search_for_items_from_list(context):

    search_list = ["cucumber", "java", "selenium web browser automation"]
    for i in search_list:
        search_bar = GOOGLE['search bar']
        search_bar_type = search_bar['type']
        search_bar_locator = search_bar['locator']
        webcommon.type_into_element(context, i, search_bar_type,
                                    search_bar_locator)

        search_button = GOOGLE['search button']
        search_button_type = search_button['type']
        search_button_locator = search_button['locator']
        webcommon.click(context, search_button_type, search_button_locator)

        result_link = GOOGLE['result link']
        result_link_type = result_link['type']
        result_link_locator = result_link['locator']
        link = webcommon.get_element_text(context, result_link_type,
                                          result_link_locator)

        search_result = GOOGLE['search result']
        search_result_type = search_result['type']
        search_result_locator = search_result['locator']
        webcommon.click(context, search_result_type, search_result_locator)

        webcommon.assert_url_contains(context, link)

        webcommon.back(context)
예제 #2
0
def i_verify_checkout_page_is_loaded(context):
    webcommon.assert_url_contains(context, '/checkout/')

    expected_text = 'Checkout'
    header_locator = CHECKOUT_PAGE_LOCATORS['page_header']
    contains = webcommon.element_contains_text(context, expected_text,
                                               header_locator['type'],
                                               header_locator['locator'])
    assert contains, f"header of checkout page does not contain the text '{expected_text}'."

    form_locator = CHECKOUT_PAGE_LOCATORS['checkout_form']
    webcommon.assert_element_visible(context, form_locator['type'],
                                     form_locator['locator'])
def tcid_3_capture_link(context):

    result_link = GOOGLE['result link']
    result_link_type = result_link['type']
    result_link_locator = result_link['locator']
    text = webcommon.get_element_text(context, result_link_type,
                                      result_link_locator)

    search_result = GOOGLE['search result']
    search_result_type = search_result['type']
    search_result_locator = search_result['locator']
    webcommon.click(context, search_result_type, search_result_locator)

    webcommon.assert_url_contains(context, text)
예제 #4
0
def i_click_on_cart_in_the_top_nav_bar_and_verify_cart_page_opens(context):
    max_tries = 5
    try_count = 0
    cart_info_locator = HOME_PAGE_LOCATORS['cart_info_box']
    while try_count < max_tries:
        try:
            webcommon.click(context, cart_info_locator['type'], cart_info_locator['locator'])
            webcommon.assert_url_contains(context, '/cart/')
            break
        except Exception as e:
            try_count += 1
            print(f"failed to click on proceed to cart. Retry number: {try_count}")
    else:
        raise Exception(f"failed to click on proceed to cart button after 5 retries")
예제 #5
0
def i_click_on_cart_in_the_top_nav_bar_and_verify_cart_page_opens(context):

        cart_info_locator = HOME_PAGE_LOCATORS['cart_info_box']
        webcommon.click(context, cart_info_locator['type'], cart_info_locator['locator'])

        webcommon.assert_url_contains(context, '/cart/')
예제 #6
0
def TCID_2_verify_url_ends_with(context, text):

    webcommon.assert_url_contains(context, text)