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.º 2
0
    def IntoCoupon(driver):
        """
        先决条件:进入我家页面
        :return: None
        """
        try:
            time.sleep(1)
            #测试点击我的优惠券进入我的优惠券页面
            Public_Page.debug_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.debug_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.debug_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()
            #退回到我家页面
            unittest_TestResult = True

        except:
            time.sleep(1)
            driver.find_element_by_id(
                "com.pujitech.pujiejia:id/iv_back").click()
            unittest_TestResult = False
        finally:
            return unittest_TestResult
 def Loginin_nomal(driver, username, password):
     """
     测试平时登录账户(在已有楼盘下账户未登录状态)
     :param username: 手机号
     :param password: 密码必须传入字符串"00000000"
     :return:None
     """
     try:
         MyHome.IntoDengLuPage(driver)
         jieguo = Public_Page.DengLu(driver, username, password)
         if jieguo == True:
             print("执行用例..............................登录哈奇账户%s成功" %
                   username)
         else:
             print("执行用例..............................登录哈奇账户%s失败" %
                   username)
     except:
         pass
    def AddAddress(driver):
        """
        先决条件:进入
        """
        try:
            Contact = Public_Page.CrateName(1)[0]
            #联系人姓名
            driver.wait_activity(".modules.usercenter.address.views.activites.AddAddressActivity", 30)
            time.sleep(2)

            driver.find_element_by_id("com.pujitech.pujiejia:id/et_contact_username").send_keys("%s"%Contact)
            #输入联系人姓名
            time.sleep(3)

            driver.find_element_by_id("com.pujitech.pujiejia:id/et_contact_telephone").send_keys("%s"%Public_Page.CratePhoneNo(1)[0])
            time.sleep(3)

            address = "北京市朝阳区慧忠里%s号"%(random.randint(1000, 9999))

            inputmode = driver.find_element_by_id("com.pujitech.pujiejia:id/tv_input_mode")
            #print (inputmode.text)
            if inputmode.text == "手动输入地址":
                time.sleep(2)
                inputmode.click()

            time.sleep(3)
            driver.find_element_by_id("com.pujitech.pujiejia:id/et_detail_address").send_keys("%s"%address)
            #定位详细地址

            #time.sleep(2)
            #driver.tap([(988, 1132)])
            #隐藏键盘操作(VIVOX9)
            #988,1132

            time.sleep(2)
            driver.find_element_by_id("com.pujitech.pujiejia:id/btn_save_address").click()
            #点击保存com.pujitech.pujiejia:id/btn_save_address
            return Contact

        except:
            pass
 def WoJiaOrder(driver):
     """
     先决条件:进入我家页面
     :return: None
     """
     time.sleep(3)
     orderNo = driver.find_elements_by_id(
         "com.pujitech.pujiejia:id/tv_order_number")[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")
    def OnceIntoLogin(driver):
        try:
            try:
                driver.wait_activity(
                    ".modules.splash.views.activities.GuideActivity", 30)
                time.sleep(1)
            except:
                time.sleep(5)
                pass
            driver.find_element_by_id(
                "com.pujitech.pujiejia:id/btn_to_login").click()
            #点击登录按钮
            result = Public_Page.DengLu(driver, 13263160105, "00000000")

            if result == True:
                print("执行用例..............................登录哈奇账户成功")
            else:
                print("执行用例..............................登录哈奇账户失败")
        except:
            print("执行用例..............................登录哈奇账户失败")
            pass
Exemplo n.º 7
0
    def SheQuFuWu(driver):
        """
        首页实地派下社区服务模块,
        包括物业缴费,限时促销,精品团购
        :return: None
        """
        time.sleep(2)
        try:
            Public_Page.debug_NomalTest(
                driver,
                title="物业缴费",
                MainWait_Element=".modules.main.views.activities.MainActivity",
                find_element_id="com.pujitech.pujiejia:id/tv_modules_name",
                Wait_Element=
                ".modules.usercenter.community.views.activities.PropertyPaymentHomeActivity",
                check_element_id="com.pujitech.pujiejia:id/tv_title",
                TestCase="物业缴费")

            time.sleep(2)

            Public_Page.debug_NomalTest(
                driver,
                title="限时促销",
                MainWait_Element=".modules.main.views.activities.MainActivity",
                find_element_id="com.pujitech.pujiejia:id/tv_modules_name",
                Wait_Element=".modules.h5.views.activitys.CommonH5Activity",
                check_element_id="com.pujitech.pujiejia:id/tv_title",
                TestCase="限时促销")

            time.sleep(2)

            Public_Page.debug_NomalTest(
                driver,
                title="精品团购",
                MainWait_Element=".modules.main.views.activities.MainActivity",
                find_element_id="com.pujitech.pujiejia:id/tv_modules_name",
                Wait_Element=".modules.h5.views.activitys.CommonH5Activity",
                check_element_id="com.pujitech.pujiejia:id/tv_title",
                TestCase="精品团购")
        except Exception as e:
            print("报错为", e)
            pass
Exemplo n.º 8
0
 def IntoNeighbor(driver):
     #先点击我家按钮进入首页页面
     Public_Page.Switch_Navigation(driver, tab="友邻")
Exemplo n.º 9
0
MyHome.IntoMyHome(driver)
# 单独测试就得重新进入我家

# MyAPP.MyApplication(driver, AppName = "我的购物车", wojia = True)
# MyAPP.MyApplication(driver, AppName = "房间绑定", wojia = True)
# MyAPP.MyApplication(driver, AppName = "我的报修", wojia = True)
# MyAPP.MyApplication(driver, AppName = "社区服务", wojia = True)
# MyAPP.MyApplication(driver, AppName = "智能家居", wojia = True)
# MyAPP.MyApplication(driver, AppName = "人脸识别", wojia = True)
# MyAPP.MyApplication(driver, AppName = "访客邀请", wojia = True)
# MyAPP.MyApplication(driver, AppName = "我的活动", wojia = True)
# 我家的我的应用(从我家页面进入需要带参数wojia = True)
time.sleep(3)
MyAPP.IntoALLAPP(driver)
# 点击全部应用进入全部应用
# MyAPP.MyApplication(driver, AppName = "商家收藏")
# MyAPP.MyApplication(driver, AppName = "我的家书")
# MyAPP.MyApplication(driver, AppName = "我的关注")
# MyAPP.MyApplication(driver, AppName = "我的评价")
# MyAPP.MyApplication(driver, AppName = "约车记录")
MyAPP.MyApplication(driver, AppName="我的帖子")
Public_Page.ExitBack(driver)
# 返回到我家页面
MyHome.SmartBandInstruction(driver)

NeighborTalk.IntoNeighbor(driver)
# 进入友邻页面
NeighborTalk.IntoNewTopic(driver)
NeighborTalk.ChoiceSpeakType(driver, type=3)
NeighborTalk.PostNewTopic(driver, price=100, phone=13435951753)
Exemplo n.º 10
0
 def test_MyAPP_015MyPost(self):
     """用例名称:我家→全部应用→进入我的帖子"""
     driver = self.driver
     TestResult = MyAPP.MyApplication(driver, AppName="我的帖子")
     Public_Page.ExitBack(driver)
     self.assertTrue(TestResult)
Exemplo n.º 11
0
 def IntoNeighbor(driver):
     # 先点击我家按钮进入首页页面
     time.sleep(2)
     Public_Page.Switch_Navigation(driver, tab="友邻")
     time.sleep(2)
Exemplo n.º 12
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
Exemplo n.º 13
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.º 14
0
    def Change_PersonalData(driver):
        '''
        修改个人资料功能
        先决条件:已经进入我家页面
        :return: None
        '''
        # 修改昵称
        # 修改性别如果名字叫大妈的狂笑则为女性,如果是蒜泥晾衣白肉则为男性
        try:
            # 如果修改完头像后直接进入这个页面,那么不用点击名字进入个人资料页
            driver.wait_activity(".modules.main.views.activities.MainActivity",
                                 30)
            # 等待我家主界面activity
            time.sleep(2)
            driver.find_element_by_id(
                "com.pujitech.pujiejia:id/tv_user_center_name").click()

            dondake = Public_Page.huoquactivity(driver)
            print("此页面的activity", dondake)
            # driver.wait_activity(".modules.usercenter.selfinfo.views.activities.SelfInfoActivity", 30)
            time.sleep(3)
            name1 = "果子狸大佐"
            name2 = "钢铁侠的audiA8L"

            nickname = driver.find_element_by_id(
                "com.pujitech.pujiejia:id/et_self_info_nickname")

            if nickname.text == name1:
                nickname.click()
                nickname.clear()
                nickname.send_keys(name2)
                print("测试修改昵称为%s用例Passed............成功" % name2)
            elif nickname.text == name2:
                nickname.click()
                nickname.clear()
                nickname.send_keys(name1)
                print("测试修改昵称为%s用例Passed............成功" % name1)
            elif nickname != name1 and nickname != name2:
                nickname.click()
                nickname.clear()
                nickname.send_keys(name1)
                print("测试修改昵称为%s用例Passed............成功" % name1)
            else:
                print("测试修改用户昵称用例失败............Failed")

            # 修改用户的性别
            time.sleep(2)
            nickname = driver.find_element_by_id(
                "com.pujitech.pujiejia:id/et_self_info_nickname")
            if nickname.text == name1:
                driver.find_element_by_id(
                    "com.pujitech.pujiejia:id/rb_female").click()
            elif nickname.text == name2:
                driver.find_element_by_id(
                    "com.pujitech.pujiejia:id/rb_male").click()
                print("测试修改用户的性别用例Passed............成功")
            else:
                print("测试修改用户的性别用例失败............Failed")

            # 修改用户生日信息
            """
            此滑动操作是以VivoX9屏幕大小选定的坐标,如若跑其他
            手机脚本无法滑动脚本报错,请修改适应其他手机脚本坐标
            """
            time.sleep(2)
            driver.find_element_by_id(
                "com.pujitech.pujiejia:id/rl_self_info_birthday_container"
            ).click()
            time.sleep(2)
            year = Public_Page.RandomNum()
            if year == 0:
                driver.swipe(150, 1625, 150, 1400)
                # 上滑
            else:
                driver.swipe(150, 1625, 150, 1850)
                # 下滑
            time.sleep(1)
            mouth = Public_Page.RandomNum()
            if mouth == 0:
                driver.swipe(540, 1625, 540, 1400)
                # 上滑
            else:
                driver.swipe(540, 1625, 540, 1850)
                # 下滑
            time.sleep(1)
            day = Public_Page.RandomNum()
            if day == 0:
                driver.swipe(900, 1625, 900, 1400)
                # 上滑
            else:
                driver.swipe(900, 1625, 900, 1850)
                # 下滑
            time.sleep(1)
            driver.find_element_by_id(
                "com.pujitech.pujiejia:id/tv_confirm").click()
            time.sleep(2)
            print("测试修改用户生日信息用例Passed............成功")

            # 修改用户身高
            time.sleep(2)
            driver.find_element_by_id(
                "com.pujitech.pujiejia:id/rl_self_info_height_container"
            ).click()
            time.sleep(2)
            num = Public_Page.RandomNum()
            if num == 0:
                driver.swipe(540, 1625, 540, 1400)
                # 上滑
            else:
                driver.swipe(540, 1625, 540, 1850)
                # 下滑
            time.sleep(2)
            driver.find_element_by_id(
                "com.pujitech.pujiejia:id/tv_confirm").click()
            time.sleep(2)
            print("测试修改用户身高信息用例Passed............成功")

            # 修改用户体重不可操作
            time.sleep(2)
            driver.find_element_by_id(
                "com.pujitech.pujiejia:id/rl_self_info_weight_container"
            ).click()
            time.sleep(2)
            num = Public_Page.RandomNum()
            if num == 0:
                driver.swipe(540, 1625, 540, 1400)
                # 上滑
            else:
                driver.swipe(540, 1625, 540, 1850)
                # 下滑
            time.sleep(2)
            driver.find_element_by_id(
                "com.pujitech.pujiejia:id/tv_confirm").click()
            time.sleep(2)
            print("测试修改用户体重信息用例Passed............成功")

            # 点击保存按钮
            driver.wait_activity(
                ".modules.usercenter.selfinfo.views.activities.SelfInfoActivity",
                30)
            time.sleep(2)
            driver.find_element_by_id(
                "com.pujitech.pujiejia:id/btn_save_self_info").click()
            print("测试保存修改的个人资料信息用例Passed............成功")
            unittest_TestResult = True
        except:
            unittest_TestResult = False
            print("测试保存修改的个人资料信息用例Passed............失败Failed")
        finally:
            return unittest_TestResult
Exemplo n.º 15
0
    def ShengHuoPeiTao(driver):
        """
        首页实地派下生活配套模块,
        :return: None
        """
        time.sleep(2)
        try:
            Public_Page.debug_NomalTest(
                driver,
                title="贝瑞母婴",
                MainWait_Element=".modules.main.views.activities.MainActivity",
                find_element_id="com.pujitech.pujiejia:id/tv_topic_row11",
                # Wait_Element = ".modules.usercenter.community.views.activities.PropertyPaymentHomeActivity",
                check_element_id="com.pujitech.pujiejia:id/tv_title",
                # TestCase = "物业缴费"
            )

            time.sleep(2)

            Public_Page.debug_NomalTest(
                driver,
                title="海绵兴趣",
                MainWait_Element=".modules.main.views.activities.MainActivity",
                find_element_id="com.pujitech.pujiejia:id/tv_topic_row12",
                # Wait_Element = ".modules.h5.views.activitys.CommonH5Activity",
                check_element_id="com.pujitech.pujiejia:id/tv_title",
                # TestCase = "限时促销"
            )

            time.sleep(2)

            Public_Page.debug_NomalTest(
                driver,
                title="家有健康",
                MainWait_Element=".modules.main.views.activities.MainActivity",
                find_element_id="com.pujitech.pujiejia:id/tv_topic_row13",
                # Wait_Element = ".modules.h5.views.activitys.CommonH5Activity",
                check_element_id="com.pujitech.pujiejia:id/tv_title",
                # TestCase = "精品团购"
            )
            time.sleep(2)

            Public_Page.debug_NomalTest(
                driver,
                title="新用户专场",
                MainWait_Element=".modules.main.views.activities.MainActivity",
                find_element_id="com.pujitech.pujiejia:id/tv_topic_row21",
                # Wait_Element = ".modules.h5.views.activitys.CommonH5Activity",
                check_element_id="com.pujitech.pujiejia:id/tv_title",
                # TestCase = "精品团购"
            )
            time.sleep(2)

            Public_Page.debug_NomalTest(
                driver,
                title="哈奇水果生鲜",
                MainWait_Element=".modules.main.views.activities.MainActivity",
                find_element_id="com.pujitech.pujiejia:id/tv_topic_row22",
                # Wait_Element = ".modules.h5.views.activitys.CommonH5Activity",
                check_element_id="com.pujitech.pujiejia:id/tv_title",
                # TestCase = "精品团购"
            )
            time.sleep(2)

            Public_Page.debug_NomalTest(
                driver,
                title="哈奇家里购",
                MainWait_Element=".modules.main.views.activities.MainActivity",
                find_element_id="com.pujitech.pujiejia:id/tv_topic_row23",
                # Wait_Element = ".modules.h5.views.activitys.CommonH5Activity",
                check_element_id="com.pujitech.pujiejia:id/tv_title",
                # TestCase = "精品团购"
            )

        except Exception as e:
            print("报错为", e)
            pass
Exemplo n.º 16
0
    def Hachilist_app(driver, case):
        """
        全部应用(如果有改动改这里)
        还有更多的话也可以作为普通页面点击
        ["餐饮美食", "社区商城", "服务预定", "课程培训",
        "精品团购", "限时促销", "家政服务",
        "社区公告", "物业缴费", "报事报修", u"智能家居", u"智能手环",
        "专享活动", "精品楼盘", "人脸识别", u"手机开门", "投诉建议",
        "更多"]

        其中["报事报修", "手机开门"]点击后判断是否为业主
        """
        application = [
            "餐饮美食", "社区商城", "服务预定", "课程培训", "精品团购", "限时促销", "家政服务", "社区公告",
            "物业缴费", "专享活动", "精品楼盘", "报事报修", "人脸识别", "投诉建议", "更多"
        ]
        time.sleep(3)
        if case in application:
            try:
                driver.find_element_by_android_uiautomator(
                    'new UiSelector().text("%s")' % case).click()
                time.sleep(4)

                checkpoint = driver.find_element_by_id(
                    "com.pujitech.pujiejia:id/tv_title")
                if checkpoint.text == case or checkpoint.text == "握手分期" \
                        or checkpoint.text == "握手金融" or checkpoint.text == "保洁":
                    # 已经没有握手分期和握手金融了
                    driver.back()
                else:
                    print("标题为%s...不在应用列表中,请重新确认标题名称。" % checkpoint.text)
                    driver.back()
                print("测试点击%s用例Passed............成功" % case)
                time.sleep(2)
            except:
                print("测试点击%s用例失败............Failed" % case)
                time.sleep(2)
                pass
        elif case == u"手机开门":
            # 判断是否在楼盘下有房
            try:
                driver.find_element_by_android_uiautomator(
                    'new UiSelector().text("%s")' % case).click()
                time.sleep(5)

                checkpoint = driver.find_element_by_id(
                    "com.pujitech.pujiejia:id/tv_content")
                # print ("查看非业主的checkpoint内容===================为",checkpoint)
                if checkpoint.text == "您没有在该小区认证房间":
                    print("点击%s后提示:" % case, checkpoint.text)
                    driver.find_element_by_id(
                        "com.pujitech.pujiejia:id/tv_cancel").click()
                    print("测试点击%s用例Passed............成功" % case)
                else:
                    time.sleep(5)
                    try:
                        Public_Page.ExitBack(driver)
                    except:
                        driver.back()
                    print("测试点击%s用例Passed............成功" % case)

            except:
                print("测试点击%s用例失败............Failed" % case)
                time.sleep(2)
                pass
        elif case == u"智能家居":
            try:
                driver.find_element_by_android_uiautomator(
                    'new UiSelector().text("%s")' % case).click()
                time.sleep(30)

                checkpoint = driver.find_element_by_id(
                    "com.pujitech.pujiejia:id/tv_base_title")
                if checkpoint.text == "我的网关":
                    try:
                        driver.find_element_by_id(
                            'com.pujitech.pujiejia:id/iv_icon_back').click()
                    except:
                        driver.back()
                else:
                    print("标题为%s...不在应用列表中,请重新确认标题名称。" % checkpoint.text)
                    driver.back()
                print("测试点击%s用例Passed............成功" % case)
            except:
                print("测试点击%s用例失败............Failed" % case)
                time.sleep(2)
                pass
        elif case == u"智能手环":
            try:
                driver.find_element_by_android_uiautomator(
                    'new UiSelector().text("%s")' % case).click()
                time.sleep(8)
                # 点击手环进入我家页面,暂时判断页面是否有全部应用元素
                ##################以后优化,每隔1秒执行一次循环,然后直到找到元素,退出整体循环
                checkpoint = driver.find_element_by_id(
                    "com.pujitech.pujiejia:id/all_application_tv")
                print(checkpoint.text)
                if checkpoint.text == "全部应用":
                    # 改成简单的方法
                    retap = "实地派"
                    try:
                        driver.wait_activity(
                            ".modules.main.views.activities.MainActivity", 30)
                        time.sleep(2)
                        allbutn = driver.find_elements_by_id(
                            "com.pujitech.pujiejia:id/fixed_bottom_navigation_title"
                        )
                        for target in allbutn:
                            if target.text == retap:
                                target.click()
                                break
                            # 点完了就跳出循环,否则会再次找寻case内容导致报错
                        print("测试点击%s用例Passed............成功" % case)
                        time.sleep(3)
                        # 为了下一次循环等待3s
                    except:
                        print("未切换到首页页面,程序退出....")
                        print("测试点击%s用例失败............Failed" % case)
                        pass

                else:
                    print("没有找到%s,在当前页面,请重新检查测试脚本..." % checkpoint.text)
                    print("测试点击%s用例失败............Failed" % case)
                    time.sleep(2)

            except:
                pass
        else:
            pass
Exemplo n.º 17
0
 def IntoShiDiPai(driver):
     # 先点击实地派按钮进入首页页面
     Public_Page.Switch_Navigation(driver, tab="实地派")
Exemplo n.º 18
0
 def IntoMyHome(driver):
     """
     点击我家按钮进入我家页面
     """
     time.sleep(1)
     Public_Page.Switch_Navigation(driver, tab="我家")
Exemplo n.º 19
0
 def QieHuanLouPan(driver, Building, into):
     Public_Page.ChoiceBuilding(driver, Building, into)
Exemplo n.º 20
0
    def MyHome_MsgSetting(driver):
        try:
            # 测试我的消息页面是否正常显示
            driver.wait_activity(".modules.main.views.activities.MainActivity",
                                 30)
            # 等待切换到我家页面30s
            driver.find_element_by_id(
                "com.pujitech.pujiejia:id/iv_message").click()
            time.sleep(20)

            driver.wait_activity(
                ".modules.h5.views.activitys.CommonH5Activity", 30)
            # 我的消息内容加载时间较长,目前开发尚未解决问题,先这么写,以后优化
            driver.back()
            '''
            Public_Page.debug_NomalTest(driver, title="我的消息",
                                        MainWait_Element=".modules.main.views.activities.MainActivity",
                                        find_element_id="com.pujitech.pujiejia:id/iv_message",
                                        Wait_Element = None,
                                        check_element_id="com.pujitech.pujiejia:id/tv_title"
                                        )
            '''

            # 测试设置页面是否正确显示
            Public_Page.debug_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")
            '''
            
            driver.wait_activity(".modules.main.views.activities.MainActivity", 30)
            driver.find_element_by_id("com.pujitech.pujiejia:id/iv_setting").click()
            time.sleep(2)
            driver.wait_activity(".modules.usercenter.setting.views.activities.SettingActivity", 30)
            checkpoint = driver.find_element_by_id("com.pujitech.pujiejia:id/tv_title")
            if checkpoint.text == "设置":
                driver.find_element_by_id("com.pujitech.pujiejia:id/iv_back").click()
                print("我家→设置模块可以正常访问....................PASS")
            else:
                print("我家→设置模块出现BUG....................用例失败")
            '''
            # 点击头像图片进入个人资料页面
            Public_Page.debug_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")
            print("点击头像图片进入个人资料页面测试完成")

            # 点击用户名称进入个人资料页面
            Public_Page.debug_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")
            print("点击用户名称进入个人资料页面测试完成")

            # 点击用户手机号进入个人资料页面
            Public_Page.debug_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")
            print("点击用户手机号进入个人资料页面")
            # 点击用户手机号进入个人资料页面,并修改个人资料数据
            unittest_TestResult = True
        except:
            unittest_TestResult = False
        finally:
            return unittest_TestResult
Exemplo n.º 21
0
    def ClickMyOrder(driver):
        """
        进入我的订单页面,脚本执行完成后返回我家页面
        :return: None
        """
        try:
            """
            订单状态:配送中  待自提  已完成  已退款  已取消  待支付  待受理  已受理  
            """
            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.debug_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.debug_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
                    else:
                        continue

            driver.find_element_by_id(
                "com.pujitech.pujiejia:id/iv_back").click()
            # 返回我家页面
            unittest_TestResult = True
        except:
            driver.find_element_by_id(
                "com.pujitech.pujiejia:id/iv_back").click()
            # 返回我家页面
            unittest_TestResult = False
        finally:
            return unittest_TestResult
        '''