示例#1
0
    def test_buy_Beauti(self):
        '''购买美丽田园测试用例'''
        convergedPage=ConvergedPage(self.drvier)
        (user_phone,pwd)=convergedPage.register_customer()

        amount='100000'

        self.drvier=appium_init.inital.get_driver()
        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()
        time.sleep(2)
        productListPage.swipe_to_up()
        time.sleep(2)
        productBeautiPage = productListPage.logic_link_beauti()
        buyInsertMoneyPage=productBeautiPage.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])

        buyTradeResultPage.saveScreenshot('test_buy_Beauti')
        self.assertEqual(int(amount), sql_amount)

        self.logger.info("run case:test_buy_Beauti user_phone is %s,product_name is %s" %(user_phone,sql_product_name))
        self.assertEqual("夸客美丽*360天", sql_product_name)
示例#2
0
    def test_buy_annualInterestRise(self):
        '''购买年年生利用例'''
        user_phone = self.inital.excel_info['annualInterestRise']['phone']
        pwd = self.inital.excel_info['annualInterestRise']['pwd']
        amount = self.inital.excel_info['annualInterestRise']['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()
        time.sleep(1)
        productListPage.swipe_to_up()
        time.sleep(1)
        productAnnualInterestRisePage = productListPage.logic_link_annualInterestRise(
        )
        buyInsertMoneyPage = productAnnualInterestRisePage.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])

        buyTradeResultPage.saveScreenshot('test_buy_annualInterestRise')
        self.assertEqual(int(amount), sql_amount)
        self.logger.info(
            "run case:ProductBuyAnnualInterestRise.test_buy_annualInterestRise user_phone is %s,product_name is %s"
            % (user_phone, sql_product_name))
        self.assertEqual("年年生利*360天", sql_product_name)
示例#3
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")
示例#4
0
    def test_buy_van_Gogh180(self):
        '''购买梵高计划180天脚本,和buy_prodouct_info.xlsx数据源对应'''

        user_phone = self.inital.buyProduct_info['van_Gogh180']['phone']
        pwd = self.inital.buyProduct_info['van_Gogh180']['pwd']
        amount = self.inital.buyProduct_info['van_Gogh180']['amount']
        times = self.inital.buyProduct_info['van_Gogh180']['times']
        exec_flag = self.inital.buyProduct_info['van_Gogh180']['exec']
        load_create = self.inital.buyProduct_info['van_Gogh180']['load_create']

        if amount == "" or times == "" or exec_flag == "" or load_create == "":
            self.logger.info(
                "BuyProductScriptVanGogh.test_buy_van_Gogh180: buy_info excel parms is wrong!"
            )
            return "buy_info excel parms is wrong!"

        elif exec_flag == 'N' or times == '0':
            self.logger.info(
                'BuyProductScriptVanGogh.test_buy_van_Gogh180: do not buy product van_Gogh180!'
            )
            return "do not buy product van_Gogh180!"

        if load_create == 'N':
            self.driver = self.inital.get_driver()
            convergedPage = ConvergedPage(self.driver)
            user_phone, pwd = convergedPage.register_customer()

        elif load_create == "Y" and (user_phone == "" or pwd == ""):
            self.logger.info(
                "BuyProductScriptVanGogh.test_buy_van_Gogh180: user_phone pwd value can not be null!"
            )
            return "BuyProductScriptVanGogh.test_buy_van_Gogh180: user_phone pwd value can not be null!"

        for i in xrange(int(times)):
            try:
                self.driver = self.inital.get_driver()
                startupPage = StartupPage(self.driver)
                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()
                productVanGoghPage = productListPage.logic_link_van_Gogh()
                productVanGoghPage.logic_choose_product_type(1)

                buyInsertMoneyPage = productVanGoghPage.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_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_productNo = str(sql_result[1])

                self.logger.info(
                    "BuyProductScriptVanGogh.test_buy_van_Gogh180:run {one} time;"
                    "phone is {two};"
                    "pwd is {three};"
                    "product is {four};"
                    "amount is {five}".format(one=(i + 1),
                                              two=user_phone,
                                              three=pwd,
                                              four=sql_productNo,
                                              five=sql_amount))
            except Exception as e:
                self.logger.info("buy_van_Gogh180 failed!" + str(e))
            finally:
                self.driver.quit()