def switch_organisations_to_my_second_organisation(driver, context): # noqa Hub(driver).click_switch_link() no = utils.get_element_index_by_text( Shared(driver).get_radio_buttons_elements(), context.org_name_for_switching_organisations) Shared(driver).click_on_radio_buttons(no) functions.click_submit(driver)
def choose_application_clearance_level(driver, context): # noqa no = utils.get_element_index_by_text( Shared(driver).get_radio_buttons_elements(), "uk_unclassified") Shared(driver).click_on_radio_buttons(no) functions.click_submit(driver)
def go_to_exporter(driver, register_organisation, sso_sign_in, exporter_url, context): # noqa if "pick-organisation" in driver.current_url: no = utils.get_element_index_by_text( Shared(driver).get_radio_buttons_elements(), context.org_name) Shared(driver).click_on_radio_buttons(no) functions.click_submit(driver) elif Shared(driver).get_text_of_organisation_heading() != context.org_name: Hub(driver).click_switch_link() no = utils.get_element_index_by_text( Shared(driver).get_radio_buttons_elements(), context.org_name) Shared(driver).click_on_radio_buttons(no) functions.click_submit(driver)
def party_table(driver, context): text = [context.end_user[key] for key in ["name", "address"]] text.append(context.end_user["country"]["name"]) row = Shared(driver).get_table_row(1) for string in text: assert string in row.text
def the_good_is_added_to_the_exhibition_application(driver, context): # noqa assert len(StandardApplicationGoodsPage( driver).get_goods()) == 1 # Only one good added assert "Equipment" in Shared(driver).get_table_row(1).text # Go back to task list functions.click_back_link(driver)
def exhibition_licence_row(context, driver): Shared(driver).filter_by_reference_number(context.reference_code) row = LicencesPage(driver).licence_row_properties(context.licence) assert context.reference_code in row assert ", ".join( x["rating"] for x in context.goods[0]["good"]["control_list_entries"]) in row assert context.goods[0]["good"]["description"] in row assert "Issued" in row
def add_new_end_user_with_clearance(driver, type, name, website, clearance, address, country, context): # noqa add_end_user_pages = AddEndUserPages(driver) add_end_user_pages.create_new_or_copy_existing(copy_existing=False) add_end_user_pages.select_type(type) context.type_end_user = type functions.click_submit(driver) add_end_user_pages.enter_name(name) context.name_end_user = name functions.click_submit(driver) add_end_user_pages.enter_website(website) functions.click_submit(driver) no = utils.get_element_index_by_text( Shared(driver).get_radio_buttons_elements(), clearance) Shared(driver).click_on_radio_buttons(no) functions.click_submit(driver) functions.click_submit(driver) add_end_user_pages.enter_address(address) context.address_end_user = address add_end_user_pages.enter_country(country) functions.click_submit(driver)
def change_members_role(driver, context, api_test_client): site = api_test_client.organisations.add_site(context.org_id) MemberPage(driver).click_assign_sites_button() site_checkbox = driver.find_element_by_id(site["name"]) scroll_to_element_by_id(driver, site["name"]) site_checkbox.click() functions.click_submit(driver) assert site["name"] in Shared( driver).get_text_of_body(), "user was expected to be assigned to site"
def the_good_is_added_to_the_application(driver, context): # noqa body_text = Shared(driver).get_text_of_body() assert len(StandardApplicationGoodsPage( driver).get_goods()) == 1 # Only one good added assert StandardApplicationGoodsPage( driver).get_goods_total_value() == "£1.00" # Value assert "2.0" in body_text # Quantity assert "Number of articles" in body_text # Unit assert context.is_good_incorporated in body_text # Incorporated # Go back to task list functions.click_back_link(driver)
def see_second_organisation_name(driver, context): assert Shared(driver).get_text_of_organisation_heading( ) == context.org_name_for_switching_organisations
def filter_status_change(driver, status): members_page = MembersPage(driver) members_page.select_filter_status_from_dropdown(status) Shared(driver).click_apply_filters_button()
def download_and_delete_is_links_are_present(driver, button): shared = Shared(driver) latest_ueu_links = [ link.text for link in shared.get_links_of_table_row(-1) ] assert button in latest_ueu_links
def i_remove_an_ultimate_end_user(driver): no_of_ultimate_end_users = Shared(driver).get_size_of_table_rows() driver.find_element_by_link_text("Remove").click() total = no_of_ultimate_end_users - Shared(driver).get_size_of_table_rows() assert total == 1, "total on the ultimate end users summary is incorrect after removing ultimate end user"
def user_deactivate(driver): # TODO get rid of this body. assert "Deactivated" in Shared(driver).get_text_of_body( ), "user status was expected to be Deactivated"
def edit_button_not_present(driver): text = Shared(driver).get_text_of_main_content() assert "post note" not in text.lower() assert "cancel" not in text.lower() assert "add a note" not in text.lower()
def notification_on_application_list(driver, context, num): elements = driver.find_elements_by_css_selector(".govuk-table__row") no = helpers.get_element_index_by_text(elements, context.app_name, complete_match=False) assert num in elements[no].find_element_by_css_selector(Shared(driver).NOTIFICATION).text
def user_reactivate(driver): assert "Active" in Shared(driver).get_text_of_body( ), "user status was expected to be Deactivated"
def nlr_document_visible(context, driver): Shared(driver).filter_by_reference_number(context.reference_code) row = LicencesPage(driver).licence_row_properties( context.generated_document) assert context.reference_code in row
def show_filters(driver): Shared(driver).click_show_filters_link()
def change_members_role(driver): assert "Super User" in Shared( driver).get_text_of_body(), "user role was expected to be Super User"
def see_open_licence_entry(driver, context): top_row = Shared(driver).get_table_row(1) assert top_row.get_attribute("id") == context.open_licence_returns_id assert context.open_licence_return_year in top_row.text
def click_on_application(driver, context): elements = Shared(driver).get_gov_table_cell_links() no = helpers.get_element_index_by_text(elements, context.app_name, complete_match=False) elements[no].click()