def test_otherData(self, poco, reloadRoute): pubTool = publicTool(poco) otherdata = otherDataPage(poco) with allure.step("您是否曾经宣告破产或被申请破产?"): otherdata.click_bankrupt(False) with allure.step("您是否艾德证券期货及/或艾德金业的雇员或任何其雇员的亲属?"): otherdata.click_customerRelatives(False) with allure.step("您是否与任何艾德证券期货及/或艾德金业客户有关连"): otherdata.click_associatedcustomer(False) with allure.step("您是否香港交易所之交易所参与者或证监会之持牌人或注册人之董事、雇员或认可人士"): otherdata.click_director(False) with allure.step("客户是否拥有美国公民或美国合法永久居民身份?"): otherdata.click_citizenOfUSA(False) with allure.step("就税务而言,您是否是美国居民?"): otherdata.click_americanResident(False) with allure.step("您是否香港法律定义下的“政治公众人物(PEP)”或与政治公众人物有密切联系"): otherdata.click_PEP_People(False) with allure.step("您的投资目标"): otherdata.click_investmentTarget(["投机", "对冲"]) with allure.step("风险承受能力"): otherdata.click_riskTolerance(grade="高") with allure.step("点击下一步"): pubTool.click_NextStepbtn()
def wrapper(self, *args, **kwargs): try: return func(self, *args, **kwargs) except: pubTool = publicTool(self.poco) pubTool.allow_permissionBox() return func(self, *args, **kwargs)
def test_derivative_securitiesMargin(self, poco, reloadRoute, orderPerson, accountHolder, isCompanyAccounts, isDiscretion, isMarginAccount): pubTool = publicTool(poco) financial = financialPage(poco) with allure.step("您的配偶是否持有艾德证券任何相关的保证金账户?"): financial.click_isMarginAccount(isMarginAccount) financial.send_AccountName() financial.send_AccountNumber() with allure.step("您或您的配偶是否单独或共同控制艾德证券之其他保证金账户35%或以上之表决权?"): financial.click_isDiscretion(isDiscretion) financial.send_AccountName() financial.send_AccountNumber() with allure.step("您是否有以客户的同一集团公司旗下之公司开立保证金账户?"): financial.click_isCompanyAccounts(isCompanyAccounts) pubTool.swipe_to_Up() financial.send_AccountName() financial.send_AccountNumber() with allure.step("您是否是账户的最终实益拥有人? "): # pubTool.swipe_to_Up() financial.click_accountHolder(accountHolder) with allure.step("您是否是最终负责下单的人? "): # pubTool.swipe_to_Up() financial.click_orderPerson(orderPerson) with allure.step("点击下一步"): # pubTool.swipe_to_Up() pubTool.click_NextStepbtn() assert_equal(pubTool.get_Routetitle(), "其他资料", msg="页面跳转到{}页面".format(pubTool.get_Routetitle()))
def test_bankCard(self, poco): mongo = mongoTool(self.gm.get_value("mongohost")) pubTool = publicTool(poco) pubTool.get_appcationNumber() with allure.step("修改数据库currentRoute"): # 判断申请编号, 判断是APP还是H5数据还是老版APP数据 if self.gm.get_value("environment").find("aos") != -1: collection = "accounts" query = {"applyCode":self.gm.get_value("appcationNumber"), "forLogin":True} setdata = {"$set": {"currentRoute": "/account"}} elif self.gm.get_value("environment") == "uat" != -1 or self.gm.get_value("environment") == "test" != -1: collection = "apply" query = {"applySeqId":self.gm.get_value("appcationNumber")} setdata = { "$set" : { "step" : "AccountInformation"} } else: self.log.debug("数据可能有问题哦!!!") mongo.UpdataData(database=self.gm.get_value("environment"), collection=collection , query=query, setdata = setdata) with allure.step("退出开户表单"): pubTool.closeform() with allure.step("重新进入表单"): pass
def test_bankCard_sendAll(self, poco): self.log.debug("正在执行{} 方法".format(sys._getframe().f_code.co_name, )) pubTool = publicTool(poco) bankcard = bankCardInformationPage(poco) with allure.step("输入卡号"): bankcard.send_bankCardNo(bankNo="内地abc123,./") with allure.step("输入银行名称"): bankcard.send_bankName() with allure.step("输入绑定手机号"): bankcard.send_bankPhone() with allure.step("点击下一步"): pubTool.click_NextStepbtn() with allure.step("校验弹框内容"): boxtitle, boxcontent = pubTool.get_boxtitle() assert_equal(boxtitle, "温馨提示", msg="银行卡信息界面弹框标题有误") assert_equal(boxcontent, "卡号只能输入数字", msg="银行卡信息界面弹框内容有误") # 关闭弹框 pubTool.click_box() with allure.step("页面停留在<银行卡信息>界面"): assert_equal(pubTool.get_Routetitle(), "银行卡信息", msg="页面跳转到{}页面".format(pubTool.get_Routetitle()))
def reloadRoute(request, poco): """ # 退出重新加载页面, 清除页面前端缓存 """ routetitle = request.param pubTool = publicTool(poco) start = time.time() while poco(text="取消").exists(): poco(text="取消").click() if time.time() - start > 20: break start1 = time.time() while poco(text="知道了").exists(): poco(text="知道了").click() if time.time() - start1 > 20: break # 点击退出按钮后, 再次进入开户表单 pubTool.closeform() pubTool.wait_loading() title = pubTool.get_Routetitle() # 获取标题 gm.set_value(Routetitle=title) log.debug("当前的页面标题为: {}".format(title)) # 判断当前标题, 如不是操作界面, 则点击返回按钮 if routetitle != pubTool.get_Routetitle(): pubTool.backform()
def test_derivative(self, poco, reloadRoute, derivativeCourse, derivativeJobs, tradingFund, buyProduct): self.log.debug("正在执行{} 方法, 参数为: {}".format( sys._getframe().f_code.co_name, locals())) pubTool = publicTool(poco) derivative = derivativeProductPage(poco) with allure.step("客户是否曾接受有关衍生产品性质和风险的一般知识培训或修读相关课程"): derivative.click_derivativeCourse(derivativeCourse) with allure.step("您是否从现在或过去拥有过与衍生产品有关的工作经验?"): derivative.click_derivativeJobs(derivativeJobs) with allure.step( "您是否在过去3年曾执行5次或以上有关衍生产品的交易,例如:衍生证券、牛熊市、股票期权、期货与期权、商品、结构性产品及交易所买卖基金等" ): derivative.click_tradingFund(tradingFund) with allure.step("客户是否申请开通买卖衍生权证、牛熊证及结构性等产品"): derivative.click_buyProduct(buyProduct) # 当"开通衍生权证"时, 触发隐藏框 if buyProduct: with allure.step("客户已明白买卖衍生权证、牛熊证及结构性产品的风险。并已详细阅读「结构性产品相关风险声明披露」"): derivative.click_riskStatement() else: self.gm.set_bool(knowRisk=False) with allure.step("点击下一步"): self.log.info("test中knowRisk的值为 : {}".format( self.gm.get_value("knowRisk"))) pubTool.click_NextStepbtn() assert_equal(pubTool.get_Routetitle(), "相关保证金融资账户", msg="页面跳转到{}页面".format(pubTool.get_Routetitle()))
def test_bankCardname_sendAll(self, poco): self.log.debug("正在执行{} 方法".format(sys._getframe().f_code.co_name, )) pubTool = publicTool(poco) bankcard = bankCardInformationPage(poco) with allure.step("输入卡号"): bankcard.send_bankCardNo() with allure.step("输入银行名称"): bankcard.send_bankName("中国银行abc123.,/@") with allure.step("输入绑定手机号"): bankcard.send_bankPhone() with allure.step("点击下一步"): pubTool.click_NextStepbtn() with allure.step("页面跳转到人脸识别界面"): assert_equal(pubTool.get_Routetitle(), "人脸识别", msg="页面跳转到{}页面".format(pubTool.get_Routetitle())) with allure.step("点击返回按钮返回银行卡信息界面"): pubTool.backform() assert_equal(pubTool.get_Routetitle(), "银行卡信息", msg="页面跳转到{}页面".format(pubTool.get_Routetitle()))
def test_pick_isaddress(self, poco, reloadRoute): pubTool = publicTool(poco) if self.gm.get_value("environment").find("aos") != -1: perinfo = personalInformationPage(poco) with allure.step("勾选住址与身份证地址不一致"): perinfo.click_isAddress(True) with allure.step("点击下一步"): pubTool.click_NextStepbtn() # pubTool.wait_loading() # with allure.step("校验地址弹框标题和内容"): # boxtitle, boxcontent = pubTool.get_boxtitle() # assert_equal(boxtitle, "请确认您的身份证地址", "确认地址弹框标题有误") # assert_equal(boxcontent, perinfo.get_address(), "弹框内容与填写内容不符") # # with allure.step("确认地址弹框--点击确定"): # pubTool.click_boxconfirm() with allure.step("页面跳转到<住址信息>界面"): assert_equal(pubTool.get_Routetitle(), "住址信息", msg="页面没有跳转") with allure.step("点击返回按钮返回身份证界面"): pubTool.backform() assert_equal(pubTool.get_Routetitle(), "身份证验证", msg="页面跳转到{}页面".format(pubTool.get_Routetitle()))
def test_unemployedandnot(self, poco, reloadRoute, employed, totalAnnual, fundlist, customer, assetslist): self.log.debug("正在执行用例 {} ".format(sys._getframe().f_code.co_name, )) pubTool = publicTool(poco) employment = employmentInfomationPage(poco) with allure.step("就业情况选择无业"): employ = employment.click_employment(employed) with allure.step("全年总收入选择{}".format(totalAnnual)): totalAnnual = employment.click_totalAnnualCustomerRevenueHK( totalAnnual, fundlist=fundlist) with allure.step("资产净值选择{}".format(customer)): customer = employment.click_customerNetAssetValueHK( customer, assetslist=assetslist) with allure.step("点击下一步"): pubTool.click_NextStepbtn() with allure.step("点击下一步成功, 跳转到'选择交易界面'"): self.log.debug("{}".format(self.gm.get_value("istotalAnnual"), )) assert_equal(pubTool.get_Routetitle(), "选择交易信息", msg="页面跳转到{}页面".format(pubTool.get_Routetitle())) with allure.step("点击返回按钮返回账户信息界面"): pubTool.backform() assert_equal(pubTool.get_Routetitle(), "就业及财务状况", msg="页面跳转到{}页面".format(pubTool.get_Routetitle()))
def test_otherData_bankruptmsg(self, poco, reloadRoute): pubTool = publicTool(poco) otherdata = otherDataPage(poco) with allure.step("您是否曾经宣告破产或被申请破产?"): otherdata.click_bankrupt(True) with allure.step("校验地址弹框标题和内容"): boxtitle, boxcontent = pubTool.get_boxtitle() assert_equal(boxtitle, "温馨提示", "弹框标题有误") assert_equal(boxcontent, "如您曾经宣告破产或被申请破产,请联系客服", "弹框内容与填写内容不符")
def test_otherData_associatedcustomermsg(self, poco, reloadRoute): pubTool = publicTool(poco) otherdata = otherDataPage(poco) with allure.step("您是否与任何艾德证券期货及/或艾德金业客户有关连"): otherdata.click_associatedcustomer(True) with allure.step("校验地址弹框标题和内容"): boxtitle, boxcontent = pubTool.get_boxtitle() assert_equal(boxtitle, "温馨提示", "弹框标题有误") assert_equal(boxcontent, "如您与任何艾德证券期货客户有关连,请联系客服", "弹框内容与填写内容不符")
def test_otherData_americanResidentmsg(self, poco, reloadRoute): pubTool = publicTool(poco) otherdata = otherDataPage(poco) with allure.step("就税务而言,您是否是美国居民?"): otherdata.click_americanResident(True) with allure.step("校验地址弹框标题和内容"): boxtitle, boxcontent = pubTool.get_boxtitle() assert_equal(boxtitle, "温馨提示", "弹框标题有误") assert_equal(boxcontent, "如您就税务而言,您是否是美国居民,请联系客服", "弹框内容与填写内容不符")
def test_otherData_citizenOfUSAmsg(self, poco, reloadRoute): pubTool = publicTool(poco) otherdata = otherDataPage(poco) with allure.step("客户是否拥有美国公民或美国合法永久居民身份?"): otherdata.click_citizenOfUSA(True) with allure.step("校验地址弹框标题和内容"): boxtitle, boxcontent = pubTool.get_boxtitle() assert_equal(boxtitle, "温馨提示", "弹框标题有误") assert_equal(boxcontent, "如您拥有美国公民或美国合法永久居民身份,请联系客服", "弹框内容与填写内容不符")
def test_signaturepass(self, poco): pubTool = publicTool(poco) sign = signaturePage(poco) with allure.step("在签名位置划线"): sign.signatureview().swipe([-0.6, 0.5]) with allure.step("点击提交按钮"): sign.click_signSubmit() with allure.step("如果有权限弹框, 点击允许"): pubTool.allow_permissionBox()
def test_otherData_customerRelativesmsg(self, poco, reloadRoute): pubTool = publicTool(poco) otherdata = otherDataPage(poco) with allure.step("您是否艾德证券期货及/或艾德金业的雇员或任何其雇员的亲属?"): otherdata.click_customerRelatives(True) with allure.step("校验地址弹框标题和内容"): boxtitle, boxcontent = pubTool.get_boxtitle() assert_equal(boxtitle, "温馨提示", "弹框标题有误") assert_equal(boxcontent, "如您是艾德证券期货的雇员或任何其雇员的亲属,请联系客服", "弹框内容与填写内容不符")
def test_otherData_PEP_Peoplemsg(self, poco, reloadRoute): pubTool = publicTool(poco) otherdata = otherDataPage(poco) with allure.step("您是否香港法律定义下的“政治公众人物(PEP)”或与政治公众人物有密切联系"): otherdata.click_PEP_People(True) with allure.step("校验地址弹框标题和内容"): boxtitle, boxcontent = pubTool.get_boxtitle() assert_equal(boxtitle, "温馨提示", "弹框标题有误") assert_equal(boxcontent, "如您是香港法律定义下的“政治公众人物(PEP)”或与政治公众人物有密切联系,请联系客服", "弹框内容与填写内容不符")
def test_otherData_directormsg(self, poco, reloadRoute): pubTool = publicTool(poco) otherdata = otherDataPage(poco) with allure.step("您是否香港交易所之交易所参与者或证监会之持牌人或注册人之董事、雇员或认可人士"): otherdata.click_director(True) with allure.step("校验地址弹框标题和内容"): boxtitle, boxcontent = pubTool.get_boxtitle() assert_equal(boxtitle, "温馨提示", "弹框标题有误") assert_equal(boxcontent, "如您是香港交易所之交易所参与者或证监会之持牌人或注册人之董事、雇员或认可人士,请联系客服", "弹框内容与填写内容不符")
def test_otherData_derivatives_and_futures(self, poco, reloadRoute): pubTool = publicTool(poco) otherdata = otherDataPage(poco) with allure.step("您是否曾经宣告破产或被申请破产?"): otherdata.click_bankrupt(False) with allure.step("您是否艾德证券期货及/或艾德金业的雇员或任何其雇员的亲属?"): otherdata.click_customerRelatives(False) with allure.step("您是否与任何艾德证券期货及/或艾德金业客户有关连"): otherdata.click_associatedcustomer(False) with allure.step("您是否香港交易所之交易所参与者或证监会之持牌人或注册人之董事、雇员或认可人士"): otherdata.click_director(False) with allure.step("客户是否拥有美国公民或美国合法永久居民身份?"): otherdata.click_citizenOfUSA(False) with allure.step("就税务而言,您是否是美国居民?"): otherdata.click_americanResident(False) with allure.step("您是否香港法律定义下的“政治公众人物(PEP)”或与政治公众人物有密切联系"): otherdata.click_PEP_People(False) with allure.step("您的投资目标"): otherdata.click_investmentTarget(["利息/股息收入", "对冲"]) with allure.step("风险承受能力"): otherdata.click_riskTolerance(grade="低") with allure.step("点击下一步"): pubTool.click_NextStepbtn() with allure.step("校验弹框标题和内容"): boxtitle, boxcontent = pubTool.get_boxtitle() assert_equal(boxtitle, "温馨提示", "弹框标题有误") assert_equal(boxcontent, "期货买卖不适合风险承受能力为低之客户。结构性产品及衍生产品买卖不适合风险承受能力为低或中之客户", "弹框内容与填写内容不符") poco(text="知道了").click() with allure.step("再次点击风险承受能力"): otherdata.click_riskTolerance(grade="中") with allure.step("点击下一步"): pubTool.click_NextStepbtn() with allure.step("再次校验弹框标题和内容"): boxtitle, boxcontent = pubTool.get_boxtitle() assert_equal(boxtitle, "温馨提示", "弹框标题有误") assert_equal(boxcontent, "结构性产品及衍生产品买卖不适合风险承受能力为低或中之客户", "弹框内容与填写内容不符")
def test_personalInfoDeclartionasY(self, poco, reloadRoute): pubTool = publicTool(poco) channel = introPromoPage(poco) with allure.step("您透过哪些渠道认识艾德证券期货及/或艾德金业?(选择所有适用)"): channels = channel.click_Channels(["网上广告", "讲座", "报纸"]) # assert_equal(employ, "无业", "就业情况信息填写有误") with allure.step("勾选本人同意艾德证券如上述情况使用本人的个人资料"): channel.click_personalInfoDeclartionLangsasImgview(True) with allure.step("点击下一步"): pubTool.click_NextStepbtn() assert_equal(pubTool.get_Routetitle(), "衍生品产品认识", msg="页面跳转到{}页面".format(pubTool.get_Routetitle()))
def click_Chinese(self): """ 选择内地居民 """ pubTool = publicTool(self.poco) if pubTool.get_Routetitle() == "选择所属地区": self.el_chinese.wait(5) self.el_chinese.click() if pubTool.get_Routetitle() == "开户准备": pubTool.click_NextStepbtn()
def test_otherData(self, poco): pubTool = publicTool(poco) riskdisclosure = RiskDisclosurePage(poco) with allure.step("点击按钮开始播放音频"): riskdisclosure.click_player() with allure.step("拖动音频进度条"): riskdisclosure.drag_progressbar() with allure.step("勾选复选框, 明白风险"): riskdisclosure.click_isUnderstandRisk() with allure.step("点击下一步"): pubTool.click_NextStepbtn()
def test_otherData(self, poco): pubTool = publicTool(poco) customer = customerStatementPage(poco) with allure.step("勾选所有客户声明"): customer.click_CustomerStatement01() customer.click_CustomerStatement02() customer.click_CustomerStatement03() customer.click_CustomerStatement04() customer.click_CustomerStatement05() customer.click_CustomerStatement06() with allure.step("点击下一步"): pubTool.click_NextStepbtn()
def test_derivative(self, poco, reloadRoute, orderPerson, accountHolder): pubTool = publicTool(poco) financial = financialPage(poco) with allure.step("您是否是账户的最终实益拥有人? "): financial.click_accountHolder(True) with allure.step("您是否是最终负责下单的人?? "): financial.click_orderPerson(True) with allure.step("点击下一步"): pubTool.click_NextStepbtn() assert_equal(pubTool.get_Routetitle(), "其他资料", msg="页面跳转到{}页面".format(pubTool.get_Routetitle()))
def test_sendtransaction(self, poco, reloadRoute): pubTool = publicTool(poco) transac = transactionPage(poco) with allure.step("输入交易资金/财富来源"): employ = transac.click_fundsSource(["储蓄", "其他"]) with allure.step("点击下一步"): pubTool.click_NextStepbtn() with allure.step("点击返回按钮返回账户信息界面"): pubTool.backform() assert_equal(pubTool.get_Routetitle(), "选择交易信息", msg="页面跳转到{}页面".format(pubTool.get_Routetitle()))
def test_nullemploy(self, poco, totalAnnual, customer): self.log.debug("正在执行用例 {} ".format(sys._getframe().f_code.co_name, )) pubTool = publicTool(poco) employment = employmentInfomationPage(poco) with allure.step("选择全年总收入选择 {}".format(totalAnnual)): employment.click_totalAnnualCustomerRevenueHK(totalAnnual) with allure.step("资产净值选择 {}".format(customer)): employment.click_customerNetAssetValueHK(customer) with allure.step("点击下一步"): pubTool.click_NextStepbtn() assert_equal(pubTool.get_Routetitle(), "就业及财务状况", msg="页面跳转到{}页面".format(pubTool.get_Routetitle()))
def test_Openning(self, poco): pubTool = publicTool(poco) startupfrom = startUpFrom(poco) with allure.step("启动APP"): startupfrom.Start_APP() with allure.step("处理权限弹框--点击运行"): pubTool.allow_permissionBox() with allure.step("首次使用设置--点击确定"): boolstr = startupfrom.firstSetting() if not boolstr: allure.attach("AppSetpLOG", "首次使用设置弹框没有出现") with allure.step("底部栏选择开户"): baropen = startupfrom.click_barOpenning() if not baropen: allure.attach("AppSetpLOG", "没有底部栏, 非行情APP") with allure.step("判断是否登录"): if pubTool.get_Routetitle() in ['艾德证券期货', '注册', '登录', '个人中心']: pytest.mark.skip(reason="已登录, 跳过下面步骤") with allure.step("点击便捷开户"): if pubTool.get_Routetitle() == "艾德证券期货": startupfrom.click_easyOpenning() with allure.step("进入注册界面--点击去登陆"): startupfrom.click_goLogin() with allure.step("登陆界面--输入手机号"): startupfrom.send_phonenumber() with allure.step("登陆界面--输入密码"): startupfrom.send_password() with allure.step("登陆界面--点击登陆按钮"): startupfrom.click_Loginbtn() pubTool.wait_loading() with allure.step("登录后再次点击便捷开户"): if pubTool.get_Routetitle() == "艾德证券期货": startupfrom.click_easyOpenning() pubTool.wait_loading()
def test_uploadidcard(self, poco, reloadRoute): upidcard = idcardPage(poco) pubTool = publicTool(poco) # 判断客户来源 pubTool.get_appcationNumber() with allure.step("选择所属地区 -- 内地居民"): upidcard.click_Chinese() with allure.step("上传身份证人像面"): upidcard.upload_idcardNegative() pubTool.wait_loading() with allure.step("上传身份证国徽面"): upidcard.upload_idcardpositive() pubTool.wait_loading() if self.gm.get_value("environment").find("aos") != -1: # 输入email perinfo = personalInformationPage(poco) with allure.step("输入电邮"): email = perinfo.send_emali() with allure.step("再次输入电邮"): reEmail = perinfo.send_reemail() with allure.step("点击下一步"): pubTool.click_NextStepbtn() with allure.step("校验地址弹框标题和内容"): boxtitle, boxcontent = pubTool.get_boxtitle() assert_equal(boxtitle, "请确认您的身份证地址", "确认地址弹框标题有误") assert_equal(boxcontent, perinfo.get_address(), "弹框内容与填写内容不符") with allure.step("确认地址弹框--点击确定"): pubTool.click_boxconfirm() with allure.step("页面跳转到<银行卡信息>界面"): assert_equal(pubTool.get_Routetitle(), "银行卡信息", msg="页面没有跳转") else: with allure.step("点击下一步"): pubTool.click_NextStepbtn()
def test_birthdayis18(self, poco, reloadRoute): pubTool = publicTool(poco) if self.gm.get_value("environment").find("aos") != -1: perinfo = personalInformationPage(poco) with allure.step("选择出生日期, 2008.2.12"): perinfo.modify_birthday(True, "2008.10.12") with allure.step("点击下一步"): pubTool.click_NextStepbtn() # pubTool.wait_loading() with allure.step("校验地址弹框标题和内容"): boxtitle, boxcontent = pubTool.get_boxtitle() assert_equal(boxtitle, "温馨提示", "确认地址弹框标题有误") assert_equal(boxcontent, "开户年龄不得小于18岁", "弹框内容与填写内容不符") with allure.step("关闭弹框"): pubTool.click_box()
def test_validityPeriod(self, poco, reloadRoute): pubTool = publicTool(poco) if self.gm.get_value("environment").find("aos") != -1: perinfo = personalInformationPage(poco) with allure.step("校验身份证是否过期"): perinfo.modify_validityPeriod(True, "2018.10.12") with allure.step("点击下一步"): pubTool.click_NextStepbtn() # pubTool.wait_loading() with allure.step("校验地址弹框标题和内容"): boxtitle, boxcontent = pubTool.get_boxtitle() assert_equal(boxtitle, "温馨提示", "确认地址弹框标题有误") assert_equal(boxcontent, "您的身份证件已过期,请更换证件后再次申请", "弹框内容与填写内容不符") with allure.step("关闭弹框"): pubTool.click_box()