def Application_Guide(driver): try: time.sleep(5) with allure.step('点击合格投资者认证申请须知'): Page.wait_elem(driver, "com.chtwm.mall:id/tv_tip", 27, 3).click() time.sleep(5) with allure.step('下滑查看合格投资者须知内容'): huadong.shanghua(driver, 1000) time.sleep(3) with allure.step("合格投资者认证须知页面截图"): allure.attach(driver.get_screenshot_as_png(), "合格投资者认证须知截图", attachment_type=allure.attachment_type.PNG) time.sleep(3) with allure.step("返回合格投资者认证页面"): Page.wait_elem(driver, "com.chtwm.mall:id/iv_back", 18, 3).click() pytest_TestResult = True except Exception as e: print("合格投资者认证申请须知页面报错:", e) pytest_TestResult = False finally: return pytest_TestResult
def FengCeShuoMing_PageBack(driver): try: with allure.step('点击确认(明白了)'): Page.wait_elem(driver, "com.chtwm.mall:id/tv_confirm", 10).click() except: driver.back()
def Autonym_CheckPoint(driver): try: with allure.step('检查标题'): check = Page.wait_elem(driver, "com.chtwm.mall:id/tv_title", 10) print("输出标题内容为..................", check.text) if check.text == title: pytest_TestResult = True else: pytest_TestResult = False with allure.step('输出客户姓名'): tv_name = Page.wait_elem(driver, "com.chtwm.mall:id/tv_name", 10) print("客户姓名:", tv_name.text) with allure.step('输出证件类型'): tv_type = Page.wait_elem(driver, "com.chtwm.mall:id/tv_type", 10) print("证件类型:", tv_type.text) with allure.step('输出证件号码'): tv_birthdate = Page.wait_elem( driver, "com.chtwm.mall:id/tv_birthdate", 10) print("证件号码:", tv_birthdate.text) except Exception as e: print("检查点%s报错:" % title, e) pytest_TestResult = False finally: return pytest_TestResult
def IntoFengCe(driver): try: with allure.step('点击基金风险评测'): Page.wait_elem(driver,"com.chtwm.mall:id/user_info_found_ll", 18,3).click() except Exception as e: print("进入基金风险评测报错:", e)
def StaffName(driver, Staffname): try: with allure.step('输入员工信息,验证'): time.sleep(3) Page.find_elem_id( driver, "com.chtwm.mall:id/search_edit").send_keys(Staffname) time.sleep(2) Page.find_elem_id(driver, "com.chtwm.mall:id/search_tv").click() time.sleep(3) name = Page.wait_elem( driver, "com.chtwm.mall:id/item_staff_query_name_tv", 8) if name.text == Staffname: pytest_TestResult = True else: pytest_TestResult = False driver.back() except Exception as e: print("查看%s报错:" % title, e) pytest_TestResult = False finally: return pytest_TestResult
def ZQCategory(driver, Category): try: with allure.step('点击分类列表'): time.sleep(2) Page.find_elem_id(driver, "com.chtwm.mall:id/right_images").click() with allure.step("%s" % Category): time.sleep(3) names = driver.find_elements_by_id("com.chtwm.mall:id/text_aa") for i in names: if i.text == "%s" % Category: i.click() Page.wait_elem(driver, "com.chtwm.mall:id/filter_true", 10).click() #点击确定 with allure.step("滑动查看详情"): time.sleep(3) huadong.shanghua(driver, 1000) time.sleep(8) huadong.shanghua(driver, 1000) time.sleep(8) except Exception as e: print("债权条件筛选报错:", e) #pytest_TestResult = False #driver.back() finally: pass
def ProInvestors_CheckPoint(driver): try: with allure.step('检查标题'): time.sleep(5) check = Page.wait_elem(driver, "com.chtwm.mall:id/tv_title2", 10) if check.text == title: pytest_TestResult = True else: pytest_TestResult = False with allure.step('输出客户姓名'): tv_name = Page.wait_elem(driver, "com.chtwm.mall:id/tv_name", 10) print("客户姓名print:", tv_name.text) allure.attach("客户姓名:", tv_name.text) with allure.step('输出投资者类型'): tv_type = Page.wait_elem(driver, "com.chtwm.mall:id/tv_invest_type", 10) print("投资者类型print:", tv_type.text) allure.attach("投资者类型:", tv_type.text) except Exception as e: print("检查点%s报错:" % title, e) allure.attach("检查点%s报错:" % title, str(e), str(type(e))) with allure.step('用例失败%s检查点截图' % title): time.sleep(2) allure.attach(driver.get_screenshot_as_png(), '%s' % PrtScPath, attachment_type=allure.attachment_type.PNG) #添加用例失败检查点截图,PrtScPath为图片位置 pytest_TestResult = False finally: return pytest_TestResult
def ApplyProInvestors(driver): try: with allure.step('上滑屏幕显示出申请转为专业投资者按钮'): time.sleep(5) huadong.shanghua(driver, 1000) with allure.step('点击申请转为专业投资者'): Page.wait_elem(driver, "com.chtwm.mall:id/zt_tv", 10).click() with allure.step('%s检查点截图' % title): time.sleep(2) allure.attach(driver.get_screenshot_as_png(), '%s' % PrtScPath, attachment_type=allure.attachment_type.PNG) #添加检查点截图,PrtScPath为图片位置 with allure.step('确认普转专申请书'): Page.wait_elem(driver, "com.chtwm.mall:id/tv_confirm", 5).click() except Exception as e: print("%s报错:" % title, e) allure.attach("检查点%s报错:" % title, str(e), str(type(e))) with allure.step('用例失败%s检查点截图' % title): time.sleep(2) allure.attach(driver.get_screenshot_as_png(), '%s' % PrtScPath, attachment_type=allure.attachment_type.PNG)
def Bank_PageBack(driver): try: with allure.step('点击"返回上一页面",返回到个人信息页面'): Page.wait_elem(driver, "com.chtwm.mall:id/bankcard_back_img", 10).click() except: driver.back()
def UserInfoInvestor_PageBack(driver): try: with allure.step('点击"返回上一页面",返回到个人信息页面'): Page.wait_elem(driver, "com.chtwm.mall:id/iv_back_white", 10).click() except: driver.back()
def SwitchDingTou(driver): try: with allure.step('选择定投排行'): time.sleep(3) Page.wait_elem(driver, "com.chtwm.mall:id/top_tab2", 18, 3).click() except Exception as e: print("进入基金排行报错:", e)
def FengCeShuoMing_CheckPoint(driver): with allure.step('获取风险揭示说明内容'): check = Page.wait_elem(driver, "com.chtwm.mall:id/tv_content", 10) print("UI自动化获取风险揭示说明内容为:", check.text) with allure.step('风险揭示点击确定'): time.sleep(2) Page.wait_elem(driver, "com.chtwm.mall:id/tv_confirm", 10).click() return True
def IntoFuWuXieYi(driver): #进入服务协议 try: with allure.step('点击服务协议进入服务协议页面'): Page.wait_elem(driver, "com.chtwm.mall:id/tv_fw", 10).click() except Exception as e: print("进入服务协议报错:", e) pass
def IntoSiMuProduct(driver): try: with allure.step('私募合格投资者认证→点击私募产品'): time.sleep(2) Page.wait_elem(driver,"com.chtwm.mall:id/tv_button_right", 15).click() except Exception as e: print("%s报错:"%title, e)
def LoginRecord(driver): #登录日志查询 try: with allure.step('点击登录日志查询'): Page.wait_elem(driver, "com.chtwm.mall:id/tv_login_record", 15).click() except Exception as e: print("点击登录日志查询报错:", e) pass
def intomyself_info(driver): try: with allure.step('点击\"个人信息\"按钮'): Page.wait_elem(driver, "com.chtwm.mall:id/myself_info_tv", 20, 2).click() time.sleep(3) except Exception as e: print("进入个人信息报错:", e) pass
def IntoAbout(driver): # 恒天财富APP进入关于页面 try: with allure.step('点击设置按钮'): Page.wait_elem(driver, "com.chtwm.mall:id/lin_above", 10).click() except Exception as e: print("进入关于报错:", e) pass
def DeviceManage(driver): # 恒天财富APP进入设备管理页面 try: with allure.step('点击设备管理'): Page.wait_elem(driver, "com.chtwm.mall:id/tv_devide_shebei", 15).click() except Exception as e: print("点击设备管理报错:", e) pass
def Into_Financial_Planner(driver): try: with allure.step('我的页面→点击理财师工号进入理财师页面'): time.sleep(2) Page.wait_elem(driver,"com.chtwm.mall:id/financial_planner_job_number_tv", 15).click() except Exception as e: print("%s报错:"%title, e)
def IntoSetting(driver): # 恒天财富APP进入设置页面 try: with allure.step('点击设置按钮'): Page.wait_elem(driver, "com.chtwm.mall:id/myself_set_img", 15).click() except Exception as e: print("点击设置按钮报错:", e) pass
def IntoMyself_Equity(driver): #进入会员权益 try: with allure.step('点击"查看权益"按钮'): Page.wait_elem(driver,"com.chtwm.mall:id/myself_equity", 10).click() time.sleep(3) except Exception as e: print("进入会员权益报错:", e) pass
def CheckVersion(driver): #检查版本 try: with allure.step('点击检查版本'): Page.wait_elem(driver, "com.chtwm.mall:id/tv_devide", 10).click() except Exception as e: print("点击检查版本报错:", e) pass
def AttachedFile(driver): try: with allure.step('私募合格投资者认证→点击附件'): time.sleep(2) Page.wait_elem(driver, "com.chtwm.mall:id/tv_span_audit_standard", 15).click() except Exception as e: print("%s报错:" % title, e)
def Into_Qualified(driver): try: with allure.step('个人信息页面→点击合格投资者认证'): time.sleep(5) Page.wait_elem(driver, "com.chtwm.mall:id/user_info_qualified_ll", 15, 3).click() except Exception as e: print("%s报错:" % title, e)
def IntoChangeEmail(driver): try: with allure.step('点击"修改邮箱"按钮'): Page.wait_elem(driver, "com.chtwm.mall:id/current_email_submit_tv", 10).click() time.sleep(3) except Exception as e: print("进入修改邮箱页面报错:", e) pass
def IntoUserinfo_Myemail(driver): try: with allure.step('点击"我的邮箱"按钮'): Page.wait_elem(driver, "com.chtwm.mall:id/user_info_my_email_ll", 10).click() time.sleep(3) except Exception as e: print("进入我的邮箱报错:", e) pass
def IntoBasic_Information(driver): try: with allure.step('点击"基本信息"按钮'): Page.wait_elem( driver, "com.chtwm.mall:id/user_info_basic_information_tv", 10).click() time.sleep(3) except Exception as e: print("进入基本信息报错:", e) pass
def IntoMessageCenter(driver): #进入消息中心 try: with allure.step('点击右上角"消息中心"按钮'): Page.wait_elem(driver, "com.chtwm.mall:id/myself_message_img", 10).click() time.sleep(3) except Exception as e: print("进入消息中心报错:", e) pass
def Into_SeachSimu(driver): try: with allure.step('点击输入私募产品名称'): time.sleep(5) #com.chtwm.mall:id/myself_item_tv Page.wait_elem(driver, "com.chtwm.mall:id/product_search_relative", 20, 3).click() except Exception as e: print("进入搜索公募报错:", e)
def CheckVersion_CheckPoint(driver): try: with allure.step('点击"稍后再说"不做升级,页面返回关于'): Page.wait_elem(driver, "com.chtwm.mall:id/iv_close", 10).click() except: #暂时没见过最新版本啥样,不处理 pass finally: pytest_TestResult = True return pytest_TestResult