Exemple #1
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('创建一个草稿视频完成')
Exemple #2
0
    def test_login_01_start(self):
        """测试登录页面未登录时的初始状态.

        1.无法获取到启动页的"跳过"控件,所以暂时先手动跳过启动页再进行登录测试,后续再优化
        """
        sc.logger.info('登录页面初始状态检查测试开始')
        fun_name = 'test_login_origin'

        time.sleep(5)
        sc.logger.info('授权小影发送通知')
        try:
            sc.driver.find_element_by_name('允许').click()
        except NoSuchElementException:
            sc.logger.info('已授权小影发送通知')

        sc.logger.info('关闭活动弹窗')
        time.sleep(2)
        try:
            sc.driver.find_element_by_name(
                "vivavideo purchase close n").click()
        except NoSuchElementException:
            sc.logger.info('当前无或者已关闭活动弹窗')

        sc.logger.info('切换到"我"')
        btn_me = "//*/XCUIElementTypeTabBar/XCUIElementTypeButton[3]"
        sc.driver.find_element_by_xpath(btn_me).click()
        time.sleep(.500)
        sc.capture_screen(fun_name, self.img_path)

        assert btn_me is not None
Exemple #3
0
    def test_music_06_local(self):
        """音乐库-使用本地音乐."""
        sc.logger.info('音乐库-使用本地音乐')
        fun_name = 'test_preview_local'

        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_xpath(
                              iOS_elements.el_mus_play)).click()
        except TimeoutException:
            sc.logger.info('本地音乐不存在!')
            return True

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

        sc.logger.info('暂停播放')
        WebDriverWait(sc.driver, 10, 1).until(
            lambda x: x.find_element_by_name(iOS_elements.btn_stop)).click()

        sc.logger.info('确定')
        WebDriverWait(sc.driver, 10,
                      1).until(lambda x: x.find_element_by_accessibility_id(
                          iOS_elements.btn_music_confirm)).click()

        sc.logger.info('点击“存草稿”按钮')
        WebDriverWait(
            sc.driver, 5,
            1).until(lambda el: el.find_element_by_name("存草稿")).click()
        sc.logger.info('音乐库-使用本地音乐测试完成')
Exemple #4
0
    def test_settings_02_feedback(self):
        """设置:意见反馈."""
        sc.logger.info('设置:意见反馈')
        fun_name = 'test_settings_feedback'
        start_x = self.width // 2
        start_y = self.height // 8
        start_bottom = self.height - start_y

        sc.logger.info('向上滑动')
        for i in range(2):
            sc.swipe_by_ratio(start_x, start_bottom, 'up', 0.7, 300)

        sc.logger.info("意见反馈")
        WebDriverWait(
            sc.driver, 3,
            1).until(lambda el: el.find_element_by_name('意见反馈')).click()
        sc.capture_screen(fun_name, self.img_path)

        sc.logger.info("填写意见反馈")
        ba.feedback()
        sc.capture_screen(fun_name, self.img_path)

        sc.logger.info("返回设置页")
        sc.driver.find_element_by_name(iOS_elements.el_com_back).click()
        sc.logger.info('意见反馈测试完成')
Exemple #5
0
    def test_fans_follow(self):
        """粉丝关注/取消关注测试."""
        sc.logger.info('用户空间粉丝页面关注状态测试开始')
        fun_name = 'test_fans_follow'

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

        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
Exemple #6
0
    def test_music_02_recommend(self):
        """音乐库-推荐音乐下载."""
        sc.logger.info('音乐库-推荐音乐下载')
        fun_name = 'test_preview_recommend'

        sc.logger.info('点击“添加配乐”按钮')
        WebDriverWait(
            sc.driver, 5,
            1).until(lambda x: x.find_element_by_name("添加配乐")).click()

        # 推荐音乐下载
        sc.logger.info('向上滑动')
        start_x = self.width // 2
        start_y = self.height // 8
        start_bottom = self.height - start_y
        for i in range(2):
            sc.swipe_by_ratio(start_x, start_bottom, 'up', 0.7, 300)

        sc.logger.info('下载音乐')
        music_list = sc.driver.find_elements_by_name(
            iOS_elements.el_mus_download)
        if len(music_list) >= 3:
            music_list = music_list[:3]
        for el_music in music_list:
            el_music.click()

        sc.capture_screen(fun_name, self.img_path)
        sc.logger.info('音乐库-推荐音乐下载测试完成')
Exemple #7
0
    def template_download(cls, type, el_download):
        """素材下载."""
        sc.logger.info('%s下载测试', type)

        fun_name = 'template_download'

        sc.logger.info('开始下载')
        el_template_down = sc.driver.find_element_by_name(el_download)
        try:
            sc.logger.info('点击“下载”按钮')
            el_template_down.click()
            sc.capture_screen(fun_name, cls.img_path)
        except NoSuchElementException:
            sc.logger.info('当前页面所有素材已下载完成')
            return True

        sc.logger.info('检查素材下载是否成功')
        try:
            WebDriverWait(sc.driver, 30).until(
                lambda theme_use: theme_use.find_element_by_name("使用"))
            sc.capture_screen(fun_name, cls.img_path)
        except TimeoutError as t:
            sc.logger.error('素材下载超时', t)
            return False
        except Exception as e:
            sc.logger.error('素材下载失败', e)
            return False

        sc.logger.info('%s下载测试完成', type)
Exemple #8
0
    def test_edit_music_02_del(self):
        """剪辑-多段配乐-删除."""
        sc.logger.info('剪辑-多段配乐-删除')
        fun_name = 'test_edit_music_del'

        time.sleep(1)
        sc.logger.info('点击首页第一个草稿封面')
        el_draft = sc.driver.find_element_by_xpath(
            "//*/XCUIElementTypeOther[2]/*/XCUIElementTypeButton")
        el_draft.click()

        sc.logger.info('点击"多段配乐"')
        time.sleep(0.5)
        sc.driver.find_element_by_name("剪辑").click()
        sc.driver.find_element_by_name("多段配乐").click()

        sc.logger.info('点击"编辑"按钮')
        sc.driver.find_element_by_name("vivavideo tool fx edit n").click()
        sc.capture_screen(fun_name, self.img_path)

        sc.logger.info('点击删除按钮')
        sc.driver.find_element_by_name(
            "vivavideo tool subtitle delete").click()
        sc.capture_screen(fun_name, self.img_path)

        sc.logger.info('点击右上角确认按钮')
        sc.driver.find_element_by_name("xiaoying com ok").click()

        sc.logger.info('点击“存草稿”按钮')
        sc.driver.find_element_by_name("存草稿").click()

        sc.logger.info('返回创作中心主界面')
        time.sleep(1)
        sc.driver.find_element_by_name("vivavideo com nav back n").click()
Exemple #9
0
    def template_use(cls, type):
        """使用素材并进入预览页测试."""
        sc.logger.info('%s使用素材并进入预览页测试', type)
        time.sleep(1)
        fun_name = 'template_use'

        sc.logger.info('点击“使用”按钮')
        try:
            el_template_use = sc.driver.find_element_by_name("使用")
            el_template_use.click()
        except NoSuchElementException:
            sc.logger.error('未找到已下载的素材')
            return False
        sc.capture_screen(fun_name, cls.img_path)

        sc.logger.info('添加视频')
        time.sleep(2)
        el_video = sc.driver.find_element_by_accessibility_id(
            "vivavideo_tool_gallery_audio_type_video")
        el_video.click()
        sc.driver.find_element_by_name("添加 0").click()

        sc.logger.info('添加多张图片')
        sc.driver.find_element_by_name("视频").click()
        sc.driver.find_element_by_name("图片").click()
        el_imgs = sc.driver.find_elements_by_xpath("//*/XCUIElementTypeImage")
        i = 1
        while i < len(el_imgs):
            el_imgs[i].click()
            i = i + 1

        sc.logger.info('点击"下一步"')
        sc.driver.find_element_by_name("下一步").click()

        sc.logger.info('%s使用并进入预览页测试完成', type)
Exemple #10
0
    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('剪辑-多段配乐-删除测试完成')
Exemple #11
0
    def test_preview_07_local(self):
        """音乐库-使用本地音乐."""
        sc.logger.info('音乐库-使用本地音乐')
        fun_name = 'test_preview_local'

        sc.logger.info('切换到“本地”分类')
        sc.driver.find_element_by_name("本地").click()
        sc.capture_screen(fun_name, self.img_path)

        sc.logger.info('选择一首本地音频试听')
        el_music_name = sc.driver.find_element_by_xpath(
            "//*/XCUIElementTypeTable//*/XCUIElementTypeButton[2]")
        try:
            el_music_name.click()
            sc.logger.info('点击播放/暂停按钮')
            sc.driver.find_element_by_name(
                "vivavideo tool camera pause n").click()

            sc.logger.info('点击“添加”按钮')
            sc.driver.find_element_by_name('添加').click()
            time.sleep(0.5)
        except NoSuchElementException:
            sc.logger.info('本地音乐不存在,返回预览页!')
            sc.driver.find_element_by_name("xiaoying com back").click()

        sc.logger.info('点击“存草稿”按钮')
        time.sleep(0.5)
        sc.driver.find_element_by_name("存草稿").click()

        sc.logger.info('点击左上角返回按钮退回创作中心')
        time.sleep(1)
        sc.driver.find_element_by_name("vivavideo com nav back n").click()
Exemple #12
0
    def test_edit_text_03_del(self):
        """剪辑-字幕-删除."""
        sc.logger.info('剪辑-字幕-删除')
        fun_name = 'test_edit_text_del'

        time.sleep(1)
        sc.logger.info('点击首页第一个草稿封面')
        el_draft = sc.driver.find_element_by_xpath(
            "//*/XCUIElementTypeOther[2]/*/XCUIElementTypeButton")
        el_draft.click()

        sc.logger.info('点击"字幕"')
        time.sleep(0.5)
        sc.driver.find_element_by_name("剪辑").click()
        sc.driver.find_element_by_name("字幕").click()

        sc.logger.info('点击已添加的"字幕"')
        sc.driver.find_element_by_xpath(
            "//*/XCUIElementTypeOther[2]/XCUIElementTypeOther/XCUIElementTypeOther/XCUIElementTypeButton"
        ).click()
        sc.capture_screen(fun_name, self.img_path)

        sc.logger.info('点击删除按钮')
        sc.driver.find_element_by_name(
            "vivavideo editor framebar dele").click()
        sc.capture_screen(fun_name, self.img_path)

        sc.logger.info('点击右上角确认按钮')
        sc.driver.find_element_by_name("vivavideo editor common ok").click()
Exemple #13
0
    def test_preview_04_other(self):
        """音乐库-其他分类音乐下载."""
        sc.logger.info('音乐库-其他分类音乐下载')
        fun_name = 'test_preview_other'

        sc.logger.info('通过滑动屏幕切换到"流行"分类')
        start_x = self.width - self.width // 5
        start_bottom = self.height // 2
        sc.swipe_by_ratio(start_x, start_bottom, 'left', 0.7, 500)

        sc.logger.info('下载"流行"分类音频')
        time.sleep(1)
        el_download = sc.driver.find_element_by_name(
            'vivavideo material download3 n')
        el_download.click()
        sc.capture_screen(fun_name, self.img_path)

        sc.logger.info('通过点击分类tab切换到"爵士 & 蓝调"分类')
        sc.driver.find_element_by_name("爵士 & 蓝调").click()

        sc.logger.info('下载"爵士 & 蓝调"分类音频')
        time.sleep(1)
        el_download = sc.driver.find_element_by_name(
            'vivavideo material download3 n')
        el_download.click()
        sc.capture_screen(fun_name, self.img_path)
Exemple #14
0
    def test_edit_clips_03_cancel(self):
        """剪辑-添加镜头-放弃."""
        sc.logger.info('剪辑-添加镜头-放弃')
        fun_name = 'test_edit_clips_cancel'

        sc.logger.info('点击"添加镜头"')
        time.sleep(1)
        sc.driver.find_element_by_name("添加镜头").click()

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

        sc.logger.info('添加图片')
        el_img = sc.driver.find_elements_by_xpath("//*/XCUIElementTypeImage")
        el_img[1].click()
        sc.capture_screen(fun_name, self.img_path)

        sc.logger.info('点击“左上角按钮”取消')
        sc.driver.find_element_by_name("vivavideo gallery back n").click()
        sc.capture_screen(fun_name, self.img_path)

        sc.logger.info('确认取消')
        sc.driver.find_element_by_name("确认").click()
        time.sleep(3)

        sc.logger.info('存草稿并返回创作页首页')
        sc.driver.find_element_by_name("存草稿").click()
        time.sleep(1)
        sc.driver.find_element_by_name("vivavideo com nav back n").click()
Exemple #15
0
    def test_preview_03_time(self):
        """预览页-时长."""
        sc.logger.info('预览页-时长')
        fun_name = 'test_preview_time'

        time.sleep(1)
        sc.logger.info('点击相册MV')
        sc.driver.find_element_by_name("相册MV").click()

        sc.logger.info('添加图片')
        el_imgs = sc.driver.find_elements_by_xpath("//*/XCUIElementTypeImage")
        i = 1  # 第0个为顶部的下拉框
        while i < len(el_imgs):
            el_imgs[i].click()
            i = i + 1

        sc.logger.info('进入预览页')
        sc.driver.find_element_by_name("下一步").click()

        sc.logger.info('点击“时长”')
        sc.driver.find_element_by_name("vivavideo tool preview imageti").click()
        sc.capture_screen(fun_name,self.img_path)

        sc.logger.info('点击“存草稿”按钮')
        sc.driver.find_element_by_name("存草稿").click()

        sc.logger.info('返回创作中心主界面')
        time.sleep(1)
        sc.driver.find_element_by_name("vivavideo com nav back n").click()
Exemple #16
0
    def test_edit_text_01_add(self):
        """剪辑-字幕-添加."""
        sc.logger.info('剪辑-字幕-添加')
        fun_name = 'test_edit_text_add'

        time.sleep(5)
        sc.logger.info('点击创作中心主按钮')
        try:
            sc.driver.find_element_by_xpath(
                "//XCUIElementTypeImage[@name='camerta_n']").click()
        except NoSuchElementException:
            sc.driver.find_element_by_xpath(
                "//XCUIElementTypeImage[@name='camerta_f']").click()

        sc.logger.info('点击首页第一个草稿封面')
        el_draft = sc.driver.find_element_by_xpath(
            "//*/XCUIElementTypeOther[2]/*/XCUIElementTypeButton")
        el_draft.click()

        sc.logger.info('点击"字幕"')
        time.sleep(0.5)
        sc.driver.find_element_by_name("剪辑").click()
        sc.driver.find_element_by_name("字幕").click()
        sc.capture_screen(fun_name, self.img_path)

        sc.logger.info('**************添加第一个字幕**************')
        sc.logger.info('点击添加按钮')
        sc.driver.find_element_by_name("vivavideo editor subtitle add").click()
        sc.capture_screen(fun_name, self.img_path)

        sc.logger.info('添加默认动态字幕')
        time.sleep(3)

        sc.logger.info('选择添加的"动态字幕"')
        sc.driver.find_element_by_xpath(
            "//*/XCUIElementTypeOther/XCUIElementTypeImage[1]").click()

        sc.logger.info('输入字幕')
        el_text_input = sc.driver.find_element_by_ios_predicate(
            "type == 'XCUIElementTypeTextView' AND value == '请输入动态文字'")
        el_text_input.clear()
        el_text_input.send_keys("input text test")
        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("vivavideo editor common ok").click()

        sc.logger.info('点击左侧"暂停"按钮')
        sc.driver.find_element_by_name(
            "vivavideo editor framebar paus").click()
        sc.capture_screen(fun_name, self.img_path)

        sc.logger.info('点击底部"确认"按钮')
        sc.driver.find_element_by_name(
            "vivavideo editor framebar comp").click()
        sc.capture_screen(fun_name, self.img_path)
Exemple #17
0
    def test_home_03_studio(self):
        """首页-我的工作室."""
        fun_name = 'test_home_studio'

        sc.logger.info('进入我的工作室')
        sc.driver.find_element_by_name("更多草稿").click()
        time.sleep(1)
        sc.capture_screen(fun_name, self.img_path)

        sc.logger.info('打开草稿工程')
        el_draft = sc.driver.find_element_by_xpath(
            "//*/XCUIElementTypeImage[1]")
        el_draft.click()
        sc.driver.find_element_by_name("xiaoying com back").click()
        time.sleep(0.5)
        try:
            sc.driver.find_element_by_name("vivavideo gallery back n").click()
        except NoSuchElementException:
            sc.logger.info('此草稿视频为拍摄视频,返回的是拍摄页面')
            sc.driver.find_element_by_name(
                "vivavideo camera tool icon clo").click()

        sc.logger.info('保存并上传')
        el_publish = sc.driver.find_element_by_name("保存/上传")
        el_publish.click()
        time.sleep(1)
        sc.capture_screen(fun_name, self.img_path)
        sc.driver.find_element_by_name("vivavideo com nav back n").click()

        sc.logger.info('删除草稿-否')
        el_del_draft = sc.driver.find_element_by_name(
            "vivavideo tool studio delete n")
        el_del_draft.click()
        sc.driver.find_element_by_name("否").click()

        sc.logger.info('删除草稿-是')
        el_del_draft.click()
        sc.driver.find_element_by_name("是").click()
        sc.capture_screen(fun_name, self.img_path)

        sc.logger.info('Guide view')
        try:
            sc.driver.find_element_by_name(
                "vivavideo tool studio list n").click()
            sc.capture_screen(fun_name, self.img_path)
        except NoSuchElementException:
            sc.logger.info('当前已是Guide view')

        sc.logger.info('List view')
        time.sleep(0.5)
        try:
            sc.driver.find_element_by_name(
                "vivavideo tool studio list2 n").click()
            sc.capture_screen(fun_name, self.img_path)
        except NoSuchElementException:
            sc.logger.info('当前已是List view')

        sc.logger.info('返回创作中心')
        sc.driver.find_element_by_name("vivavideo com nav back n").click()
Exemple #18
0
    def test_edit_05_publish(self):
        """发布页-发布."""
        sc.logger.info('发布页-发布')
        fun_name = 'test_edit_publish'

        sc.logger.info('清空标题')
        el_title_clear = sc.driver.find_element_by_xpath("//*/XCUIElementTypeScrollView/XCUIElementTypeTextView")
        el_title_clear.clear()

        sc.logger.info('空标题发布')
        sc.driver.find_element_by_name("保存/上传").click()
        sc.capture_screen(fun_name,self.img_path)
        time.sleep(0.5)

        sc.logger.info('输入标题')
        el_title = sc.driver.find_element_by_xpath("//XCUIElementTypeStaticText[@name='请输入标题,你的作品记录了什么?']")
        el_title.clear()
        el_title.send_keys('input video title test')
        time.sleep(1)
        sc.capture_screen(fun_name, self.img_path)

        sc.logger.info('输入描述')
        el_des = sc.driver.find_element_by_xpath("//*/XCUIElementTypeOther[1]/XCUIElementTypeTextView")
        el_des.clear()
        el_des.send_keys("input description text")
        time.sleep(0.5)
        try:
            sc.driver.find_element_by_xpath("//XCUIElementTypeButton[@name='Done']").click()
        except NoSuchElementException:
            sc.logger.info("当前键盘为中文键盘")
            sc.driver.find_element_by_xpath("完成").click()
        sc.capture_screen(fun_name, self.img_path)

        sc.logger.info('发布')
        sc.driver.find_element_by_name("保存/上传").click()

        sc.logger.info('选择480P导出')
        sc.driver.find_element_by_name("清晰 480P").click()

        sc.logger.info('开始导出并上传')
        try:
            WebDriverWait(sc.driver, 60).until(
                lambda V_exprot: V_exprot.find_element_by_name('发现'))
            sc.capture_screen(fun_name, self.img_path)

            sc.logger.info('点击"我"查看发布的视频')
            sc.driver.find_element_by_name("我").click()  # 个人页
            time.sleep(2)
            sc.capture_screen(fun_name,self.img_path)
        except Exception as e:
            sc.logger.error('发布失败',e)
            return False

        sc.logger.info('点击创作中心主按钮')
        try:
            sc.driver.find_element_by_xpath("//XCUIElementTypeImage[@name='camerta_n']").click()
        except NoSuchElementException:
            sc.driver.find_element_by_xpath("//XCUIElementTypeImage[@name='camerta_f']").click()
Exemple #19
0
    def test_template_08_transition(self):
        """素材中心-转场."""
        sc.logger.info('素材中心-转场')
        fun_name = 'test_template_transition'

        time.sleep(1)
        sc.logger.info('点击"素材中心"')
        sc.driver.find_element_by_name("素材中心").click()

        sc.logger.info('向上滑动')
        start_x = self.width // 2
        start_bottom = self.height - self.height // 5
        sc.swipe_by_ratio(start_x, start_bottom, 'up', 0.6, 500)

        sc.logger.info('点击"转场"')
        time.sleep(0.5)
        try:
            sc.driver.find_element_by_name("转场").click()
        except NoSuchElementException:
            sc.logger.info('仍需要上滑显示转场分类')
            sc.swipe_by_ratio(start_x, start_bottom, 'up', 0.6, 500)
            sc.driver.find_element_by_name("转场").click()
        sc.capture_screen(fun_name, self.img_path)

        sc.logger.info('下载“转场”')
        btn_download = 'vivavideo material download n'
        self.template_download('转场', btn_download)

        sc.logger.info('使用“转场”')
        self.template_use('转场')
        time.sleep(2)

        sc.logger.info('确认使用该下载的转场')
        sc.driver.find_element_by_name("xiaoying com ok").click()
        time.sleep(0.5)
        sc.capture_screen(fun_name, self.img_path)

        sc.logger.info('点击“存草稿”按钮')
        time.sleep(1)
        sc.driver.find_element_by_name("存草稿").click()

        sc.logger.info('点击左上角返回按钮退回创作中心')
        time.sleep(1)
        sc.driver.find_element_by_name("vivavideo com nav back n").click()

        sc.logger.info('点击"素材中心"')
        sc.driver.find_element_by_name("素材中心").click()

        sc.logger.info('向上滑动')
        sc.swipe_by_ratio(start_x, start_bottom, 'up', 0.6, 500)

        sc.logger.info('点击"转场"')
        time.sleep(0.5)
        sc.driver.find_element_by_name("转场").click()

        sc.logger.info('删除下载的转场')
        btn_del = 'vivavideo material delete n'
        self.theme_manager('转场', btn_del)
Exemple #20
0
    def test_create_craft(self):
        """创建草稿视频."""
        sc.logger.info('创建草稿视频')
        fun_name = 'test_preview_create'

        time.sleep(5)
        sc.logger.info('点击创作中心主按钮')
        try:
            sc.driver.find_element_by_xpath(
                "//XCUIElementTypeImage[@name='camerta_n']").click()
        except NoSuchElementException:
            sc.driver.find_element_by_xpath(
                "//XCUIElementTypeImage[@name='camerta_f']").click()

        sc.logger.info('点击视频剪辑')
        sc.driver.find_element_by_name("视频剪辑").click()
        time.sleep(1)
        try:
            sc.driver.find_element_by_name("跳过").click()
            time.sleep(1)
            sc.driver.find_element_by_name("视频剪辑").click()
        except NoSuchElementException:
            sc.logger.info('已跳过订阅页面')

        sc.logger.info("授权小影访问相册和媒体资料")
        try:
            sc.driver.find_element_by_name("好").click()  # 授权相册
            time.sleep(2)
            sc.driver.find_element_by_name("好").click()  # 授权媒体资料库
        except NoSuchElementException:
            sc.logger.info("已授权")

        sc.logger.info('添加视频')
        el_video = sc.driver.find_element_by_accessibility_id(
            "vivavideo_tool_gallery_audio_type_video")
        el_video.click()
        sc.driver.find_element_by_name("添加 0").click()

        sc.logger.info('添加图片')
        sc.driver.find_element_by_name("视频").click()
        sc.driver.find_element_by_name("图片").click()
        el_imgs = sc.driver.find_elements_by_xpath("//*/XCUIElementTypeImage")
        i = 1
        while i < len(el_imgs):
            el_imgs[i].click()
            i = i + 1

        sc.logger.info('点击下一步,进入预览页')
        sc.driver.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('返回创作中心主界面')
        time.sleep(1)
        sc.driver.find_element_by_name("vivavideo com nav back n").click()
Exemple #21
0
    def test_camera_self(self):
        """拍摄-自拍视频(全屏)."""
        sc.logger.info('拍摄-美颜趣拍(全屏)')
        fun_name = 'test_camera_self'

        sc.logger.info('点击“美颜趣拍”')
        ba.home_first_click("美颜趣拍")
        sc.capture_screen(fun_name, self.img_path)

        # 第一次从次要功能位打开自拍,拍摄按钮是音乐视频的控件,所以先关闭再打开
        sc.logger.info('退出拍摄')
        time.sleep(1)
        WebDriverWait(sc.driver, 5, 1).until(lambda x: x.find_element_by_name(
            iOS_elements.el_cam_close)).click()

        sc.logger.info('点击“美颜趣拍”')
        WebDriverWait(
            sc.driver,
            5).until(lambda x: x.find_element_by_name('美颜趣拍')).click()

        sc.logger.info('点击人脸贴纸icon')
        ba.find_element_click('name', 10, iOS_elements.el_sticker_icon)
        sc.capture_screen(fun_name, self.img_path)

        sc.logger.info('下载人脸贴纸')
        WebDriverWait(sc.driver, 5).until(lambda x: x.find_element_by_xpath(
            iOS_elements.el_sticker_download)).click()
        sc.capture_screen(fun_name, self.img_path)

        sc.logger.info('使用下载的人脸贴纸')
        ba.find_element_click('xpath', 10, iOS_elements.el_sticker_used)
        sc.capture_screen(fun_name, self.img_path)

        sc.logger.info('点击屏幕消除贴纸控件')
        actions = TouchAction(sc.driver)
        actions.tap(None, 200, 200).release().perform()
        sc.capture_screen(fun_name, self.img_path)

        # 点拍
        sc.logger.info('拍摄一段5s的视频')
        btn_rec = WebDriverWait(sc.driver, 10).until(
            lambda x: x.find_element_by_xpath(iOS_elements.el_cp_self))
        ba.video_capture('点拍', btn_rec, 5)

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

        sc.logger.info('点击“存草稿”按钮')
        sc.driver.find_element_by_name("存草稿").click()
        sc.logger.info('拍摄-美颜趣拍(全屏)测试完成')
Exemple #22
0
    def test_template_06_sticker(self):
        """素材中心-动画贴纸."""
        sc.logger.info('素材中心-动画贴纸')
        fun_name = 'test_template_sticker'

        time.sleep(1)
        sc.logger.info('点击"素材中心"')
        sc.driver.find_element_by_name("素材中心").click()

        sc.logger.info('向上滑动')
        start_x = self.width // 2
        start_bottom = self.height - self.height // 5
        sc.swipe_by_ratio(start_x, start_bottom, 'up', 0.6, 500)

        sc.logger.info('点击"动画贴纸"')
        time.sleep(0.5)
        sc.driver.find_element_by_name("动画贴纸").click()
        sc.capture_screen(fun_name, self.img_path)

        sc.logger.info('下载“动画贴纸”')
        btn_download = 'vivavideo material download n'
        self.template_download('动画贴纸', btn_download)

        sc.logger.info('使用“动画贴纸”')
        self.template_use('动画贴纸')
        time.sleep(2)

        sc.logger.info('确认使用该下载的贴纸')
        sc.driver.find_element_by_name("xiaoying com ok").click()
        time.sleep(0.5)
        sc.driver.find_element_by_name("xiaoying com ok").click()
        sc.capture_screen(fun_name, self.img_path)

        sc.logger.info('点击“存草稿”按钮')
        time.sleep(1)
        sc.driver.find_element_by_name("存草稿").click()

        sc.logger.info('点击左上角返回按钮退回创作中心')
        time.sleep(1)
        sc.driver.find_element_by_name("vivavideo com nav back n").click()

        sc.logger.info('点击"素材中心"')
        sc.driver.find_element_by_name("素材中心").click()

        sc.logger.info('向上滑动')
        sc.swipe_by_ratio(start_x, start_bottom, 'up', 0.6, 500)

        sc.logger.info('点击"动画贴纸"')
        time.sleep(0.5)
        sc.driver.find_element_by_name("动画贴纸").click()

        sc.logger.info('删除下载的贴纸')
        btn_del = 'vivavideo material delete n'
        self.theme_manager('动画贴纸', btn_del)
Exemple #23
0
    def test_export_03_1080P(self):
        """导出-保存到相册-1080P-三次导出."""
        sc.logger.info('导出-保存到相册-1080P')
        fun_name = 'test_export_third'

        sc.logger.info('点击“保存到相册”')
        ba.export_to_album()
        sc.capture_screen(fun_name, self.img_path)

        sc.logger.info('点击“超清 1080P”')
        ba.export_video("超清 1080P")
        sc.logger.info('导出-保存到相册-1080P测试完成')
Exemple #24
0
    def test_export_04_gif(self):
        """导出-保存到相册-GIF."""
        sc.logger.info('导出-保存到相册-GIF')
        fun_name = 'test_export_gif'

        sc.logger.info('点击“保存到相册”')
        ba.export_to_album()
        sc.capture_screen(fun_name, self.img_path)

        sc.logger.info('点击“GIF”')
        ba.export_gif('320P', '10F/s')
        sc.logger.info('导出-保存到相册-GIF测试完成')
Exemple #25
0
    def test_text_02_download(self):
        """更换封面-下载字幕/字体."""
        sc.logger.info('更换封面-下载字幕/字体')
        fun_name = 'test_text_download'

        time.sleep(1)
        sc.logger.info('点击"更换封面"')
        sc.driver.find_element_by_name("更换封面").click()
        time.sleep(3)

        sc.logger.info('点击"字幕"按钮')
        sc.driver.find_element_by_name("cover tool preview caption n").click()

        sc.logger.info('点击"下载更多"字幕')
        sc.driver.find_element_by_name("xiaoying itembar down more").click()

        sc.logger.info('点击"下载"按钮')
        el_text_download = sc.driver.find_element_by_name(
            "vivavideo material download n")
        el_text_download.click()
        time.sleep(10)
        sc.capture_screen(fun_name, self.img_path)

        sc.logger.info('使用下载的字幕')
        el_text_use = sc.driver.find_element_by_name("使用")
        try:
            el_text_use.click()
            time.sleep(0.5)
        except NoSuchElementException:
            sc.logger.info('字幕下载未完成,继续等待5s')
            time.sleep(5)
            el_text_use.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('下载任意"字体"')
        el_text_download = sc.driver.find_element_by_accessibility_id(
            "vivavideo_camera_tool_icon_sticker_download_nrm")
        try:
            el_text_download.click()
            sc.capture_screen(fun_name, self.img_path)
        except NoSuchElementException:
            sc.logger.info('当前页面已无为下载"字体"')

        sc.logger.info('放弃编辑并返回发布页')
        sc.driver.find_element_by_name("xiaoying itembar close").click()
        sc.driver.find_element_by_name(
            "vivavideo editor common cancel").click()
        sc.capture_screen(fun_name, self.img_path)
Exemple #26
0
    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('剪辑-特效-删除&放弃测试完成')
Exemple #27
0
    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('剪辑-多段配乐-添加测试完成')
Exemple #28
0
    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('剪辑-画中画-图片添加测试完成')
Exemple #29
0
    def test_fans_home(self):
        """点击粉丝头像进入粉丝空间测试."""
        sc.logger.info('粉丝空间空间测试')
        fun_name = 'test_fans_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)
        assert avatar_img is not None
Exemple #30
0
    def test_edit_fx_03_cancel(self):
        """剪辑-特效-放弃."""
        sc.logger.info('剪辑-特效-放弃')
        fun_name = 'test_edit_fx_cancel'

        sc.logger.info('点击“特效”')
        time.sleep(1)
        sc.driver.find_element_by_name("特效").click()

        sc.logger.info('点击"添加"按钮')
        sc.driver.find_element_by_name("vivavideo tool fx add n").click()
        sc.capture_screen(fun_name, self.img_path)

        sc.logger.info('选择一个"特效"使用')
        el_fx = sc.driver.find_element_by_xpath(
            "//*/XCUIElementTypeOther[5]//*/XCUIElementTypeOther/XCUIElementTypeImage")
        el_fx.click()
        sc.capture_screen(fun_name, self.img_path)

        sc.logger.info('点击右上角保存')
        sc.driver.find_element_by_name("xiaoying com ok").click()
        sc.capture_screen(fun_name, self.img_path)

        sc.logger.info('点击“左上角X”取消')
        sc.driver.find_element_by_name("xiaoying com cancel").click()
        sc.capture_screen(fun_name, self.img_path)

        sc.logger.info('确认取消')
        sc.driver.find_element_by_name("确认").click()
        time.sleep(3)

        sc.logger.info('存草稿并返回创作页首页')
        sc.driver.find_element_by_name("存草稿").click()
        time.sleep(1)
        sc.driver.find_element_by_name("vivavideo com nav back n").click()