def testViewPicture(self):
     for i in range(100):
         d.press('back') #If it goes to fullview suc, it shall back to the grid view after pressing back key
         assert d(description = 'Switch to camera').wait.exists(timeout = 2000)
         u.pressBack(4)
         u.launchGallery()
         u.enterXView('fullview')
 def testSharePerfectShotUsingGmail(self):
     self._deleteAllPictures()
     self._takePicUnderPerfectMode()
     self._launchGallery()
     self._enterSingleView()
     self._showPopupCard()
     #Tap on share icon
     d(description = 'Share').click.wait()
     assert d(text = 'See all').wait.exists(timeout = 2000), 'Share options does not pop up in 2s'
     d(text = 'See all').click.wait() #List all share options
     #When share picture via Gmail, it may locate at the end of the option list
     try:
         assert d(text = 'Gmail').wait.exists(timeout = 2000)
     except:
         d.swipe(600, 800, 600, 300)
     finally:
         d(text = 'Gmail').click.wait()
     #Check if composing  interface display
     assert d(description = 'Send').wait.exists(timeout = 5000), 'Share picture to Gmail failed'
     #Discard the sharing item
     d.press('menu')
     assert d(text = 'Discard').wait.exists(timeout = 2000) #Check if menu list pop up
     d(text = 'Discard').click.wait() #Click discard in menu list
     assert d(text = 'Discard this message?').wait.exists(timeout = 2000)
     d(text = 'Discard').click.wait() #Click discard when confirm
示例#3
0
 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.start_activity(component='com.rovio.angrybirdsstarwars.ads.iap/com.rovio.fusion.App')
     d.sleep(30)
     d.press('home')
示例#4
0
    def testMO_MTSms(self):
        str_receiver = '10010'
        str_content = 'Message Test Content'
        #assert d.exists(text='Messaging') , 'message app not appear on the home screen'
        #assert d.exists(text='Apps')  , 'apps not appear on the home screen'
        #d(text='Messaging').click.wait()

        d.start_activity(component='com.android.mms/.ui.ConversationList')
        assert d(text='Messaging').wait.exists(timeout=3000), 'can not launch message in 3s'

        #Delete messages
        if not d(text="No conversations.").wait.exists(timeout=2000):
            d.press('menu')
            d(text='Delete all threads').click.wait()
            d(text='Delete', className='android.widget.Button').click.wait()
            assert d(text="No conversations.").wait.exists(timeout=3000), 'Delete message failed'

        d(description='New message').click.wait()
        d(text='To').set_text(str_receiver)
        assert d(text=str_receiver).wait.exists(timeout=10000), 'receiver number input error'            
        d(text='Type message').set_text(str_content)
        assert d(text=str_content).wait.exists(timeout=10000), 'content input error'            
        d(description='Send', className='android.widget.ImageButton').click.wait()

        assert d(text='SENDING…').wait.exists(timeout=10000), 'Sending not start in 10s'
        assert d(text='SENDING…').wait.gone(timeout=20000), 'sms sending failed in 20s'
        d.sleep(15)
        assert d(textStartsWith='尊敬的').wait.exists(timeout=20000), 'No feedback in 35s'
示例#5
0
文件: weibo.py 项目: jimlin95/hm
    def weibo(self, wifi):
        u.openWifi(d, wifi)
        
        #Open sina weibo and check if successful
        d.start_activity(component='com.sina.weibo/.SplashActivity')
        assert d(className='android.widget.TextView', description="MainEdit").wait.exists(timeout=10000), 'weibo cient unable to open in 10 secs'

        #Clear the 'sent fail' prompt
        if d.exists(text='Sent failed. It has been saved in the draft.'):
            d(text='Sent failed. It has been saved in the draft.').click.wait()
            d.press('back')
        
        #Swipe to fetch new messages 3 times
        for i in range(3):
            #d.swipe(340, 340, 340, 1000, steps=5)
            d(description='首页列表').click.wait()
            d(className='android.widget.LinearLayout', index=0).click.wait()
            u.sleep(5)
        
        #Compose new message
        #Switch to message editor
        d(className='android.widget.TextView', description="MainEdit").click.wait()
        assert d(className='android.widget.TextView', text="New Weibo").wait.exists(timeout=3000), 'unable to compose message'
        
        #Fetch and input random TEXT, and send the message
        d(className='android.widget.EditText').set_text(u.fetchText())
        d(text='Send', description='Send').click.wait()
        assert not d(text='Sent failed. It has been saved in the draft.').wait.exists(timeout=10000), 'msg send failed'
        assert d(className='android.widget.TextView', description="MainEdit").wait.exists(timeout=10000), 'unable to back to home screen in 10 secs'
 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 _removeIdentity(self):
     u.tapOnCenter() #Tap on the face on image
     #Below is to remove the exists face recognize
     if d(description = 'Edit menu').wait.exists(timeout = 2000):
         self._editFDFR('Remove identity')
     else:
         d.press('back')
示例#8
0
    def testMusicPlayer(self):
        #Launch Music and check if successful
        d.start_activity(component='com.miui.player/.ui.MusicBrowserActivity')
        assert d(text='4:35').wait.exists(timeout=5000) , 'Music app can not be launched in 3s.'

        d(text='4:35').click.wait()
        assert d(className='android.widget.SeekBar').wait.exists(timeout=5000) , 'Switch to music playing failed in 5s.'
        
        #Press 'next' button
        d(className='android.widget.LinearLayout', index=5).child(className='android.widget.ImageView', index=2).click.wait()

        #Stop
        d(className='android.widget.LinearLayout', index=5).child(className='android.widget.ImageView', index=1).click.wait()
        text1 = d(className='android.widget.LinearLayout', index=2).child(className='android.widget.TextView', index=0).text

        #Start
        d(className='android.widget.LinearLayout', index=5).child(className='android.widget.ImageView', index=1).click.wait()

        #Stop
        d(className='android.widget.LinearLayout', index=5).child(className='android.widget.ImageView', index=1).click.wait()
        text2 = d(className='android.widget.LinearLayout', index=2).child(className='android.widget.TextView', index=0).text

        assert text1!=text2, 'Not playing'
        
        d.press('back')
示例#9
0
文件: browser.py 项目: jimlin95/hm
    def openBrowser(self, wifi):
        u.openWifi(d, wifi)
        
        #Launch browser and check if launch sucessful
        d.start_activity(component='com.android.browser/.BrowserActivity')
        assert d(className='android.widget.ImageButton', index=3).wait.exists(timeout=5000), 'Launch browser failed in 5s'

        #Open a new page
        #and go to www.qq.com
        d(className='android.widget.ImageButton', index=3).click.wait()
        assert d(text="Bookmarks").wait.exists(timeout=3000), 'Open new page failed in 3s'
        d(className='android.widget.EditText').set_text('wap.qq.com')
        d.press('enter')

        #Sleep 15s to wait loading web page
        u.sleep(15)
        flag = True
        i = 0
        while(flag and i < 9):
            i = i + 1
            d.swipe(400, 1000, 400, 500, steps=6)
            u.sleep(5)
            if not d.find('browser_blank.png'):
                flag = False
        if flag:
            assert False, 'Open the web page failed in 60s.'
        else:
            assert True
示例#10
0
    def testContact(self):
        c_name = 'aaatest'
        c_number = '12345678901'
        #Launch Contacts and check if sucessful
        d.start_activity(component='com.android.contacts/.activities.PeopleActivity')
        assert d(text='New contact', className='android.widget.Button').wait.exists(timeout=5000), 'can not launch contacts in 5s'

        #Delete the contact with the same name, will be added.
        if d(text=c_name).wait.exists(timeout=1000):
        	d(text=c_name).long_click()
        	d(text='Delete').click.wait()
        	d(text='Delete', className='android.widget.Button').click.wait()

        #New contact
        d(text='New contact', className='android.widget.Button').click.wait()

        assert d(text='Add  contact', className='android.widget.TextView').wait.exists(timeout=5000), 'Can not switch to create contact activity in 5s'
        d(text='Name', className='android.widget.EditText').set_text(c_name)
        assert d(text=c_name), 'Input name failed.'
        d(text='Phone', className='android.widget.EditText').set_text(c_number)
        assert d(text=c_number), 'Input number failed.'
        d(text='OK', className='android.widget.Button').click.wait()	

        #Delete the contact
        assert d(text='About').wait.exists(timeout=3000), 'Add contact failed'
        d.press('menu')
        d(text='Delete', className='android.widget.TextView').click.wait()
        d(text='Delete', className='android.widget.Button').click.wait()
        assert d(text='New contact').wait.exists(timeout=3000), 'Back to contacts list in 3s'
示例#11
0
    def testMoMMS(self):
        str_receiver = '13501101339'
        str_content = 'Message Test Content'
        d.start_activity(component='com.android.mms/.ui.ConversationList')

        if not d(text="No conversations.").wait.exists(timeout=2000):
            d.press('menu')
            d(text='Delete all threads').click.wait()
            d(text='Delete', className='android.widget.Button').click.wait()
            assert d(text="No conversations.").wait.exists(timeout=3000), 'Delete message failed'

        d(description='New message').click.wait()
        d(text='To').set_text(str_receiver)
        #assert d(text=str_receiver).wait.exists(timeout=10000), 'receiver number input error'            
        d(text='Type message').set_text(str_content)
        #assert d(text=str_content).wait.exists(timeout=10000), 'content input error'            
        #d(description='Send', className='android.widget.ImageButton').click.wait()

        d(description='Attach').click.wait()
        assert d(text='Capture picture').wait.exists(timeout=3000), 'no adding attachment panel' 
        d(text='Capture picture').click.wait()
        assert d(description='Shutter button').wait.exists(timeout=3000), 'no camera' 
        d(description='Shutter button').click.wait()
        d.sleep(1)
        assert d(description='Review done').wait.exists(timeout=3000), 'Take picture failed.'
        d(description='Review done').click.wait()
        assert d(text='MMS', description='Send MMS').wait.exists(timeout=3000), 'add attachment failed'
        d(text='MMS', description='Send MMS').click.wait()
        assert d(text='SENDING…').wait.exists(timeout=10000), 'No sending status'
        d.sleep(30)
        assert d(text='SENDING…').wait.gone(timeout=20000), 'MMS sending failed in 50s'
示例#12
0
文件: message.py 项目: hongbinbao/s4
 def setUp(self):
     super(MessageTest, self).setUp()
     d.wakeup()
     #d.start_activity(action='android.intent.action.DIAL', data='tel:13581739891', flags=0x04000000)
     d.press('back')\
      .press('back')\
      .press('home')
示例#13
0
 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)
示例#14
0
 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)
示例#15
0
 def tearDown(self):
     super(GalleryBatTest,self).tearDown()
     d.press('back','back')
     #Check whether Gallery has been exit completely
     galleryPID = commands.getoutput("adb shell ps | grep com.intel.android.gallery3d | awk '{print $2}'")
     KILL_GALLERY = 'adb shell kill %s' %galleryPID
     if galleryPID != -1:
         commands.getoutput(KILL_GALLERY)
     time.sleep(5)
示例#16
0
文件: camera.py 项目: hongbinbao/s4
 def testTakePicture(self):
     assert d.exists(text='Camera') , 'camera app not appear on home screen'
     #assert d.exists(text='Apps')
     d(text='Camera').click.wait()
     d.click(1765,555)
     d.click(116,966)
     d.press('menu')
     assert d(text="Delete").wait.exists(timeout=5000), 'unable to take picture!'
     d(text='Delete').click.wait()
     d(text="OK").click.wait()
示例#17
0
 def _takePicUnderPerfectMode(self):
     self._launchCamera()
     d(description = 'Show switch camera mode list').click.wait()
     assert d(resourceId = 'com.intel.camera22:id/mode_wave_perfectshot').wait.exists(timeout = 2000)
     d(resourceId = 'com.intel.camera22:id/mode_wave_perfectshot').click.wait() #Switch to perfect mode
     time.sleep(5) #Sometimes it takes much time for switching mode
     assert d(resourceId = 'com.intel.camera22:id/shutter_button').wait.exists() #Check if mode has been switched
     d(resourceId = 'com.intel.camera22:id/shutter_button').click.wait()
     time.sleep(5) #Take picture under perfect mode may take more time
     d.press('back','back')
示例#18
0
 def testFaceRecognition(self):
     for i in range (0,3):
         self.testRegisterAContact()
         time.sleep(2)
         d.press('back','back') #Exit gallery
         galleryPID = commands.getoutput("adb shell ps | grep com.intel.android.gallery3d | awk '{print $2}'")
         KILL_GALLERY = 'adb shell kill %s' %galleryPID
         if galleryPID != -1:
             commands.getoutput(KILL_GALLERY)
         time.sleep(5)
示例#19
0
 def testMenuKeyOfSync(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 left,check Rotate left progress pops up.
     """  
     d.press('menu')
     assert d(text = 'Social Sync').wait.exists(timeout = 3000), 'unable to find sync icon'
示例#20
0
 def testGeotagInformation(self):
     self._deleteAllPictures()
     self._launchMap()
     d.press('back','back')
     self._launchCamera()
     self._setGeoOn()
     self._takePicture()
     d.press('back','back')
     self._launchGallery()
     time.sleep(2)
     self._enterSingleView()
     self._showPopupCard()
     d.click(350,1100) #Tap on pop up card bar to invoke it
     assert d(resourceId = 'com.intel.android.gallery3d:id/street').wait.exists(timeout = 2000), 'Geo tag information does not show on pictures details'
示例#21
0
 def testSharePictureToGooglePlus(self):
     '''
         Summary: Share 1 picture in Google+
         Steps:   1.Enter full view
                  2.Click share icon
                  3.Click Google+ icon
     '''
     u.shareItem('Google+')
     if d(text = 'Choose account').wait.exists(timeout = 2000):
         d(resourceId = 'com.google.android.apps.plus:id/avatar').click.wait()
     assert d(text = 'Share').wait.exists(timeout = 2000)
     #Discard it.
     d.press('back')
     d(text = 'Yes').click.wait()
示例#22
0
    def _turnFDFR(self,fdfroption):
        '''
            The function is to turn on/off face identity, usage as below:

            -> _turnFDFR('On')

            *You may need inputing 'On' but not 'on'
        '''
        u.showPopCard()
        d.press('menu')
        if d(text = 'Face recognition %s' %fdfroption).wait.exists(timeout = 2000):
            d(text = 'Face recognition %s' %fdfroption).click.wait()
        else:
            d.press('menu')
示例#23
0
    def openBrowser(self, wifi):
        u.openWifi(d, wifi)
        #Launch browser
        d.start_activity(component='com.android.browser/.BrowserActivity')
        assert d(description='Page manager').wait.exists(timeout=5000), 'Launch browser failed in 5s'

        d(className='android.widget.EditText').set_text('wap.qq.com')
        d.press('enter')

        #Sleep 15s to wait loading web page
        d.sleep(15)
        if d.find('browser_blank.png'):
            assert False, 'Open the web page failed.'
        else:
            assert True
示例#24
0
文件: video.py 项目: jimlin95/hm
    def testVideoPlayer(self):
        #Launch video and check if successful
        d.start_activity(component='com.miui.video/.HomeActivity')
        assert d(text='电视直播').wait.exists(timeout=5000) , 'video app can not be launched.'

        #Switch to local video and find bbb.mp4 to play
        if d(text='我的视频').wait.exists(timeout=1000):
            d(text='我的视频').click.wait()
        if d(text='Local').wait.exists(timeout=1000):
            d(text='Local').click.wait()
        assert d(text='bbb.mp4').wait.exists(timeout=3000) , 'Switch to local video.'
        d(text='bbb.mp4').click.wait()
        assert d(text='bbb.mp4').wait.gone(timeout=3000), 'Not switch to playing'

        #After finish playing, should back to video list
        u.sleep(600)
        assert d(text='bbb.mp4').wait.exists(timeout=10000)
        d.press('back')
示例#25
0
 def testWeibo(self):
     assert d.exists(text='Weibo') , 'wechat app not appear on the home screen'
     #assert d.exists(text='Apps')  , 'not appear on the home screen'
     d(text='Weibo').click.wait()
     assert d(className='android.widget.TextView', description="MainEdit").wait.exists(timeout=10000), 'weibo cient unable to open in 10 secs'
     if d.exists(text='Sent failed. It has been saved in the draft.'):
         d(text='Sent failed. It has been saved in the draft.').click.wait()
         d.press('back')
     d.swipe(350, 420, 350, 820)
     d.sleep(3)
     #d(description="首页列表").click.wait()
     
     d(className='android.widget.TextView', description="MainEdit").click.wait()
     assert d(className='android.widget.TextView', text="New Weibo").wait.exists(timeout=3000), 'unable to compose message'
     d(className='android.widget.EditText').set_text('funny funny bear')
     d(text='Send', description='Send').click.wait()
     assert not d(text='Sent failed. It has been saved in the draft.').wait.exists(timeout=10000), 'msg send failed'
     assert d(className='android.widget.TextView', description="MainEdit").wait.exists(timeout=10000), 'unable to back to home screen in 10 secs'
示例#26
0
文件: camera.py 项目: shaofang/falcon
    def testTakePicture(self):
        #assert d.exists(text='Camera') , 'camera app not appear on home screen'
        #assert d.exists(text='Apps')
        #d(text='Camera').click.wait()
        d.start_activity(component='com.android.gallery3d/com.android.camera.CameraLauncher')
        assert d(description='Shutter button').wait.exists(timeout=5000), 'can not launch camera in 5s'

        d(description='Shutter button').click.wait()
        d.sleep(1)
        d().swipe.left()
        assert d(description='Share with').wait.exists(timeout=3000), 'take picture failed'

        d.press('menu')
        d(text='Delete').click.wait()
        d(text='OK').click.wait()
        d().swipe.right()

        assert d(description='Shutter button').wait.exists(timeout=5000), 'Back to camera failed.'
示例#27
0
 def testAddingDeletingKeywords(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'
     d.click(280,700) #Delete the keyword just added
     try:
         assert d(text = 'NewKeyword').wait.exists(timeout = 2000), 'Delete keywords failed'
     except:
         d.press('back','back')
     finally:
         self._deleteAllPictures()
示例#28
0
文件: message.py 项目: hongbinbao/s4
 def testSendMessage1(self):
     assert d.exists(text='Messaging') , 'message app not appear on the home screen'
     #assert d.exists(text='Apps')  , 'apps not appear on the home screen'
     d(text='Messaging').click.wait()
     if not d(text="No messages").wait.exists(timeout=3000):
         d.press('menu')
         d(text="Delete threads").click.wait()
         d(text="Select all").click.wait()
         d(text="Delete").click.wait()
         d(text="OK").click.wait()
         assert d(text="No messages").wait.exists(timeout=10000)
     d(description='Compose').click.wait()
     d(text='Enter recipient').set_text('13581739891')
     assert d(text="13581739891").wait.exists(timeout=10000), 'receiver number input error'            
     d(text='Enter message').set_text('testingongoing')
     assert d(text="Testingongoing").wait.exists(timeout=10000), 'content input error'            
     d(description='Send').click.wait()
     assert d(className='android.widget.ProgressBar').wait.gone(timeout=10000), 'message unable to send in 30 seconds'
     assert d(description='Sending failed').wait.exists(timeout=10000), 'message send failed'
     assert d(text='Failed').wait.exists(timeout=10000), 'message send failed'
示例#29
0
    def testTakePicture(self):
        #Start camera and check if sucessful
        d.start_activity(component='com.android.camera/.Camera')
        assert d(description='Shutter button').wait.exists(timeout=5000), 'can not launch camera in 5s'

        #Take picture
        d(description='Shutter button').click.wait()
        u.sleep(5)
        d(description='Shutter button').click.wait()
        u.sleep(5)

        #Delete the recent picture
        d(description='Most recent photo').click.wait()
        assert d(text="Delete").wait.exists(timeout=3000), 'No picture to delete.'
        #d(text="Delete").click.wait()
        #d(text="OK").click.wait()
        #If there is not only one picture
        #if d(text="Delete").wait.exists(timeout=2000):
        d.press('back')
        assert d(description="Shutter button").wait.exists(timeout=5000), 'unable back to camera after delete in 5s.'
示例#30
0
文件: gallery.py 项目: jimlin95/hm
 def testGallery(self):
     #Launch gallery and check if successful
     d.start_activity(component='com.miui.gallery/.app.Gallery')
     assert d(textStartsWith='Cloud', className='android.widget.TextView').wait.exists(timeout=5000), 'Launch gallery failed in 5s'
     d(textStartsWith='Cloud', className='android.widget.TextView').click.wait()
     assert d(text='New', className='android.widget.TextView').wait.exists(timeout=5000), 'Switch to cloud images failed in 5s'
     
     #Select and open the cloud gallery
     d.click(510,331)
     u.sleep(2)
     d.click(111,222)
     u.sleep(3)
     for m in range(3):
         for i in range(5):
     	    d().swipe.left()
         for i in range(5):
     	    d().swipe.right()
     d.press('back')
     u.sleep(1)
     d.press('back')
     u.sleep(1)
示例#31
0
 def _pressBack(self, touchtimes):
     for i in range(0, touchtimes):
         d.press('back')