def test_multi_select(self): logging.info('======test_multi_select=====') slv = SelectView(self.driver) slv.select_index('alldoc') iv = IconView(self.driver) iv.multi_select() self.assertTrue(iv.check_multi_select()) name = iv.multi_select_del('alldoc') self.assertTrue(iv.check_delete_file('alldoc', name))
def test_delete_file(self): logging.info('======test_delete_file=====') slv = SelectView(self.driver) iv = IconView(self.driver) types = ['last', 'alldoc'] for i in types: slv.select_index(i) file_name = iv.delete_file(i) self.assertTrue(iv.check_delete_file(i, file_name))
def test_cloud_alogin(self): logging.info('======test_cloud=====') # 云文档登录 sv = SelectView(self.driver) cv = CloudView(self.driver) sv.select_index('cloud') login_state = cv.exist( "//*[@resource-id='com.yozo.office:id/btn_logo']") print("====%s=====" % login_state) if login_state: data1 = cv.get_csv_data(self.csv_file, 4) cv.cloud_login_action(username=data1[0], password=data1[1]) self.assertTrue(cv.exist("//*[@text='自动上传']"), msg='Cloud login fail!')
def upload(self): # 上传云文档 logging.info('==========upload==========') slv = SelectView(self.driver) l = LoginView(self.driver) slv.select_index('alldoc') ele = self.driver.find_elements(By.ID, 'com.yozo.office:id/file_item')[0] ele.find_element(By.ID, 'com.yozo.office:id/lay_more').click() self.driver.find_element( By.ID, 'com.yozo.office:id/ll_filework_pop_upcloud').click() # 点击上传 logging.info('checking having already logined in') getele = self.get_toast_message('请先登录账号') if getele == True: slv.select_index('my') # self.find_element(By.ID, 'com.yozo.office:id/ll_bottommenu_my').click() logging.info('try login in') data = l.get_csv_data(self.csv_file, 4) l.login_action(data[0], data[1]) if l.check_login_status(): logging.info('login success in upload') slv.select_index('alldoc') ele = self.driver.find_elements( By.ID, 'com.yozo.office:id/file_item')[0] ele.find_element(By.ID, 'com.yozo.office:id/lay_more').click() self.driver.find_element( By.ID, 'com.yozo.office:id/ll_filework_pop_upcloud').click( ) # 点击上传 # self.driver.find_element(By.ID, 'com.yozo.office:id/yozo_ui_select_save_path_save_btn').click() # try: # btn = self.driver.find_element(By.ID, 'android:id/button1') # except NoSuchElementException: # pass # else: # btn.click() else: logging.error('login fail in upload') self.getScreenShot('login fail in upload') raise self.driver.find_element( By.ID, 'com.yozo.office:id/yozo_ui_select_save_path_save_btn').click() try: btn = self.driver.find_element(By.ID, 'android:id/button1') except NoSuchElementException: pass else: btn.click() slv.select_index('my') l.logout_action()
def test_file_type(self, f): logging.info('======test_file_type=====') slv = SelectView(self.driver) slv.select_index('alldoc') slv.select_file_type(f) self.assertTrue(slv.check_select_file_type(f))
def test_mark_star(self): logging.info('======test_mark_star=====') iv = IconView(self.driver) sv = SelectView(self.driver) # 最近文档:第一个文档标星 logging.info('======last_mark_star=====') sv.select_index('last') file_name = iv.mark_remove_star() self.assertTrue(iv.check_mark_star(file_name)) # 打开文档:第一个文档标星 logging.info('======alldoc_mark_star=====') sv.select_index('alldoc') sv.select_file_type('ss') file_name = iv.mark_remove_star() self.assertTrue(iv.check_mark_star(file_name))
def test_sort(self): logging.info('======test_sort=====') slv = SelectView(self.driver) slv.select_index('alldoc') slv.select_file_type('all') stv = SortView(self.driver) type = ['type', 'name', 'size', 'time'] # 可选择的排序类型 sort = ['up', 'down'] # 升序还是降序 for i in type: for j in sort: # type, sort = 'time', 'up' # stv.sort_file(type, sort) stv.sort_file(i, j)
def test_phone(self): slv = SelectView(self.driver) slv.select_index('alldoc') slv.phone_local() self.assertTrue(slv.cjeck_phone_local())