Exemplo n.º 1
0
    def test_edit_sound_add(self):
        """剪辑-配音-添加."""
        sc.logger.info('剪辑-配音-添加')
        fun_name = 'test_edit_sound_add'

        start_x = self.width - self.width // 4
        start_bottom = self.height - self.height // 10

        time.sleep(1)
        sc.logger.info('点击创作中心主按钮')
        sc.driver.find_element_by_id(
            'com.quvideo.xiaoying:id/img_creation').click()
        sc.logger.info('点击“更多草稿”')
        sc.driver.find_element_by_android_uiautomator('text("更多草稿")').click()

        sc.logger.info('点击草稿封面')
        el_draft = sc.driver.find_element_by_id(
            'com.quvideo.xiaoying:id/xiaoying_studio_img_project_thumb')
        el_draft.click()
        sc.logger.info('点击“剪辑”')
        sc.driver.find_element_by_android_uiautomator('text("剪辑")').click()
        time.sleep(1)
        sc.swipe_by_ratio(start_x, start_bottom, 'left', 0.6, 500)
        el_edit_list = sc.driver.find_elements_by_id(
            'com.quvideo.xiaoying:id/title')
        for el_item in el_edit_list:
            if el_item.text == '配音':
                sc.logger.info('开始点击配音')
                el_item.click()
                break
        el_record = sc.driver.find_element_by_id(
            'com.quvideo.xiaoying:id/dub_panel_audio_record_btn')
        # 长按录制
        sc.logger.info('长按拍摄5s')
        actions = TouchAction(sc.driver)
        actions.long_press(el_record, None, None, 5000).release().perform()
        sc.capture_screen(fun_name, self.img_path)
        """
        x = record.location.get('x')
        y = record.location.get('y')
        sc.driver.swipe(x, y, x, y, 5000)
        """
        sc.capture_screen(fun_name, self.img_path)
        sc.driver.find_element_by_id(
            'com.quvideo.xiaoying:id/xiaoying_ve_imgbtn_add_audio_dub').click(
            )
        time.sleep(2)
        el_audio_name = sc.driver.find_element_by_id(
            'com.quvideo.xiaoying:id/musiclist_title')
        el_audio_name.click()
        sc.driver.find_element_by_id(
            'com.quvideo.xiaoying:id/btn_add_music').click()
        sc.driver.find_element_by_id(
            'com.quvideo.xiaoying:id/xiaoying_com_btn_right').click()

        sc.logger.info('返回创作中心主界面')
        for i in range(4):
            time.sleep(1)
            sc.driver.press_keycode(4)
        sc.logger.info('剪辑-配音-添加测试完成')
Exemplo n.º 2
0
    def test_theme_ui(self):
        """预览页-切换到主题页面."""
        sc.logger.info('预览页-切换到主题页面')
        fun_name = 'test_theme_ui'

        time.sleep(1)
        sc.logger.info('点击创作中心主按钮')
        sc.driver.find_element_by_id('com.quvideo.xiaoying:id/img_creation').click()
        sc.logger.info('点击“剪辑”')
        sc.driver.find_element_by_id('com.quvideo.xiaoying:id/icon1').click()
        el_video = sc.driver.find_element_by_id('com.quvideo.xiaoying:id/img_click_mask')
        el_video.click()
        sc.logger.info('点击“添加”')
        sc.driver.find_element_by_id('com.quvideo.xiaoying:id/imgbtn_import').click()
        try:
            WebDriverWait(sc.driver, 60).until(
                lambda V_improt: V_improt.find_element_by_android_uiautomator('text("下一步")'))
        except TimeoutError as t:
            sc.logger.error('导入视频超时', t)
            return False
        except Exception as e:
            sc.logger.error('导入视频出错', e)
            return False
        sc.logger.info('点击“下一步”')
        sc.driver.find_element_by_android_uiautomator('text("下一步")').click()
        sc.logger.info('点击“主题”按钮')
        sc.driver.find_element_by_android_uiautomator('text("主题")').click()
        sc.capture_screen(fun_name, self.img_path)
        sc.logger.info('预览页-切换到主题页面')
Exemplo n.º 3
0
    def test_home_other(self):
        """首页-小影百宝箱及其他."""
        sc.logger.info('首页-推荐位-小影百宝箱及其他')
        fun_name = 'test_home_other'

        time.sleep(3)
        start_x = self.width // 2
        start_bottom = self.height - self.height // 5
        sc.swipe_by_ratio(start_x, start_bottom, 'up', 0.7, 500)
        sc.driver.find_element_by_id('com.quvideo.xiaoying:id/btn_vip').click()
        sc.driver.find_element_by_id(
            'com.quvideo.xiaoying:id/img_back').click()
        sc.driver.find_element_by_id(
            'com.quvideo.xiaoying:id/btn_shuffle').click()
        sc.driver.press_keycode(4)
        el_ads_list = sc.driver.find_elements_by_id(
            'com.quvideo.xiaoying:id/creation_item_img')

        # 跳转小影记广告位
        for el_ad in el_ads_list:
            el_ad.click()
            time.sleep(3)
            sc.capture_screen(fun_name, self.img_path)
            sc.driver.press_keycode(4)
        sc.logger.info('首页-推荐位-小影百宝箱及其他检查完毕')
Exemplo n.º 4
0
    def test_settings_live(self):
        """设置:摄像头校正."""
        sc.logger.info('设置:摄像头校正')
        fun_name = 'test_settings_live'

        sc.driver.find_element_by_android_uiautomator(
            'new UiSelector().text("摄像头校正")').click()
        sc.driver.find_element_by_android_uiautomator(
            'new UiSelector().text("校正前置摄像头")').click()
        time.sleep(3)
        sc.logger.info('校正前置摄像头时截图')
        sc.capture_screen(fun_name, self.img_path)
        sc.driver.find_element_by_id('com.quvideo.xiaoying:id/cam_adjust_dialog_btn_rotate_left').click()
        sc.driver.find_element_by_id('com.quvideo.xiaoying:id/cam_adjust_dialog_btn_rotate_right').click()
        sc.driver.find_element_by_id('com.quvideo.xiaoying:id/cam_adjust_dialog_btn_flip_horizontal').click()
        sc.driver.find_element_by_id('com.quvideo.xiaoying:id/cam_adjust_dialog_btn_flip_vertical').click()
        sc.driver.press_keycode(4)
        time.sleep(3)
        sc.driver.find_element_by_android_uiautomator(
            'new UiSelector().text("摄像头校正")').click()
        sc.driver.find_element_by_android_uiautomator(
            'new UiSelector().text("校正后置摄像头")').click()
        time.sleep(3)
        sc.logger.info('校正后置摄像头时截图')
        sc.capture_screen(fun_name, self.img_path)
        sc.driver.find_element_by_id('com.quvideo.xiaoying:id/cam_adjust_dialog_btn_rotate_left').click()
        sc.driver.find_element_by_id('com.quvideo.xiaoying:id/cam_adjust_dialog_btn_rotate_right').click()
        sc.driver.find_element_by_id('com.quvideo.xiaoying:id/cam_adjust_dialog_btn_flip_horizontal').click()
        sc.driver.find_element_by_id('com.quvideo.xiaoying:id/cam_adjust_dialog_btn_flip_vertical').click()
        sc.driver.press_keycode(4)
        sc.logger.info('设置:摄像头校正测试完成')
Exemplo n.º 5
0
    def test_settings_ui(self):
        """设置:默认值UI遍."""
        sc.logger.info('设置:默认UI遍历')
        fun_name = 'test_settings_ui'

        time.sleep(3)
        sc.logger.info('点击按钮“我”')
        sc.driver.find_element_by_id(
            'com.quvideo.xiaoying:id/img_studio').click()
        sc.logger.info('开始进入个人空间截图')
        sc.capture_screen(fun_name, self.img_path)
        sc.driver.find_element_by_id(
            'com.quvideo.xiaoying:id/btn_setting').click()
        el_set_list = sc.driver.find_elements_by_class_name(
            'android.widget.TextView')

        for el_set_content in el_set_list:
            el_set_content.click()
            sc.capture_screen(fun_name, self.img_path)
            sc.driver.press_keycode(4)
            time.sleep(1)
            """
            try:
                sc.driver.find_element_by_id(
                    'com.quvideo.xiaoying:id/btn_setting').click()
            except NoSuchElementException:
                sc.logger.info('[%s]: 未找到设置按钮', fun_name)
            """
        sc.logger.info('设置选项UI第一页遍历完成')
Exemplo n.º 6
0
    def test_cancel_preview(self):
        """拍摄-预览页放弃."""
        sc.logger.info('拍摄-预览页放弃)')
        fun_name = 'test_cancel_preview'

        sc.logger.info('点击创作中心“拍摄”按钮')
        sc.driver.find_element_by_id('com.quvideo.xiaoying:id/icon2').click()
        el_capture = sc.driver.find_element_by_id(
            'com.quvideo.xiaoying:id/btn_rec')
        sc.logger.info('点击录制按钮')
        el_capture.click()
        time.sleep(5)
        sc.logger.info('拍摄5s后点击录制按钮停止拍摄')
        el_capture.click()
        try:
            WebDriverWait(sc.driver,
                          60).until(lambda capture: capture.find_element_by_id(
                              'com.quvideo.xiaoying:id/cam_btn_next'))
        except Exception as e:
            sc.logger.error('拍摄完成但未找到返回按钮', e)
            return False
        sc.logger.info('录制完成后点击确认按钮')
        sc.driver.find_element_by_id(
            'com.quvideo.xiaoying:id/cam_btn_next').click()
        sc.capture_screen(fun_name, self.img_path)
        sc.logger.info('点击左上角返回按钮')
        sc.driver.find_element_by_id(
            'com.quvideo.xiaoying:id/xiaoying_com_btn_left').click()
        sc.logger.info('点击左上角取消按钮')
        sc.driver.find_element_by_id(
            'com.quvideo.xiaoying:id/cam_btn_cancel').click()
        sc.logger.info('点击左上角返回按钮退回主页面')
        sc.driver.find_element_by_id(
            'com.quvideo.xiaoying:id/xiaoying_com_btn_left').click()
        sc.logger.info('拍摄-预览页放弃测试完成')
Exemplo n.º 7
0
    def test_home_studio(self):
        """首页-我的工作室."""
        sc.logger.info('首页-我的工作室')
        fun_name = 'test_home_studio'

        time.sleep(3)
        start_x = self.width // 2
        start_bottom = self.height // 5
        sc.swipe_by_ratio(start_x, start_bottom, 'down', 0.6, 500)
        sc.driver.find_element_by_android_uiautomator('text("更多草稿")').click()
        el_draft = sc.driver.find_element_by_id(
            'com.quvideo.xiaoying:id/xiaoying_studio_img_project_thumb')
        el_draft.click()
        sc.driver.find_element_by_id(
            'com.quvideo.xiaoying:id/xiaoying_com_btn_left').click()
        time.sleep(1)
        try:
            sc.driver.find_element_by_id(
                'com.quvideo.xiaoying:id/xiaoying_com_btn_left').click()
        except NoSuchElementException:
            sc.logger.info('此草稿视频为拍摄视频,返回的是拍摄页面')
            sc.driver.find_element_by_id(
                'com.quvideo.xiaoying:id/cam_btn_cancel').click()
        el_publish = sc.driver.find_element_by_id(
            'com.quvideo.xiaoying:id/xiaoying_studio_publish_btn')
        el_publish.click()
        sc.capture_screen(fun_name, self.img_path)
        sc.driver.find_element_by_id(
            'com.quvideo.xiaoying:id/img_back').click()
        el_del_draft = sc.driver.find_element_by_id(
            'com.quvideo.xiaoying:id/xiaoying_studio_img_delete')
        el_del_draft.click()
        sc.driver.find_element_by_android_uiautomator('text("确认")').click()
        sc.driver.press_keycode(4)
        sc.logger.info('首页-我的工作室完成')
Exemplo n.º 8
0
    def test_gallery_video(self):
        """相册-视频."""
        sc.logger.info('相册-视频')
        fun_name = 'test_gallery_video'
        start_x = self.width // 2
        start_bottom = self.height - self.height // 4

        time.sleep(1)
        sc.logger.info('点击创作中心主按钮')
        sc.driver.find_element_by_id(
            'com.quvideo.xiaoying:id/img_creation').click()
        sc.logger.info('点击“剪辑”')
        sc.driver.find_element_by_id('com.quvideo.xiaoying:id/icon1').click()
        time.sleep(1)
        try:
            sc.driver.find_element_by_android_uiautomator('text("跳过")').click()
            sc.driver.find_element_by_id(
                'com.quvideo.xiaoying:id/icon1').click()
        except NoSuchElementException:
            sc.logger.info('已跳过订阅页面')
        sc.logger.info('点击“其它相册”')
        sc.driver.find_element_by_android_uiautomator('text("其他相册")').click()
        sc.capture_screen(fun_name, self.img_path)
        sc.driver.find_element_by_android_uiautomator('text("全部")').click()
        sc.swipe_by_ratio(start_x, start_bottom, 'up', 0.5, 500)
        el_video = sc.driver.find_element_by_id(
            'com.quvideo.xiaoying:id/img_click_mask')
        el_video.click()
        sc.capture_screen(fun_name, self.img_path)
        sc.driver.find_element_by_id(
            'com.quvideo.xiaoying:id/imgbtn_ratate').click()
        try:
            sc.driver.find_element_by_id(
                'com.quvideo.xiaoying:id/imgbtn_crop').click()
        except NoSuchElementException:
            sc.logger.info('视频尺寸1:1,无此选项')
        sc.driver.find_element_by_id(
            'com.quvideo.xiaoying:id/btn_start_trim').click()
        sc.driver.find_element_by_id(
            'com.quvideo.xiaoying:id/imgbtn_import').click()
        sc.capture_screen(fun_name, self.img_path)
        try:
            WebDriverWait(
                sc.driver,
                60).until(lambda V_improt: V_improt.
                          find_element_by_android_uiautomator('text("下一步")'))
        except TimeoutError as t:
            sc.logger.error('导入视频超时', t)
            return False
        except Exception as e:
            sc.logger.error('导入视频出错', e)
            return False
        sc.driver.find_element_by_android_uiautomator('text("下一步")').click()
        sc.capture_screen(fun_name, self.img_path)

        sc.driver.find_element_by_android_uiautomator('text("存草稿")').click()
        sc.driver.find_element_by_id(
            'com.quvideo.xiaoying:id/xiaoying_com_btn_left').click()
        sc.capture_screen(fun_name, self.img_path)
        sc.logger.info('相册-视频相关操作测试完成')
Exemplo n.º 9
0
    def test_export_third(self):
        """导出-保存到相册-1080P-三次导出."""
        sc.logger.info('导出-保存到相册-1080P')
        fun_name = 'test_export_third'

        sc.driver.find_element_by_android_uiautomator('text("更多草稿")').click()
        el_draft = sc.driver.find_element_by_id('com.quvideo.xiaoying:id/xiaoying_studio_img_project_thumb')
        el_draft.click()
        sc.driver.find_element_by_android_uiautomator('text("保存/上传")').click()
        sc.driver.find_element_by_id('com.quvideo.xiaoying:id/btn_export').click()
        try:
            sc.driver.find_element_by_id('com.quvideo.xiaoying:id/purchase_hd_1080_title').click()
        except NoSuchElementException:
            sc.logger.info('当前设备不支持1080P导出')
            sc.logger.info('返回创作中心主界面')
            for i in range(5):
                time.sleep(1)
                sc.driver.press_keycode(4)
            return True
        try:
            WebDriverWait(sc.driver, 60).until(
                lambda V_exprot: V_exprot.find_element_by_android_uiautomator('text("工作室")'))
            sc.capture_screen(fun_name, self.img_path)
            sc.driver.find_element_by_id('com.quvideo.xiaoying:id/xiaoying_com_btn_left').click()
        except TimeoutError as t:
            sc.logger.error('导出视频超时', t)
            return False
        sc.logger.info('导出-保存到相册-1080P测试完成')
Exemplo n.º 10
0
 def test_preview_local(self):
     """音乐库-使用本地音乐."""
     sc.logger.info('音乐库-使用本地音乐')
     fun_name = 'test_preview_local'
     sc.driver.find_element_by_android_uiautomator('text("本地")').click()
     sc.capture_screen(fun_name, self.img_path)
     m_list = sc.driver.find_elements_by_id(
         'com.quvideo.xiaoying:id/music_item_name')
     try:
         m_list[0].click()
     except Exception:
         sc.logger.info('本地音乐不存在!返回创作中心主界面。')
         for i in range(4):
             time.sleep(1)
             sc.driver.press_keycode(4)
         return True
     sc.driver.find_element_by_id(
         'com.quvideo.xiaoying:id/music_item_play_state').click()
     sc.driver.find_element_by_android_uiautomator('text("添加")').click()
     sc.driver.find_element_by_id(
         'com.quvideo.xiaoying:id/preview_layout_fake').click()
     sc.driver.find_element_by_android_uiautomator('text("存草稿")').click()
     sc.driver.find_element_by_id(
         'com.quvideo.xiaoying:id/xiaoying_com_btn_left').click()
     sc.logger.info('音乐库-使用本地音乐测试完成')
Exemplo n.º 11
0
    def test_preview_recommend(self):
        """音乐库-推荐音乐下载."""
        sc.logger.info('音乐库-推荐音乐下载')
        fun_name = 'test_preview_recommend'
        start_x = self.width // 2
        start_bottom = self.height - self.height // 4

        sc.logger.info('点击添加配乐')
        sc.driver.find_element_by_id(
            'com.quvideo.xiaoying:id/txtview_bgm_name').click()
        sc.logger.info('点击“推荐”tab')
        sc.driver.find_element_by_android_uiautomator('text("推荐")').click()

        # 推荐音乐下载
        while True:
            try:
                sc.driver.find_element_by_android_uiautomator(
                    'text("没有更多了…")').click()
                break
            except NoSuchElementException:
                sc.swipe_by_ratio(start_x, start_bottom, 'up', 0.5, 500)

        el_download = sc.driver.find_element_by_id(
            'com.quvideo.xiaoying:id/music_item_download')
        el_download.click()
        time.sleep(5)
        sc.capture_screen(fun_name, self.img_path)
        sc.logger.info('音乐库-推荐音乐下载测试完成')
Exemplo n.º 12
0
    def test_camera_self(self):
        """拍摄-自拍视频(1:1)."""
        sc.logger.info('拍摄-美颜趣拍(1:1)')
        fun_name = 'test_camera_self'

        time.sleep(1)
        sc.logger.info('点击创作中心主按钮')
        sc.driver.find_element_by_id(
            'com.quvideo.xiaoying:id/img_creation').click()
        sc.logger.info('点击“美颜趣拍”')
        sc.driver.find_element_by_android_uiautomator('text("美颜趣拍")').click()
        sc.logger.info('点击摄像头反转按钮')
        sc.driver.find_element_by_id(
            'com.quvideo.xiaoying:id/img_switch').click()
        sc.capture_screen(fun_name, self.img_path)
        el_capture = sc.driver.find_element_by_id(
            'com.quvideo.xiaoying:id/btn_rec')
        # 点拍5s
        sc.logger.info('点击录制按钮')
        el_capture.click()
        time.sleep(5)
        sc.logger.info('拍摄5s后点击录制按钮停止拍摄')
        el_capture.click()
        sc.logger.info('点击确认按钮')
        sc.driver.find_element_by_id(
            'com.quvideo.xiaoying:id/cam_btn_next').click()
        sc.capture_screen(fun_name, self.img_path)
        sc.logger.info('点击“存草稿”按钮')
        sc.driver.find_element_by_android_uiautomator('text("存草稿")').click()
        sc.logger.info('美颜趣拍测试完成,点击返回按钮返回主页面')
        sc.driver.find_element_by_id(
            'com.quvideo.xiaoying:id/xiaoying_com_btn_left').click()
        sc.logger.info('拍摄-美颜趣拍拍摄完成')
Exemplo n.º 13
0
    def test_settings_senior(self):
        """设置:高级设置和其他."""
        sc.logger.info('设置:高级设置和其他')
        fun_name = 'test_settings_senior'

        sc.driver.find_element_by_android_uiautomator(
            'new UiSelector().text("视频处理硬件加速")').click()
        sc.driver.find_element_by_android_uiautomator(
            'new UiSelector().text("视频保存位置")').click()
        sc.driver.press_keycode(4)
        time.sleep(1)
        sc.driver.find_element_by_android_uiautomator(
            'new UiSelector().text("关于小影")').click()
        sc.driver.find_element_by_id(
            'com.quvideo.xiaoying:id/img_back').click()
        sc.driver.find_element_by_android_uiautomator(
            'new UiSelector().text("评价小影")').click()
        sc.capture_screen(fun_name, self.img_path)
        sc.driver.press_keycode(4)

        time.sleep(1)
        sc.driver.find_element_by_android_uiautomator(
            'new UiSelector().text("铂金会员")').click()
        sc.driver.find_element_by_id(
            'com.quvideo.xiaoying:id/img_back').click()
        sc.driver.find_element_by_android_uiautomator(
            'new UiSelector().text("恢复购买")').click()
        sc.logger.info('设置:高级设置和其他测试完成')
Exemplo n.º 14
0
    def test_edit_music_cancel(self):
        """剪辑-多段配乐-放弃."""
        sc.logger.info('剪辑-多段配乐-放弃')
        fun_name = 'test_camera_music_cancel'

        start_x = self.width // 2
        start_bottom = self.height // 4

        time.sleep(1)
        sc.logger.info('点击创作中心主按钮')
        sc.driver.find_element_by_id('com.quvideo.xiaoying:id/img_creation').click()
        sc.logger.info('点击“更多草稿”')
        sc.driver.find_element_by_android_uiautomator('text("更多草稿")').click()

        sc.logger.info('点击草稿封面')
        el_draft = sc.driver.find_element_by_id('com.quvideo.xiaoying:id/xiaoying_studio_img_project_thumb')
        el_draft.click()
        sc.logger.info('点击“剪辑”')
        sc.driver.find_element_by_android_uiautomator('text("剪辑")').click()

        el_edit_list = sc.driver.find_elements_by_id('com.quvideo.xiaoying:id/title')
        for el_item in el_edit_list:
            if el_item.text == '多段配乐':
                sc.logger.info('开始点击多段配乐')
                el_item.click()
                break

        while True:
            try:
                time.sleep(1)
                sc.driver.find_element_by_id('com.quvideo.xiaoying:id/imgbtn_add_music').click()
                sc.logger.info('点击添加音乐按钮')
                break
            except NoSuchElementException:
                sc.logger.info('当前视频已经有配乐')
                sc.logger.info('删除原有音乐')
                sc.driver.find_element_by_id('com.quvideo.xiaoying:id/imgbtn_speed_close').click()
                sc.logger.info('点击删除按钮')
                sc.driver.find_element_by_id('com.quvideo.xiaoying:id/imgbtn_del_music').click()

        el_download = sc.driver.find_element_by_id('com.quvideo.xiaoying:id/music_item_download')
        el_music_name = sc.driver.find_element_by_id('com.quvideo.xiaoying:id/music_item_name')
        el_download.click()
        time.sleep(5)
        el_music_name.click()
        sc.driver.find_element_by_id('com.quvideo.xiaoying:id/music_item_play_state').click()
        sc.driver.find_element_by_id('com.quvideo.xiaoying:id/music_item_use').click()
        sc.driver.swipe(start_x, start_bottom, start_x, start_bottom, 1000)
        sc.logger.info('点击左上角放弃操作按钮')
        sc.driver.find_element_by_id('com.quvideo.xiaoying:id/xiaoying_com_btn_left').click()
        sc.logger.info('确认放弃操作')
        sc.driver.find_element_by_android_uiautomator('text("确认")').click()
        sc.capture_screen(fun_name, self.img_path)

        sc.logger.info('返回创作中心主界面')
        for i in range(4):
            time.sleep(1)
            sc.driver.press_keycode(4)
        sc.logger.info('剪辑-多段配乐-放弃测试完成')
Exemplo n.º 15
0
    def test_edit_fx(self):
        """剪辑-特效-添加."""
        sc.logger.info('剪辑-特效-添加')
        fun_name = 'test_edit_fx'

        start_x = self.width - self.width // 4
        start_bottom = self.height - self.height // 10

        time.sleep(1)
        sc.logger.info('点击创作中心主按钮')
        sc.driver.find_element_by_id(
            'com.quvideo.xiaoying:id/img_creation').click()
        sc.logger.info('点击“更多草稿”')
        sc.driver.find_element_by_android_uiautomator('text("更多草稿")').click()

        sc.logger.info('点击草稿封面')
        el_draft = sc.driver.find_element_by_id(
            'com.quvideo.xiaoying:id/xiaoying_studio_img_project_thumb')
        el_draft.click()
        sc.logger.info('点击“剪辑”')
        sc.driver.find_element_by_android_uiautomator('text("剪辑")').click()
        time.sleep(1)
        sc.swipe_by_ratio(start_x, start_bottom, 'left', 0.6, 500)

        el_edit_list = sc.driver.find_elements_by_id(
            'com.quvideo.xiaoying:id/title')
        for el_item in el_edit_list:
            if el_item.text == '特效':
                sc.logger.info('开始点击“特效”按钮')
                el_item.click()
                break
        time.sleep(1)
        while True:
            try:
                sc.logger.info('开始点击“FX”按钮')
                sc.driver.find_element_by_id(
                    'com.quvideo.xiaoying:id/imgbtn_add_subtitle').click()
                break
            except NoSuchElementException:
                sc.logger.info('该视频已经有特效,先删除特效')
                sc.logger.info('开始点击特效编辑按钮')
                sc.driver.find_element_by_id(
                    'com.quvideo.xiaoying:id/imgbtn_speed_close').click()
                sc.capture_screen(fun_name, self.img_path)
                sc.logger.info('点击删除特效按钮')
                sc.driver.find_element_by_id(
                    'com.quvideo.xiaoying:id/imgbtn_del_subtitle').click()

        sc.capture_screen(fun_name, self.img_path)
        sc.driver.find_element_by_id(
            'com.quvideo.xiaoying:id/xiaoying_com_btn_right').click()
        sc.driver.find_element_by_id(
            'com.quvideo.xiaoying:id/xiaoying_com_btn_right').click()

        sc.logger.info('返回创作中心主界面')
        for i in range(4):
            time.sleep(1)
            sc.driver.press_keycode(4)
        sc.logger.info('剪辑-特效-添加测试完成')
Exemplo n.º 16
0
    def test_refresh(self):
        """测试下拉刷新"""
        sc.logger.info(u'创作页面下拉刷新测试开始')
        start_x = self.width // 2
        start_y = self.heigh // 8
        result = sc.swipe_by_ratio(start_x, start_y, 'down', 0.6, 600)

        time.sleep(.300)
        sc.capture_screen(inspect.stack()[0][3], sc.path_lists[0])
        assert result is True
Exemplo n.º 17
0
 def test_origin():
     """测试创作页面初始UI状态"""
     sc.logger.info(u'创作页面初始状态检查测试开始')
     time.sleep(2)
     el_home = sc.driver.find_element_by_id(
         'com.quvideo.xiaoying:id/img_creation')
     el_home.click()
     time.sleep(.500)
     sc.capture_screen(inspect.stack()[0][3], sc.path_lists[0])
     assert el_home is not None
Exemplo n.º 18
0
    def test_video_share(self):
        """测试视频的分享功能."""
        sc.logger.info('开始测试视频的分享功能.')
        fun_name = 'test_video_share'

        time.sleep(1)
        sc.capture_screen(fun_name, self.img_path)
        btn_share = 'com.quvideo.xiaoying:id/btn_share'
        sc.driver.find_element_by_id(btn_share).click()
        sc.capture_screen(fun_name, self.img_path)
Exemplo n.º 19
0
    def test_template_filter(self):
        """素材中心-滤镜."""
        sc.logger.info('素材中心-滤镜')
        fun_name = 'test_template_filter'
        start_x = self.width // 2
        start_bottom = self.height - self.height // 5

        time.sleep(1)
        sc.logger.info('点击创作中心主按钮')
        sc.driver.find_element_by_id(
            'com.quvideo.xiaoying:id/img_creation').click()
        sc.logger.info('点击“素材中心”')
        sc.driver.find_element_by_android_uiautomator('text("素材中心")').click()
        try:
            sc.logger.info('点击“滤镜”')
            sc.driver.find_element_by_android_uiautomator('text("滤镜")').click()
        except NoSuchElementException:
            sc.swipe_by_ratio(start_x, start_bottom, 'up', 0.6, 300)
            sc.driver.find_element_by_android_uiautomator('text("滤镜")').click()

        sc.logger.info('开始下载滤镜')
        try:
            el_template_down = sc.driver.find_element_by_id(
                'com.quvideo.xiaoying:id/template_filter_download')
            el_template_down.click()
        except NoSuchElementException:
            sc.logger.info('当前页面所有滤镜已下载完成')

        sc.logger.info('检查滤镜下载是否成功')
        try:
            WebDriverWait(
                sc.driver,
                30).until(lambda use: use.find_element_by_android_uiautomator(
                    'text("使用")'))
        except TimeoutError as t:
            sc.logger.info('滤镜下载超时', t)
            return False
        except Exception as e:
            sc.logger.info('滤镜下载失败', e)
            return False
        sc.logger.info('滤镜下载测试完成')

        self.template_use('滤镜')
        sc.driver.find_element_by_id(
            'com.quvideo.xiaoying:id/xiaoying_com_btn_right').click()
        time.sleep(1)
        sc.driver.find_element_by_android_uiautomator('text("存草稿")').click()
        time.sleep(10)
        sc.capture_screen(fun_name, self.img_path)
        sc.driver.press_keycode(4)
        time.sleep(2)

        sc.logger.info('删除刚刚下载的滤镜')
        sc.capture_screen(fun_name, self.img_path)
        self.theme_manager('滤镜', 'com.quvideo.xiaoying:id/img_delete')
Exemplo n.º 20
0
    def test_collage_album(self):
        """拍摄-画中画拍摄-拍摄."""
        sc.logger.info('拍摄-画中画拍摄-相册视频')
        fun_name = 'test_collage_album'

        sc.logger.info('点击"画中画拍摄"')
        sc.driver.find_element_by_android_uiautomator('text("画中画拍摄")').click()
        sc.logger.info('从相册选择视频')
        sc.driver.find_element_by_id(
            'com.quvideo.xiaoying:id/xiaoying_cam_btn_pip_gallery').click()
        sc.logger.info('点击相册第一个视频')
        sc.driver.find_element_by_id(
            'com.quvideo.xiaoying:id/img_click_mask').click()
        sc.logger.info('点击“添加”按钮')
        sc.driver.find_element_by_id(
            'com.quvideo.xiaoying:id/imgbtn_import').click()

        try:
            WebDriverWait(
                sc.driver,
                60).until(lambda V_improt: V_improt.find_element_by_id(
                    'com.quvideo.xiaoying:id/btn_rec'))
        except TimeoutError as t:
            sc.logger.error('导入视频超时', t)
            return False
        except Exception as e:
            sc.logger.error('导入视频出错', e)
            return False

        sc.logger.info('添加第二段视频')
        el_capture = sc.driver.find_element_by_id(
            'com.quvideo.xiaoying:id/btn_rec')
        # 点拍
        el_capture.click()
        time.sleep(5)
        el_capture.click()
        try:
            WebDriverWait(
                sc.driver,
                300).until(lambda capture: capture.
                           find_element_by_android_uiautomator('text("存草稿")'))
            sc.logger.info('点击"存草稿"按钮')
            sc.driver.find_element_by_android_uiautomator(
                'text("存草稿")').click()
            sc.logger.info('点击左上角返回按钮返回创作中心主页面')
            sc.driver.find_element_by_id(
                'com.quvideo.xiaoying:id/xiaoying_com_btn_left').click()
            sc.capture_screen(fun_name, self.img_path)
            sc.logger.info('拍摄-音乐视频拍摄完成')
        except Exception as e:
            sc.logger.error('拍摄完成跳转预览页异常', e)
            sc.driver.press_keycode(4)
            return False

        sc.logger.info('拍摄-画中画拍摄-相册视频完成')
Exemplo n.º 21
0
    def test_user_follow_home(self):
        """点击关注用户头像进入用户空间测试."""
        sc.logger.info('粉丝空间空间测试')
        fun_name = 'test_user_follow_home'

        time.sleep(.500)
        el_avatar = sc.driver.find_element_by_id('com.quvideo.xiaoying:id/avatar_img')
        el_avatar.click()
        sc.logger.info('点击粉丝头像后,进入粉丝空间截图')
        sc.capture_screen(fun_name, self.img_path)
        sc.driver.press_keycode(4)
        assert el_avatar is not None
Exemplo n.º 22
0
    def test_video_play(self):
        """测试视频的播放."""
        sc.logger.info('测试视频的暂停/播放/进度条')
        fun_name = 'test_video_play'

        time.sleep(1)
        el_video = sc.driver.find_element_by_id(
            'com.quvideo.xiaoying:id/xiaoying_com_activity_videoview')
        el_video.click()

        sc.capture_screen(fun_name, self.img_path)
        assert el_video is not None
Exemplo n.º 23
0
    def test_edit_collage_cancel(self):
        """剪辑-画中画-放弃."""
        sc.logger.info('剪辑-画中画-放弃')
        fun_name = 'test_edit_collage_cancel'

        start_x = self.width // 2
        start_bottom = self.height // 3

        time.sleep(1)
        sc.logger.info('点击创作中心主按钮')
        sc.driver.find_element_by_id(
            'com.quvideo.xiaoying:id/img_creation').click()
        sc.logger.info('点击“更多草稿”')
        sc.driver.find_element_by_android_uiautomator('text("更多草稿")').click()

        sc.logger.info('点击草稿封面')
        el_draft = sc.driver.find_element_by_id(
            'com.quvideo.xiaoying:id/xiaoying_studio_img_project_thumb')
        el_draft.click()
        sc.logger.info('点击“剪辑”')
        sc.driver.find_element_by_android_uiautomator('text("剪辑")').click()
        el_edit_list = sc.driver.find_elements_by_id(
            'com.quvideo.xiaoying:id/title')
        for el_item in el_edit_list:
            if el_item.text == '画中画':
                sc.logger.info('开始点击画中画')
                el_item.click()
                break
        sc.logger.info('开始添加图片')
        sc.driver.find_element_by_id(
            'com.quvideo.xiaoying:id/video_editor_btn_gif_add').click()
        el_pic = sc.driver.find_element_by_id(
            'com.quvideo.xiaoying:id/collage_pic_item_cover')
        sc.logger.info('添加一张图片')
        el_pic.click()

        sc.capture_screen(fun_name, self.img_path)
        sc.logger.info('点击确认按钮')
        sc.driver.find_element_by_id(
            'com.quvideo.xiaoying:id/video_title_right_button').click()
        sc.driver.swipe(start_x, start_bottom, start_x, start_bottom, 1000)
        sc.logger.info('放弃所有操作')
        sc.driver.find_element_by_id(
            'com.quvideo.xiaoying:id/video_title_left_button').click()
        sc.driver.find_element_by_id(
            'com.quvideo.xiaoying:id/video_title_left_button').click()
        sc.driver.find_element_by_android_uiautomator('text("确认")').click()

        sc.logger.info('返回创作中心主界面')
        for i in range(4):
            time.sleep(1)
            sc.driver.press_keycode(4)
        sc.logger.info('剪辑-画中画-放弃测试完成')
Exemplo n.º 24
0
    def test_login_origin(self):
        """测试登录页面未登录时的初始状态."""
        sc.logger.info('登录页面初始状态检查测试开始')
        fun_name = 'test_login_origin'

        time.sleep(2)
        btn_home = 'com.quvideo.xiaoying:id/img_studio'
        el_home = sc.driver.find_element_by_id(btn_home)
        el_home.click()
        time.sleep(.500)
        sc.capture_screen(fun_name, self.img_path)
        assert el_home is not None
Exemplo n.º 25
0
 def test_recommend_user():
     """测试推荐页面的用户."""
     sc.logger.info('推荐页面用户检查开始')
     el_video = sc.driver.find_element_by_id(
         'com.quvideo.xiaoying:id/img_owner_avatar')
     el_video.click()
     time.sleep(1)
     sc.logger.info('小影圈推荐页面点击用户头像进入用户空间截图开始')
     sc.capture_screen(inspect.stack()[0][3], sc.path_lists[0])
     # sc.driver.back()
     sc.logger.info('点击返回键')
     sc.driver.press_keycode(4)
     assert el_video is not None
Exemplo n.º 26
0
 def test_recommend_video():
     """测试推荐页面的视频."""
     sc.logger.info('推荐页面视频检查开始')
     el_video = sc.driver.find_element_by_id(
         'com.quvideo.xiaoying:id/img_video_thumb')
     el_video.click()
     time.sleep(1)
     sc.logger.info('小影圈推荐页面进入视频feed流截图开始')
     sc.capture_screen(inspect.stack()[0][3], sc.path_lists[0])
     # sc.driver.back()
     sc.logger.info('点击返回键')
     sc.driver.press_keycode(4)
     assert el_video is not None
Exemplo n.º 27
0
    def test_settings_recommend(self):
        """设置:推荐小影给好友."""
        sc.logger.info('设置:推荐小影给好友')
        fun_name = 'test_settings_recommend'

        sc.driver.find_element_by_android_uiautomator(
            'new UiSelector().text("推荐小影给好友")').click()
        time.sleep(1)
        sc.capture_screen(fun_name, self.img_path)
        for i in range(3):
            sc.driver.press_keycode(4)
            time.sleep(1)
        sc.logger.info('推荐到微信好友测试完成')
Exemplo n.º 28
0
    def test_collage_edit(self):
        """拍摄-画中画编辑."""
        sc.logger.info('拍摄-画中画编辑')
        fun_name = 'test_collage_edit'

        sc.logger.info('点击"画中画编辑"')
        sc.driver.find_element_by_android_uiautomator('text("画中画编辑")').click()
        sc.logger.info('选择第2个样式')
        el_style_list = sc.driver.find_elements_by_id(
            'com.quvideo.xiaoying:id/xiaoying_imagebtn_style_thumb')
        el_style_list[1].click()
        sc.driver.press_keycode(4)
        sc.capture_screen(fun_name, self.img_path)
Exemplo n.º 29
0
    def test_share_edit(self):
        """分享-编辑视频标题/话题相关."""
        sc.logger.info('分享-编辑视频标题/话题相关')
        fun_name = 'test_share_edit'

        start_x = self.width // 2
        start_bottom = self.height - self.height // 4

        sc.logger.info('添加标题')
        el_title = sc.driver.find_element_by_id(
            'com.quvideo.xiaoying:id/share_video_title_text')
        el_title.clear()
        el_title.send_keys('video title test')

        sc.logger.info('添加话题')
        sc.driver.find_element_by_id(
            'com.quvideo.xiaoying:id/share_btn_add_topic').click()
        sc.swipe_by_ratio(start_x, start_bottom, 'up', 0.5, 500)
        el_tag = sc.driver.find_element_by_id(
            'com.quvideo.xiaoying:id/txtview_tag_name')
        el_tag.click()
        sc.capture_screen(fun_name, self.img_path)

        # 显示位置有点问题,后续再优化
        """ sc.logger.info("显示位置")
        sc.driver.find_element_by_id("com.quvideo.xiaoying:id/txt_locating_tips").click()
        try:
            element = WebDriverWait(dr, 60).until(
                lambda local: local.find_element_by_id("com.quvideo.xiaoying:id/img_back"))
            sc.capture_screen(fun_name, self.img_path)
            loc_list = sc.driver.find_elements_by_id("com.quvideo.xiaoying:id/map_list_item_txt_title")
            for loc in loc_list:
                if loc.text == u'不显示位置':
                    loc.click()
        except TimeoutError as t:
            sc.loggererror("加载位置超时", t)
            return False
        sc.capture_screen(fun_name, self.img_path)
        """

        sc.logger.info('隐私设置')
        sc.driver.find_element_by_id(
            'com.quvideo.xiaoying:id/share_btn_privacy').click()
        sc.driver.find_element_by_id(
            'com.quvideo.xiaoying:id/private_setting_visible_btn').click()
        sc.driver.find_element_by_id(
            'com.quvideo.xiaoying:id/private_setting_candnload_btn').click()
        sc.driver.find_element_by_id(
            'com.quvideo.xiaoying:id/buttonDefaultPositive').click()
        sc.logger.info('导出-导出页编辑测试完成')
Exemplo n.º 30
0
    def test_notify_info(self):
        """测试消息中心通知页."""
        sc.logger.info('开始测试消息中心通知页.')
        fun_name = 'test_notify_info'

        time.sleep(1)
        el_tab_list = sc.driver.find_elements_by_id('com.quvideo.xiaoying:id/text_viewpager_tab')
        for el_tab in el_tab_list:
            if el_tab.text == '通知':
                el_tab.click()
                break
        sc.logger.info('消息中心通知页截图')
        sc.capture_screen(fun_name, self.img_path)
        assert el_tab is not None