def testLaunch(self): #assert d.exists(text='Angry Birds') , 'wechat app not appear on the home screen' #assert d.exists(text='Apps') , 'not appear on the home screen' #d(text='Angry Birds').click.wait() #d.sleep(30) d.expect('loaded.png')
def testSearchByKeyword(self): self._checkResource() self._launchGallery() self._enterSingleView() self._showPopupCard() d.click(350,1100) #Tap on pop up card bar to invoke it assert d(text = 'Facebook').wait.exists(timeout = 2000), 'Details has not pop up' d.swipe(350,1100,350,350) #Pull up pop up card to show more details assert d(resourceId = 'com.intel.android.gallery3d:id/addKeywordButton').wait.exists(timeout = 2000), 'Keywords has not shown in details' d(resourceId = 'com.intel.android.gallery3d:id/addKeywordButton').click.wait() #Tap on add keywords d(text = 'Enter new keyword').set_text('NewKeyword') #Input keywords content self._clickDoneButton() assert d(text = 'NewKeyword').wait.exists(timeout = 2000), 'Add keywords failed' #Search by keyword d.press('back') #Back to the grid view time.sleep(2) d.press('back') #Back to the album view assert d(description = 'Search').wait.exists(timeout = 2000), 'It has not back to the album view' d(description = 'Search').click.wait() assert d(resourceId = 'com.intel.android.gallery3d:id/search_src_text').wait.exists(timeout = 2000) d(resourceId = 'com.intel.android.gallery3d:id/search_src_text').set_text('NewKeyword') d.expect('Search_Result_Item.png') #Check the search result d(resourceId = 'com.intel.android.gallery3d:id/searchedText').click.wait() assert d(text = 'NewKeyword').wait.exists(timeout = 2000)
def testBaidumaps(self): #Check and set wifi u.openWifi(d, True) #Launch Baidu map app d.start_activity(component='com.baidu.BaiduMap/com.baidu.baidumaps.WelcomeScreen') if d(text='不要福利').wait.exists(timeout=5000): d(text='不要福利').click.wait() if d(text='以后再说').wait.exists(timeout=5000): d(text='以后再说').click.wait() if d(text='以后再说').wait.exists(timeout=2000): d(text='以后再说').click.wait() #Check if baidu map can be launched successfully assert d(text='附近').wait.exists(timeout=10000), 'No enter main map activity' assert d(text='路线').wait.exists(timeout=2000), 'No enter main map activity' #Swipe on the map d.swipe(340, 340, 340, 900, steps=5) #Locate to current location d.expect('location.png') d.click('location.png') #Located successful assert d(text='我的位置').wait.exists(timeout=3000), 'can not locate'
def testFRBackgroundProcess(self): self._checkResource() self._launchGallery() d(text = 'Albums').click.wait() #Tap on album to switch other view assert d(text = 'People').wait.exists(timeout = 2000) d(text = 'People').click.wait() #Swtich to people view time.sleep(3) d.expect('Unknown_New_Face.png')
def testLaunch(self): #Launch game d.start_activity(component='com.rovio.angrybirdsstarwars.ads.iap/com.rovio.fusion.App') u.sleep(30) d.expect('loaded.png', timeout=30, msg='failed to load') d.press('back') d.expect('ok.png', timeout=30, msg='failed to find ok button') d.click(1060,590)
def testLaunch(self): #Launch game d.start_activity(component='com.rovio.angrybirdsstarwars.ads.iap/com.rovio.fusion.App') u.sleep(40) d.expect('loaded.png', timeout=20, msg='Fail to load app') d.press('back') d.expect('ok.png', timeout=10, msg='Fail to find ok button') d.click(788,385)
def testOpenBrowser(self): assert d.exists(text='Internet') , 'not appear on the home screen' assert d.exists(text='Apps') , 'not appear on the home screen' d(text='Internet').click.wait() assert d(description="Bookmarks").wait.exists(timeout=10000), 'browser unable to open in 10 secs' d(className='android.widget.EditText').set_text('www.baidu.com') d.click('go.png', threshold=0.01) d.expect('baidu_logo.png', timeout=20)
def testMenuKeyOfRotateRight(self): """ Summary:This case test rotate left 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 testSendMessage1(self): #sys.stderr.write(str(d(text="Settings").click())) d.wakeup() #d.click(100, 200, waittime=2) #d.start_activity(action='android.intent.action.DIAL', data='tel:13581739891', flags=0x04000000) d.click('a.png', waittime=1, threshold=0.01)\ .expect('no_msg.png')\ .click('create_btn.png') if d.find('input_label.png'): d.click('input_label.png')\ .click('content_label.png') d.expect('send_btn.png')
def testCapturePanoramaImage200TimesBackCamera(self): """ Summary:testCapturepanoramaimage200times: Capture panorama image 200 times Steps: 1.Launch panorama capture activity 2.Capture panorama image 200 times 3.Exit activity """ #step 1 sm.switchcamera('panorama') d.expect('panorama.png') #step 2 for i in range(200): self._PanoramaCapturePic() time.sleep(1)
def testCapturePerectshotImage200TimesBackCamera(self): """ Summary:testCaptureperfectshotimage200times: Capture perfect shot image 200 times Steps: 1.Launch perfectshot capture activity 2.Capture perfectshot image 200 times 3.Exit activity """ #step 1 sm.switchcamera('perfectshot') d.expect('perfectshot.png') #step 2 for i in range(200): self._checkCapturedPic() time.sleep(2)
def testcaseRecord720PVideo500Times(self): """ Record 720P Video 500times Video size 720P """ #step 1 sm.switchcamera('video') sm.setCameraSetting('video',3,2) d.expect('video.png') #step 2 for i in range (500): tb.takeVideo(5) time.sleep(1)
def testcaseRecord720PVideo500Times(self): """ Record 720P Video 500times Video size 720P """ #step 1 sm.switchCaptureMode('video') so.setCameraOption('Video Size','false','5') d.expect('video.png') #step 2 for i in range (5): tb.captureAndCheckPicCount('video',3) 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 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._checkCapturedPic() time.sleep(1)
def setUp(self): super(CameraTest,self).setUp() # rm DCIM folder and refresh from adb shell a.cmd('rm','/sdcard/DCIM/100ANDRO') a.cmd('refresh','/sdcard/DCIM/100ANDRO') #Because default camera after launching is single mode, so we set this step in setUp(). #Step 1. Launch single capture activity a.cmd('launch','com.intel.camera22/.Camera') time.sleep(2) if d(text = 'OK').wait.exists(timeout = 3000): d(text = 'OK').click.wait() else: assert d(resourceId = 'com.intel.camera22:id/shutter_button'),'Launch camera failed!!' sm.switchcamera('panorama') time.sleep(1) d.expect('panorama.png')
def testcaseBurstImage8M200Times(self): """ test case Burst Image 200 times 8M pixels, back camera """ #step 1 sm.switchcamera('burstfast') sm.setCameraSetting('burstfast',2,2) d.expect('burst.png') assert bool(a.cmd('cat',PATH + PICTURE_SIZE_KEY).find('StandardScreen')+1) #step 2 tb.switchBackOrFrontCamera('back') #step 3 for i in range(200): self._checkCapturedPic() time.sleep(1)
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')
def weChat(self, wifi): u.openWifi(d, wifi) #Start WeChat and check if successful d.start_activity(component='com.tencent.mm/.ui.LauncherUI') assert d(text="Me").wait.exists(timeout=20000), 'wechat unable to open in 20 secs' assert d(text="Discover").wait.exists(timeout=20000), 'wechat unable to open in 20 secs' #Switch to groups, moments, and settings d(className='android.widget.RadioButton', text='Contacts').click.wait() d(text='Groups').wait.exists(timeout=3000), 'Switch to Contacts failed' d(className='android.widget.RadioButton', text='Discover').click.wait() d(text='Moments').wait.exists(timeout=3000), 'Switch to Discover failed' d(className='android.widget.RadioButton', text='Me').click.wait() d(text='Settings').wait.exists(timeout=3000), 'Switch to Me failed' d(className='android.widget.RadioButton', text='Chats').click.wait() #Enter WeChat Team d.expect('conversation.png') d.click('conversation.png') assert d(text='常见问题').wait.exists(timeout=3000), 'Switch to chat failed.' #Clear chat history d.press('menu') d(text='Clear Chat History').click.wait() d(text='OK').click.wait() #Compose and send out a void message d.expect('compose.png', timeout=10) d.click('compose.png') if d.find('voice.png'): d.click('voice.png') assert d(className='android.widget.Button', text='Hold to Talk').wait.exists(timeout=3000), 'Can not swith to voice message' d(className='android.widget.Button', text='Hold to Talk').swipe.up(steps=100) #Check if can get feedback in 60s d.expect('chat.png', timeout=60)