示例#1
0
    def double_pull_notification(self, driver, bigstyle, text):
        if bigstyle == 61 or bigstyle == 62:
            if not len(
                    driver.find_elements_by_id(
                        configs.PKG_name + ':id/getui_big_notification_icon')):
                tools.double_slide(
                    driver, configs.PKG_name + ':id/getui_notification_icon',
                    100, 200, 30, 100)
                time.sleep(3)
                self.verify_screenshots("notification" + str(type))
            result = self.find_class_name(driver, 'android.widget.TextView',
                                          text)
            tools.assertEqual(result, tools.SUCCESS_CODE, "通知验证失败!")
            print "通知验证成功!"

        if bigstyle == 63:
            if not len(
                    driver.find_elements_by_id(configs.PKG_name +
                                               ':id/getui_bigview_expanded')):
                tools.double_slide(
                    driver, configs.PKG_name + ':id/getui_bigview_banner', 200,
                    400, 50, 150)
                time.sleep(3)
                self.verify_screenshots("notification" + str(type))
            bigimage = driver.find_elements_by_id(configs.PKG_name +
                                                  ':id/getui_bigview_expanded')
            for b in bigimage:
                b.click()
                time.sleep(3)
示例#2
0
    def appdownload(self):
        # 下拉通知栏,清空所有通知
        tools.clear_motification(self.driver)

        # 1.删除文件夹中的文件,删除要安装的APP
        # subprocess.call('adb shell rm -r /sdcard/libs/tmp', shell=True)
        # import os
        os.system("adb shell rm -r /sdcard/libs/tmp")
        time.sleep(5)
        print "清空tmp文件夹"
        # subprocess.call('adb uninstall com.ibox.flashlight', shell=True)
        os.system("adb uninstall com.ibox.flashlight")
        time.sleep(5)
        print "删除要安装的APP"

        # 2.下发动作链
        taskid = self.verify_actionchain(self.cid, action_chain.ACTIONCHAIN_APPDOWNLOAD % (self.appid))

        # 3.验证下载文件
        time.sleep(30)
        result = tools.verify_file("adb shell ls /sdcard/libs/tmp", NAME + ".apk")
        tools.assertEqual(result, tools.SUCCESS_CODE, "下载文件验证失败!")
        print "下载文件验证成功!"

        # 4.截图
        time.sleep(3)
        self.driver.open_notifications()
        time.sleep(2)
        self.verify_screenshots("appdownload")

        # 5.下拉通知栏验证通知并点击通知
        self.verify_nitification(NAME)

        # 6.点击安装
        tools.swipeUp(self.driver)
        tools.swipeUp(self.driver)
        tools.swipeUp(self.driver)
        tools.swipeUp(self.driver)
        butten = self.driver.find_elements_by_class_name("android.widget.Button")
        for b in butten:
            if INSTALL == b.text:
                b.click()
                time.sleep(15)

        # 7.检查APP安装完成后是否自动打开
        activity = os.popen('adb shell "dumpsys activity | grep mFocusedActivity"').read()
        if "com.ibox.flashlight" in activity:
            print "下载文件验证成功!"
        else:
            print "下载文件验证失败!"

        # 8.验证回执
        self.verify_logs(taskid, FEEDBACK)

        print("普通下载 验证成功!")
示例#3
0
    def updateapp(self):
        # 下拉通知栏,清空所有通知
        tools.clear_motification(self.driver)

        # 1.安装低版本快手
        if self.driver.is_app_installed("com.UCMobile"):
            os.system("adb uninstall com.smile.gifmaker")
            time.sleep(5)
        self.driver.install_app("./UC.apk")
        time.sleep(5)
        print "安装低版本快手"

        # 2.下发动作链
        self.verify_actionchain(
            self.cid, action_chain.ACTIONCHAIN_UPDATEAPP % (self.appid))

        # 3.验证下载文件
        time.sleep(60)
        result = tools.verify_file("adb shell ls /sdcard/libs/tmp",
                                   NAME + ".apk")
        tools.assertEqual(result, tools.SUCCESS_CODE, "下载文件验证失败!")
        print "下载文件验证成功!"

        # 4.下拉通知栏截图
        time.sleep(3)
        self.driver.open_notifications()
        time.sleep(2)
        self.verify_screenshots("updateapp_notification")

        # 5.验证通知并点击通知
        self.verify_nitification(NAME)
        time.sleep(5)
        self.verify_screenshots("updateapp_popup")

        # 6.点击安装并截图
        time.sleep(5)
        self.verify_nitification("更新")

        # 7.验证回执
        self.verify_logs(PADTASKID, FEEDBACK)

        print("app更新 验证成功!")
示例#4
0
    def silentdownload(self):
        # 1.删除文件夹中的文件,删除要安装的APP
        os.popen("adb shell rm -r /sdcard/libs/tmp")
        time.sleep(5)
        print "清空tmp文件夹"
        os.popen("adb uninstall com.ibox.flashlight")
        time.sleep(10)
        print "删除要安装的APP"

        # 2.下发动作连
        taskid = self.verify_actionchain(self.cid, action_chain.ACTIONCHAIN_SILENTDOWNLOAD % (self.appid))

        # 3.验证下载文件
        time.sleep(30)
        result = tools.verify_file("adb shell ls /sdcard/libs/tmp", NAME + ".apk")
        tools.assertEqual(result, tools.SUCCESS_CODE, "下载文件验证失败!")
        print "下载文件验证成功!"

        # 4.点击安装
        tools.swipeUp(self.driver)
        tools.swipeUp(self.driver)
        tools.swipeUp(self.driver)
        tools.swipeUp(self.driver)
        butten = self.driver.find_elements_by_class_name("android.widget.Button")
        for b in butten:
            if INSTALL == b.text:
                b.click()
                time.sleep(15)

        # 5.检查APP安装完成后是否自动打开
        activity = os.popen('adb shell "dumpsys activity | grep mFocusedActivity"').read()
        print activity
        if "com.ibox.flashlight" in activity:
            print "下载文件验证成功!"
        else:print "下载文件验证失败!"

        # 6.验证回执
        self.verify_logs(taskid, FEEDBACK)

        print("静默下载 验证成功!")
示例#5
0
 def verify_popup(self, driver, type, title, btn_title):
     result = self.popup_notification(driver, type, title, btn_title)
     tools.assertEqual(result, tools.SUCCESS_CODE, "弹框验证失败!")
     print "弹框验证成功!"
示例#6
0
 def verify_logs(self, taskid, FEEDBACK):
     result = tools.check_logs(self.driver, taskid, FEEDBACK)
     tools.assertEqual(result, tools.SUCCESS_CODE, "日志验证失败!\n")
     print "日志验证成功!\n"
示例#7
0
 def verify_nitification(self, text):
     result = self.find_class_name(self.driver, 'android.widget.TextView',
                                   text)
     tools.assertEqual(result, tools.SUCCESS_CODE, "通知验证失败!")
     print "通知验证成功!"
示例#8
0
 def verify_screenshots(self, filename):
     result = tools.screenshots(self.driver, filename)
     tools.assertEqual(result, tools.SUCCESS_CODE, "截图失败!")
     print "截图成功!"