Exemple #1
0
class TestErrorCheck(BaseTestCase):
    file_name, name = __file__, __name__
    case_log_path = log_path(file_name, name)

    student_data = Data().student_data()

    @log_decorator(case_log_path)
    def test_field_error(self):
        """
        试炼场
        :return:
        """
        self.step_log_path = self.case_log_path
        self.login(**self.student_data)
        self.click_and_jump(1, *ElementSelector.test_field_btn_loc)
        self.check_error()

    @log_decorator(case_log_path)
    def test_course_field_error(self):
        """
        课件查看页面精简试炼场
        :return:
        """
        self.step_log_path = self.case_log_path
        self.login(**self.student_data)
        self.click_button(*ElementSelector.bar_course_loc)
        self.click_and_jump(
            1,
            *ElementSelector.course_list_card_mode_first_course_loc,
            loading=True)
        self.click_button(
            *ElementSelector.course_detail_start_study_course_loc,
            loading=True)
        code = wrong_code()
        self.course_field_operation(code, 'Error', wrong=True)
Exemple #2
0
class UserLoginWrong(BaseTestCase):
    file_name = __file__
    name = __name__
    case_log_path = log_path(file_name, name)

    @log_decorator(case_log_path)
    def test_wrong_login(self):
        self.step_log_path = self.case_log_path
        self.user_login_wrong()
Exemple #3
0
class TestWishBox(BaseTestCase):
    file_name = __file__
    name = __name__
    case_log_path = log_path(file_name, name)

    student_data = Data().student_data()

    @log_decorator(case_log_path)
    def test_wish_box(self):
        self.step_log_path = self.case_log_path
        self.login(**self.student_data)
        self.wish_box()
class TestAIExperience(BaseTestCase):
    file_name = __file__
    name = __name__
    case_log_path = log_path(file_name, name)

    teacher_data = Data().teacher_data()

    @log_decorator(case_log_path)
    def test_01(self):
        self.step_log_path = self.case_log_path
        self.login(**self.teacher_data)
        self.click_button(*ElementSelector.ai_experience_loc)
        self.ai_experience()
Exemple #5
0
class TestHomework(BaseTestCase):
    file_name = __file__
    name = __name__
    case_log_path = log_path(file_name, name)

    d = Data()
    teacher_data = d.teacher_data()
    student_data = d.student_data()
    username = Data().teacher_username_for_edu()
    password = Data().password_for_edu
    username_student = Data().student_username_for_edu()
    student_name = Data().student_name_for_edu()
    teacher_name = Data().teacher_name_for_edu()

    @log_decorator(case_log_path)
    def test_01_homework_loop(self):
        self.step_log_path = self.case_log_path
        # 教师操作
        self.login(**self.teacher_data)
        self.click_button(*ElementSelector.bar_homework_loc)
        self.add_homework_loop()
        # self.date_selection('作业', Data().homework_name)   # 日期筛选全部砍掉了,先保留代码免得后面又加回来
        # 学生操作
        self.get_new_driver()
        self.login(**self.student_data)
        self.click_button(*ElementSelector.bar_homework_loc)
        self.student_do_homework_loop()
        # self.date_selection('作业', Data().homework_name, student=True)

    @log_decorator(case_log_path)
    def test_02_add_homework_wrong(self):
        self.step_log_path = self.case_log_path
        self.login(**self.teacher_data)
        self.click_button(*ElementSelector.bar_homework_loc)
        self.add_homework_wrong()

    @log_decorator(case_log_path)
    def test_03_homework_search(self):
        self.step_log_path = self.case_log_path
        # 教师操作
        self.login(**self.teacher_data)
        self.click_button(*ElementSelector.bar_homework_loc)
        self.search_input('自动')
        # 学生操作
        self.get_new_driver()
        self.login(**self.student_data)
        self.click_button(*ElementSelector.bar_homework_loc)
        self.search_input('自动')
Exemple #6
0
class DoHomeworkSimple(BaseTestCase):
    file_name = __file__
    name = __name__
    case_log_path = log_path(file_name, name)

    student_data = Data().student_data()
    username = Data().student_username_for_edu()
    password = Data().password_for_edu
    student_name = Data().student_name_for_edu()

    @log_decorator(case_log_path)
    def test_01(self):
        self.step_log_path = self.case_log_path
        self.login(**self.student_data)
        self.click_button(*ElementSelector.bar_homework_loc, loading=True)
        self.student_do_homework_simple(homework_name=None)
Exemple #7
0
class TestCourse(BaseTestCase):
    file_name, name = __file__, __name__
    case_log_path = log_path(file_name, name)
    d = Data()
    manager_data = d.manager_data()
    teacher_data = d.teacher_data()
    student_data = d.student_data()

    @log_decorator(case_log_path)
    def test_01_teacher_preview_course(self):
        self.step_log_path = self.case_log_path
        self.login(**self.teacher_data)
        self.click_button(*ElementSelector.bar_course_loc)
        self.preview_course()

    @log_decorator(case_log_path)
    def test_02_traverse_check_course(self):
        self.step_log_path = self.case_log_path
        self.login(**self.teacher_data)
        self.click_button(*ElementSelector.bar_course_loc)
        course_name = self.add_course_simple(self.teaching_package_list[0])
        self.click_and_jump(
            1, *ElementSelector.course_list_card_mode_first_course_loc)
        self.check_course_simple(course_name, teacher=True, check_all=True)
        self.switch_window(0)
        self.del_course()

    @log_decorator(case_log_path)
    def test_03_student_do_practice(self):
        self.step_log_path = self.case_log_path
        self.login(**self.student_data)
        self.click_button(*ElementSelector.bar_course_loc)
        self.click_and_jump(
            1,
            *ElementSelector.course_list_card_mode_first_course_loc,
            loading=True)
        self.student_do_practice()
class TestFieldCase(BaseTestCase):
    file_name = __file__
    name = __name__
    case_log_path = log_path(file_name, name)

    d = Data()
    teacher_data = d.teacher_data()
    student_data = d.student_data()

    @log_decorator(case_log_path)
    def test_01(self):
        """turtle"""
        self.step_log_path = self.case_log_path

        self.login(**self.student_data)
        self.click_and_jump(1, *ElementSelector.test_field_btn_loc)
        self.do_test_field('turtle')

    @log_decorator(case_log_path)
    def test_02(self):
        """pygame"""
        self.step_log_path = self.case_log_path
        self.login(**self.student_data)
        self.click_and_jump(1, *ElementSelector.test_field_btn_loc)
        self.do_test_field('pygame')

    @log_decorator(case_log_path)
    def test_03(self):
        """多文件"""
        self.step_log_path = self.case_log_path
        filename = Data().test_field_file_name
        output = Data().test_field_output
        self.login(**self.teacher_data)
        self.click_and_jump(1, *ElementSelector.test_field_btn_loc)
        self.multiple_files_test_field(filename, '多文件测试', output)

    @log_decorator(case_log_path)
    def test_04(self):
        """打开草稿"""
        self.step_log_path = self.case_log_path
        output = Data().test_field_output
        self.login(**self.teacher_data)
        self.click_and_jump(1, *ElementSelector.test_field_btn_loc)
        self.open_file(output)

    @log_decorator(case_log_path)
    def test_05(self):
        """3D打印"""
        self.step_log_path = self.case_log_path
        self.login(**self.teacher_data)
        self.click_and_jump(1, *ElementSelector.test_field_btn_loc)
        self.three_dimensional()

    @log_decorator(case_log_path)
    def test_06(self):
        """
        试炼场发布作品
        :return:
        """
        work_name = Data().work_name
        self.step_log_path = self.case_log_path
        self.login(**self.student_data)
        self.click_and_jump(1, *ElementSelector.test_field_btn_loc)
        self.submit_work(work_name)

    @log_decorator(case_log_path)
    def test_07(self):
        """素材库"""
        self.step_log_path = self.case_log_path
        self.login(**self.student_data)
        self.click_and_jump(1, *ElementSelector.test_field_btn_loc)
        self.upload_material()
Exemple #9
0
class TestMainProcess(BaseTestCase):
    file_name, name = __file__, __name__
    case_log_path = log_path(file_name, name)
    d = Data()
    manager_data = d.manager_data()
    teacher_data = d.teacher_data()
    student_data = d.student_data()

    homework_name = d.homework_name
    admin_class_name = d.admin_class_name_for_edu()
    pro_class_name = d.pro_class_name_for_edu()

    @log_decorator(case_log_path)
    def test_01_main_process_course(self):
        self.step_log_path = self.case_log_path
        # 教师操作
        self.login(**self.teacher_data)
        self.click_button(*ElementSelector.bar_course_loc)
        course_name = self.add_course_simple(self.teaching_package_list[0])
        self.click_and_jump(
            1, *ElementSelector.course_list_card_mode_first_course_loc)
        self.check_course_simple(course_name, teacher=True)
        self.teacher_check_index_course(course_name)
        # 学生操作
        self.get_new_driver()
        self.login(**self.student_data)
        self.student_check_index_course(course_name)
        self.click_and_jump(
            1, *ElementSelector.course_list_card_mode_first_course_name_loc)
        self.check_course_simple(course_name)

    @log_decorator(case_log_path)
    def test_02_main_process_homework(self):
        self.step_log_path = self.case_log_path
        # 教师发布作业
        self.login(**self.teacher_data)
        self.click_button(*ElementSelector.bar_homework_loc)
        self.click_button(*ElementSelector.homework_list_add_homework_btn_loc,
                          loading=True)
        add_homework_param = {
            'homework_name': self.homework_name,
            'answer_config': self.answer_list[0],
            'difficulty': 1
        }
        self.add_homework_simple(**add_homework_param)
        self.teacher_check_index_homework(self.homework_name)
        # 学生做作业
        self.get_new_driver()
        self.login(**self.student_data)
        self.student_check_index_homework(self.homework_name)
        self.click_button(*ElementSelector.bar_homework_loc, loading=True)
        completion, correct = self.student_do_homework_simple(
            self.homework_name)
        # 教师检查作业详情
        self.switch_to_default_driver()
        self.teacher_check_index_homework(self.homework_name)
        self.teacher_check_homework_simple(self.homework_name, completion,
                                           correct)

    @log_decorator(case_log_path)
    def test_03_delete_course(self):
        self.step_log_path = self.case_log_path
        self.login(**self.teacher_data)
        self.click_button(*ElementSelector.bar_course_loc)
        self.del_course()