Пример #1
0
    def setUpClass(cls):
        # 更改Appium启动参数
        appium_config.desired_caps['automationName'] = 'Appium'
        # 启动Appium
        appium_config.AppiumStart(cls)
        cls.extend = Appium_Extend(cls.driver)

        # 获取手机屏幕分辨率
        cls.x = cls.driver.get_window_size()['width']
        cls.y = cls.driver.get_window_size()['height']

        # 判断当前手机网络
        network_num = cls.driver.network_connection
        if network_num != 6:
            # 开启手机wifi网络
            cls.driver.set_network_connection(ConnectionType.WIFI_ONLY)

        time.sleep(6)
        # 判断是否存在收藏提醒
        if go_comic.go_comic(cls) is True:
            print '存在收藏更新提醒,点击关闭测试通过'
        else:
            pass

        # 设置首页顶部tab
        element1 = cls.driver.find_element_by_id(Page_config.PageID.homeTab)
        cls.elements1 = element1.find_elements_by_class_name(
            'android.widget.FrameLayout')
Пример #2
0
    def setUpClass(cls):
        # 更改Appium启动参数
        appium_config.desired_caps['automationName'] = 'Appium'
        # 启动Appium
        appium_config.AppiumStart(cls)

        # 获取手机屏幕分辨率
        cls.x = cls.driver.get_window_size()['width']
        cls.y = cls.driver.get_window_size()['height']

        # 进入我的页面
        time.sleep(5)
        cls.driver.find_element_by_id(Page_config.PageID.homeMy).click()
Пример #3
0
    def setUpClass(cls):
        # 更改Appium启动参数
        appium_config.desired_caps['automationName'] = 'Uiautomator2'
        # 启动Appium
        appium_config.AppiumStart(cls)

        # 获取手机屏幕分辨率
        cls.x = cls.driver.get_window_size()['width']
        cls.y = cls.driver.get_window_size()['height']

        time.sleep(5)

        # 判断是否存在收藏提醒
        if go_comic.go_comic(cls) is True:
            print '存在收藏更新提醒,点击关闭测试通过'
        else:
            pass

        # 进入分类页面
        cls.driver.find_element_by_id(Page_config.PageID.tab_category).click()

        # 分类页面中随机选择一部漫画进入
        for x in range(1, random.randint(3, 31)):
            Swipe_op.SwipeDown(cls)

        element_names = cls.driver.find_elements_by_id('com.xmtj.mkz:id/name')
        element_name = element_names[random.randint(3, len(element_names) - 1)]
        element_name.click()
        try:
            WebDriverWait(cls.driver,
                          30).until(lambda driver: driver.find_element_by_id(
                              Page_config.PageID.comic_read))
        except Exception, e:
            # 判断超时时,点击刷新页面
            for i in range(1, 21):
                try:
                    element_refresh = cls.driver.find_elements_by_id(
                        'com.xmtj.mkz:id/refresh')
                    if element_refresh is not None:
                        element_refresh.click()
                    break
                except Exception, e:
                    print '网络出错,页面未能刷新'
                    continue
Пример #4
0
    def setUpClass(cls):
        # 更改Appium启动参数
        appium_config.desired_caps['automationName'] = 'Uiautomator2'
        # 启动Appium
        appium_config.AppiumStart(cls)
        cls.extend = Appium_Extend(cls.driver)

        # 获取手机屏幕分辨率
        cls.x = cls.driver.get_window_size()['width']
        cls.y = cls.driver.get_window_size()['height']

        time.sleep(5)

        # 进入忘记密码页面
        cls.driver.find_element_by_id(Page_config.PageID.homeMy).click()
        cls.driver.find_element_by_id(Page_config.PageID.myLogin).click()
        time.sleep(2)
        cls.driver.find_element_by_id(
            Page_config.PageID.forgetPasswordID).click()
Пример #5
0
    def setUpClass(cls):
        # 更改Appium启动参数
        appium_config.desired_caps['automationName'] = 'Appium'
        # 启动Appium
        appium_config.AppiumStart(cls)

        # 获取手机屏幕分辨率
        cls.x = cls.driver.get_window_size()['width']
        cls.y = cls.driver.get_window_size()['height']

        time.sleep(5)

        # 判断是否存在收藏提醒
        if go_comic.go_comic(cls) is True:
            print '存在收藏更新提醒,点击关闭测试通过'
        else:
            pass

        # 进入我的页面
        cls.driver.find_element_by_id(Page_config.PageID.homeMy).click()
Пример #6
0
    def setUpClass(cls):
        # 更改Appium启动参数
        appium_config.desired_caps['automationName'] = 'Appium'
        # 启动Appium
        appium_config.AppiumStart(cls)
        cls.extend = Appium_Extend(cls.driver)

        # 获取手机屏幕分辨率
        cls.x = cls.driver.get_window_size()['width']
        cls.y = cls.driver.get_window_size()['height']

        time.sleep(5)

        # 判断是否存在收藏提醒
        if go_comic.go_comic(cls) is True:
            print '存在收藏更新提醒,点击关闭测试通过'
        else:
            pass

        # 进入分类页面
        cls.driver.find_element_by_id('com.xmtj.mkz:id/tab_category').click()
Пример #7
0
    def setUpClass(cls):
        # 更改Appium启动参数
        appium_config.desired_caps['automationName'] = 'Uiautomator2'
        # 启动Appium
        appium_config.AppiumStart(cls)
        cls.extend = Appium_Extend(cls.driver)

        # 获取手机屏幕分辨率
        cls.x = cls.driver.get_window_size()['width']
        cls.y = cls.driver.get_window_size()['height']

        # 进入注册页面
        time.sleep(6)
        cls.driver.find_element_by_id(Page_config.PageID.homeMy).click()
        cls.driver.find_element_by_id(Page_config.PageID.myLogin).click()
        while True:
            try:
                cls.driver.find_element_by_id(Page_config.PageID.regID).click()
                break
            except Exception, e:
                continue