def test_wp_table_pop_menu(self): self.wp_insert_one_table() wp = WPView(self.driver) touch(wp.template_object('table_select.png')) touch(wp.template_object('copy.png')) touch(wp.template_object('table_select.png')) touch(wp.template_object('delete_table.png')) time.sleep(2) if wp.exist('//*[@text=" Font Color "]'): wp.fold_expand() text("YOZOYOZOYOZO") text("YOZOYOZOYOZO") if not exists(wp.template_object('point.png')): wp.get_element( '//*[@resource-id="com.yozo.office.en:id/yozo_ui_app_frame_office_view_container"]' ).click() touch(wp.template_object('point.png')) touch(wp.template_object('selectAll.png')) touch(wp.template_object('cut.png')) wp.group_button_click(' Insert ') wp.insert_example_table() touch(wp.template_object('table_select.png')) touch(wp.template_object('paste.png')) touch(wp.template_object('table_select.png')) touch(wp.template_object('clear.png')) touch(wp.template_object('table_select.png')) touch(wp.template_object('cut.png'))
def test_wp_shape_pop_menu_all(self, type1='wp'): cv = CreateView(self.driver) cv.create_file(type1) wp = WPView(self.driver) time.sleep(1) wp.pinch() wp.group_button_click(' Insert ') wp.insert_shape(type1, index=3) wp.fold_expand() touch(wp.template_object('rotate_free.png')) touch(wp.template_object('editText.png')) # 编辑文字 touch(wp.template_object('rotate_free.png')) touch(wp.template_object('copy.png')) # 复制 touch(wp.template_object('rotate_free.png')) touch(wp.template_object('cut.png')) # 剪切 touch(wp.template_object('point.png')) touch(wp.template_object('paste.png')) # 粘贴 touch(wp.template_object('rotate_free.png')) swipe(wp.template_object('editText.png'), wp.template_object('copy.png')) touch(wp.template_object('rotate_90.png')) touch(wp.template_object('rotate_free.png')) touch(wp.template_object('delete.png')) # 删除 time.sleep(10)
def wp_insert_one_table(self): logging.info('==========wp_insert_one_table==========') cv = CreateView(self.driver) cv.create_file('wp') wp = WPView(self.driver) wp.group_button_click(' Insert ') wp.insert_example_table()
def test_wp_font_attr(self): logging.info('==========test_wp_font_attr===========') cv = CreateView(self.driver) cv.create_file(self.file_type) time.sleep(1) wp = WPView(self.driver) wp.group_button_click(' Edit ') wp.font_size(16) wp.font_style(self.file_type, '倾斜') wp.font_color(self.file_type, 3) ele1 = '//*[@text=" Edit "]' ele2 = '//*[@text=" Font Color "]' ele3 = '//*[@text=" Highlight Color "]' ele4 = '//*[@text=" Columns "]' wp.swipe_ele(ele2, ele1) time.sleep(1) wp.tap(450, 450) for i in range(100): self.driver.press_keycode(random.randint(29, 54)) wp.group_button_click(' Edit ') wp.drag_coordinate(450, 500, 200, 500) wp.high_light_color(self.file_type, 3) wp.bullets_numbers(self.file_type, 6, 14) wp.text_align(self.file_type, '右对齐') wp.swipe_ele(ele3, ele1) wp.text_line_space(self.file_type, 2.5) wp.text_indent(self.file_type, '右缩进') wp.swipe_ele(ele4, ele1) wp.text_columns(4) wp.text_columns(3) wp.text_columns(2) time.sleep(3)
def insert_one_shape(self, type): # 将矩形 Insert wp中 cv = CreateView(self.driver) cv.create_file(type) wp = WPView(self.driver) wp.group_button_click(' Insert ') wp.get_element( '//*[@resource-id="com.yozo.office.en:id/yozo_ui_%s_option_id_insert_shape"]' '/android.widget.FrameLayout[3]' % type).click()
def test_wp_jump(self): # 跳转页 logging.info('==========test_wp_bookmark==========') ov = OpenView(self.driver) ov.open_file('欢迎使用永中Office.docx') wp = WPView(self.driver) wp.group_button_click('查看') wp.page_jump(7) time.sleep(2)
def test_wp_insert_watermark(self): logging.info('==========test_wp_insert_watermark==========') cv = CreateView(self.driver) cv.create_file('wp') wp = WPView(self.driver) wp.group_button_click(' Insert ') wp.insert_watermark('YOZO') time.sleep(1) wp.group_button_click(' Insert ') wp.insert_watermark('yozo', delete='delete') time.sleep(3)
def test_wp_bookmark(self): logging.info('==========test_wp_bookmark==========') ov = OpenView(self.driver) ov.open_file('欢迎使用永中Office.docx') wp = WPView(self.driver) wp.group_button_click('查看') wp.add_bookmark('test') self.assertTrue(wp.check_add_bookmark(), '书签插入失败!') wp.swipeUp() wp.swipeUp() wp.group_button_click('查看') wp.list_bookmark('test')
def test_wp_insert_chart_list(self, chart_type): cv = CreateView(self.driver) cv.create_file('wp') wp = WPView(self.driver) wp.group_button_click(' Insert ') s = wp.swipe_option('up') while not wp.exist('//*[@text=" Chart "]'): wp.swipe(s[0], s[1], s[2], s[3]) wp.get_element('//*[@text=" Chart "]').click() while not wp.exist('//*[@text="%s"]' % chart_type): wp.swipe(s[0], s[1], s[2], s[3]) wp.get_element('//*[@text="%s"]' % chart_type).click() wp.chart_insert_list('%s' % chart_type)
def test_wp_jump(self): # 跳转页 logging.info('==========test_wp_bookmark==========') gv = GeneralView(self.driver) gv.jump_to_index('alldoc') gv.select_file_type('wp') gv.sort_files('size', 'down') eles = self.driver.find_elements(By.ID, 'com.yozo.office.en:id/file_item') eles[0].click() wp = WPView(self.driver) wp.group_button_click(' File ') total_pages = self.driver.find_element( By.ID, 'com.yozo.office.en:id/yozo_id_print_wp_page_count').text str_list = total_pages.split(' ') total_pages = int(str_list[1]) wp.group_button_click(' View ') wp.page_jump(total_pages) time.sleep(2)
def test_wp_bookmark(self): logging.info('==========test_wp_bookmark==========') ov = OpenView(self.driver) ov.open_random_file('doc') wp = WPView(self.driver) wp.group_button_click(' View ') wp.add_bookmark('test') self.assertTrue(wp.check_add_bookmark(), '书签 Insert 失败!') # 收起键盘 self.driver.find_element( By.ID, 'com.yozo.office.en:id/yozo_ui_option_expand_button').click() self.driver.find_element( By.ID, 'com.yozo.office.en:id/yozo_ui_option_expand_button').click() wp.swipeUp() wp.swipeUp() wp.group_button_click(' View ') wp.list_bookmark('test')
def test_wp_check_approve(self): # 修订 logging.info('==========test_wp_check_approve==========') cv = CreateView(self.driver) cv.create_file(self.file_type) wp = WPView(self.driver) wp.group_button_click(' Review ') wp.change_name('super_root') wp.group_button_click(' Review ') wp.revision_on_off('ON') wp.tap(450, 550) for i in range(20): self.driver.press_keycode(random.randint(29, 54)) wp.group_button_click(' Review ') wp.revision_accept_not('yes') wp.tap(450, 550) for i in range(20): self.driver.press_keycode(random.randint(29, 54)) wp.group_button_click(' Review ') wp.revision_accept_not() wp.group_button_click(' Review ') wp.revision_on_off('OFF') time.sleep(3)
def insert_one_pic(self, type1): # 将图片 Insert wp中 cv = CreateView(self.driver) cv.create_file(type1) wp = WPView(self.driver) wp.group_button_click(' Insert ') wp.insert_pic()
def test_wp_table_insert(self): cv = CreateView(self.driver) cv.create_file('wp') wp = WPView(self.driver) wp.group_button_click(' Insert ') wp.table_insert_list()