def test_Exited_list(self): "投资记录-已退出列表数据验证" entry_page = Entry_page(self.driver,phone='17712345606',pwd='qwe123') myinvsetrecorepage = entry_page.open_my_invset_recore_Page() time.sleep(0.2) myinvsetrecorepage.el_exited_btn.click() invest_list_value = myinvsetrecorepage.logic_get_invest_value() sql = Exce_SQLserver() contract_number = sql.execSql_getList( "SELECT top 1 new_product_name,new_name,new_instreststartdate,new_quitdate,new_planmoney,new_planmoney_Base from new_investdetailBase WHERE new_accountname = 'F86EEE35-2940-E711-80D3-00155D02B414' AND new_status=100000002 order BY new_paidon desc") entry_page.saveScreenshot('test_Exited_list') # 断言验证 # 断言理财名称 self.assertIn(invest_list_value["invest_text_name"], contract_number[0][0]) # 断言合同编号 self.assertIn(contract_number[0][1], invest_list_value["invest_product_no"]) # 断言起息日 self.assertEquals(invest_list_value["start_income_day"], (contract_number[0][2].date() + datetime.timedelta(days=1)).strftime("%Y-%m-%d")) # 断言结息日 self.assertEquals(invest_list_value["end_income_day"], (contract_number[0][3].date() + datetime.timedelta(days=1)).strftime("%Y-%m-%d")) # 断言 实际投资金额 self.assertIn(str(contract_number[0][4])[:-6] + "," + str(contract_number[0][4])[-6:], invest_list_value["reality_invest"]) # 断言 意向投资金额 self.assertIn(str(contract_number[0][5])[:-6] + "," + str(contract_number[0][5])[-6:], invest_list_value["expected_invest"])
def test_user_Information(self): """个人中心-个人信息验证""" entry_page = Entry_page(self.driver, phone="18048444414", pwd='qwe123') myPersonalCenterPage = entry_page.open_my_Personal_CenterPage() user_information = myPersonalCenterPage.logic_get_user_information() sql = Exce_SQLserver() sql_user_information = sql.execSql_getList( "SELECT Name,new_telephone1,new_certificatenum from AccountBase WHERE new_telephone1={phone}" .format(phone=entry_page.phone)) "" [('username', u'u***1'), ('phonenum', u'144****8098'), ('ID', u'411***********3286')] [(u'14488888098', u'ufo21', 411224197404103286)] "" username = sql_user_information[0][0] phonenum = sql_user_information[0][1] ID = sql_user_information[0][2] entry_page.saveScreenshot('user_Information') #断言 self.assertEquals(user_information["username"], username[:1] + '*' + username[-1:]) self.assertEquals(user_information["phonenum"], phonenum[:3] + '****' + phonenum[-4:]) self.assertEquals(user_information["ID"], ID[:3] + '***********' + ID[-4:])
def test_Continued_investment(self): """交易记录-续投记录验证""" entry_page = Entry_page(self.driver, phone="14404414441", pwd="qwe123") mytradeRecordPage = entry_page.open_my_tradeRecord_page() mytradeRecordPage.el_trade_list_image.click() trade_list_dict = mytradeRecordPage.logic_get_reinvest_way() sql = Exce_SQLserver() data_trade_list = sql.execSql_getList( "SELECT top 10 new_renewmethod,new_expectprofit,new_newcontractno FROM new_renewapplyBase WHERE new_customer ='47A24DAD-E65A-E711-80C9-00155D01F903'" ) entry_page.saveScreenshot("Continued_investment") #断言续投方式 self.assertEquals(data_trade_list[0][0], 100000001) self.assertEquals(trade_list_dict['reinvest_way'], "本金续投") #断言预期收益 self.assertIn( str(data_trade_list[0][1])[:5], trade_list_dict['expect_incomeself']) #断言续投编号 self.assertEquals(trade_list_dict['el_reinvest_contract_no'], data_trade_list[0][2])
def test_Exited_data(self): """投资记录-已退出资产详情数据验证""" entry_page = Entry_page(self.driver, phone='17712345606',pwd='qwe123') MyAssetDetailsPage = entry_page.open_my_assetDetails_Exited_page() time.sleep(1.5) assetdetails_list=MyAssetDetailsPage.get_assetdetails_list() pact_title=MyAssetDetailsPage.el_pact_title_btn.text #查询DB 获得理财中第一个理财的合同编号 sql = Exce_SQLserver() contract_number = sql.execSql_getList("SELECT top 1 new_name from new_investdetailBase WHERE new_accountname = 'F86EEE35-2940-E711-80D3-00155D02B414' AND new_status=100000002 order BY new_instreststartdate desc ") #查询DB 获得理财产品名称 sql = Exce_SQLserver() product_name = sql.execSql_getList( "SELECT top 1 new_product_name from new_investdetailBase WHERE new_accountname = 'F86EEE35-2940-E711-80D3-00155D02B414' AND new_status=100000002 order BY new_instreststartdate desc") #断言 self.basepage = BasePage(self.driver) self.basepage.saveScreenshot('Exited_data') self.assertIn(assetdetails_list[0],product_name[0][0]) self.assertIn(contract_number[0][0],assetdetails_list[1]) self.assertEqual(pact_title,'资产详情')
def test_financial_data(self): """投资记录-理财中资产详情数据验证""" entry_page = Entry_page(self.driver) MyAssetDetailsPage = entry_page.open_my_assetDetails_page() time.sleep(1.5) #获得资产详情页列表数据,默认获得第index=0 个 assetdetails_list=MyAssetDetailsPage.get_assetdetails_list() pact_title=MyAssetDetailsPage.el_pact_title_btn.text #查询DB 获得理财中第一个理财的合同编号 sql = Exce_SQLserver() contract_number = sql.execSql_getList("SELECT top 1 new_name from new_investdetailBase WHERE new_accountname = '24004F6C-7C08-E711-80C9-00155D01F903' AND new_status=100000000 order BY new_paidon desc") #查询DB 获得理财产品名称 sql = Exce_SQLserver() product_name = sql.execSql_getList( "SELECT top 1 new_product_name from new_investdetailBase WHERE new_accountname = '24004F6C-7C08-E711-80C9-00155D01F903' AND new_status=100000000 order BY new_paidon desc") #断言 self.basepage = BasePage(self.driver) self.basepage.saveScreenshot('financial_data') self.assertIn(assetdetails_list[0],product_name[0][0]) self.assertIn(contract_number[0][0],assetdetails_list[1]) self.assertEqual(pact_title,'资产详情')
def test_quiting_data(self): """投资记录-退出中资产详情数据验证""" entry_page = Entry_page(self.driver,phone='14477650717',pwd='qwe123') MyAssetDetailsPage = entry_page.open_my_assetDetails_quiting_page() #获得资产详情页列表数据,默认获得第index=0 个 time.sleep(1.5) assetdetails_list=MyAssetDetailsPage.get_assetdetails_list() time.sleep(2) pact_title=MyAssetDetailsPage.el_pact_title_btn.text #查询DB 获得理财中第一个理财的合同编号 sql = Exce_SQLserver() contract_number = sql.execSql_getList("SELECT top 1 new_name from new_investdetailBase WHERE new_accountname = '331C4E9C-D93A-E711-80D3-00155D02B414' AND new_status=100000003 order BY new_instreststartdate desc") #查询DB 获得理财产品名称 sql = Exce_SQLserver() product_name = sql.execSql_getList( "SELECT top 1 new_product_name from new_investdetailBase WHERE new_accountname = '331C4E9C-D93A-E711-80D3-00155D02B414' AND new_status=100000003 order BY new_instreststartdate desc") #断言 self.basepage = BasePage(self.driver) self.basepage.saveScreenshot('quiting_data') self.assertIn(assetdetails_list[0],product_name[0][0]) self.assertIn(contract_number[0][0],assetdetails_list[1]) self.assertEqual(pact_title,'资产详情')
def test_financial_list(self): "投资记录-理财中列表数据验证" entry_page = Entry_page(self.driver) myinvsetrecorepage=entry_page.open_my_invset_recore_Page() invest_list_value=myinvsetrecorepage.logic_get_invest_value() sql = Exce_SQLserver() contract_number = sql.execSql_getList("SELECT top 1 new_product_name,new_name,new_instreststartdate,new_quitdate,new_planmoney,new_planmoney_Base from new_investdetailBase WHERE new_accountname = '24004F6C-7C08-E711-80C9-00155D01F903' AND new_status=100000000 order BY new_paidon desc") entry_page.saveScreenshot('financial_data') #断言验证 #断言理财名称 self.assertIn(invest_list_value["invest_text_name"],contract_number[0][0]) #断言合同编号 self.assertIn(contract_number[0][1],invest_list_value["invest_product_no"]) #断言起息日 self.assertEquals(invest_list_value["start_income_day"], (contract_number[0][2].date()+datetime.timedelta(days = 1)).strftime("%Y-%m-%d")) #断言结息日 if '年年生利' in invest_list_value["invest_text_name"]: self.assertIn("随时申请退出",invest_list_value["end_income_day"]) else: self.assertEquals(invest_list_value["end_income_day"],(contract_number[0][3].date().strftime("%Y-%m-%d"))) #断言 实际投资金额 self.assertIn(str(contract_number[0][4])[:-6]+ ","+ str(contract_number[0][4])[-6:],invest_list_value["reality_invest"]) #断言 意向投资金额 self.assertIn(str(contract_number[0][5])[:-6]+ ","+ str(contract_number[0][5])[-6:],invest_list_value["expected_invest"])
def test_system_notice(self): """首页-未登录点击系统广告""" entry_page = Entry_page(self.driver) homepage = entry_page.open_start_home_page() homepage.el_system_notice.click() time.sleep(2) entry_page.saveScreenshot('system_notice')
def test_payment_record(self): """交易记录-回款记录验证""" entry_page = Entry_page(self.driver, phone="14454839876", pwd="qwe123") mytradeRecordPage = entry_page.open_my_tradeRecord_page() mytradeRecordPage.el_trade_list_image.click() trade_list_dict = mytradeRecordPage.logic_get_trade_list() sql = Exce_SQLserver() data_trade_list = sql.execSql_getList( "SELECT top 1 new_product_name,new_payamount,new_paydate,new_paymentstatus,new_paymentno,new_txtinvestapply FROM new_tradedetailBase WHERE new_account ='6B5A5084-9C49-E711-80D3-00155D02B414'" ) entry_page.saveScreenshot("payment_record") #断言理财名称 self.assertIn(trade_list_dict['name'], data_trade_list[0][0]) #断言金额 self.assertIn( str(data_trade_list[0][1])[:-6] + "," + str(data_trade_list[0][1])[-6:], trade_list_dict['amount']) #断言时间 self.assertIn((data_trade_list[0][2].date().strftime("%Y-%m-%d")), trade_list_dict['data']) #断言交易流水 self.assertEquals(trade_list_dict['flowing'], data_trade_list[0][4]) #断言理财状态 self.assertEquals(data_trade_list[0][3], 100000003) #断言合同编号 self.assertEquals(trade_list_dict['contract_no'], data_trade_list[0][5])
def test_transaction_list(self): """交易记录-交易列表数据验证""" #mytraderecordpage=self.into_transaction() entry_page = Entry_page(self.driver) mytradeRecordPage = entry_page.open_my_tradeRecord_page() # time.sleep(2) trade_list = mytradeRecordPage.logic_trade_list() # 查询DB 获得理财中第一个理财的合同编号 sql = Exce_SQLserver() txtinvestapply = sql.execSql_getList( "SELECT top 1 new_txtinvestapply from new_tradedetailBase WHERE new_account = '24004F6C-7C08-E711-80C9-00155D01F903' ORDER BY new_paydate DESC" ) # print txtinvestapply[0][0] #print trade_list[0] sql = Exce_SQLserver() paymentno = sql.execSql_getList( "SELECT top 1 new_paymentno from new_tradedetailBase WHERE new_account = '24004F6C-7C08-E711-80C9-00155D01F903' ORDER BY new_paydate DESC" ) #print paymentno[0][0] #print trade_list[1] entry_page.saveScreenshot('transaction_list') self.assertEquals(trade_list[0], txtinvestapply[0][0]) self.assertEquals(trade_list[1], paymentno[0][0])
def test_contract_list(self): """消息中心-合同消息-展示本金确认书合同列表""" # 客户登录并进入消息中心列表 entry_page = Entry_page(self.driver) newspage = entry_page.open_news_page() # 点击合同列表页面 contractspage = newspage.click_el_contract_message_btn() time.sleep(2) #获取列表中第 index 个的详情数据,默认最新的一条数据 con_list=contractspage.get_Contracts_list_text(index=0) # print "con_list is %s" %con_list[0] #从DB中查询购买的最新的理财产品信息 #sql=Exce_SQLserver() # results = sql.execSql_getList( # "SELECT top 1 new_product_name,new_investdate,new_name,new_financeterm from new_investdetailBase WHERE new_accountname = '24004F6C-7C08-E711-80C9-00155D01F903' order BY new_investdate DESC") sql = Exce_SQLserver() product_name = sql.execSql_getList("SELECT top 1 new_product_name from new_investdetailBase WHERE new_accountname = '24004F6C-7C08-E711-80C9-00155D01F903' order BY CreatedOn DESC") #print "product_name is %s" %product_name sql = Exce_SQLserver() contract_number = sql.execSql_getList("SELECT top 1 new_name from new_investdetailBase WHERE new_accountname = '24004F6C-7C08-E711-80C9-00155D01F903' order BY CreatedOn DESC") #print "contract_number is %s" % contract_number #print con_list[2] #print contract_number[0][0] #断言处理 self.basepage = BasePage(self.driver) self.basepage.saveScreenshot('contract_list') self.assertIn(con_list[0],product_name[0][0]) self.assertEqual(con_list[2],contract_number[0][0]) """
def test_gesture_cipher(self): """个人中心-修改手势密码""" entry_page = Entry_page(self.driver, phone="18048444414", pwd='qwe123') myPersonalCenterPage = entry_page.open_my_Personal_CenterPage() myPersonalCenterPage.el_gesture_cipher_btn.click() myPersonalCenterPage.logic_drawGestureCode() time.sleep(1) entry_page.saveScreenshot('gesture_cipher')
def test_private_fund_list(self): """私募预约-私募预约列表验证""" entry_page = Entry_page(self.driver) private_Offering_Fund_Page=entry_page.open_Private_Offering_Fund_Page() entry_page.saveScreenshot("private_fund_list") self.assertEquals(len(private_Offering_Fund_Page.el_private_fund_list),2)
def test_home_product(self): """首页-未登录点击推荐产品""" entry_page = Entry_page(self.driver) homepage = entry_page.open_start_home_page() productBeautiPage = homepage.logic_el_invest_newpeo_click() title = productBeautiPage.logic_get_title_text() entry_page.saveScreenshot('home_product') self.assertEquals(title, "新手体验计划")
def test_login_out(self): """个人中心-安全退出测试""" entry_page = Entry_page(self.driver, phone="18048444414", pwd='qwe123') myPersonalCenterPage = entry_page.open_my_Personal_CenterPage() homepage = myPersonalCenterPage.logic_login_out_btn_click() entry_page.saveScreenshot('login_out') product_name = homepage.get_product_title_text() self.assertEquals(product_name, "新手体验计划")
def test_invest_contract_no4(self): """资产详情-电子合同《出借本金确认书》验证""" entry_page = Entry_page(self.driver) electronic_contract_page = entry_page.open_Electronic_contract_page() time.sleep(1) electronic_contract_page.logic_contract_no1_click(index=3) title = electronic_contract_page.logic_get_contract_details_title() entry_page.saveScreenshot('invest_contract_no4') self.assertEquals(title, "出借本金确认书")
def test_invest_contract_no3(self): """资产详情-电子合同《授权委托书-催收及诉讼》验证""" entry_page = Entry_page(self.driver) electronic_contract_page = entry_page.open_Electronic_contract_page() time.sleep(1) electronic_contract_page.logic_contract_no1_click(index=2) title = electronic_contract_page.logic_get_contract_details_title() entry_page.saveScreenshot('invest_contract_no3') self.assertEquals(title, "授权委托书-催收及诉讼")
def test_newuser_product_buy(self): """新用户首页理财产品验证""" "14414441414 ,qwe123" entry_page = Entry_page(self.driver, phone='14414441414') homepage = entry_page.open_login_home_page() title_text = homepage.get_product_title_text() entry_page.saveScreenshot('newuser_product_buy') self.assertEquals(title_text, "新手体验计划")
def test_Help_center(self): """登录状态-帮助中心""" entry_page = Entry_page(self.driver) mypage = entry_page.open_login_my_page() mypage.el_Help_center.click() #mypage.get_screenshot_by_element(mypage, 'el_Help_center_deil', isexist=False) #time.sleep(5) bool1 = mypage.get_screenshot_by_element(mypage, 'el_Help_center_deil', isexist=True).same_as(percent=30) entry_page.saveScreenshot("test_Help_center") self.assertTrue(bool1)
def test_contract_details_no3(self): """消息中心-授权委托书-催收及诉讼验证""" entry_page = Entry_page(self.driver) newspage = entry_page.open_news_page() contractspage = newspage.click_el_contract_message_btn() contractdetailspage = contractspage.click_el_check_pact_btn() contractdetailspage.el_litigation_btn.click() title = contractdetailspage.el_capitalt_title.text entry_page.saveScreenshot("contract_details_no3") self.assertEquals("授权委托书-催收及诉讼", title)
def test_bankcard_num(self): """登录状态-银行卡张数验证""" entry_page = Entry_page(self.driver) mypage = entry_page.open_login_my_page() bankcard_num=mypage.el_my_bankcard_num.text myBankCardPage=mypage.logic_my_bankCard_click() entry_page.saveScreenshot("bankcard_num") self.assertIn(str(len(myBankCardPage.el_bankcard_list)),bankcard_num)
def test_About_us(self): """ 登录状态-关于我们""" entry_page = Entry_page(self.driver) mypage = entry_page.open_login_my_page() mypage.el_about_us.click() #mypage.get_screenshot_by_element(mypage, 'el_about_us_deilt', isexist=False) #time.sleep(5) bool1 = mypage.get_screenshot_by_element(mypage, 'el_about_us_deilt',isexist=True).same_as(percent=30) entry_page.saveScreenshot("test_About_us") self.assertTrue(bool1)
def test_contract_details_no1(self): """消息中心-出借咨询与服务协议验证""" entry_page = Entry_page(self.driver) newspage = entry_page.open_news_page() contractspage = newspage.click_el_contract_message_btn() contractdetailspage=contractspage.click_el_check_pact_btn() contractdetailspage.el_service_agreement_btn.click() title = contractdetailspage.el_capitalt_title.text entry_page.saveScreenshot("contract_details_no2") self.assertEquals(title,"出借咨询与服务协议")
def test_product_notlogin(self): """首页-未登录购买理财产品""" entry_page = Entry_page(self.driver) homepage = entry_page.open_start_home_page() productBeautiPage = homepage.logic_el_invest_newpeo_click() #productListPage=homepage.logic_link_product() # productBeautiPage=productListPage.logic_notlogin_prodict() loginPage = productBeautiPage.logic_noLogin_state_buy() title = loginPage.el_title.text entry_page.saveScreenshot('product_notlogin') self.assertEquals(title, "登录")
def test_product_financial(self): "登录状态—产品列表进入资产详情" entry_page = Entry_page(self.driver) productListPage = entry_page.open_login_productList_page() myInvsetRecorePage=productListPage.logic_financia_img_click() myInvsetRecorePage.el_tv_know.click() title_text=myInvsetRecorePage.logic_get_invest_title() # 截图 self.assertEquals(title_text, u"投资记录") # 断言 entry_page.saveScreenshot('product_financial')
def test_my_financial(self): "登录状态-我的列表进入资产详情" entry_page = Entry_page(self.driver) mypage=entry_page.open_login_my_page() myInvsetRecorePage=mypage.logic_financial_img_click() myInvsetRecorePage.el_tv_know.click() title_text = myInvsetRecorePage.logic_get_invest_title() # 断言 self.assertEquals(title_text, u"投资记录") # 截图 entry_page.saveScreenshot('my_financial')
def test_home_financial(self): "登录状态-首页进入资产详情" entry_page=Entry_page(self.driver) homepage=entry_page.open_login_home_page() time.sleep(2) myInvsetRecorePage=homepage.logic_click_el_invest_img() myInvsetRecorePage.el_tv_know.click() title_text=myInvsetRecorePage.logic_get_invest_title() #截图 entry_page.saveScreenshot('home_financial') #断言 self.assertEquals(title_text,u"投资记录")
def test_consultation_mes(self): """消息中心-咨询消息-展示咨询消息列表""" # 客户登录并进入消息中心列表 entry_page=Entry_page(self.driver) newspage=entry_page.open_news_page() # 点击合同列表页面 newsconsultspage = newspage.click_el_consult_message_btn() newsconsultspage_title=newsconsultspage.el_service_agreement_title.text entry_page.saveScreenshot('consultation_mes') self.assertEqual(newsconsultspage_title,'咨询消息')
def test_transaction_consultation(self): """交易记录-咨询消息验证""" "14114444144" entry_page = Entry_page(self.driver) mytradeRecordPage = entry_page.open_my_tradeRecord_page() mytradeRecordPage.el_trade_Consultation_btn.click() mytradeRecordPage.el_trade_Consultation_list[0].click() #time.sleep(2) title = mytradeRecordPage.logic_get_inquiry_no_test() entry_page.saveScreenshot('transaction_consultation') #断言 self.assertIsNotNone(title)
def test_invest_profit_detailed(self): """投资记录-资产详情-月月付息收益详情""" "账户 15948444448 qwe123" entry_page = Entry_page(self.driver, phone="15948444448",pwd='qwe123') myAssetDetailsPage=entry_page.open_my_assetDetails_quiting_page() My_Invest_Profit_Detailed_page=myAssetDetailsPage.logic_Profit_btn_click() time.sleep(1) entry_page.saveScreenshot('invest_profit_detailed') money=My_Invest_Profit_Detailed_page.logic_get_sum_money() #对金额进行断言 self.assertNotEqual(money,0)