Example #1
0
def edit_good_details_in_application(driver, field_name,
                                     updated_value):  # noqa
    summary_page = ProductSummary(driver)
    _, link = summary_page.get_field_details(field_name)
    driver.execute_script("arguments[0].scrollIntoView();", link)
    driver.execute_script("arguments[0].click();", link)

    pages_map = {
        "Name":
        AddGoodPage(driver).enter_good_name,
        "Description":
        AddGoodPage(driver).enter_description_of_goods,
        "Part number":
        AddGoodPage(driver).enter_part_number,
        "Year of manufacture":
        AddGoodDetails(driver).enter_year_of_manufacture,
        "Calibre":
        AddGoodDetails(driver).enter_calibre,
        "Military use":
        AddGoodDetails(driver).select_is_product_for_military_use,
        "Information security features":
        AddGoodDetails(driver).does_product_employ_information_security,
    }

    func = pages_map[field_name]
    assert func is not None
    func(updated_value)
    functions.click_submit(driver)

    if field_name == "Military use":
        if updated_value == "yes_designed":
            updated_value = "Yes, specially designed for military use"
        elif updated_value == "yes_modified":
            updated_value = "Yes, modified for military use"
        elif updated_value == "no":
            updated_value = "No"

    updated_field_value, _ = summary_page.get_field_details(field_name)
    assert updated_field_value == updated_value
Example #2
0
def specify_product_infosec_details(driver, supports_infosec):  # noqa
    page = AddGoodDetails(driver)
    page.does_product_employ_information_security(supports_infosec)
    functions.click_submit(driver)
Example #3
0
def specify_product_purpose_details(driver, product_type, purpose):  # noqa
    page = AddGoodDetails(driver)
    heading = driver.find_element_by_class_name("govuk-fieldset__heading").text
    assert f"Describe the purpose of the {product_type}" == heading
    page.enter_software_technology_purpose_details(purpose)
    functions.click_submit(driver)
Example #4
0
def specify_product_component_details(driver, component):  # noqa
    page = AddGoodDetails(driver)
    page.select_is_product_a_component(component)
    functions.click_submit(driver)
Example #5
0
def specify_product_military_details(driver, military_use):  # noqa
    page = AddGoodDetails(driver)
    page.select_is_product_for_military_use(military_use)
    functions.click_submit(driver)
Example #6
0
def specify_firearms_identification_markings(driver, has_markings,
                                             details):  # noqa
    good_details_page = AddGoodDetails(driver)
    good_details_page.does_firearm_have_identification_markings(
        has_markings, details)
    functions.click_submit(driver)
Example #7
0
def upload_a_file_with_description(driver, cert_num, expiry_date):  # noqa
    good_details_page = AddGoodDetails(driver)
    good_details_page.enter_firearms_act_certificate_number(cert_num)
    day, month, year = expiry_date.split("-")
    good_details_page.enter_certificate_expiry_date(day, month, year)
    functions.click_submit(driver)
Example #8
0
def upload_a_file_with_description(driver, filename):  # noqa
    good_details_page = AddGoodDetails(driver)
    file_path = get_file_upload_path(filename)
    good_details_page.choose_firearms_certificate_file(file_path)
Example #9
0
def specify_firearms_act_section_num(driver, num):  # noqa
    good_details_page = AddGoodDetails(driver)
    good_details_page.select_firearms_act_section(num)
    functions.click_submit(driver)
Example #10
0
def specify_firearms_act_sections_choice(driver, choice):  # noqa
    good_details_page = AddGoodDetails(driver)
    good_details_page.select_do_firearms_act_sections_apply(choice)

    if choice != "Yes":
        functions.click_submit(driver)
Example #11
0
def enter_firearm_calibre(driver, calibre):  # noqa
    good_details_page = AddGoodDetails(driver)
    good_details_page.enter_calibre(calibre)
    functions.click_submit(driver)
Example #12
0
def enter_firearm_replica_status_with_description(driver, status,
                                                  description):  # noqa
    good_details_page = AddGoodDetails(driver)
    good_details_page.select_replica_status(status, description)
    functions.click_submit(driver)
Example #13
0
def enter_firearm_year_of_manufacture(driver, year):  # noqa
    good_details_page = AddGoodDetails(driver)
    good_details_page.enter_year_of_manufacture(year)
    functions.click_submit(driver)
Example #14
0
def select_sporting_gun_status(driver, status):  # noqa
    good_details_page = AddGoodDetails(driver)
    good_details_page.select_sporting_gun_status(status)
    functions.click_submit(driver)
Example #15
0
def specify_serial_number_of_other_identification_details(
        driver, has_markings, details):  # noqa
    good_details_page = AddGoodDetails(driver)
    good_details_page.set_identification_details(has_markings, details)
    functions.click_submit(driver)
Example #16
0
def select_product_type(driver, product_type):  # noqa
    good_details_page = AddGoodDetails(driver)
    good_details_page.select_firearm_product_type(product_type)
    functions.click_submit(driver)