Exemplo n.º 1
0
    def IntoPurse(driver):
        """
        先决条件:进入我家页面
        :return: None
        """
        # 测试点击我的钱包进入我的钱包页面
        Public_Page.NomalTest(driver, title="我的钱包",
                              MainWait_Element=".modules.main.views.activities.MainActivity",
                              find_element_id="com.pujitech.pujiejia:id/tv_user_wallet",
                              Wait_Element=".modules.wallet.views.activitys.MyWalletActivity",
                              check_element_id="com.pujitech.pujiejia:id/tv_title")

        # 测试点击我的钱包额度进入我的钱包页面
        Public_Page.NomalTest(driver, title="我的钱包",
                              MainWait_Element=".modules.main.views.activities.MainActivity",
                              find_element_id="com.pujitech.pujiejia:id/tv_wallet",
                              Wait_Element=".modules.wallet.views.activitys.MyWalletActivity",
                              check_element_id="com.pujitech.pujiejia:id/tv_title",
                              YESBack=False)

        # 点击余额说明
        Public_Page.NomalTest(driver, title="余额说明",
                              MainWait_Element=".modules.wallet.views.activitys.MyWalletActivity",
                              find_element_id="com.pujitech.pujiejia:id/my_wallet_yue_shuoming_tv",
                              Wait_Element=".modules.help.view.activities.HelpActivity",
                              check_element_id="com.pujitech.pujiejia:id/tv_title")

        # 点击去充值
        Public_Page.NomalTest(driver, title="余额充值",
                              MainWait_Element=".modules.wallet.views.activitys.MyWalletActivity",
                              find_element_id="com.pujitech.pujiejia:id/my_wallet_qu_chongzhi_btn",
                              Wait_Element=".modules.wallet.views.activitys.MyWalletYuEChongzhiActivity",
                              check_element_id="com.pujitech.pujiejia:id/tv_title")

        # 下滑查看余额明细
        driver.wait_activity(".modules.wallet.views.activitys.MyWalletActivity", 30)
        time.sleep(2)
        driver.swipe(500, 1700, 500, 1000)
        time.sleep(2)
        driver.swipe(500, 1700, 500, 1000)

        # 点击更多明细(并下滑查看数据)
        Public_Page.NomalTest(driver, title="更多明细",
                              MainWait_Element=".modules.wallet.views.activitys.MyWalletActivity",
                              find_element_id="com.pujitech.pujiejia:id/my_wallet_more_mingxi_tv",
                              Wait_Element=".modules.wallet.views.activitys.MyWalletMoreMingxiActivity",
                              check_element_id="com.pujitech.pujiejia:id/tv_title",
                              YESBack=False)

        huadong.shanghua(driver, 1000)
        time.sleep(3)
        huadong.shanghua(driver, 1000)
        time.sleep(3)
        huadong.shanghua(driver, 1000)
        time.sleep(3)
        driver.find_element_by_id("com.pujitech.pujiejia:id/iv_back").click()
        # 退回到我的钱包页面
        time.sleep(2)
        driver.find_element_by_id("com.pujitech.pujiejia:id/iv_back").click()
Exemplo n.º 2
0
    def FYMtest(driver):
        Public_Page.Switch_Navigation(driver, tab= "实地派")
        time.sleep(1)

        #Public_Page.RandomBuilding(driver)
        Public_Page.ChoiceBuilding(driver, Building = "常春藤")
        time.sleep(2)

        Loginin.Loginin_nomal(driver)

        time.sleep(2)

        allapp = driver.find_elements_by_id("com.pujitech.pujiejia:id/tv_app_name")

        for i in allapp:
            if i.text == "房间绑定":
                fangjianbangding = i
                break

        Public_Page.NomalTest(driver, title="房间绑定",
                              MainWait_Element=".modules.main.views.activities.MainActivity",
                              find_element_id= fangjianbangding,
                              Wait_Element=".modules.roombind.views.activitys.RoomBindActivity",
                              check_element_id="com.pujitech.pujiejia:id/tv_title"
                              )

        Public_Page.Dengchu(driver)
Exemplo n.º 3
0
    def WoJiaOrder(driver):
        """
        先决条件:进入我家页面
        :return: None
        """
        try:
            time.sleep(3)
            orderNo = driver.find_elements_by_id(
                "com.pujitech.pujiejia:id/tv_order_number")[0]
            #[0]取第一个订单
            print(orderNo)
            print(orderNo.text)
            if "订单号" not in orderNo.text:
                pass
            else:
                Public_Page.NomalTest(
                    driver,
                    title="订单详情",
                    MainWait_Element=
                    ".modules.main.views.activities.MainActivity",
                    find_element_id=orderNo,
                    Wait_Element=
                    ".modules.usercenter.order.views.activities.OrderDetailsActivity",
                    check_element_id="com.pujitech.pujiejia:id/tv_title")
            unittest_TestResult = True

        except:
            unittest_TestResult = False
        finally:
            return unittest_TestResult
    def ClickMyOrder(driver):
        """
        进入我的订单页面,脚本执行完成后返回我家页面
        :return: None
        """
        """
        订单状态:配送中  待自提  已完成  已退款  已取消  待支付  待受理  已受理  
        """
        orderstatus = ['配送中', '待自提', '已完成', '已退款', '已取消', '待支付', '待受理', '已受理']
        for status in orderstatus:
            time.sleep(2)
            order = driver.find_elements_by_id(
                "com.pujitech.pujiejia:id/order_state")
            for i in order:
                if i.text == status:
                    Public_Page.NomalTest(
                        driver,
                        title="订单详情",
                        MainWait_Element=
                        ".modules.usercenter.order.views.activities.OrderListActivity",
                        find_element_id=i,
                        Wait_Element=
                        ".modules.usercenter.order.views.activities.OrderDetailsActivity",
                        check_element_id="com.pujitech.pujiejia:id/tv_title",
                        YESBack=False)

                    Public_Page.NomalTest(
                        driver,
                        title="订单状态跟踪",
                        MainWait_Element=
                        ".modules.usercenter.order.views.activities.OrderDetailsActivity",
                        find_element_id=
                        "com.pujitech.pujiejia:id/tv_more_status",
                        Wait_Element=
                        ".modules.usercenter.order.views.activities.OrderStatusActivity",
                        check_element_id="com.pujitech.pujiejia:id/tv_title",
                        TestCase=status + "订单")
                    time.sleep(1)
                    driver.find_element_by_id(
                        "com.pujitech.pujiejia:id/iv_back").click()
                    break

        driver.find_element_by_id("com.pujitech.pujiejia:id/iv_back").click()
        #返回我家页面
        '''
 def SmartBandInstruction(driver):
     """
     点击智能手环的使用说明
     先决条件:进入我家页面
     :return: None
     """
     Public_Page.NomalTest(driver, title = "使用说明",
                           MainWait_Element = ".modules.main.views.activities.MainActivity",
                           find_element_id = "com.pujitech.pujiejia:id/btn_brand_instruction",
                           Wait_Element = ".modules.help.view.activities.HelpActivity",
                           check_element_id = "com.pujitech.pujiejia:id/tv_title")
Exemplo n.º 6
0
    def IntoCoupon(driver):
        """
        先决条件:进入我家页面
        :return: None
        """

        #测试点击我的优惠券进入我的优惠券页面
        Public_Page.NomalTest(
            driver,
            title="我的优惠券",
            MainWait_Element=".modules.main.views.activities.MainActivity",
            find_element_id="com.pujitech.pujiejia:id/rl_user_coupon_container",
            Wait_Element=
            ".modules.usercenter.coupon.view.activities.AvailableCouponActivity",
            check_element_id="com.pujitech.pujiejia:id/tv_title",
            YESBack=False)

        #点击优惠券使用说明
        Public_Page.NomalTest(
            driver,
            title="使用说明",
            MainWait_Element=
            ".modules.usercenter.coupon.view.activities.AvailableCouponActivity",
            find_element_id="com.pujitech.pujiejia:id/tv_coupon_top",
            Wait_Element=".modules.help.view.activities.HelpActivity",
            check_element_id="com.pujitech.pujiejia:id/tv_title",
        )
        #查看无效优惠券
        Public_Page.NomalTest(
            driver,
            title="无效优惠券",
            MainWait_Element=
            ".modules.usercenter.coupon.view.activities.AvailableCouponActivity",
            find_element_id="com.pujitech.pujiejia:id/tv_bottom_coupon",
            Wait_Element=
            ".modules.usercenter.coupon.view.activities.UnAvailableCouponActivity",
            check_element_id="com.pujitech.pujiejia:id/tv_title",
        )

        time.sleep(3)
        driver.find_element_by_id("com.pujitech.pujiejia:id/iv_back").click()
    def MyHome_two(driver):
        #测试我的消息页面是否正常显示
        Public_Page.NomalTest(driver, title = "我的消息",
                              MainWait_Element = ".modules.main.views.activities.MainActivity",
                              find_element_id = "com.pujitech.pujiejia:id/iv_message",
                              Wait_Element = ".modules.h5.views.activitys.CommonH5Activity",
                              check_element_id = "com.pujitech.pujiejia:id/tv_title"
                              )

        #测试设置页面是否正确显示
        Public_Page.NomalTest(driver, title = "设置",
                              MainWait_Element = ".modules.main.views.activities.MainActivity",
                              find_element_id = "com.pujitech.pujiejia:id/iv_setting",
                              Wait_Element = ".modules.usercenter.setting.views.activities.SettingActivity",
                              check_element_id = "com.pujitech.pujiejia:id/tv_title"
                              )

        #点击头像图片进入个人资料页面
        Public_Page.NomalTest(driver, title = "个人资料",
                              MainWait_Element = ".modules.main.views.activities.MainActivity",
                              find_element_id = "com.pujitech.pujiejia:id/iv_avatar",
                              Wait_Element = ".modules.usercenter.selfinfo.views.activities.SelfInfoActivity",
                              check_element_id = "com.pujitech.pujiejia:id/tv_title"
                              )

        #点击用户名称进入个人资料页面
        Public_Page.NomalTest(driver, title = "个人资料",
                              MainWait_Element = ".modules.main.views.activities.MainActivity",
                              find_element_id = "com.pujitech.pujiejia:id/tv_user_center_name",
                              Wait_Element = ".modules.usercenter.selfinfo.views.activities.SelfInfoActivity",
                              check_element_id = "com.pujitech.pujiejia:id/tv_title"
                              )

        #点击用户手机号进入个人资料页面
        Public_Page.NomalTest(driver, title = "个人资料",
                              MainWait_Element = ".modules.main.views.activities.MainActivity",
                              find_element_id = "com.pujitech.pujiejia:id/tv_user_center_phone",
                              Wait_Element = ".modules.usercenter.selfinfo.views.activities.SelfInfoActivity",
                              check_element_id = "com.pujitech.pujiejia:id/tv_title"
                              )
 def AllOrder(driver):
     """
     先决条件: 进入我家页面
     :return: None
     """
     time.sleep(2)
     #点击全部订单进入我的订单页面
     Public_Page.NomalTest(
         driver,
         title="我的订单",
         MainWait_Element=".modules.main.views.activities.MainActivity",
         find_element_id="com.pujitech.pujiejia:id/ll_all_order_container",
         Wait_Element=
         ".modules.usercenter.order.views.activities.OrderListActivity",
         check_element_id="com.pujitech.pujiejia:id/tv_title",
         YESBack=False)
Exemplo n.º 9
0
    def MyApplication(driver, AppName, wojia=False):
        """
        先决条件:进入我家页面
        从我家页面进入需要带参数 wojia = True 这样取的activity就是我家页面的activity
        :return: None
        """
        if wojia == True:
            MainActivity = ".modules.main.views.activities.MainActivity"
            driver.wait_activity("%s" % MainActivity, 30)
            time.sleep(1)
        else:
            MainActivity = ".modules.usercenter.allapp.views.activitys.AllApplicationActivity"
            driver.wait_activity("%s" % MainActivity, 30)
            time.sleep(1)

        Allname = driver.find_elements_by_id(
            "com.pujitech.pujiejia:id/tv_app_name")
        noin = ["投诉建议", "房屋报修", "访客邀请"]
        for i in Allname:
            if i.text == AppName:
                if i.text in noin:
                    i.click()
                    try:
                        Public_Page.NoHomeInThisBuilding(driver)
                    #在该小区没有认证房间
                    except:
                        Public_Page.ExitBack(driver)
                    break
                elif i.text == "智能家居":
                    Public_Page.NomalTest(
                        driver,
                        title="我的网关",
                        MainWait_Element="%s" % MainActivity,
                        find_element_id=i,
                        Wait_Element="com.pujitech.atsmarthome.MySipActivity",
                        check_element_id=
                        "com.pujitech.pujiejia:id/tv_base_title",
                        TestCase=i.text)
                    break
                elif i.text == "我的购物车":
                    Public_Page.NomalTest(
                        driver,
                        title=i.text,
                        MainWait_Element="%s" % MainActivity,
                        find_element_id=i,
                        Wait_Element=
                        ".modules.shoppingcar.views.activities.MyShoppingCarActivity",
                        check_element_id="com.pujitech.pujiejia:id/tv_title")
                    break
                elif i.text == "房间绑定":
                    Public_Page.NomalTest(
                        driver,
                        title=i.text,
                        MainWait_Element="%s" % MainActivity,
                        find_element_id=i,
                        Wait_Element=
                        ".modules.roombind.views.activitys.RoomBindActivity",
                        check_element_id="com.pujitech.pujiejia:id/tv_title")
                    break
                elif i.text == "社区服务":
                    Public_Page.NomalTest(
                        driver,
                        title=i.text,
                        MainWait_Element="%s" % MainActivity,
                        find_element_id=i,
                        Wait_Element=
                        ".modules.usercenter.community.views.activities.CommunityHomeActivity",
                        check_element_id="com.pujitech.pujiejia:id/tv_title")
                    break
                elif i.text == "人脸识别":
                    Public_Page.NomalTest(
                        driver,
                        title=i.text,
                        MainWait_Element="%s" % MainActivity,
                        find_element_id=i,
                        Wait_Element=
                        ".modules.facerecognition.views.activities.RecognitionProtocolActivity",
                        check_element_id="com.pujitech.pujiejia:id/tv_title")
                    break
                elif i.text == "商家收藏":
                    Public_Page.NomalTest(
                        driver,
                        title=i.text,
                        MainWait_Element="%s" % MainActivity,
                        find_element_id=i,
                        Wait_Element=
                        ".modules.usercenter.collection.views.activities.CollectionActivity",
                        check_element_id="com.pujitech.pujiejia:id/tv_title")
                    break
                elif i.text == "我的家书" or i.text == "我的关注" or i.text == "我的评价" or i.text == "我的帖子":
                    Public_Page.NomalTest(
                        driver,
                        title=i.text,
                        MainWait_Element="%s" % MainActivity,
                        find_element_id=i,
                        Wait_Element=
                        ".modules.h5.views.activitys.CommonH5Activity",
                        check_element_id="com.pujitech.pujiejia:id/tv_title")
                    break