示例#1
0
    def test_gallery_02_giveup(self):
        """相册-放弃操作."""
        sc.logger.info('相册-放弃操作')
        fun_name = 'test_gallery_giveup'

        sc.logger.info('点击“视频剪辑”按钮')
        try:
            WebDriverWait(sc.driver, 3,
                          1).until(lambda x: x.find_element_by_xpath(
                              iOS_elements.el_home_edit)).click()
        except TimeoutException:
            sc.driver.find_element_by_name('剪辑').click()

        sc.logger.info('添加"视频"')
        ba.gallery_clip_add('视频', 2)
        sc.capture_screen(fun_name, self.img_path)

        sc.logger.info('左上角返回')
        WebDriverWait(sc.driver, 10,
                      1).until(lambda el: el.find_element_by_name(
                          iOS_elements.el_gallery_back)).click()
        sc.capture_screen(fun_name, self.img_path)

        sc.logger.info('放弃')
        WebDriverWait(
            sc.driver, 10,
            1).until(lambda el: el.find_element_by_name('丢弃')).click()
        sc.capture_screen(fun_name, self.img_path)
        sc.logger.info('相册-放弃操作相关操作测试完成')
示例#2
0
    def test_create_draft(self):
        """创建一个草稿视频."""
        sc.logger.info('创建一个草稿视频')
        fun_name = 'test_create_craft'

        sc.logger.info('点击创作中心主按钮')
        ba.home_enter()

        sc.logger.info('点击“视频剪辑”按钮')
        WebDriverWait(sc.driver, 3, 1).until(lambda x: x.find_element_by_xpath(
            iOS_elements.el_home_edit)).click()

        sc.logger.info('添加视频')
        ba.gallery_clip_add('视频', 2)
        sc.capture_screen(fun_name, self.img_path)

        sc.logger.info('切换到图片')
        sc.driver.find_element_by_name("视频").click()
        sc.driver.find_element_by_name("图片").click()

        sc.logger.info('添加图片')
        ba.gallery_clip_add('图片', 2)
        sc.capture_screen(fun_name, self.img_path)

        sc.logger.info('点击下一步')
        ba.find_element_click('predicate', 10, iOS_elements.el_gallery_next)

        sc.logger.info('点击“存草稿”按钮')
        WebDriverWait(
            sc.driver, 5,
            1).until(lambda el: el.find_element_by_name("存草稿")).click()
        sc.logger.info('创建一个草稿视频完成')
示例#3
0
    def test_edit_text(self):
        """剪辑-字幕-添加."""
        sc.logger.info('剪辑-字幕-添加')
        fun_name = 'test_edit_text'

        sc.logger.info('点击视频剪辑')
        WebDriverWait(sc.driver, 3, 1).until(lambda x: x.find_element_by_xpath(
            iOS_elements.el_home_edit)).click()

        sc.logger.info('添加视频')
        ba.gallery_clip_add('视频', 2)
        sc.capture_screen(fun_name, self.img_path)

        sc.logger.info('点击下一步')
        ba.find_element_click('predicate', 10, iOS_elements.el_gallery_next)
        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.effect_add_confirm()
        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.text_comm_add()

        sc.logger.info('其他设置')
        ba.text_other()

        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('剪辑-字幕-添加测试完成')
示例#4
0
    def test_template_02_filter(self):
        """素材中心-滤镜."""
        sc.logger.info('素材中心-滤镜')
        fun_name = 'test_template_filter'

        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.material_used(iOS_elements.el_store_download2)
        sc.capture_screen(fun_name, self.img_path)

        sc.logger.info('添加"视频"')
        ba.gallery_clip_add('视频', 2)

        sc.logger.info('点击下一步进入预览页')
        ba.find_element_click('predicate', 10, iOS_elements.el_gallery_next)
        sc.capture_screen(fun_name, self.img_path)

        sc.logger.info('点击“确认”')
        sc.driver.find_element_by_name(iOS_elements.el_confirm_btn).click()

        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('返回创作页')
        WebDriverWait(sc.driver, 5,
                      1).until(lambda el: el.find_element_by_name(
                          iOS_elements.el_com_back)).click()

        WebDriverWait(
            sc.driver, 5,
            1).until(lambda x: x.find_element_by_name('素材中心')).click()

        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.material_manager('滤镜', iOS_elements.el_store_del)
        sc.capture_screen(fun_name, self.img_path)
        sc.logger.info('素材中心-滤镜测试完成')
示例#5
0
    def test_edit_fx(self):
        """剪辑-特效-添加."""
        sc.logger.info('剪辑-特效-添加')
        fun_name = 'test_edit_fx'

        sc.logger.info('点击创作中心主按钮')
        ba.home_enter()

        sc.logger.info('点击视频剪辑')
        WebDriverWait(sc.driver, 5, 1).until(lambda x: x.find_element_by_xpath(
            iOS_elements.el_home_edit)).click()

        sc.logger.info('添加视频')
        ba.gallery_clip_add('视频', 2)
        sc.capture_screen(fun_name, self.img_path)

        sc.logger.info('点击下一步')
        ba.find_element_click('predicate', 10, iOS_elements.el_gallery_next)
        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('下载并使用“特效”')
        ba.fx_add()

        sc.logger.info('确认添加')
        sc.driver.find_element_by_name(iOS_elements.el_confirm_btn).click()
        time.sleep(5)
        sc.driver.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('剪辑-特效-添加测试完成')
示例#6
0
    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('剪辑-放弃添加镜头-测试完成')
示例#7
0
    def test_preview_time(self):
        """预览页-时长."""
        sc.logger.info('预览页-时长')
        fun_name = 'test_preview_time'

        sc.logger.info('相册MV')
        ba.home_first_click('相册MV')
        sc.capture_screen(fun_name, self.img_path)

        sc.logger.info('添加图片')
        ba.gallery_clip_add('图片', 5)

        sc.logger.info('点击下一步进入预览页')
        ba.find_element_click('predicate', 10, iOS_elements.el_gallery_next)

        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, 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.logger.info('点击“确认”')
            sc.driver.find_element_by_name(iOS_elements.el_confirm_btn).click()
            sc.capture_screen(fun_name, self.img_path)
        except TimeoutException:
            sc.logger.info('当前镜头是gif图片,直接存草稿')

        sc.logger.info('点击“存草稿”按钮')
        WebDriverWait(
            sc.driver, 5,
            1).until(lambda el: el.find_element_by_name("存草稿")).click()
        sc.logger.info('预览页-时长测试完成')
示例#8
0
    def test_template_08_transition(self):
        """素材中心-转场."""
        sc.logger.info('素材中心-转场')
        fun_name = 'test_template_transition'
        start_x = self.width // 2
        start_y = self.height // 8
        start_bottom = self.height - start_y

        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('向上滑动直到最底部')
        while True:
            try:
                sc.driver.find_element_by_name("没有更多了…").click()
                break
            except NoSuchElementException:
                sc.swipe_by_ratio(start_x, start_bottom, 'up', 0.7, 300)

        sc.logger.info('下载并使用转场')
        ba.material_used(iOS_elements.el_store_download1)
        sc.capture_screen(fun_name, self.img_path)

        sc.logger.info('添加"视频"')
        ba.gallery_clip_add('视频', 2)

        sc.logger.info('点击下一步进入预览页')
        ba.find_element_click('predicate', 10, iOS_elements.el_gallery_next)
        sc.capture_screen(fun_name, self.img_path)

        sc.logger.info('点击“确认”')
        sc.driver.find_element_by_name(iOS_elements.el_confirm_btn).click()

        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('返回创作页')
        WebDriverWait(sc.driver, 5,
                      1).until(lambda el: el.find_element_by_name(
                          iOS_elements.el_com_back)).click()

        WebDriverWait(
            sc.driver, 5,
            1).until(lambda x: x.find_element_by_name('素材中心')).click()

        sc.logger.info('向上滑动')
        el_text = sc.driver.find_element_by_name("字幕")
        coord_x = el_text.location.get('x')
        coord_y = el_text.location.get('y')
        sc.swipe_by_ratio(coord_x, coord_y, 'up', 0.7, 500)

        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.material_manager('转场', iOS_elements.el_store_del)
        sc.capture_screen(fun_name, self.img_path)
        sc.logger.info('素材中心-动画贴纸测试完成')
示例#9
0
    def test_template_07_gif(self):
        """素材中心-GIF."""
        sc.logger.info('素材中心-GIF')
        fun_name = 'test_template_gif'

        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('切换到“GIF”')
        WebDriverWait(
            sc.driver, 5,
            1).until(lambda el: el.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('添加"视频"')
        ba.gallery_clip_add('视频', 2)

        sc.logger.info('点击下一步进入预览页')
        ba.find_element_click('predicate', 10, iOS_elements.el_gallery_next)
        sc.capture_screen(fun_name, self.img_path)

        sc.logger.info('点击“确认”')
        ba.effect_add_confirm()

        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('返回创作页')
        WebDriverWait(sc.driver, 5,
                      1).until(lambda el: el.find_element_by_name(
                          iOS_elements.el_com_back)).click()

        WebDriverWait(
            sc.driver, 5,
            1).until(lambda x: x.find_element_by_name('素材中心')).click()

        sc.logger.info('向上滑动')
        el_text = sc.driver.find_element_by_name("字幕")
        coord_x = el_text.location.get('x')
        coord_y = el_text.location.get('y')
        sc.swipe_by_ratio(coord_x, coord_y, 'up', 0.7, 300)

        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('切换到“GIF”')
        WebDriverWait(
            sc.driver, 5,
            1).until(lambda el: el.find_element_by_name("GIF")).click()

        sc.logger.info('删除下载的GIF贴纸')
        ba.material_manager('GIF贴纸', '删除')
        sc.capture_screen(fun_name, self.img_path)
        sc.logger.info('素材中心-GIF贴纸测试完成')
示例#10
0
    def test_template_01_theme(self):
        """素材中心-主题."""
        sc.logger.info('素材中心-主题')
        fun_name = 'test_template_theme'

        ba.home_first_click('素材中心')
        sc.capture_screen(fun_name, self.img_path)

        sc.logger.info('点击顶部banner')
        WebDriverWait(sc.driver, 5,
                      1).until(lambda el: el.find_element_by_accessibility_id(
                          iOS_elements.el_banner)).click()

        sc.logger.info('返回')
        try:
            WebDriverWait(
                sc.driver, 5, 1).until(lambda el: el.find_element_by_xpath(
                    '//XCUIElementTypeButton[@name="vivavideo com nav back n"]'
                )).click()
        except TimeoutException:
            WebDriverWait(
                sc.driver, 3, 1).until(lambda el: el.find_element_by_xpath(
                    '//XCUIElementTypeButton[@name="vivavideo back n"]')
                                       ).click()

        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.material_used(iOS_elements.el_store_download1)
        sc.capture_screen(fun_name, self.img_path)

        sc.logger.info('添加"视频"')
        ba.gallery_clip_add('视频', 2)

        sc.logger.info('点击下一步进入预览页')
        ba.find_element_click('predicate', 10, iOS_elements.el_gallery_next)
        sc.capture_screen(fun_name, self.img_path)

        sc.logger.info('取消限制弹窗')
        try:
            WebDriverWait(sc.driver, 3,
                          1).until(lambda x: x.find_element_by_name(
                              iOS_elements.el_cancel)).click()
        except TimeoutException:
            sc.logger.info('限制弹窗已取消')

        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('返回创作页')
        WebDriverWait(sc.driver, 5,
                      1).until(lambda el: el.find_element_by_name(
                          iOS_elements.el_com_back)).click()

        WebDriverWait(
            sc.driver, 5,
            1).until(lambda x: x.find_element_by_name('素材中心')).click()

        sc.logger.info('点击“主题”')
        WebDriverWait(sc.driver, 5,
                      1).until(lambda x: x.find_element_by_name('主题')).click()

        sc.logger.info('删除下载的主题')
        ba.material_manager('主题', iOS_elements.el_store_del)
        sc.capture_screen(fun_name, self.img_path)
        sc.logger.info('素材中心-主题测试完成')