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'初始化测试数据')
Пример #3
0
    def setup(self):
        print("Test Start")
        self.config = ReadConfig(config_path)
        self.login_host = self.config.get_value("Wristband_Alpha", "host")
        self.login_host = self.login_host.encode('utf-8')                                                             #config文件获取host

        self.yaml = Yamlc(yaml_path).get_yaml_data(1, "get_historysport")
        self.method = Yamlc(yaml_path).get_yaml_data(1, "get_historysport", "method")
        self.url = Yamlc(yaml_path).get_yaml_data(1, "get_historysport", "url")
        self.parm = Yamlc(yaml_path).get_yaml_data(1, "get_historysport", "parm")
        self.expect = Yamlc(yaml_path).get_yaml_data(1, "get_historysport", "expect")                              #yaml文件获取传入参数
        self.url = self.login_host + self.url
        self.log = MyLog()
        self.log.debug(u'初始化测试数据')
 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'初始化测试数据')
Пример #5
0
class TestClass:
    def setup(self):
        print("Test Start")
        self.config = ReadConfig(config_path)
        self.login_host = self.config.get_value("Wristband_Alpha", "host")
        self.login_host = self.login_host.encode('utf-8')                                                             #config文件获取host

        self.yaml = Yamlc(yaml_path).get_yaml_data(1, "get_historysport")
        self.method = Yamlc(yaml_path).get_yaml_data(1, "get_historysport", "method")
        self.url = Yamlc(yaml_path).get_yaml_data(1, "get_historysport", "url")
        self.parm = Yamlc(yaml_path).get_yaml_data(1, "get_historysport", "parm")
        self.expect = Yamlc(yaml_path).get_yaml_data(1, "get_historysport", "expect")                              #yaml文件获取传入参数
        self.url = self.login_host + self.url
        self.log = MyLog()
        self.log.debug(u'初始化测试数据')

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

    case_name = Yamlc(yaml_path).get_yaml_data(1, "get_historysport", "case_name")
    @allure.story(case_name)
    @allure.severity('blocker')
    def test_get_historysport001(self):
        Returndata = Moudle("Wristband_Alpha").bind()
        self.headers = Returndata[1]
        r = Request().post_wirst_request(method=self.method, url=self.url, data=self.parm, header=self.headers)
        print(r)
        Assertions().assert_code(r['code'], self.expect['code'])
        Assertions().assert_code(r['status_code'], self.expect['status_code'])
Пример #6
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.config = ReadConfig(config_path)
        self.login_host = self.config.get_value("Wristband_Alpha", "host")
        self.login_host = self.login_host.encode('utf-8')  #config文件获取host

        self.yaml = Yamlc(yaml_path).get_yaml_data(1, "unbind_device")
        self.method = Yamlc(yaml_path).get_yaml_data(1, "unbind_device",
                                                     "method")
        self.url = Yamlc(yaml_path).get_yaml_data(1, "unbind_device", "url")
        self.parm = Yamlc(yaml_path).get_yaml_data(1, "unbind_device", "parm")
        self.expect = Yamlc(yaml_path).get_yaml_data(1, "unbind_device",
                                                     "expect")  #yaml文件获取传入参数
        self.parm2 = Yamlc(yaml_path).get_yaml_data(2, "unbind_device", "parm")
        self.expect2 = Yamlc(yaml_path).get_yaml_data(2, "unbind_device",
                                                      "expect")
        self.parm3 = Yamlc(yaml_path).get_yaml_data(3, "unbind_device", "parm")
        self.expect3 = Yamlc(yaml_path).get_yaml_data(3, "unbind_device",
                                                      "expect")
        self.url = self.login_host + self.url
        self.log = MyLog()
        self.log.debug(u'初始化测试数据')

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

    case_name = Yamlc(yaml_path).get_yaml_data(1, "unbind_device", "case_name")

    @allure.story(case_name)
    @allure.severity('blocker')
    def test_unbind_device001(self):
        Returndata = Moudle("Wristband_Alpha").bind()
        self.parm['device_token'] = Returndata[0]
        self.headers = Returndata[1]
        r = Request().post_wirst_request(method=self.method,
                                         url=self.url,
                                         data=self.parm,
                                         header=self.headers)
        print(r)
        Assertions().assert_code(r['code'], self.expect['code'])
        Assertions().assert_code(r['status_code'], self.expect['status_code'])
        Assertions().assert_time(r['time_total'], self.expect['respones_time'])
        Assertions().assert_code(r['message'], self.expect['message'])
        Assertions().assert_code(r['data']['rst'], self.expect['data']['rst'])

    case_name = Yamlc(yaml_path).get_yaml_data(2, "unbind_device", "case_name")

    @allure.story(case_name)
    @allure.severity('blocker')
    def test_unbind_device002(self):
        Returndata = Moudle("Wristband_Alpha").bind()
        self.parm2['device_token'] = Returndata[0]
        self.headers = Returndata[1]
        r = Request().post_wirst_request(method=self.method,
                                         url=self.url,
                                         data=self.parm2,
                                         header=self.headers)
        print(r)
        Assertions().assert_code(r['code'], self.expect2['code'])
        Assertions().assert_code(r['status_code'], self.expect2['status_code'])

    case_name = Yamlc(yaml_path).get_yaml_data(3, "unbind_device", "case_name")

    @allure.story(case_name)
    @allure.severity('blocker')
    def test_unbind_device002(self):
        Returndata = Moudle("Wristband_Alpha").bind()
        #
        self.parm3['device_token'] = Returndata[0] + 'Greey'
        self.headers = Returndata[1]
        r = Request().post_wirst_request(method=self.method,
                                         url=self.url,
                                         data=self.parm3,
                                         header=self.headers)
        print(r)
        Assertions().assert_code(r['code'], self.expect3['code'])
        Assertions().assert_code(r['status_code'], self.expect3['status_code'])
Пример #8
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"回到主页面")
Пример #9
0
 def setup(self):
     print("Test Start***********************")
     self.config = ReadConfig(config_path)
     self.login_host = self.config.get_value("Wristband_Alpha", "host").encode('utf-8')                         #config文件获取host
     firmware_ver = self.config.get_value("Wristband_Alpha", "firmware_ver").encode('utf-8')
     self.yaml = Yamlc(yaml_path).get_yaml_data(1, "bind_device")
     self.method = Yamlc(yaml_path).get_yaml_data(1, "bind_device", "method")
     self.url = Yamlc(yaml_path).get_yaml_data(1, "bind_device", "url")
     self.parm = Yamlc(yaml_path).get_yaml_data(1, "bind_device", "parm")
     self.expect = Yamlc(yaml_path).get_yaml_data(1, "bind_device", "expect")                                    #yaml文件获取传入参数
     self.parm2 = Yamlc(yaml_path).get_yaml_data(2, "bind_device", "parm")
     self.expect2 = Yamlc(yaml_path).get_yaml_data(2, "bind_device", "expect")
     self.parm3 = Yamlc(yaml_path).get_yaml_data(3, "bind_device", "parm")
     self.expect3 = Yamlc(yaml_path).get_yaml_data(3, "bind_device", "expect")
     self.parm4 = Yamlc(yaml_path).get_yaml_data(4, "bind_device", "parm")
     self.expect4 = Yamlc(yaml_path).get_yaml_data(4, "bind_device", "expect")
     self.parm5 = Yamlc(yaml_path).get_yaml_data(5, "bind_device", "parm")
     self.expect5 = Yamlc(yaml_path).get_yaml_data(5, "bind_device", "expect")
     self.parm6 = Yamlc(yaml_path).get_yaml_data(6, "bind_device", "parm")
     self.expect6 = Yamlc(yaml_path).get_yaml_data(6, "bind_device", "expect")
     self.parm7 = Yamlc(yaml_path).get_yaml_data(7, "bind_device", "parm")
     self.expect7 = Yamlc(yaml_path).get_yaml_data(7, "bind_device", "expect")
     env2 = "Wristband_Alpha"
     Returndata = Session().get_wristband_session(env2)
     self.wirst_cookies = Returndata[0]                                        #获取wrist端的cookies
     self.headers = Returndata[1]                                              #获取wrist端的headers
     self.headers['firmware_ver'] = firmware_ver
     self.url = self.login_host + self.url
     self.parm['device_token'] = self.wirst_cookies
     self.log = MyLog()
     self.log.debug(u'初始化测试数据')
Пример #10
0
class TestClass(object):
    def setup(self):
        print("Test Start***********************")
        self.config = ReadConfig(config_path)
        self.login_host = self.config.get_value("Wristband_Alpha", "host").encode('utf-8')                         #config文件获取host
        firmware_ver = self.config.get_value("Wristband_Alpha", "firmware_ver").encode('utf-8')
        self.yaml = Yamlc(yaml_path).get_yaml_data(1, "bind_device")
        self.method = Yamlc(yaml_path).get_yaml_data(1, "bind_device", "method")
        self.url = Yamlc(yaml_path).get_yaml_data(1, "bind_device", "url")
        self.parm = Yamlc(yaml_path).get_yaml_data(1, "bind_device", "parm")
        self.expect = Yamlc(yaml_path).get_yaml_data(1, "bind_device", "expect")                                    #yaml文件获取传入参数
        self.parm2 = Yamlc(yaml_path).get_yaml_data(2, "bind_device", "parm")
        self.expect2 = Yamlc(yaml_path).get_yaml_data(2, "bind_device", "expect")
        self.parm3 = Yamlc(yaml_path).get_yaml_data(3, "bind_device", "parm")
        self.expect3 = Yamlc(yaml_path).get_yaml_data(3, "bind_device", "expect")
        self.parm4 = Yamlc(yaml_path).get_yaml_data(4, "bind_device", "parm")
        self.expect4 = Yamlc(yaml_path).get_yaml_data(4, "bind_device", "expect")
        self.parm5 = Yamlc(yaml_path).get_yaml_data(5, "bind_device", "parm")
        self.expect5 = Yamlc(yaml_path).get_yaml_data(5, "bind_device", "expect")
        self.parm6 = Yamlc(yaml_path).get_yaml_data(6, "bind_device", "parm")
        self.expect6 = Yamlc(yaml_path).get_yaml_data(6, "bind_device", "expect")
        self.parm7 = Yamlc(yaml_path).get_yaml_data(7, "bind_device", "parm")
        self.expect7 = Yamlc(yaml_path).get_yaml_data(7, "bind_device", "expect")
        env2 = "Wristband_Alpha"
        Returndata = Session().get_wristband_session(env2)
        self.wirst_cookies = Returndata[0]                                        #获取wrist端的cookies
        self.headers = Returndata[1]                                              #获取wrist端的headers
        self.headers['firmware_ver'] = firmware_ver
        self.url = self.login_host + self.url
        self.parm['device_token'] = self.wirst_cookies
        self.log = MyLog()
        self.log.debug(u'初始化测试数据')

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

    case_name = Yamlc(yaml_path).get_yaml_data(1, "bind_device", "case_name").encode('utf-8')
    @allure.story(case_name)
    @allure.severity('blocker')
    def test_bind_device001(self):
        r = Request().post_wirst_request(self.method, self.url, self.parm, header=self.headers)
        print(r)
        Assertions().assert_code(r['code'], self.expect['code'])
        Assertions().assert_code(r['status_code'], self.expect['status_code'])
        Assertions().assert_time(r['time_total'], self.expect['respones_time'])
        Assertions().assert_code(r['message'], self.expect['message'])
        Assertions().assert_code(r['data']['rst'], self.expect['data']['rst'])

    case_name = Yamlc(yaml_path).get_yaml_data(2, "bind_device", "case_name").encode('utf-8')
    @allure.story(case_name)
    @allure.severity('blocker')
    def test_bind_device002(self):
        self.parm2['device_token'] = self.wirst_cookies
        headers = self.headers.copy()
        headers['firmware_ver'] = ''
        r = Request().post_wirst_request(self.method, self.url, self.parm2, header=headers)
        print(r)
        Assertions().assert_code(r['code'], self.expect2['code'])
        Assertions().assert_code(r['status_code'], self.expect2['status_code'])

    case_name = Yamlc(yaml_path).get_yaml_data(3, "bind_device", "case_name").encode('utf-8')
    @allure.story(case_name)
    @allure.severity('blocker')
    def test_bind_device003(self):
        self.parm3['device_token'] = self.wirst_cookies
        headers = self.headers.copy()
        headers['access_token'] = 'AAAAAAAAAAAAAAAA'
        r = Request().post_wirst_request(self.method, self.url, self.parm3, header=headers)
        print(r)
        Assertions().assert_code(r['code'], self.expect3['code'])
        Assertions().assert_code(r['status_code'], self.expect3['status_code'])

    case_name = Yamlc(yaml_path).get_yaml_data(4, "bind_device", "case_name").encode('utf-8')
    @allure.story(case_name)
    @allure.severity('blocker')
    def test_bind_device004(self):
        self.parm4['device_token'] = self.wirst_cookies
        r = Request().post_wirst_request(self.method, self.url, self.parm4, header=self.headers)
        print(r)
        Assertions().assert_code(r['code'], self.expect4['code'])
        Assertions().assert_code(r['status_code'], self.expect4['status_code'])

    case_name = Yamlc(yaml_path).get_yaml_data(5, "bind_device", "case_name").encode('utf-8')
    @allure.story(case_name)
    @allure.severity('blocker')
    def test_bind_device005(self):
        self.parm5['device_token'] = self.wirst_cookies
        r = Request().post_wirst_request(self.method, self.url, self.parm5, header=self.headers)
        print(r)
        Assertions().assert_code(r['code'], self.expect5['code'])
        Assertions().assert_code(r['status_code'], self.expect5['status_code'])

    case_name = Yamlc(yaml_path).get_yaml_data(6, "bind_device", "case_name").encode('utf-8')
    @allure.story(case_name)
    @allure.severity('blocker')
    def test_bind_device006(self):
        self.parm6['device_token'] = self.wirst_cookies + 'Greey'
        r = Request().post_wirst_request(self.method, self.url, self.parm6, header=self.headers)
        print(r)
        Assertions().assert_code(r['code'], self.expect6['code'])
        Assertions().assert_code(r['status_code'], self.expect6['status_code'])