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 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 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 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 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=True) 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 application_is_submitted(driver, context): # noqa elements = driver.find_elements_by_css_selector("tr") element_number = utils.get_element_index_by_text(elements, context.app_name, complete_match=False) element_row = elements[element_number].text assert utils.search_for_correct_date_regex_in_element(element_row) assert "0 Goods" or "1 Good" or "2 Goods" in element_row assert driver.find_element_by_xpath( "// th[text()[contains(., 'Status')]]").is_displayed() assert driver.find_element_by_xpath( "// th[text()[contains(., 'Last updated')]]").is_displayed()
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 assert_case_is_present(self, case_id): elements = self.driver.find_elements_by_css_selector( self.CASES_TABLE_ROW) no = get_element_index_by_text(elements, case_id, complete_match=False) return elements[no].is_displayed()
def get_text_of_assignees(self, driver, case_id): elements = Shared(driver).get_rows_in_lite_table() no = get_element_index_by_text(elements, case_id) return elements[no].find_element_by_css_selector( ".app-assignments__container").text
def click_on_picklist_item(driver, context): elements = PicklistPages(driver).get_elements_of_picklist_names_in_list() no = utils.get_element_index_by_text(elements, context.picklist_name) elements[no].click()
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 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()