def Into_GMTuiJian(driver): try: with allure.step('首页→上滑,显示公募推荐'): time.sleep(8) huadong.shanghua(driver, 5300) time.sleep(3) with allure.step('查看公募推荐'): Page.find_elem_id(driver, "com.chtwm.mall:id/item_tv").click() time.sleep(3) driver.back() pytest_TestResult = True except Exception as e: print("进入公募推荐报错:", e) pytest_TestResult = False finally: return pytest_TestResult
def MarketImg(driver): try: with allure.step('首页→上滑,显示活动资讯'): time.sleep(3) huadong.shanghua(driver, 10000) time.sleep(3) with allure.step('查看活动资讯'): Page.find_elem_id(driver,"com.chtwm.mall:id/item_market_img").click() time.sleep(3) driver.back() pytest_TestResult = True except Exception as e: print("活动资讯报错:", e) pytest_TestResult = False finally: return pytest_TestResult
def myself_info_CheckPoint(driver): time.sleep(2) with allure.step('验证标题是否为个人信息'): check = Page.find_elem_id(driver, "com.chtwm.mall:id/tv_title") if check.text == "个人信息": pytest_TestResult = True else: pytest_TestResult = False with allure.step('输出客户姓名'): username = Page.find_elem_id( driver, "com.chtwm.mall:id/user_info_tv_username") print("自动化校验客户姓名为:", username.text) with allure.step('输出客户编号'): userNO = Page.find_elem_id( driver, "com.chtwm.mall:id/user_info_tv_userjecno") print("自动化校验", userNO.text) with allure.step('输出客户注册手机号'): phone = Page.find_elem_id( driver, "com.chtwm.mall:id/user_info_tv_userjecno") print("自动化校验客户", phone.text) return pytest_TestResult
def SimuAssetProve(driver): try: with allure.step('点击申请私募资产证明'): time.sleep(3) Page.wait_elem(driver, "com.chtwm.mall:id/sm_apply", 8).click() with allure.step('点击下载,下载资产证明到手机'): time.sleep(15) Page.find_elem_id(driver, "com.chtwm.mall:id/right_text").click() try: with allure.step('资产证明发送到默认邮箱,点击确定'): time.sleep(2) Page.find_elem_id( driver, "com.chtwm.mall:id/tv_confirm").click() time.sleep(3) except: pass with allure.step("私募资产证明页面截图"): allure.attach(driver.get_screenshot_as_png(), '%s' % PrtScPath, attachment_type=allure.attachment_type.PNG) with allure.step("上滑查看私募资产证明下一页"): huadong.shanghua(driver, 500) with allure.step("返回上一页面"): driver.back() pytest_TestResult = True except Exception as e: print("查看%s报错:" % "私募" + title, e) pytest_TestResult = False finally: return pytest_TestResult
def IntoChangeEmail_CheckPoint(driver): time.sleep(2) with allure.step('验证标题是否为%s' % title): check = Page.find_elem_id(driver, "com.chtwm.mall:id/tv_title") with allure.step('%s检查点截图' % title): allure.attach(driver.get_screenshot_as_png(), '%s' % PrtScPath, attachment_type=allure.attachment_type.PNG) #添加检查点截图,PrtScPath为图片位置 if check.text == title: pytest_TestResult = True else: pytest_TestResult = False return pytest_TestResult
def DeviceManage_CheckPoint(driver): time.sleep(2) #driver.get_screenshot_as_file(PrtScPath) with allure.step('添加检查点截图'): allure.attach(driver.get_screenshot_as_png(), '%s' % PrtScPath, attachment_type=allure.attachment_type.PNG) #添加检查点截图,PrtScPath为图片位置 with allure.step('验证标题为设备管理'): check = Page.find_elem_id(driver, "com.chtwm.mall:id/tv_above") if check.text == title: pytest_TestResult = True else: pytest_TestResult = False return pytest_TestResult
def Into_Financial_Planner_CheckPoint(driver): try: with allure.step('截取我的理财师页面截图'): time.sleep(2) allure.attach(driver.get_screenshot_as_png(),'%s' %PrtScPath,attachment_type=allure.attachment_type.PNG) #添加检查点截图,PrtScPath为图片位置 with allure.step("检查页面标题"): check = Page.find_elem_id(driver,"com.chtwm.mall:id/tv_title") if check.text == title: pytest_TestResult = True else: pytest_TestResult = False except Exception as e: allure.attach("%s报错:%s%s"%(title,str(e),str(type(e)))) pytest_TestResult = False finally: return pytest_TestResult
def Basic_Information_CheckPoint(driver): time.sleep(2) with allure.step('验证标题是否为%s' % title): check = Page.find_elem_id(driver, "com.chtwm.mall:id/tv_title") with allure.step('添加基本信息检查点截图_第一页'): allure.attach(driver.get_screenshot_as_png(), '%s_1' % PrtScPath, attachment_type=allure.attachment_type.PNG) #添加检查点截图,PrtScPath为图片位置 huadong.shanghua(driver, 500) with allure.step('添加基本信息检查点截图_第二页'): allure.attach(driver.get_screenshot_as_png(), '%s_2' % PrtScPath, attachment_type=allure.attachment_type.PNG) #添加检查点截图,PrtScPath为图片位置 if check.text == title: pytest_TestResult = True else: pytest_TestResult = False return pytest_TestResult
def ChangeFinancial_Planner_CheckPoint(driver): try: with allure.step('截取变更理财师后页面截图'): time.sleep(8) allure.attach(driver.get_screenshot_as_png(), '%s' % PrtScPath, attachment_type=allure.attachment_type.PNG) #如果截图页面还在变更专属理财师页面说明提交没有成功 with allure.step('查看我的页面理财师的工号是否与提交工号一致'): job_number = Page.find_elem_id( driver, "com.chtwm.mall:id/financial_planner_job_number_tv") if job_number == "H" + FinancialPlannernum: pytest_TestResult = True else: pytest_TestResult = False except Exception as e: allure.attach("%s报错:%s%s" % (title, str(e), str(type(e)))) pytest_TestResult = False finally: return pytest_TestResult
def FuWuXieYi_PageBack(driver): try: with allure.step('点击"返回上一页面",返回到关于页面'): driver.back() except: Page.find_elem_id(driver, "goBack").click()
def Basic_Information_PageBack(driver): try: with allure.step('点击"返回上一页面",返回到个人信息页面'): Page.find_elem_id(driver, "com.chtwm.mall:id/iv_back").click() except: driver.back()
def DeviceManage_PageBack(driver): try: with allure.step('点击返回按钮'): Page.find_elem_id(driver, "com.chtwm.mall:id/img_back").click() except: Page.wait_elem(driver, "com.chtwm.mall:id/img_back", 5).click()
def LoginRecord_PageBack(driver): try: with allure.step('点击返回按钮'): Page.find_elem_id(driver, "goBack").click() except: driver.back()