Exemple #1
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')
Exemple #2
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'
 def _launchCamera(self):
     d.start_activity(component = ACTIVITY_NAME)
     time.sleep(2)
     #When it is the first time to launch camera there will be a dialog to ask user 'remember location', so need to check
     if d(text = 'OK').wait.exists(timeout = 2000):
         d(text = 'OK').click.wait()
     assert d(resourceId = 'com.intel.camera22:id/mode_button').wait.exists(timeout = 3000), 'Launch camera failed in 3s'
Exemple #4
0
    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'
Exemple #5
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'
Exemple #6
0
    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'
Exemple #7
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')
    def testTakePicture(self):
        """
        Summary:testCapturePictureAndDelete: Take a picture, then view and delete the picture.
        Steps:1. Open Camera app
              2. Capture a picture
              3. Touch thumbnail to view the picture
              4. Touch Delete button to delete the picture
              5. Exit Camera app
        """
        #Start camera and check if sucessful
        d.start_activity(component='com.intel.camera22/.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='Most recent photo').click.wait()
        d.click(500,500)
        assert d(description="Delete").wait.exists(timeout=3000), 'No picture to delete.'
        d(description='Delete').click.wait()
        d(text='Delete').click.wait()
        u.sleep(3)

        assert d(description="Shutter button").wait.exists(timeout=5000), 'unable back to camera after delete in 5s.'
Exemple #9
0
 def testSetSingleCameraC(self):
     """
     Summary:This method is use to test social_util
     """
     d.start_activity(component = ACTIVITY_NAME)
     self._setSingleCameraSetting('delay','5')
     print 'test over'
Exemple #10
0
 def testSetSingleCameraD(self):
     """
     Summary:This method is use to test social_util
     """
     d.start_activity(component = ACTIVITY_NAME)
     self._setSingleCameraSetting('whitebalance','fluorescent')
     print 'test over'
Exemple #11
0
    def testMO_MTSms(self):
        #Set receiver and msg content
        str_receiver = '10086'
        str_content = 'Message Test Content'

        #Start Messaging and check if sucessful
        d.start_activity(component='com.android.mms/.ui.MmsTabActivity')
        assert d(text='Messages').wait.exists(timeout=3000), 'can not launch message in 3s'

        #Delete messages if there is any message.
        if not d(textStartsWith="No conversations").wait.exists(timeout=2000):
            d(className='android.view.View').long_click()
            if d(text='Select all').wait.exists(timeout=3000):
                d(text='Select all').click.wait()
            d(text='Delete').click.wait()
            d(text='Delete').click.wait()
            assert d(textStartsWith="No conversations").wait.exists(timeout=10000), 'Delete messages failed'

        #Compose message
        d(text='New message').click.wait()
        d(className='android.widget.EditText', index=0).set_text(str_receiver)
        assert d(text=str_receiver).wait.exists(timeout=10000), 'receiver number input error'            
        d(className='android.widget.EditText', index=1).set_text(str_content)
        assert d(text=str_content).wait.exists(timeout=10000), 'content input error'            
        d(description='Send message').click.wait()
        #assert d(text='Sending').wait.exists(timeout=3000), 'Not begin to sending in 3s'
        u.sleep(3)
        assert d(text='Sending').wait.gone(timeout=20000), 'sms sending failed in 20s'
Exemple #12
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'
Exemple #13
0
    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
 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)
Exemple #15
0
 def _launchCamera(self):
     d.start_activity(component=ACTIVITY_NAME)
     time.sleep(2)
     #When it is the first time to launch camera there will be a dialog to ask user 'remember location', so need to check
     if d(text='OK').wait.exists(timeout=2000):
         d(text='OK').click.wait()
     assert d(resourceId='com.intel.camera22:id/mode_button').wait.exists(
         timeout=3000), 'Launch camera failed in 3s'
Exemple #16
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)
 def _launchCamera(self):
     d.start_activity(component=ACTIVITY_NAME)
     # When it is the first time to launch camera there will be a dialog to ask user 'remember location', so need to check
     try:
         assert d(text="OK").wait.exists(timeout=2000)
         d(text="OK").click.wait()
     except:
         pass
     assert d(resourceId="com.intel.camera22:id/mode_button").wait.exists(timeout=3000), "Launch camera failed in 3s"
Exemple #18
0
    def testVideoPlayer(self):
        #Start video player and check if successful
        d.start_activity(component='com.miui.video/.HomeActivity')
        assert d(text='Local').wait.exists(timeout=5000) , 'video app can not be launched.'

        #Go to local video and start to play video
        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'

        #Wait to finish playing and check if back to video list
        u.sleep(600)
        assert d(text='bbb.mp4').wait.exists(timeout=10000)
Exemple #19
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
Exemple #20
0
    def testMusicPlayer(self):
        #Find and launch Video app
        #assert d.exists(text='Music') , 'Music app not appear on the home screen'
        #d(text='Music').click.wait()

        #d.start_activity(component='com.miui.player/.ui.MusicBrowserActivity')
        d.start_activity(component='com.google.android.music/com.android.music.activitymanagement.TopLevelActivity')
        
        assert d(text='爸爸去哪儿').wait.exists(timeout=3000) , 'Music app can not be launched.'
        #assert d(className='android.widget.ImageView', index=2).wait.exists(timeout=3000) , 'play and stop button.'
        assert d(description='Play').wait.exists(timeout=3000)
        d(description='Play').click.wait()
        assert d(description='Pause').wait.exists(timeout=3000), 'Can not play'
        d.sleep(15)
        d(description='Pause').click.wait()
        assert d(description='Play').wait.exists(timeout=3000)
Exemple #21
0
 def launchApplication(self,app):
     application = {'camera':'com.intel.camera22/.Camera',
                     'setting':'com.android.settings/.Settings',
                     'contact':'com.android.contacts/.activities.PeopleActivity',
                     'message':'com.android.mms/.ui.ConversationList',
                     'gallery':'com.intel.android.gallery3d/.app.Gallery',
                     'browser':'com.android.browser/.BrowserActivity',
                     'soundrecorder':'com.android.soundrecorder/.SoundRecorder'}
     #get all support application
     all_application = str(application.keys())
     if app not in all_application:
         print 'applicaiton name is wrong, only support ' + all_application
     else:
         #get the value of app
         component = application.get(app)
         #start activity
         d.start_activity(component = component)
Exemple #22
0
    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')
Exemple #23
0
    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.'
    def testMoMMS(self):
        #Set receiver and msg content
        str_receiver = '13501278511'
        str_content = 'Message Test Content'

        #Start Messaging and check if sucessful
        d.start_activity(component='com.android.mms/.ui.MmsTabActivity')
        assert d(text='New message', className='android.widget.Button').wait.exists(timeout=5000), 'can not launch message in 3s'

        #Delete messages if there is any message.
        if not d(text="No conversations.").wait.exists(timeout=1000):
            d(className='android.view.View').long_click()
            if d(text="Select all").wait.exists(timeout=3000):
                d(text="Select all").click.wait()
            d(text="Delete").click.wait()
            d(text="Delete").click.wait()

        #Compose message
        d(text='New message').click.wait()
        d(className='android.widget.EditText', index=0).set_text(str_receiver)
        assert d(text=str_receiver).wait.exists(timeout=10000), 'receiver number input error'            
        d(className='android.widget.EditText', index=1).set_text(str_content)
        assert d(text=str_content).wait.exists(timeout=10000), 'content input error' 

        #Add attachment from camera
        d(descriptionContains='dd attachment').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()

        assert d(className='android.widget.ImageView', index=1, description='Shutter button').wait.gone(timeout=10000), 'Take picture failed'
        assert d(className='android.widget.ImageView', index=1).wait.exists(timeout=5000), 'No confirm for picture'
        d(className='android.widget.ImageView', index=1).click.wait()
        assert d(text='MMS').wait.exists(timeout=5000), 'add attachment failed'

        #Send MMS
        d(descriptionContains='end message').click.wait()
        assert d(text='Sending').wait.exists(timeout=10000), 'No sending status in 10s'
        u.sleep(20)
        assert d(text='Sending').wait.gone(timeout=70000), 'MMS sending failed in 90s'
Exemple #25
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.'
Exemple #26
0
    def setWifiOpenClose(self,status):
        all_status = {'on':'running','off':'stopped'}

        if status != 'on' and status != 'off':
            print 'please input on or off'
        else:
            wifivalue = self._getWifistatus()
            i = 1
            while all_status.get(status) not in wifivalue and i<3:
                #launch setting app
                d.start_activity(component='com.android.settings/.Settings')
                #print wifivalue
                #print status          
                #click wifi switch icon 
                d(resourceId='android:id/list',className="android.widget.ListView").child(index='1',className='android.widget.LinearLayout').child(className='android.widget.Switch').click.wait()
                self.sleep(5)
                wifivalue = self._getWifistatus()
                i+=1
            assert all_status.get(status) in wifivalue, 'set wifi status failed'
        self.backHome()
Exemple #27
0
 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)
Exemple #28
0
    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)
Exemple #29
0
    def weibo(self, wifi):
        u.openWifi(d, wifi)
        #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()
        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'

        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(5)
        
        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'
        
        n=random.randint(15, 30)
        
        d(className='android.widget.EditText').set_text(''.join(self.content(n)))
        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 testMoCall(self):
        #Start dialer and confirm if dialer is launched
        d.start_activity(component='com.android.contacts/.activities.TwelveKeyDialer')
        assert d(text='Keypad').wait.exists(timeout=5000), 'Launch dialer failed'
        
        #MO call to 10086(cmcc) or 10010(unicom)
        d(description='one').click()
        d(description='zero').click()
        d(description='zero').click()
        d(description='one').click()
        d(description='zero').click()
        assert d.exists(text="10010") , 'Input number error!'
        
        #Press the call button
        d(text='Keypad').click.wait()
        
        #Wait 'Dialing' to see if begin to dial, and wait 'Dialing' disappear to see if connected. 
        #Wait '0:10' to see if duration is over 10s.  
        assert d(text="Dialing").wait.exists(timeout=10000), 'Should begin to dialing in 10 secs'
        assert d(text="Dialing").wait.gone(timeout=10000), 'Should connect in 10 secs'
        assert d(textStartsWith="0:1").wait.exists(timeout=15000), 'Call duration should be 10 secs'

        d(className='android.widget.Button', index=1).click.wait()
        assert d(text='Keypad').wait.exists(timeout=10000), 'Should Hangup in 10s.'
Exemple #31
0
 def _launchCamera(self):
     d.start_activity(component = ACTIVITY_NAME)
Exemple #32
0
 def launchGallery(self):
     d.start_activity(component=ACTIVITY_NAME)
     #Confirm gallery launch successfully by the icon on left-top corner
     assert d(description='Switch to camera').wait.exists(
         timeout=5000), 'Gallery launch failed in 5s'
 def _launchCamera(self):
     d.start_activity(component = ACTIVITY_NAME)
Exemple #34
0
 def _launchCamera(self):
     d.start_activity(component = ACTIVITY_NAME)
     time.sleep(1)
     assert d(resourceId = 'com.intel.camera22:id/mode_button').wait.exists(timeout = 3000), 'Launch camera failed in 3s'