Exemplo n.º 1
0
    def test_ppt_autoplay_to_last(self):
        logging.info('==========test_ppt_autoplay_to_last==========')
        cv = CreateView(self.driver)
        cv.create_file('pg')
        pg = PGView(self.driver)
        pg.add_new()
        pg.add_new()

        logging.info('==========autoplay to the last page==========')
        pg = PGView(self.driver)
        pg.group_button_click(' Play ')
        pg.play_mode('autoplay')

        logging.info('==========validate toast==========')
        try:
            WebDriverWait(self.driver, 120).until(
                ec.visibility_of_element_located(
                    (By.XPATH, '//*[@text="It has been the last slide."]')))
        except TimeoutException:
            self.assertTrue(False, '等待自动 Play 两分钟,未找到弹窗')
        else:
            toast = self.driver.find_element(
                By.XPATH, '//*[@text="It has been the last slide."]')
            self.assertEqual(toast.text, 'It has been the last slide.',
                             '验证弹窗信息为已是简报尾页')
Exemplo n.º 2
0
 def test_search_replace(self, file_type):  # 查找替换
     logging.info('==========test_search_replace==========')
     cv = CreateView(self.driver)
     gv = GeneralView(self.driver)
     cv.create_file(file_type)
     if file_type == 'ss':
         self.driver.find_element(
             By.ID,
             'com.yozo.office.en:id/formulabar_edit_container').click()
     elif file_type == 'pg':
         pg = PGView(self.driver)
         x, y = pg.get_size()
         pg.tap(x * 0.5, y * 0.4)
         pg.tap(x * 0.5, y * 0.4)
     elif file_type == 'wp':
         gv.tap(700, 700)
     self.driver.press_keycode(53)
     self.driver.press_keycode(43)
     self.driver.press_keycode(54)
     self.driver.press_keycode(43)
     if file_type in WS:
         if file_type == 'ss':
             self.driver.find_element(
                 By.ID, 'com.yozo.office.en:id/formulabar_ok').click()
         gv.group_button_click(' View ')
     gv.search_content(file_type, 'yozo')
     gv.replace_content('YOZO')
     time.sleep(3)
     gv.replace_content('yozo', 'all')
Exemplo n.º 3
0
    def test_ppt_insert_new(self):
        logging.info('==========test_ppt_insert_new==========')
        cv = CreateView(self.driver)
        cv.create_file('pg')

        logging.info('==========insert new ppt==========')
        pv = PGView(self.driver)
        pv.insert_new_ppt()
        gv = GeneralView(self.driver)
        gv.fold_expand()

        logging.info('==========validate insert success==========')
        thumbnails_list = self.driver.find_elements(By.CLASS_NAME,
                                                    'android.view.View')
        thumbnails_list[0].click()
        pv.screenshot_edit_ppt(SEREEN_SHOTS + 'new_first.png')
        thumbnails_list[1].click()
        pv.screenshot_edit_ppt(SEREEN_SHOTS + 'new_second.png')

        result1 = gv.compare_pic('first.png', 'new_first.png')
        result2 = gv.compare_pic('new_second.png', 'new_ppt.png')

        self.assertEqual(result1, 0.0)
        self.assertEqual(result2, 0.0)

        logging.info('==========delete pngs==========')
        os.remove(SEREEN_SHOTS + 'first.png')
        os.remove(SEREEN_SHOTS + 'new_first.png')
        os.remove(SEREEN_SHOTS + 'new_second.png')
Exemplo n.º 4
0
 def test_ppt_template(self):
     logging.info('==========test_ppt_template==========')
     cv = CreateView(self.driver)
     cv.create_file('pg')
     pg = PGView(self.driver)
     pg.group_button_click('编辑')
     for i in range(11):
         pg.edit_template(i)
     time.sleep(3)
Exemplo n.º 5
0
 def test_ppt_format(self):
     logging.info('==========test_ppt_format==========')
     cv = CreateView(self.driver)
     cv.create_file('pg')
     pg = PGView(self.driver)
     pg.group_button_click(' Edit ')
     for i in FORMAT:
         pg.edit_format(i)
     time.sleep(3)
Exemplo n.º 6
0
    def test_pop_menu_shape1(self, file_type):
        logging.info('==========test_pop_menu_shape1_ws==========')
        cv = CreateView(self.driver)
        cv.create_file(file_type)
        gv = GeneralView(self.driver)

        if file_type == 'pg':
            pg = PGView(self.driver)
            gv.group_button_click(' Edit ')
            pg.edit_format('空白')

        time.sleep(1)
        gv.group_button_click(' Insert ')
        gv.insert_shape(file_type)

        gv.fold_expand()
        x1, y1 = gv.find_pic_position('drag_all')
        gv.drag_coordinate(x1, y1, x1 - 100, y1)

        x1, y1 = gv.find_pic_position('drag_all')
        gv.drag_coordinate(x1, y1, x1 + 100, y1)

        x1, y1 = gv.find_pic_position('drag_all')
        gv.drag_coordinate(x1, y1, x1 - 50, y1 - 50)

        x2, y2 = gv.find_pic_position('drag_all1')
        gv.drag_coordinate(x2, y2, x2, y2 - 100)

        x2, y2 = gv.find_pic_position('drag_all1')
        gv.drag_coordinate(x2, y2, x2, y2 + 100)

        x2, y2 = gv.find_pic_position('drag_all1')
        gv.drag_coordinate(x2, y2, x2 - 50, y2 - 50)

        x, y = gv.find_pic_position('rotate_free')
        gv.drag_coordinate(x, y, x + 50, y + 50)
Exemplo n.º 7
0
 def test_ppt_format(self):
     logging.info('==========test_ppt_format==========')
     format = ['标题与副标题', '标题', '标题与文本', '标题与两栏文本', '标题与竖排文本-上下', '标题与竖排文本-左右',
               '空白', '标题与图片', '标题、文本与图片', '标题、图片与文本', '标题、图片与竖排文本', '标题、竖排文本与图片']
     cv = CreateView(self.driver)
     cv.create_file('pg')
     pg = PGView(self.driver)
     pg.group_button_click('编辑')
     for i in format:
         pg.edit_format(i)
     time.sleep(3)
Exemplo n.º 8
0
 def test_ppt_add_scroll_comment(self):  # ppt缩略图滚屏备注
     logging.info('==========test_ppt_add_scroll_comment==========')
     ov = OpenView(self.driver)
     ov.open_file('欢迎使用永中Office.pptx')
     pg = PGView(self.driver)
     pg.switch_write_read()
     pg.add_new()
     pg.add_comment(5, 'test2')
     pg.add_new()
     pg.check_comment(5)
     pg.edit_comment('TEST')
     pg.add_new()
     pg.check_comment(5)
     pg.delete_comment()
     time.sleep(1)
Exemplo n.º 9
0
    def test_ppt_play(self):  # ppt播放
        logging.info('==========test_ppt_play==========')
        ov = OpenView(self.driver)
        ov.open_file('欢迎使用永中Office.pptx')
        pg = PGView(self.driver)
        pg.group_button_click('播放')
        pg.play_mode('first')
        x, y = pg.get_size()

        time.sleep(1)
        pg.tap(y * 0.75, x * 0.5)
        time.sleep(1)
        pg.tap(y * 0.75, x * 0.5)
        pg.quit_play()
        # pg.screen_rotate('PORTRAIT')
        # pg.group_button_click('播放')
        pg.play_mode('current')
        time.sleep(1)
        pg.tap(y * 0.75, x * 0.5)
        time.sleep(1)
        pg.tap(y * 0.75, x * 0.5)
        pg.quit_play()
        # pg.screen_rotate('PORTRAIT')
        # pg.group_button_click('播放')
        pg.swipeRight()
        pg.swipeRight()
        pg.swipeRight()
        pg.play_mode('autoplay')
        time.sleep(2)
        pg.pause_resume_play()
        time.sleep(1)
        pg.pause_resume_play()
        time.sleep(20)
Exemplo n.º 10
0
    def test_ppt_play_switch(self, switch):  # 幻灯片切换
        logging.info('==========test_ppt_play_switch==========')
        ov = OpenView(self.driver)
        ov.open_file('欢迎使用永中Office.pptx')
        pg = PGView(self.driver)
        pg.switch_write_read()

        pg.group_button_click('切换')
        pg.switch_mode(switch, 'all')
        pg.group_button_click('播放')
        pg.play_mode()
        time.sleep(20)
Exemplo n.º 11
0
    def test_ppt_play_to_last(self, play_type):
        logging.info('==========test_ppt_play_to_last==========')
        cv = CreateView(self.driver)
        cv.create_file('pg')
        pg = PGView(self.driver)
        pg.add_new()
        pg.add_new()

        logging.info('==========play to the last page==========')
        pg = PGView(self.driver)
        pg.group_button_click(' Play ')
        pg.play_mode(play_type)
        if play_type == 'first':
            index = 1
        else:
            index = 3
        pg.play_to_last(index, 3)

        logging.info('==========validate toast==========')
        try:
            toast = self.driver.find_element(
                By.XPATH, '//*[@text="It has been the last slide."]')
        except NoSuchElementException:
            self.assertTrue(False, '未出现弹窗')
        else:
            self.assertEqual(toast.text, 'It has been the last slide.',
                             '验证弹窗信息为已是简报尾页')
Exemplo n.º 12
0
    def test_ppt_play_switch(self, switch):  # 幻灯片切换
        logging.info('==========test_ppt_play_switch==========')
        ov = OpenView(self.driver)
        ov.open_random_file('ppt')
        pg = PGView(self.driver)
        pg.switch_write_read()

        pg.group_button_click(' Switch ')
        pg.switch_mode(switch, 'all')
        pg.group_button_click(' Play ')
        pg.play_mode()
        logging.info('==========validate toast==========')
        try:
            WebDriverWait(self.driver, 1200).until(
                ec.visibility_of_element_located(
                    (By.XPATH, '//*[@text="It has been the last slide."]')))
        except TimeoutException:
            self.assertTrue(False, '等待自动 Play 二十分钟,未找到弹窗')
        else:
            toast = self.driver.find_element(
                By.XPATH, '//*[@text="It has been the last slide."]')
            self.assertEqual(toast.text, 'It has been the last slide.',
                             '验证弹窗信息为已是简报尾页')