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 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')
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 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
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)