コード例 #1
0
ファイル: test_settings.py プロジェクト: Hanlen520/UItest-1
    def test_settings_ui(self):
        """设置:默认值UI遍."""
        sc.logger.info('设置:默认UI遍历')
        fun_name = 'test_settings_ui'

        sc.logger.info('点击个人中心主按钮')
        p_btn = 'com.quvideo.xiaoying:id/img_studio'
        WebDriverWait(
            sc.driver, 10,
            1).until(lambda c_btn: c_btn.find_element_by_id(p_btn)).click()

        sc.logger.info('开始进入个人空间截图')
        sc.capture_screen(fun_name, self.img_path)

        setting_btn = 'com.quvideo.xiaoying:id/btn_setting'
        WebDriverWait(
            sc.driver, 10,
            1).until(lambda el: el.find_element_by_id(setting_btn)).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第一页遍历完成')
コード例 #2
0
    def test_home_minor(self):
        """首页-次要功能位检查."""
        sc.logger.info('首页-次要功能位检查')
        fun_name = 'test_home_minor'

        sc.logger.info('点击创作中心主按钮')
        c_btn = 'com.quvideo.xiaoying:id/img_creation'
        WebDriverWait(
            sc.driver, 10,
            1).until(lambda el: el.find_element_by_id(c_btn)).click()

        sub_icon_btn = 'com.quvideo.xiaoying:id/sub_btn_icon'
        element_list = sc.driver.find_elements_by_id(sub_icon_btn)
        element_list.pop(0)

        for element_em in element_list:
            element_em.click()
            time.sleep(2)
            sc.driver.press_keycode(4)
            sc.capture_screen(fun_name, self.img_path)

        coord_x = element_list[-1].location.get('x')
        coord_y = element_list[-1].location.get('y')
        sc.swipe_by_ratio(coord_x, coord_y, 'left', 0.7, 500)

        sec_list = sc.driver.find_elements_by_id(sub_icon_btn)

        for sec_em in sec_list:
            sec_em.click()
            time.sleep(2)
            sc.driver.press_keycode(4)
            sc.capture_screen(fun_name, self.img_path)

        sc.logger.info('首页-次要功能位检查完毕')
コード例 #3
0
    def test_home_other(self):
        """首页-小影百宝箱及其他."""
        sc.logger.info('首页-推荐位-小影百宝箱及其他')
        fun_name = 'test_home_other'
        start_x = self.width // 2
        start_bottom = self.height - self.height // 5

        time.sleep(1)
        sc.swipe_by_ratio(start_x, start_bottom, 'up', 0.7, 500)

        vip_btn = 'com.quvideo.xiaoying:id/btn_vip'
        WebDriverWait(
            sc.driver, 10,
            1).until(lambda el: el.find_element_by_id(vip_btn)).click()

        back_img = 'com.quvideo.xiaoying:id/vip_home_close'
        WebDriverWait(
            sc.driver, 10,
            1).until(lambda el: el.find_element_by_id(back_img)).click()

        shuffle_btn = 'com.quvideo.xiaoying:id/btn_shuffle'
        WebDriverWait(
            sc.driver, 10,
            1).until(lambda el: el.find_element_by_id(shuffle_btn)).click()

        sc.driver.press_keycode(4)
        img_item = 'com.quvideo.xiaoying:id/creation_item_img'
        WebDriverWait(
            sc.driver, 10,
            1).until(lambda el: el.find_element_by_id(img_item)).click()
        sc.capture_screen(fun_name, self.img_path)

        time.sleep(3)
        sc.driver.press_keycode(4)
        sc.logger.info('首页-推荐位-小影百宝箱及其他检查完毕')
コード例 #4
0
ファイル: test_export.py プロジェクト: Hanlen520/UItest-1
    def test_export_create(self):
        """导出-创建视频."""
        sc.logger.info('导出-创建视频')
        fun_name = 'test_export_create'
        start_x = self.width // 2
        start_bottom = self.height // 3

        sc.logger.info('点击创作中心主按钮')
        c_btn = 'com.quvideo.xiaoying:id/img_creation'
        WebDriverWait(sc.driver, 10, 1).until(
            lambda el: el.find_element_by_id(c_btn)).click()

        sc.logger.info('点击“拍摄”')
        sc.driver.find_element_by_id('com.quvideo.xiaoying:id/icon2').click()

        sc.logger.info('点击录制按钮')
        el_cp = sc.driver.find_element_by_id('com.quvideo.xiaoying:id/btn_rec')

        # 长按拍摄
        sc.logger.info('长按拍摄5s')
        actions = TouchAction(sc.driver)
        actions.long_press(el_cp, None, None, 5000).release().perform()
        sc.capture_screen(fun_name, self.img_path)

        sc.logger.info('点击确认按钮')
        time.sleep(1)
        next_btn = 'com.quvideo.xiaoying:id/cam_btn_next'
        sc.driver.find_element_by_id(next_btn).click()
        sc.capture_screen(fun_name, self.img_path)

        time.sleep(1)
        sc.driver.swipe(start_x, start_bottom, start_x, start_bottom, 1000)

        sc.driver.find_element_by_android_uiautomator('text("保存/上传")').click()
        sc.logger.info('导出-创建视频完成')
コード例 #5
0
ファイル: test_pre_music.py プロジェクト: Hanlen520/UItest-1
    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('点击添加配乐')
        b_btn = 'com.quvideo.xiaoying:id/txtview_bgm_name'
        WebDriverWait(
            sc.driver, 10,
            1).until(lambda c_btn: c_btn.find_element_by_id(b_btn)).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.7, 600)

        sc.logger.info('下载音乐')
        music_item_download = 'com.quvideo.xiaoying:id/music_item_download'
        WebDriverWait(sc.driver, 10, 1).until(
            lambda el: el.find_element_by_id(music_item_download)).click()

        time.sleep(5)
        sc.capture_screen(fun_name, self.img_path)
        sc.logger.info('音乐库-推荐音乐下载测试完成')
コード例 #6
0
ファイル: test_pre_music.py プロジェクト: Hanlen520/UItest-1
    def test_music_create(self):
        """导出-创建视频."""
        sc.logger.info('分享-创建视频')
        fun_name = 'test_music_create'

        sc.logger.info('点击创作中心主按钮')
        c_btn = 'com.quvideo.xiaoying:id/img_creation'
        WebDriverWait(
            sc.driver, 10,
            1).until(lambda el: el.find_element_by_id(c_btn)).click()

        sc.logger.info('点击“拍摄”')
        sc.driver.find_element_by_id('com.quvideo.xiaoying:id/icon2').click()

        el_cp = sc.driver.find_element_by_id('com.quvideo.xiaoying:id/btn_rec')

        # 长按拍摄
        sc.logger.info('长按拍摄5s')
        actions = TouchAction(sc.driver)
        actions.long_press(el_cp, None, None, 5000).release().perform()
        sc.capture_screen(fun_name, self.img_path)

        next_btn = 'com.quvideo.xiaoying:id/cam_btn_next'
        WebDriverWait(
            sc.driver, 10,
            1).until(lambda c_btn: c_btn.find_element_by_id(next_btn)).click()

        WebDriverWait(
            sc.driver, 10,
            1).until(lambda el: el.find_element_by_android_uiautomator(
                'text("存草稿")')).click()

        sc.capture_screen(fun_name, self.img_path)
        sc.logger.info('分享-创建视频完成')
コード例 #7
0
ファイル: test_pre_music.py プロジェクト: Hanlen520/UItest-1
    def test_preview_use(self):
        """音乐库-使用已下载音乐."""
        sc.logger.info('音乐库-使用已下载音乐')
        start_x = self.width // 2
        start_y = self.height // 3
        fun_name = 'test_preview_use'

        sc.logger.info('点击“已下载”tab')
        sc.driver.find_element_by_android_uiautomator('text("已下载")').click()
        sc.capture_screen(fun_name, self.img_path)

        sc.logger.info('添加音乐')
        music_item_name = 'com.quvideo.xiaoying:id/music_item_name'
        WebDriverWait(sc.driver, 10, 1).until(
            lambda el: el.find_element_by_id(music_item_name)).click()

        state_btn = 'com.quvideo.xiaoying:id/music_item_play_state'
        WebDriverWait(
            sc.driver, 10,
            1).until(lambda el: el.find_element_by_id(state_btn)).click()

        sc.logger.info('点击“添加”按钮')
        sc.driver.find_element_by_android_uiautomator('text("添加")').click()

        time.sleep(1)
        sc.driver.swipe(start_x, start_y, start_x, start_y, 1000)
        sc.capture_screen(fun_name, self.img_path)
        sc.logger.info('音乐库-使用已下载音乐测试完成')
コード例 #8
0
ファイル: test_pre_music.py プロジェクト: Hanlen520/UItest-1
    def test_preview_delete(self):
        """音乐库-删除已下载音乐."""
        sc.logger.info('音乐库-删除已下载音乐')
        fun_name = 'test_preview_delete'

        b_btn = 'com.quvideo.xiaoying:id/txtview_bgm_name'
        WebDriverWait(
            sc.driver, 10,
            1).until(lambda c_btn: c_btn.find_element_by_id(b_btn)).click()

        sc.logger.info('点击删除按钮')
        rubbish_icon = 'com.quvideo.xiaoying:id/music_rubbish_icon'
        WebDriverWait(
            sc.driver, 10,
            1).until(lambda el: el.find_element_by_id(rubbish_icon)).click()

        sc.logger.info('依次选择已下载音乐')
        check_item = 'com.quvideo.xiaoying:id/music_item_check_box'
        sc.find_by_ids(check_item, fun_name, self.img_path)

        sc.logger.info('再次点击删除按钮')
        WebDriverWait(
            sc.driver, 10,
            1).until(lambda el: el.find_element_by_id(rubbish_icon)).click()
        sc.capture_screen(fun_name, self.img_path)
        sc.logger.info('音乐库-删除已下载音乐测试完成')
コード例 #9
0
    def test_user_follow_state(self):
        """关注/取消关注测试."""
        sc.logger.info('用户空间关注页面关注状态测试开始')
        fun_name = 'test_fans_follow'

        time.sleep(1)
        btn_follow = 'com.quvideo.xiaoying:id/btn_follow_state'
        el_btn_follow = sc.driver.find_element_by_id(btn_follow)
        if el_btn_follow.text == '已关注':
            sc.logger.info('点击第一个已关注状态按钮')
            el_btn_follow.click()

            pos_btn = 'com.quvideo.xiaoying:id/buttonDefaultPositive'
            WebDriverWait(
                sc.driver, 10,
                1).until(lambda el: el.find_element_by_id(pos_btn)).click()

            sc.logger.info('第一次取消点击后,关注状态截图')
            sc.capture_screen(fun_name, self.img_path)
        else:
            sc.logger.info('点击第一个关注状态按钮')
            el_btn_follow.click()
            sc.logger.info('第一次点击关注后,关注状态截图')
            sc.capture_screen(fun_name, self.img_path)
        assert el_btn_follow is not None
コード例 #10
0
ファイル: test_search.py プロジェクト: Hanlen520/UItest-1
    def test_search_follow(self):
        """小影圈搜索结果中的关注测试,为了简化流程,请与上一条连起来用."""
        sc.logger.info('小影圈搜索结果,关注测试开始')
        fun_name = 'test_search_follow'
        start_x = self.width // 4
        start_bottom = self.heigh // 2

        # 查找用户关注按钮
        time.sleep(1)
        sc.logger.info('开始查找搜索结果用户页面中的第一个用户关注按钮')
        sc.swipe_by_ratio(start_x, start_bottom, 'up', 0.3, 500)

        WebDriverWait(
            sc.driver, 10,
            1).until(lambda el: el.find_element_by_android_uiautomator(
                'text("关注")')).click()

        WebDriverWait(
            sc.driver, 10,
            1).until(lambda el: el.find_element_by_android_uiautomator(
                'text("已关注")')).click()

        sc.logger.info('小影圈搜索结果,用户页面关注情况截图')
        sc.capture_screen(fun_name, self.img_path)

        # 取消关注
        sc.logger.info('开始取消关注')

        pos_btn = 'com.quvideo.xiaoying:id/buttonDefaultPositive'
        WebDriverWait(
            sc.driver, 10,
            1).until(lambda el: el.find_element_by_id(pos_btn)).click()

        sc.logger.info('小影圈搜索结果,用户页面取消关注后情况截图')
        sc.capture_screen(fun_name, self.img_path)
コード例 #11
0
ファイル: test_export.py プロジェクト: Hanlen520/UItest-1
    def test_export_first(self):
        """导出-保存到相册-480P-首次导出."""
        sc.logger.info('导出-保存到相册-480P-首次导出')
        fun_name = 'test_export_first'

        sc.logger.info('点击“保存到相册”')
        export_btn = 'com.quvideo.xiaoying:id/btn_export'
        WebDriverWait(sc.driver, 10, 1).until(
            lambda el: el.find_element_by_id(export_btn)).click()
        # sc.driver.find_element_by_id('com.quvideo.xiaoying:id/btn_export').click()

        try:
            pos_btn = 'com.quvideo.xiaoying:id/buttonDefaultPositive'
            WebDriverWait(sc.driver, 5, 1).until(
                lambda el: el.find_element_by_id(pos_btn)).click()
            TestCreationExport.hardware_acceleration()

            WebDriverWait(sc.driver, 10, 1).until(
                lambda el: el.find_element_by_id(export_btn)).click()
        except TimeoutException:
            sc.logger.info('无需设置硬件加速')

        sc.logger.info('点击“480P 清晰”')
        limit_btn = 'com.quvideo.xiaoying:id/normal_layout'
        WebDriverWait(sc.driver, 5, 1).until(
            lambda el: el.find_element_by_id(limit_btn)).click()
        try:
            WebDriverWait(sc.driver, 20).until(
                lambda x: x.find_element_by_android_uiautomator('text("工作室")'))
            sc.capture_screen(fun_name, self.img_path)
        except TimeoutException:
            sc.driver.press_keycode(4)
        time.sleep(1)
        sc.driver.press_keycode(4)
        sc.logger.info('导出-保存到相册-480P-首次导出测试完成')
コード例 #12
0
ファイル: test_clip_add.py プロジェクト: Hanlen520/UItest-1
    def test_edit_clips_shot(self):
        """剪辑-添加镜头-拍摄添加."""
        sc.logger.info('剪辑-添加镜头-拍摄添加')
        fun_name = 'test_edit_clips_shot'

        sc.logger.info('点击创作中心主按钮')
        c_btn = 'com.quvideo.xiaoying:id/img_creation'
        WebDriverWait(sc.driver, 10, 1).until(
            lambda el: el.find_element_by_id(c_btn)).click()

        sc.logger.info('点击“更多草稿”')
        sc.driver.find_element_by_android_uiautomator('text("更多草稿")').click()

        sc.logger.info('点击草稿封面')
        draft_img = 'com.quvideo.xiaoying:id/xiaoying_studio_img_project_thumb'
        WebDriverWait(sc.driver, 10, 1).until(
            lambda el: el.find_element_by_id(draft_img)).click()

        sc.logger.info('尝试点击“编辑该视频”')
        edit_btn = 'com.quvideo.xiaoying:id/edit_this_video_text'
        try:
            WebDriverWait(sc.driver, 5, 1).until(
                lambda el: el.find_element_by_id(edit_btn)).click()
        except TimeoutException:
            sc.logger.info('该视频已经在编辑页,跳过此步骤')

        sc.logger.info('点击“镜头编辑”')
        WebDriverWait(sc.driver, 10, 1).until(
            lambda c_btn: c_btn.find_element_by_android_uiautomator(
                'text("镜头编辑")')).click()

        sc.logger.info('点击添加镜头的加号标识')
        clip_add_btn = 'com.quvideo.xiaoying:id/clipedit_add_btn'
        WebDriverWait(sc.driver, 10, 1).until(
            lambda el: el.find_element_by_id(clip_add_btn)).click()

        camera_btn = 'com.quvideo.xiaoying:id/layout_move_camera'
        WebDriverWait(sc.driver, 10, 1).until(
            lambda el: el.find_element_by_id(camera_btn)).click()

        rec_btn = 'com.quvideo.xiaoying:id/btn_rec'
        el_cp = WebDriverWait(sc.driver, 10, 1).until(
            lambda el: el.find_element_by_id(rec_btn))
        # 长按拍摄
        sc.logger.info('长按拍摄5s')
        actions = TouchAction(sc.driver)
        actions.long_press(el_cp, None, None, 5000).release().perform()
        sc.capture_screen(fun_name, self.img_path)

        sc.logger.info('点击确认键')
        next_btn = 'com.quvideo.xiaoying:id/cam_btn_next'
        sc.driver.find_element_by_id(next_btn).click()
        sc.capture_screen(fun_name, self.img_path)

        sc.logger.info('返回创作中心主界面')
        for i in range(2):
            time.sleep(1)
            sc.driver.press_keycode(4)
        sc.logger.info('剪辑-添加镜头-拍摄添加测试完成')
コード例 #13
0
ファイル: test_export.py プロジェクト: Hanlen520/UItest-1
    def test_export_gif(self):
        """导出-保存到相册-GIF."""
        sc.logger.info('导出-保存到相册-GIF')
        fun_name = 'test_export_gif'

        sc.logger.info('点击“更多草稿”')
        WebDriverWait(sc.driver, 10, 1).until(
            lambda el: el.find_element_by_android_uiautomator(
                'text("更多草稿")')).click()

        sc.logger.info('点击第一个草稿封面')
        draft_img = 'com.quvideo.xiaoying:id/xiaoying_studio_img_project_thumb'
        WebDriverWait(sc.driver, 10, 1).until(
            lambda el: el.find_element_by_id(draft_img)).click()

        sc.logger.info('点击“保存/上传”')
        sc.driver.find_element_by_android_uiautomator('text("保存/上传")').click()

        sc.logger.info('点击“保存到相册”')
        export_btn = 'com.quvideo.xiaoying:id/btn_export'
        WebDriverWait(sc.driver, 10, 1).until(
            lambda c_btn: c_btn.find_element_by_id(export_btn)).click()

        try:
            sc.logger.info('点击“GIF”')
            gif_title = 'com.quvideo.xiaoying:id/gif_layout'
            WebDriverWait(sc.driver, 10, 1).until(
                lambda el: el.find_element_by_id(gif_title)).click()
        except NoSuchElementException:
            sc.logger.info('当前版本不支持GIF导出')
            return True

        sc.logger.info('点击“导出”按钮')
        share_btn = 'com.quvideo.xiaoying:id/share_btn_share'
        WebDriverWait(sc.driver, 10, 1).until(
                lambda el: el.find_element_by_id(share_btn)).click()
        try:
            WebDriverWait(sc.driver, 20).until(
                lambda x: x.find_element_by_android_uiautomator('text("工作室")'))
            sc.capture_screen(fun_name, self.img_path)

            left_btn = 'com.quvideo.xiaoying:id/xiaoying_com_btn_left'
            WebDriverWait(sc.driver, 10, 1).until(
                lambda el: el.find_element_by_id(left_btn)).click()
        except TimeoutError as t:
            sc.logger.error('导出GIF超时', t)
            sc.driver.press_keycode(4)
            sc.capture_screen(fun_name, self.img_path)

            pos_btn = 'com.quvideo.xiaoying:id/buttonDefaultPositive'
            WebDriverWait(sc.driver, 10, 1).until(
                lambda el: el.find_element_by_id(pos_btn)).click()
            sc.logger.info('返回创作中心主界面')
            for i in range(4):
                time.sleep(1)
                sc.driver.press_keycode(4)
            return False
        sc.logger.info('导出-保存到相册-GIF测试完成')
コード例 #14
0
    def test_create_craft(self):
        """创建一个草稿视频."""
        sc.logger.info('创建一个草稿视频')
        fun_name = 'test_create_craft'
        sc.logger.info('点击创作中心主按钮')
        c_btn = 'com.quvideo.xiaoying:id/img_creation'
        WebDriverWait(
            sc.driver, 10,
            1).until(lambda el: el.find_element_by_id(c_btn)).click()

        sc.logger.info('点击“剪辑”按钮')
        editor_btn = 'com.quvideo.xiaoying:id/btn1'
        WebDriverWait(
            sc.driver, 10,
            1).until(lambda el: el.find_element_by_id(editor_btn)).click()

        mask_img = 'com.quvideo.xiaoying:id/btn_item_status'
        el_video_list = sc.driver.find_elements_by_id(mask_img)
        if len(el_video_list) >= 2:
            el_video_list = el_video_list[:2]
        for i in range(2):
            el_video_list[i].click()

        sc.logger.info('点击“视频”按钮')
        type_btn = 'com.quvideo.xiaoying:id/gallery_type'
        WebDriverWait(
            sc.driver, 10,
            1).until(lambda c_btn: c_btn.find_element_by_id(type_btn)).click()
        sc.logger.info('点击“图片”按钮')
        img_type_btn = 'com.quvideo.xiaoying:id/xiaoying_gallery_photo_tab'
        WebDriverWait(sc.driver, 10, 1).until(
            lambda c_btn: c_btn.find_element_by_id(img_type_btn)).click()

        el_img_list = sc.driver.find_elements_by_id(mask_img)
        if len(el_img_list) >= 2:
            el_img_list = el_img_list[:2]

        for el_img_list in el_img_list:
            el_img_list.click()
            time.sleep(1)
            sc.capture_screen(fun_name, self.img_path)

        sc.logger.info('点击“下一步”按钮')
        import_n_btn = 'com.quvideo.xiaoying:id/tv_next'
        WebDriverWait(
            sc.driver, 10,
            1).until(lambda el: el.find_element_by_id(import_n_btn)).click()

        sc.logger.info('点击“存草稿”按钮')
        draft_btn = 'com.quvideo.xiaoying:id/editor_draft'
        WebDriverWait(
            sc.driver, 10,
            1).until(lambda el: el.find_element_by_id(draft_btn)).click()

        sc.logger.info('返回创作中心主界面')
        sc.driver.press_keycode(4)
        sc.logger.info('创建一个草稿视频完成')
コード例 #15
0
ファイル: test_theme.py プロジェクト: Hanlen520/UItest-1
    def test_theme_download(self):
        """预览页-主题下载."""
        sc.logger.info('预览页-主题下载')
        fun_name = 'test_theme_download'
        start_x = self.width // 4
        start_bottom = self.height - self.height // 10
        start_y = self.height // 3

        time.sleep(1)
        sc.swipe_by_ratio(start_x, start_bottom, 'right', 0.5, 500)

        sc.logger.info('点击“下载更多”')
        thumb_bg = 'com.quvideo.xiaoying:id/imgview_get_more_thumbnail_bg'
        WebDriverWait(sc.driver, 10, 1).until(
            lambda el: el.find_element_by_id(thumb_bg)).click()

        try:
            sc.logger.info('点击“使用”按钮')
            u_btn = 'com.quvideo.xiaoying:id/template_caption_grid_btn_update'
            WebDriverWait(sc.driver, 10, 1).until(
                lambda el: el.find_element_by_id(u_btn)).click()
            time.sleep(1)
            sc.driver.swipe(start_x, start_y, start_x, start_y, 1000)
        except TimeoutException:
            sc.logger.info('点击下载按钮')
            sc.capture_screen(fun_name, self.img_path)
            down_btn = 'com.quvideo.xiaoying:id/imgbtn_download'
            WebDriverWait(sc.driver, 10, 1).until(
                lambda el: el.find_element_by_id(down_btn)).click()

            try:
                WebDriverWait(sc.driver, 30).until(
                    lambda el: el.find_element_by_android_uiautomator(
                        'text("使用")')).click()
                time.sleep(1)
                sc.driver.swipe(start_x, start_y, start_x, start_y, 1000)
            except TimeoutError as t:
                sc.logger.error('素材下载超时', t)
                sc.logger.info('返回创作中心主界面')
                for i in range(4):
                    time.sleep(1)
                    sc.driver.press_keycode(4)
                return False
            except Exception as e:
                sc.logger.info('返回创作中心主界面')
                for i in range(4):
                    time.sleep(1)
                    sc.driver.press_keycode(4)
                sc.logger.error('素材下载失败', e)
                return False

        sc.logger.info('返回创作中心主界面')
        for i in range(3):
            time.sleep(1)
            sc.driver.press_keycode(4)
        sc.logger.info('预览页-主题测试完成')
コード例 #16
0
ファイル: test_videos.py プロジェクト: Hanlen520/UItest-1
    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)
コード例 #17
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')
コード例 #18
0
    def test_refresh(self):
        """测试下拉刷新"""
        sc.logger.info('创作页面下拉刷新测试开始')
        fun_name = 'test_refresh'
        start_x = self.width // 2
        start_y = self.height // 8
        result = sc.swipe_by_ratio(start_x, start_y, 'down', 0.6, 600)

        time.sleep(1)
        sc.capture_screen(fun_name, self.img_path)
        assert result is True
コード例 #19
0
ファイル: test_export.py プロジェクト: Hanlen520/UItest-1
    def test_export_second(self):
        """导出-保存到相册-720P-二次导出."""
        sc.logger.info('导出-保存到相册-720P-二次导出')
        fun_name = 'test_export_second'

        sc.logger.info('点击“更多草稿”')
        WebDriverWait(sc.driver, 10, 1).until(
            lambda el: el.find_element_by_android_uiautomator(
                'text("更多草稿")')).click()
        # sc.driver.find_element_by_android_uiautomator('text("更多草稿")').click()
        sc.logger.info('点击第一个草稿封面')
        draft_img = 'com.quvideo.xiaoying:id/xiaoying_studio_img_project_thumb'
        WebDriverWait(sc.driver, 10, 1).until(
            lambda el: el.find_element_by_id(draft_img)).click()

        sc.logger.info('点击“保存/上传”')
        sc.driver.find_element_by_android_uiautomator('text("保存/上传")').click()

        sc.logger.info('点击“保存到相册”')
        export_btn = 'com.quvideo.xiaoying:id/btn_export'
        WebDriverWait(sc.driver, 10, 1).until(
            lambda c_btn: c_btn.find_element_by_id(export_btn)).click()
        try:
            hd_title = 'com.quvideo.xiaoying:id/purchase_hd_title'
            sc.driver.find_element_by_id(hd_title).click()
            TestCreationExport.restore_purchase()

            WebDriverWait(sc.driver, 10, 1).until(
                lambda c_btn: c_btn.find_element_by_id(export_btn)).click()
            sc.driver.find_element_by_id(hd_title).click()
        except NoSuchElementException:
            sc.logger.info('当前设备不支持720P导出')
            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 x: x.find_element_by_android_uiautomator('text("工作室")'))
            sc.capture_screen(fun_name, self.img_path)

            sc.driver.press_keycode(4)
            time.sleep(1)
            sc.driver.press_keycode(4)
        except NoSuchElementException:
            sc.driver.find_element_by_android_uiautomator('text("分享小影")')
            sc.capture_screen(fun_name, self.img_path)
            sc.driver.press_keycode(4)
        except TimeoutError as t:
            sc.logger.error('导出视频超时', t)
            return False
        sc.logger.info('导出-保存到相册-720P-二次导出测试完成')
コード例 #20
0
    def test_notify_info(self):
        """测试消息中心通知页."""
        sc.logger.info('开始测试消息中心通知页.')
        fun_name = 'test_notify_info'
        start_x = self.width - self.width // 8
        start_y = self.height // 2

        time.sleep(1)
        sc.swipe_by_ratio(start_x, start_y, 'left', 0.7, 500)
        sc.logger.info('消息中心通知页截图')
        sc.capture_screen(fun_name, self.img_path)
コード例 #21
0
ファイル: test_videos.py プロジェクト: Hanlen520/UItest-1
    def test_video_play(self):
        """测试视频的播放."""
        sc.logger.info('测试视频的暂停/播放/进度条')
        fun_name = 'test_video_play'

        time.sleep(1)
        el_view = 'com.quvideo.xiaoying:id/xiaoying_com_activity_videoview'
        WebDriverWait(
            sc.driver, 10,
            1).until(lambda el: el.find_element_by_id(el_view)).click()
        sc.capture_screen(fun_name, self.img_path)
コード例 #22
0
ファイル: un_test_login.py プロジェクト: Hanlen520/UItest-1
    def test_login_origin(self):
        """测试登录页面未登录时的初始状态."""
        sc.logger.info('登录页面初始状态检查测试开始')
        fun_name = 'test_login_origin'

        sc.logger.info('点击个人中心主按钮')
        if sc.first_step(self.p_btn) is True:
            time.sleep(1)
            sc.capture_screen(fun_name, self.img_path)
            assert True
        else:
            assert False
コード例 #23
0
    def test_origin(self):
        """测试创作页面初始UI状态"""
        sc.logger.info('创作页面初始状态检查测试开始')
        fun_name = 'test_origin'

        sc.logger.info('点击创作中心主按钮')
        c_btn = 'com.quvideo.xiaoying:id/img_creation'
        WebDriverWait(
            sc.driver, 10,
            1).until(lambda el: el.find_element_by_id(c_btn)).click()

        sc.capture_screen(fun_name, self.img_path)
コード例 #24
0
ファイル: test_collage.py プロジェクト: Hanlen520/UItest-1
    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('从相册选择视频')
        gallery_btn = 'com.quvideo.xiaoying:id/xiaoying_cam_btn_pip_gallery'
        sc.driver.find_element_by_id(gallery_btn).click()

        sc.logger.info('点击相册第一个视频')
        mask_btn = 'com.quvideo.xiaoying:id/btn_item_status'
        WebDriverWait(sc.driver, 10, 1).until(
            lambda el: el.find_element_by_id(mask_btn)).click()
        sc.logger.info('点击“添加”按钮')
        import_btn = 'com.quvideo.xiaoying:id/tv_next'
        WebDriverWait(sc.driver, 10, 1).until(
            lambda el: el.find_element_by_id(import_btn)).click()

        rec_btn = 'com.quvideo.xiaoying:id/btn_rec'
        try:
            el_capture = WebDriverWait(sc.driver, 60).until(
                lambda V_improt: V_improt.find_element_by_id(rec_btn))
        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.click()
        try:
            WebDriverWait(sc.driver, 60).until(
                lambda x: x.find_element_by_android_uiautomator('text("存草稿")'))
            sc.logger.info('点击"存草稿"按钮')
            sc.driver.find_element_by_android_uiautomator(
                'text("存草稿")').click()

            sc.logger.info('点击左上角返回按钮返回创作中心主页面')
            left_btn = 'com.quvideo.xiaoying:id/xiaoying_com_btn_left'
            sc.driver.find_element_by_id(left_btn).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('拍摄-画中画拍摄-相册视频完成')
コード例 #25
0
    def test_user_follow_home(self):
        """点击关注用户头像进入用户空间测试."""
        sc.logger.info('粉丝空间空间测试')
        fun_name = 'test_user_follow_home'

        avatar_img = 'com.quvideo.xiaoying:id/avatar_img'
        WebDriverWait(
            sc.driver, 10,
            1).until(lambda el: el.find_element_by_id(avatar_img)).click()

        sc.logger.info('点击粉丝头像后,进入粉丝空间截图')
        sc.capture_screen(fun_name, self.img_path)
        sc.driver.press_keycode(4)
コード例 #26
0
    def test_planet_page(self):
        """小影圈推荐页面初始状态测试."""
        sc.logger.info('小影圈推荐页面初始状态检查开始')
        fun_name = 'test_planet_page'

        sc.logger.info('点击小影圈主按钮')
        p_btn = 'com.quvideo.xiaoying:id/img_find'
        WebDriverWait(
            sc.driver, 10,
            1).until(lambda el: el.find_element_by_id(p_btn)).click()

        sc.logger.info('小影圈推荐页面初始状态截图开始')
        sc.capture_screen(fun_name, self.img_path)
コード例 #27
0
ファイル: test_publish.py プロジェクト: Hanlen520/UItest-1
    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('添加标题')
        text_input = 'com.quvideo.xiaoying:id/share_video_title_text'
        el_title = WebDriverWait(
            sc.driver, 10,
            1).until(lambda el: el.find_element_by_id(text_input))
        el_title.clear()
        el_title.send_keys('video title test')

        sc.logger.info('添加话题')
        topic_btn = 'com.quvideo.xiaoying:id/share_btn_add_topic'
        WebDriverWait(
            sc.driver, 10,
            1).until(lambda el: el.find_element_by_id(topic_btn)).click()

        time.sleep(1)
        sc.swipe_by_ratio(start_x, start_bottom, 'up', 0.5, 500)

        name_tag = 'com.quvideo.xiaoying:id/txtview_tag_name'
        WebDriverWait(
            sc.driver, 10,
            1).until(lambda el: el.find_element_by_id(name_tag)).click()
        sc.capture_screen(fun_name, self.img_path)

        sc.logger.info('隐私设置')
        privacy_btn = 'com.quvideo.xiaoying:id/share_btn_privacy'
        WebDriverWait(
            sc.driver, 10,
            1).until(lambda el: el.find_element_by_id(privacy_btn)).click()

        vis_btn = 'com.quvideo.xiaoying:id/private_setting_visible_btn'
        WebDriverWait(
            sc.driver, 10,
            1).until(lambda el: el.find_element_by_id(vis_btn)).click()

        down_btn = 'com.quvideo.xiaoying:id/private_setting_candnload_btn'
        WebDriverWait(
            sc.driver, 10,
            1).until(lambda el: el.find_element_by_id(down_btn)).click()

        pos_btn = 'com.quvideo.xiaoying:id/buttonDefaultPositive'
        WebDriverWait(
            sc.driver, 10,
            1).until(lambda el: el.find_element_by_id(pos_btn)).click()
        sc.logger.info('导出-导出页编辑测试完成')
コード例 #28
0
ファイル: test_collage.py プロジェクト: Hanlen520/UItest-1
    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个样式')
        style_btn = 'com.quvideo.xiaoying:id/xiaoying_imagebtn_style_thumb'
        el_style_list = sc.driver.find_elements_by_id(style_btn)
        el_style_list[1].click()
        sc.capture_screen(fun_name, self.img_path)
        sc.driver.press_keycode(4)
コード例 #29
0
    def test_home_studio(self):
        """首页-我的工作室."""
        sc.logger.info('首页-我的工作室')
        fun_name = 'test_home_studio'
        start_x = self.width // 2
        start_bottom = self.height // 5

        sc.logger.info('下滑一点')
        time.sleep(1)
        sc.swipe_by_ratio(start_x, start_bottom, 'down', 0.7, 700)

        sc.capture_screen(fun_name, self.img_path)
        WebDriverWait(
            sc.driver, 10,
            1).until(lambda el: el.find_element_by_android_uiautomator(
                'text("更多草稿")')).click()

        sc.logger.info('点击第一个草稿封面')
        draft_img = 'com.quvideo.xiaoying:id/xiaoying_studio_img_project_thumb'
        sc.driver.find_element_by_id(draft_img).click()

        time.sleep(1)
        try:
            sc.logger.info('点击左上角返回')
            left_btn = 'com.quvideo.xiaoying:id/xiaoying_com_btn_left'
            WebDriverWait(
                sc.driver, 10,
                1).until(lambda el: el.find_element_by_id(left_btn)).click()
            sc.capture_screen(fun_name, self.img_path)
        except NoSuchElementException:
            sc.logger.info('此草稿视频为拍摄视频,返回的是拍摄页面')
            cancel_btn = 'com.quvideo.xiaoying:id/cam_btn_cancel'
            sc.driver.find_element_by_id(cancel_btn).click()
            sc.capture_screen(fun_name, self.img_path)

        sc.driver.press_keycode(4)

        sc.logger.info('点击“保存/上传”')
        publish_btn = 'com.quvideo.xiaoying:id/xiaoying_studio_publish_btn'
        WebDriverWait(
            sc.driver, 10,
            1).until(lambda el: el.find_element_by_id(publish_btn)).click()
        sc.capture_screen(fun_name, self.img_path)

        sc.logger.info('点击左上角返回')
        back_img = 'com.quvideo.xiaoying:id/img_back'
        WebDriverWait(
            sc.driver, 10,
            1).until(lambda el: el.find_element_by_id(back_img)).click()

        sc.logger.info('删除一个草稿')
        del_img = 'com.quvideo.xiaoying:id/xiaoying_studio_img_delete'
        WebDriverWait(
            sc.driver, 5,
            1).until(lambda el: el.find_element_by_id(del_img)).click()

        sc.driver.find_element_by_android_uiautomator('text("确认")').click()
        sc.driver.press_keycode(4)
        sc.logger.info('首页-我的工作室完成')
コード例 #30
0
    def test_notify_message(self):
        """测试消息中心动态."""
        sc.logger.info('开始测试消息中心私信.')
        fun_name = 'test_notify_message'
        start_x = self.width - self.width // 8
        start_y = self.height // 2

        time.sleep(1)
        sc.swipe_by_ratio(start_x, start_y, 'left', 0.7, 500)

        sc.logger.info('消息中心私信页截图')
        sc.capture_screen(fun_name, self.img_path)

        sc.logger.info('通知中心测试完成,返回主页')
        sc.driver.press_keycode(4)