Beispiel #1
0
    def test_filemanager(self):

        app_name = 'filemanager'

        try:
            self.device.start_application('com.android.filemanager/.FileManagerActivity')
            time.sleep(2)
            cmd = 'am force-stop {0} '.format(
                'com.android.filemanager')
            self.device.shell(cmd)
            time.sleep(5)
            self.device.start_application('com.android.filemanager/.FileManagerActivity')

            time.sleep(2)
            if myuiautomator.in_or_not(DEVICE_NAME, u'分类浏览') == True:
                myuiautomator.click_popup_window(DEVICE_NAME, [u'分类浏览'])
                time.sleep(1)
                common.screenshots(app_name, '分类浏览')
            else:
                pass

            time.sleep(2)
            if myuiautomator.in_or_not(DEVICE_NAME, u'音乐') == True:
                myuiautomator.click_popup_window(DEVICE_NAME, [u'音乐'])
                time.sleep(1)
                common.screenshots(app_name, '音乐')
                time.sleep(2)
                self.device.send_keyevent(adbtools.KeyCode.KEYCODE_BACK)
            else:
                pass

            time.sleep(2)
            if myuiautomator.in_or_not(DEVICE_NAME, u'文档') == True:
                myuiautomator.click_popup_window(DEVICE_NAME, [u'文档'])
                time.sleep(1)
                common.screenshots(app_name, '文档')
                time.sleep(2)
                self.device.send_keyevent(adbtools.KeyCode.KEYCODE_BACK)
            else:
                pass
            time.sleep(2)
            if myuiautomator.in_or_not(DEVICE_NAME, u'手机存储') == True:
                myuiautomator.click_popup_window(DEVICE_NAME, [u'手机存储'])
                time.sleep(1)
                common.screenshots(app_name, '手机存储')

            self.assertEqual(1, 1)
        except Exception, ex:
            print ex
            self.assertEqual(1, 0, ex)
    def test_qq(self):
        app_name = 'qq'

        try:
            self.device.start_application(
                'com.tencent.mobileqq/.activity.SplashActivity')
            time.sleep(2)
            cmd = 'am force-stop {0} '.format('com.tencent.mobileqq')
            self.device.shell(cmd)
            time.sleep(2)
            self.device.start_application(
                'com.tencent.mobileqq/.activity.SplashActivity')
            time.sleep(2)
            common.screenshots(app_name, '首页')
            time.sleep(2)
            # 腾讯新闻
            time.sleep(3)
            if myuiautomator.in_or_not(DEVICE_NAME, u'服务号') == True:
                myuiautomator.click_popup_window(DEVICE_NAME, [u'服务号'])
                time.sleep(3)
                if myuiautomator.in_or_not(DEVICE_NAME, u'腾讯新闻') == True:
                    myuiautomator.click_popup_window(DEVICE_NAME, [u'腾讯新闻'])
                    time.sleep(2)
                    common.screenshots(app_name, '腾讯新闻')
                    time.sleep(2)
                    self.device.send_keyevent(adbtools.KeyCode.KEYCODE_BACK)
                else:
                    pass
                time.sleep(2)
                self.device.send_keyevent(adbtools.KeyCode.KEYCODE_BACK)
            else:
                pass
            # 联系人
            time.sleep(2)
            myuiautomator.click_popup_window(DEVICE_NAME, [u'联系人'])
            time.sleep(2)
            common.screenshots(app_name, '联系人')
            # 动态
            time.sleep(2)
            myuiautomator.click_popup_window(DEVICE_NAME, [u'动态'])
            time.sleep(2)
            common.screenshots(app_name, '动态')
            cmd = 'am force-stop {0} '.format('com.tencent.mobileqq')
            self.device.shell(cmd)
        except Exception, ex:
            print ex
            self.assertEqual(1, 0, ex)
Beispiel #3
0
    def test_feedback(self):
        app_name = 'feedback'

        try:
            self.device.start_application('com.bbk.iqoo.feedback/.activities.UserFeedBackActivity')
            time.sleep(2)
            cmd = 'am force-stop {0} '.format(
                'com.bbk.iqoo.feedback')
            self.device.shell(cmd)
            time.sleep(1)
            self.device.start_application('com.bbk.iqoo.feedback/.activities.UserFeedBackActivity')
            time.sleep(2)
            common.screenshots(app_name, '意见反馈')

            # 我的反馈
            time.sleep(10)
            cmd = 'input tap {0} {1}'.format(
                int(self.width / 20 * 19), (int(self.height / 100 * 7)))
            self.device.shell(cmd)
            time.sleep(1)
            common.screenshots(app_name, '我的反馈')
            time.sleep(2)
            self.device.send_keyevent(adbtools.KeyCode.KEYCODE_BACK)
            # 反馈
            time.sleep(2)
            if myuiautomator.in_or_not(DEVICE_NAME, u'闪退') == True:
                myuiautomator.click_popup_window(DEVICE_NAME, [u'闪退'])
                time.sleep(1)
                common.screenshots(app_name, '闪退')
                time.sleep(2)
                self.device.send_keyevent(adbtools.KeyCode.KEYCODE_BACK)
            # 常见帮助
            time.sleep(2)
            myuiautomator.click_popup_window(DEVICE_NAME, [u'常见帮助'])
            time.sleep(20)
            common.screenshots(app_name, '常见帮助')
            # 问题
            time.sleep(10)
            cmd = 'input tap {0} {1}'.format(
                int(self.width / 2), (int(self.height / 2)))
            self.device.shell(cmd)
            time.sleep(1)
            common.screenshots(app_name, '问题')

        except Exception, ex:
            print ex
            self.assertEqual(1, 0, ex)
    def test_appstore(self):
        app_name = 'appstore'

        try:
            self.device.start_application(
                'com.bbk.appstore/.ui.AppStoreTabActivity')
            time.sleep(10)
            cmd = 'am force-stop {0} '.format('com.bbk.appstore')
            self.device.shell(cmd)
            time.sleep(1)
            self.device.start_application(
                'com.bbk.appstore/.ui.AppStoreTabActivity')
            time.sleep(10)
            common.screenshots(app_name, '首页')
            # 下载列表
            time.sleep(3)
            cmd = 'input tap {0} {1}'.format(int(self.width / 20 * 19),
                                             (int(self.height / 100 * 7)))
            self.device.shell(cmd)
            time.sleep(1)
            common.screenshots(app_name, '下载列表')
            time.sleep(2)
            self.device.send_keyevent(adbtools.KeyCode.KEYCODE_BACK)
            # 热门
            time.sleep(2)
            if myuiautomator.in_or_not(DEVICE_NAME, u'热门') == True:
                myuiautomator.click_popup_window(DEVICE_NAME, [u'热门'])
                time.sleep(2)
                common.screenshots(app_name, '热门')
                time.sleep(2)
                self.device.send_keyevent(adbtools.KeyCode.KEYCODE_BACK)
            else:
                pass
            # 必备
            time.sleep(2)
            if myuiautomator.in_or_not(DEVICE_NAME, u'必备') == True:
                myuiautomator.click_popup_window(DEVICE_NAME, [u'必备'])
                time.sleep(2)
                common.screenshots(app_name, '必备')
                time.sleep(2)
                self.device.send_keyevent(adbtools.KeyCode.KEYCODE_BACK)
            else:
                pass
            # 新品
            time.sleep(2)
            if myuiautomator.in_or_not(DEVICE_NAME, u'新品') == True:
                myuiautomator.click_popup_window(DEVICE_NAME, [u'新品'])
                time.sleep(2)
                common.screenshots(app_name, '新品')
                time.sleep(2)
                self.device.send_keyevent(adbtools.KeyCode.KEYCODE_BACK)
            else:
                pass
            # 分类
            time.sleep(2)
            if myuiautomator.in_or_not(DEVICE_NAME, u'分类') == True:
                myuiautomator.click_popup_window(DEVICE_NAME, [u'分类'])
                time.sleep(2)
                common.screenshots(app_name, '分类')
                time.sleep(2)
                self.device.send_keyevent(adbtools.KeyCode.KEYCODE_BACK)
            else:
                pass
            # 游戏中心
            time.sleep(2)
            if myuiautomator.in_or_not(DEVICE_NAME, u'游戏中心') == True:
                myuiautomator.click_popup_window(DEVICE_NAME, [u'游戏中心'])
                time.sleep(2)
                common.screenshots(app_name, '游戏中心')
                # 游戏中心-推荐-礼包
                time.sleep(2)
                cmd = 'input tap {0} {1}'.format(int(self.width / 4 - 80),
                                                 (int(self.height / 25 * 9)))
                self.device.shell(cmd)
                time.sleep(2)
                common.screenshots(app_name, '游戏中心-推荐-礼包')
                # 游戏中心-推荐-礼包-我的礼包
                time.sleep(2)
                if myuiautomator.in_or_not(DEVICE_NAME, u'游戏中心') == True:
                    myuiautomator.click_popup_window(DEVICE_NAME, [u'我的礼包'])
                    time.sleep(2)
                    common.screenshots(app_name, '游戏中心-推荐-礼包-我的礼包')
                    time.sleep(2)
                    self.device.send_keyevent(adbtools.KeyCode.KEYCODE_BACK)
                else:
                    pass
                time.sleep(2)
                self.device.send_keyevent(adbtools.KeyCode.KEYCODE_BACK)
                # 游戏中心-推荐-专题
                time.sleep(2)
                cmd = 'input tap {0} {1}'.format(int(self.width / 2 - 80),
                                                 (int(self.height / 25 * 9)))
                self.device.shell(cmd)
                time.sleep(2)
                common.screenshots(app_name, '游戏中心-推荐-专题')
                time.sleep(2)
                self.device.send_keyevent(adbtools.KeyCode.KEYCODE_BACK)
                # 游戏中心-推荐-精选
                time.sleep(2)
                cmd = 'input tap {0} {1}'.format(int(self.width / 2 + 80),
                                                 (int(self.height / 25 * 9)))
                self.device.shell(cmd)
                time.sleep(2)
                common.screenshots(app_name, '游戏中心-推荐-精选')
                time.sleep(2)
                self.device.send_keyevent(adbtools.KeyCode.KEYCODE_BACK)
                # 游戏中心-推荐-社区
                time.sleep(2)
                cmd = 'input tap {0} {1}'.format(int(self.width / 4 * 3 + 80),
                                                 (int(self.height / 25 * 9)))
                self.device.shell(cmd)
                time.sleep(2)
                common.screenshots(app_name, '游戏中心-推荐-社区')
                # 游戏中心-推荐-社区-好友广场
                time.sleep(2)
                myuiautomator.click_popup_window(DEVICE_NAME, [u'好友广场'])
                time.sleep(2)
                common.screenshots(app_name, '游戏中心-推荐-社区-好友广场')
                # 好友信息
                time.sleep(2)
                cmd = 'input tap {0} {1}'.format(int(self.width / 2),
                                                 (int(self.height / 2)))
                self.device.shell(cmd)
                time.sleep(20)
                common.screenshots(app_name, '好友信息')
                time.sleep(2)
                self.device.send_keyevent(adbtools.KeyCode.KEYCODE_BACK)
                time.sleep(2)
                self.device.send_keyevent(adbtools.KeyCode.KEYCODE_BACK)
                # 排行
                time.sleep(2)
                cmd = 'input tap {0} {1}'.format(int(self.width / 2 - 80),
                                                 (int(self.height / 21 * 20)))
                self.device.shell(cmd)
                time.sleep(2)
                common.screenshots(app_name, '排行')
                # 分类
                time.sleep(2)
                cmd = 'input tap {0} {1}'.format(int(self.width / 2 + 80),
                                                 (int(self.height / 21 * 20)))
                self.device.shell(cmd)
                time.sleep(2)
                common.screenshots(app_name, '分类')
                # 我
                time.sleep(2)
                cmd = 'input tap {0} {1}'.format(int(self.width / 4 * 3 + 80),
                                                 (int(self.height / 21 * 20)))
                self.device.shell(cmd)
                time.sleep(2)
                common.screenshots(app_name, '我')
                # 我-设置
                time.sleep(3)
                cmd = 'input tap {0} {1}'.format(int(self.width / 20),
                                                 (int(self.height / 100 * 7)))
                self.device.shell(cmd)
                time.sleep(1)
                common.screenshots(app_name, '我-设置')
                time.sleep(3)
                cmd = 'input swipe {0} {1} {2} {3} 200'.format(
                    int(self.width / 2), int(self.height / 2),
                    int(self.height / 4), int(self.height / 4))
                self.device.shell(cmd)
                time.sleep(2)
                if myuiautomator.in_or_not(DEVICE_NAME, u'意见反馈') == True:
                    myuiautomator.click_popup_window(DEVICE_NAME, [u'意见反馈'])
                    time.sleep(2)
                    common.screenshots(app_name, '我-设置-意见反馈')
                    time.sleep(2)
                    self.device.send_keyevent(adbtools.KeyCode.KEYCODE_BACK)
                else:
                    pass
                time.sleep(2)
                self.device.send_keyevent(adbtools.KeyCode.KEYCODE_BACK)
                # 我-我的论坛
                time.sleep(2)
                if myuiautomator.in_or_not(DEVICE_NAME, u'我的论坛') == True:
                    myuiautomator.click_popup_window(DEVICE_NAME, [u'我的论坛'])
                    time.sleep(2)
                    common.screenshots(app_name, '我-我的论坛')
                    time.sleep(2)
                    self.device.send_keyevent(adbtools.KeyCode.KEYCODE_BACK)
                else:
                    pass
                # 我-V钻.礼券
                time.sleep(2)
                if myuiautomator.in_or_not(DEVICE_NAME, u'V钻.礼券') == True:
                    myuiautomator.click_popup_window(DEVICE_NAME, [u'V钻.礼券'])
                    time.sleep(2)
                    common.screenshots(app_name, '我-V钻.礼券')
                    time.sleep(2)
                    self.device.send_keyevent(adbtools.KeyCode.KEYCODE_BACK)
                else:
                    pass
                # 我-消息.好友
                time.sleep(2)
                if myuiautomator.in_or_not(DEVICE_NAME, u'消息.好友') == True:
                    myuiautomator.click_popup_window(DEVICE_NAME, [u'消息.好友'])
                    time.sleep(2)
                    common.screenshots(app_name, '我-消息.好友')
                    time.sleep(2)
                    self.device.send_keyevent(adbtools.KeyCode.KEYCODE_BACK)
                else:
                    pass
                time.sleep(2)
                self.device.send_keyevent(adbtools.KeyCode.KEYCODE_BACK)
            else:
                pass
            # 应用
            time.sleep(2)
            myuiautomator.click_popup_window(DEVICE_NAME, [u'应用'])
            time.sleep(2)
            common.screenshots(app_name, '应用')
            # 游戏
            time.sleep(2)
            myuiautomator.click_popup_window(DEVICE_NAME, [u'游戏'])
            time.sleep(2)
            common.screenshots(app_name, '游戏')
            # 排行
            time.sleep(2)
            myuiautomator.click_popup_window(DEVICE_NAME, [u'排行'])
            time.sleep(2)
            common.screenshots(app_name, '排行')
            # 管理
            time.sleep(2)
            if myuiautomator.in_or_not(DEVICE_NAME, u'管理') == True:
                myuiautomator.click_popup_window(DEVICE_NAME, [u'管理'])
                time.sleep(2)
                common.screenshots(app_name, '管理')
                # 积分可用
                time.sleep(2)
                cmd = 'input tap {0} {1}'.format(int(self.width / 5),
                                                 (int(self.height / 25 * 7)))
                self.device.shell(cmd)
                time.sleep(10)
                common.screenshots(app_name, '积分可用')
                time.sleep(2)
                self.device.send_keyevent(adbtools.KeyCode.KEYCODE_BACK)
                # 下载领积分
                time.sleep(2)
                cmd = 'input tap {0} {1}'.format(int(self.width / 2),
                                                 (int(self.height / 25 * 7)))
                self.device.shell(cmd)
                time.sleep(5)
                common.screenshots(app_name, '下载领积分')
                # 下载领积分-查看活动说明
                time.sleep(2)
                cmd = 'input tap {0} {1}'.format(int(self.width / 4 * 3),
                                                 (int(self.height / 5 * 4)))
                self.device.shell(cmd)
                time.sleep(2)
                common.screenshots(app_name, '下载领积分-查看活动说明')
                time.sleep(2)
                self.device.send_keyevent(adbtools.KeyCode.KEYCODE_BACK)
                time.sleep(2)
                self.device.send_keyevent(adbtools.KeyCode.KEYCODE_BACK)
                # 会员中心
                time.sleep(2)
                cmd = 'input tap {0} {1}'.format(int(self.width / 5 * 4),
                                                 (int(self.height / 25 * 7)))
                self.device.shell(cmd)
                time.sleep(10)
                common.screenshots(app_name, '会员中心')
                time.sleep(2)
                self.device.send_keyevent(adbtools.KeyCode.KEYCODE_BACK)
                # 应用卸载
                time.sleep(2)
                if myuiautomator.in_or_not(DEVICE_NAME, u'应用卸载') == True:
                    myuiautomator.click_popup_window(DEVICE_NAME, [u'应用卸载'])
                    time.sleep(2)
                    common.screenshots(app_name, '应用卸载')
                    time.sleep(2)
                    self.device.send_keyevent(adbtools.KeyCode.KEYCODE_BACK)
                else:
                    pass
                # 空间清理
                time.sleep(2)
                if myuiautomator.in_or_not(DEVICE_NAME, u'空间清理') == True:
                    myuiautomator.click_popup_window(DEVICE_NAME, [u'空间清理'])
                    time.sleep(2)
                    common.screenshots(app_name, '空间清理')
                    # 帮助
                    time.sleep(2)
                    if myuiautomator.in_or_not(DEVICE_NAME, u'帮助') == True:
                        myuiautomator.click_popup_window(DEVICE_NAME, [u'帮助'])
                        time.sleep(2)
                        common.screenshots(app_name, '帮助')
                        time.sleep(2)
                        self.device.send_keyevent(
                            adbtools.KeyCode.KEYCODE_BACK)
                    else:
                        pass
                    time.sleep(2)
                    self.device.send_keyevent(adbtools.KeyCode.KEYCODE_BACK)
                else:
                    pass
                # 应用同步
                time.sleep(2)
                if myuiautomator.in_or_not(DEVICE_NAME, u'应用同步') == True:
                    myuiautomator.click_popup_window(DEVICE_NAME, [u'应用同步'])
                    time.sleep(2)
                    common.screenshots(app_name, '应用同步')
                    time.sleep(2)
                    self.device.send_keyevent(adbtools.KeyCode.KEYCODE_BACK)
                else:
                    pass
                # 意见反馈
                time.sleep(2)
                if myuiautomator.in_or_not(DEVICE_NAME, u'意见反馈') == True:
                    myuiautomator.click_popup_window(DEVICE_NAME, [u'意见反馈'])
                    time.sleep(2)
                    common.screenshots(app_name, '意见反馈')
                    time.sleep(2)
                    self.device.send_keyevent(adbtools.KeyCode.KEYCODE_BACK)
                else:
                    pass
                # 设置
                time.sleep(2)
                if myuiautomator.in_or_not(DEVICE_NAME, u'意见反馈') == True:
                    myuiautomator.click_popup_window(DEVICE_NAME, [u'设置'])
                    time.sleep(2)
                    common.screenshots(app_name, '设置')
                    time.sleep(2)
                    self.device.send_keyevent(adbtools.KeyCode.KEYCODE_BACK)
                else:
                    pass
            else:
                pass

        except Exception, ex:
            print ex
            self.assertEqual(1, 0, ex)
    def test_isecure(self):
        app_name = 'isecure'

        try:
            self.device.start_application('com.iqoo.secure/.MainActivity')
            time.sleep(2)
            cmd = 'am force-stop {0} '.format('com.iqoo.secure')
            self.device.shell(cmd)
            time.sleep(1)
            self.device.start_application('com.iqoo.secure/.MainActivity')
            time.sleep(2)
            common.screenshots(app_name, '首页')

            # 首页-设置
            time.sleep(10)
            cmd = 'input tap {0} {1}'.format(int(self.width / 20 * 19),
                                             (int(self.height / 100 * 7)))
            self.device.shell(cmd)
            time.sleep(1)
            common.screenshots(app_name, '首页-设置')
            # 首页-设置-加速白名单
            time.sleep(2)
            if myuiautomator.in_or_not(DEVICE_NAME, u'加速白名单') == True:
                myuiautomator.click_popup_window(DEVICE_NAME, [u'加速白名单'])
                time.sleep(1)
                common.screenshots(app_name, '首页-设置-加速白名单')
                time.sleep(2)
                self.device.send_keyevent(adbtools.KeyCode.KEYCODE_BACK)
            else:
                pass
            time.sleep(2)
            self.device.send_keyevent(adbtools.KeyCode.KEYCODE_BACK)
            # 首页-点击体检
            time.sleep(2)
            if myuiautomator.in_or_not(DEVICE_NAME, u'点击体检') == True:
                myuiautomator.click_popup_window(DEVICE_NAME, [u'点击体检'])
                time.sleep(20)
                common.screenshots(app_name, '首页-点击体检')
                time.sleep(2)
                self.device.send_keyevent(adbtools.KeyCode.KEYCODE_BACK)
            else:
                pass
            # 空间管理
            time.sleep(2)
            if myuiautomator.in_or_not(DEVICE_NAME, u'空间管理') == True:
                myuiautomator.click_popup_window(DEVICE_NAME, [u'空间管理'])
                time.sleep(5)
                common.screenshots(app_name, '空间管理')
                # 空间管理-设置
                time.sleep(2)
                cmd = 'input tap {0} {1}'.format(int(self.width / 20 * 19),
                                                 (int(self.height / 100 * 7)))
                self.device.shell(cmd)
                time.sleep(1)
                common.screenshots(app_name, '空间管理-设置')
                time.sleep(2)
                self.device.send_keyevent(adbtools.KeyCode.KEYCODE_BACK)
                time.sleep(2)
                self.device.send_keyevent(adbtools.KeyCode.KEYCODE_BACK)
            else:
                pass
            # 流量监控
            time.sleep(2)
            if myuiautomator.in_or_not(DEVICE_NAME, u'流量监控') == True:
                myuiautomator.click_popup_window(DEVICE_NAME, [u'流量监控'])
                time.sleep(2)
                common.screenshots(app_name, '流量监控')
                # 流量监控-设置
                time.sleep(2)
                if myuiautomator.in_or_not(DEVICE_NAME, u'设置') == True:
                    myuiautomator.click_popup_window(DEVICE_NAME, [u'设置'])
                    time.sleep(2)
                    common.screenshots(app_name, '流量监控-设置')
                    time.sleep(2)
                    self.device.send_keyevent(adbtools.KeyCode.KEYCODE_BACK)
                else:
                    pass
                time.sleep(2)
                self.device.send_keyevent(adbtools.KeyCode.KEYCODE_BACK)
            else:
                pass
            # 软件管理
            time.sleep(2)
            if myuiautomator.in_or_not(DEVICE_NAME, u'软件管理') == True:
                myuiautomator.click_popup_window(DEVICE_NAME, [u'软件管理'])
                time.sleep(5)
                common.screenshots(app_name, '软件管理')
                time.sleep(2)
                self.device.send_keyevent(adbtools.KeyCode.KEYCODE_BACK)
            else:
                pass
            # 省电管理
            time.sleep(2)
            if myuiautomator.in_or_not(DEVICE_NAME, u'省电管理') == True:
                myuiautomator.click_popup_window(DEVICE_NAME, [u'省电管理'])
                time.sleep(5)
                common.screenshots(app_name, '省电管理')
                time.sleep(2)
                self.device.send_keyevent(adbtools.KeyCode.KEYCODE_BACK)
            else:
                pass
            # 骚扰拦截
            time.sleep(2)
            if myuiautomator.in_or_not(DEVICE_NAME, u'骚扰拦截') == True:
                myuiautomator.click_popup_window(DEVICE_NAME, [u'骚扰拦截'])
                time.sleep(5)
                common.screenshots(app_name, '骚扰拦截')
                # 骚扰拦截-设置
                time.sleep(2)
                if myuiautomator.in_or_not(DEVICE_NAME, u'设置') == True:
                    myuiautomator.click_popup_window(DEVICE_NAME, [u'设置'])
                    time.sleep(5)
                    common.screenshots(app_name, '骚扰拦截-设置')
                    time.sleep(2)
                    self.device.send_keyevent(adbtools.KeyCode.KEYCODE_BACK)
                else:
                    pass
                time.sleep(2)
                self.device.send_keyevent(adbtools.KeyCode.KEYCODE_BACK)
            else:
                pass
            # 病毒查杀
            time.sleep(2)
            if myuiautomator.in_or_not(DEVICE_NAME, u'病毒查杀') == True:
                myuiautomator.click_popup_window(DEVICE_NAME, [u'病毒查杀'])
                time.sleep(2)
                common.screenshots(app_name, '病毒查杀')
                time.sleep(2)
                self.device.send_keyevent(adbtools.KeyCode.KEYCODE_BACK)
            else:
                pass
            # 隐私空间
            time.sleep(2)
            if myuiautomator.in_or_not(DEVICE_NAME, u'隐私空间') == True:
                myuiautomator.click_popup_window(DEVICE_NAME, [u'隐私空间'])
                time.sleep(2)
                common.screenshots(app_name, '隐私空间')
                time.sleep(2)
                self.device.send_keyevent(adbtools.KeyCode.KEYCODE_BACK)
            else:
                pass
            # 查找手机
            time.sleep(2)
            if myuiautomator.in_or_not(DEVICE_NAME, u'手机寻回') == True:
                myuiautomator.click_popup_window(DEVICE_NAME, [u'手机寻回'])
                time.sleep(2)
                common.screenshots(app_name, '手机寻回')
                # 查找手机-帮助
                time.sleep(2)
                if myuiautomator.in_or_not(DEVICE_NAME, u'帮助') == True:
                    myuiautomator.click_popup_window(DEVICE_NAME, [u'帮助'])
                    time.sleep(2)
                    common.screenshots(app_name, '手机寻回帮助')
                    time.sleep(2)
                    self.device.send_keyevent(adbtools.KeyCode.KEYCODE_BACK)
                else:
                    pass
                time.sleep(2)
                self.device.send_keyevent(adbtools.KeyCode.KEYCODE_BACK)
            else:
                pass

        except Exception, ex:
            print ex
            self.assertEqual(1, 0, ex)
    def test_setting(self):

        app_name = 'setting'

        try:
            cmd = 'am force-stop {0} '.format('com.android.settings')
            self.device.shell(cmd)
            time.sleep(2)
            self.device.start_application('com.android.settings/.Settings')
            time.sleep(2)
            common.screenshots(app_name, '设置')
            self.assertEqual(1, 1)

            # WLAN
            time.sleep(2)
            if myuiautomator.in_or_not(DEVICE_NAME, u'WLAN') == True:
                myuiautomator.click_popup_window(DEVICE_NAME, [u'WLAN'])
                time.sleep(2)
                common.screenshots(app_name, 'WLAN')

                time.sleep(1)
                if myuiautomator.in_or_not(DEVICE_NAME, u'添加网络') == True:
                    myuiautomator.click_popup_window(DEVICE_NAME, [u'添加网络'])
                    time.sleep(2)
                    common.screenshots(app_name, '添加网络')
                    time.sleep(1)
                    myuiautomator.click_popup_window(DEVICE_NAME, [u'取消'])
                else:
                    pass
                time.sleep(2)
                self.device.send_keyevent(adbtools.KeyCode.KEYCODE_BACK)
            else:
                pass

            # 个人热点
            time.sleep(2)
            if myuiautomator.in_or_not(DEVICE_NAME, u'个人热点') == True:
                myuiautomator.click_popup_window(DEVICE_NAME, [u'个人热点'])
                time.sleep(2)
                common.screenshots(app_name, '个人热点')
                # 密码配置
                time.sleep(2)
                if myuiautomator.in_or_not(DEVICE_NAME, u'密码配置') == True:
                    myuiautomator.click_popup_window(DEVICE_NAME, [u'密码配置'])
                    time.sleep(2)
                    common.screenshots(app_name, '密码配置')
                    time.sleep(2)
                    myuiautomator.click_popup_window(DEVICE_NAME, [u'取消'])
                else:
                    pass
            #     连接管理
                time.sleep(2)
                if myuiautomator.in_or_not(DEVICE_NAME, u'连接管理') == True:
                    myuiautomator.click_popup_window(DEVICE_NAME, [u'连接管理'])
                    time.sleep(2)
                    if myuiautomator.in_or_not(DEVICE_NAME, u'允许连接数量') == True:
                        myuiautomator.click_popup_window(
                            DEVICE_NAME, [u'允许连接数量'])
                        time.sleep(2)
                        common.screenshots(app_name, '允许连接数量')
                        time.sleep(1)
                        self.device.send_keyevent(
                            adbtools.KeyCode.KEYCODE_BACK)
                    else:
                        pass
                    time.sleep(1)
                    self.device.send_keyevent(adbtools.KeyCode.KEYCODE_BACK)
                else:
                    pass

            #     其他共享方式
                time.sleep(2)
                if myuiautomator.in_or_not(DEVICE_NAME, u'其他共享方式') == True:
                    myuiautomator.click_popup_window(DEVICE_NAME, [u'其他共享方式'])
                    time.sleep(2)
                    common.screenshots(app_name, '其他共享方式')
                    #     帮助
                    time.sleep(2)
                    if myuiautomator.in_or_not(DEVICE_NAME, u'帮助') == True:
                        myuiautomator.click_popup_window(DEVICE_NAME, [u'帮助'])
                        time.sleep(2)
                        common.screenshots(app_name, '其他共享方式-帮助')
                        time.sleep(1)
                        self.device.send_keyevent(
                            adbtools.KeyCode.KEYCODE_BACK)
                    else:
                        pass
                    time.sleep(1)
                    self.device.send_keyevent(adbtools.KeyCode.KEYCODE_BACK)
                else:
                    pass
                time.sleep(1)
                self.device.send_keyevent(adbtools.KeyCode.KEYCODE_BACK)
            else:
                pass

        #     移动网络

        # 声音
            time.sleep(2)
            if myuiautomator.in_or_not(DEVICE_NAME, u'声音') == True:
                myuiautomator.click_popup_window(DEVICE_NAME, [u'声音'])
                time.sleep(2)
                common.screenshots(app_name, '声音')

                #     勿扰模式
                time.sleep(2)
                if myuiautomator.in_or_not(DEVICE_NAME, u'勿扰模式') == True:
                    myuiautomator.click_popup_window(DEVICE_NAME, [u'勿扰模式'])
                    time.sleep(2)
                    common.screenshots(app_name, '勿扰模式')
                    # 允许打扰
                    time.sleep(2)
                    if myuiautomator.in_or_not(DEVICE_NAME, u'允许打扰') == True:
                        myuiautomator.click_popup_window(
                            DEVICE_NAME, [u'允许打扰'])
                        time.sleep(2)
                        common.screenshots(app_name, '允许打扰')
                        time.sleep(1)
                        self.device.send_keyevent(
                            adbtools.KeyCode.KEYCODE_BACK)
                    else:
                        pass
                    time.sleep(1)
                    self.device.send_keyevent(adbtools.KeyCode.KEYCODE_BACK)
                else:
                    pass

            # 音量键调整
                time.sleep(1)
                if myuiautomator.in_or_not(DEVICE_NAME, u'音量键调整') == True:
                    myuiautomator.click_popup_window(DEVICE_NAME, [u'音量键调整'])
                    time.sleep(2)
                    common.screenshots(app_name, '音量键调整')
                    time.sleep(1)
                    self.device.send_keyevent(adbtools.KeyCode.KEYCODE_BACK)
                else:
                    pass

            #     来电铃声
            #     time.sleep(2)
            #     myuiautomator.click_popup_window(DEVICE_NAME, [u'来电铃声'])
            #     time.sleep(2)
            #     common.screenshots(app_name, img_count)
            #     img_count += 1
            #     time.sleep(1)
            #     self.device.send_keyevent(adbtools.KeyCode.KEYCODE_BACK)

            #     信息铃声
            #     time.sleep(2)
            #     myuiautomator.click_popup_window(DEVICE_NAME, [u'信息铃声'])
            #     time.sleep(2)
            #     common.screenshots(app_name, img_count)
            #     img_count += 1
            #     time.sleep(1)
            #     self.device.send_keyevent(adbtools.KeyCode.KEYCODE_BACK)

            #     通知铃声
                time.sleep(1)
                cmd = 'input swipe {0} {1} {2} {3} 100'.format(
                    int(self.width / 2), int(self.height / 30 * 29),
                    int(self.width / 2), int(self.height / 11))
                self.device.shell(cmd)
                #     time.sleep(2)
                #     common.screenshots(app_name, img_count)
                #     img_count += 1
                #     time.sleep(2)
                #     myuiautomator.click_popup_window(DEVICE_NAME, [u'通知铃声'])
                #     time.sleep(2)
                #     common.screenshots(app_name, img_count)
                #     img_count += 1
                #     time.sleep(1)
                #     self.device.send_keyevent(adbtools.KeyCode.KEYCODE_BACK)

                #     Hi-Fi
                time.sleep(2)
                if myuiautomator.in_or_not(DEVICE_NAME, u'Hi-Fi') == True:
                    myuiautomator.click_popup_window(DEVICE_NAME, [u'Hi-Fi'])
                    time.sleep(2)
                    common.screenshots(app_name, 'Hi-Fi')
                    time.sleep(2)
                    if myuiautomator.in_or_not(DEVICE_NAME,
                                               u'关于Hi-Fi') == True:
                        myuiautomator.click_popup_window(
                            DEVICE_NAME, [u'关于Hi-Fi'])
                        time.sleep(2)
                        common.screenshots(app_name, '关于Hi-Fi')
                        time.sleep(1)
                        self.device.send_keyevent(
                            adbtools.KeyCode.KEYCODE_BACK)
                    else:
                        pass
                    time.sleep(1)
                    self.device.send_keyevent(adbtools.KeyCode.KEYCODE_BACK)
                else:
                    pass
                time.sleep(1)
                self.device.send_keyevent(adbtools.KeyCode.KEYCODE_BACK)
            else:
                pass

            #     移动KTV
            #     time.sleep(2)
            #     myuiautomator.click_popup_window(DEVICE_NAME, [u'移动KTV'])
            #     time.sleep(2)
            #     common.screenshots(app_name, img_count)
            #     img_count += 1
            #     time.sleep(1)
            #     self.device.send_keyevent(adbtools.KeyCode.KEYCODE_BACK)
            #     time.sleep(1)
            #     self.device.send_keyevent(adbtools.KeyCode.KEYCODE_BACK)

        # 显示与亮度
            time.sleep(2)
            if myuiautomator.in_or_not(DEVICE_NAME, u'显示与亮度') == True:
                myuiautomator.click_popup_window(DEVICE_NAME, [u'显示与亮度'])
                time.sleep(2)
                common.screenshots(app_name, '显示与亮度')
                time.sleep(2)
                if myuiautomator.in_or_not(DEVICE_NAME, u'全局护眼') == True:
                    myuiautomator.click_popup_window(DEVICE_NAME, [u'全局护眼'])
                    time.sleep(2)
                    common.screenshots(app_name, '全局护眼')
                    time.sleep(1)
                    self.device.send_keyevent(adbtools.KeyCode.KEYCODE_BACK)
                else:
                    pass
                time.sleep(1)
                self.device.send_keyevent(adbtools.KeyCode.KEYCODE_BACK)
            else:
                pass

        # 壁纸与字体
            time.sleep(2)
            if myuiautomator.in_or_not(DEVICE_NAME, u'壁纸与字体') == True:
                myuiautomator.click_popup_window(DEVICE_NAME, [u'壁纸与字体'])
                time.sleep(2)
                common.screenshots(app_name, '壁纸与字体')
                time.sleep(1)
                self.device.send_keyevent(adbtools.KeyCode.KEYCODE_BACK)
            else:
                pass

        # 状态栏与通知
            time.sleep(2)
            if myuiautomator.in_or_not(DEVICE_NAME, u'状态栏与通知') == True:
                myuiautomator.click_popup_window(DEVICE_NAME, [u'状态栏与通知'])
                time.sleep(2)
                common.screenshots(app_name, '状态栏与通知')
                time.sleep(2)
                if myuiautomator.in_or_not(DEVICE_NAME, u'顶部预览样式') == True:
                    myuiautomator.click_popup_window(DEVICE_NAME, [u'顶部预览样式'])
                    time.sleep(2)
                    common.screenshots(app_name, '顶部预览样式')
                    time.sleep(1)
                    self.device.send_keyevent(adbtools.KeyCode.KEYCODE_BACK)
                else:
                    pass
                time.sleep(1)
                self.device.send_keyevent(adbtools.KeyCode.KEYCODE_BACK)
            else:
                pass

        #     系统升级
            time.sleep(2)
            if myuiautomator.in_or_not(DEVICE_NAME, u'系统升级') == True:
                myuiautomator.click_popup_window(DEVICE_NAME, [u'系统升级'])
                time.sleep(20)
                common.screenshots(app_name, '系统升级')
                time.sleep(1)
                self.device.send_keyevent(adbtools.KeyCode.KEYCODE_BACK)
            else:
                pass

        #     账户与同步
            time.sleep(1)
            cmd = 'input swipe {0} {1} {2} {3} 100'.format(
                int(self.width / 2), int(self.height / 2), int(self.width / 2),
                int(self.height / 10 * 3))
            self.device.shell(cmd)
            time.sleep(2)
            if myuiautomator.in_or_not(DEVICE_NAME, u'帐户与同步') == True:
                myuiautomator.click_popup_window(DEVICE_NAME, [u'帐户与同步'])
                time.sleep(2)
                common.screenshots(app_name, '帐户与同步')
                time.sleep(1)
                self.device.send_keyevent(adbtools.KeyCode.KEYCODE_BACK)
            else:
                pass

        #     指纹与密码
            time.sleep(2)
            if myuiautomator.in_or_not(DEVICE_NAME, u'指纹与密码') == True:
                myuiautomator.click_popup_window(DEVICE_NAME, [u'指纹与密码'])
                time.sleep(2)
                common.screenshots(app_name, '指纹与密码')
                time.sleep(2)
                if myuiautomator.in_or_not(DEVICE_NAME, u'屏幕锁定') == True:
                    myuiautomator.click_popup_window(DEVICE_NAME, [u'屏幕锁定'])
                    time.sleep(2)
                    common.screenshots(app_name, '屏幕锁定')
                    time.sleep(1)
                    self.device.send_keyevent(adbtools.KeyCode.KEYCODE_BACK)
                else:
                    pass
                time.sleep(2)
                if myuiautomator.in_or_not(DEVICE_NAME, u'支付') == True:
                    myuiautomator.click_popup_window(DEVICE_NAME, [u'支付'])
                    time.sleep(2)
                    common.screenshots(app_name, '支付')
                    time.sleep(1)
                    self.device.send_keyevent(adbtools.KeyCode.KEYCODE_BACK)
                else:
                    pass
                time.sleep(1)
                self.device.send_keyevent(adbtools.KeyCode.KEYCODE_BACK)
            else:
                pass

        #     安全
            time.sleep(2)
            if myuiautomator.in_or_not(DEVICE_NAME, u'安全') == True:
                myuiautomator.click_popup_window(DEVICE_NAME, [u'安全'])
                time.sleep(2)
                common.screenshots(app_name, '安全')
                # 访客模式
                time.sleep(2)
                if myuiautomator.in_or_not(DEVICE_NAME, u'访客模式') == True:
                    myuiautomator.click_popup_window(DEVICE_NAME, [u'访客模式'])
                    time.sleep(2)
                    common.screenshots(app_name, '访客模式')
                    # 保护联系人
                    time.sleep(2)
                    if myuiautomator.in_or_not(DEVICE_NAME, u'保护联系人') == True:
                        myuiautomator.click_popup_window(
                            DEVICE_NAME, [u'保护联系人'])
                        time.sleep(2)
                        common.screenshots(app_name, '保护联系人')
                        time.sleep(1)
                        self.device.send_keyevent(
                            adbtools.KeyCode.KEYCODE_BACK)
                    else:
                        pass
                    # 隐藏图标
                    time.sleep(2)
                    if myuiautomator.in_or_not(DEVICE_NAME, u'隐藏图标') == True:
                        myuiautomator.click_popup_window(
                            DEVICE_NAME, [u'隐藏图标'])
                        time.sleep(2)
                        common.screenshots(app_name, '隐藏图标')
                        time.sleep(1)
                        self.device.send_keyevent(
                            adbtools.KeyCode.KEYCODE_BACK)
                    else:
                        pass
                    # 访客模式使用说明
                    time.sleep(2)
                    if myuiautomator.in_or_not(DEVICE_NAME,
                                               u'访客模式使用说明') == True:
                        myuiautomator.click_popup_window(
                            DEVICE_NAME, [u'访客模式使用说明'])
                        time.sleep(2)
                        common.screenshots(app_name, '访客模式使用说明')
                        time.sleep(1)
                        self.device.send_keyevent(
                            adbtools.KeyCode.KEYCODE_BACK)
                    else:
                        pass
                    time.sleep(1)
                    self.device.send_keyevent(adbtools.KeyCode.KEYCODE_BACK)
                else:
                    pass
                # 设置SIM卡锁
                # time.sleep(2)
                # myuiautomator.click_popup_window(DEVICE_NAME, [u'设置SIM卡锁'])
                # time.sleep(2)
                # common.screenshots(app_name, img_count)
                # img_count += 1
                # time.sleep(1)
                # self.device.send_keyevent(adbtools.KeyCode.KEYCODE_BACK)
                # 设备管理器
                time.sleep(2)
                if myuiautomator.in_or_not(DEVICE_NAME, u'设备管理器') == True:
                    myuiautomator.click_popup_window(DEVICE_NAME, [u'设备管理器'])
                    time.sleep(2)
                    common.screenshots(app_name, '设备管理器')
                    time.sleep(1)
                    self.device.send_keyevent(adbtools.KeyCode.KEYCODE_BACK)
                else:
                    pass
                # 通知使用权
                time.sleep(2)
                if myuiautomator.in_or_not(DEVICE_NAME, u'通知使用权') == True:
                    myuiautomator.click_popup_window(DEVICE_NAME, [u'通知使用权'])
                    time.sleep(2)
                    common.screenshots(app_name, '通知使用权')
                    time.sleep(1)
                    self.device.send_keyevent(adbtools.KeyCode.KEYCODE_BACK)
                else:
                    pass
                # 受信任的凭据
                time.sleep(2)
                if myuiautomator.in_or_not(DEVICE_NAME, u'受信任的凭据') == True:
                    myuiautomator.click_popup_window(DEVICE_NAME, [u'受信任的凭据'])
                    time.sleep(2)
                    common.screenshots(app_name, '受信任的凭据')
                    time.sleep(1)
                    self.device.send_keyevent(adbtools.KeyCode.KEYCODE_BACK)
                else:
                    pass
                time.sleep(1)
                self.device.send_keyevent(adbtools.KeyCode.KEYCODE_BACK)
            else:
                pass
            # 定位服务
            time.sleep(2)
            if myuiautomator.in_or_not(DEVICE_NAME, u'定位服务') == True:
                myuiautomator.click_popup_window(DEVICE_NAME, [u'定位服务'])
                time.sleep(2)
                common.screenshots(app_name, '定位服务')
                time.sleep(1)
                self.device.send_keyevent(adbtools.KeyCode.KEYCODE_BACK)
            else:
                pass
            # 运存与存储空间
            time.sleep(2)
            if myuiautomator.in_or_not(DEVICE_NAME, u'运存与存储空间') == True:
                myuiautomator.click_popup_window(DEVICE_NAME, [u'运存与存储空间'])
                time.sleep(2)
                common.screenshots(app_name, '运存与存储空间')
                # 正在运行程序
                time.sleep(2)
                if myuiautomator.in_or_not(DEVICE_NAME, u'正在运行程序') == True:
                    myuiautomator.click_popup_window(DEVICE_NAME, [u'正在运行程序'])
                    time.sleep(5)
                    common.screenshots(app_name, '正在运行程序')
                    time.sleep(1)
                    self.device.send_keyevent(adbtools.KeyCode.KEYCODE_BACK)
                else:
                    pass
                # 管理已安装程序
                time.sleep(2)
                if myuiautomator.in_or_not(DEVICE_NAME, u'管理已安装程序') == True:
                    myuiautomator.click_popup_window(DEVICE_NAME, [u'管理已安装程序'])
                    time.sleep(2)
                    common.screenshots(app_name, '管理已安装程序')
                    time.sleep(1)
                    self.device.send_keyevent(adbtools.KeyCode.KEYCODE_BACK)
                else:
                    pass
                # 管理存储文件
                time.sleep(2)
                if myuiautomator.in_or_not(DEVICE_NAME, u'管理存储文件') == True:
                    myuiautomator.click_popup_window(DEVICE_NAME, [u'管理存储文件'])
                    time.sleep(2)
                    common.screenshots(app_name, '管理存储文件')
                    time.sleep(1)
                    self.device.send_keyevent(adbtools.KeyCode.KEYCODE_BACK)
                else:
                    pass
                time.sleep(1)
                self.device.send_keyevent(adbtools.KeyCode.KEYCODE_BACK)
            else:
                pass
            # 更多设置
            time.sleep(2)
            if myuiautomator.in_or_not(DEVICE_NAME, u'更多设置') == True:
                myuiautomator.click_popup_window(DEVICE_NAME, [u'更多设置'])
                time.sleep(2)
                common.screenshots(app_name, '更多设置')
                # 关于手机
                time.sleep(2)
                if myuiautomator.in_or_not(DEVICE_NAME, u'关于手机') == True:
                    myuiautomator.click_popup_window(DEVICE_NAME, [u'关于手机'])
                    time.sleep(2)
                    common.screenshots(app_name, '关于手机')
                    # CPU实时数据
                    time.sleep(1)
                    cmd = 'input tap {0} {1}'.format(int(self.width / 2),
                                                     int(self.height - 100))
                    self.device.shell(cmd)
                    time.sleep(2)
                    common.screenshots(app_name, 'CPU实时数据')
                    time.sleep(1)
                    self.device.send_keyevent(adbtools.KeyCode.KEYCODE_BACK)
                    time.sleep(1)
                    cmd = 'input swipe {0} {1} {2} {3} 100'.format(
                        int(self.width / 2), int(self.height / 5 * 3),
                        int(self.width / 2), int(self.height / 4))
                    self.device.shell(cmd)
                    # SIM卡状态
                    time.sleep(1)
                    cmd = 'input tap {0} {1}'.format(int(self.width / 2),
                                                     int(self.height / 5 * 3))
                    self.device.shell(cmd)
                    time.sleep(2)
                    common.screenshots(app_name, 'SIM卡状态')
                    time.sleep(1)
                    self.device.send_keyevent(adbtools.KeyCode.KEYCODE_BACK)
                    # 法律信息
                    time.sleep(1)
                    cmd = 'input tap {0} {1}'.format(int(self.width / 2),
                                                     int(self.height - 100))
                    self.device.shell(cmd)
                    time.sleep(2)
                    common.screenshots(app_name, '法律信息')
                    # vivo法律咨询
                    time.sleep(2)
                    if myuiautomator.in_or_not(DEVICE_NAME,
                                               u'vivo法律咨询') == True:
                        myuiautomator.click_popup_window(
                            DEVICE_NAME, [u'vivo法律咨询'])
                        time.sleep(2)
                        common.screenshots(app_name, 'vivo法律咨询')
                        time.sleep(1)
                        self.device.send_keyevent(
                            adbtools.KeyCode.KEYCODE_BACK)
                    else:
                        pass
                    # 开放源代码许可
                    time.sleep(2)
                    if myuiautomator.in_or_not(DEVICE_NAME,
                                               u'开放源代码许可') == True:
                        myuiautomator.click_popup_window(
                            DEVICE_NAME, [u'开放源代码许可'])
                        time.sleep(2)
                        common.screenshots(app_name, '开放源代码许可')
                        time.sleep(1)
                        self.device.send_keyevent(
                            adbtools.KeyCode.KEYCODE_BACK)
                    else:
                        pass
                    time.sleep(1)
                    self.device.send_keyevent(adbtools.KeyCode.KEYCODE_BACK)
                else:
                    pass
                time.sleep(1)
                self.device.send_keyevent(adbtools.KeyCode.KEYCODE_BACK)
                # 全局搜索
                time.sleep(2)
                if myuiautomator.in_or_not(DEVICE_NAME, u'全局搜索') == True:
                    myuiautomator.click_popup_window(DEVICE_NAME, [u'全局搜索'])
                    time.sleep(2)
                    common.screenshots(app_name, '全局搜索')
                    time.sleep(1)
                    self.device.send_keyevent(adbtools.KeyCode.KEYCODE_BACK)
                else:
                    pass
                # 虚拟专用网设置
                time.sleep(2)
                if myuiautomator.in_or_not(DEVICE_NAME, u'虚拟专用网设置') == True:
                    myuiautomator.click_popup_window(DEVICE_NAME, [u'虚拟专用网设置'])
                    time.sleep(2)
                    common.screenshots(app_name, '虚拟专用网设置')
                    time.sleep(1)
                    self.device.send_keyevent(adbtools.KeyCode.KEYCODE_BACK)
                else:
                    pass
                # 指示灯
                time.sleep(1)
                cmd = 'input swipe {0} {1} {2} {3} 100'.format(
                    int(self.width / 2), int(self.height / 2),
                    int(self.width / 2), int(self.height / 10 * 3))
                self.device.shell(cmd)
                time.sleep(2)
                if myuiautomator.in_or_not(DEVICE_NAME, u'指示灯') == True:
                    myuiautomator.click_popup_window(DEVICE_NAME, [u'指示灯'])
                    time.sleep(2)
                    common.screenshots(app_name, '指示灯')
                    time.sleep(1)
                    self.device.send_keyevent(adbtools.KeyCode.KEYCODE_BACK)
                else:
                    pass
                # 按键
                time.sleep(2)
                if myuiautomator.in_or_not(DEVICE_NAME, u'按键') == True:
                    myuiautomator.click_popup_window(DEVICE_NAME, [u'按键'])
                    time.sleep(2)
                    common.screenshots(app_name, '按键')
                    time.sleep(1)
                    self.device.send_keyevent(adbtools.KeyCode.KEYCODE_BACK)
                else:
                    pass
                # 日期和时间
                time.sleep(2)
                if myuiautomator.in_or_not(DEVICE_NAME, u'日期和时间') == True:
                    myuiautomator.click_popup_window(DEVICE_NAME, [u'日期和时间'])
                    time.sleep(2)
                    common.screenshots(app_name, '日期和时间')
                    # 设置时间
                    time.sleep(2)
                    if myuiautomator.in_or_not(DEVICE_NAME, u'设置时间') == True:
                        myuiautomator.click_popup_window(
                            DEVICE_NAME, [u'设置时间'])
                        time.sleep(2)
                        common.screenshots(app_name, '设置时间')
                        time.sleep(1)
                        self.device.send_keyevent(
                            adbtools.KeyCode.KEYCODE_BACK)
                    else:
                        pass
                    # 设置日期
                    time.sleep(2)
                    if myuiautomator.in_or_not(DEVICE_NAME, u'设置日期') == True:
                        myuiautomator.click_popup_window(
                            DEVICE_NAME, [u'设置日期'])
                        time.sleep(2)
                        common.screenshots(app_name, '设置日期')
                        time.sleep(1)
                        self.device.send_keyevent(
                            adbtools.KeyCode.KEYCODE_BACK)
                    else:
                        pass
                    # 选择时区
                    time.sleep(2)
                    if myuiautomator.in_or_not(DEVICE_NAME, u'选择时区') == True:
                        myuiautomator.click_popup_window(
                            DEVICE_NAME, [u'选择时区'])
                        time.sleep(2)
                        common.screenshots(app_name, '选择时区')
                        time.sleep(1)
                        self.device.send_keyevent(
                            adbtools.KeyCode.KEYCODE_BACK)
                    else:
                        pass
                    time.sleep(1)
                    self.device.send_keyevent(adbtools.KeyCode.KEYCODE_BACK)
                else:
                    pass
                # 语言
                time.sleep(2)
                if myuiautomator.in_or_not(DEVICE_NAME, u'语言') == True:
                    myuiautomator.click_popup_window(DEVICE_NAME, [u'语言'])
                    time.sleep(2)
                    common.screenshots(app_name, '语言')
                    time.sleep(1)
                    self.device.send_keyevent(adbtools.KeyCode.KEYCODE_BACK)
                else:
                    pass
                # 输入法
                time.sleep(1)
                cmd = 'input swipe {0} {1} {2} {3} 100'.format(
                    int(self.width / 2), int(self.height / 2),
                    int(self.width / 2), int(self.height / 4))
                self.device.shell(cmd)
                time.sleep(2)
                if myuiautomator.in_or_not(DEVICE_NAME, u'输入法') == True:
                    myuiautomator.click_popup_window(DEVICE_NAME, [u'输入法'])
                    time.sleep(2)
                    common.screenshots(app_name, '输入法')
                    # vivo输入法
                    time.sleep(2)
                    if myuiautomator.in_or_not(DEVICE_NAME,
                                               u'vivo输入法') == True:
                        myuiautomator.click_popup_window(
                            DEVICE_NAME, [u'vivo输入法'])
                        time.sleep(2)
                        common.screenshots(app_name, 'vivo输入法')
                        time.sleep(1)
                        self.device.send_keyevent(
                            adbtools.KeyCode.KEYCODE_BACK)
                    else:
                        pass
                    time.sleep(1)
                    self.device.send_keyevent(adbtools.KeyCode.KEYCODE_BACK)
                else:
                    pass
                # 定时任务
                time.sleep(2)
                if myuiautomator.in_or_not(DEVICE_NAME, u'定时任务') == True:
                    myuiautomator.click_popup_window(DEVICE_NAME, [u'定时任务'])
                    time.sleep(2)
                    common.screenshots(app_name, '定时任务')
                    # 定时开关机
                    time.sleep(2)
                    if myuiautomator.in_or_not(DEVICE_NAME, u'定时开关机') == True:
                        myuiautomator.click_popup_window(
                            DEVICE_NAME, [u'定时开关机'])
                        time.sleep(2)
                        common.screenshots(app_name, '定时开关机')
                        time.sleep(1)
                        self.device.send_keyevent(
                            adbtools.KeyCode.KEYCODE_BACK)
                    else:
                        pass
                    time.sleep(1)
                    self.device.send_keyevent(adbtools.KeyCode.KEYCODE_BACK)
                else:
                    pass
                # 应用程序
                time.sleep(2)
                if myuiautomator.in_or_not(DEVICE_NAME, u'应用程序') == True:
                    myuiautomator.click_popup_window(DEVICE_NAME, [u'应用程序'])
                    time.sleep(2)
                    common.screenshots(app_name, '应用程序')
                    # 已安装
                    time.sleep(2)
                    if myuiautomator.in_or_not(DEVICE_NAME, u'已安装') == True:
                        myuiautomator.click_popup_window(DEVICE_NAME, [u'已安装'])
                        time.sleep(2)
                        common.screenshots(app_name, '已安装')
                        cmd = 'input tap {0} {1}'.format(
                            int(self.width / 2), int(self.height / 2))
                        self.device.shell(cmd)
                        time.sleep(2)
                        common.screenshots(app_name, 'APP')
                        time.sleep(1)
                        self.device.send_keyevent(
                            adbtools.KeyCode.KEYCODE_BACK)
                        time.sleep(1)
                        self.device.send_keyevent(
                            adbtools.KeyCode.KEYCODE_BACK)
                    else:
                        pass
                    # 正在运行
                    time.sleep(2)
                    if myuiautomator.in_or_not(DEVICE_NAME, u'正在运行') == True:
                        myuiautomator.click_popup_window(
                            DEVICE_NAME, [u'正在运行'])
                        time.sleep(2)
                        common.screenshots(app_name, '正在运行')
                        cmd = 'input tap {0} {1}'.format(
                            int(self.width / 2), int(self.height / 2))
                        self.device.shell(cmd)
                        time.sleep(2)
                        common.screenshots(app_name, '正在运行-app')
                        time.sleep(1)
                        self.device.send_keyevent(
                            adbtools.KeyCode.KEYCODE_BACK)
                        time.sleep(1)
                        self.device.send_keyevent(
                            adbtools.KeyCode.KEYCODE_BACK)
                    else:
                        pass
                    # 全部
                    time.sleep(2)
                    if myuiautomator.in_or_not(DEVICE_NAME, u'全部') == True:
                        myuiautomator.click_popup_window(DEVICE_NAME, [u'全部'])
                        time.sleep(2)
                        common.screenshots(app_name, '全部')
                        time.sleep(1)
                        self.device.send_keyevent(
                            adbtools.KeyCode.KEYCODE_BACK)
                    else:
                        pass
                    # 出厂应用程序管理
                    time.sleep(2)
                    if myuiautomator.in_or_not(DEVICE_NAME,
                                               u'出厂应用程序管理') == True:
                        myuiautomator.click_popup_window(
                            DEVICE_NAME, [u'出厂应用程序管理'])
                        time.sleep(2)
                        common.screenshots(app_name, '出厂应用程序管理')
                        time.sleep(1)
                        self.device.send_keyevent(
                            adbtools.KeyCode.KEYCODE_BACK)
                    else:
                        pass
                    time.sleep(1)
                    self.device.send_keyevent(adbtools.KeyCode.KEYCODE_BACK)
                else:
                    pass
                # 恢复出厂设置
                time.sleep(2)
                if myuiautomator.in_or_not(DEVICE_NAME, u'恢复出厂设置') == True:
                    myuiautomator.click_popup_window(DEVICE_NAME, [u'恢复出厂设置'])
                    time.sleep(2)
                    common.screenshots(app_name, '恢复出厂设置')
                    # 清除所有数据
                    time.sleep(2)
                    if myuiautomator.in_or_not(DEVICE_NAME, u'清除所有数据') == True:
                        myuiautomator.click_popup_window(
                            DEVICE_NAME, [u'清除所有数据'])
                        time.sleep(2)
                        common.screenshots(app_name, '清除所有数据')
                        time.sleep(1)
                        self.device.send_keyevent(
                            adbtools.KeyCode.KEYCODE_BACK)
                    else:
                        pass
                    time.sleep(1)
                    self.device.send_keyevent(adbtools.KeyCode.KEYCODE_BACK)
                else:
                    pass
                # 说明书
                time.sleep(2)
                if myuiautomator.in_or_not(DEVICE_NAME, u'说明书') == True:
                    myuiautomator.click_popup_window(DEVICE_NAME, [u'说明书'])
                    time.sleep(2)
                    common.screenshots(app_name, '说明书')
                    time.sleep(2)
                    if myuiautomator.in_or_not(DEVICE_NAME, u'工具') == True:
                        myuiautomator.click_popup_window(DEVICE_NAME, [u'工具'])
                        time.sleep(2)
                        common.screenshots(app_name, '工具')
                        time.sleep(2)
                        if myuiautomator.in_or_not(DEVICE_NAME,
                                                   u'计算器') == True:
                            myuiautomator.click_popup_window(
                                DEVICE_NAME, [u'计算器'])
                            time.sleep(2)
                            common.screenshots(app_name, '计算器')
                            time.sleep(1)
                            self.device.send_keyevent(
                                adbtools.KeyCode.KEYCODE_BACK)
                        else:
                            pass
                        time.sleep(1)
                        self.device.send_keyevent(
                            adbtools.KeyCode.KEYCODE_BACK)
                    else:
                        pass
                        time.sleep(1)
                    self.device.send_keyevent(adbtools.KeyCode.KEYCODE_BACK)
                else:
                    pass
                # 售后服务
                time.sleep(2)
                if myuiautomator.in_or_not(DEVICE_NAME, u'售后服务') == True:
                    myuiautomator.click_popup_window(DEVICE_NAME, [u'售后服务'])
                    time.sleep(2)
                    common.screenshots(app_name, '售后服务')
                    time.sleep(1)
                    self.device.send_keyevent(adbtools.KeyCode.KEYCODE_BACK)
                else:
                    pass
                # 电子保修卡
                time.sleep(2)
                if myuiautomator.in_or_not(DEVICE_NAME, u'电子保修卡') == True:
                    myuiautomator.click_popup_window(DEVICE_NAME, [u'电子保修卡'])
                    time.sleep(2)
                    common.screenshots(app_name, '电子保修卡')
                    time.sleep(1)
                    self.device.send_keyevent(adbtools.KeyCode.KEYCODE_BACK)
                else:
                    pass
                # 用户体验改进计划
                time.sleep(2)
                if myuiautomator.in_or_not(DEVICE_NAME, u'用户体验改进计划') == True:
                    myuiautomator.click_popup_window(DEVICE_NAME,
                                                     [u'用户体验改进计划'])
                    time.sleep(2)
                    common.screenshots(app_name, '用户体验改进计划')
                    # 有关用户体验改进计划
                    time.sleep(2)
                    if myuiautomator.in_or_not(DEVICE_NAME,
                                               u'有关用户体验改进计划') == True:
                        myuiautomator.click_popup_window(
                            DEVICE_NAME, [u'有关用户体验改进计划'])
                        time.sleep(2)
                        common.screenshots(app_name, '有关用户体验改进计划')
                        time.sleep(1)
                        self.device.send_keyevent(
                            adbtools.KeyCode.KEYCODE_BACK)
                    else:
                        pass
                    time.sleep(1)
                    self.device.send_keyevent(adbtools.KeyCode.KEYCODE_BACK)
                else:
                    pass
                # 更新号码归属地
                time.sleep(2)
                if myuiautomator.in_or_not(DEVICE_NAME, u'更新号码归属地') == True:
                    myuiautomator.click_popup_window(DEVICE_NAME, [u'更新号码归属地'])
                    time.sleep(2)
                    common.screenshots(app_name, '更新号码归属地')
                    time.sleep(1)
                    self.device.send_keyevent(adbtools.KeyCode.KEYCODE_BACK)
                else:
                    pass
                # 辅助功能
                time.sleep(2)
                if myuiautomator.in_or_not(DEVICE_NAME, u'辅助功能') == True:
                    myuiautomator.click_popup_window(DEVICE_NAME, [u'辅助功能'])
                    time.sleep(2)
                    common.screenshots(app_name, '辅助功能')
                    time.sleep(1)
                    self.device.send_keyevent(adbtools.KeyCode.KEYCODE_BACK)
                else:
                    pass
                time.sleep(1)
                self.device.send_keyevent(adbtools.KeyCode.KEYCODE_BACK)
            else:
                pass
            # 智能体感
            time.sleep(1)
            cmd = 'input swipe {0} {1} {2} {3} 100'.format(
                int(self.width / 2), int(self.height / 2), int(self.width / 2),
                int(self.height / 4))
            self.device.shell(cmd)
            time.sleep(2)
            if myuiautomator.in_or_not(DEVICE_NAME, u'智能体感') == True:
                myuiautomator.click_popup_window(DEVICE_NAME, [u'智能体感'])
                time.sleep(2)
                common.screenshots(app_name, '智能体感')
                # Smartwake
                time.sleep(1)
                cmd = 'input tap {0} {1}'.format(int(self.width / 2),
                                                 int(self.height / 50 * 9))
                self.device.shell(cmd)
                time.sleep(2)
                common.screenshots(app_name, 'Smartwake')
                time.sleep(1)
                self.device.send_keyevent(adbtools.KeyCode.KEYCODE_BACK)
                # 隔空操作
                time.sleep(2)
                if myuiautomator.in_or_not(DEVICE_NAME, u'隔空操作') == True:
                    myuiautomator.click_popup_window(DEVICE_NAME, [u'隔空操作'])
                    time.sleep(2)
                    common.screenshots(app_name, '隔空操作')
                    time.sleep(1)
                    self.device.send_keyevent(adbtools.KeyCode.KEYCODE_BACK)
                else:
                    pass
                # 智能亮屏熄屏
                time.sleep(2)
                if myuiautomator.in_or_not(DEVICE_NAME, u'智能亮屏熄屏') == True:
                    myuiautomator.click_popup_window(DEVICE_NAME, [u'智能亮屏熄屏'])
                    time.sleep(2)
                    common.screenshots(app_name, '智能亮屏熄屏')
                    time.sleep(1)
                    self.device.send_keyevent(adbtools.KeyCode.KEYCODE_BACK)
                else:
                    pass
                # 智能通话
                time.sleep(2)
                if myuiautomator.in_or_not(DEVICE_NAME, u'智能通话') == True:
                    myuiautomator.click_popup_window(DEVICE_NAME, [u'智能通话'])
                    time.sleep(2)
                    common.screenshots(app_name, '智能通话')
                    time.sleep(1)
                    self.device.send_keyevent(adbtools.KeyCode.KEYCODE_BACK)
                else:
                    pass
                time.sleep(1)
                self.device.send_keyevent(adbtools.KeyCode.KEYCODE_BACK)
            else:
                pass
            # 多屏互动
            time.sleep(2)
            if myuiautomator.in_or_not(DEVICE_NAME, u'多屏互动') == True:
                myuiautomator.click_popup_window(DEVICE_NAME, [u'多屏互动'])
                time.sleep(2)
                common.screenshots(app_name, '多屏互动')
                # 使用说明
                time.sleep(2)
                if myuiautomator.in_or_not(DEVICE_NAME, u'使用说明') == True:
                    myuiautomator.click_popup_window(DEVICE_NAME, [u'使用说明'])
                    time.sleep(2)
                    common.screenshots(app_name, '使用说明')
                    time.sleep(1)
                    self.device.send_keyevent(adbtools.KeyCode.KEYCODE_BACK)
                else:
                    pass
                time.sleep(1)
                self.device.send_keyevent(adbtools.KeyCode.KEYCODE_BACK)
            else:
                pass
            # 分屏多任务
            time.sleep(2)
            if myuiautomator.in_or_not(DEVICE_NAME, u'分屏多任务') == True:
                myuiautomator.click_popup_window(DEVICE_NAME, [u'分屏多任务'])
                time.sleep(2)
                common.screenshots(app_name, '分屏多任务')
                # 消息分屏
                time.sleep(2)
                if myuiautomator.in_or_not(DEVICE_NAME, u'消息分屏') == True:
                    myuiautomator.click_popup_window(DEVICE_NAME, [u'消息分屏'])
                    time.sleep(2)
                    common.screenshots(app_name, '消息分屏')
                    time.sleep(1)
                    self.device.send_keyevent(adbtools.KeyCode.KEYCODE_BACK)
                else:
                    pass
                # 手动分屏
                time.sleep(2)
                if myuiautomator.in_or_not(DEVICE_NAME, u'手动分屏') == True:
                    myuiautomator.click_popup_window(DEVICE_NAME, [u'手动分屏'])
                    time.sleep(2)
                    common.screenshots(app_name, '手动分屏')
                    time.sleep(1)
                    self.device.send_keyevent(adbtools.KeyCode.KEYCODE_BACK)
                else:
                    pass
                time.sleep(1)
                self.device.send_keyevent(adbtools.KeyCode.KEYCODE_BACK)
            else:
                pass
            # 单手操作
            time.sleep(2)
            if myuiautomator.in_or_not(DEVICE_NAME, u'单手操作') == True:
                myuiautomator.click_popup_window(DEVICE_NAME, [u'单手操作'])
                time.sleep(2)
                common.screenshots(app_name, '单手操作')
                time.sleep(1)
                self.device.send_keyevent(adbtools.KeyCode.KEYCODE_BACK)
            else:
                pass
            # 超级截屏
            time.sleep(2)
            if myuiautomator.in_or_not(DEVICE_NAME, u'超级截屏') == True:
                myuiautomator.click_popup_window(DEVICE_NAME, [u'超级截屏'])
                time.sleep(2)
                common.screenshots(app_name, '超级截屏')
                # 使用说明
                time.sleep(2)
                if myuiautomator.in_or_not(DEVICE_NAME, u'使用说明') == True:
                    myuiautomator.click_popup_window(DEVICE_NAME, [u'使用说明'])
                    time.sleep(2)
                    common.screenshots(app_name, '使用说明')
                    # 图形截屏
                    time.sleep(2)
                    if myuiautomator.in_or_not(DEVICE_NAME, u'图形截屏') == True:
                        myuiautomator.click_popup_window(
                            DEVICE_NAME, [u'图形截屏'])
                        time.sleep(2)
                        common.screenshots(app_name, '图形截屏')
                        time.sleep(1)
                        self.device.send_keyevent(
                            adbtools.KeyCode.KEYCODE_BACK)
                    else:
                        pass
                    time.sleep(1)
                    self.device.send_keyevent(adbtools.KeyCode.KEYCODE_BACK)
                else:
                    pass
                time.sleep(1)
                self.device.send_keyevent(adbtools.KeyCode.KEYCODE_BACK)
            else:
                pass
            # 应用分身
            time.sleep(2)
            if myuiautomator.in_or_not(DEVICE_NAME, u'应用分身') == True:
                myuiautomator.click_popup_window(DEVICE_NAME, [u'应用分身'])
                time.sleep(2)
                common.screenshots(app_name, '应用分身')
                # 应用分身说明
                time.sleep(2)
                if myuiautomator.in_or_not(DEVICE_NAME, u'应用分身说明') == True:
                    myuiautomator.click_popup_window(DEVICE_NAME, [u'应用分身说明'])
                    time.sleep(2)
                    common.screenshots(app_name, '应用分身说明')
                    time.sleep(1)
                    self.device.send_keyevent(adbtools.KeyCode.KEYCODE_BACK)
                else:
                    pass
                time.sleep(1)
                self.device.send_keyevent(adbtools.KeyCode.KEYCODE_BACK)
            else:
                pass
            # 快捷启动
            time.sleep(2)
            if myuiautomator.in_or_not(DEVICE_NAME, u'快捷启动') == True:
                myuiautomator.click_popup_window(DEVICE_NAME, [u'快捷启动'])
                time.sleep(2)
                common.screenshots(app_name, '快捷启动')
                time.sleep(1)
                self.device.send_keyevent(adbtools.KeyCode.KEYCODE_BACK)
            else:
                pass
        except Exception, ex:
            print ex
            self.assertEqual(1, 0, ex)
    def test_itheme(self):
        app_name = 'itheme'

        try:
            self.device.start_application('com.bbk.theme/.Theme')
            time.sleep(10)
            cmd = 'am force-stop {0} '.format('com.bbk.theme')
            self.device.shell(cmd)
            time.sleep(1)
            self.device.start_application('com.bbk.theme/.Theme')
            time.sleep(30)
            common.screenshots(app_name, '首页')

            # 搜索
            time.sleep(2)
            cmd = 'input tap {0} {1}'.format(int(self.width / 2),
                                             (int(self.height / 25 * 2)))
            self.device.shell(cmd)
            time.sleep(1)
            common.screenshots(app_name, '搜索')
            time.sleep(2)
            self.device.send_keyevent(adbtools.KeyCode.KEYCODE_BACK)
            time.sleep(2)
            self.device.send_keyevent(adbtools.KeyCode.KEYCODE_BACK)
            # 主题
            time.sleep(2)
            if myuiautomator.in_or_not(DEVICE_NAME, u'主题') == True:
                myuiautomator.click_popup_window(DEVICE_NAME, [u'主题'])
                time.sleep(5)
                common.screenshots(app_name, '主题')
                # # 主题-排行
                time.sleep(2)
                if myuiautomator.in_or_not(DEVICE_NAME, u'排行') == True:
                    myuiautomator.click_popup_window(DEVICE_NAME, [u'排行'])
                    time.sleep(5)
                    common.screenshots(app_name, '主题-排行')
                    # 主题详情
                    time.sleep(2)
                    myuiautomator.click_popup_window(DEVICE_NAME, [u'免费'])
                    time.sleep(2)
                    cmd = 'input tap {0} {1}'.format(int(self.width / 3),
                                                     (int(self.height / 3)))
                    self.device.shell(cmd)
                    time.sleep(1)
                    common.screenshots(app_name, '主题详情')
                    time.sleep(2)
                    cmd = 'input swipe {0} {1} {2} {3} 200'.format(
                        int(self.width / 2), (int(self.height / 4 * 3)),
                        int(self.width / 2), int(self.height / 4))
                    self.device.shell(cmd)
                    time.sleep(2)
                    if myuiautomator.in_or_not(DEVICE_NAME, u'评论') == True:
                        myuiautomator.click_popup_window(DEVICE_NAME, [u'评论'])
                        time.sleep(2)
                        common.screenshots(app_name, '主题详情-评论')
                        time.sleep(2)
                        self.device.send_keyevent(
                            adbtools.KeyCode.KEYCODE_BACK)
                    else:
                        pass
                    time.sleep(2)
                    self.device.send_keyevent(adbtools.KeyCode.KEYCODE_BACK)
                    time.sleep(2)
                    self.device.send_keyevent(adbtools.KeyCode.KEYCODE_BACK)
                    # 主题-分类
                    time.sleep(2)
                    if myuiautomator.in_or_not(DEVICE_NAME, u'分类') == True:
                        myuiautomator.click_popup_window(DEVICE_NAME, [u'分类'])
                        time.sleep(5)
                        common.screenshots(app_name, '主题-分类')
                        time.sleep(2)
                        self.device.send_keyevent(
                            adbtools.KeyCode.KEYCODE_BACK)
                    else:
                        pass
                    # 主题-壁纸
                    time.sleep(2)
                    if myuiautomator.in_or_not(DEVICE_NAME, u'壁纸') == True:
                        myuiautomator.click_popup_window(DEVICE_NAME, [u'壁纸'])
                        time.sleep(5)
                        common.screenshots(app_name, '主题-壁纸')
                        time.sleep(2)
                        self.device.send_keyevent(
                            adbtools.KeyCode.KEYCODE_BACK)
                    else:
                        pass
                else:
                    pass
            # 字体
            time.sleep(2)
            if myuiautomator.in_or_not(DEVICE_NAME, u'字体') == True:
                myuiautomator.click_popup_window(DEVICE_NAME, [u'字体'])
                time.sleep(5)
                common.screenshots(app_name, '字体')
                # 字体-分类
                time.sleep(2)
                if myuiautomator.in_or_not(DEVICE_NAME, u'分类') == True:
                    myuiautomator.click_popup_window(DEVICE_NAME, [u'分类'])
                    time.sleep(5)
                    common.screenshots(app_name, '字体-分类')
                    time.sleep(2)
                    self.device.send_keyevent(adbtools.KeyCode.KEYCODE_BACK)
                else:
                    pass
            else:
                pass
            # 铃声
            time.sleep(2)
            if myuiautomator.in_or_not(DEVICE_NAME, u'铃声') == True:
                myuiautomator.click_popup_window(DEVICE_NAME, [u'铃声'])
                time.sleep(5)
                common.screenshots(app_name, '铃声')
                # 铃声-分类
                time.sleep(2)
                if myuiautomator.in_or_not(DEVICE_NAME, u'分类') == True:
                    myuiautomator.click_popup_window(DEVICE_NAME, [u'分类'])
                    time.sleep(5)
                    common.screenshots(app_name, '铃声-分类')
                    time.sleep(2)
                    self.device.send_keyevent(adbtools.KeyCode.KEYCODE_BACK)
                else:
                    pass
            else:
                pass
            # 我的
            time.sleep(2)
            if myuiautomator.in_or_not(DEVICE_NAME, u'我的') == True:
                myuiautomator.click_popup_window(DEVICE_NAME, [u'我的'])
                time.sleep(5)
                common.screenshots(app_name, '我的')
                # 我的-消息
                time.sleep(2)
                cmd = 'input tap {0} {1}'.format(int(self.width / 20),
                                                 (int(self.height / 25 * 2)))
                self.device.shell(cmd)
                time.sleep(2)
                common.screenshots(app_name, '我的-消息')
                time.sleep(2)
                self.device.send_keyevent(adbtools.KeyCode.KEYCODE_BACK)
                # 已购
                time.sleep(2)
                if myuiautomator.in_or_not(DEVICE_NAME, u'已购') == True:
                    myuiautomator.click_popup_window(DEVICE_NAME, [u'已购'])
                    time.sleep(5)
                    common.screenshots(app_name, '已购')
                    # 已购-已购主题
                    time.sleep(2)
                    if myuiautomator.in_or_not(DEVICE_NAME, u'已购主题') == True:
                        myuiautomator.click_popup_window(
                            DEVICE_NAME, [u'已购主题'])
                        time.sleep(5)
                        common.screenshots(app_name, '已购-已购主题')
                        time.sleep(2)
                        self.device.send_keyevent(
                            adbtools.KeyCode.KEYCODE_BACK)
                    else:
                        pass
                    # 已购-已购字体
                    time.sleep(2)
                    if myuiautomator.in_or_not(DEVICE_NAME, u'已购字体') == True:
                        myuiautomator.click_popup_window(
                            DEVICE_NAME, [u'已购字体'])
                        time.sleep(5)
                        common.screenshots(app_name, '已购-已购字体')
                        time.sleep(2)
                        self.device.send_keyevent(
                            adbtools.KeyCode.KEYCODE_BACK)
                    else:
                        pass
                    # 已购-已购锁屏
                    time.sleep(2)
                    if myuiautomator.in_or_not(DEVICE_NAME, u'已购锁屏') == True:
                        myuiautomator.click_popup_window(
                            DEVICE_NAME, [u'已购锁屏'])
                        time.sleep(5)
                        common.screenshots(app_name, '已购-已购锁屏')
                        time.sleep(2)
                        self.device.send_keyevent(
                            adbtools.KeyCode.KEYCODE_BACK)
                    else:
                        pass
                    time.sleep(2)
                    self.device.send_keyevent(adbtools.KeyCode.KEYCODE_BACK)
                else:
                    pass
                # 收藏
                time.sleep(2)
                if myuiautomator.in_or_not(DEVICE_NAME, u'收藏') == True:
                    myuiautomator.click_popup_window(DEVICE_NAME, [u'收藏'])
                    time.sleep(5)
                    common.screenshots(app_name, '收藏')
                    # 收藏-主题收藏
                    time.sleep(2)
                    if myuiautomator.in_or_not(DEVICE_NAME, u'主题收藏') == True:
                        myuiautomator.click_popup_window(
                            DEVICE_NAME, [u'主题收藏'])
                        time.sleep(5)
                        common.screenshots(app_name, '收藏-主题收藏')
                        time.sleep(2)
                        self.device.send_keyevent(
                            adbtools.KeyCode.KEYCODE_BACK)
                    else:
                        pass
                    # 收藏-壁纸收藏
                    time.sleep(2)
                    if myuiautomator.in_or_not(DEVICE_NAME, u'壁纸收藏') == True:
                        myuiautomator.click_popup_window(
                            DEVICE_NAME, [u'壁纸收藏'])
                        time.sleep(5)
                        common.screenshots(app_name, '收藏-壁纸收藏')
                        time.sleep(2)
                        self.device.send_keyevent(
                            adbtools.KeyCode.KEYCODE_BACK)
                    else:
                        pass
                    # 收藏-字体收藏
                    time.sleep(2)
                    if myuiautomator.in_or_not(DEVICE_NAME, u'字体收藏') == True:
                        myuiautomator.click_popup_window(
                            DEVICE_NAME, [u'字体收藏'])
                        time.sleep(5)
                        common.screenshots(app_name, '收藏-字体收藏')
                        time.sleep(2)
                        self.device.send_keyevent(
                            adbtools.KeyCode.KEYCODE_BACK)
                    else:
                        pass
                    # 收藏-锁屏收藏
                    time.sleep(2)
                    if myuiautomator.in_or_not(DEVICE_NAME, u'锁屏收藏') == True:
                        myuiautomator.click_popup_window(
                            DEVICE_NAME, [u'锁屏收藏'])
                        time.sleep(5)
                        common.screenshots(app_name, '收藏-锁屏收藏')
                        time.sleep(2)
                        self.device.send_keyevent(
                            adbtools.KeyCode.KEYCODE_BACK)
                    else:
                        pass
                    time.sleep(2)
                    self.device.send_keyevent(adbtools.KeyCode.KEYCODE_BACK)
                else:
                    pass
                # 我的-主题
                time.sleep(2)
                if myuiautomator.in_or_not(DEVICE_NAME, u'主题') == True:
                    myuiautomator.click_popup_window(DEVICE_NAME, [u'主题'])
                    time.sleep(5)
                    common.screenshots(app_name, '我的-主题')
                    time.sleep(2)
                    self.device.send_keyevent(adbtools.KeyCode.KEYCODE_BACK)
                else:
                    pass
                # 我的-壁纸
                time.sleep(2)
                if myuiautomator.in_or_not(DEVICE_NAME, u'壁纸') == True:
                    myuiautomator.click_popup_window(DEVICE_NAME, [u'壁纸'])
                    time.sleep(5)
                    common.screenshots(app_name, '我的-壁纸')
                    time.sleep(2)
                    self.device.send_keyevent(adbtools.KeyCode.KEYCODE_BACK)
                else:
                    pass
                # 我的-锁屏
                time.sleep(2)
                if myuiautomator.in_or_not(DEVICE_NAME, u'锁屏') == True:
                    myuiautomator.click_popup_window(DEVICE_NAME, [u'锁屏'])
                    time.sleep(5)
                    common.screenshots(app_name, '我的-锁屏')
                    time.sleep(2)
                    self.device.send_keyevent(adbtools.KeyCode.KEYCODE_BACK)
                else:
                    pass
                # 我的-铃声
                time.sleep(2)
                if myuiautomator.in_or_not(DEVICE_NAME, u'铃声') == True:
                    myuiautomator.click_popup_window(DEVICE_NAME, [u'铃声'])
                    time.sleep(5)
                    common.screenshots(app_name, '我的-铃声')
                    time.sleep(2)
                    self.device.send_keyevent(adbtools.KeyCode.KEYCODE_BACK)
                else:
                    pass
                # 我的-字体
                time.sleep(2)
                if myuiautomator.in_or_not(DEVICE_NAME, u'字体') == True:
                    myuiautomator.click_popup_window(DEVICE_NAME, [u'字体'])
                    time.sleep(5)
                    common.screenshots(app_name, '我的-字体')
                    time.sleep(2)
                    self.device.send_keyevent(adbtools.KeyCode.KEYCODE_BACK)
                else:
                    pass
                # 我的-混搭
                time.sleep(2)
                if myuiautomator.in_or_not(DEVICE_NAME, u'混搭') == True:
                    myuiautomator.click_popup_window(DEVICE_NAME, [u'混搭'])
                    time.sleep(5)
                    common.screenshots(app_name, '我的-混搭')
                    time.sleep(2)
                    self.device.send_keyevent(adbtools.KeyCode.KEYCODE_BACK)
                else:
                    pass
                # 我的-帮助与反馈
                time.sleep(2)
                if myuiautomator.in_or_not(DEVICE_NAME, u'帮助与反馈') == True:
                    myuiautomator.click_popup_window(DEVICE_NAME, [u'帮助与反馈'])
                    time.sleep(5)
                    common.screenshots(app_name, '我的-帮助与反馈')
                    time.sleep(2)
                    self.device.send_keyevent(adbtools.KeyCode.KEYCODE_BACK)
                else:
                    pass
                # 我的-设置
                time.sleep(2)
                cmd = 'input tap {0} {1}'.format(int(self.width / 100 * 97),
                                                 (int(self.height / 25 * 2)))
                self.device.shell(cmd)
                time.sleep(2)
                common.screenshots(app_name, '我的-设置')
                # 设置-左快捷应用
                time.sleep(2)
                if myuiautomator.in_or_not(DEVICE_NAME, u'左快捷应用') == True:
                    myuiautomator.click_popup_window(DEVICE_NAME, [u'左快捷应用'])
                    time.sleep(5)
                    common.screenshots(app_name, '设置-左快捷应用')
                    time.sleep(2)
                    self.device.send_keyevent(adbtools.KeyCode.KEYCODE_BACK)
                else:
                    pass
                # 设置-右快捷应用
                time.sleep(2)
                if myuiautomator.in_or_not(DEVICE_NAME, u'右快捷应用') == True:
                    myuiautomator.click_popup_window(DEVICE_NAME, [u'右快捷应用'])
                    time.sleep(5)
                    common.screenshots(app_name, '设置-右快捷应用')
                    time.sleep(2)
                    self.device.send_keyevent(adbtools.KeyCode.KEYCODE_BACK)
                else:
                    pass
                # 设置-联系方式
                time.sleep(2)
                cmd = 'input swipe {0} {1} {2} {3} 200'.format(
                    int(self.width / 2), (int(self.height / 4 * 3)),
                    int(self.width / 2), int(self.height / 4))
                self.device.shell(cmd)
                time.sleep(2)
                if myuiautomator.in_or_not(DEVICE_NAME, u'联系方式') == True:
                    myuiautomator.click_popup_window(DEVICE_NAME, [u'联系方式'])
                    time.sleep(5)
                    common.screenshots(app_name, '设置-联系方式')
                    time.sleep(2)
                    self.device.send_keyevent(adbtools.KeyCode.KEYCODE_BACK)
                else:
                    pass
                # 设置-用户须知
                time.sleep(2)
                if myuiautomator.in_or_not(DEVICE_NAME, u'用户须知') == True:
                    myuiautomator.click_popup_window(DEVICE_NAME, [u'用户须知'])
                    time.sleep(5)
                    common.screenshots(app_name, '设置-用户须知')
                    time.sleep(2)
                    self.device.send_keyevent(adbtools.KeyCode.KEYCODE_BACK)
                else:
                    pass
            else:
                pass

        except Exception, ex:
            print ex
            self.assertEqual(1, 0, ex)
Beispiel #8
0
    def test_imusic(self):
        app_name = 'imusic'

        try:
            self.device.start_application(
                'com.android.bbkmusic/.WidgetToTrackActivity')
            time.sleep(2)
            cmd = 'am force-stop {0} '.format('com.android.bbkmusic')
            self.device.shell(cmd)
            time.sleep(5)
            self.device.start_application(
                'com.android.bbkmusic/.WidgetToTrackActivity')
            time.sleep(2)
            common.screenshots(app_name, '首页')
            # 进入更多
            time.sleep(2)
            cmd = 'input tap {0} {1}'.format(int(self.width / 10),
                                             int(self.height / 10))
            self.device.shell(cmd)
            time.sleep(1)
            common.screenshots(app_name, '更多')
            # 在线试听音质
            if myuiautomator.in_or_not(DEVICE_NAME, u'在线试听音质') == True:
                time.sleep(2)
                myuiautomator.click_popup_window(DEVICE_NAME, [u'在线试听音质'])
                time.sleep(2)
                common.screenshots(app_name, '更多-在线试听音质')
                time.sleep(1)
                self.device.send_keyevent(adbtools.KeyCode.KEYCODE_BACK)
            else:
                pass
            # 音效设置
            if myuiautomator.in_or_not(DEVICE_NAME, u'音效设置') == True:
                time.sleep(2)
                myuiautomator.click_popup_window(DEVICE_NAME, [u'音效设置'])
                time.sleep(2)
                common.screenshots(app_name, '更多-音效设置')
                time.sleep(1)
                self.device.send_keyevent(adbtools.KeyCode.KEYCODE_BACK)
            else:
                pass
                # 主题皮肤
            if myuiautomator.in_or_not(DEVICE_NAME, u'主题皮肤') == True:
                time.sleep(2)
                myuiautomator.click_popup_window(DEVICE_NAME, [u'主题皮肤'])
                time.sleep(5)
                common.screenshots(app_name, '更多-主题皮肤')
                time.sleep(1)
                self.device.send_keyevent(adbtools.KeyCode.KEYCODE_BACK)
            else:
                pass
                # test
                # time.sleep(2)
                # if myuiautomator.in_or_not(DEVICE_NAME, u'哈哈哈') == True :
                #         time.sleep(2)
                #         myuiautomator.click_popup_window(DEVICE_NAME, [u'活力橙'])
                #         time.sleep(2)
                #         common.screenshots(app_name, img_count)
                #         img_count += 1
                #         time.sleep(1)
                #         self.device.send_keyevent(adbtools.KeyCode.KEYCODE_BACK)
                # else:
                #         pass
                # time.sleep(1)
                # self.device.send_keyevent(adbtools.KeyCode.KEYCODE_BACK)
                # 听歌偏好
            if myuiautomator.in_or_not(DEVICE_NAME, u'听歌偏好') == True:
                time.sleep(2)
                myuiautomator.click_popup_window(DEVICE_NAME, [u'听歌偏好'])
                time.sleep(60)
                common.screenshots(app_name, '更多-听歌偏好')
                time.sleep(1)
                self.device.send_keyevent(adbtools.KeyCode.KEYCODE_BACK)
            else:
                pass
                # 导入外部歌单
            if myuiautomator.in_or_not(DEVICE_NAME, u'导入外部歌单') == True:
                time.sleep(2)
                myuiautomator.click_popup_window(DEVICE_NAME, [u'导入外部歌单'])
                time.sleep(2)
                common.screenshots(app_name, '更多-导入外部歌单')
                time.sleep(1)
                self.device.send_keyevent(adbtools.KeyCode.KEYCODE_BACK)
            else:
                pass
                # 意见反馈
            if myuiautomator.in_or_not(DEVICE_NAME, u'意见反馈') == True:
                time.sleep(2)
                myuiautomator.click_popup_window(DEVICE_NAME, [u'意见反馈'])
                time.sleep(2)
                common.screenshots(app_name, '更多-意见反馈')
                time.sleep(1)
                self.device.send_keyevent(adbtools.KeyCode.KEYCODE_BACK)
            else:
                pass
            time.sleep(1)
            self.device.send_keyevent(adbtools.KeyCode.KEYCODE_BACK)
            # 我的
            time.sleep(2)
            cmd = 'input tap {0} {1}'.format(int(self.width / 5 * 2),
                                             int(self.height / 100 * 7))
            self.device.shell(cmd)
            time.sleep(2)
            common.screenshots(app_name, '我的')
            # 我的-个人中心
            time.sleep(2)
            cmd = 'input tap {0} {1}'.format(int(self.width / 100 * 37),
                                             int(self.height / 50 * 9))
            self.device.shell(cmd)
            time.sleep(2)
            common.screenshots(app_name, '我的-个人中心')
            # 个人中心-头像
            time.sleep(2)
            if myuiautomator.in_or_not(DEVICE_NAME, u'头像') == True:
                myuiautomator.click_popup_window(DEVICE_NAME, [u'头像'])
                time.sleep(2)
                common.screenshots(app_name, '我的-个人中心-头像')
                time.sleep(1)
                self.device.send_keyevent(adbtools.KeyCode.KEYCODE_BACK)
            else:
                pass
            # 个人中心-昵称
            time.sleep(2)
            if myuiautomator.in_or_not(DEVICE_NAME, u'昵称') == True:
                myuiautomator.click_popup_window(DEVICE_NAME, [u'昵称'])
                time.sleep(2)
                common.screenshots(app_name, '我的-个人中心-昵称')
                time.sleep(1)
                self.device.send_keyevent(adbtools.KeyCode.KEYCODE_BACK)
                time.sleep(1)
                self.device.send_keyevent(adbtools.KeyCode.KEYCODE_BACK)
            else:
                pass
            # 个人中心-性别
            time.sleep(2)
            if myuiautomator.in_or_not(DEVICE_NAME, u'性别') == True:
                myuiautomator.click_popup_window(DEVICE_NAME, [u'性别'])
                time.sleep(2)
                common.screenshots(app_name, '我的-个人中心-性别')
                time.sleep(1)
                self.device.send_keyevent(adbtools.KeyCode.KEYCODE_BACK)
            else:
                pass
            # 个人中心-生日
            time.sleep(2)
            if myuiautomator.in_or_not(DEVICE_NAME, u'生日') == True:
                myuiautomator.click_popup_window(DEVICE_NAME, [u'生日'])
                time.sleep(2)
                common.screenshots(app_name, '我的-个人中心-生日')
                time.sleep(1)
                self.device.send_keyevent(adbtools.KeyCode.KEYCODE_BACK)
            else:
                pass
            time.sleep(1)
            self.device.send_keyevent(adbtools.KeyCode.KEYCODE_BACK)

            # 我的-本地歌曲
            if myuiautomator.in_or_not(DEVICE_NAME, u'本地歌曲') == True:
                time.sleep(2)
                myuiautomator.click_popup_window(DEVICE_NAME, [u'本地歌曲'])
                time.sleep(2)
                common.screenshots(app_name, '我的-本地歌曲-歌曲')
                # 本地歌曲-歌手
                time.sleep(2)
                if myuiautomator.in_or_not(DEVICE_NAME, u'歌手') == True:
                    myuiautomator.click_popup_window(DEVICE_NAME, [u'歌手'])
                    time.sleep(2)
                    common.screenshots(app_name, '我的-本地歌曲-歌手')
                else:
                    pass
                # 本地歌曲-专辑
                time.sleep(2)
                if myuiautomator.in_or_not(DEVICE_NAME, u'专辑') == True:
                    myuiautomator.click_popup_window(DEVICE_NAME, [u'专辑'])
                    time.sleep(2)
                    common.screenshots(app_name, '我的-本地歌曲-专辑')
                else:
                    pass
                # 本地歌曲-文件夹
                time.sleep(2)
                if myuiautomator.in_or_not(DEVICE_NAME, u'文件夹') == True:
                    myuiautomator.click_popup_window(DEVICE_NAME, [u'文件夹'])
                    time.sleep(2)
                    common.screenshots(app_name, '我的-本地歌曲-文件夹')
                else:
                    pass
                time.sleep(2)
                cmd = 'input tap {0} {1}'.format(int(self.width / 100 * 78),
                                                 int(self.height / 100 * 7))
                # 本地歌曲-搜索
                time.sleep(2)
                cmd = 'input tap {0} {1}'.format(int(self.width / 100 * 78),
                                                 int(self.height / 100 * 7))
                self.device.shell(cmd)
                time.sleep(2)
                cmd = 'input text abcd'
                self.device.shell(cmd)
                time.sleep(2)
                common.screenshots(app_name, '我的-本地歌曲-搜索')
                time.sleep(1)
                self.device.send_keyevent(adbtools.KeyCode.KEYCODE_BACK)
                time.sleep(1)
                self.device.send_keyevent(adbtools.KeyCode.KEYCODE_BACK)
                time.sleep(1)
                self.device.send_keyevent(adbtools.KeyCode.KEYCODE_BACK)
            else:
                pass
            # 我的-我的下载
            time.sleep(2)
            if myuiautomator.in_or_not(DEVICE_NAME, u'我的下载') == True:
                myuiautomator.click_popup_window(DEVICE_NAME, [u'我的下载'])
                time.sleep(2)
                common.screenshots(app_name, '我的-我的下载')
                # 我的下载-正在下载
                time.sleep(2)
                if myuiautomator.in_or_not(DEVICE_NAME, u'正在下载') == True:
                    myuiautomator.click_popup_window(DEVICE_NAME, [u'正在下载'])
                    time.sleep(2)
                    common.screenshots(app_name, '我的下载-正在下载')
                else:
                    pass
                time.sleep(1)
                self.device.send_keyevent(adbtools.KeyCode.KEYCODE_BACK)
            else:
                pass
            # 我的-最近播放
            time.sleep(2)
            if myuiautomator.in_or_not(DEVICE_NAME, u'最近播放') == True:
                myuiautomator.click_popup_window(DEVICE_NAME, [u'最近播放'])
                time.sleep(2)
                common.screenshots(app_name, '我的-最近播放')
                # 最近播放-下载
                time.sleep(2)
                if myuiautomator.in_or_not(DEVICE_NAME, u'下载') == True:
                    myuiautomator.click_popup_window(DEVICE_NAME, [u'下载'])
                    time.sleep(2)
                    common.screenshots(app_name, '我的-最近播放-下载')
                    time.sleep(1)
                    self.device.send_keyevent(adbtools.KeyCode.KEYCODE_BACK)
                else:
                    pass
                # 最近播放-多选
                time.sleep(2)
                if myuiautomator.in_or_not(DEVICE_NAME, u'多选') == True:
                    myuiautomator.click_popup_window(DEVICE_NAME, [u'多选'])
                    time.sleep(2)
                    common.screenshots(app_name, '我的-最近播放-多选')
                    time.sleep(1)
                    self.device.send_keyevent(adbtools.KeyCode.KEYCODE_BACK)
                else:
                    pass
                time.sleep(1)
                self.device.send_keyevent(adbtools.KeyCode.KEYCODE_BACK)
            else:
                pass
            # 我的-我喜欢
            time.sleep(2)
            if myuiautomator.in_or_not(DEVICE_NAME, u'我喜欢') == True:
                myuiautomator.click_popup_window(DEVICE_NAME, [u'我喜欢'])
                time.sleep(2)
                common.screenshots(app_name, '我的-我喜欢')
                # 我喜欢-专辑
                time.sleep(2)
                if myuiautomator.in_or_not(DEVICE_NAME, u'专辑') == True:
                    myuiautomator.click_popup_window(DEVICE_NAME, [u'专辑'])
                    time.sleep(2)
                    common.screenshots(app_name, '我的-我喜欢-专辑')
                else:
                    pass
                # 我喜欢-歌单
                time.sleep(2)
                if myuiautomator.in_or_not(DEVICE_NAME, u'歌单') == True:
                    myuiautomator.click_popup_window(DEVICE_NAME, [u'歌单'])
                    time.sleep(2)
                    common.screenshots(app_name, '我的-我喜欢-歌单')
                    # 歌单-管理
                    time.sleep(2)
                    if myuiautomator.in_or_not(DEVICE_NAME, u'管理') == True:
                        myuiautomator.click_popup_window(DEVICE_NAME, [u'管理'])
                        time.sleep(2)
                        common.screenshots(app_name, '我的-我喜欢-歌单-管理')
                        time.sleep(1)
                        self.device.send_keyevent(
                            adbtools.KeyCode.KEYCODE_BACK)
                    else:
                        pass
                    time.sleep(1)
                    self.device.send_keyevent(adbtools.KeyCode.KEYCODE_BACK)
                else:
                    pass
            else:
                pass
            # 我的-已购音乐
            time.sleep(2)
            if myuiautomator.in_or_not(DEVICE_NAME, u'已购音乐') == True:
                myuiautomator.click_popup_window(DEVICE_NAME, [u'已购音乐'])
                time.sleep(2)
                common.screenshots(app_name, '我的-已购音乐')
                # 已购音乐-单曲
                time.sleep(2)
                if myuiautomator.in_or_not(DEVICE_NAME, u'单曲') == True:
                    myuiautomator.click_popup_window(DEVICE_NAME, [u'单曲'])
                    time.sleep(2)
                    common.screenshots(app_name, '我的-已购音乐-单曲')
                else:
                    pass
                time.sleep(1)
                self.device.send_keyevent(adbtools.KeyCode.KEYCODE_BACK)
            else:
                pass
            # 我的-免流随心听
            time.sleep(2)
            if myuiautomator.in_or_not(DEVICE_NAME, u'免流随心听') == True:
                myuiautomator.click_popup_window(DEVICE_NAME, [u'免流随心听'])
                time.sleep(2)
                common.screenshots(app_name, '我的-免流随心听')
                time.sleep(1)
                self.device.send_keyevent(adbtools.KeyCode.KEYCODE_BACK)
            else:
                pass
            # 我的-听歌识曲
            time.sleep(2)
            if myuiautomator.in_or_not(DEVICE_NAME, u'听歌识曲') == True:
                myuiautomator.click_popup_window(DEVICE_NAME, [u'听歌识曲'])
                time.sleep(2)
                common.screenshots(app_name, '我的-听歌识曲')
                time.sleep(1)
                self.device.send_keyevent(adbtools.KeyCode.KEYCODE_BACK)
            else:
                pass
            # 我的-新建
            time.sleep(2)
            if myuiautomator.in_or_not(DEVICE_NAME, u'新建') == True:
                myuiautomator.click_popup_window(DEVICE_NAME, [u'新建'])
                time.sleep(2)
                common.screenshots(app_name, '自建歌曲-新建')
                time.sleep(1)
                self.device.send_keyevent(adbtools.KeyCode.KEYCODE_BACK)
                time.sleep(1)
                self.device.send_keyevent(adbtools.KeyCode.KEYCODE_BACK)
            else:
                pass
            # 发现
            time.sleep(2)
            cmd = 'input tap {0} {1}'.format(int(self.width / 20 * 13),
                                             int(self.height / 100 * 7))
            self.device.shell(cmd)
            # 发现-歌单
            time.sleep(2)
            if myuiautomator.in_or_not(DEVICE_NAME, u'歌单') == True:
                myuiautomator.click_popup_window(DEVICE_NAME, [u'歌单'])
                time.sleep(2)
                common.screenshots(app_name, '发现-歌单')
                # 歌单-全部歌单
                time.sleep(2)
                if myuiautomator.in_or_not(DEVICE_NAME, u'全部歌单') == True:
                    myuiautomator.click_popup_window(DEVICE_NAME, [u'全部歌单'])
                    time.sleep(2)
                    common.screenshots(app_name, '发现-歌单-全部歌单')
                    time.sleep(1)
                    self.device.send_keyevent(adbtools.KeyCode.KEYCODE_BACK)
                else:
                    pass
                time.sleep(1)
                self.device.send_keyevent(adbtools.KeyCode.KEYCODE_BACK)
            else:
                pass
            # 发现-排行
            time.sleep(2)
            if myuiautomator.in_or_not(DEVICE_NAME, u'排行') == True:
                myuiautomator.click_popup_window(DEVICE_NAME, [u'排行'])
                time.sleep(2)
                common.screenshots(app_name, '发现-排行')
                # 排行-人气榜
                time.sleep(2)
                cmd = 'input tap {0} {1}'.format(int(self.width / 2),
                                                 int(self.height / 2))
                self.device.shell(cmd)
                time.sleep(2)
                common.screenshots(app_name, '发现-排行-人气榜')
                time.sleep(1)
                self.device.send_keyevent(adbtools.KeyCode.KEYCODE_BACK)
                time.sleep(1)
                self.device.send_keyevent(adbtools.KeyCode.KEYCODE_BACK)
            else:
                pass
            # 发现-电台
            time.sleep(2)
            if myuiautomator.in_or_not(DEVICE_NAME, u'电台') == True:
                myuiautomator.click_popup_window(DEVICE_NAME, [u'电台'])
                time.sleep(2)
                common.screenshots(app_name, '发现-电台')
                cmd = 'input tap {0} {1}'.format(int(self.width / 2),
                                                 int(self.height / 2 + 100))
                self.device.shell(cmd)
                # 电台-主题
                time.sleep(2)
                if myuiautomator.in_or_not(DEVICE_NAME, u'主题') == True:
                    myuiautomator.click_popup_window(DEVICE_NAME, [u'主题'])
                    time.sleep(2)
                    common.screenshots(app_name, '发现-电台-主题')
                else:
                    pass
                # 电台-场景
                time.sleep(2)
                if myuiautomator.in_or_not(DEVICE_NAME, u'场景') == True:
                    myuiautomator.click_popup_window(DEVICE_NAME, [u'场景'])
                    time.sleep(2)
                    common.screenshots(app_name, '发现-电台-场景')
                else:
                    pass
                # 电台-语种
                time.sleep(2)
                if myuiautomator.in_or_not(DEVICE_NAME, u'语种') == True:
                    myuiautomator.click_popup_window(DEVICE_NAME, [u'语种'])
                    time.sleep(2)
                    common.screenshots(app_name, '发现-电台-语种')
                else:
                    pass
                # 电台-风格
                time.sleep(2)
                if myuiautomator.in_or_not(DEVICE_NAME, u'风格') == True:
                    myuiautomator.click_popup_window(DEVICE_NAME, [u'风格'])
                    time.sleep(2)
                    common.screenshots(app_name, '发现-电台-风格')
                else:
                    pass
                # 电台-星座
                time.sleep(2)
                if myuiautomator.in_or_not(DEVICE_NAME, u'星座') == True:
                    myuiautomator.click_popup_window(DEVICE_NAME, [u'星座'])
                    time.sleep(2)
                    common.screenshots(app_name, '发现-电台-星座')
                else:
                    pass
                time.sleep(1)
                self.device.send_keyevent(adbtools.KeyCode.KEYCODE_BACK)
            else:
                pass
            # 发现-歌手
            time.sleep(2)
            if myuiautomator.in_or_not(DEVICE_NAME, u'歌手') == True:
                myuiautomator.click_popup_window(DEVICE_NAME, [u'歌手'])
                time.sleep(5)
                common.screenshots(app_name, '发现-歌手')
            else:
                pass
            # 歌手-我的
            time.sleep(2)
            if myuiautomator.in_or_not(DEVICE_NAME, u'我的') == True:
                myuiautomator.click_popup_window(DEVICE_NAME, [u'我的'])
                time.sleep(2)
                common.screenshots(app_name, '发现-歌手-我的')
                # 歌手-搜索
                time.sleep(2)
                cmd = 'input tap {0} {1}'.format(int(self.width / 50 * 49),
                                                 int(self.height / 25 * 2))
                self.device.shell(cmd)
                time.sleep(5)
                common.screenshots(app_name, '发现-歌手-搜索')
                time.sleep(1)
                self.device.send_keyevent(adbtools.KeyCode.KEYCODE_BACK)
                time.sleep(1)
                self.device.send_keyevent(adbtools.KeyCode.KEYCODE_BACK)
                time.sleep(1)
                self.device.send_keyevent(adbtools.KeyCode.KEYCODE_BACK)
            else:
                pass
            # 播放
            time.sleep(2)
            cmd = 'input tap {0} {1}'.format(int(self.width / 2),
                                             int(self.height / 100 * 97))
            self.device.shell(cmd)
            time.sleep(2)
            cmd = 'input tap {0} {1}'.format(int(self.width / 2),
                                             int(self.height / 3))
            self.device.shell(cmd)
            time.sleep(2)
            common.screenshots(app_name, '播放')
            # 播放-更多
            time.sleep(2)
            cmd = 'input tap {0} {1}'.format(int(self.width / 100 * 81),
                                             int(self.height / 100 * 97))
            self.device.shell(cmd)
            time.sleep(2)
            common.screenshots(app_name, '播放-更多')
            time.sleep(1)
            self.device.send_keyevent(adbtools.KeyCode.KEYCODE_BACK)
            # 播放-歌单
            time.sleep(2)
            cmd = 'input tap {0} {1}'.format(int(self.width / 200 * 37),
                                             int(self.height / 100 * 97))
            self.device.shell(cmd)
            time.sleep(2)
            common.screenshots(app_name, '播放-歌单')
            time.sleep(1)
            self.device.send_keyevent(adbtools.KeyCode.KEYCODE_BACK)

            time.sleep(1)
            cmd = 'am force-stop {0} '.format('com.android.bbkmusic')
            self.device.shell(cmd)
        except Exception, ex:
            print ex
            self.assertEqual(1, 0, ex)