def test_soundrecorder(self): img_count = 0 app_name = 'feedback' try: cmd = 'am force-stop {0} '.format('com.android.bbksoundrecorder') self.device.shell(cmd) time.sleep(1) self.device.start_application( 'com.android.bbksoundrecorder/.SoundRecorder') time.sleep(2) common.screenshots(app_name, img_count) img_count += 1 # time.sleep(3) cmd = 'input tap {0} {1}'.format(int(self.width / 50 * 43), (int(self.height / 50 * 43))) self.device.shell(cmd) time.sleep(1) common.screenshots(app_name, img_count) img_count += 1 except Exception, ex: print ex self.assertEqual(1, 0, ex)
def test_minimap(self): img_count = 0 app_name = 'minimap' try: self.device.start_application('com.autonavi.minimap/com.autonavi.map.activity.NewMapActivity') time.sleep(2) cmd = 'am force-stop {0} '.format( 'com.autonavi.minimap') self.device.shell(cmd) time.sleep(2) self.device.start_application('com.autonavi.minimap/com.autonavi.map.activity.NewMapActivity') time.sleep(2) common.screenshots(app_name, img_count) img_count += 1 time.sleep(2) cmd = 'input tap {0} {1}'.format( int(self.width / 2), (int(self.height / 10))) self.device.shell(cmd) time.sleep(10) common.screenshots(app_name, img_count) img_count += 1 except Exception, ex: print ex self.assertEqual(1, 0, ex)
def test_dial(self): app_name = 'dial' try: self.device.start_application( 'com.android.dialer/.BBKTwelveKeyDialer') time.sleep(2) cmd = 'am force-stop {0} '.format('com.android.dialer') self.device.shell(cmd) time.sleep(5) self.device.start_application( 'com.android.dialer/.BBKTwelveKeyDialer') time.sleep(2) common.screenshots(app_name, '拨号') # swipe screen for all dial cmd = 'input swipe {0} {1} {2} {3}'.format( int(self.width / 2), (int(self.height / 2)), int(self.width / 2), (int(self.height / 2) + 300)) self.device.shell(cmd) time.sleep(2) myuiautomator.click_popup_window(DEVICE_NAME, [u'未接']) time.sleep(2) common.screenshots(app_name, '未接') self.assertEqual(1, 1) except Exception, ex: print ex self.assertEqual(1, 0, ex)
def test_note(self): img_count = 0 app_name = 'note' try: self.device.start_application('com.android.notes/.Notes') time.sleep(2) cmd = 'am force-stop {0} '.format('com.android.notes') self.device.shell(cmd) time.sleep(2) self.device.start_application('com.android.notes/.Notes') time.sleep(2) common.screenshots(app_name, img_count) img_count += 1 # check note list # self.device.send_keyevent(adbtools.KeyCode.KEYCODE_BACK) cmd = 'input tap {0} {1}'.format(int(self.width / 2), (int(self.height / 5))) self.device.shell(cmd) time.sleep(2) common.screenshots(app_name, img_count) self.assertEqual(1, 1) except Exception, ex: print ex self.assertEqual(1, 0, ex)
def test_home(self): img_count = 0 app_name = 'home' try: # screenshot home page common.screenshots(app_name, img_count) img_count += 1 # swipe screen for multiple pages of home # width, height = self.device.get_screen_normal_size() # width = int(width) # height = int(height) cmd = 'input swipe {0} {1} {2} {3}'.format(int(self.width / 3 * 2), (int(self.height / 2)), int(self.width / 3), (int(self.height / 2))) self.device.shell(cmd) common.screenshots(app_name, img_count) self.assertEqual(1, 1) except Exception, ex: print ex self.assertEqual(1, 0, ex)
def test_message(self): img_count = 0 app_name = 'message' try: self.device.start_application( 'com.android.mms/.ui.ConversationList') time.sleep(2) cmd = 'am force-stop {0} '.format('com.android.mms') self.device.shell(cmd) time.sleep(5) self.device.start_application( 'com.android.mms/.ui.ConversationList') time.sleep(2) common.screenshots(app_name, img_count) img_count += 1 # check message info cmd = 'input tap {0} {1}'.format(int(self.width / 2), (int(self.height / 5))) self.device.shell(cmd) time.sleep(2) common.screenshots(app_name, img_count) self.assertEqual(1, 1) except Exception, ex: print ex self.assertEqual(1, 0, ex)
def test_news(self): img_count = 0 app_name = 'news' try: self.device.start_application('com.ss.android.article.news/.activity.MainActivity') time.sleep(10) cmd = 'am force-stop {0} '.format( 'com.ss.android.article.news') self.device.shell(cmd) time.sleep(2) self.device.start_application('com.ss.android.article.news/.activity.MainActivity') time.sleep(10) common.screenshots(app_name, img_count) img_count += 1 time.sleep(2) cmd = 'input tap {0} {1}'.format( int(self.width / 2), (int(self.height / 2))) self.device.shell(cmd) time.sleep(5) common.screenshots(app_name, img_count) img_count += 1 time.sleep(2) cmd = 'input tap {0} {1}'.format( int(self.width / 5 * 3), (int(self.height / 20 * 19))) self.device.shell(cmd) time.sleep(2) common.screenshots(app_name, img_count) img_count += 1 time.sleep(1) self.device.send_keyevent(adbtools.KeyCode.KEYCODE_BACK) time.sleep(2) cmd = 'input tap {0} {1} '.format( int(self.width / 2 + 50), int(self.height / 20 * 19)) self.device.shell(cmd) time.sleep(2) common.screenshots(app_name, img_count) img_count += 1 time.sleep(2) cmd = 'input tap {0} {1} '.format( int(self.width / 2), int(self.height / 4)) self.device.shell(cmd) time.sleep(2) cmd = 'input swipe {0} {1} {2} {3} 100'.format( int(self.width / 2), int(self.height / 10 * 9), int(self.width / 2), int(self.height / 10)) self.device.shell(cmd) common.screenshots(app_name, img_count) img_count += 1 except Exception, ex: print ex self.assertEqual(1, 0, ex)
def test_contacts(self): img_count = 0 app_name = 'contacts' try: self.device.start_application( 'com.android.contacts/.DialtactsContactsEntryActivity') time.sleep(2) common.screenshots(app_name, img_count) self.assertEqual(1, 1) except Exception, ex: print ex self.assertEqual(1, 0, ex)
def test_notification(self): img_count = 0 app_name = 'notification' try: cmd = 'input swipe {0} {1} {2} {3}'.format(int(self.width / 2), 0, int(self.width / 2), (int(self.height / 2))) self.device.shell(cmd) common.screenshots(app_name, img_count) self.assertEqual(1, 1) except Exception, ex: print ex self.assertEqual(1, 0, ex)
def test_feedback(self): app_name = 'feedback' try: self.device.start_application('com.bbk.iqoo.feedback/.activities.UserFeedBackActivity') time.sleep(2) cmd = 'am force-stop {0} '.format( 'com.bbk.iqoo.feedback') self.device.shell(cmd) time.sleep(1) self.device.start_application('com.bbk.iqoo.feedback/.activities.UserFeedBackActivity') time.sleep(2) common.screenshots(app_name, '意见反馈') # 我的反馈 time.sleep(10) cmd = 'input tap {0} {1}'.format( int(self.width / 20 * 19), (int(self.height / 100 * 7))) self.device.shell(cmd) time.sleep(1) common.screenshots(app_name, '我的反馈') time.sleep(2) self.device.send_keyevent(adbtools.KeyCode.KEYCODE_BACK) # 反馈 time.sleep(2) if myuiautomator.in_or_not(DEVICE_NAME, u'闪退') == True: myuiautomator.click_popup_window(DEVICE_NAME, [u'闪退']) time.sleep(1) common.screenshots(app_name, '闪退') time.sleep(2) self.device.send_keyevent(adbtools.KeyCode.KEYCODE_BACK) # 常见帮助 time.sleep(2) myuiautomator.click_popup_window(DEVICE_NAME, [u'常见帮助']) time.sleep(20) common.screenshots(app_name, '常见帮助') # 问题 time.sleep(10) cmd = 'input tap {0} {1}'.format( int(self.width / 2), (int(self.height / 2))) self.device.shell(cmd) time.sleep(1) common.screenshots(app_name, '问题') except Exception, ex: print ex self.assertEqual(1, 0, ex)
def test_note(self): img_count = 0 app_name = 'note' try: self.device.start_application('com.android.notes/.Notes') time.sleep(2) common.screenshots(app_name, img_count) img_count += 1 # check note list self.device.send_keyevent(adbtools.KeyCode.KEYCODE_BACK) common.screenshots(app_name, img_count) self.assertEqual(1, 1) except Exception, ex: print ex self.assertEqual(1, 0, ex)
def test_contacts(self): app_name = 'contacts' try: self.device.start_application( 'com.android.contacts/.DialtactsContactsEntryActivity') time.sleep(2) cmd = 'am force-stop {0} '.format('com.android.contacts') self.device.shell(cmd) time.sleep(5) self.device.start_application( 'com.android.contacts/.DialtactsContactsEntryActivity') time.sleep(2) common.screenshots(app_name, '联系人') self.assertEqual(1, 1) except Exception, ex: print ex self.assertEqual(1, 0, ex)
def test_calendar(self): img_count = 0 app_name = 'calendar' try: self.device.start_application('com.bbk.calendar/.MainActivity') time.sleep(2) cmd = 'am force-stop {0} '.format( 'com.bbk.calendar') self.device.shell(cmd) time.sleep(5) self.device.start_application('com.bbk.calendar/.MainActivity') time.sleep(2) common.screenshots(app_name, '日历') img_count += 1 self.assertEqual(1, 1) except Exception, ex: print ex self.assertEqual(1, 0, ex)
def test_home(self): img_count = 0 app_name = 'home' try: # screenshot home page common.screenshots(app_name, img_count) img_count += 1 cmd = 'input swipe {0} {1} {2} {3}'.format(int(self.width / 3 * 2), (int(self.height / 2)), int(self.width / 3), (int(self.height / 2))) self.device.shell(cmd) common.screenshots(app_name, img_count) self.assertEqual(1, 1) except Exception, ex: print ex self.assertEqual(1, 0, ex)
def test_qiyi(self): app_name = 'qiyi' try: self.device.start_application( 'com.qiyi.video/org.qiyi.android.video.MainActivity') time.sleep(10) cmd = 'am force-stop {0} '.format('com.qiyi.video') self.device.shell(cmd) time.sleep(2) self.device.start_application( 'com.qiyi.video/org.qiyi.android.video.MainActivity') time.sleep(10) common.screenshots(app_name, '首页') time.sleep(2) cmd = 'input tap {0} {1}'.format(int(self.width / 5 * 3), (int(self.height / 10))) self.device.shell(cmd) time.sleep(2) cmd = 'input tap {0} {1}'.format(int(self.width / 2), (int(self.height / 3 * 2))) self.device.shell(cmd) time.sleep(20) common.screenshots(app_name, '弹幕') time.sleep(2) cmd = 'input tap {0} {1}'.format(int(self.width / 10 * 7), (int(self.height / 5 * 3 - 100))) self.device.shell(cmd) time.sleep(5) common.screenshots(app_name, '评论') except Exception, ex: print ex self.assertEqual(1, 0, ex)
def test_cloudmusic(self): app_name = 'cloudmusic' try: myuiautomator.click_popup_window(DEVICE_NAME, [u'网易云音乐']) time.sleep(5) cmd = 'am force-stop {0} '.format('com.netease.cloudmusic') self.device.shell(cmd) time.sleep(2) myuiautomator.click_popup_window(DEVICE_NAME, [u'网易云音乐']) time.sleep(5) common.screenshots(app_name, '网易云音乐-首页') time.sleep(2) myuiautomator.click_popup_window(DEVICE_NAME, [u'排行榜']) time.sleep(2) cmd = 'input swipe {0} {1} '.format(int(self.width / 2), int(self.height / 2)) self.device.shell(cmd) time.sleep(20) common.screenshots(app_name, '排行榜') time.sleep(2) cmd = 'input swipe {0} {1} '.format(int(self.width / 100 * 13), int(self.height / 5 * 2)) self.device.shell(cmd) time.sleep(20) common.screenshots(app_name, '排行榜-评论') except Exception, ex: print ex self.assertEqual(1, 0, ex)
def test_filemanager(self): app_name = 'filemanager' try: self.device.start_application('com.android.filemanager/.FileManagerActivity') time.sleep(2) cmd = 'am force-stop {0} '.format( 'com.android.filemanager') self.device.shell(cmd) time.sleep(5) self.device.start_application('com.android.filemanager/.FileManagerActivity') time.sleep(2) if myuiautomator.in_or_not(DEVICE_NAME, u'分类浏览') == True: myuiautomator.click_popup_window(DEVICE_NAME, [u'分类浏览']) time.sleep(1) common.screenshots(app_name, '分类浏览') else: pass time.sleep(2) if myuiautomator.in_or_not(DEVICE_NAME, u'音乐') == True: myuiautomator.click_popup_window(DEVICE_NAME, [u'音乐']) time.sleep(1) common.screenshots(app_name, '音乐') time.sleep(2) self.device.send_keyevent(adbtools.KeyCode.KEYCODE_BACK) else: pass time.sleep(2) if myuiautomator.in_or_not(DEVICE_NAME, u'文档') == True: myuiautomator.click_popup_window(DEVICE_NAME, [u'文档']) time.sleep(1) common.screenshots(app_name, '文档') time.sleep(2) self.device.send_keyevent(adbtools.KeyCode.KEYCODE_BACK) else: pass time.sleep(2) if myuiautomator.in_or_not(DEVICE_NAME, u'手机存储') == True: myuiautomator.click_popup_window(DEVICE_NAME, [u'手机存储']) time.sleep(1) common.screenshots(app_name, '手机存储') self.assertEqual(1, 1) except Exception, ex: print ex self.assertEqual(1, 0, ex)
def test_weather(self): app_name = 'weather' try: self.device.start_application('com.vivo.weather/.WeatherMain') time.sleep(2) cmd = 'am force-stop {0} '.format('com.vivo.weather') self.device.shell(cmd) time.sleep(1) self.device.start_application('com.vivo.weather/.WeatherMain') time.sleep(2) common.screenshots(app_name, '首页') # 首页-设置 time.sleep(10) cmd = 'input tap {0} {1}'.format(int(self.width / 20 * 19), (int(self.height / 100 * 7))) self.device.shell(cmd) time.sleep(1) common.screenshots(app_name, '首页-设置') # 添加城市 time.sleep(2) cmd = 'input tap {0} {1}'.format(int(self.width / 20 * 19), (int(self.height / 100 * 7))) self.device.shell(cmd) time.sleep(1) common.screenshots(app_name, '添加城市') time.sleep(2) self.device.send_keyevent(adbtools.KeyCode.KEYCODE_BACK) time.sleep(2) self.device.send_keyevent(adbtools.KeyCode.KEYCODE_BACK) except Exception, ex: print ex self.assertEqual(1, 0, ex)
def test_tips(self): img_count = 0 app_name = 'tips' try: time.sleep(2) myuiautomator.click_popup_window(DEVICE_NAME, [u'使用技巧']) time.sleep(2) common.screenshots(app_name, img_count) img_count += 1 # 首页-设置 time.sleep(10) cmd = 'input tap {0} {1}'.format( int(self.width / 20), (int(self.height / 100 * 7))) self.device.shell(cmd) time.sleep(1) common.screenshots(app_name, img_count) img_count += 1 # 空间管理 time.sleep(10) cmd = 'input tap {0} {1}'.format( int(self.width / 2), (int(self.height / 2))) self.device.shell(cmd) time.sleep(2) common.screenshots(app_name, img_count) img_count += 1 time.sleep(2) self.device.send_keyevent(adbtools.KeyCode.KEYCODE_BACK) except Exception, ex: print ex self.assertEqual(1, 0, ex)
def test_camera(self): app_name = 'camera' try: self.device.start_application('com.android.camera/.CameraActivity') time.sleep(2) cmd = 'am force-stop {0} '.format('com.android.camera') self.device.shell(cmd) time.sleep(5) self.device.start_application('com.android.camera/.CameraActivity') time.sleep(2) common.screenshots(app_name, '相机') # 更多 time.sleep(2) cmd = 'input tap {0} {1}'.format(int(self.width / 25 * 23), int(self.height / 100 * 3)) self.device.shell(cmd) time.sleep(2) common.screenshots(app_name, '更多') time.sleep(2) self.device.send_keyevent(adbtools.KeyCode.KEYCODE_BACK) # 类型 time.sleep(2) cmd = 'input tap {0} {1}'.format(int(self.width / 25 * 23), int(self.height / 50 * 47)) self.device.shell(cmd) time.sleep(2) common.screenshots(app_name, '类型') except Exception, ex: print ex self.assertEqual(1, 0, ex)
def test_browser(self): img_count = 0 app_name = 'browser' try: self.device.start_application('com.vivo.browser/.MainActivity') time.sleep(2) common.screenshots(app_name, '首页') # check baidu web myuiautomator.click_element_by_name(DEVICE_NAME, u'搜索或输入网址') time.sleep(1) self.device.shell('input text baidu.com') time.sleep(1) self.device.send_keyevent(adbtools.KeyCode.KEYCODE_ENTER) time.sleep(1) common.screenshots(app_name, '百度') self.assertEqual(1, 1) except Exception, ex: print ex self.assertEqual(1, 0, ex)
def test_dial(self): img_count = 0 app_name = 'dial' try: self.device.start_application( 'com.android.dialer/.BBKTwelveKeyDialer') time.sleep(2) common.screenshots(app_name, img_count) img_count += 1 # swipe screen for all dial cmd = 'input swipe {0} {1} {2} {3}'.format( int(self.width / 2), (int(self.height / 2)), int(self.width / 2), (int(self.height / 2) + 300)) self.device.shell(cmd) common.screenshots(app_name, img_count) self.assertEqual(1, 1) except Exception, ex: print ex self.assertEqual(1, 0, ex)
def test_weibo(self): img_count = 0 app_name = 'weibo' try: self.device.start_application( 'com.sina.weibo/.VisitorMainTabActivity') time.sleep(10) cmd = 'am force-stop {0} '.format('com.sina.weibo') self.device.shell(cmd) time.sleep(5) self.device.start_application( 'com.sina.weibo/.VisitorMainTabActivity') time.sleep(10) common.screenshots(app_name, img_count) img_count += 1 time.sleep(2) cmd = 'input tap {0} {1}'.format(int(self.width / 5), (int(self.height / 5))) self.device.shell(cmd) time.sleep(2) cmd = 'input swipe {0} {1} {2} {3} 100'.format( int(self.width / 2), int(self.height / 10 * 9), int(self.width / 2), int(self.height / 10)) self.device.shell(cmd) time.sleep(2) common.screenshots(app_name, img_count) img_count += 1 time.sleep(2) self.device.send_keyevent(adbtools.KeyCode.KEYCODE_BACK) time.sleep(2) cmd = 'input tap {0} {1}'.format(int(self.width / 10 * 7), (int(self.height / 21 * 20))) self.device.shell(cmd) time.sleep(2) common.screenshots(app_name, img_count) img_count += 1 time.sleep(2) myuiautomator.click_popup_window(DEVICE_NAME, [u'微博热搜']) time.sleep(2) common.screenshots(app_name, img_count) img_count += 1 except Exception, ex: print ex self.assertEqual(1, 0, ex)
def test_videoplayer(self): img_count = 0 app_name = 'videoplayer' try: cmd = 'am force-stop {0} '.format('com.android.VideoPlayer') self.device.shell(cmd) time.sleep(2) self.device.start_application( 'com.android.VideoPlayer/.VideoPlayer') time.sleep(2) common.screenshots(app_name, img_count) img_count += 1 # 录制的视频 time.sleep(2) myuiautomator.click_popup_window(DEVICE_NAME, [u'录制的视频']) time.sleep(2) common.screenshots(app_name, img_count) img_count += 1 except Exception, ex: print ex self.assertEqual(1, 0, ex)
def test_qq(self): app_name = 'qq' try: self.device.start_application( 'com.tencent.mobileqq/.activity.SplashActivity') time.sleep(2) cmd = 'am force-stop {0} '.format('com.tencent.mobileqq') self.device.shell(cmd) time.sleep(2) self.device.start_application( 'com.tencent.mobileqq/.activity.SplashActivity') time.sleep(2) common.screenshots(app_name, '首页') time.sleep(2) # 腾讯新闻 time.sleep(3) if myuiautomator.in_or_not(DEVICE_NAME, u'服务号') == True: myuiautomator.click_popup_window(DEVICE_NAME, [u'服务号']) time.sleep(3) if myuiautomator.in_or_not(DEVICE_NAME, u'腾讯新闻') == True: myuiautomator.click_popup_window(DEVICE_NAME, [u'腾讯新闻']) time.sleep(2) common.screenshots(app_name, '腾讯新闻') time.sleep(2) self.device.send_keyevent(adbtools.KeyCode.KEYCODE_BACK) else: pass time.sleep(2) self.device.send_keyevent(adbtools.KeyCode.KEYCODE_BACK) else: pass # 联系人 time.sleep(2) myuiautomator.click_popup_window(DEVICE_NAME, [u'联系人']) time.sleep(2) common.screenshots(app_name, '联系人') # 动态 time.sleep(2) myuiautomator.click_popup_window(DEVICE_NAME, [u'动态']) time.sleep(2) common.screenshots(app_name, '动态') cmd = 'am force-stop {0} '.format('com.tencent.mobileqq') self.device.shell(cmd) except Exception, ex: print ex self.assertEqual(1, 0, ex)
def test_baidumap(self): app_name = 'baidumap' try: self.device.start_application( 'com.baidu.BaiduMap/com.baidu.baidumaps.MapsActivity') time.sleep(5) cmd = 'am force-stop {0} '.format('com.baidu.BaiduMap') self.device.shell(cmd) self.device.start_application( 'com.baidu.BaiduMap/com.baidu.baidumaps.MapsActivity') time.sleep(5) common.screenshots(app_name, '首页') time.sleep(2) cmd = 'input tap {0} {1}'.format(int(self.width / 2), (int(self.height / 10))) self.device.shell(cmd) time.sleep(1) common.screenshots(app_name, '搜索') except Exception, ex: print ex self.assertEqual(1, 0, ex)
def test_baidu(self): app_name = 'baidu' try: self.device.start_application('com.baidu.searchbox/.MainActivity') time.sleep(10) cmd = 'am force-stop {0} '.format('com.baidu.searchbox') self.device.shell(cmd) time.sleep(1) self.device.start_application('com.baidu.searchbox/.MainActivity') time.sleep(10) cmd = 'input tap {0} {1}'.format(int(self.width / 2), (int(self.height / 100 * 82))) self.device.shell(cmd) time.sleep(2) self.device.send_keyevent(adbtools.KeyCode.KEYCODE_BACK) time.sleep(2) myuiautomator.click_popup_window(DEVICE_NAME, [u'百度']) time.sleep(5) common.screenshots(app_name, '百度-首页') time.sleep(1) cmd = 'input tap {0} {1}'.format(int(self.width / 2), (int(self.height / 2))) self.device.shell(cmd) time.sleep(5) common.screenshots(app_name, '新闻') time.sleep(1) cmd = 'input tap {0} {1}'.format(int(self.width / 100 * 67), (int(self.height / 100 * 99))) self.device.shell(cmd) time.sleep(2) common.screenshots(app_name, '评论') time.sleep(2) self.device.send_keyevent(adbtools.KeyCode.KEYCODE_BACK) time.sleep(2) myuiautomator.click_popup_window(DEVICE_NAME, [u'未登录']) time.sleep(5) common.screenshots(app_name, '未登录') except Exception, ex: print ex self.assertEqual(1, 0, ex)
def test_clock(self): app_name = 'clock' try: self.device.start_application('com.android.BBKClock/.Timer') time.sleep(2) cmd = 'am force-stop {0} '.format( 'com.android.BBKClock') self.device.shell(cmd) self.device.start_application('com.android.BBKClock/.Timer') time.sleep(2) cmd = 'input tap {0} {1}'.format( int(self.width / 4 - 30 ), (int(self.height / 20 * 19))) self.device.shell(cmd) time.sleep(2) common.screenshots(app_name, '闹钟') time.sleep(2) cmd = 'input tap {0} {1}'.format( int(self.width / 2 - 30), (int(self.height / 20 * 19))) self.device.shell(cmd) time.sleep(2) common.screenshots(app_name, '世界时钟') time.sleep(2) cmd = 'input tap {0} {1}'.format( int(self.width / 2 + 30), (int(self.height / 20 * 19))) self.device.shell(cmd) time.sleep(2) common.screenshots(app_name, '秒表') time.sleep(2) cmd = 'input tap {0} {1}'.format( int(self.width / 4 * 3 + 30), (int(self.height / 20 * 19))) self.device.shell(cmd) time.sleep(2) common.screenshots(app_name, '计时器') self.assertEqual(1, 1) except Exception, ex: print ex self.assertEqual(1, 0, ex)
def test_douyin(self): app_name = 'douyin' try: self.device.start_application('com.ss.android.ugc.aweme/.main.MainActivity') time.sleep(20) cmd = 'am force-stop {0} '.format( 'com.ss.android.ugc.aweme') self.device.shell(cmd) time.sleep(5) self.device.start_application('com.ss.android.ugc.aweme/.main.MainActivity') time.sleep(60) common.screenshots(app_name, '首页') time.sleep(2) cmd = 'input tap {0} {1}'.format( int(self.width / 25 * 23), (int(self.height / 50 * 31))) self.device.shell(cmd) time.sleep(2) common.screenshots(app_name, '评论') time.sleep(2) self.device.send_keyevent(adbtools.KeyCode.KEYCODE_BACK) time.sleep(2) myuiautomator.click_popup_window(DEVICE_NAME, [u'消息']) time.sleep(5) common.screenshots(app_name, '消息') time.sleep(2) myuiautomator.click_popup_window(DEVICE_NAME, [u'我']) time.sleep(5) common.screenshots(app_name, '我') except Exception, ex: print ex self.assertEqual(1, 0, ex)
def test_photo(self): img_count = 0 app_name = 'photo' try: cmd = 'am start com.vivo.gallery' self.device.shell(cmd) time.sleep(3) cmd = 'am force-stop {0} '.format( 'com.vivo.gallery') self.device.shell(cmd) time.sleep(2) cmd = 'am start com.vivo.gallery' self.device.shell(cmd) time.sleep(3) common.screenshots(app_name, img_count) img_count += 1 # 相机照片 time.sleep(2) myuiautomator.click_popup_window(DEVICE_NAME, [u'相机照片']) time.sleep(2) common.screenshots(app_name, img_count) img_count += 1 # 相机 time.sleep(2) myuiautomator.click_popup_window(DEVICE_NAME, [u'全部相册']) time.sleep(2) myuiautomator.click_popup_window(DEVICE_NAME, [u'相机']) time.sleep(2) common.screenshots(app_name, img_count) img_count += 1 self.assertEqual(1, 1) except Exception, ex: print ex self.assertEqual(1, 0, ex)