def go_to_team_edit_page(driver, team, queue): # noqa # we should already be on the profile page driver.find_element_by_id("link-edit-team").click() teams_page = TeamsPages(driver) teams_page.select_team_from_dropdown(team) teams_page.select_default_queue_from_dropdown(queue) functions.click_submit(driver)
def add_new_external_location_without_country(driver, name, address): # noqa add_new_external_location_form_page = AddNewExternalLocationFormPage( driver) add_new_external_location_form_page.enter_external_location_name(name) add_new_external_location_form_page.enter_external_location_address( address) functions.click_submit(driver)
def eu_military_end_use_details(driver, choice): # noqa end_use_details = EndUseDetailsFormPage(driver) if choice == "Yes": end_use_details.answer_is_eu_military(True) else: end_use_details.answer_is_eu_military(False) functions.click_submit(driver)
def informed_wmd_end_use_details(driver, choice): # noqa end_use_details = EndUseDetailsFormPage(driver) if choice == "Yes": end_use_details.answer_is_informed_wmd(True, fake.ean(length=13)) else: end_use_details.answer_is_informed_wmd(False) functions.click_submit(driver)
def enter_permanent_or_temporary(driver, permanent_or_temporary, context): # noqa context.perm_or_temp = permanent_or_temporary # type needs to be permanent or temporary apply = ApplyForALicencePage(driver) apply.click_permanent_or_temporary_button(permanent_or_temporary) functions.click_submit(driver)
def fill_in_individual_info_page_1(self, context): context.organisation_name = fake.name() context.eori = "12345" self.enter_individual_organisation_first_last_name( context.organisation_name) self.enter_email(fake.free_email()) functions.click_submit(self.driver)
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 add_a_role(driver, permissions, context): roles_page = RolesPages(driver) roles_page.click_add_a_role_button() context.role_name = f"test {utils.get_unformatted_date_time()}"[:25] roles_page.enter_role_name(context.role_name) roles_page.select_permissions(permissions) functions.click_submit(driver)
def create_standard_application(driver, export_type, context): # noqa ExporterHubPage(driver).click_apply_for_a_licence() ApplyForALicencePage(driver).select_licence_type("export_licence") functions.click_submit(driver) enter_type_of_application(driver, "siel", context) enter_permanent_or_temporary(driver, export_type, context) enter_application_name(driver, context) enter_export_licence(driver, "yes", "123456", context)
def enter_details_of_copied_application(driver, context, name, option, code): ApplyForALicencePage(driver).enter_name_or_reference_for_application(name) functions.click_submit(driver) ApplyForALicencePage(driver).click_export_licence_yes_or_no(option) ApplyForALicencePage(driver).type_into_reference_number(code) context.name = name context.reference_code = code functions.click_submit(driver)
def create_standard_individual_transhipment_application(driver, context): # noqa ExporterHubPage(driver).click_apply_for_a_licence() ApplyForALicencePage(driver).select_licence_type("transhipment") functions.click_submit(driver) enter_type_of_application(driver, "sitl", context) enter_application_name(driver, context) enter_export_licence(driver, "yes", "123456", context)
def eu_compliant_limitations_end_use_details(driver, choice): # noqa end_use_details = EndUseDetailsFormPage(driver) if choice == "Yes": end_use_details.answer_is_compliant_limitations_eu(True) else: end_use_details.answer_is_compliant_limitations_eu( False, fake.sentence(nb_words=30)) functions.click_submit(driver)
def create_standard_application(driver, good_type, country, context): # noqa ExporterHubPage(driver).click_apply_for_a_licence() ApplyForALicencePage(driver).select_licence_type("export_licence") functions.click_submit(driver) enter_type_of_application(driver, "ogel", context) ogel = OgelPage(driver) ogel.enter_control_list_entry(good_type) ogel.enter_country(country)
def create_new_or_copy_existing(self, copy_existing: bool): if copy_existing: self.driver.find_element_by_id( f"{self.INPUT_CREATE_NEW_OR_COPY_ID}-yes").click() else: self.driver.find_element_by_id( f"{self.INPUT_CREATE_NEW_OR_COPY_ID}-no").click() functions.click_submit(self.driver)
def suspected_wmd_end_use_details(driver, choice): # noqa end_use_details = EndUseDetailsFormPage(driver) if choice == "Yes": end_use_details.answer_is_suspected_wmd(True, fake.sentence(nb_words=30)) else: end_use_details.answer_is_suspected_wmd(False) functions.click_submit(driver)
def new_sites_info(driver, context): context.new_site_name = faker.word() + timezone.localtime().strftime( "%m%d%H%M") NewSite(driver).enter_new_site_details(context.new_site_name, faker.street_address(), faker.postcode(), faker.city(), faker.state()) functions.click_submit(driver)
def temporary_export_direct_control(driver, choice): # noqa temporary_export_details = TemporaryExportDetailsFormPage(driver) if choice == "Yes": temporary_export_details.answer_is_temp_direct_control(True) else: temporary_export_details.answer_is_temp_direct_control( False, fake.sentence(nb_words=30)) functions.click_submit(driver)
def military_end_use_details(driver, choice): # noqa end_use_details = EndUseDetailsFormPage(driver) if choice == "Yes": end_use_details.answer_military_end_use_controls( True, fake.ean(length=13)) else: end_use_details.answer_military_end_use_controls(False) functions.click_submit(driver)
def i_add_a_exhibition_style_good_on_application(driver, context): # noqa goods_page = StandardApplicationGoodsPage(driver) goods_page.click_add_preexisting_good_button() goods_page.click_add_to_application() # Enter good details context.good_type = "equipment" ExhibitionClearanceGoodPage(driver).click_good_type(context.good_type) functions.click_submit(driver)
def create_routing_rule(driver, context, tier, case_status): routing_rules_page = RoutingRulesPage(driver) routing_rules_page.create_new_routing_rule() routing_rules_page.select_team(SystemTeamsID.ADMIN.value) functions.click_submit(driver) routing_rules_page.initial_details_form( tier=tier, case_status=case_status, queue=context.queue_name, additional_rules=False ) functions.click_submit(driver)
def create_open_app(driver, export_type, context): # noqa ExporterHubPage(driver).click_apply_for_a_licence() ApplyForALicencePage(driver).select_licence_type("export_licence") functions.click_submit(driver) enter_type_of_application(driver, "oiel", context) choose_open_licence_category(driver, "military", context) enter_permanent_or_temporary(driver, export_type, context) enter_application_name(driver, context) answer_firearms_question(driver)
def create_a_new_good_in_application(driver, name, description, part_number, controlled, control_code, graded): # noqa add_goods_page = AddGoodPage(driver) add_goods_page.enter_good_name(name) add_goods_page.enter_description_of_goods(description) add_goods_page.enter_part_number(part_number) add_goods_page.select_is_your_good_controlled(controlled) add_goods_page.enter_control_list_entries(control_code) add_goods_page.select_is_your_good_graded(graded) functions.click_submit(driver)
def i_update_description(driver, text): # noqa change_description = driver.find_elements_by_id("link-edit-description")[0] change_description.click() desc_element = driver.find_element_by_id("description") updated_description = f"{desc_element.text} {text}" desc_element.clear() desc_element.send_keys(updated_description) functions.click_submit(driver)
def create_standard_individual_trade_control_application(driver, context): # noqa ExporterHubPage(driver).click_apply_for_a_licence() apply_for_licence_page = ApplyForALicencePage(driver) apply_for_licence_page.select_licence_type("trade_control_licence") functions.click_submit(driver) enter_type_of_application(driver, "sicl", context) enter_application_name(driver, context) apply_for_licence_page.select_trade_control_activity() apply_for_licence_page.select_trade_control_product_category()
def add_user(driver, context): user_page = UsersPage(driver) user_page.click_add_a_user_button() fake = Faker() context.added_email = fake.free_email() user_page.enter_email(context.added_email) user_page.select_option_from_team_drop_down_by_visible_text("Admin") user_page.select_option_from_role_drop_down_by_visible_text("Default") user_page.select_option_from_default_queue_drop_down_by_visible_text( "All cases") functions.click_submit(driver)
def add_new_additional_information(driver, context): # noqa page = F680AdditionalInformationPage(driver, "submit") page.enter_no_date() page.enter_foreign_technology() page.enter_locally_manufactured() page.enter_mtcr_type() page.enter_electronic_warfare_requirement() page.enter_uk_service_equipment() page.enter_uk_service_equipment_type() page.enter_prospect_value() functions.click_submit(driver, button_value="finish")
def i_fill_in_the_details_and_submit(driver, context): additional_contacts_page = AdditionalContactsPage(driver) context.additional_contact_email = fake.email() additional_contacts_page.enter_details(fake.prefix()) additional_contacts_page.enter_name(fake.name()) additional_contacts_page.enter_address(fake.address()) additional_contacts_page.enter_country("United Kingdom") additional_contacts_page.enter_email(context.additional_contact_email) additional_contacts_page.enter_phone_number(fake.phone_number()) functions.click_submit(driver)
def enter_site_details(self, context, location): context.site_name = fake.company() self.enter_site_name(context.site_name) if location == "united_kingdom": self.enter_address_line_1(fake.street_address()) self.enter_region(fake.city()) self.enter_post_code(fake.postcode()) self.enter_city(fake.state()) else: self.enter_address(fake.street_address()) self.enter_country("Ukraine") functions.click_submit(self.driver)
def i_enter_product_details_unit_quantity_and_value(driver, unit, quantity, value, status): # noqa details_page = StandardApplicationGoodDetails(driver) details_page.select_unit(unit) details_page.enter_quantity(quantity) details_page.enter_value(value) details_page.check_is_good_incorporated_false() # this step is not applicable if we are adding an existing good to the application if status != "N/A": details_page.set_deactivated_status(status) functions.click_submit(driver)