Ejemplo n.º 1
0
 def test_MyAPP_015MyPost(self):
     """用例名称:我家→全部应用→进入我的帖子"""
     driver = self.driver
     TestResult = MyAPP.MyApplication(driver, AppName="我的帖子")
     Public_Page.ExitBack(driver)
     #self.assertTrue(TestResult)
     assert TestResult == True
Ejemplo n.º 2
0
    def Hachilist_app(driver, case):
        """
        全部应用(如果有改动改这里)
        还有更多的话也可以作为普通页面点击
        ["餐饮美食", "社区商城", "服务预定", "课程培训",
        "限时促销", "精品团购",
        "社区公告", "房屋报修", "物业缴费", "投诉建议",
        "精品楼盘", "专享活动", "投资理财", u"智能手环", u"手机开门", u"消费分期", u"智能家居", u"哈奇贝壳",
        "更多"]

        其中["投诉建议", "房屋报修"] 点击后判断是否为业主
        哈奇贝壳怎么是空白页
        """
        application = [
            "餐饮美食", "社区商城", "服务预定", "课程培训", "限时促销", "精品团购", "社区公告", "物业缴费",
            "精品楼盘", "专享活动", "投资理财", "更多", u"消费分期"
        ]
        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 == "握手金融":
                    driver.back()
                else:
                    print("标题为%s...不在应用列表中,请重新确认标题名称。" % checkpoint.text)
                    driver.back()
                print("测试点击%s用例Passed............成功" % case)
            except:
                print("测试点击%s用例失败............Failed" % case)
                time.sleep(2)
                pass
        elif case == "投诉建议" or case == "房屋报修" or case == u"手机开门":
            try:
                driver.find_element_by_android_uiautomator(
                    'new UiSelector().text("%s")' % case).click()
                time.sleep(8)

                checkpoint = driver.find_element_by_id(
                    "com.pujitech.pujiejia:id/tv_content")
                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:
                    Public_Page.ExitBack(driver)
                    print("测试点击%s用例Passed............成功" % case)

            except:
                print("测试点击%s用例失败............Failed" % case)
                time.sleep(2)
                pass
Ejemplo n.º 3
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)
Ejemplo n.º 4
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
Ejemplo n.º 5
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