def __init__(self, driver, index, version): self.driver = driver self.applicant_grid = EventApplicant(self.driver) self.getby = CandidateDetailsPage(self.driver) self.applicant_action = EventApplicantActions(self.driver) self.quick_schedule = QuickIntSchedulePage(self.driver) self.multi_select = MultiSelectValues(self.driver) self.switch_window = SwitchWindowClose(self.driver) """ ----------------- EXCEL READ AND TO ASSIGN VALUES TO RESPECTIVE INIT VARIABLES ------>>>> """ int_excel = excelRead.ExcelRead() int_excel.read(inputFile.INPUT_PATH['interview_lobby'], index=index) xl = int_excel.excel_dict self.xl_int1_name = xl['int1_name'][0] self.xl_int2_name = xl['int2_name'][0] status_excel = excelRead.ExcelRead() status_excel.read(inputFile.INPUT_PATH['event_status_change'], index=index) xl = status_excel.excel_dict self.xl_quick_stage = xl['live_stage'][0] self.xl_quick_comment = xl['quick_comment'][0] self.xl_quick_message = xl['live_message'][0] self.xl_app_name = xl['event_name'][0].format(version) self.xl_schedule_status = xl['schedule'][0] self.quick_config_collection = [] self.quick_schedule_collection = []
class CandidateDetailsPage: __e_title_xpath = Locators.TITLE['title'] __e_id_xpath = Locators.CANDIDATE['id'] __e_candidate_float_action_class = Locators.ACTIONS['float_click_class'] __e_manage_task_xpath = Locators.TITLE['title'].format('Manage Task') def __init__(self, driver): self.driver = driver self.wait = WebElementWait(self.driver) self.window = SwitchWindowClose(self.driver) self.candidate_id = '' def candidate_float_actions(self): try: self.wait.web_element_wait_click( By.CLASS_NAME, self.__e_candidate_float_action_class, 'candidate_float_actions') print('Candidate details screen - floating action clicked') return True except Exception as error: ui_logger.error(error) def candidate_manage_task_action(self, window_index): try: time.sleep(1) self.wait.web_element_wait_click(By.XPATH, self.__e_manage_task_xpath, 'candidate_manage_task_action') print('Candidate details screen - floating action - Manage Task') time.sleep(1) self.window.switch_to_window(window_index) self.wait.loading() return True except Exception as error: ui_logger.error(error) def candidate_status(self, changed_status): try: time.sleep(2) self.wait.loading() self.wait.web_element_wait_text( By.XPATH, self.__e_title_xpath.format(changed_status), f'Candidate_status_{changed_status}') if self.wait.text_value == changed_status: print(f'Candidate status changed - {self.wait.text_value}') return True except Exception as error: ui_logger.error(error) def candidate_id_copy(self): try: self.wait.web_element_wait_text(By.XPATH, self.__e_id_xpath, 'candidate_id') self.candidate_id = self.wait.text_value print(f'candidate id - {self.candidate_id}') return True except Exception as error: ui_logger.error(error)
class CandidateLobbyLogin: def __init__(self, driver, index, version): self.driver = driver self.event_sub_tab = EventSubTabs(self.driver) self.candidate_login = LoginPage(self.driver) self.new_tab = SwitchWindowClose(self.driver) self.lobby = LobbyPage(self.driver) """ ----------------- EXCEL READ AND TO ASSIGN VALUES TO RESPECTIVE INIT VARIABLES ------>>>> """ status_excel = excelRead.ExcelRead() status_excel.read(inputFile.INPUT_PATH['candidate_lobby'], index=index) xl = status_excel.excel_dict self.xl_candidate_name = xl['name'][0].format(version) self.xl_almost_message = xl['almost_message'][0] self.xl_queued_message = xl['queued_message'][0] self.candidate_lobby_collection = [] def candidate_lobby_login(self, candidate_id, candidate_login_link): self.candidate_lobby_collection = [] __list = [ self.candidate_login.open_link(candidate_login_link), self.candidate_login.login_screen(candidate_id), self.candidate_login.enter_to_room(), self.candidate_login.candidate_name_validate( self.xl_candidate_name), self.candidate_login.almost_message(self.xl_almost_message), self.new_tab.window_close(), self.new_tab.switch_to_window(0), self.event_sub_tab.manage_candidates(), self.lobby.un_assign_room(), self.lobby.ok_buttons(), self.lobby.ok_buttons(), self.candidate_login.open_link(candidate_login_link), self.candidate_login.login_screen(candidate_id), self.candidate_login.enter_to_room(), self.candidate_login.candidate_name_validate( self.xl_candidate_name), self.candidate_login.queued_message(self.xl_queued_message), self.new_tab.window_close(), self.new_tab.switch_to_window(0), ] for func in __list: if func: self.candidate_lobby_collection.append(func) else: self.candidate_lobby_collection.append(func)
def __init__(self, driver, index, version): self.driver = driver self.event_sub_tab = EventSubTabs(self.driver) self.candidate_login = LoginPage(self.driver) self.new_tab = SwitchWindowClose(self.driver) self.lobby = LobbyPage(self.driver) """ ----------------- EXCEL READ AND TO ASSIGN VALUES TO RESPECTIVE INIT VARIABLES ------>>>> """ status_excel = excelRead.ExcelRead() status_excel.read(inputFile.INPUT_PATH['candidate_lobby'], index=index) xl = status_excel.excel_dict self.xl_candidate_name = xl['name'][0].format(version) self.xl_almost_message = xl['almost_message'][0] self.xl_queued_message = xl['queued_message'][0] self.candidate_lobby_collection = []
class EventApplicant: __e_applicant_check_name = Locators.CHECKBOX['check'] __e_status_change_id = Locators.ACTIONS['status_change'] __e_applicant_name_xpath = Locators.TITLE['title'] def __init__(self, driver): self.driver = driver self.wait = WebElementWait(self.driver) self.message = Notifier(self.driver) self.switch_window = SwitchWindowClose(self.driver) def select_applicant(self): try: self.wait.web_element_wait_click(By.NAME, self.__e_applicant_check_name, 'Applicant_check_box') return True except Exception as error: ui_logger.error(error) def change_status_action(self): try: self.wait.web_element_wait_click(By.ID, self.__e_status_change_id, 'Applicant_status_change') self.wait.loading() return True except Exception as error: ui_logger.error(error) def applicant_get_name(self, applicant_name, index_window): try: time.sleep(1) self.wait.web_element_wait_click( By.XPATH, self.__e_applicant_name_xpath.format(applicant_name), 'Applicant_Get_By_Name') print('Clicked on applicant name') self.switch_window.switch_to_window(index_window) return True except Exception as error: ui_logger.error(error)
class ManageTaskScreen: __e_common_css = Locators.MANAGE_TASK['common_label'] __e_candidate_status_xpath = Locators.MANAGE_TASK['candidate_status'] __e_submit_xpath = Locators.TITLE['tooltip'].format("'", 'Candidate has submitted but not approved.', "'") __e_pending_xpath = Locators.TITLE['tooltip'].format("'", 'Candidate has not submitted.', "'") __e_reject_xpath = Locators.TITLE['tooltip'].format("'", 'Candidate has not corrected the details after the ' 'task(s) got rejected.', "'") __e_approved_xpath = Locators.TITLE['tooltip'].format("'", 'Task(s) are approved.', "'") __e_total_xpath = Locators.MANAGE_TASK['total'] def __init__(self, driver): self.driver = driver self.wait = WebElementWait(self.driver) self.window = SwitchWindowClose(self.driver) def candidate_name_validate(self, candidate_name): try: value = self.wait.web_elements_wait_text(By.CSS_SELECTOR, self.__e_common_css, candidate_name) if candidate_name in value: print(f'Candidate Name is - {value}') return True except Exception as error: ui_logger.error(error) def candidate_stage_status_validate(self, stage_status): try: self.wait.web_element_wait_text(By.XPATH, self.__e_candidate_status_xpath, stage_status) if self.wait.text_value.strip() == stage_status: print(f'Manage candidate screen verified - {self.wait.text_value.strip()}') return True except Exception as error: ui_logger.error(error) def submitted_task_validate(self, submit_task): try: self.wait.web_element_wait_text(By.XPATH, self.__e_submit_xpath, 'submitted_task_validate') if self.wait.text_value == submit_task: print(f'Submitted tasks are - {self.wait.text_value}') return True except Exception as error: ui_logger.error(error) def pending_task_validate(self, pending_task): try: self.wait.web_element_wait_text(By.XPATH, self.__e_pending_xpath, 'pending_task_validate') if self.wait.text_value == pending_task: print(f'Pending tasks are - {self.wait.text_value}') return True except Exception as error: ui_logger.error(error) def rejected_task_validate(self, rejected_task): try: self.wait.web_element_wait_text(By.XPATH, self.__e_reject_xpath, 'rejected_task_validate') if self.wait.text_value == rejected_task: print(f'Rejected tasks are - {self.wait.text_value}') return True except Exception as error: ui_logger.error(error) def approved_task_validate(self, approved_task): try: self.wait.web_element_wait_text(By.XPATH, self.__e_approved_xpath, 'approved_task_validate') if self.wait.text_value == approved_task: print(f'Approved tasks are - {self.wait.text_value}') return True except Exception as error: ui_logger.error(error) def total_task_validate(self, total_task): try: self.wait.web_element_wait_text(By.XPATH, self.__e_total_xpath, 'total_task_validate') if self.wait.text_value == total_task: print(f'Total tasks are - {self.wait.text_value}') return True except Exception as error: ui_logger.error(error) def switch_back_to_old_window(self): try: self.window.window_close() time.sleep(0.5) self.window.switch_to_window(1) time.sleep(0.5) self.window.window_close() time.sleep(0.5) self.window.switch_to_window(0) return True except Exception as error: ui_logger.error(error)
def __init__(self, driver): self.driver = driver self.wait = WebElementWait(self.driver) self.window = SwitchWindowClose(self.driver)
class CRPOQuickInterviewSchedule: def __init__(self, driver, index, version): self.driver = driver self.applicant_grid = EventApplicant(self.driver) self.getby = CandidateDetailsPage(self.driver) self.applicant_action = EventApplicantActions(self.driver) self.quick_schedule = QuickIntSchedulePage(self.driver) self.multi_select = MultiSelectValues(self.driver) self.switch_window = SwitchWindowClose(self.driver) """ ----------------- EXCEL READ AND TO ASSIGN VALUES TO RESPECTIVE INIT VARIABLES ------>>>> """ int_excel = excelRead.ExcelRead() int_excel.read(inputFile.INPUT_PATH['interview_lobby'], index=index) xl = int_excel.excel_dict self.xl_int1_name = xl['int1_name'][0] self.xl_int2_name = xl['int2_name'][0] status_excel = excelRead.ExcelRead() status_excel.read(inputFile.INPUT_PATH['event_status_change'], index=index) xl = status_excel.excel_dict self.xl_quick_stage = xl['live_stage'][0] self.xl_quick_comment = xl['quick_comment'][0] self.xl_quick_message = xl['live_message'][0] self.xl_app_name = xl['event_name'][0].format(version) self.xl_schedule_status = xl['schedule'][0] self.quick_config_collection = [] self.quick_schedule_collection = [] def quick_interview_config(self): self.quick_config_collection = [] __list = [ self.applicant_grid.select_applicant(), self.applicant_action.more_action(), self.applicant_action.quick_interview_action(), self.quick_schedule.select_interviewers_field(), self.multi_select.search(self.xl_int1_name), self.multi_select.move_all_items(), self.multi_select.search_clear(), self.multi_select.search(self.xl_int2_name), self.multi_select.move_all_items(), self.multi_select.done() ] for func in __list: if func: self.quick_config_collection.append(func) else: self.quick_config_collection.append(func) def quick_interview_schedule(self): self.quick_schedule_collection = [] __list = [ self.quick_schedule.select_interviewer_round(self.xl_quick_stage), self.quick_schedule.quick_comment(self.xl_quick_comment), self.quick_schedule.schedule_quick_interview(), self.quick_schedule.quick_schedule_notifier(self.xl_quick_message), self.quick_schedule.quick_schedule_notifier_dismiss(), self.applicant_grid.applicant_get_name(self.xl_app_name, 1), self.getby.candidate_status(self.xl_schedule_status), self.switch_window.window_close(), self.switch_window.switch_to_window(0) ] for func in __list: if func: self.quick_schedule_collection.append(func) else: self.quick_schedule_collection.append(func)
def __init__(self, driver): self.driver = driver self.wait = WebElementWait(self.driver) self.message = Notifier(self.driver) self.switch_window = SwitchWindowClose(self.driver)