def edit_existing_role(driver, context): elements = Shared(driver).get_cells_in_lite_table() no = utils.get_element_index_by_text(elements, context.role_name) elements[no + 2].find_element_by_css_selector("a").click() roles_pages = RolesPages(driver) context.flag_name = str(context.role_name)[:12] + "edited" roles_pages.enter_role_name(context.role_name) Shared(driver).click_submit()
def add_a_team_blue_ocean(driver, context): teams_pages = TeamsPages(driver) shared = Shared(driver) teams_pages.click_add_a_team_button() context.team_name = "BlueOcean" + str( utils.get_formatted_date_time_y_m_d_h_s()) teams_pages.enter_team_name(context.team_name) shared.click_submit()
def generate_decision_document(driver, context): # noqa generate_document_page = GeneratedDocument(driver) generate_document_page.select_generate_document() generate_document_page.select_document_template() Shared(driver).click_submit() Shared(driver).click_submit() Shared(driver).click_submit() context.status = "finalised"
def edit_existing_team(driver, context): teams_pages = TeamsPages(driver) shared = Shared(driver) elements = shared.get_links_in_lite_table() no = utils.get_element_index_by_text(elements, context.team_name) elements[no + 1].click() context.team_name = context.team_name + "edited" teams_pages.enter_team_name(context.team_name) shared.click_submit()
def see_team_user_added(driver, added_not_added, context, internal_info): if added_not_added == "added": table = Shared(driver).get_text_of_lite_table_body() assert context.added_email in table, "User is not displayed in team list" assert "Active" in table, "User is not displayed in team list" elif added_not_added == "not added": assert functions.element_with_css_selector_exists( driver, Shared(driver).LITE_NOTICE_SELECTOR ), "Users are potentially displayed for a just created Team List"
def edit_queue_with_countersigning(driver, context): queues = QueuesPages(driver) no = utils.get_element_index_by_text( Shared(driver).get_rows_in_lite_table(), context.queue_name, complete_match=False) queues.click_queue_edit_button(no) QueuesPages(driver).select_countersigning_queue( context.countersigning_queue_name) Shared(driver).click_submit()
def click_on_edit_queue(driver, context): queues = QueuesPages(driver) no = utils.get_element_index_by_text( Shared(driver).get_rows_in_lite_table(), context.queue_name, complete_match=False) queues.click_queue_edit_button(no) context.queue_name = str(context.queue_name)[:12] + "edited" QueuesPages(driver).enter_queue_name(context.queue_name) Shared(driver).click_submit()
def create_goods_flagging_rule(driver, context, condition, answer): flagging_rules_page = FlaggingRulePages(driver) flagging_rules_page.create_new_flagging_rule() flagging_rules_page.select_flagging_rule_type("Good") Shared(driver).click_submit() flagging_rules_page.enter_control_list(condition) flagging_rules_page.select_is_for_verified_goods_only(answer) flagging_rules_page.select_flag(context.flags["Good"]["name"]) Shared(driver).click_submit()
def create_flagging_rule(driver, context, type, condition): flagging_rules_page = FlaggingRulePages(driver) flagging_rules_page.create_new_flagging_rule() flagging_rules_page.select_flagging_rule_type(type) Shared(driver).click_submit() if type == "Case": flagging_rules_page.select_case_type(condition) elif type == "Destination": flagging_rules_page.enter_country(condition) flagging_rules_page.select_flag(context.flags[type]["name"]) Shared(driver).click_submit()
def audit_trail_updated(driver, context, internal_info, internal_url): # noqa ApplicationPage(driver).go_to_cases_activity_tab_for_clc( internal_url, context) assert (context.status.lower() in Shared(driver).get_audit_trail_text().lower() ), "status has not been shown as approved in audit trail"
def enter_response(driver, prefix, grading, suffix, comment): # noqa clc_query_page = GoodsQueriesPages(driver) clc_query_page.enter_a_prefix(prefix) clc_query_page.select_a_grading(grading) clc_query_page.enter_a_suffix(suffix) clc_query_page.enter_a_comment(comment) Shared(driver).click_submit()
def deactivate_first_active_flag(driver, context, internal_url): for level in context.flags: row = driver.find_element_by_id(context.flags[level]["id"]) FlaggingRulePages(driver).click_on_deactivate_flag(row) FlaggingRulePages(driver).click_confirm_deactivate_activate() Shared(driver).click_submit() driver.get(internal_url.rstrip("/") + "/flags/rules/")
def edit_template_paragraphs(driver, context, api_test_client): letter_template = LetterTemplates(driver) letter_template.click_edit_paragraphs_button() letter_template.click_add_paragraph_link() paragraph_id = letter_template.get_add_paragraph_button() context.document_template_paragraph_text.append( get_paragraph_text(api_test_client, paragraph_id)) Shared(driver).click_submit()
def edit_template_name_and_layout(driver, context): context.document_template_name = str(uuid.uuid4())[:35] letter_template = LetterTemplates(driver) letter_template.click_edit_template_button() letter_template.enter_template_name(context.document_template_name) letter_template.select_which_type_of_cases_template_can_apply_to( ["MOD-F680-Clearance"]) Shared(driver).click_submit()
def verify_registered_individual_organisation(driver, context): wait_until_page_is_loaded(driver) # Assert that the success info bar is visible assert functions.element_with_css_selector_exists( driver, Shared(driver).SNACKBAR_SELECTOR) OrganisationsPage(driver).search_for_org_in_filter( context.organisation_name) row = OrganisationPage(driver).get_organisation_row() assert context.organisation_name in row["name"]
def click_continue(driver, controlled, control_list_entry, report, comment, context): # noqa query_page = GoodsQueriesPages(driver) query_page.click_is_good_controlled(controlled) query_page.type_in_to_control_list_entry(control_list_entry) context.goods_control_list_entry = control_list_entry query_page.choose_report_summary() context.report = report query_page.enter_a_comment(comment) context.comment = comment Shared(driver).click_submit()
def edit_existing_flag(driver, context): flags_list_page = FlagsListPage(driver) add_edit_flag_page = AddEditFlagPage(driver) flags_list_page.click_edit_link() context.flag_name = "Edited flag" + utils.get_formatted_date_time_d_h_m_s() add_edit_flag_page.enter_name(context.flag_name) add_edit_flag_page.select_colour("red") add_edit_flag_page.enter_label("Hard to Find") add_edit_flag_page.enter_priority(1) Shared(driver).click_submit()
def add_flag(driver, context, blocks_approval): add_edit_flag_page = AddEditFlagPage(driver) context.flag_name = "UAE" + utils.get_formatted_date_time_d_h_m_s() FlagsListPage(driver).click_add_a_flag_button() add_edit_flag_page.enter_name(context.flag_name) add_edit_flag_page.select_level("Case") add_edit_flag_page.select_colour("orange") add_edit_flag_page.enter_label("Easy to Find") add_edit_flag_page.enter_priority(0) add_edit_flag_page.enter_blocking_approval(blocks_approval) Shared(driver).click_submit()
def add_a_role(driver, role_name, permissions, status, context): roles_page = RolesPages(driver) roles_page.click_add_a_role_button() if role_name == " ": context.role_name = role_name else: extra_string = str(utils.get_unformatted_date_time()) extra_string = extra_string[(len(extra_string)) - 14:] context.role_name = role_name + extra_string roles_page.enter_role_name(context.role_name) roles_page.select_permissions(permissions) roles_page.select_statuses(status) Shared(driver).click_submit()
def edit_flagging_rule(driver, context, condition): flagging_rules_page = FlaggingRulePages(driver) row = driver.find_element_by_id(context.flag_id) # select edit for my flagging rule flagging_rules_page.click_on_edit_for_element(row) if type == "Case": flagging_rules_page.select_case_type(condition) elif type == "Destination": flagging_rules_page.enter_country(condition) elif type == "Good": flagging_rules_page.enter_control_list(condition) Shared(driver).click_submit()
def queue_change_in_audit(driver, context, internal_url): ApplicationPage(driver).go_to_cases_activity_tab(internal_url, context) assert "moved the case to " + context.queue_name in Shared( driver).get_audit_trail_text()
def see_queue_in_queue_list(driver, context): Shared(driver).filter_by_name(context.queue_name) assert context.queue_name in QueuesPages(driver).get_row_text( context.queue_name)
def click_letter_template(self, document_template_name): Shared(self.driver).go_to_last_page() self.driver.find_element_by_id(document_template_name).click()
def my_case_not_in_queue(driver, context): # noqa assert context.case_id not in Shared(driver).get_text_of_cases_form()
def see_queue_in_queue_list_with_countersigning_queue(driver, context): Shared(driver).filter_by_name(context.queue_name) row = QueuesPages(driver).get_row_text(context.queue_name) assert context.countersigning_queue_name in row assert context.countersigning_queue_name in row
def selected_created_template(driver, context): # noqa GeneratedDocument(driver).click_letter_template( context.document_template_id) Shared(driver).click_submit()
def i_show_filters(driver): # noqa Shared(driver).try_open_filters()
def move_case_to_new_queue(driver, context): # noqa ApplicationPage(driver).click_move_case_button() if not driver.find_element_by_id(context.queue_name.replace( " ", "-")).is_selected(): driver.find_element_by_id(context.queue_name.replace(" ", "-")).click() Shared(driver).click_submit()
def select_status_save(driver, status, context): # noqa application_page = ApplicationPage(driver) application_page.select_status(status) context.status = status context.date_time_of_update = utils.get_formatted_date_time_h_m_pm_d_m_y() Shared(driver).click_submit()
def i_click_continue(driver): # noqa Shared(driver).click_submit()