def test_clips_add_01(self): """剪辑-添加镜头-相册添加.""" sc.logger.info('剪辑-添加镜头-相册添加') fun_name = 'test_edit_add_clips' sc.logger.info('打开一个草稿视频') ba.home_first_click('更多草稿') sc.logger.info('点击草稿封面') ba.open_draft(iOS_elements.el_studio_draft) sc.capture_screen(fun_name, self.img_path) sc.logger.info('点击“镜头编辑”') WebDriverWait( sc.driver, 5, 1).until(lambda x: x.find_element_by_name("镜头编辑")).click() sc.capture_screen(fun_name, self.img_path) sc.logger.info('从相册添加') ba.clip_add('相册') sc.capture_screen(fun_name, self.img_path) sc.logger.info('退出预览页') WebDriverWait(sc.driver, 5, 1).until(lambda x: x.find_element_by_xpath( iOS_elements.el_pre_clo)).click() sc.logger.info('剪辑-添加镜头-相册添加测试完成')
def test_edit_collage_01_img(self): """剪辑-画中画-图片添加.""" sc.logger.info('剪辑-画中画-图片添加') fun_name = 'test_edit_collage_img' sc.logger.info('打开一个草稿视频') ba.home_first_click('更多草稿') sc.logger.info('点击草稿封面') ba.open_draft(iOS_elements.el_studio_draft) sc.capture_screen(fun_name, self.img_path) sc.logger.info('点击“效果”') WebDriverWait(sc.driver, 5, 1).until( lambda x: x.find_element_by_name("效果")).click() sc.capture_screen(fun_name, self.img_path) sc.logger.info('点击"画中画"') WebDriverWait(sc.driver, 5, 1).until( lambda x: x.find_element_by_name('画中画')).click() sc.capture_screen(fun_name, self.img_path) sc.logger.info('添加图片画中画') ba.collage_add('图片') sc.capture_screen(fun_name, self.img_path) sc.logger.info('确认添加') ba.effect_add_confirm() sc.logger.info('剪辑-画中画-图片添加测试完成')
def test_preview_theme(self): """预览页-主题页面.""" sc.logger.info('预览页-主题页面') fun_name = 'test_preview_theme' sc.logger.info('打开一个草稿视频') ba.home_first_click('更多草稿') sc.logger.info('点击草稿封面') ba.open_draft(iOS_elements.el_studio_draft) sc.capture_screen(fun_name, self.img_path) sc.logger.info('点击“主题”') WebDriverWait(sc.driver, 5, 1).until(lambda x: x.find_element_by_name("主题")).click() sc.capture_screen(fun_name, self.img_path) sc.logger.info('使用“主题”') try: WebDriverWait(sc.driver, 3, 1).until(lambda x: x.find_element_by_xpath( iOS_elements.el_theme_use)).click() except TimeoutException: sc.logger.info('当前页面无已下载的主题') WebDriverWait(sc.driver, 10, 1).until(lambda x: x.find_element_by_xpath( iOS_elements.el_theme_download)).click() sc.capture_screen(fun_name, self.img_path) sc.logger.info('点击“存草稿”按钮') WebDriverWait( sc.driver, 5, 1).until(lambda el: el.find_element_by_name("存草稿")).click() sc.logger.info('预览页-主题测试完成')
def test_edit_music_02(self): """剪辑-多段配乐-删除.""" sc.logger.info('剪辑-多段配乐-删除') fun_name = 'test_camera_music_del' sc.logger.info('点击草稿封面') try: ba.open_draft(iOS_elements.el_studio_draft) sc.capture_screen(fun_name, self.img_path) except: sc.logger.info('关闭广告') WebDriverWait(sc.driver, 5, 1).until( lambda el: el.find_element_by_name(iOS_elements.btn_ad_clo)).click() ba.open_draft(iOS_elements.el_studio_draft) sc.capture_screen(fun_name, self.img_path) sc.logger.info('点击“效果”') WebDriverWait(sc.driver, 5, 1).until( lambda x: x.find_element_by_name("效果")).click() sc.capture_screen(fun_name, self.img_path) sc.logger.info('点击"多段配乐"') WebDriverWait(sc.driver, 5, 1).until( lambda x: x.find_element_by_name('多段配乐')).click() sc.capture_screen(fun_name, self.img_path) sc.logger.info('当前视频已经有配乐,删除原有音乐') sc.driver.find_element_by_name('删除').click() sc.capture_screen(fun_name, self.img_path) sc.logger.info('确定') WebDriverWait(sc.driver, 5, 1).until( lambda x: x.find_element_by_name(iOS_elements.el_confirm_btn)).click() sc.logger.info('剪辑-多段配乐-删除测试完成')
def test_edit_music_01(self): """剪辑-多段配乐-添加.""" sc.logger.info('剪辑-多段配乐-添加') fun_name = 'test_music_add' sc.logger.info('打开一个草稿视频') ba.home_first_click('更多草稿') sc.logger.info('点击草稿封面') ba.open_draft(iOS_elements.el_studio_draft) sc.capture_screen(fun_name, self.img_path) sc.logger.info('点击“效果”') WebDriverWait(sc.driver, 5, 1).until( lambda x: x.find_element_by_name("效果")).click() sc.capture_screen(fun_name, self.img_path) sc.logger.info("添加一段'配乐'") ba.effects_music() sc.capture_screen(fun_name, self.img_path) sc.logger.info('确认添加') ba.effect_add_confirm() sc.capture_screen(fun_name, self.img_path) sc.logger.info('点击“存草稿”按钮') WebDriverWait(sc.driver, 5, 1).until( lambda el: el.find_element_by_name("存草稿")).click() sc.logger.info('剪辑-多段配乐-添加测试完成')
def test_edit_proportion(self): '''剪辑-比例&多选.''' sc.logger.info('剪辑-比例') fun_name = 'test_edit_proportion' sc.logger.info('打开一个草稿视频') ba.home_first_click('更多草稿') sc.logger.info('点击草稿封面') ba.open_draft(iOS_elements.el_studio_draft) sc.capture_screen(fun_name, self.img_path) sc.logger.info('点击“镜头编辑”') WebDriverWait( sc.driver, 5, 1).until(lambda x: x.find_element_by_name("镜头编辑")).click() sc.capture_screen(fun_name, self.img_path) sc.logger.info('点击"比例"') WebDriverWait(sc.driver, 5, 1).until(lambda x: x.find_element_by_name("比例")).click() sc.capture_screen(fun_name, self.img_path) sc.logger.info('切换到"比例tab"') try: WebDriverWait(sc.driver, 5, 1).until(lambda x: x.find_element_by_name( iOS_elements.btn_bg_pro)).click() sc.capture_screen(fun_name, self.img_path) except TimeoutException: sc.logger.info('已经在"比例tab"') sc.logger.info('选择"1:1 比例"') el_proportion = "vivavideo_edit_icon_proportion_1_1" ba.clip_proportion(el_proportion) sc.capture_screen(fun_name, self.img_path) sc.logger.info('进入多选') try: WebDriverWait( sc.driver, 5, 1).until(lambda x: x.find_element_by_xpath( '//XCUIElementTypeStaticText[@name="点击多选"]')).click() sc.capture_screen(fun_name, self.img_path) except TimeoutException: sc.logger.info('当前工程只有一个镜头,无法进入多选') return True sc.logger.info('多选-删除') ba.clip_mult_select() sc.capture_screen(fun_name, self.img_path) sc.logger.info('点击“存草稿”按钮') WebDriverWait( sc.driver, 5, 1).until(lambda el: el.find_element_by_name("存草稿")).click() sc.capture_screen(fun_name, self.img_path) sc.logger.info('剪辑-比例测试完成')
def test_edit_fx_del(self): """剪辑-特效-删除&放弃.""" sc.logger.info('剪辑-特效-删除&放弃') fun_name = 'test_edit_fx_del' sc.logger.info('点击草稿封面') time.sleep(0.5) ba.open_draft(iOS_elements.el_studio_draft) sc.capture_screen(fun_name, self.img_path) sc.logger.info('点击“效果”') WebDriverWait(sc.driver, 5, 1).until(lambda x: x.find_element_by_name("效果")).click() sc.capture_screen(fun_name, self.img_path) sc.logger.info('点击屏幕弹出已添加的特效编辑页面') ba.screen_tap('特效', 200, 200) sc.logger.info('删除') sc.driver.find_element_by_name('删除').click() sc.capture_screen(fun_name, self.img_path) sc.logger.info('添加特效并放弃') WebDriverWait(sc.driver, 10, 1).until(lambda x: x.find_element_by_name('添加')).click() sc.capture_screen(fun_name, self.img_path) sc.logger.info('点击"下载更多"') el_more = 'xiaoying itembar down more' ba.more_download(el_more) sc.logger.info('使用特效') ba.material_used(iOS_elements.el_store_download1) sc.logger.info('确定') WebDriverWait(sc.driver, 5, 1).until(lambda x: x.find_element_by_name( iOS_elements.el_confirm_btn)).click() sc.capture_screen(fun_name, self.img_path) sc.logger.info('取消添加') WebDriverWait(sc.driver, 5, 1).until(lambda x: x.find_element_by_name( iOS_elements.el_cancel_btn)).click() sc.logger.info('确定放弃') sc.driver.find_element_by_name('确认').click() sc.logger.info('点击“存草稿”按钮') WebDriverWait( sc.driver, 5, 1).until(lambda el: el.find_element_by_name("存草稿")).click() sc.logger.info('剪辑-特效-删除&放弃测试完成')
def test_edit_sound_01_rec(self): """剪辑-配音-录制.""" sc.logger.info('剪辑-配音-录制') fun_name = 'test_edit_sound_rec' sc.logger.info('打开一个草稿视频') ba.home_first_click('更多草稿') sc.logger.info('点击草稿封面') ba.open_draft(iOS_elements.el_studio_draft) sc.capture_screen(fun_name, self.img_path) sc.logger.info('点击“效果”') WebDriverWait(sc.driver, 5, 1).until(lambda x: x.find_element_by_name("效果")).click() sc.capture_screen(fun_name, self.img_path) sc.logger.info('左滑并点击"配音和音效"') el_loc = WebDriverWait( sc.driver, 5, 1).until(lambda x: x.find_element_by_name('画中画')) ba.swipe_left(el_loc, 0.3, 300) WebDriverWait( sc.driver, 5, 1).until(lambda x: x.find_element_by_name('配音和音效')).click() sc.capture_screen(fun_name, self.img_path) sc.logger.info('删除已添加的配音或音效') try: WebDriverWait( sc.driver, 3, 1).until(lambda x: x.find_element_by_accessibility_id( iOS_elements.btn_rec_start)) except TimeoutException: sc.logger.info('当前位置已添加配音或音效,删除后录制') sc.driver.find_element_by_name('删除').click() sc.capture_screen(fun_name, self.img_path) sc.logger.info('"录制"一段音频') ba.sound_rec_add() sc.capture_screen(fun_name, self.img_path) sc.logger.info('确认添加') WebDriverWait(sc.driver, 5, 1).until(lambda x: x.find_element_by_name( iOS_elements.el_confirm_btn)).click() sc.capture_screen(fun_name, self.img_path) sc.logger.info('剪辑-配音-录制添加测试完成')
def test_clips_add_03(self): """剪辑-添加镜头-放弃.""" sc.logger.info('剪辑-添加镜头-放弃') fun_name = 'test_edit_clips_cancel' sc.logger.info('点击草稿封面') ba.open_draft(iOS_elements.el_home_draft) sc.capture_screen(fun_name, self.img_path) sc.logger.info('点击“镜头编辑”') WebDriverWait( sc.driver, 5, 1).until(lambda x: x.find_element_by_name("镜头编辑")).click() sc.capture_screen(fun_name, self.img_path) sc.logger.info('点击"添加镜头"按钮') WebDriverWait(sc.driver, 5, 1).until(lambda x: x.find_element_by_name( iOS_elements.btn_clip_add)).click() sc.capture_screen(fun_name, self.img_path) sc.logger.info('选择相册') WebDriverWait(sc.driver, 5, 1).until(lambda x: x.find_element_by_name('相册')).click() sc.capture_screen(fun_name, self.img_path) sc.logger.info('勾选镜头') ba.gallery_clip_add('视频', 2) sc.logger.info('左上角返回') sc.driver.find_element_by_name(iOS_elements.el_gallery_back).click() sc.capture_screen(fun_name, self.img_path) sc.logger.info('确定放弃') try: WebDriverWait( sc.driver, 5, 1).until(lambda x: x.find_element_by_name('确认')).click() sc.capture_screen(fun_name, self.img_path) except TimeoutException: sc.logger.error('没有勾选中镜头,需要手动再验证!') return False sc.logger.info('剪辑-放弃添加镜头-测试完成')
def test_music_01_add(self): """预览页-配乐.""" sc.logger.info('配乐操作相关') fun_name = 'test_music_add' sc.logger.info('打开一个草稿视频') ba.home_first_click('更多草稿') sc.logger.info('点击草稿封面') ba.open_draft(iOS_elements.el_studio_draft) sc.capture_screen(fun_name, self.img_path) sc.logger.info('点击“主题”') WebDriverWait(sc.driver, 5, 1).until(lambda x: x.find_element_by_name("主题")).click() sc.capture_screen(fun_name, self.img_path) sc.logger.info('配乐相关操作') ba.preview_music() sc.capture_screen(fun_name, self.img_path) sc.logger.info('预览页-配乐测试完成')
def test_edit_filter(self): """剪辑-滤镜.""" sc.logger.info('剪辑-滤镜') fun_name = 'test_edit_filter' sc.logger.info('打开一个草稿视频') ba.home_first_click('更多草稿') sc.logger.info('点击草稿封面') ba.open_draft(iOS_elements.el_studio_draft) sc.capture_screen(fun_name, self.img_path) sc.logger.info('点击“镜头编辑”') WebDriverWait( sc.driver, 5, 1).until(lambda x: x.find_element_by_name("镜头编辑")).click() sc.capture_screen(fun_name, self.img_path) sc.logger.info('点击"滤镜"') WebDriverWait(sc.driver, 5, 1).until(lambda x: x.find_element_by_name("滤镜")).click() sc.logger.info('点击"下载更多"') btn_more = '下载更多' ba.more_download(btn_more) sc.logger.info('使用滤镜') ba.material_used(iOS_elements.el_store_download2) sc.logger.info('确认添加') WebDriverWait(sc.driver, 5, 1).until(lambda x: x.find_element_by_name( iOS_elements.el_confirm_btn)).click() sc.capture_screen(fun_name, self.img_path) sc.logger.info('点击“存草稿”按钮') WebDriverWait( sc.driver, 5, 1).until(lambda el: el.find_element_by_name("存草稿")).click() sc.logger.info('剪辑-滤镜测试完成')
def test_clip_edit_function(self): """剪辑-镜头编辑-功能遍历.""" sc.logger.info('剪辑-镜头编辑-功能遍历') fun_name = 'test_clip_edit_function' sc.logger.info('点击创作中心主按钮') ba.home_enter() sc.logger.info('点击草稿封面') ba.open_draft(iOS_elements.el_home_draft) sc.capture_screen(fun_name, self.img_path) sc.logger.info('功能遍历') ba.clip_fun_loop() sc.capture_screen(fun_name, self.img_path) sc.logger.info('点击“存草稿”按钮') WebDriverWait( sc.driver, 5, 1).until(lambda el: el.find_element_by_name("存草稿")).click() sc.logger.info('剪辑-镜头编辑-功能遍历完成')
def test_clips_add_02(self): """剪辑-添加镜头-拍摄添加.""" sc.logger.info('剪辑-添加镜头-拍摄添加') fun_name = 'test_edit_clips_shot' sc.logger.info('点击草稿封面') ba.open_draft(iOS_elements.el_home_draft) sc.capture_screen(fun_name, self.img_path) sc.logger.info('点击“镜头编辑”') WebDriverWait( sc.driver, 5, 1).until(lambda x: x.find_element_by_name("镜头编辑")).click() sc.capture_screen(fun_name, self.img_path) sc.logger.info('拍摄添加镜头') ba.clip_add('拍摄') sc.capture_screen(fun_name, self.img_path) sc.logger.info('退出预览页') WebDriverWait(sc.driver, 5, 1).until(lambda x: x.find_element_by_xpath( iOS_elements.el_pre_clo)).click() sc.logger.info('剪辑-添加镜头-拍摄添加测试完成')
def test_edit_transition(self): """剪辑-转场-添加.""" sc.logger.info('剪辑-转场-添加') fun_name = 'test_edit_transition' sc.logger.info('打开一个草稿视频') ba.home_first_click('更多草稿') sc.logger.info('点击草稿封面') ba.open_draft(iOS_elements.el_studio_draft) sc.capture_screen(fun_name, self.img_path) sc.logger.info('点击“镜头编辑”') WebDriverWait( sc.driver, 5, 1).until(lambda x: x.find_element_by_name("镜头编辑")).click() sc.capture_screen(fun_name, self.img_path) sc.logger.info('点击“转场icon”') try: WebDriverWait(sc.driver, 5, 1).until(lambda x: x.find_element_by_name( iOS_elements.btn_transition_icon)).click() sc.capture_screen(fun_name, self.img_path) except TimeoutException: sc.logger.info('只有一个镜头,无法使用转场') return True sc.logger.info('下载并使用转场') ba.clip_transition() sc.logger.info('点击“存草稿”按钮') WebDriverWait( sc.driver, 5, 1).until(lambda el: el.find_element_by_name("存草稿")).click() sc.logger.info('剪辑-转场-添加测试完成')
def test_edit_sticker(self): """剪辑-动画贴纸-添加.""" sc.logger.info('剪辑-动画贴纸-添加') fun_name = 'test_edit_sticker' sc.logger.info('打开一个草稿视频') ba.home_first_click('更多草稿') sc.logger.info('点击草稿封面') ba.open_draft(iOS_elements.el_studio_draft) sc.capture_screen(fun_name, self.img_path) sc.logger.info('点击“效果”') WebDriverWait(sc.driver, 5, 1).until(lambda x: x.find_element_by_name("效果")).click() sc.capture_screen(fun_name, self.img_path) sc.logger.info('点击“贴纸”') WebDriverWait(sc.driver, 5, 1).until(lambda x: x.find_element_by_name("贴纸")).click() sc.capture_screen(fun_name, self.img_path) sc.logger.info('添加一个普通"贴纸"') ba.sticker_comm_add() sc.logger.info('确认添加') WebDriverWait(sc.driver, 5, 1).until(lambda x: x.find_element_by_name( iOS_elements.el_confirm_btn)).click() sc.capture_screen(fun_name, self.img_path) sc.logger.info('添加第二个贴纸并放弃') WebDriverWait(sc.driver, 10, 1).until(lambda x: x.find_element_by_name('添加')).click() sc.capture_screen(fun_name, self.img_path) sc.logger.info('点击GIF') WebDriverWait( sc.driver, 10, 1).until(lambda x: x.find_element_by_name('GIF')).click() sc.capture_screen(fun_name, self.img_path) sc.logger.info('添加一个GIF"贴纸"') ba.material_used('下载') sc.capture_screen(fun_name, self.img_path) sc.logger.info('确定') time.sleep(0.5) WebDriverWait(sc.driver, 5, 1).until(lambda x: x.find_element_by_name( iOS_elements.el_confirm_btn)).click() sc.logger.info('取消添加') WebDriverWait(sc.driver, 5, 1).until(lambda x: x.find_element_by_name( iOS_elements.el_cancel_btn)).click() sc.capture_screen(fun_name, self.img_path) # iOS此处有一个bug,贴纸未添加完成时,点击x,未弹出放弃弹窗(7.2.2已修复) sc.logger.info('确定放弃') try: WebDriverWait( sc.driver, 5, 1).until(lambda x: x.find_element_by_name('确认')).click() sc.capture_screen(fun_name, self.img_path) except TimeoutException: sc.logger.error('iOS此处有一个bug,贴纸未添加完成时,点击x,未弹出放弃弹窗') sc.logger.info('点击“存草稿”按钮') WebDriverWait( sc.driver, 5, 1).until(lambda el: el.find_element_by_name("存草稿")).click() sc.logger.info('剪辑-动画贴纸-添加测试完成')