def testVisitWebPage4G(self): # turn off wifi self._setWifistatus('off') d.sleep(3) #Launch Browser self._launchBrowser() # visite webpage d(resourceId = 'com.android.browser:id/url', text = '输入网址').set_text(TOP5[3]) d.press('enter') d.expect(CHECK_POINT[3], timeout=15) # browse webpage d.swipe(1000,1300,1000,600,10) d.sleep(1) d.swipe(1000,1300,1000,600,10) d.sleep(1) d.swipe(1000,600,1000,1300,10) d.sleep(1) d.swipe(1000,600,1000,1300,10) d.sleep(1) # turn on wifi self._setWifistatus('on') d.start_activity(component='com.android.browser/.BrowserActivity') assert d(resourceId = 'com.android.browser:id/switch_btn').wait.exists(timeout = 5000),'Launch browser failed in 5s!'
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 testMenuKeyOfRotateRight(self): """ Summary:This case test rotate right burst pictures by menu key in burst view. Precondition: There are burst pictures in sdcard Steps: 1. Launch Intel gallery and enter to burst view 2. Tap menu -> Rotate right,check Rotate right progress pops up. """ self._burstMenuOption('Rotate right') d.expect('burstview.png')
def testWebNavigation(self): #Launch Browser self._launchBrowser() #Visite webpage d(resourceId = 'com.android.browser:id/url', text = '输入网址').set_text('wap.sohu.com') d.press('enter') d.expect('Web_Navigation_News.png',timeout=10, msg = 'Loading webpage failed in 10s!') #Click Navigation '新闻' d.click('Web_Navigation_News.png')
def testMOCall(self): commands.getoutput('adb shell am start -n com.android.contacts/.activities.DialtactsActivity') d(resourceId = 'com.android.contacts:id/one_classic', description = '一').click.wait() d(resourceId = 'com.android.contacts:id/zero_classic', description = '零').click.wait() d(resourceId = 'com.android.contacts:id/zero_classic', description = '零').click.wait() d(resourceId = 'com.android.contacts:id/eight_classic', description = '八').click.wait() d(resourceId = 'com.android.contacts:id/six_classic', description = '六').click.wait() d(resourceId = 'com.android.contacts:id/call_classic').click.wait() assert d(text='结束').wait.exists(timeout=15000),'Calling failed!' d(text='结束').click.wait() d.sleep(3) d.expect('10086.png')
def testLaunchAndExitCloudGallery(self): """ launch app store and exit """ for i in xrange(8): d.press('right') assert d(text="云相册").exists, 'Cloud Gallery icon not found!' d(text="云相册").click.wait() #gallery_check_png = os.path.join(PIC_DIR, 'cloudgallery_sub_1.png') d.expect('cloudgallery_sub_1.png', timeout=20000) d.press('back') assert d(text="云相册").wait.exists(timeout=10000), 'exit from cloud gallery failed!'
def testVisitTop5(self): #Launch Browser self._launchBrowser() #Visite TOP5 webpage for i in range(5): d(resourceId = 'com.android.browser:id/url', text = '输入网址').set_text(TOP5[i]) d.sleep(2) d.press('enter') if d(textContains = '需要了解您的位置信息').wait.exists(): d(text = '拒绝').click.wait() d.expect(CHECK_POINT[i],timeout=10, msg = 'Loading webpage %s failed in 10s!'%TOP5[i]) d(resourceId = 'com.android.browser:id/newtab_btn').click.wait()
def testLaunchAndExitCloudGallery(self): """ launch app store and exit """ for i in xrange(8): d.press('right') assert d(text="云相册").exists, 'Cloud Gallery icon not found!' d(text="云相册").click.wait() #gallery_check_png = os.path.join(PIC_DIR, 'cloudgallery_sub_1.png') d.expect('cloudgallery_sub_1.png', timeout=20000) d.press('back') assert d(text="云相册").wait.exists( timeout=10000), 'exit from cloud gallery failed!'
def testQuickSwitchtoSinglemode(self): """ Summary:testQuickSwitchtoSinglemode: Quick Switch to Single mode Steps: 1.Launch single capture activity 2.press change mode and then press Video icon to enter video 3.press change mode icon then choose camera group """ # steps 2 sm.switchcamera('video') # change video mode d.expect('video.png') time.sleep(1) # steps 3 sm.switchcamera('single') # change camera mode # check camera mode assert d(resourceId = 'com.intel.camera22:id/mode_button').wait.exists(timeout = 3000)
def testcaseCaptureSmileImage8M500TimesBackCamera(self): """ Capture Smile Image 8M 500 times back camera 8M pixels, back camera """ #step 1 sm.switchcamera('smile') sm.setCameraSetting('smile',2,2) d.expect('smile.png') #step 2 tb.switchBackOrFrontCamera('back') #step 3 for i in range(500): self._PanoramaCapturePic() time.sleep(1)
def testQuickSwitchtoSinglemode(self): """ Summary:testQuickSwitchtoSinglemode: Quick Switch to Single mode Steps: 1.Launch single capture activity 2.press change mode and then press Video icon to enter video 3.press change mode icon then choose camera group """ # steps 2 sm.switchcamera('video') # change video mode d.expect('video.png') time.sleep(1) # steps 3 sm.switchcamera('single') # change camera mode # check camera mode assert d(resourceId='com.intel.camera22:id/mode_button').wait.exists( timeout=3000)
def testAppStoreDownload(self): #Launch app store d.start_activity(component='com.smartisanos.appstore/.AppStoreActivity') assert d(text = '推荐').wait.exists(timeout = 5000),'Launch app store failed in 5s!' #Download app d(text = '排行').click.wait() assert d(resourceId = 'com.smartisanos.appstore:id/title_tv',text = '排行').wait.exists(timeout = 5000),"Switch to '排行' view failed in 5s!" if d(text = '总排行').wait.exists(timeout = 5000): d(text = '总排行').click.wait() d(text = 'QQ').click.wait() assert d(resourceId = 'com.smartisanos.appstore:id/title_tv',text = 'QQ').wait.exists(timeout = 5000),"Switch to app 'QQ' failed in 5s!" d(resourceId = 'com.smartisanos.appstore:id/appStatusIconView').click.wait() if d(text = '权限管理').wait.exists(timeout = 5000): d(text = '同意并安装').click.wait() assert d(resourceId = 'com.smartisanos.appstore:id/appStatusIconView').wait.exists(timeout = 5000),'App does not start downloading in 5s!' d.expect('Open_Icon.png', timeout=90)
def testPlayStreamingVideo(self): #Launch Browser self._launchBrowser() # input download audio url d(resourceId = 'com.android.browser:id/url', text = '输入网址').set_text('auto.smartisan.com/media/Auto_Test_Video.mp4') d.press('enter') d.sleep(5) d.expect('Streaming_Play.png',timeout = 15000) d.click('Streaming_Play.png') assert d(className = 'android.view.View').wait.exists(timeout = 15000),'Loading streaming video failed in 15s!' # play time d.sleep(10) d.press('back') assert d(description = '媒体控件').wait.exists(timeout = 5000),'Switch to webview failed in 5s!' if d.orientation != 'natural': d.orientation = 'n'
def testVisitWebPage(self): #Launch Browser self._launchBrowser() # visite webpage d(resourceId = 'com.android.browser:id/url', text = '输入网址').set_text(TOP5[3]) d.press('enter') d.expect(CHECK_POINT[3], timeout=15) # browse webpage d.swipe(1000,1300,1000,600,10) d.sleep(1) d.swipe(1000,1300,1000,600,10) d.sleep(1) d.swipe(1000,600,1000,1300,10) d.sleep(1) d.swipe(1000,600,1000,1300,10) d.sleep(1)
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')
def testQuickSwitchtoSmileCammode(self): """ Summary:testQuickSwitchtoSmileCammode: Quick Switch to SmileCam mode Steps: 1.Launch SmileCam capture activity 2.press change mode and then press Video icon to enter video 3.press change mode icon then choose camera group """ # step 1 sm.switchcamera('smile') # change smile mode time.sleep(1) d.expect('smile.png') # step 2 sm.switchcamera('video') # change video mode time.sleep(1) d.expect('video.png') # step 3 sm.switchcamera('smile') # change camera mod # check camera mode d.expect('smile.png')
def testQuickSwitchtoPerfectShotmode(self): """ Summary:testQuickSwitchtoPerfectShotmode: Quick Switch to Perfect Shot mode Steps: 1.Launch Perfect capture activity 2.press change mode and then press panorama icon to enter panorama 3.press change mode icon then choose Multi group """ # step 1 sm.switchcamera('perfectshot') # change perfectshot mode time.sleep(1) d.expect('perfectshot.png') # step 2 sm.switchcamera('panorama') # change panorama mode time.sleep(1) d.expect('panorama.png') # step 3 sm.switchcamera('perfectshot') # change perfectshot mode time.sleep(1) d.expect('perfectshot.png')