Ejemplo n.º 1
0
 def setup(self):
     print("Test Start")
     self.log = MyLog()
     desired_caps = Yamlc(yaml_path).get_yaml_data(3, "Model", "desired_caps")
     self.desired_caps = desired_caps
     self.app = App(desired_caps)
     self.log.debug(u'初始化测试数据')
 def setup(self):
     print("Test Start")
     self.log = MyLog()
     desired_caps = Yamlc(yaml_path).get_yaml_data(1, "Model", "desired_caps")
     desired_caps2 = Yamlc(yaml_path).get_yaml_data(2, "Model", "desired_caps")
     self.wyzeband_mac = "2C:AA:8E:8F:03:52"
     self.desired_caps = desired_caps
     self.app = App(desired_caps)
     self.app_setting = App(desired_caps2)
     self.log.debug(u'初始化测试数据')
 def setup(self):
     print("Test Start")
     self.log = MyLog()
     desired_caps = Yamlc(yaml_path).get_yaml_data(1, "Model", "desired_caps")
     desired_caps2 = Yamlc(yaml_path).get_yaml_data(2, "Model", "desired_caps")
     self.wyzeband_mac = "9C:F6:DD:38:1A:F5"
     # self.wyzeband_mac = "9C:F6:DD:38:19:59"
     # self.wyzeband_mac = "9C:F6:DD:38:18:75"
     self.desired_caps = desired_caps
     self.app = App(desired_caps)
     self.app_setting = App(desired_caps2)
     self.log.debug(u'初始化测试数据')
Ejemplo n.º 4
0
class TestClass:
    def setup(self):
        print("Test Start")
        self.log = MyLog()
        desired_caps = Yamlc(yaml_path).get_yaml_data(3, "Model", "desired_caps")
        self.desired_caps = desired_caps
        self.app = App(desired_caps)
        self.log.debug(u'初始化测试数据')

    def teardown(self):
        print("Test End")

    @allure.story("设备升级")
    @allure.severity('blocker')
    @pytest.mark.smoke
    def test_upgradewyze_smoke(self):
        self.driver = self.app.open_app()
        # self.app.click_prompt_box()
        if self.app.object_exist("*****@*****.**") == False:
            self.app.login_wyze("*****@*****.**", "Yxz@2020")
        self.app.upgrade_wyze("1.0.7.81")
        self.app.upgrading()
        time.sleep(5)
        self.app.upgrade_wyze_again("1.0.7.78")
        self.app.upgrading()
        self.app.close_app()
Ejemplo n.º 5
0
class TestClass:
    def setup(self):
        print("Test Start")
        self.log = MyLog()
        desired_caps = Yamlc(yaml_path).get_yaml_data(1, "Model",
                                                      "desired_caps")
        desired_caps2 = Yamlc(yaml_path).get_yaml_data(2, "Model",
                                                       "desired_caps")
        self.wyzeband_mac = "9C:F6:DD:38:19:59"
        self.desired_caps = desired_caps
        self.app = App(desired_caps)
        self.app_setting = App(desired_caps2)
        self.log.debug(u'初始化测试数据')

    def teardown(self):
        self.app.close_app()  #关闭App
        print("Test End")

    @allure.story("设备端通过性验证")
    @allure.severity('blocker')
    @pytest.mark.smoke
    def test_appwyze_smoke(self):
        self.driver = self.app.open_app()
        size = self.driver.get_window_size()
        self.app.find_elementby(
            By.XPATH, "//android.widget.Button[@text='BRANDY_APP']").click()
        time.sleep(5)
        if self.app.object_exist(self.wyzeband_mac + "  已连接") == False:
            self.app.find_elementby(
                By.XPATH, "//android.widget.Button[@text='解绑']").click()
            self.app.click_prompt_box()
            if self.app.object_exist_xpath(
                    "//android.view.ViewGroup[@index='0']") == False:
                self.app.close_app()
                self.app_setting.restart_bluetooth()  #重启蓝牙
                self.driver = self.app.open_app()
                self.app.find_elementby(
                    By.XPATH,
                    "//android.widget.Button[@text='BRANDY_APP']").click()
                self.app.find_elementby(
                    By.XPATH, "//android.widget.Button[@text='扫描']").click()
            time.sleep(5)
            self.app.find_elementby(By.XPATH, "//*[@text='" +
                                    self.wyzeband_mac + "']").click()
            time.sleep(5)
            if self.app.object_exist("请在设备上点击确认"):
                self.driver.keyevent(4)
                self.driver.keyevent(4)
            self.app.brandy_inputclick("160", "300")
            self.driver.keyevent(4)
            self.app.find_elementby(
                By.XPATH,
                "//android.widget.Button[@text='BRANDY_APP']").click()
        self.app.tv_device_info()  #设备信息
        self.app.tv_device_property()  #设备电量
        self.app.tv_device_activity()  #活动数据
        self.app.tv_device_data()  #数据同步
        self.app.tv_find_device()  #查找手环
        self.app.tv_reboot_device("BRANDY_APP")  #重启手环
        self.app.tv_send_notification({
            "telephony": {
                "contact": "reeyx",
                "number": "1234567",
                "status": "RINGING_UNANSWERABLE"
            },
            "type": "TELEPHONY"
        })  #发送通知
        self.app.tv_send_notification({
            "appMessage": {
                "appId": "app.facebook",
                "text": "ryeex text",
                "title": "ryeex title"
            },
            "type": "APP_MESSAGE"
        })
        self.app.tv_send_notification({
            "sms": {
                "contact": "ryeex contact",
                "content": "ryeex content",
                "sender": "1234567"
            },
            "type": "SMS"
        })

        self.app.tv_set_app_list("2,3,5,6,7,8,11,12,13,14,15")  #设置应用排序
        self.app.tv_app_list("2, 3, 5")  #获取应用排序

        self.app.swpe(size['width'] * 0.25, size['height'] * 0.85,
                      size['width'] * 0.25, size['height'] * 0.5)
        self.app.tv_setDoNotDisturb({
            "homeVibrate": 0,
            "lunchModeEnable": 0,
            "mode": "ALWAYS",
            "raiseToWake": 0
        })  #设置勿扰模式
        self.app.tv_getDoNotDisturb("ALWAYS")  #获取勿扰模式
        self.app.tv_setDoNotDisturb({
            "homeVibrate": 0,
            "lunchModeEnable": 0,
            "mode": "DISABLE",
            "raiseToWake": 0
        })
        self.app.tv_getDoNotDisturb("DISABLE")
        self.app.tv_setDoNotDisturb({
            "homeVibrate": 0,
            "lunchModeEnable": 0,
            "mode": "SMART",
            "raiseToWake": 0
        })
        self.app.tv_getDoNotDisturb("SMART")
        self.app.tv_setDoNotDisturb({
            "durations": [{
                "endTimeHour": 12,
                "endTimeMinute": 30,
                "startTimeHour": 10,
                "startTimeMinute": 30
            }],
            "homeVibrate":
            0,
            "lunchModeEnable":
            0,
            "mode":
            "TIMING",
            "raiseToWake":
            0
        })
        self.app.tv_getDoNotDisturb("TIMING")

        self.app.tv_setDeviceRaiseToWake({
            "enable": True,
            "endTimeHour": 10,
            "endTimeMinute": 00,
            "startTimeHour": 8,
            "startTimeMinute": 00
        })  #设置抬腕亮屏
        self.app.tv_getDeviceRaiseToWake(True)  #获取抬腕亮屏
        self.app.tv_setDeviceRaiseToWake({"enable": False})
        self.app.tv_getDeviceRaiseToWake(False)

        self.app.swpe(size['width'] * 0.25, size['height'] * 0.95,
                      size['width'] * 0.25, size['height'] * 0.5)
        self.app.tv_setHeartRateDetect({
            "enable": True,
            "interval": 5
        })  #设置心率检测
        self.app.tv_getHeartRateDetect(5)  #获取心率检测
        self.app.tv_setHeartRateDetect({"enable": False})
        self.app.tv_getHeartRateDetect(False)

        self.app.tv_setDeviceBrightness("MID")  #设置屏幕亮度
        self.app.tv_getDeviceBrightness("MID")  #获取屏幕亮度
        self.app.tv_setDeviceBrightness("LOW")
        self.app.tv_getDeviceBrightness("LOW")
        self.app.tv_setDeviceBrightness("HIGH")
        self.app.tv_setDeviceBrightness("HIGH")

        self.app.tv_setHomeVibrateSetting(True)  #设置震动开关
        self.app.tv_getHomeVibrateSetting(True)  #获取震动开关
        self.app.tv_setHomeVibrateSetting(False)
        self.app.tv_getHomeVibrateSetting(False)

        self.app.tv_setUnlock(1)  #设置解锁方式
        self.app.tv_getUnlock(1)  #获取解锁方式
        self.app.tv_setUnlock(0)
        self.app.tv_getUnlock(0)

        self.app.swpe(size['width'] * 0.25, size['height'] * 0.25,
                      size['width'] * 0.25, size['height'] * 0.95)
class TestClass:
    def setup(self):
        print("Test Start")
        self.log = MyLog()
        desired_caps = Yamlc(yaml_path).get_yaml_data(1, "Model", "desired_caps")
        desired_caps2 = Yamlc(yaml_path).get_yaml_data(2, "Model", "desired_caps")
        self.wyzeband_mac = "2C:AA:8E:8F:03:52"
        self.desired_caps = desired_caps
        self.app = App(desired_caps)
        self.app_setting = App(desired_caps2)
        self.log.debug(u'初始化测试数据')

    def teardown(self):
        # self.app.find_elementby(By.XPATH, "//*[@text='解绑']").click()
        self.app.close_app()                                                                                           #关闭App
        print("Test End")

    @allure.story("模拟Brandy设备端操作验证")
    @allure.severity('blocker')
    @pytest.mark.smoke
    def test_wyzewatch_smoke(self):
        self.driver = self.app.open_app()
        time.sleep(1)
        for i in range(1, 100):
            self.app.devices_click('BRANDY_设备')
            time.sleep(1)
            while self.app.object_exist(self.wyzeband_mac + "  正在连接...") :
                time.sleep(1)
            if self.app.object_exist(self.wyzeband_mac + "  已连接") == False:
                self.app.devices_click('解绑')
                self.app.click_prompt_box()
                if (self.app.object_exist("realme Watch Saturn") or self.app.object_exist("WYZE") or self.app.object_exist("hey+")) == False:
                    self.app.close_app()
                    self.app_setting.restart_bluetooth()                                                                       #重启蓝牙
                    self.driver = self.app.open_app()
                    self.app.devices_click('BRANDY_设备')
                    self.app.devices_click('解绑')
                while self.app.object_exist(self.wyzeband_mac) == False:
                    time.sleep(1)
                self.app.devices_click(self.wyzeband_mac)
                while self.app.object_exist("请在设备上点击确认") == False:
                    time.sleep(1)
                self.app.devices_click('完成')
                self.app.devices_click('BRANDY_设备')
                self.app.brandy_inputclick("160", "240")
                self.driver.keyevent(4)
                self.app.devices_click('BRANDY_设备')
                try:
                    self.log.debug(u'运行次数:' + str(i))
                    assert(self.app.object_exist(self.wyzeband_mac + "  已连接"))
                    self.device_clickDID()
                    self.app.assert_getdevicepagename('home_page')
                    self.log.debug(u'进入表盘主页面成功')
                    self.app.find_elementby(By.XPATH, "//*[@text='解绑']").click()
                    self.log.debug(u'解绑成功')
                except:
                    self.log.error(u'绑定解绑第N次运行失败:' + str(i))
                time.sleep(6)
                self.driver.keyevent(4)
                self.driver.keyevent(4)
Ejemplo n.º 7
0
def smoke2():
    info2 = "Process-2"
    desired_caps2 = Yamlc(yaml_path).get_yaml_data(3, "Model", "desired_caps")
    app1 = App(desired_caps2)
    wyzeband_mac2 = "9C:F6:DD:38:1B:78"
    # App.start_appium(4725, 4726, "HDP9K19128907088")
    driver1 = app1.open_application('4725')
    size = driver1.get_window_size()
    time.sleep(1)
    app1.devices_click('SATURN_设备')
    time.sleep(1)
    while app1.object_exist(wyzeband_mac2 + "  正在连接..."):
        time.sleep(1)
    if app1.object_exist(wyzeband_mac2 + "  已连接") == False:
        app1.devices_click('解绑')
        app1.click_prompt_box()
        if (app1.object_exist("realme Watch 2") or app1.object_exist("WYZE")
                or app1.object_exist("hey+")) == False:
            app1.close_app()
            # app1.restart_bluetooth()                                                                       #重启蓝牙
            driver1 = app1.open_app()
            app1.devices_click('SATURN_设备')
            app1.devices_click('解绑')
        while app1.object_exist(wyzeband_mac2) == False:
            time.sleep(1)
        app1.devices_click(wyzeband_mac2)
        while app1.object_exist("请在设备上点击确认") == False:
            time.sleep(1)
        driver1.keyevent(4)
        driver1.keyevent(4)
        app1.devices_click('完成')
        app1.devices_click('SATURN_设备')
        app1.saturn_inputclick("160", "240", "160", "240")
        driver1.keyevent(4)
        app1.devices_click('SATURN_设备')
    time.sleep(1)
    app1.swpe(size['width'] * 0.25, size['height'] * 0.95,
              size['width'] * 0.25, size['height'] * 0.25)
    for i in range(1, 50):
        try:
            log.info(info2 + u'滑动/点击运行次数:' + str(i))
            app1.device_downslide()
            log.debug(info2 + u"向下滑动成功")
            app1.device_upslide()
            log.debug(info2 + u"向上滑动成功")
            app1.device_leftslide()
            log.debug(info2 + u"向左滑动成功")
            app1.device_leftslide()
            log.debug(info2 + u"向左滑动成功")
            app1.device_leftslide()
            log.debug(info2 + u"向左滑动成功")
            app1.device_leftslide()
            log.debug(info2 + u"向左滑动成功")
            app1.device_rightslide()
            log.debug(info2 + u"向右滑动成功")
            app1.device_home()
            log.debug(info2 + u"按home键成功")
            app1.device_longpress()
            log.debug(info2 + u"长按成功")
            app1.assert_getdevicepagename("face_pick_page")
            log.debug(info2 + u"进入切换表盘页面成功")
            app1.device_leftslide()
            log.debug(info2 + u"向左滑动成功")
            app1.device_rightslide()
            log.debug(info2 + u"向右滑动成功")
            app1.device_home()
            log.debug(info2 + u"home键成功")
            app1.assert_getdevicepagename("home_page")
            log.debug(info2 + u"退出切换表盘页面成功")
        except:
            log.error(info2 + u'滑动/点击在第N次运行失败:' + str(i))
            app1.device_home()
            log.debug(info2 + u"回到主页面")
Ejemplo n.º 8
0
def smoke1():
    info1 = "Process-1"
    desired_caps = Yamlc(yaml_path).get_yaml_data(1, "Model", "desired_caps")
    app = App(desired_caps)
    wyzeband_mac1 = "9C:F6:DD:38:1B:81"
    # App.start_appium(4723, 4724, "468207dd")
    driver = app.open_application('4723')
    time.sleep(1)
    app.devices_click('SATURN_设备')
    time.sleep(1)
    while app.object_exist(wyzeband_mac1 + "  正在连接..."):
        time.sleep(1)
    if app.object_exist(wyzeband_mac1 + "  已连接") == False:
        app.find_elementby(By.XPATH, "//*[@text='解绑']").click()
        app.click_prompt_box()
        if (app.object_exist("realme Watch Saturn") or app.object_exist("WYZE")
                or app.object_exist("hey+")) == False:
            app.close_app()
            # self.app_setting.restart_bluetooth()                                                                       #重启蓝牙
            driver = app.open_app()
            app.devices_click('SATURN_设备')
            app.devices_click('解绑')
        while app.object_exist(wyzeband_mac1) == False:
            time.sleep(1)
        app.devices_click(wyzeband_mac1)
        while app.object_exist(wyzeband_mac1) == False:
            time.sleep(1)
            app.devices_click('完成')
            app.devices_click('SATURN_设备')
            app.saturn_inputclick("160", "240", "160", "240")
            driver.keyevent(4)
            app.devices_click('SATURN_设备')
    time.sleep(1)
    app.device_upslide()
    for i in range(1, 50):
        try:
            log.debug(info1 + u'血氧心率运行次数:' + str(i))
            app.saturn_inputclick("240", "80", "240", "80")
            log.debug(info1 + u"点击心率icon成功")
            app.assert_getdevicepagename("hrm")
            log.debug(info1 + u"进入心率功能成功")
            time.sleep(3)
            app.device_home()
            log.debug(info1 + u"home键返回上级页面成功(心率-上级页面)")
            app.saturn_inputclick("80", "240", "80", "240")
            log.debug(info1 + u"点击血氧icon成功")
            app.assert_getdevicepagename("spo2")
            log.debug(info1 + u"进入血氧功能成功")
            time.sleep(3)
            app.device_home()
            log.debug(info1 + u"home键返回上级页面成功(血氧-上级页面)")
        except:
            log.error(info1 + u'血氧心率在第N次运行失败:' + str(i))
            app.device_home()
            app.device_home()
            app.device_upslide()
            log.debug(info1 + u"回到主页面")
class TestClass:
    def setup(self):
        print("Test Start")
        self.log = MyLog()
        desired_caps = Yamlc(yaml_path).get_yaml_data(1, "Model", "desired_caps")
        desired_caps2 = Yamlc(yaml_path).get_yaml_data(2, "Model", "desired_caps")
        self.wyzeband_mac = "9C:F6:DD:38:1A:F5"
        # self.wyzeband_mac = "9C:F6:DD:38:19:59"
        # self.wyzeband_mac = "9C:F6:DD:38:18:75"
        self.desired_caps = desired_caps
        self.app = App(desired_caps)
        self.app_setting = App(desired_caps2)
        self.log.debug(u'初始化测试数据')

    def teardown(self):
        # self.app.find_elementby(By.XPATH, "//*[@text='解绑']").click()
        # self.app.close_app()                                                                                           #关闭App
        print("Test End")

    @allure.story("模拟Saturn设备端操作验证")
    @allure.severity('blocker')
    @pytest.mark.smoke
    def test_wyzewatch_smoke(self):
        self.driver = self.app.open_app()
        time.sleep(1)
        self.app.devices_click('SATURN_设备')
        time.sleep(1)
        while self.app.object_exist(self.wyzeband_mac + "  正在连接...") :
            time.sleep(1)
        if self.app.object_exist(self.wyzeband_mac + "  已连接") == False:
            self.app.devices_click('解绑')
            self.app.click_prompt_box()
            if (self.app.object_exist("realme Watch Saturn") or self.app.object_exist("WYZE") or self.app.object_exist("hey+")) == False:
                self.app.close_app()
                self.app_setting.restart_bluetooth()                                                                       #重启蓝牙
                self.driver = self.app.open_app()
                self.app.devices_click('SATURN_设备')
                self.app.devices_click('解绑')
            while self.app.object_exist(self.wyzeband_mac) == False:
                time.sleep(1)
            self.app.devices_click(self.wyzeband_mac)
            while self.app.object_exist("请在设备上点击确认") == False:
                time.sleep(1)
            self.app.devices_click('完成')
            self.app.devices_click('SATURN_设备')
            self.app.saturn_inputclick("160", "240", "160", "240")
            self.driver.keyevent(4)
            self.app.devices_click('SATURN_设备')
        time.sleep(1)
        self.app.device_upslide()
        self.log.debug(u"向上滑动")
        for i in range(83, 250):
            try:
                # self.log.debug(str(i))
                # self.app.device_upslide()
                # self.app.saturn_inputslide("160", "40", "160", "10")
                # self.app.saturn_inputclick("80", "315", "80", "315")
                # self.app.assert_getdevicepagename("sports")
                # self.app.device_upslide()
                # self.app.saturn_inputclick("160", "160", "160", "160")
                # time.sleep(200)
                # self.app.device_home()
                # self.app.device_home()
                # self.app.saturn_inputclick("80", "160", "80", "160")
                # self.app.saturn_inputclick("160", "300", "160", "300")
                # self.app.device_home()
                # self.app.device_home()
                #
                # self.app.device_upslide()
                # self.app.saturn_inputslide("160", "40", "160", "10")
                # self.app.saturn_inputclick("80", "315", "80", "315")
                # self.app.assert_getdevicepagename("sports")
                # self.app.device_upslide()
                # self.app.saturn_inputclick("160", "300", "160", "300")
                # time.sleep(200)
                # self.app.device_home()
                # self.app.device_home()
                # self.app.saturn_inputclick("80", "160", "80", "160")
                # self.app.saturn_inputclick("160", "300", "160", "300")
                # self.app.device_home()
                # self.app.device_home()

                self.log.debug(str(i))
                self.app.saturn_inputclick("240", "80", "240", "80")
                self.app.assert_getdevicepagename("hrm")
                self.log.debug(u"进入心率功能")
                time.sleep(5)
                self.app.device_home()
                self.log.debug(u'点击home回到上级页面')
                self.app.saturn_inputclick("80", "240", "80", "240")
                self.app.assert_getdevicepagename("spo2")
                self.log.debug(u"进入血氧功能")
                time.sleep(5)
                self.app.device_home()
                self.log.debug(u'点击home回到上级页面')
            except:
                self.log.error(str(i))
                self.app.device_home()
                self.app.device_home()
                self.app.device_upslide()
Ejemplo n.º 10
0
class TestClass:
    def setup(self):
        print("Test Start")
        self.log = MyLog()
        desired_caps = Yamlc(yaml_path).get_yaml_data(1, "Model",
                                                      "desired_caps")
        desired_caps2 = Yamlc(yaml_path).get_yaml_data(2, "Model",
                                                       "desired_caps")
        self.wyzeband_mac = "9C:F6:DD:38:1A:F5"
        # self.wyzeband_mac = "9C:F6:DD:38:19:59"
        # self.wyzeband_mac = "9C:F6:DD:38:18:75"
        self.desired_caps = desired_caps
        self.app = App(desired_caps)
        self.app_setting = App(desired_caps2)
        self.log.debug(u'初始化测试数据')

    def teardown(self):
        # self.app.find_elementby(By.XPATH, "//*[@text='解绑']").click()
        # self.app.close_app()                                                                                           #关闭App
        print("Test End")

    @allure.story("模拟Saturn设备端操作验证")
    @allure.severity('blocker')
    @pytest.mark.smoke
    def test_wyzewatch_smoke(self):
        self.driver = self.app.open_app()
        time.sleep(1)
        self.app.devices_click('SATURN_APP')
        time.sleep(1)
        while self.app.object_exist(self.wyzeband_mac + "  正在连接..."):
            time.sleep(1)
        if self.app.object_exist(self.wyzeband_mac + "  已连接") == False:
            self.app.devices_click('解绑')
            self.app.click_prompt_box()
            if (self.app.object_exist("realme Watch Saturn")
                    or self.app.object_exist("WYZE")
                    or self.app.object_exist("hey+")) == False:
                self.app.close_app()
                self.app_setting.restart_bluetooth()  #重启蓝牙
                self.driver = self.app.open_app()
                self.app.devices_click('SATURN_设备')
                self.app.devices_click('解绑')
            while self.app.object_exist(self.wyzeband_mac) == False:
                time.sleep(1)
            self.app.devices_click(self.wyzeband_mac)
            while self.app.object_exist("请在设备上点击确认") == False:
                time.sleep(1)
            self.app.devices_click('完成')
            self.app.devices_click('SATURN_设备')
            self.app.saturn_inputclick("160", "240", "160", "240")
            self.driver.keyevent(4)
            self.app.devices_click('SATURN_设备')
        time.sleep(1)
        count = 1
        for i in range(1, 1000):
            try:
                self.log.debug(str(i))
                self.app.tv_send_notification(
                    '{"telephony": {"contact": "reeyx' + str(i) +
                    '", "number": ' + str(i) +
                    ', "status": "RINGING_UNANSWERABLE"}, "type": "TELEPHONY"}'
                )
                self.driver.keyevent(4)
                self.app.devices_click('SATURN_设备')
                self.app.assert_getdevicepagename('remind')
                self.app.saturn_inputclick("240", "240", "240", "240")
                self.driver.keyevent(4)
                self.app.devices_click('SATURN_APP')
            except:
                count = 1 + count
                self.log.error(str(count))
                self.app.device_home()
                self.app.device_home()
                self.driver.keyevent(4)
                self.app.devices_click('SATURN_APP')
                time.sleep(3)
Ejemplo n.º 11
0
class TestClass:
    def setup(self):
        print("Test Start")
        self.log = MyLog()
        desired_caps = Yamlc(yaml_path).get_yaml_data(1, "Model",
                                                      "desired_caps")
        desired_caps2 = Yamlc(yaml_path).get_yaml_data(2, "Model",
                                                       "desired_caps")
        # self.wyzeband_mac = "2C:AA:8E:8F:00:9E"
        self.wyzeband_mac = "2c:aa:8e:8f:02:28"
        self.desired_caps = desired_caps
        self.app = App(desired_caps)
        self.app_setting = App(desired_caps2)
        self.log.debug(u'初始化测试数据')

    def teardown(self):
        self.app.close_app()  #关闭App
        print("Test End")

    @allure.story("模拟Brandy设备端操作验证")
    @allure.severity('blocker')
    @pytest.mark.smoke
    def test_wyzewatch_smoke(self):
        self.driver = self.app.open_app()
        self.app.find_elementby(
            By.XPATH, "//android.widget.Button[@text='BRANDY_设备']").click()
        time.sleep(5)
        if self.app.object_exist(self.wyzeband_mac + "  已连接") == False:
            self.app.find_elementby(
                By.XPATH, "//android.widget.Button[@text='解绑']").click()
            self.app.click_prompt_box()
            if self.app.object_exist_xpath(
                    "//android.view.ViewGroup[@index='0']") == False:
                self.app.close_app()
                self.app_setting.restart_bluetooth()  #重启蓝牙
                self.driver = self.app.open_app()
                self.app.find_elementby(
                    By.XPATH,
                    "//android.widget.Button[@text='BRANDY_设备']").click()
                self.app.find_elementby(
                    By.XPATH, "//android.widget.Button[@text='扫描']").click()
            time.sleep(5)
            self.app.find_elementby(By.XPATH, "//*[@text='" +
                                    self.wyzeband_mac + "']").click()
            time.sleep(5)
            if self.app.object_exist("请在设备上点击确认"):
                self.driver.keyevent(4)
                self.driver.keyevent(4)
            self.app.brandy_inputclick("160", "300")
            self.driver.keyevent(4)
            self.app.find_elementby(
                By.XPATH,
                "//android.widget.Button[@text='BRANDY_设备']").click()
        # self.app.find_elementby(By.XPATH, "//@text='" + self.wyzeband_mac + " 已连接']")
        self.app.device_upslide()
        self.app.brandy_inputclick("80", "80")
        self.app.brandy_inputclick("240", "80")
        self.app.brandy_inputclick("240", "80")
        self.app.brandy_inputclick("240", "80")
        self.app.brandy_inputclick("80", "240")
        self.app.brandy_inputclick("240", "240")
        self.app.device_downslide()
        self.app.device_leftslide()
        self.app.device_rightslide()
class TestClass:
    def setup(self):
        print("Test Start")
        self.log = MyLog()
        desired_caps = Yamlc(yaml_path).get_yaml_data(1, "Model",
                                                      "desired_caps")
        desired_caps2 = Yamlc(yaml_path).get_yaml_data(2, "Model",
                                                       "desired_caps")
        self.wyzeband_mac = "9C:F6:DD:38:1A:F5"
        # self.wyzeband_mac = "9C:F6:DD:38:19:59"
        # self.wyzeband_mac = "9C:F6:DD:38:18:75"
        self.desired_caps = desired_caps
        self.app = App(desired_caps)
        self.app_setting = App(desired_caps2)
        self.log.debug(u'初始化测试数据')

    def teardown(self):
        # self.app.find_elementby(By.XPATH, "//*[@text='解绑']").click()
        # self.app.close_app()                                                                                           #关闭App
        print("Test End")

    @allure.story("模拟Saturn设备端操作验证")
    @allure.severity('blocker')
    @pytest.mark.smoke
    def test_wyzewatch_smoke(self):
        self.driver = self.app.open_app()
        time.sleep(1)
        self.app.devices_click('SATURN_设备')
        time.sleep(1)
        while self.app.object_exist(self.wyzeband_mac + "  正在连接..."):
            time.sleep(1)
        if self.app.object_exist(self.wyzeband_mac + "  已连接") == False:
            self.app.devices_click('解绑')
            self.app.click_prompt_box()
            if (self.app.object_exist("realme Watch Saturn")
                    or self.app.object_exist("WYZE")
                    or self.app.object_exist("hey+")) == False:
                self.app.close_app()
                self.app_setting.restart_bluetooth()  #重启蓝牙
                self.driver = self.app.open_app()
                self.app.devices_click('SATURN_设备')
                self.app.devices_click('解绑')
            while self.app.object_exist(self.wyzeband_mac) == False:
                time.sleep(1)
            self.app.devices_click(self.wyzeband_mac)
            while self.app.object_exist("请在设备上点击确认") == False:
                time.sleep(1)
            self.app.devices_click('完成')
            self.app.devices_click('SATURN_设备')
            self.app.saturn_inputclick("160", "240", "160", "240")
            self.driver.keyevent(4)
            self.app.devices_click('SATURN_设备')
        time.sleep(1)
        for i in range(30, 100):
            try:
                self.log.debug(u'运行次数:' + str(i))
                self.driver.keyevent(4)
                self.app.devices_click('SATURN_APP')
                self.app.tv_send_notification(
                    '{"appMessage": {"appId": "app.qq", "text": "reeyx' +
                    str(i) + '", "title": ' + str(i) +
                    '}, "type": "APP_MESSAGE"}')
                self.log.debug(u'发送通知成功')
                self.driver.keyevent(4)
                self.app.devices_click('SATURN_设备')
                # self.app.device_home()
                # self.log.debug(u'返回上级页面成功')
                # self.app.device_downslide()
                # self.log.debug(u'向下滑动成功')
                self.app.saturn_inputslide("160", "80", "160", "160")
                self.log.debug(u'向下滑动')
                self.app.saturn_inputslide("160", "160", "160", "80")
                self.log.debug(u'向上滑动')
                self.app.saturn_inputslide("160", "160", "160", "160")
                self.log.debug(u'点击消息')
                # self.app.assert_getdevicepagename('notification_box_detail')
                # self.log.debug(u'进入消息详情页面成功')
                # self.app.device_home()
                # self.log.debug(u'返回上级页面成功')
                # self.app.device_home()
                # self.log.debug(u'返回主页面成功')
            except:
                self.log.error(u'第N次运行失败:' + str(i))
                raise