Exemplo n.º 1
0
    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,'资产详情')
Exemplo n.º 2
0
    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,'资产详情')
Exemplo n.º 3
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])

        """
Exemplo n.º 4
0
    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,'资产详情')
Exemplo n.º 5
0
    def test_click_banner1(self):
        u"""验证banner[1]"""

        startUp = StartupPage(self.driver)
        homepage = startUp.page_swipe()
        b = homepage.banner_click(id=1)
        time.sleep(3)
        self.logger.info(b.el_title.text)
        self.basepage = BasePage(self.driver)
        self.basepage.saveScreenshot('click_banner1')
        self.logger.info(self.assertEqual(b.el_title.text, u"系统维护"))
Exemplo n.º 6
0
    def test_click_banner5(self):
        u"""验证banner[5]"""
        # id:输入需要验证的banner 索引ID
        # assertEqual 输入预期的banner详情的title

        startUp = StartupPage(self.driver)
        homepage = startUp.page_swipe()
        b = homepage.banner_click(id=5)
        time.sleep(3)
        self.logger.info(b.el_title.text)
        self.basepage = BasePage(self.driver)
        self.basepage.saveScreenshot('click_banner5')
Exemplo n.º 7
0
    def test_non_login_state_clickMyPage(self):
        '''非登录状态点击“我的”按钮测试用例'''
        startupPage = StartupPage(self.driver)
        homePage = startupPage.page_swipe()
        loginPage = homePage.logic_link_login_page()

        self.basepage = BasePage(self.driver)
        self.basepage.saveScreenshot('non_login_state_clickMyPage')
        self.logger.info(
            "run case:case_login.test_non_login_state_clickMyPage")
        self.assertTrue(loginPage.element_is_exsit(
            loginPage.el_pwd_text_input))
Exemplo n.º 8
0
    def test_non_login_state_clickBuy(self):
        '''非登录态点击“立即投资”按钮测试用例'''
        startupPage = StartupPage(self.driver)
        homePage = startupPage.page_swipe()
        productListPage = homePage.logic_link_product()
        productQuarkzxPage = productListPage.logic_link_quarkZX()
        loginPage = productQuarkzxPage.logic_noLogin_state_buy()

        self.basepage = BasePage(self.driver)
        self.basepage.saveScreenshot('non_login_state_clickBuy')
        self.logger.info("run case:case_login.test_non_login_state_clickBuy")
        self.assertTrue(
            loginPage.element_is_exsit(loginPage.el_phone_text_input))
Exemplo n.º 9
0
    def test_procedure(self):
        '''我的按钮截图对比测试用例'''

        startuppage = StartupPage(self.driver)
        time.sleep(3)
        homepage = startuppage.page_swipe()
        homepage.el_product_btn.click()
        # homepage.get_screenshot_by_element(homepage,"el_home_btn",False)
        result = homepage.get_screenshot_by_element(homepage,
                                                    "el_my_btn").same_as(30)
        # self.driver.save_screenshot("E:\\quark_work\\result\\2017-05-31\\image\\2017-05-31\\" +"test_procedure11"+'.png')

        self.basepage = BasePage(self.driver)
        # if result != False:
        self.basepage.saveScreenshot('procedure')
        time.sleep(2)
Exemplo n.º 10
0
class RegisterTest(InterfaceCase):
    '''注册相关测试用例集'''
    def setUp(self):
        self.driver = self.inital.get_driver()
        self.logger = self.inital.logger

    def test_new_customer(self):
        '''注册新客户,并在我的个人中心,根据手机号断言'''
        user_phone = Create_Data().get_phone()
        user_name = Create_Data().get_name()
        user_id = Create_Data.get_identification()
        user_email = Create_Data.get_random_mail()

        startupPage = StartupPage(self.driver)
        homePage = startupPage.page_swipe()
        loginPage = homePage.logic_link_login_page()
        registerChoosePage = loginPage.logic_link_register()
        registerSmsPage = registerChoosePage.logic_link_new_user()
        registerPasswordPage = registerSmsPage.logic_entry_info(user_phone)
        registerReferencePage = registerPasswordPage.logic_entry_pwd()
        registerPatternlockPage = registerReferencePage.logic_link_hulue()
        registerIdentityAuthPage = registerPatternlockPage.logic_drawGestureCode(
        )
        homePage = registerIdentityAuthPage.logic_entry_user_info(
            user_name, user_id, user_email)

        homePage.el_my_btn.click()
        myPage = homePage.click_el_my_btn()

        #点击浮层
        myPage.el_tv_know.click()

        #断言代码
        myPersonalCenterPage = myPage.logic_link_myCenter()
        phone_text = myPersonalCenterPage.el_phone_text.text
        phone_secret = user_phone[:3] + '****' + user_phone[7:]

        self.basepage = BasePage(self.driver)
        self.basepage.saveScreenshot('new_customer')
        self.assertEqual(phone_text, phone_secret)
        self.logger.info(
            "userinfo:phone-{phone} name-{name} id-{id} email-{email}".format(
                phone=user_phone, name=user_name, id=user_id,
                email=user_email))

    def tearDown(self):
        self.driver.quit()
Exemplo n.º 11
0
    def test_newspage_contract(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()
        #点击出借本金确认书 el_capital_btn
        contractdetailspage.clcik_el_capital_btn()

        contractdetailspage.get_screenshot_by_element(contractdetailspage, 'el_capital_img',isexist=False)  #第一次截图时
        #进行截图对比
        time.sleep(4)
        bool1= contractdetailspage.get_screenshot_by_element(contractdetailspage,'el_capital_img',isexist=True).same_as(percent=30)
        #断言判断
        title=contractdetailspage.el_capitalt_title.text
        self.basepage = BasePage(self.driver)
        self.basepage.saveScreenshot('newspage_contract')
        self.assertTrue(bool1)
        self.assertEqual(title,'出借本金确认书')
Exemplo n.º 12
0
    def test_login_success(self):
        '''登录成功测试用例'''
        user_phone = '14488888098'
        pwd = 'qwe123'

        startupPage = StartupPage(self.driver)
        homePage = startupPage.page_swipe()
        loginPage = homePage.logic_link_login_page()
        homePage = loginPage.logic_login(user_phone, pwd)

        myPage = homePage.click_el_my_btn()
        # 点击浮层
        time.sleep(1)
        myPage.el_tv_know.click()
        # 断言代码
        myPersonalCenterPage = myPage.logic_link_myCenter()
        phone_text = myPersonalCenterPage.el_phone_text.text
        phone_secret = user_phone[:3] + '****' + user_phone[7:]

        self.basepage = BasePage(self.driver)
        self.basepage.saveScreenshot('login_success')
        self.logger.info("run case:case_login.test_login_success")
        self.assertEqual(phone_text, phone_secret)
Exemplo n.º 13
0
    def test_buy_quarkZX90(self):
        '''购买夸客尊享90天测试用例'''
        user_phone=self.inital.excel_info['quarkZX90']['phone']
        pwd=self.inital.excel_info['quarkZX90']['pwd']
        amount=self.inital.excel_info['quarkZX90']['amount']

        startupPage=StartupPage(self.drvier)
        homePage=startupPage.page_swipe()
        loginPage=homePage.logic_link_login_page()
        homePage=loginPage.logic_login(user_phone,pwd)
        #点击一次理财产品元素,过滤蒙层
        homePage.el_product_btn.click()
        time.sleep(0.5)
        productListPage=homePage.logic_link_product()
        productQuarkzxPage=productListPage.logic_link_quarkZX()
        productQuarkzxPage.logic_choose_product_type(3)
        buyInsertMoneyPage=productQuarkzxPage.logic_link_buy()

        buyConfirmPage=buyInsertMoneyPage.logic_buy_product(amount)
        buyTradeResultPage=buyConfirmPage.logic_confirm_info(pwd)
        time.sleep(20)
        homePage=buyTradeResultPage.logic_link_buy()
        myPage=homePage.logic_buy_my_btn()

        #数据库断言,查询投资记录最新的记录根据金额判断
        SQL="select top(1) m.new_managemoney,m.new_product_name from dbo.Account t,dbo.new_investdetail m where t.name=m.new_accountnameName and t.new_telephone1=%s ORDER BY m.CreatedOn DESC" %(user_phone)
        sql_conn=Exce_SQLserver()

        sql_result = sql_conn.execSql_getOne(SQL)
        sql_amount = int(sql_result[0])
        sql_product_name = str(sql_result[1])

        self.basepage = BasePage(self.drvier)
        self.basepage.saveScreenshot('buy_quarkZX90')
        self.assertEqual(int(amount),sql_amount)
        self.assertEqual("夸客尊享*90天",sql_product_name)
        self.logger.info("run case:test_buy_quarkZX90")
Exemplo n.º 14
0
class hometest(InterfaceCase):
    u"""首页模块验证"""
    """
    setup():每个测试case运行前运行
    teardown():每个测试case运行完后执行
    setUpClass():必须使用@classmethod 装饰器,所有case运行前只运行一次
    tearDownClass():必须使用@classmethod装饰器,所有case运行完后只运行一次
    """
    def setUp(self):
        self.driver = self.inital.get_driver()
        self.logger = self.inital.logger

    #id:输入需要验证的banner 索引ID
    #assertEqual 输入预期的banner详情的title

    def test_click_banner1(self):
        u"""验证banner[1]"""

        startUp = StartupPage(self.driver)
        homepage = startUp.page_swipe()
        b = homepage.banner_click(id=1)
        time.sleep(3)
        self.logger.info(b.el_title.text)
        self.basepage = BasePage(self.driver)
        self.basepage.saveScreenshot('click_banner1')
        self.logger.info(self.assertEqual(b.el_title.text, u"系统维护"))
        #self.assertEqual(b.el_title.text, u"系统维护")

    def test_click_banner3(self):
        u"""验证banner[3]"""

        # id:输入需要验证的banner 索引ID
        # assertEqual 输入预期的banner详情的title

        startUp = StartupPage(self.driver)
        homepage = startUp.page_swipe()
        b = homepage.banner_click(id=3)
        time.sleep(1)
        self.logger.info(b.el_title.text)
        self.basepage = BasePage(self.driver)
        self.basepage.saveScreenshot('click_banner3')

    # self.assertEqual(b.el_title.text, u"夸客美丽增值计划")

    def test_click_banner5(self):
        u"""验证banner[5]"""
        # id:输入需要验证的banner 索引ID
        # assertEqual 输入预期的banner详情的title

        startUp = StartupPage(self.driver)
        homepage = startUp.page_swipe()
        b = homepage.banner_click(id=5)
        time.sleep(3)
        self.logger.info(b.el_title.text)
        self.basepage = BasePage(self.driver)
        self.basepage.saveScreenshot('click_banner5')

    # self.assertEqual(b.el_title.text, u"新春心意")

    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_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_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_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 tearDown(self):
        self.driver.quit()
Exemplo n.º 15
0
class GFtest(InterfaceCase):
    '''截图对比测试集'''
    def setUp(self):

        self.driver = self.inital.get_driver()
        self.logger = self.inital.logger

    @unittest.skip('skip')
    def test_procedure(self):
        '''我的按钮截图对比测试用例'''

        startuppage = StartupPage(self.driver)
        time.sleep(3)
        homepage = startuppage.page_swipe()
        homepage.el_product_btn.click()
        # homepage.get_screenshot_by_element(homepage,"el_home_btn",False)
        result = homepage.get_screenshot_by_element(homepage,
                                                    "el_my_btn").same_as(30)
        # self.driver.save_screenshot("E:\\quark_work\\result\\2017-05-31\\image\\2017-05-31\\" +"test_procedure11"+'.png')

        self.basepage = BasePage(self.driver)
        # if result != False:
        self.basepage.saveScreenshot('procedure')
        time.sleep(2)
        #self.assertTrue(result)
        #self.assertTrue(result)

    @unittest.skip('skip')
    def test_converged(self):
        convergedPage = ConvergedPage(self.driver)
        (user_phone, user_pwd) = convergedPage.register_customer()

        self.driver = appium_init.inital.get_driver()
        startupPage = StartupPage(self.driver)
        homePage = startupPage.page_swipe()
        loginPage = homePage.logic_link_login_page()
        homePage = loginPage.logic_login(user_phone, user_pwd)

        myPage = homePage.click_el_my_btn()
        # 点击浮层
        time.sleep(1)
        myPage.el_tv_know.click()
        # 断言代码
        myPersonalCenterPage = myPage.logic_link_myCenter()
        myPersonalCenterPage.saveScreenshot('myPersonalCenterPage')

    def test_delete_card(self):
        user_name = 'ufo83'
        user_phone = '14488888083'
        user_pwd = '123456q'

        startupPage = StartupPage(self.driver)
        homePage = startupPage.page_swipe()
        loginPage = homePage.logic_link_login_page()
        homePage = loginPage.logic_login(user_phone, user_pwd)

        myPage = homePage.click_el_my_btn()
        # 点击浮层
        time.sleep(1)
        myPage.el_tv_know.click()

        myBankCardPage = myPage.logic_my_bankCard_click()
        bankCardInfoPage = myBankCardPage.logic_link_bankcardInfo_page()
        bankCardInfoPage.el_delete_btn.click()
        time.sleep(5)

    def tearDown(self):
        self.driver.quit()
Exemplo n.º 16
0
class InvestRecord(InterfaceCase):

    """投资记录模块验证"""


    def setUp(self):
        self.driver = self.inital.get_driver()
        self.logger = self.inital.logger


    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_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_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_quiting_list(self):
        "投资记录-退出中列表数据验证"

        entry_page = Entry_page(self.driver)
        myinvsetrecorepage = entry_page.open_my_invset_recore_Page()
        time.sleep(0.2)
        myinvsetrecorepage.el_drop_out_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 = '24004F6C-7C08-E711-80C9-00155D01F903' AND  new_status=100000003 order BY  new_paidon desc")

        entry_page.saveScreenshot('test_quiting_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"))

        # 断言结息日
        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_invest_contract_no1(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=0)
        title=electronic_contract_page.logic_get_contract_details_title()
        entry_page.saveScreenshot('invest_contract_no1')
        self.assertEquals(title,"出借咨询与服务协议")


    def test_invest_contract_no2(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=1)
        title = electronic_contract_page.logic_get_contract_details_title()
        entry_page.saveScreenshot('invest_contract_no2')
        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_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_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)


    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_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_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 tearDown(self):
        self.driver.quit()
Exemplo n.º 17
0
class NewsMesg(InterfaceCase):
    """消息中心模块验证"""

    def setUp(self):
        self.driver = self.inital.get_driver()
        self.logger = self.inital.logger


    def test_newspage_contract(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()
        #点击出借本金确认书 el_capital_btn
        contractdetailspage.clcik_el_capital_btn()

        contractdetailspage.get_screenshot_by_element(contractdetailspage, 'el_capital_img',isexist=False)  #第一次截图时
        #进行截图对比
        time.sleep(4)
        bool1= contractdetailspage.get_screenshot_by_element(contractdetailspage,'el_capital_img',isexist=True).same_as(percent=30)
        #断言判断
        title=contractdetailspage.el_capitalt_title.text
        self.basepage = BasePage(self.driver)
        self.basepage.saveScreenshot('newspage_contract')
        self.assertTrue(bool1)
        self.assertEqual(title,'出借本金确认书')


    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_contract_details_no2(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_confirmation_btn.click()

        title = contractdetailspage.el_capitalt_title.text
        entry_page.saveScreenshot("contract_details_no1")

        self.assertEquals("授权委托书-出借确认和债权转让",title)

    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_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])

        """
        [u'\u5938\u5ba2\u5c0a\u4eab', u'2017-05-22', u'UF201500009497', u'90\u5929']
        [(u'\u5938\u5ba2\u5c0a\u4eab*90\u5929', datetime.datetime(2017, 5, 22, 10, 39, 4), u'UF201500009497', 90)]
        """


    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 tearDown(self):
        self.driver.quit()
Exemplo n.º 18
0
class LoginTest(InterfaceCase):
    '''登录模块验证'''
    def setUp(self):
        self.driver = self.inital.get_driver()
        self.logger = self.inital.logger

    #@unittest.skip('skip')
    def test_non_login_state_clickBuy(self):
        '''非登录态点击“立即投资”按钮测试用例'''
        startupPage = StartupPage(self.driver)
        homePage = startupPage.page_swipe()
        productListPage = homePage.logic_link_product()
        productQuarkzxPage = productListPage.logic_link_quarkZX()
        loginPage = productQuarkzxPage.logic_noLogin_state_buy()

        self.basepage = BasePage(self.driver)
        self.basepage.saveScreenshot('non_login_state_clickBuy')
        self.logger.info("run case:case_login.test_non_login_state_clickBuy")
        self.assertTrue(
            loginPage.element_is_exsit(loginPage.el_phone_text_input))

    #@unittest.skip('skip')
    def test_non_login_state_calculation(self):
        '''非登录状态点击理财计算器测试用例'''
        startupPage = StartupPage(self.driver)
        homePage = startupPage.page_swipe()
        productListPage = homePage.logic_link_product()
        productQuarkzxPage = productListPage.logic_link_quarkZX()
        productCalculationPage = productQuarkzxPage.logic_link_calculation_Page(
        )
        page_title = productCalculationPage.el_title.text
        productCalculationPage.saveScreenshot(
            'test_non_login_state_calculation')
        self.logger.info(
            "run case:case_login.test_non_login_state_calculation")
        self.assertEqual(page_title, '理财计算器')

    #@unittest.skip("2")
    def test_non_login_state_clickFund(self):
        '''非登录状态点击基金列表'''
        startupPage = StartupPage(self.driver)
        homePage = startupPage.page_swipe()
        productListPage = homePage.logic_link_product()
        loginPage = productListPage.logic_nologin_state_fund()
        page_title = loginPage.el_title.text
        loginPage.saveScreenshot('test_non_login_state_clickFund')
        self.logger.info("run case:case_login.test_non_login_state_clickFund")
        self.assertEqual(page_title, u'登录')

    #@unittest.skip("2")
    def test_non_login_state_clickReinvsetment(self):
        '''非登录状态点击续投列表'''
        startupPage = StartupPage(self.driver)
        homePage = startupPage.page_swipe()
        productListPage = homePage.logic_link_product()
        loginPage = productListPage.logic_nologin_state_reinvestment()

        page_title = loginPage.el_title.text
        loginPage.saveScreenshot('test_non_login_state_clickFund')
        self.logger.info(
            "run case:case_login.test_non_login_state_clickReinvsetment")
        self.assertEqual(page_title, u'登录')

    #@unittest.skip('skip')
    def test_non_login_state_clickMyPage(self):
        '''非登录状态点击“我的”按钮测试用例'''
        startupPage = StartupPage(self.driver)
        homePage = startupPage.page_swipe()
        loginPage = homePage.logic_link_login_page()

        self.basepage = BasePage(self.driver)
        self.basepage.saveScreenshot('non_login_state_clickMyPage')
        self.logger.info(
            "run case:case_login.test_non_login_state_clickMyPage")
        self.assertTrue(loginPage.element_is_exsit(
            loginPage.el_pwd_text_input))

    #@unittest.skip('skip')
    def test_login_success(self):
        '''登录成功测试用例'''
        user_phone = '14488888098'
        pwd = 'qwe123'

        startupPage = StartupPage(self.driver)
        homePage = startupPage.page_swipe()
        loginPage = homePage.logic_link_login_page()
        homePage = loginPage.logic_login(user_phone, pwd)

        myPage = homePage.click_el_my_btn()
        # 点击浮层
        time.sleep(1)
        myPage.el_tv_know.click()
        # 断言代码
        myPersonalCenterPage = myPage.logic_link_myCenter()
        phone_text = myPersonalCenterPage.el_phone_text.text
        phone_secret = user_phone[:3] + '****' + user_phone[7:]

        self.basepage = BasePage(self.driver)
        self.basepage.saveScreenshot('login_success')
        self.logger.info("run case:case_login.test_login_success")
        self.assertEqual(phone_text, phone_secret)

    def test_Forgot_password(self):
        """找回密码验证"""
        entry_page = Entry_page(self.driver)
        forget_Pass = entry_page.open_forget_pass_page()
        forget_Pass.el_edit_phone.send_keys(entry_page.phone)
        forget_Pass.el_get_verify.click()
        message = Message()
        yanzma = message.get_sms(entry_page.phone)
        forget_Pass.el_edit_yanzheng.send_keys(yanzma)
        forget_Pass.el_tv_nextstepself.click()

        sql = Exce_SQLserver()
        contract_number = sql.execSql_getList(
            "SELECT Name,new_certificatenum FROM AccountBase WHERE  new_telephone1={phone}"
            .format(phone=entry_page.phone))
        forget_Pass.el_edit_phone.send_keys(contract_number[0][0])
        forget_Pass.el_edit_yanzheng.send_keys(contract_number[0][1])
        forget_Pass.el_tv_nextstepself.click()
        forget_Pass.el_edit_password.send_keys("qwe1234")
        forget_Pass.el_edit_reinput.send_keys("qwe1234")
        loginPage = forget_Pass.logic_tv_nextstepself_click()
        #loginPage=homePage.logic_buy_my_btn()

        forget_Pass = loginPage.logic_el_forget_pass_click()
        forget_Pass.el_edit_phone.send_keys(entry_page.phone)
        forget_Pass.el_get_verify.click()
        message = Message()
        yanzma = message.get_sms(entry_page.phone)
        forget_Pass.el_edit_yanzheng.send_keys(yanzma)
        forget_Pass.el_tv_nextstepself.click()

        #sql = Exce_SQLserver()
        # contract_number = sql.execSql_getList("SELECT Name,new_certificatenum FROM AccountBase WHERE  new_telephone1={phone}".format(phone=entry_page.phone))
        forget_Pass.el_edit_phone.send_keys(contract_number[0][0])
        forget_Pass.el_edit_yanzheng.send_keys(contract_number[0][1])
        forget_Pass.el_tv_nextstepself.click()
        forget_Pass.el_edit_password.send_keys("qwe123")
        forget_Pass.el_edit_reinput.send_keys("qwe123")
        self.assertEquals(forget_Pass.el_tb_title.text, '找回密码')
        forget_Pass.el_tv_nextstepself.click()

        entry_page.saveScreenshot("Forgot_password")

    def tearDown(self):
        self.driver.quit()