def testAnimateInGridView(self):
     """
     Summary: animate picture in gallery
     Step:
     1.Launch gallery activity 
     2.Enter Grid view
     3.Select two or more pics
     4.Tap Extra Menu
     5.Tap animate option
     6.Random select the options
     7.Tap create button
     """
     # Step 3 + Step 4
     self._longtouchscreencenter()
     d.click(100,300)
     d.click(100,500)
     # Step 4 + Step 5
     u.setMenuOptions('Animate')
     # Step 6 + Step 7
     d(text = 'Animated GIF').click()
     d(text = 'Create').click()
     time.sleep(2)
     d(text = 'Save').click.wait()
     time.sleep(2)
     # confirm create complete
     result = commands.getoutput('adb shell ls -l /sdcard/Sharing | grep gif | wc -l')
     if string.atoi(result) != 1:
         self.fail('animated failed')
 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 testCreateAnimateGIF(self):
     self._checkResource()
     self._launchGallery()
     self._enterGridView()
     d.swipe(390, 280, 391, 281) #Long click the first picture on second row
     #This will run 3 circles, means select the second, the third and the fouth pic on second row
     for y in range(530, 1100, 250): #530 = 280 + 250, that means the second pic on second row
         d.click(390, y)
     d(description = 'More options').click.wait() #Tap on the extra menu
     assert d(text = 'Animate').wait.exists(timeout = 2000)
     d(text = 'Animate').click.wait() #Try to convert the selected pictures to an animate
     assert d(text = 'Animated GIF').wait.exists(timeout = 3000), 'Animate does not pop up in 3s'
     d(text = 'Animated GIF').click.wait() #Select Video to convert
     assert d(text = 'Speed').wait.exists(timeout = 2000)
     #Count has been changed, so get count before converting here
     before = commands.getoutput(GET_CONVERT_COUNT) #Count before creating animate
     d(text = 'Create').click.wait() #Tap on create button
     time.sleep(5) #This action may take a few seconds, but faster than video
     assert d(text = 'Save').wait.exists(timeout = 2000), 'Converting does not complete in 7s'
     #Save and check
     d(text = 'Save').click.wait() #Save the animate
     time.sleep(5) #Saving action    
     after = commands.getoutput(GET_CONVERT_COUNT) #Count after creating animate
     if string.atoi(before) == string.atoi(after) - 1 or string.atoi(before) == string.atoi(after) - 2:
         pass
     else:
         self.fail('Converting picture failed.')
 def testAddingEventVenue(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'
     #Add & delete Event****************************************************************
     d(resourceId = 'com.intel.android.gallery3d:id/event_edit').click.wait() #Add new event
     d(resourceId = 'com.intel.android.gallery3d:id/search_text').set_text('HappyDay') #Input envent
     self._clickDoneButton()
     assert d(text = 'HappyDay').wait.exists(timeout = 2000), 'Set Event failed'
     d(resourceId = 'com.intel.android.gallery3d:id/event_edit').click.wait() #Delete event
     self._clearInputText()
     self._clickDoneButton()
     assert d(text = 'Add an event').wait.exists(timeout = 2000), 'Event has not been deleted'
     #Add & delete Venue****************************************************************
     d(resourceId = 'com.intel.android.gallery3d:id/venue_edit').click.wait() #Add new venue
     d(resourceId = 'com.intel.android.gallery3d:id/search_text').set_text('RNB') #Input venue
     self._clickDoneButton()
     assert d(text = 'RNB').wait.exists(timeout = 2000), 'Set Venue failed'
     d(resourceId = 'com.intel.android.gallery3d:id/venue_edit').click.wait() #Delete venue
     self._clearInputText()
     self._clickDoneButton()
     assert d(text = 'Add a venue').wait.exists(timeout = 2000), 'Venue has not been deleted'
    def testAddingPlaceEventToGroup(self):
        self._checkResource()
        self._launchGallery()
        d.swipe(360, 780, 361, 781) #Long click the album
        assert d(text = '1 selected').wait.exists(timeout = 2000) #Check whether the album has been highlighted
        #Edit place for album
        d(description = 'More options').click.wait()
        assert d(text = 'Edit Place').wait.exists(timeout = 2000)
        d(text = 'Edit Place').click.wait()
        d(text = 'Enter new venue').set_text('RNB01') #Input place info
        self._clickDoneButton()

        d.swipe(360, 780, 361, 781) #Long click the album

        #Edit event for album
        d(description = 'More options').click.wait()
        assert d(text = 'Edit Event').wait.exists(timeout = 2000)
        d(text = 'Edit Event').click.wait()
        d(text = 'Enter new event').set_text('Sprint Review') #Input event info
        self._clickDoneButton()
        #Check place and event
        self._enterSingleView()
        self._showPopupCard()
        d.click(350,1100) #Tap on pop up card bar to invoke it
        assert d(text = 'RNB01').wait.exists(timeout = 2000)
        assert d(text = 'Sprint Review').wait.exists(timeout = 2000)
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'
 def _enableGalleryFR(self):
     d(description = 'More options').click.wait()
     try:
         assert d(text = 'Face recognition Off').wait.exists(timeout = 2000)
         d.click(660,120)
     except:
         d(text = 'Face recognition On').click.wait()
 def _setGeoOn(self):
     geovalue = commands.getoutput(CAMERA_GEOTAG_ON_OFF)
     geoonoffv = geovalue.find('off')
     if geoonoffv != -1:
         d(description = 'Camera settings').click.wait()
         d.click(290,170) #Tap on Geo point
         d.click(170,300) #Set Geo On
    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.'
 def testAddKeywordsToAllInGridView(self):
     """
     Summary: animate picture in gallery
     Step:
     1.Launch gallery activity 
     2.Enter Grid view
     3.Long touch a pic or video to select
     4.Tap select file dropdown 
     5.Tap select all option
     6.Tap extra menu
     7.Tap add keywords option
     8.Input tag and tap DONE icon
     9.Exit socialgallery app
     """
     # Step 3
     self._longtouchscreencenter()
     # Step 4 + Step 5
     d(text = '1 selected').click()
     d(text = 'Select all').click()
     # Step 6 + Step 7
     u.setMenuOptions('Add a keyword')
     # Step 8
     d(text="Enter new keyword").set_text("New Keyword")
     d.click(650,1130) # click 'done' icon on the keyboard.
     # confirm back to gallery
     self._longtouchscreencenter()
     d(text = '1 selected').click()
     d(text = 'Select all').click()       
     u.setMenuOptions('Add a keyword')
     assert d(text = 'New Keyword').exists
Exemple #11
0
 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)
Exemple #12
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 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 showPopCard(self):
     d.click(350, 100).wait(1000)  # The center of the top action bar
     d.click(350, 100).wait(
         1000
     )  # Sometimes there is no response if tap here only once. Although it has poped up, tap here would do no thing for the case
     assert d(description="Share").wait.exists(
         timeout=2000
     ), "Pop card does not display after tapping on the top bar twice"
Exemple #15
0
 def showPopCard(self):
     d.click(350, 100).wait(1000)  #The center of the top action bar
     d.click(350, 100).wait(
         1000
     )  #Sometimes there is no response if tap here only once. Although it has poped up, tap here would do no thing for the case
     assert d(description='Share').wait.exists(
         timeout=2000
     ), 'Pop card does not display after tapping on the top bar twice'
Exemple #16
0
 def _launchSmail(self):
     try:
         d(text = 'OK').wait.exists(timeout=3000)
         d(text = 'OK').click.wait()
     except:
         pass
     finally:    
         d.click(650,1090)
         d.click(650,930)
Exemple #17
0
 def _launchpanorama(self):
     try:
         d(text = 'OK').wait.exists(timeout=3000)
         d(text = 'OK').click.wait()
     except:
         pass
     finally:    
         d.click(650,1090)
         time.sleep(2)
         d.click(80,1084) 
Exemple #18
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.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()
Exemple #19
0
 def _launchperfectshot(self):
     try:
         d(text = 'OK').wait.exists(timeout=3000)
         d(text = 'OK').click.wait()
     except:
         pass
     finally: 
         d.click(650,1090)
         time.sleep(3)
         d.click(230,1097) 
Exemple #20
0
    def testSendMessage2(self):
        assert d.exists(text='Messaging')
        d(text='Messaging').click()
        assert d.exists(text='No conversations')
        d.click('create_btn.png')

        if d.find('input_label.png'):
            d.click('input_label.png')\
             .click('content_label.png')

        assert d.exists(text='New message')
Exemple #21
0
 def _VideoMode(self):
     try:
         d(text = 'OK').wait.exists(timeout=3000)
         d(text = 'OK').click.wait()
     except:
         pass
     finally:
         d.click(650,1090)
         time.sleep(3)
         d.click(492,1101)
         time.sleep(5)
Exemple #22
0
 def testPlayBurstPictures(self):
     """
     Steps:
          1.Launch gallery activity 
          2.Enter Full View
          3.Tap play burst icon
     """
     d.click(350,620)  
     time.sleep(7)
     d.click(324,100)
     time.sleep(1)
     assert d(resourceId = 'android:id/home').wait.exists(timeout=2000),'play fail '
Exemple #23
0
 def selectPictueWhenEditBurst(self, imagesSelect):
     #Could display 5 pictures on selection bar at most, when the count of image selected bigger than 5, need swipe
     x = 70  #The abscissa of the first picture
     while imagesSelect > 0:
         d.click(x, 250)
         time.sleep(1)  #Sometimes case failed if tap action is too fast
         x = x + 150  #The gap between two pictures are 150 pix
         if x > 700:  #The left boundry of the fifth image, so if abscissa over than 600, need swipe
             d.swipe(650, 250, 1, 250, steps=5)
             time.sleep(1)
             x = 70  #Reset the first abscissa
         imagesSelect = imagesSelect - 1
 def selectPictueWhenEditBurst(self, imagesSelect):
     # Could display 5 pictures on selection bar at most, when the count of image selected bigger than 5, need swipe
     x = 70  # The abscissa of the first picture
     while imagesSelect > 0:
         d.click(x, 250)
         time.sleep(1)  # Sometimes case failed if tap action is too fast
         x = x + 150  # The gap between two pictures are 150 pix
         if x > 700:  # The left boundry of the fifth image, so if abscissa over than 600, need swipe
             d.swipe(650, 250, 1, 250, steps=5)
             time.sleep(1)
             x = 70  # Reset the first abscissa
         imagesSelect = imagesSelect - 1
Exemple #25
0
 def _setPictureSizeStatus(self, status):
     #commands.getoutput('adb shell input swipe 530 6 523 22')
     d.swipe(530, 6, 523, 22)
     d(description='Camera settings').click.wait()
     #.d()
     if status == 'WideScreen':
         d.click(60, 292)
     elif status == 'StandardScreen':
         d.click(180, 292)
     state = commands.getoutput()
     statevalue = state.find(status)
     if statevalue == -1:
         self.fail('set camera picture size to' + status + 'fail!')
Exemple #26
0
 def _setPictureSizeStatus(self,status):
     #commands.getoutput('adb shell input swipe 530 6 523 22')
     d.swipe(530,6,523,22)
     d(description = 'Camera settings').click.wait()
     #.d()
     if status == 'WideScreen':
         d.click(60,292)
     elif status == 'StandardScreen':
         d.click(180,292)
     state = commands.getoutput()
     statevalue = state.find(status)
     if statevalue == -1:
         self.fail('set camera picture size to' + status +'fail!')
Exemple #27
0
    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')
Exemple #28
0
 def testSmallPlayBurstIconOfPageflip(self):
     """
     Summary:This case test play burst with Page flip mode in burst view.
     Precondition: There are burst pictures in sdcard
     Steps:
       1. Launch Intel gallery and enter to burst view
       2. Tap small play burst icon -> Page flip, wait some seconds to check if stopped the playing
     """ 
     self._burstMenuOption('Playback','Page flip')
     time.sleep(15)
     d.click(324,100)
     time.sleep(1)
     assert d(resourceId = 'com.intel.android.gallery3d:id/action_share').wait.exists(timeout = 3000), 'play fail'
 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'
Exemple #30
0
 def _setFlashStatus(self,status):
     #commands.getoutput('adb shell input swipe 530 6 523 22')
     # Touch flash setting
     d.swipe(530,6,523,22)
     d(description = 'Camera settings').click.wait()
     if status == 'on':
         d.click(176,176)
     elif status == 'off':
         d.click(59,178)
     else:
         self.touch((296,176))
     state = commands.getoutput(PictureSize_STATE)
     statevalue = state.find(status)
     if statevalue == -1:
         self.fail('set camera flash status to' + status + 'fail!') 
Exemple #31
0
 def _setFlashStatus(self, status):
     #commands.getoutput('adb shell input swipe 530 6 523 22')
     # Touch flash setting
     d.swipe(530, 6, 523, 22)
     d(description='Camera settings').click.wait()
     if status == 'on':
         d.click(176, 176)
     elif status == 'off':
         d.click(59, 178)
     else:
         self.touch((296, 176))
     state = commands.getoutput(PictureSize_STATE)
     statevalue = state.find(status)
     if statevalue == -1:
         self.fail('set camera flash status to' + status + 'fail!')
Exemple #32
0
 def testSmallPlayBurstIconOfDissolve(self):
     """
     Summary:This case test play burst with Dissolve mode in burst view.
     Precondition: There are burst pictures in sdcard
     Steps:
       1. Launch Intel gallery and enter to burst view
       2. Tap small play burst icon -> Dissolve, wait some seconds to check if stopped the playing
     """  
     #Step 2
     #Tap small play burst icon twice,the fist tap try to activity the tool bar due to it is disappeared
     self._burstMenuOption('Playback','Dissolve')
     time.sleep(7)
     d.click(324,100)
     time.sleep(1)
     assert d(resourceId = 'com.intel.android.gallery3d:id/action_share').wait.exists(timeout = 3000), 'play fail'
 def testQuickSwitchtoGallery(self):
     """
     Summary:testQuickSwitchtoGallery: Quick Switch to gallery 
     Steps:  1. Launch camera 
             2. Touch shutter button to capture a picture
             3. Touch the thubnail icon to view it in gallery 
     """ 
     # step 2
     time.sleep(1)
     self._checkCapturedPic()                                         # capture picture
     time.sleep(1)                                    
     d(resourceId = 'com.intel.camera22:id/thumbnail').click.wait()   # enter gallery
     time.sleep(2)
     # step 2
     d.click(500,500)
     time.sleep(1)
     assert d(resourceId = 'android:id/home').wait.exists(timeout = 3000)
Exemple #34
0
 def _btakePicture(self):
     result = commands.getoutput('adb shell ls '+DCIM_PATH)
     if result.find(CAMERA_FOLDER) == -1:
         self.logger.info("no 100ANDRO folder.")
         before = '0'
     #Get the number of photo in sdcard
     else:
         before = commands.getoutput('adb shell ls /sdcard/DCIM/100ANDRO/* | grep BST | wc -l')
         time.sleep(3)
     d.click(356,1100)
     time.sleep(2)
     after = commands.getoutput('adb shell ls /sdcard/DCIM/100ANDRO/* | grep BST | wc -l')
     time.sleep(2)
     if string.atoi(before) < string.atoi(after) - 2 :
         print('take picture success!')
     else:
         self.fail('take picture fail!')          
Exemple #35
0
 def testEnterGalleryFromGalleryPreviewThumbnail100times(self):
     '''
     Summary: enter gallery from gallery preview thumbnail 100times
     Steps  : 1.Launch single capture activity
              2.enter gallery from gallery preview thumbnail 100times
              3.Exit  activity
     '''
     for i in range(100):
         time.sleep(3)
         tb.captureAndCheckPicCount('single', 2)  # capture picture
         time.sleep(1)
         d(resourceId='com.intel.camera22:id/thumbnail').click.wait(
         )  # enter gallery
         time.sleep(2)
         # step 2
         d.click(1200, 800)
         time.sleep(1)
         assert d(resourceId='android:id/home').wait.exists(timeout=3000)
         self._pressBack(1)
Exemple #36
0
 def _tapOnDoneButton(self):
     #Touch on Done button on the soft keyboard
     d.click(650, 1130)
Exemple #37
0
 def tapOnCenter(self):
     time.sleep(2)
     d.click(350, 700)