def approve_inside_by_role(driver, loanno, screenshot_path, casename): u"""审批内部审批流程""" expect_result = "结束" process_type = "内部审批" view = "OK" print("开始审批内审流程") print("使用的贷款单号是:" + loanno) from com.ea.pages.todo_page import TodoPage, ApproveInsidePage # 进入待办查询页面 try: todopage = TodoPage(driver) approveinsidepage = ApproveInsidePage(driver) while tools.get_approver_acount_by_yewuno(loanno, process_type): approver_account = tools.get_approver_acount_by_yewuno(loanno, process_type) login.login(driver, username=approver_account) menu.go_to_wait_todo_query(driver) todopage.input_yewuno(loanno) # todopage.click_query_all() todopage.click_search_button() todopage.click_first_row(process_type) approveinsidepage.scroll_to_approve_view() approveinsidepage.input_approve_view(view) approveinsidepage.click_tongguo_button() approveinsidepage.click_confirm_button() driver.delete_all_cookies() # 切换到内部审批页面 login.login(driver) menu.go_to_inside_approve(driver) # time.sleep(5) actual_result = approveinsidepage.get_result(loanno) assert actual_result == expect_result print("审批内审流程结束") except Exception as e: tools.get_screenshot(driver, screenshot_path, casename) raise e
def test_e_caiwu_approve(self): u"""财务审批""" casename = sys._getframe().f_code.co_name view = "OK" except_result = "流程结束" process_type = "平台财务" # self.loanno = "SK0027-BK-1712-00009" print("财务审批开始") print("使用的贷款单号是:" + self.loanno) from com.ea.pages.todo_page import TodoPage, ApproveCaiwuPage try: todopage = TodoPage(self.driver) approvecaiwupage = ApproveCaiwuPage(self.driver) # 进入待办查询页面 menu.go_to_wait_todo_query(self.driver) todopage.input_yewuno(self.loanno) todopage.click_query_all() todopage.click_search_button() todopage.click_first_row(process_type) # 拖动页面到最下面 approvecaiwupage.scroll_to_special_condition() approvecaiwupage.input_special_condition(view) approvecaiwupage.click_save_button() approvecaiwupage.click_confirm_button() approvecaiwupage.input_approve_view(view) approvecaiwupage.click_tongguo_button() approvecaiwupage.click_confirm_button() time.sleep(3) menu.go_to_platform_caiwu_approve(self.driver) actual_result = approvecaiwupage.get_result(self.loanno) self.assertEqual(actual_result, except_result) print("财务审批结束") except Exception as e: tools.get_screenshot(self.driver, self.screenshot_path, casename) raise e
def loan_clear_approve(driver, loanno, screenshot_path, casename): u"""审批贷款结清流程""" types = "提前还款" clear_date = "2017-10-10" approve_view = "OK" expect_result = "还款完成" # self.loanno = "SK0027-BP-1801-00002" from com.ea.pages.todo_page import TodoPage, LoanClearApprove try: print("审批贷款结清开始") print("使用的贷款单号是:" + loanno) todopage = TodoPage(driver) loanclearapprovepage = LoanClearApprove(driver) menu.go_to_wait_todo_query(driver) todopage.input_yewuno(loanno) todopage.click_query_all() todopage.click_search_button() todopage.click_first_row(types) loanclearapprovepage.scroll_to_clear_date() loanclearapprovepage.input_clear_date(clear_date) loanclearapprovepage.click_save_button() loanclearapprovepage.click_confirm_button() loanclearapprovepage.input_approve_view(approve_view) loanclearapprovepage.click_tongguo_button() loanclearapprovepage.click_confirm_button() time.sleep(5) menu.go_to_loan_query(driver) actual_result = loanclearapprovepage.get_result(loanno) assert actual_result == expect_result print("审批贷款结清结束") except Exception as e: tools.get_screenshot(driver, screenshot_path, casename) raise e
def zhengxin_approve_by_role(self, zhengxindanhao, process_type): approveview = "OK" # process_type = "新征信查询" card_date = "2028-11-11" expect_result = "流程结束" print("审批征信开始") print("审批时的征信账号是:" + zhengxindanhao) from com.ea.pages.todo_page import TodoPage, ApproveZhengxinPage todopage = TodoPage(self.driver) approvepage = ApproveZhengxinPage(self.driver) menu.go_to_wait_todo_query(self.driver) todopage.input_yewuno(zhengxindanhao) # todopage.click_query_all() todopage.click_search_button() todopage.click_first_row(process_type) approvepage.page_down() approvepage.input_approve_view(approveview) approvepage.click_approve_button() approvepage.click_confirm_button() time.sleep(3) todopage.click_first_row(process_type) approvepage.page_down() approvepage.upload_file(self.pic_path) approvepage.input_cardno_date(card_date) approvepage.click_save_button() approvepage.click_confirm_button() approvepage.input_approve_view(approveview) approvepage.click_approve_button() approvepage.click_confirm_button() time.sleep(3) menu.go_to_personnel_zhengxin_query(self.driver) actual_result = approvepage.get_result(zhengxindanhao) assert actual_result == expect_result print("审批征信结束")
def charge_approve(driver, loanno, fullname, pic_path, screenshot_path, casename): u"""审批收费流程""" expect_result = "流程结束" process_type = "保证金管理费" pay_time = "2017-10-10" approve_view = "OK" daokuan_total = "50000" pay_date = "2017-10-10" # self.loanno = "SK0027-BK-1712-00012" print("审批收费流程开始") print("使用的贷款单号是:" + loanno) try: from com.ea.pages.todo_page import TodoPage, ApproveCharge todopage = TodoPage(driver) approvechaegepage = ApproveCharge(driver) # 进入待办查询页面 menu.go_to_wait_todo_query(driver) todopage.input_yewuno(loanno) todopage.click_query_all() todopage.click_search_button() todopage.click_first_row(process_type) approvechaegepage.scroll_to_payer() approvechaegepage.input_payer(fullname) approvechaegepage.input_pay_time(pay_time) approvechaegepage.click_save_button() time.sleep(1) approvechaegepage.scroll_to_approve_view() time.sleep(3) approvechaegepage.input_print_voucher(pic_path) time.sleep(1) approvechaegepage.input_approve_view(approve_view) approvechaegepage.click_tongguo_button() approvechaegepage.click_confirm_button() time.sleep(5) todopage.click_first_row(process_type) approvechaegepage.scroll_to_daokuan_total() time.sleep(1) approvechaegepage.input_daokuan_total(daokuan_total) approvechaegepage.input_pay_date(pay_date) approvechaegepage.select_collect_acount(1) approvechaegepage.click_save_button() approvechaegepage.scroll_to_approve_view() approvechaegepage.input_approve_view(approve_view) approvechaegepage.click_tongguo_button() approvechaegepage.click_confirm_button() time.sleep(5) menu.go_to_charge_query(driver) actual_result = approvechaegepage.get_result(loanno) assert actual_result == expect_result print("审批收费流程结束") except Exception as e: tools.get_screenshot(driver, screenshot_path, casename) raise e
def loan_by_role_approve(driver,loanno, screenshot_path, casename): u"""贷款审批""" number = "0" view = "OK" process_type = "征信准入" except_result = "征信准入完成" # self.loanno = "SK0027-BK-1712-00006" print("审批贷款开始") print("使用的贷款单号是:" + loanno) from com.ea.pages.todo_page import TodoPage, ApproveLoanPage try: approver_account = tools.get_approver_acount_by_yewuno(loanno, process_type) login.login(driver, username=approver_account) todopage = TodoPage(driver) approvepage = ApproveLoanPage(driver) # 进入待办查询页面 menu.go_to_wait_todo_query(driver) todopage.input_yewuno(loanno) # todopage.click_query_all() todopage.click_search_button() todopage.click_first_row(process_type) approvepage.scrollto_edit() approvepage.click_edit() approvepage.input_bank_overdue(number) approvepage.input_credit_overdue(number) approvepage.input_nobank_overdue(number) approvepage.scrollto_save_button() approvepage.click_save_button() time.sleep(2) approvepage.scrollto_approve_view() approvepage.input_approve_view(view) approvepage.click_tongguo() approvepage.click_confirm() time.sleep(3) menu.go_to_loan_query(driver) time.sleep(1) actual_result = approvepage.get_result(loanno) assert actual_result == except_result print("审批贷款结束") except Exception as e: tools.get_screenshot(driver, screenshot_path, casename) raise e
def approve_inside(driver, loanno, screenshot_path, casename, loan_mode): u"""审批内部审批流程""" global y expect_result = "结束" process_type = "内部审批" view = "OK" print("开始审批内审流程") print("使用的贷款单号是:" + loanno) from com.ea.pages.todo_page import TodoPage, ApproveInsidePage todopage = TodoPage(driver) approveinsidepage = ApproveInsidePage(driver) # 进入待办查询页面 try: menu.go_to_wait_todo_query(driver) todopage.input_yewuno(loanno) todopage.click_query_all() todopage.click_search_button() if loan_mode == "共享模式": y = 7 elif loan_mode == "自营模式": y = 6 else: print("输入的模式有误,请确认!!") for i in range(y): todopage.click_first_row(process_type) approveinsidepage.scroll_to_approve_view() approveinsidepage.input_approve_view(view) approveinsidepage.click_tongguo_button() approveinsidepage.click_confirm_button() time.sleep(5) # 切换到内部审批页面 menu.go_to_inside_approve(driver) actual_result = approveinsidepage.get_result(loanno) assert actual_result == expect_result print("审批内审流程结束") except Exception as e: tools.get_screenshot(driver, screenshot_path, casename) raise e
def zhengxin_approve(self, driver, wait, zhengxingdanhao, screenshot_path, pic_name, casename): u'''审批征信''' # casename = sys._getframe().f_code.co_name # zhengxingdanhao = "O2OZX-1711-00031" print("审批征信开始") print("审批时的征信账号是:" + zhengxingdanhao) try: # 进入待办查询页面 menu.go_to_wait_todo_query(driver) # tools.get_screenshot(driver, screenshot_path) # 输入征信单号查询 driver.find_element_by_css_selector( "input[name='referCode']").send_keys(zhengxingdanhao) driver.find_element_by_css_selector("input[name='queryAll']").click() self.assertTrue( driver.find_element_by_css_selector( "input[name='queryAll']").is_selected()) driver.find_element_by_css_selector("input[value='搜索']").click() wait.until( EC.visibility_of_all_elements_located( (By.XPATH, "//td[text()='" + zhengxingdanhao + "']/preceding-sibling::td[1]"))) # 点击审批流程中第一条记录 driver.find_element_by_xpath("//td[text()='" + zhengxingdanhao + "']/preceding-sibling::td[1]").click() time.sleep(1) # tools.get_screenshot(driver, screenshot_path) # 拖动页面到最下面 target = driver.find_element_by_xpath("//th[text()='开始时间']") driver.execute_script("arguments[0].scrollIntoView();", target) # 输入审批意见 wait.until( EC.presence_of_element_located( (By.XPATH, "//td[text()='审核意见:']/following-sibling::td[1]/textarea"))) driver.find_element_by_xpath( "//td[text()='审核意见:']/following-sibling::td[1]/textarea" ).send_keys("OK") # tools.get_screenshot(driver, screenshot_path) # 点击通过按钮并确认 driver.find_element_by_css_selector("input[value='通 过']").click() # tools.get_screenshot(driver, screenshot_path) driver.find_element_by_xpath("//button[text()='确认']").click() # 第二次审批 time.sleep(3) wait.until( EC.element_to_be_clickable( (By.XPATH, "//td[text()='" + zhengxingdanhao + "']/preceding-sibling::td[1]"))) # 点击审批流程中第一条记录 # tools.get_screenshot(driver, screenshot_path) driver.find_element_by_xpath("//td[text()='" + zhengxingdanhao + "']/preceding-sibling::td[1]").click() time.sleep(1) # tools.get_screenshot(driver, screenshot_path) # 拖动页面到最下面 target = driver.find_element_by_xpath("//th[text()='开始时间']") driver.execute_script("arguments[0].scrollIntoView();", target) # tools.get_screenshot(driver, screenshot_path) # 上传附件 els = driver.find_elements_by_css_selector("input[name='file']") els[0].send_keys(pic_name) # 选择证件到期日 driver.find_element_by_name("zxDate").click() driver.switch_to.frame(driver.find_element_by_tag_name("iframe")) driver.find_element_by_xpath("//td[text()='15']").click() driver.switch_to.default_content() # 点击保存按钮 driver.find_element_by_css_selector("input[value='保存']").click() driver.find_element_by_xpath("//button[text()='确认']").click() # 输入审批意见 driver.find_element_by_xpath( "//td[text()='审核意见:']/following-sibling::td[1]/textarea" ).send_keys("OK") # 点击通过按钮并确认 # tools.get_screenshot(driver, screenshot_path) driver.find_element_by_css_selector("input[value='通 过']").click() # tools.get_screenshot(driver, screenshot_path) driver.find_element_by_xpath("//button[text()='确认']").click() time.sleep(3) # 切换到个人征信查询页面 menu.go_to_personnel_zhengxin_query(driver) time.sleep(1) # tools.get_screenshot(driver, screenshot_path) result = driver.find_element_by_xpath( "//a[text()='" + zhengxingdanhao + "']/../following-sibling::td[7]").text self.assertEqual(result, "流程结束") print("审批征信结束") except Exception as e: shottime = tools.get_current_time() picname = screenshot_path + "\\" + shottime + casename + ".png" driver.get_screenshot_as_file(picname) print("运行失败,请查看图片:" + picname) raise e
def interview_approve(driver, loanno, fullname, screenshot_path, casename): u"""面签审批""" expect_result = "已放款" types = "面签提报" card_daoqi_date = "2017-10-10" approve_view = "OK" isphonecheck = "是" phonecheckmessage = "OK" isfujianover = "是" file_path = gl.file_path # self.loanno = "SK0027-BP-1801-00002" # self.fullname = "何器" print("面签审批开始") print("使用的贷款单号是:" + loanno) try: from com.ea.pages.todo_page import TodoPage, ApproveInterview todopage = TodoPage(driver) approveinterviepage = ApproveInterview(driver) menu.go_to_wait_todo_query(driver) todopage.input_yewuno(loanno) todopage.click_query_all() todopage.click_search_button() todopage.click_first_row(types) approveinterviepage.scroll_to_approve_view() approveinterviepage.input_approve_view(approve_view) approveinterviepage.click_tongguo() approveinterviepage.click_confirm() time.sleep(5) todopage.click_first_row(types) approveinterviepage.scroll_to_is_phone_check() approveinterviepage.select_is_phone_check(isphonecheck) approveinterviepage.input_phone_check_message(phonecheckmessage) approveinterviepage.click_phone_save_button() time.sleep(1) approveinterviepage.select_is_fujian_over(isfujianover) approveinterviepage.click_fujian_save_button() time.sleep(1) approveinterviepage.scroll_to_approve_view() approveinterviepage.input_approve_view(approve_view) approveinterviepage.click_tongguo() approveinterviepage.click_confirm() time.sleep(5) todopage.click_first_row(types) approveinterviepage.scroll_to_card_date() approveinterviepage.input_card_daoqi_date(card_daoqi_date) approveinterviepage.click_save_bank_loan_data() time.sleep(1) tools.create_huankuanjihua(fullname) approveinterviepage.input_file(file_path) time.sleep(3) approveinterviepage.input_approve_view(approve_view) approveinterviepage.click_tongguo() approveinterviepage.click_confirm() time.sleep(5) menu.go_to_loan_query(driver) actual_result = approveinterviepage.get_result(loanno) assert actual_result == expect_result print("审批面签提报结束") except Exception as e: tools.get_screenshot(driver, screenshot_path, casename) raise e