def testPlayVideoOnline(self): #d.start_activity('--activity-clear-task', component='com.duokan.duokantv/.MainActivity') assert d(text="在线影视").exists, 'Online Video icon not found!' d(text="在线影视").sibling(className='android.view.View').click.wait() #menu_hot_highlight_focus_png = os.path.join(PIC_DIR, 'menu_hot_highlight_focus.png') #menu_hot_highlight_nofocus_png = os.path.join(PIC_DIR, 'menu_hot_highlight_nofocus.png') #preview_shoucang_png = os.path.join(PIC_DIR, 'video_preview_sub_shoucang.png') #preview_pinglun_png = os.path.join(PIC_DIR, 'video_preview_sub_pinglun.png') if d.find('menu_hot_highlight_focus.png', timeout=30) : d.press('down') d.sleep(2) d.press('enter') elif d.find('menu_hot_highlight_nofocus.png', timeout=30): d.press('enter') else: assert False, 'launch video failed' d.expect('video_preview_sub_shoucang.png', timeout=30) d.sleep(2) d.press('enter') assert d(resourceId='com.duokan.duokantv:id/main_frame').wait.exists(timeout=30000), 'video not start!' #assert not d.find('video_preview_sub_shoucang.png', timeout=30), 'video not start!' d.sleep(120) d.press('back') d.expect('video_preview_sub_shoucang.png', timeout=30) d.press('back')
def testPlayOnlineVideoLongBACK(self): """ launch app store and exit """ #d.start_activity('--activity-clear-task', component='com.duokan.duokantv/.MainActivity') assert d(text="在线影视").exists, 'Online Video icon not found!' d(text="在线影视").sibling(className='android.view.View').click.wait() #menu_hot_highlight_focus_png = os.path.join(PIC_DIR, 'menu_hot_highlight_focus.png') #menu_hot_highlight_nofocus_png = os.path.join(PIC_DIR, 'menu_hot_highlight_nofocus.png') #preview_shoucang_png = os.path.join(PIC_DIR, 'video_preview_sub_shoucang.png') #preview_pinglun_png = os.path.join(PIC_DIR, 'video_preview_sub_pinglun.png') if d.find('menu_hot_highlight_focus.png', threshold=0.01, timeout=30): d.press('down') d.sleep(2) d.press('enter') elif d.find('menu_hot_highlight_nofocus.png', timeout=30): d.press('enter') else: assert False, 'launch video failed' d.expect('video_preview_sub_shoucang.png', threshold=0.05, timeout=30) d.sleep(2) d.press('enter') assert d(resourceId='com.duokan.duokantv:id/main_frame').wait.exists( timeout=30000), 'video not start!' #assert not d.find('video_preview_sub_shoucang.png', timeout=30), 'video not start!' d.sleep(1200) assert not d(textContains='播放失败').exists or not d( textContains='无法获取视频地址').exists or not d( textContains="正在读取视频信息").exists, 'Video start failed!' d.press('back') d.expect('video_preview_sub_shoucang.png', threshold=0.05, timeout=30) d.press('back')
def testLaunchAndExitVideo(self): assert d(text="在线影视").exists, 'Online Video icon not found!' d(text="在线影视").sibling(className='android.view.View').click.wait() #menu_hot_highlight_focus_png = os.path.join(PIC_DIR, 'menu_hot_highlight_focus.png') #menu_hot_highlight_nofocus_png = os.path.join(PIC_DIR, 'menu_hot_highlight_nofocus.png') if d.find('menu_hot_highlight_focus.png', timeout=30) : pass elif d.find('menu_hot_highlight_nofocus.png', timeout=30): pass else: assert False, 'open online video failed!' d.press('back') assert d(text="在线影视").wait.exists(timeout=10000), 'exit from online video failed!'
def testLaunchAndExitVideo(self): assert d(text="在线影视").exists, 'Online Video icon not found!' d(text="在线影视").sibling(className='android.view.View').click.wait() #menu_hot_highlight_focus_png = os.path.join(PIC_DIR, 'menu_hot_highlight_focus.png') #menu_hot_highlight_nofocus_png = os.path.join(PIC_DIR, 'menu_hot_highlight_nofocus.png') if d.find('menu_hot_highlight_focus.png', timeout=50): pass elif d.find('menu_hot_highlight_nofocus.png', timeout=50): pass else: assert False, 'open online video failed!' d.press('back') assert d(text="在线影视").wait.exists( timeout=10000), 'exit from online video failed!'
def testPlayOnlineVideo(self): """ launch app store and exit """ #d.start_activity('--activity-clear-task', component='com.duokan.duokantv/.MainActivity') assert d(text="在线影视").exists, 'Online Video icon not found!' d(text="在线影视").sibling(className='android.view.View').click.wait() #menu_hot_highlight_focus_png = os.path.join(PIC_DIR, 'menu_hot_highlight_focus.png') #menu_hot_highlight_nofocus_png = os.path.join(PIC_DIR, 'menu_hot_highlight_nofocus.png') #preview_shoucang_png = os.path.join(PIC_DIR, 'video_preview_sub_shoucang.png') #preview_pinglun_png = os.path.join(PIC_DIR, 'video_preview_sub_pinglun.png') if d.find('menu_hot_highlight_nofocus.png', timeout=30): d.press('left') d.sleep(3) d.press('left') d.sleep(3) d.press('left') d.sleep(3) d.press('right') d.sleep(3) d.press('enter') d.sleep(5) d.press('enter') elif d.find('menu_hot_highlight_focus.png', threshold=0.01, timeout=30) : d.press('down') d.sleep(3) d.press('right') d.sleep(3) d.press('enter') d.sleep(5) d.press('enter') else: assert False, 'launch video failed' d.expect('video_preview_sub_shoucang2.png', threshold=0.05 ,timeout=30) d.sleep(2) d.press('enter') assert d(resourceId='com.duokan.duokantv:id/main_frame').wait.exists(timeout=30000), 'video not start!' #assert not d.find('video_preview_sub_shoucang.png', timeout=30), 'video not start!' d.sleep(180) assert not d(textContains='播放失败').exists or not d(textContains='无法获取视频地址').exists or not d(textContains="正在读取视频信息").exists, 'Video start failed!' d.press('back') d.expect('video_preview_sub_shoucang2.png', threshold=0.05 , timeout=30) d.press('back')