Exemplo n.º 1
0
def step_impl(context):
    # 获取参数
    chk_is_playing = context.table[0]['chk_is_playing']

    # 获取视频广告控件
    adtime = Video().get_aqy_player_top_adtime()

    if adtime.wait.exists(timeout=5000):
        adtime.wait.gone(timeout=60000)

    # 获取当前播放时间控件
    oldTime = Video().get_aqy_player_currentTime()
    old_time = ''
    if oldTime.wait.exists():
        old_time = oldTime.text
    else:
        uit.raise_Exception_info('当前播放时间控件不存在')

    time.sleep(5)

    newTime = Video().get_aqy_player_currentTime()
    new_time = ''
    if newTime.wait.exists():
        new_time = newTime.text
    else:
        uit.raise_Exception_info('当前播放时间控件不存在')

    if str(new_time == old_time).lower() == str(chk_is_playing).lower():
        uit.raise_Exception_info('视频播放状态不一致')
Exemplo n.º 2
0
def step_impl(context):
    #获取收藏控件
    fav_ele = Video().get_aqy_player_fav()
    if fav_ele.wait.exists():
        fav_ele.click()
    else:
        uit.raise_Exception_info('视频收藏控件不存在')
Exemplo n.º 3
0
def step_impl(context):
    # 获取暂停或者播放控件
    pause_btn = Video().get_aqy_pause_btn()

    if pause_btn.wait.exists():
        pause_btn.click()
    else:
        uit.raise_Exception_info('播放或者暂停控件不存在')
Exemplo n.º 4
0
def step_impl(context):  # 修改 清空视频搜索框并验证
    # 获取清除控件
    clear_ele = Video().get_aqy_search_his_clear()
    if clear_ele.wait.exists():
        clear_ele.click.wait()
    else:
        uit.raise_Exception_info('清除搜索记录控件不存在')

    # 验证是否清除完成
    clear_ele = Video().get_aqy_search_his_clear()
    if clear_ele.exists:
        uit.raise_Exception_info('清空搜索记录失败')
Exemplo n.º 5
0
def step_impl(context):  # 新加步骤
    # 获取左侧菜单
    left_menu = Video().get_aqy_left_menu_frame()
    if left_menu.wait.exists():
        x = left_menu.info['bounds']['right']
        y = left_menu.info['bounds']['bottom']
        d.swipe(x, int(y) / 2, 0, int(y) / 2, 15)

    top_menu = Video().get_aqy_home_top_menu()
    if top_menu.wait.exists():
        top_menu.click.wait()
    else:
        uit.raise_Exception_info('爱奇艺顶部菜单不存在')
Exemplo n.º 6
0
def step_impl(context):
    # 获取视频搜索控件
    search = Video().get_aqy_search()
    if search.wait.exists():
        search.click.wait()
    else:
        uit.raise_Exception_info('视频搜索控件不存在')
Exemplo n.º 7
0
def step_impl(context):
    # 获取接受返回值的参数
    param = context.table[0]['o_result']
    video_name = Video().get_aqy_search_his_title()
    if video_name.wait.exists():
        ht.set_context_map(param, video_name[0].text)
    else:
        uit.raise_Exception_info('搜索记录为空')
Exemplo n.º 8
0
def step_impl(context):
    # 获取入参
    video_name = context.table[0]['video_name']

    list_view = Video().get_aqy_search_result_list()
    title_ele = Video().get_aqy_search_result_title()

    if title_ele.wait.exists(timeout=ht.LONG_TIME_OUT):
        if list_view.scroll.vert.to(text=video_name):
            for t in title_ele:
                if t.text.strip() == video_name:
                    t.click.wait()
                    break
        else:
            uit.raise_Exception_info('搜索视频不存在')
    else:
        uit.raise_Exception_info('视频搜索结果为空')
Exemplo n.º 9
0
def step_impl(context):  # 修改
    # 获取接受出参的参数
    param = context.table[0]['o_result']

    ele = Video().get_aqy_recommend_right_up_title()
    if ele.wait.exists():
        ht.set_context_map(param, ele.text)
        ele.click.wait()
    else:
        uit.raise_Exception_info('爱奇艺推荐视频不存在')
Exemplo n.º 10
0
def step_impl(context):
    # 获取出参
    param = context.table[0]['o_result']

    # 获取第一个视频名称
    ele = Video().get_aqy_mine_his_video_title()
    if ele.wait.exists():
        ht.set_context_map(param, ele[0].text.strip())
    else:
        uit.raise_Exception_info('播放记录为空')
Exemplo n.º 11
0
def step_impl(context):
    # 获取接受返回值参数
    param = context.table[0]['o_result']
    video_name = Video().get_aqy_search_hot_title()
    if video_name.wait.exists():
        idx = random.randint(0, len(video_name) - 1)
        ht.set_context_map(param, video_name[idx].text)
        video_name[idx].click.wait()
    else:
        uit.raise_Exception_info('热门搜索记录为空')
Exemplo n.º 12
0
def step_impl(context):
    flag = False
    # 获取参数
    param = context.table[0]['search_word']
    ele = Video().get_aqy_search_result_title()
    for e in ele:
        if param in e.text.strip():
            flag = True
            break

    if not flag:
        uit.raise_Exception_info('搜索视频没有期望的结果')
Exemplo n.º 13
0
def step_impl(context):
    # 获取入参
    key_word = context.table[0]['keyword']
    input_ele = Video().get_aqy_search_input()
    if input_ele.wait.exists():
        input_ele.clear_text()
        input_ele.set_text(ht.unicode_input(key_word))
    else:
        uit.raise_Exception_info('视频搜索输入框控件不存在')
Exemplo n.º 14
0
def step_impl(context):
    # 获取播放视频名称
    video_name = context.table[0]['video_name']
    # 从列表中查找指定视频并播放
    ele = Video().get_aqy_mine_his_video_title()
    if ele.wait.exists():
        # if ele.scroll.vert.to(text=video_name):
        for e in ele:
            if e.text.strip() == video_name:
                d(text=video_name).click.wait()
                break
        else:
            uit.raise_Exception_info('没有查找到指定《' + video_name + '》视频')
    else:
        uit.raise_Exception_info('播放记录为空')
Exemplo n.º 15
0
def step_impl(context):
    exists_flag = False
    # 获取视频名称
    video_name = context.table[0]['video_name']
    # 查找并播放本地视频
    local_video = Video().get_aqy_mine_local_video_title()
    if local_video.wait.exists():
        for lv in local_video:
            if lv.text == video_name:
                lv.click.wait()
                exists_flag = True
                break
    else:
        uit.raise_Exception_info('本地视频列表为空')

    if not exists_flag:
        uit.raise_Exception_info('没有找到指定视频')
Exemplo n.º 16
0
def step_impl(context):
    # 获取参数
    param = context.table[0]['chk_name']
    if param.startswith('o_'):
        chk_video_name = ht.get_context_map(param)
    else:
        chk_video_name = param

    video_title = Video().get_aqy_playing_title()
    if not video_title.wait.exists():
        uit.raise_Exception_info('视频名称控件不存在')

    video_name = video_title.text

    if not chk_video_name == video_name:
        uit.raise_Exception_info('视频文件名称不一致,期望值为《' + chk_video_name +
                                 '》,实际值为《' + video_name + '》')
Exemplo n.º 17
0
def step_impl(context):
    flag = False
    # 获取入参 视频名称,是否收藏
    video_name = context.table[0]['chk_video_name']
    is_faved = context.table[0]['is_faved']
    if video_name.startswith('o_'):
        video_name = ht.get_context_map(video_name)

    # 获取我的收藏视频title
    video_title = Video().get_aqy_mine_fav_video_title()
    if video_title.wait.exists():
        for vt in video_title:
            if video_name == vt.text.strip():
                flag = True
                break
    else:
        uit.raise_Exception_info('我的收藏记录为空')

    if not str(flag).lower() == str(is_faved).lower():
        uit.raise_Exception_info('视频是否收藏验证失败')
Exemplo n.º 18
0
    def back_to_launcher(self):
        # 获取当前包名
        package_name = d.info['currentPackageName']

        while package_name != 'com.qinggan.app.launcher':
            if 'com.qinggan.app.carmodule.ui'.__eq__(package_name):
                pass
            elif 'com.qinggan.app.serviceui'.__eq__(package_name):
                pass
            elif 'com.qiyi.video.auto'.__eq__(package_name):
                Video().back_to_launcher()
            elif 'com.pateonavi.naviapp'.__eq__(package_name):
                Navi().back_to_launcher()
            elif 'com.qinggan.app.music'.__eq__(package_name):
                Audio().back_to_launcher()
            elif 'cn.kuwo.kwmusiccar'.__eq__(package_name):
                Audio().back_from_kuwo()
            elif 'com.qinggan.app.radio'.__eq__(package_name):
                Radio().back_to_launcher()
            elif 'com.qinggan.app.qplay'.__eq__(package_name):
                Qplay().back_to_launcher()
            elif 'com.qinggan.app.setting'.__eq__(package_name):
                SysSetting().back_to_launcher()
            elif 'com.qinggan.app.ivokaUI'.__eq__(package_name):
                time.sleep(10)
            elif 'com.qinggan.app.gesture'.__eq__(package_name):
                Gesture().back_to_launcher()
            else:
                if uit.crash_handler():
                    print('回到主界面有CRASH')
                else:
                    uit.raise_Exception_info('应用停留界面没有返回主界面处理,请联系维护人员添加')
                    break

            package_name = d.info['currentPackageName']
        # 在主界面
        Launcher().back_to_main()
        # 升级后取消修复
        d.click(1150, 80)
        time.sleep(2)
Exemplo n.º 19
0
def step_impl(context):
    ele = Video().get_aqy_menu_category_recommend()
    if ele.wait.exists():
        ele.click.wait()
    else:
        uit.raise_Exception_info('爱奇艺推荐栏目控件不存在')
Exemplo n.º 20
0
def step_impl(context):
    ele = Video().get_aqy_menu_category()
    if ele.wait.exists():
        ele.click()
    else:
        uit.raise_Exception_info('爱奇艺频道菜单控件不存在')
Exemplo n.º 21
0
def step_impl(context):
    mine = Video().get_aqy_menu_mine()
    if mine.wait.exists():
        mine.click()
    else:
        uit.raise_Exception_info('我的视频控件不存在')
Exemplo n.º 22
0
def step_impl(context):  # 新加步骤
    fav = Video().get_aqy_menu_mine_fav()
    if fav.wait.exists():
        fav.click.wait()
    else:
        uit.raise_Exception_info('我的收藏控件不存在')
Exemplo n.º 23
0
def step_impl(context):  # 新加步骤
    his = Video().get_aqy_menu_mine_his()
    if his.wait.exists():
        his.click.wait()
    else:
        uit.raise_Exception_info('播放记录控件不存在')
Exemplo n.º 24
0
def step_impl(context):  # 新加步骤
    local = Video().get_aqy_menu_mine_local_video()
    if local.wait.exists():
        local.click.wait()
    else:
        uit.raise_Exception_info('本地视频控件不存在')