Example #1
0
    def test_question_feedback(self):
        """问题反馈 -- 正常流程"""
        self.login_page.app_status()  # 判断APP当前状态

        if self.home_page.wait_check_page():  # 页面检查点
            self.home_page.click_tab_profile()  # 进入首页后点击‘个人中心’按钮

            if self.user_center.wait_check_page():  # 页面检查点
                self.user_center.click_setting()  # 进入设置页面
                if self.setting.wait_check_page():
                    self.setting.question_feedback()  # 进入问题反馈页面

                    if self.question_feedback.wait_check_page():
                        self.question_feedback.edit_text().send_keys(
                            "123vxc567")
                        self.question_feedback.submit_button()

                        if self.setting.wait_check_page():
                            print('submit question success')

                        else:
                            print(' failed to submit question ')

                        self.setting.back_up()  # 返回主界面
                    else:
                        print("未进入问题反馈页面")
        else:
            Toast().find_toast(VALID_LOGIN_TOAST.login_failed())
            print("未进入主界面")
    def test_vocabulary_selection_yb(self):
        self.login_page.app_status()  # 判断APP当前状态

        if self.home_page.wait_check_page():  # 主界面检查点
            print("已进入主界面:")
            var = self.home_page.homework_count()
            if gv.VOC_CHO_YB in var[0]:  # 该作业存在
                for i in range(0, len(var[0])):
                    if var[0][i] == gv.VOC_CHO_YB:
                        var[1][i].click()
                        time.sleep(3)
                        count = self.homework.games_count(0, '词汇选择')
                        self.game_exist(count[0])

                        if count[1] == 10:  # 判断小游戏list是否需滑屏
                            game_count = self.homework.swipe_screen('词汇选择')
                            if len(game_count) != 0:
                                self.game_exist(game_count)
            else:
                print('当前页no have该作业')
                game = self.home_page.swipe(var[0], gv.VOC_CHO_YB,
                                            '词汇选择')  # 作业list翻页
                self.game_exist(game)
            print('Game Over')
        else:
            try:
                Toast().find_toast(VALID_LOGIN_TOAST.login_failed())
            except Exception:
                print("未进入主界面")
                raise
    def test_choice_word_cloze(self):
        self.login_page.app_status()  # 判断APP当前状态

        if self.home_page.wait_check_page():  # 页面检查点
            print("已进入主界面:")
            self.home_page.click_homework_label()
            if self.homework.homework_page_check:
                var = self.home_page.homework_count()
                if gv.CHO_WOR_CL in var[0]:  # 该作业存在
                    for i in range(0, len(var[0])):
                        if var[0][i] == gv.CHO_WOR_CL:
                            var[1][i].click()  # 点击进入该作业
                            count = self.homework.games_count(0, '选词填空')
                            self.game_exist(count[0], gv.CHO_WOR_CL)

                            if count[1] == 10:  # 小游戏list需翻页
                                game_count = self.homework.swipe_screen('选词填空')
                                if len(game_count) != 0:
                                    self.game_exist(game_count, gv.CHO_WOR_CL)
                else:
                    print('当前页no have该作业')
                    game = self.home_page.swipe(var[0], gv.CHO_WOR_CL,
                                                '选词填空')  # 作业list翻页
                    self.game_exist(game, gv.CHO_WOR_CL)
                print('Game Over')
            else:
                try:
                    Toast().find_toast(VALID_LOGIN_TOAST.login_failed())
                except Exception as e:
                    print("未进入主界面")
                    raise e
    def test_strengthen_sentence(self):
        self.login_page.app_status()  # 判断APP当前状态

        if self.home_page.wait_check_page():
            print("已进入主界面:")
            var = self.home_page.homework_count()

            if gv.STREN_SENT in var[0]:
                for i in range(0, len(var[0])):
                    if var[0][i] == gv.STREN_SENT:
                        var[1][i].click()  # 点击进入该作业
                        count = self.homework.games_count(0, '强化炼句')  # 小游戏个数统计
                        self.game_exist(count[0], gv.STREN_SENT)  # 具体操作

                        if count[1] == 10:  # 判断小游戏list是否需滑屏
                            game_count = self.homework.swipe_screen('强化炼句')
                            if len(game_count) != 0:
                                self.game_exist(game_count, gv.STREN_SENT)
            else:
                print('当前页no have该作业')
                game = self.home_page.swipe(var[0], gv.STREN_SENT,
                                            '强化炼句')  # 作业list翻页
                self.game_exist(game, gv.STREN_SENT)
            print('Game Over')
        else:
            try:
                Toast().find_toast(VALID_LOGIN_TOAST.login_failed())
            except Exception:
                print("未进入主界面")
                raise
    def test_word_spelling_noyb(self):
        self.login_page.app_status()  # 判断APP当前状态

        if self.home_page.wait_check_page():  # 页面检查点
            print("已进入主界面:")
            var = self.home_page.homework_count()
            if gv.WOR_SPE in var[0]:  # 该作业存在
                for i in range(0, len(var[0])):
                    if var[0][i] == gv.WOR_SPE:
                        var[1][i].click()
                        time.sleep(3)
                        count = self.homework.games_count(0, '单词拼写')
                        self.game_exist(count[0])
                        if count[1] == 10:
                            game_count = self.homework.swipe_screen('单词拼写')
                            self.game_exist(game_count)
            else:
                print('当前页no have该作业')
                game = self.home_page.swipe(var[0], gv.WOR_SPE,
                                            '单词拼写')  # 作业list翻页
                self.game_exist(game)
            print('Game Over')
        else:
            try:
                Toast().find_toast(VALID_LOGIN_TOAST.login_failed())
            except Exception:
                print("未进入主界面")
                raise
Example #6
0
    def test_flash_card_yb(self):
        """对不同小游戏类型,选择不同函数进行相应的操作"""
        self.login_page.app_status()  # 判断APP当前状态

        if self.home_page.wait_check_page():  # 页面检查点
            print("已进入主界面:")
            var = self.home_page.homework_count()
            if gv.FLA_CARD_YB in var[0]:  # 该作业存在
                for i in range(0, len(var[0]) - 1):
                    if var[0][i] == gv.FLA_CARD_YB:
                        var[1][i].click()
                        time.sleep(3)
                        count = self.homework.games_count(0, '闪卡练习')
                        self.game_exist(count[0])
                        if count[1] == 10:
                            game_count = self.homework.swipe_screen('闪卡练习')
                            if len(game_count) != 0:
                                self.game_exist(game_count)
            else:
                print('当前页no have该作业')
                game = self.home_page.swipe(var[0], gv.FLA_CARD_YB,
                                            '闪卡练习')  # 作业list翻页
                self.game_exist(game)
            print('Game Over')
        else:
            try:
                Toast().find_toast(VALID_LOGIN_TOAST.login_failed())
            except Exception:
                print("未进入主界面")
                raise
    def test_listen_choice(self):
        self.login_page.app_status()  # 判断APP当前状态
        if self.home_page.wait_check_page():
            print("已进入主界面:")
            self.home_page.click_hk_tab(2)

            if self.homework.wait_check_page():  # 页面检查点
                var = self.home_page.homework_count()
                if gv.LIS_EXE in var[0]:
                    for i in range(0, len(var[0])):
                        if var[0][i] == gv.LIS_EXE:
                            var[1][i].click()
                            count = self.homework.games_count(0, '听力练习')  # 小游戏个数统计
                            self.game_exist(count[0])

                            if count[1] == 10:  # 判断小游戏list是否需滑屏
                                game_count = self.homework.swipe_screen('听力练习')
                                if len(game_count) != 0:
                                    self.game_exist(game_count)
                else:
                    print('当前页no have该作业')
                    game = self.home_page.swipe_operate(var[0], gv.LIS_EXE, '听力练习')  # 作业list翻页
                    self.game_exist(game[0])
                    print('Game Over')
            else:
                Toast().find_toast(VALID_LOGIN_TOAST.login_failed())
                print("未进入主界面")
    def test_result_ranking(self):
        self.login_page.app_status()  # 判断APP当前状态

        if self.home_page.wait_check_page():
            print("已进入主界面:")
            self.login_page.enter_user_info_page()  # 由 主界面 进入个人信息页
            nickname = UserInfoPage().nickname()  # 获取昵称
            UserInfoPage().back_up()

            if self.home_page.wait_check_page():
                var = self.home_page.homework_count()
                if gv.RANK in var[0]:  # 该作业存在
                    for i in range(0, len(var[0])):
                        if var[0][i] == gv.RANK:
                            var[1][i].click()  # 点击进入该游戏
                            # self.homework.games_count(0, gv.RANK_TYPE)
                            self.game_exist(gv.RANK_COUNT, nickname)  # 具体操作
                            # if count[1] == 10:  # 小游戏list需翻页
                            #     game_count = self.homework.swipe_screen(gv.RATE_TYPE)
                            #     if len(game_count) != 0:
                            #         self.game_exist(game_count)
                            # self.homework.back_up_button()  # 返回主界面
                else:
                    print('当前页no have该作业')
                    self.home_page.swipe(var[0], gv.RANK_COUNT,
                                         gv.RANK_TYPE)  # 作业list翻页
                    self.game_exist(gv.RANK_COUNT, nickname)  # 具体操作
                print('Game Over')
            else:
                try:
                    Toast().find_toast(VALID_LOGIN_TOAST.login_failed())
                except Exception:
                    print("未进入主界面")
                    raise
    def test_word_dictation(self):
        self.login_page.app_status()  # 判断APP当前状态

        if self.home_page.wait_check_page():
            print("已进入主界面:")
            self.home_page.click_homework_label()
            if self.homework.homework_page_check:
                var = self.home_page.homework_count()
                if gv.WOR_DIC in var[0]:
                    for i in range(0, len(var[0])):
                        if var[0][i] == gv.WOR_SPE:
                            var[1][i].click()  # 点击进入该作业
                            count = self.homework.games_count(0, '单词听写')  # 小游戏个数统计
                            self.game_exist(count[0])  # 具体操作

                            if count[1] == 10:  # 判断小游戏list是否需滑屏
                                game_count = self.homework.swipe_screen('单词听写')
                                if len(game_count) != 0:
                                    self.game_exist(game_count)
                else:
                    print('当前页no have该作业')
                    game = self.home_page.swipe(var[0], gv.WOR_DIC, '单词听写')  # 作业list翻页
                    self.game_exist(game)
                print('Game Over')
            else:
                try:
                    Toast().find_toast(VALID_LOGIN_TOAST.login_failed())
                except Exception:
                    print("未进入主界面")
                    raise
Example #10
0
    def test_change_image(self):
        """拍照修改头像 -- 不选择修改方式,直接点击空白处退出"""
        self.login_page.app_status()  # 判断APP当前状态

        if self.home_page.wait_check_page():  # 页面检查点
            self.home_page.click_tab_profile()  # 进入首页后点击‘个人中心’按钮

            if self.user_center.wait_check_page():  # 页面检查点
                self.user_center.click_avatar_profile()  # 点击登录头像按钮,进行个人信息操作
                if self.user_info.wait_check_page():  # 页面检查点

                    # image1 = self.user_info.image()   # 获取登录后的头像截图
                    # t = self.screen_shot.screenshot(image1)
                    # self.assertTrue(t)

                    # 点击头像条目,进入设置页面
                    self.user_info.click_image()
                    if self.user_info.wait_check_tips_page():
                        self.user_info.tips_title()  # 弹框信息
                        self.user_info.click_block()  # 取消更换头像

                    # # 获取修改后的头像截图
                    # image2 = self.user_info.image()
                    # result = self.screen_shot.same_as_screenshot(image2, t)
                    # self.assertTrue(result)

                else:
                    print('未进入个人信息页面')
                self.user_info.back_up()
            else:
                print('未进入个人中心页面')
        else:
            Toast().find_toast(VALID_LOGIN_TOAST.login_failed())
            print("未进入主界面")
Example #11
0
    def test_result_time(self):
        self.login_page.app_status()  # 判断APP当前状态

        if self.home_page.wait_check_page():
            print("已进入主界面:")
            var = self.home_page.homework_count()
            if gv.TIME in var[0]:  # 该作业存在
                for i in range(0, len(var[0])):
                    if var[0][i] == gv.TIME:
                        var[1][i].click()  # 点击进入该作业
                        # count = self.homework.games_count(0, gv.TIME_TYPE)
                        self.game_exist(gv.TIME_COUNT, gv.TIME)  # 具体操作

                        # if count[1] == 10:  # 小游戏list需翻页
                        #     game_count = self.homework.swipe_screen(gv.RATE_TYPE)
                        #     if len(game_count) != 0:
                        #         self.game_exist(game_count, gv.TIME)
                        # self.homework.back_up_button()  # 返回主界面
            else:
                print('当前页no have该作业')
                self.home_page.swipe(var[0], gv.TIME, gv.TIME_TYPE)  # 作业list翻页
                self.game_exist(gv.TIME_COUNT, gv.TIME)  # 具体操作
            print('Game Over')
        else:
            try:
                Toast().find_toast(VALID_LOGIN_TOAST.login_failed())
            except Exception:
                print("未进入主界面")
                raise
    def listen_choice(self):
        if self.wait_check_page():  # 页面检查
            horn = self.play_voice()
            if horn.get_attribute("enabled"):  # 播放按钮检查
                retip = self.red_tips()  # 顶部红色提示信息
                if retip:  # 检查是否有红色提示
                    timestr = []  # 获取每小题的时间

                    horn.click()  # 点击发音按钮
                    retip = self.red_tips()  # 顶部红色提示信息
                    if retip is False:  # 检查红色提示是否消失
                        tipsum = int(self.rate())  # 获取待完成数
                        print("作业个数:", tipsum)
                        swipe_num = int(round(tipsum / 3))  # 获取翻页次数
                        print("需要翻页的次数", swipe_num)
                        self.swipe_operate(self.click_options, swipe_num,
                                           timestr)
                    print(timestr)
                    Homework().now_time(timestr)
                else:
                    print("----没有红色标识------")
            else:
                print("出现错误:喇叭不可点-------")
        else:
            try:
                Toast().find_toast(VALID_LOGIN_TOAST.login_failed())
            except Exception:
                print("未进入主界面")
                raise
    def test_reading_comprehension(self):
        self.login_page.app_status()  # 判断APP当前状态

        if self.home_page.wait_check_page():  # 页面检查点
            print("已进入主界面:")
            var = self.home_page.homework_count()
            if gv.COMPL_ART in var[0]:  # 该作业存在
                for i in range(0, len(var[0])):
                    if var[0][i] == gv.COMPL_ART:
                        var[1][i].click()  # 进入作业
                        count = self.homework.games_count(0, '补全文章')  # 小游戏个数统计
                        self.game_exist(count[0])  # 具体操作

                        if count[1] == 10:  # 判断小游戏list是否需滑屏
                            game_count = self.homework.swipe_screen('补全文章')
                            if len(game_count) != 0:
                                self.game_exist(game_count)
            else:
                print('当前页no have该作业')
                game = self.home_page.swipe(var[0], gv.COMPL_ART, '补全文章')  # 作业list翻页
                self.game_exist(game)
            print('Game Over')
        else:
            try:
                Toast().find_toast(VALID_LOGIN_TOAST.login_failed())
            except Exception:
                print("未进入主界面")
                raise
    def test_single_choice(self):
        self.login_page.app_status()  # 判断APP当前状态

        if self.home_page.wait_check_page():  # 页面检查点
            print("已进入主界面:")
            var = self.home_page.homework_count()
            if gv.SIN_CHO in var[0]:  # 该作业存在
                for i in range(0, len(var[0])):
                    if var[0][i] == gv.SIN_CHO:
                        var[1][i].click()  # 进入作业
                        count = self.homework.games_count(0, '单项选择')  # 统计小游戏个数
                        self.game_exist(count[0])  # 具体操作

                        if count[1] == 10:  # 判断小游戏list是否需要滑屏
                            game_count = self.homework.swipe_screen('单项选择')
                            if len(game_count) != 0:
                                self.game_exist(game_count)
            else:
                print('no have该作业')
                game = self.home_page.swipe(var[0], gv.SIN_CHO, '单项选择')  # 作业list翻页
                self.game_exist(game)
            print('Game Over')
        else:
            try:
                Toast().find_toast(VALID_LOGIN_TOAST.login_failed())
            except Exception:
                print("未进入主界面")
                raise
    def test_nickname(self):
        """修改昵称 -- 修改后不保存"""
        self.login_page.app_status()  # 判断APP当前状态

        if self.home_page.wait_check_page():
            self.home_page.click_tab_profile()  # 进入首页后点击‘个人中心’按钮

            if self.user_center.wait_check_page():  # 页面检查点
                self.user_center.click_avatar_profile()  # 点击登录头像按钮,进行个人信息操作
                if self.user_info.wait_check_page():  # 页面检查点
                    name1 = self.user_info.nickname()
                    # 点击昵称条目,进入设置页面
                    self.user_info.click_nickname()
                    text = self.user_info.input()  # 找到要删除文本的EditText元素
                    # 删除文本框中内容
                    DelEditText().del_text(text)
                    text.send_keys("HelloWorld")
                    self.user_info.click_negative_button()

                    if self.user_info.wait_check_page():
                        name2 = self.user_info.nickname()
                        if name2 == name1:
                            print('cancel change nickname success')
                        else:
                            print('cancel change nickname failed')

                        self.user_info.back_up()
                    else:
                        print('未返回个人信息页面')
                else:
                    print('未进入个人信息页面')
        else:
            Toast().find_toast(VALID_LOGIN_TOAST.login_failed())
            print("未进入主界面")
    def test_result_score(self):
        self.login_page.app_status()  # 判断APP当前状态

        if self.home_page.wait_check_page():
            print("已进入主界面:")
            self.home_page.click_hk_tab(2)

            if self.homework.wait_check_page():  # 页面检查点
                var = self.home_page.homework_count()
                if gv.SCORE in var[0]:  # 该作业存在
                    for i in range(0, len(var[0])):
                        if var[0][i] == gv.SCORE:
                            var[1][i].click()  # 点击进入该作业
                            # self.homework.games_count(0, gv.SCORE_TYPE)
                            self.game_exist(gv.SCORE_COUNT, gv.SCORE)

                            # if count[1] == 10:  # 小游戏list需翻页
                            #     game_count = self.homework.swipe_screen(gv.RATE_TYPE)
                            #     if len(game_count) != 0:
                            #         self.game_exist(game_count)
                            # self.homework.back_up_button()  # 返回主界面
                else:
                    print('当前页no have该作业')
                    self.home_page.swipe_operate(var[0], gv.SCORE,
                                                 gv.SCORE_TYPE)  # 作业list翻页
                    self.game_exist(gv.SCORE_COUNT, gv.SCORE)
                print('Game Over')
        else:
            Toast().find_toast(VALID_LOGIN_TOAST.login_failed())
            print("未进入主界面")
Example #17
0
    def test_homework_ranking(self):
        self.login.app_status()  # 判断APP当前状态

        if self.home.wait_check_page():  # 页面检查点
            self.login.enter_user_info_page()  # 由 主界面 进入个人信息页
            nickname = UserInfoPage().nickname()  # 获取昵称
            UserInfoPage().back_up_button()  # 返回个人中心页面

            self.home.click_tab_hw()  # 进入主界面

            if self.home.wait_check_page():  # 页面检查点
                self.home.click_test_vanclass()  # 班级tab
                if self.van.wait_check_page():  # 页面检查点

                    van = self.van.vanclass_name()  # 班级名称
                    for i in range(len(van)):
                        if van[i].text == gv.VAN_LIST:
                            van[i].click()  # 进入班级详情页
                            break
                    if self.van.wait_check_vanclass_page(gv.VAN_LIST):  # 页面检查点

                        self.van.vanclass_hw()  # 点击 本班作业 tab
                        if self.detail.wait_check_page(gv.VAN_LIST):  # 页面检查点
                            print('%s 本班作业:' % gv.VAN_LIST)
                            if self.van.empty_tips():
                                print('暂无数据')
                            else:
                                all_hw = self.detail.all_finish_tab(
                                    1)  # 全部 tab
                                if self.detail.selected(all_hw) is False:
                                    print('★★★ Error- 未默认在 全部页面')
                                else:
                                    print(
                                        '--------------全部tab-------------------'
                                    )
                                    if self.van.empty_tips():
                                        print('暂无数据')
                                    else:
                                        self.hw_operate(nickname)  # 具体操作

                                self.home.back_up_button()  # 返回 本班作业页面
                                if self.detail.wait_check_page(
                                        gv.HW_NAME):  # 页面检查点
                                    self.home.back_up_button()  # 返回 班级详情页面
                                else:
                                    print('未返回 本班作业页面')

                            if self.detail.wait_check_page(
                                    gv.VAN_LIST):  # 页面检查点
                                self.home.back_up_button()  # 返回 班级
                                if self.van.wait_check_page():  # 班级 页面检查点
                                    self.home.click_tab_hw()  # 返回主界面
                        else:
                            print('未进入班级 -本班作业tab')
                            self.home.back_up_button()
                            if self.van.wait_check_page():  # 班级 页面检查点
                                self.home.click_tab_hw()  # 返回主界面
        else:
            Toast().find_toast(VALID_LOGIN_TOAST.login_failed())
            print("未进入主界面")
Example #18
0
    def test_privacy_clause(self):
        """版权申诉 -- 正常流程"""
        self.login_page.app_status()  # 判断APP当前状态

        if self.home_page.wait_check_page():
            self.home_page.click_tab_profile()  # 进入首页后点击‘个人中心’按钮

            if self.user_center.wait_check_page():  # 页面检查点
                self.user_center.click_setting()  # 进入设置页面
                if self.setting.wait_check_page():
                    self.setting.privacy_clause()  # 隐私条款

                    if self.privacy_clause.wait_check_page():
                        for i in range(4):
                            print('翻页%s次' % (i + 1))
                            BasePage().screen_swipe_up(0.5, 0.5, 0.25, 1000)
                        print('下拉一次')
                        BasePage().screen_swipe_down(0.5, 0.2, 0.9, 1000)

                        self.home_page.back_up_button()

                        if self.setting.wait_check_page():
                            print('success')
                        else:
                            print(' failed  ')
                        self.setting.back_up()  # 返回主界面
                    else:
                        print('未进入隐私条款页面')
        else:
            Toast().find_toast(VALID_LOGIN_TOAST.login_failed())
            print("未进入主界面")
Example #19
0
    def test_restore_word(self):
        self.login_page.app_status()  # 判断APP当前状态

        if self.home_page.wait_check_page():  # 页面检查点
            print("登录成功")
            var = self.home_page.homework_count()
            if gv.RES_WORD in var[0]:
                for i in range(0, len(var[0])):
                    if var[0][i] == gv.RES_WORD:
                        var[1][i].click()  # 点击进入该作业
                        count = self.homework.games_count(0, '还原单词')  # 小游戏个数统计
                        self.game_exist(count[0])  # 具体操作

                        if count[1] == 10:  # 判断小游戏list是否需滑屏
                            game_count = self.homework.swipe_screen('还原单词')
                            if len(game_count) != 0:
                                self.game_exist(game_count)
            else:
                print('当前页no have该作业')
                game = self.home_page.swipe(var[0], gv.RES_WORD,
                                            '还原单词')  # 作业list翻页
                self.game_exist(game)
            print('Game Over')
        else:
            try:
                Toast().find_toast(VALID_LOGIN_TOAST.login_failed())
            except Exception as e:
                print("未进入主界面")
                raise e
Example #20
0
 def test_login(self):
     """判断登录状态,若failed则获取toast"""
     self.login_page.app_status()
     if self.home_page.wait_check_page() == "试卷":
         self.setting.logout()
     else:
         Toast().find_toast(VALID_LOGIN_TOAST.login_failed())
         print('login failed ')
    def test_change_image(self):
        """拍照修改头像 -- 重拍后保存"""
        self.login_page.app_status()  # 判断APP当前状态

        if self.home_page.wait_check_page():
            self.home_page.click_tab_profile()  # 进入首页后点击‘个人中心’按钮

            if self.user_center.wait_check_page():  # 页面检查点
                self.user_center.click_avatar_profile()  # 点击登录头像按钮,进行个人信息操作
                if self.user_info.wait_check_page():  # 页面检查点

                    # # 获取登录后的头像截图
                    # image1 = self.user_info.image()
                    # t = self.screen_shot.screenshot(image1)
                    # self.assertTrue(t)

                    self.user_info.click_image()  # 点击头像条目,进入设置页面
                    if self.user_info.wait_check_tips_page():
                        self.user_info.tips_title()  # 弹框信息
                        self.user_info.click_photograph()

                        if self.change_image.wait_check_page_camera():
                            self.change_image.click_camera_button()  # 拍照 按钮
                            if self.change_image.wait_check_retake_page():
                                self.change_image.click_retake_button(
                                )  # 重拍 按钮

                                if self.change_image.wait_check_page_camera():
                                    self.change_image.click_camera_button(
                                    )  # 拍照 按钮
                                    if self.change_image.wait_check_retake_page(
                                    ):
                                        self.change_image.click_done_button(
                                        )  # 完成 按钮
                                        if self.change_image.wait_check_save_page(
                                        ):
                                            self.change_image.click_save_button(
                                            )  # 保存 按钮

                                            if self.user_info.wait_check_page(
                                            ):
                                                print('retake cancel success')
                                            else:
                                                print('retake cancel failed')
                                                # # 获取修改后的头像截图
                                                # image2 = self.user_info.image()
                                                # result = self.screen_shot.same_as_screenshot(image2, t)
                                                # self.assertTrue(result)

                                            self.user_info.back_up()
                    else:
                        print('未进入拍照页面')
                else:
                    print('未进入个人信息页面')
        else:
            Toast().find_toast(VALID_LOGIN_TOAST.login_failed())
            print("未进入主界面")
Example #22
0
    def test_change_image(self):
        """相册修改头像 -- 正常流程"""
        self.login_page.app_status()  # 判断APP当前状态

        if self.home_page.wait_check_page():
            self.home_page.click_tab_profile()  # 进入首页后点击‘个人中心’按钮

            if self.user_center.wait_check_page():  # 页面检查点
                self.user_center.click_avatar_profile()  # 点击登录头像按钮,进行个人信息操作
                if self.user_info.wait_check_page():  # 页面检查点

                    # # 获取登录后的头像截图
                    # image1 = self.user_info.image()
                    # t = self.screen_shot.screenshot(image1)
                    # self.assertTrue(t)

                    self.user_info.click_image()  # 点击头像条目,进入设置页面
                    if self.user_info.wait_check_tips_page():
                        self.user_info.tips_title()  # 弹框信息
                        self.user_info.click_album()  # 从相册选择

                        if self.change_image.wait_check_page_album():
                            self.change_image.choose_album()
                            if self.change_image.wait_check_all_picture_page():
                                self.change_image.open_album()  # 进入某相册
                                if self.change_image.wait_check_all_picture_page(
                                ):
                                    self.change_image.choose_image()  # 选择照片
                                    if self.change_image.wait_check_page_album(
                                    ):
                                        self.change_image.album_commit_button(
                                        )  # 确定按钮
                                        if self.change_image.wait_check_save_page(
                                        ):
                                            self.change_image.click_save_button(
                                            )  # 保存按钮

                                            if self.user_info.wait_check_page(
                                            ):
                                                print('choose success')
                                            else:
                                                # # 获取修改后的头像截图
                                                # image2 = self.user_info.image()
                                                # result = self.screen_shot.same_as_screenshot(image2, t)
                                                # self.assertTrue(result)
                                                print('choose failed')

                                            self.user_info.back_up()
                    else:
                        print('未进入选择相册页面')
                else:
                    print('未进入个人信息页面')
        else:
            Toast().find_toast(VALID_LOGIN_TOAST.login_failed())
            print("未进入主界面")
Example #23
0
 def test_study_word(self):
     """新词练习"""
     if self.home.wait_check_page():  # 页面检查点
         print('进入主界面')
         self.home.click_hk_tab(1)  # 点击 背单词
         self.word.word_book_operate()   # 单词本 游戏过程
         self.result.result_page_handle()
         # DataActionPage().change_new_word_level(0,1)
     else:
         Toast().find_toast(VALID_LOGIN_TOAST.login_failed())
         print("未进入主界面")
Example #24
0
    def test_homework_analysis_unfinish(self):
        self.login.app_status()  # 判断APP当前状态

        if self.home.wait_check_page():  # 页面检查点
            self.home.click_test_vanclass()  # 班级tab
            if self.van.wait_check_page():  # 页面检查点

                van = self.van.vanclass_name()  # 班级名称
                for i in range(len(van)):
                    if van[i].text == gv.VAN_ANALY:
                        van[i].click()  # 进入班级详情页
                        break
                if self.van.wait_check_vanclass_page(gv.VAN_ANALY):  # 页面检查点

                    self.van.vanclass_hw()  # 点击 本班作业 tab
                    if self.detail.wait_check_page(gv.VAN_ANALY):  # 页面检查点
                        print('%s 本班作业:' % gv.VAN_ANALY)
                        if self.van.empty_tips():
                            print('暂无数据')
                        else:
                            incomplete = self.detail.all_finish_tab(
                                2)  # 未完成 tab
                            incomplete.click()  # 进入 未完成 tab页
                            if self.detail.selected(incomplete) is False:
                                print('★★★ Error- 未进入 未完成 tab页')
                            else:
                                print(
                                    '--------------未完成tab-------------------')
                                if self.van.empty_tips():
                                    print('暂无数据')
                                else:
                                    self.hw_operate()  # 具体操作

                            self.home.back_up_button()  # 返回 作业详情页面
                            if self.detail.wait_check_page(
                                    gv.HW_ANALY_GAME):  # 页面检查点
                                self.home.back_up_button()  # 返回 本班作业页面
                            else:
                                print('未返回 本班作业页面')

                        if self.detail.wait_check_page(gv.VAN_ANALY):  # 页面检查点
                            self.home.back_up_button()  # 返回 班级详情页面
                            if self.van.wait_check_vanclass_page(
                                    gv.VAN_ANALY):  # 班级详情 页面检查点
                                self.home.back_up_button()
                    else:
                        print('未进入班级 -本班作业tab')
                        self.home.back_up_button()
                    if self.van.wait_check_page():  # 班级 页面检查点
                        self.home.click_tab_hw()  # 返回主界面
        else:
            Toast().find_toast(VALID_LOGIN_TOAST.login_failed())
            print("未进入主界面")
Example #25
0
    def test_login_failed(self):
        """判断登录状态,若failed则获取toast"""
        print('登录啦')
        self.login_page.login()
        activity = self.login_page.wait_activity()

        # self.assertEqual(self.home_page.wait_check_page(), u"试卷")

        if activity == 'com.vanthink.vanthinkstudent.v2.ui.home.HomeActivity':
            print('登录成功!!!')
        else:
            Toast().find_toast(VALID_LOGIN_TOAST.login_failed())
            print(' fail login ')
    def test_exchange_phone(self):
        """更换手机号 -- 验证码验证失败"""
        self.login_page.app_status()  # 判断APP当前状态

        if self.home_page.wait_check_page():
            self.home_page.click_tab_profile()  # 进入首页后点击‘个人中心’按钮

            if self.user_center.wait_check_page():  # 页面检查点
                self.user_center.click_avatar_profile()  # 点击登录头像按钮,进行个人信息操作

                if self.user_info.wait_check_page():
                    phone1 = self.user_info.phone()
                    # 点击手机号条目,进入设置页面
                    self.user_info.click_phone_number()
                    text = self.user_info.input()  # 验证密码
                    text.send_keys(VALID_RESETPHONE.password())
                    self.user_info.click_positive_button()

                    if self.phone_reset.wait_check_page():
                        phone = self.phone_reset.et_phone()
                        phone.send_keys(VALID_RESETPHONE.reset())
                        self.phone_reset.count_time()
                        value = verify_find(VALID_RESETPHONE.reset())
                        verify = self.phone_reset.verify()
                        verify.send_keys('1234')
                        self.phone_reset.btn_certain()
                        t = Toast().find_toast('验证码验证失败')
                        if t:
                            verify.clear()
                            self.phone_reset.verify().send_keys(value)
                            self.phone_reset.btn_certain()
                            if self.user_info.wait_check_page():
                                phone2 = self.user_info.phone()
                                if phone1 == phone2:
                                    print('exchange success')
                                else:
                                    print('failed')

                                self.user_info.back_up()
                            else:
                                print('未返回个人信息页面')
                    else:
                        print('未进入手机修改页面')
                else:
                    print('未进入个人信息页面')
        else:
            Toast().find_toast(VALID_LOGIN_TOAST.login_failed())
            print("未进入主界面")
Example #27
0
 def test_listen_choice(self):
     self.login_page.app_status()  # 判断APP当前状态
     if self.home_page.wait_check_page():
         print("已进入主界面:")
         self.home_page.click_recite_word_label()
         if self.word_book.wait_check_page():
             self.word_book.word_book_type()  #单词本游戏过程
             self.word_book.play_again()  #再练一组
         else:
             print("未进入单词本界面")
     else:
         try:
             Toast().find_toast(VALID_LOGIN_TOAST.login_failed())
         except Exception:
             print("未进入主界面")
             raise
Example #28
0
    def test_homework_share(self):
        self.login.app_status()  # 判断APP当前状态

        if self.home.wait_check_page():  # 页面检查点
            self.home.click_test_vanclass()  # 班级tab
            if self.van.wait_check_page():  # 页面检查点

                van = self.van.vanclass_name()  # 班级名称
                for i in range(len(van)):
                    if van[i].text == gv.VAN_ANALY:
                        van[i].click()  # 进入班级详情页
                        break
                if self.van.wait_check_vanclass_page(gv.VAN_ANALY):  # 页面检查点

                    self.van.vanclass_hw()  # 点击 本班作业 tab
                    if self.detail.wait_check_page(gv.VAN_ANALY):  # 页面检查点
                        print('%s 本班作业:' % gv.VAN_ANALY)
                        if self.van.empty_tips():
                            print('暂无数据')
                        else:
                            all_hw = self.detail.all_finish_tab(1)  # 全部 tab
                            if self.detail.selected(all_hw) is False:
                                print('★★★ Error- 未默认在 全部页面')
                            else:
                                print('--------------全部tab-------------------')
                                if self.van.empty_tips():
                                    print('暂无数据')
                                else:
                                    self.share_operate()  # 具体操作

                            self.home.back_up_button()  # 返回 本班作业页面
                            if self.detail.wait_check_page(gv.VAN_ANALY):  # 页面检查点
                                self.home.back_up_button()  # 返回 班级详情 页
                            else:
                                print('未返回 本班作业页面')

                        if self.van.wait_check_page():  # 班级 页面检查点
                            self.home.click_tab_hw()  # 返回主界面
                    else:
                        print('未进入班级 -本班作业tab')
                        self.home.back_up_button()
                        if self.van.wait_check_page():  # 班级 页面检查点
                            self.home.click_tab_hw()  # 返回主界面
        else:
            Toast().find_toast(VALID_LOGIN_TOAST.login_failed())
            print("未进入主界面")
Example #29
0
    def test_change_password(self):
        """修改密码 -- 正常流程"""
        self.login_page.app_status()  # 判断APP当前状态

        if self.home_page.wait_check_page():
            self.home_page.click_tab_profile()  # 进入首页后点击‘个人中心’按钮

            if self.user_center.wait_check_page():  # 页面检查点
                self.user_center.click_avatar_profile()  # 点击登录头像按钮,进行个人信息操作

                if self.user_info.wait_check_page():
                    self.user_info.click_password()  # 点击修改密码

                    for i in range(len(reset_pwd)):
                        print('修改密码为:', reset_pwd[i]['new'])
                        if self.pwd_reset.wait_check_page():  # 页面检查点
                            self.pwd_reset.pwd_checkbox()
                            old_pwd = self.pwd_reset.pwd_origin()
                            old_pwd.click()
                            old_pwd.send_keys(reset_pwd[i]['old'])

                            # 输入新的密码
                            new_pwd = self.pwd_reset.pwd_new()
                            new_pwd.click()
                            new_pwd.send_keys(reset_pwd[i]['new'])

                            # 再次输入密码
                            again_pwd = self.pwd_reset.pwd_confirm()
                            again_pwd.click()
                            again_pwd.send_keys(reset_pwd[i]['commit'])

                            self.pwd_reset.confirm_button()  # 点击完成按钮
                            if self.user_info.wait_check_page(10):  # 页面检查点
                                print('success to changed')
                                if i != len(reset_pwd) - 1:
                                    self.user_info.click_password()  # 点击修改密码
                            else:
                                print('failed to submit question')
                            print('---------------------------------')
                else:
                    print('未进入个人信息页面')
                self.user_info.back_up()
        else:
            Toast().find_toast(VALID_LOGIN_TOAST.login_failed())
            print("未进入主界面")
Example #30
0
    def test_quit_vanclass(self):
        self.login.app_status()  # 判断APP当前状态

        if self.home.wait_check_page():  # 页面检查点
            self.home.click_test_vanclass()  # 班级tab
            if self.van.wait_check_page():  # 页面检查点

                van = self.van.vanclass_name()  # 班级名称
                for i in range(len(van)):
                    if van[i].text == gv.DEL_VANCLASS:
                        van[i].click()  # 进入班级详情页
                        break
                self.quit_tips_operate()  # 退出班级提示框

                if self.detail.wait_check_page(gv.DEL_VANCLASS):  # 页面检查点
                    self.home.back_up_button()  # 返回 班级
                    if self.van.wait_check_page():  # 班级 页面检查点
                        self.home.click_tab_hw()  # 返回主界面
        else:
            Toast().find_toast(VALID_LOGIN_TOAST.login_failed())
            print("未进入主界面")