Пример #1
0
 def setup(self):
     '''
     非調試端口用
     '''
     self.main = Main()
     # 讀取數據庫
     self.db = shelve.open("overtimeSn")
Пример #2
0
 def setup_class(self):
     '''
     非調試端口用
     '''
     self.main = Main().goto_login(). \
         username(self.setup_datas["username"]).password(self.setup_datas["password"]).save(). \
         goto_application(). \
         goto_exam(self.setup_datas["application"])
Пример #3
0
class TestRegister:
    def setup(self):
        self.main = Main()

    def test_register(self):
        assert self.main.goto_register().register()

    def test_login(self):
        assert self.main.goto_login().goto_register().register()
Пример #4
0
class TestWechat:
    def setup(self):
        self.main = Main()

    def teardown(self):
        self.main.quit()

    @pytest.mark.parametrize("username, uid, phonenum", [("hogwarts007", "19799", "15879654998")])
    def test_wechat(self, username, uid, phonenum):
        assert self.main.add_newMember().add_new(username, uid, phonenum).addressBook(username)
Пример #5
0
class TestRegister:

    #初始化,setup方法会在下面每个测试用例前执行
    def setup(self):
        self.main = Main()

    def test_register(self):
        #链式调用 main方法中的gotoregister,可以return到Register中的register方法
        #assert self.main.goto_register().register()
        self.main.goto_login().goto_register().register()
Пример #6
0
class TestLogin:
    def setup(self):
        self.main = Main()

    def teardown(self):
        pass

    def test_login(self):
        self.main.goto_login().do_scan()
        assert '吕川,开始探索企业微信' in self.main.driver.page_source
        assert '退出' == self.main.find(By.ID, 'logout').text
Пример #7
0
class TestCustomerInput:

    def setup(self):
        self.main = Main()

    @pytest.mark.parametrize('customername, contactPhone', customer_name)
    def test_customer_input(self, customername, contactPhone):
        self.main.customer_input().add_customer(customername, contactPhone)

    def teardown(self):
        self.main.close()
Пример #8
0
class Test0924:
    with open(test_authorization_dir, encoding="utf-8") as f:
        datas = yaml.safe_load(f)
        setup_datas = datas["setup_datas"]
        test_get_memu_num_datas = datas["test_get_memu_num"]

    def setup_class(self):
        '''
        非調試端口用
        '''
        # self.main = Main().goto_login(). \
        #     username(self.setup_datas["username"]).password(self.setup_datas["password"]).save(). \
        #     goto_application(). \
        #     goto_exam(self.setup_datas["application"])
        self.main = Main()

    def setup(self):
        '''
        非調試端口用
        '''
        self.begin=self.main.goto_login(). \
            username(self.setup_datas["username"]).password(self.setup_datas["password"]).save(). \
            goto_application(). \
            goto_exam(self.setup_datas["application"])

    def teardown(self):
        '''
        非調試端口用
        '''
        self.main.back_to_index().quit()

    def teardown_class(self):
        '''
        非調試端口啓用
        '''
        self.main.close()

    # def setup(self):
    #     '''
    #     開啓調試端口啓用
    #     '''
    #     self.main = Main()

    @pytest.mark.parametrize("data", test_get_memu_num_datas)
    def test_get_memu_num(self, data):
        '''
        權限測試,驗證取消排考計劃權限,菜單只有5個
        '''
        result = self.begin.get_memu_num()
        assert result == data["expect"]
Пример #9
0
class TestContract:
    def setup(self):
        self.main = Main()
        self.main.goto_login().do_scan()
        self.main.driver.find_element(By.XPATH,
                                      "//*[@id='menu_contacts']").click()
        time.sleep(2)

    def teardown(self):
        # 清除数据
        pass

    def test_add_department(self):
        result = self.main.goto_add_department().add_department(
        ).get_department_list()
        assert '和平精英' in result
Пример #10
0
class TestAddMember():
    def setup(self):
        self.main = Main()

    @pytest.mark.skip
    def test_add_member(self):
        add_member = self.main.goto_add_member()
        add_member.add_member()
        # 添加断言,验证是否新增的成员成功
        assert "hogwarts" in add_member.get_element()

    # @pytest.mark.skip
    def test_add_member_contact(self):
        add_member_contact = self.main.goto_contact().add_member_contacts()
        add_member_contact.add_member()
        assert "hogwarts" in add_member_contact.get_element()
Пример #11
0
class TestMain():
    def setup(self):
        self.main = Main(reuse=True)

    @pytest.mark.parametrize("username, mobile", [('test', '15515155166')])
    def test_add_member(self, username, mobile):
        t = str(int(time.time()))
        username += t
        contactPage = self.main.goto_add_member()
        contactPage.add_member(username, t, mobile)

        titles = contactPage.get_titles_in_list(username)
        assert username in titles

    def teardown(self):
        self.main.close()
Пример #12
0
class TestContact:
    def setup(self):
        self.main = Main(reuse=True)

    def test_contact(self):
        self.contact = self.main.goto_add_member().add_member()
        assert self.contact.get_member() == "MrDong"
Пример #13
0
class TestAddmumber:
    def setup(self):
        self.main = Main()

    def test_addmumber(self):
        add_mumber = self.main.goto_add_mumber()
        add_mumber.add_mumber()
        assert "测试1" == add_mumber.search_mumber()
Пример #14
0
class TestRegister:
    def setup(self):
        self.main = Main()

    def teardown(self):
        pass

    def test_register(self):
        assert self.main.goto_register().do_register()
Пример #15
0
class TestProgress:
    def setup(self):
        self.main = Main()

    def test_event_student_stutas(self):
        staffNo = "0409853A-S011-0911"
        result = self.main.goto_registration().\
            goto_progress().simple_search().\
            goto_firstevent_stulist().\
            simple_search(staffNo).\
            event_stutas(staffNo)
        assert result == "未完成"

    def test_history_operation_num(self):
        staffNo = "0409853A-S011-0911"
        result = self.main.goto_registration(). \
            goto_progress().simple_search(). \
            goto_firstevent_stulist(). \
            simple_search(staffNo).\
            goto_detail(staffNo).\
            operation_history()
        assert result == 1
Пример #16
0
 def goto_main(self) -> Main:
     def wait_load(driver):
         source = self._driver.page_source
         if "我的" in source:
             return True
         if "同意" in source:
             return True
         if "image_cancel" in source:
             return True
         return False
     WebDriverWait(self._driver,30).until(wait_load)
     time.sleep(5)
     return Main(self._driver)
Пример #17
0
    def t_classtable(self, data):
        '''
        把setup的內容包裝成函數調用,原因:要傳參data
        :param data:
        :return:
        '''
        # 处理data参数
        memu = data['memu']
        term = data['term']

        # t_classtable = Main().goto_classtimetable(). \
        #     goto_teacher_classtable(memu)
        t_classtable = Main().goto_teacher_classtable(memu)
        return t_classtable
Пример #18
0
class Test_Authorization_Setting:

    with open(test_exam_authorization_setting_dir, encoding="utf-8") as f:
        datas = yaml.safe_load(f)
        setup_datas = datas["setup_datas"]
        test_exam_authorization_setting_datas = datas[
            "test_exam_authorization_setting"]

    # def setup_class(self):
    #     '''
    #     非調試端口用
    #     '''
    #     self.main = Main().goto_login(). \
    #         username(self.setup_datas["username).password(self.setup_datas["password).save(). \
    #         goto_application(). \
    #         goto_classtimetable(self.setup_datas["application)
    #
    # def teardown_class(self):
    #     '''
    #     非調試端口啓用
    #     '''
    #     self.main.close()

    def setup(self):
        '''
        開啓調試端口啓用
        '''
        self.main = Main()

    # def teardown(self):
    #     '''
    #     開啓調試端口啓用
    #     '''
    #     self.main = Main()

    @pytest.mark.parametrize("data", test_exam_authorization_setting_datas)
    def test_exam_authorization_setting(self, data):
        '''
        '''
        result = self.main.goto_unified_authorization().\
            goto_role_management().\
            search_role_management(data["role"]).\
            the_role_permission_setting().\
            goto_Platform_For_Academia_Service().\
            goto_examPC(data["application"]).\
            give_exam_exam_plan(data["memu"]).\
            click_save(data["role"])
        assert result == data["expect"]
Пример #19
0
class Test_AddUser_t:

    # def setup_class(self):
    #     '''
    #     非調試端口用
    #     '''
    #     self.main = Main().goto_login(). \
    #         username(self.setup_datas["username).password(self.setup_datas["password).save(). \
    #         goto_application(). \
    #         goto_classtimetable(self.setup_datas["application)
    #
    # def teardown_class(self):
    #     '''
    #     非調試端口啓用
    #     '''
    #     self.main.close()

    def setup(self):
        '''
        開啓調試端口啓用
        '''
        self.main = Main()

    def teardown(self):
        '''
        開啓調試端口啓用
        '''
        self.main = Main().close_adduser_pop()

    @pytest.mark.parametrize("name,enname,staffno,"
                             "username_t,"
                             "port_id,email,group,tel,"
                             "groupSortOrder,expect", test_create_data())
    def test_add_user(self, name, enname, staffno, username_t, port_id, email,
                      group, tel, groupSortOrder, expect):
        '''
        驗證添加教職工
        '''
        result = self.main.goto_unified_data().goto_user().\
            goto_teacher().goto_add_user_t().click_add().name(name).\
            enname(enname).staffno(staffno).username(username_t).\
            port(port_id).email(email).group(group).tel(tel).\
            groupSortOrder(groupSortOrder).submit().get_adduser_succeed()
        assert result == expect
Пример #20
0
class Test_Exam_Plan:
    with open(test_exam_plan_dir, encoding="utf-8") as f:

        datas = yaml.safe_load(f)
        setup_datas = datas["setup_datas"]
        test_check_upload_exists_plan_datas = datas[
            "test_check_upload_exists_plan"]

    def setup_class(self):
        '''
        非調試端口用
        '''
        self.main = Main().goto_login(). \
            username(self.setup_datas["username"]).password(self.setup_datas["password"]).save(). \
            goto_application(). \
            goto_exam(self.setup_datas["application"])

    def teardown_class(self):
        '''
        非調試端口啓用
        '''
        # self.main.close()
        pass

    # def setup(self):
    #     '''
    #     開啓調試端口啓用
    #     '''
    #     self.main = Main()

    @pytest.mark.parametrize("data", test_check_upload_exists_plan_datas)
    def test_check_upload_exists_plan(self, data):
        '''
        验证上传已排计划
        '''

        result = self.main.goto_exam_plan().\
            add_exists_plan().\
            plan_name(data["plan_name"]).term().\
            upload_exists_plan_import(data["excel_path"]).\
            download_result().\
            check_upload_result()
        assert result == data["expect"]
Пример #21
0
    def sign_in_derail(self, data):
        '''
        把setup的內容包裝成函數調用,原因:要傳參data
        :param data:
        :return:
        '''
        # 处理data参数
        memu = data['memu']
        term = data['term']
        stuclass = data['stuclass']
        course = data['course']
        staffNo = data['staffNo']

        sign_in_derail = Main().goto_classtimetable(). \
            goto_undergradute_record(memu). \
            advanced_search(term, stuclass,course). \
            advanced_srarch_result_goto_signrecord(course). \
            simple_search(staffNo)
        return sign_in_derail
Пример #22
0
class TestLogin:

    _name = "test11"
    _psd = "123456"

    def setup_class(self):
        self.main = Main()

    def teardown_class(self):
        self.main.close()

    def setup(self):
        self.login = self.main.goto_login().username(self._name).password(self._psd).save()

    def teardown(self):
        self.main.quit()

    @pytest.mark.parametrize("name,psd",[("test12","wemust123"),("test11","123456")])
    @pytest.mark.skip
    def testlogin(self,name,psd):
        '''
        測試登錄功能
        :return:
        '''
        self.main.goto_login().username(name).password(psd).save()

    def test_selectapplication(self):
        '''
        測試打開選擇應用的頁面
        :return:
        '''
        self.login.goto_application()

    def test_gotoapplication(self):
        '''
        測試打開某個應用
        :return:
        '''
        application_name = "課表"
        memu = "教師課表(本科)"
        self.login.goto_application().\
            goto_classtimetable(application_name). \
            goto_teacher_management_degree(memu)
Пример #23
0
 def main(self):
     return Main(self._driver)
Пример #24
0
class Test_bug27204:
    with open(test_bug27204_dir, encoding="utf-8") as f:
        datas = yaml.safe_load(f)
        setup_datas = datas[get_env()]
        test_check_add_plan_succeed_datas = datas[
            "test_check_add_plan_succeed"]
        test_add_double_exam_datas = datas["test_add_double_exam"]

    _working = _get_working()
    if _working == "port":

        def setup(self):
            '''
            開啓調試端口啓用
            '''
            self.main = Main()
    else:

        def setup_class(self):
            '''
            非調試端口用
            '''
            self.main = Main().goto_login(). \
                username(self.setup_datas["username"]).password(self.setup_datas["password"]).save(). \
                goto_application(). \
                goto_exam(self.setup_datas["application"])

        def teardown_class(self):
            '''
            非調試端口啓用
            '''
            self.main.close()

    @pytest.mark.parametrize("data", test_check_add_plan_succeed_datas)
    def test_check_add_plan_succeed(self, data):
        '''
        验证添加計劃成功
        '''

        result = self.main.goto_exam_plan().\
            add_exists_plan().\
            plan_name(data["plan_name"]).term(data["term"]).\
            upload_exists_plan_import(data["excel_path"]).\
            download_result().\
            goto_plan_details().\
            get_plan_name()
        assert data["expect"] in result

    @pytest.mark.parametrize("data", test_add_double_exam_datas)
    def test_add_double_exam(self, data):
        '''
        一次添加兩門科目
        '''
        result = self.main.goto_exam_plan(). \
            goto_plan_details(data["plan_name"]). \
            goto_add_exam(). \
            add_examCode(data["examCode"]).add_course_1(data["course_1"]). \
            add_teacher_1(data["teacher_1"]).add_class_1(data["classdata_1"]). \
            add_course_2(data["course_2"]).add_teacher_2(data["teacher_2"]).add_class_2(data["classdata_2"]). \
            add_student_exam(data["num"]).add_examdate(data["examdate"]).add_examtime(data["examtime"]). \
            add_roomCode(data["roomCode"]).add_invigilate_one(data["invigilate_one"]).\
            click_save(). \
            close_and_goto_plan_details(). \
            get_current_exam_total()
        assert data["expect"] == result
Пример #25
0
 def setup(self):
     '''
     開啓調試端口啓用
     '''
     self.main = Main()
Пример #26
0
    def setup_class(self):

        self.main = Main().goto_login().\
            username(self.setup_datas["username"]).password(self.setup_datas["password"]).save().\
            goto_application().\
            goto_classtimetable(self.setup_datas["application"])
Пример #27
0
class TestTeacherClassTable:

    with open(test_teacher_m_degree_dir, encoding="utf-8") as f:
        datas = yaml.safe_load(f)
        setup_datas = datas["setup_datas"]
        test_course_type_datas = datas["test_course_type"]
        test_simply_search_course_name_datas = datas["test_simply_search_course_name"]
        test_simply_search_tearch_name_datas = datas["test_simply_search_tearch_name"]
        test_simply_search_tearch_username_datas = datas["test_simply_search_tearch_username"]
        test_simply_search_course_code_datas = datas["test_simply_search_course_code"]
        test_advanced_search_teachername_datas = datas["test_advanced_search_teachername"]
        test_advanced_search_username_datas = datas["test_advanced_search_username"]
        test_advanced_search_room_datas = datas["test_advanced_search_room"]
        test_advanced_search_course_name_datas = datas["test_advanced_search_course_name"]
        test_advanced_search_course_code_datas = datas["test_advanced_search_course_code"]
        test_advanced_search_course_type_datas = datas["test_advanced_search_course_type"]
        test_advanced_search_reset_datas = datas["test_advanced_search_reset"]
        test_get_H_S_N_course_room_datas = datas["test_get_H_S_N_course_room"]
        test_get_H_S_N_course_zoom_datas = datas["test_get_H_S_N_course_zoom"]
        test_get_Z_M_course_room_datas = datas["test_get_Z_M_course_room"]
        test_get_course_details_student_num_datas = datas["test_get_course_details_student_num"]
        test_search_studentname_datas = datas["test_search_studentname"]
        test_search_studentstaffNo_datas = datas["test_search_studentstaffNo"]
        test_get_lessontime_datas = datas["test_get_lessontime"]
        test_get_lesson_student_num_datas = datas["test_get_lesson_student_num"]
        test_back_to_teacher_management_degree_datas = datas["test_back_to_teacher_management_degree"]


    def setup_class(self):

        self.main = Main().goto_login().\
            username(self.setup_datas["username"]).password(self.setup_datas["password"]).save().\
            goto_application().\
            goto_classtimetable(self.setup_datas["application"])

    def teardown_class(self):
        self.main.close()

    # def setup(self):
    #     self.main = self.main.goto_login().\
    #         username(self.setup_datas["username"]).password(self.setup_datas["password"]).save().\
    #         goto_application().\
    #         goto_classtimetable(self.setup_datas["application"])


    # def teardown(self):
    #     self.main.quit()

    @pytest.mark.parametrize("data", test_course_type_datas)
    def test_course_type(self, data):
        '''
        驗證課堂類型
        :return:
        '''

        result = self.main. \
            goto_teacher_management_degree(self.setup_datas["memu"]).\
            get_yy_mm_dd(data["year"], data["month"], data["day"]). \
            get_course_details(data["week"],data["course_num"]).\
            get_course_type(data["data_num"])
        return result == data["expect"]

    @pytest.mark.parametrize("data", test_simply_search_course_name_datas)
    def test_simply_search_course_name(self, data):
        '''
        驗證簡易查詢科目名稱
        :return:
        '''
        result = self.main. \
            goto_teacher_management_degree(self.setup_datas["memu"]).\
            get_yy_mm_dd(data["year"], data["month"], data["day"]). \
            get_all_facCode(). \
            simply_search(data["keywords"]).get_current_week_courses_num()
        assert result == data["expect"]

    @pytest.mark.parametrize("data", test_simply_search_tearch_name_datas)
    def test_simply_search_tearch_name(self, data):
        '''
        驗證簡易查詢教師名稱
        :return:
        '''
        result = self.main. \
            goto_teacher_management_degree(data["memu"]). \
            get_yy_mm_dd(data["year"],data["month"],data["day"]).\
            get_all_facCode(). \
            simply_search(data["keywords"]).\
            get_current_week_courses_num()
        assert result == data["expect"]

    @pytest.mark.parametrize("data", test_simply_search_tearch_username_datas)
    def test_simply_search_tearch_username(self, data):
        '''
        驗證簡易查詢教師賬號
        :return:
        '''
        result = self.main. \
            goto_teacher_management_degree(data["memu"]). \
            get_yy_mm_dd(data["year"],data["month"],data["day"]).\
            get_all_facCode(). \
            simply_search(data["keywords"]).\
            get_current_week_courses_num()
        assert result == data["expect"]

    @pytest.mark.parametrize("data", test_simply_search_course_code_datas)
    def test_simply_search_course_code(self, data):
        '''
        驗證簡易查詢科目編號
        :return:
        '''
        result = self.main. \
            goto_teacher_management_degree(data["memu"]). \
            get_yy_mm_dd(data["year"],data["month"],data["day"]).\
            get_all_facCode(). \
            simply_search(data["keywords"]).\
            get_current_week_courses_num()
        assert result == data["expect"]

    @pytest.mark.parametrize("data", test_advanced_search_teachername_datas)
    def test_advanced_search_teachername(self, data):
        '''
        驗證高級查詢教師名稱
        :return:
        '''
        result = self.main. \
            goto_teacher_management_degree(data["memu"]). \
            get_yy_mm_dd(data["year"],data["month"],data["day"]).\
            get_all_facCode(). \
            click_advanced_search(). \
            advanced_search_teachername(data["teachername"]).\
            advanced_search_confirm().\
            get_current_week_courses_num()
        assert result == data["expect"]

    @pytest.mark.parametrize("data", test_advanced_search_username_datas)
    def test_advanced_search_username(self, data):
        '''
        驗證高級查詢教師賬號
        :return:
        '''
        result = self.main. \
            goto_teacher_management_degree(data["memu"]). \
            get_yy_mm_dd(data["year"],data["month"],data["day"]).\
            get_all_facCode(). \
            click_advanced_search(). \
            advanced_search_username(data["tusername"]).\
            advanced_search_confirm().\
            get_current_week_courses_num()
        assert result == data["expect"]

    @pytest.mark.parametrize("data", test_advanced_search_room_datas)
    def test_advanced_search_room(self, data):
        '''
        驗證高級查詢課室
        :return:
        '''
        result = self.main. \
            goto_teacher_management_degree(data["memu"]). \
            get_yy_mm_dd(data["year"],data["month"],data["day"]).\
            get_all_facCode(). \
            click_advanced_search(). \
            advanced_search_room(data["room"]).\
            advanced_search_confirm().\
            get_current_week_courses_num()
        assert result == data["expect"]

    @pytest.mark.parametrize("data", test_advanced_search_course_name_datas)
    def test_advanced_search_course_name(self, data):
        '''
        驗證高級查詢科目名稱
        :return:
        '''
        result = self.main. \
            goto_teacher_management_degree(data["memu"]). \
            get_yy_mm_dd(data["year"],data["month"],data["day"]).\
            get_all_facCode(). \
            click_advanced_search(). \
            advanced_search_course_name(data["course_name"]).\
            advanced_search_confirm().\
            get_current_week_courses_num()
        assert result == data["expect"]    \

    @pytest.mark.parametrize("data", test_advanced_search_course_code_datas)
    def test_advanced_search_course_code(self, data):
        '''
        驗證高級查詢科目編號
        :return:
        '''
        result = self.main. \
            goto_teacher_management_degree(data["memu"]). \
            get_yy_mm_dd(data["year"],data["month"],data["day"]).\
            get_all_facCode(). \
            click_advanced_search(). \
            advanced_search_course_code(data["course_code"]).\
            advanced_search_confirm().\
            get_current_week_courses_num()
        assert result == data["expect"]

    @pytest.mark.parametrize("data", test_advanced_search_course_type_datas)
    def test_advanced_search_course_type(self, data):
        '''
        驗證高級查詢科目類型
        :return:
        '''
        result = self.main. \
            goto_teacher_management_degree(data["memu"]). \
            get_yy_mm_dd(data["year"],data["month"],data["day"]).\
            get_all_facCode(). \
            click_advanced_search(). \
            advanced_search_course_type(data["course_type"]).\
            advanced_search_confirm().\
            get_current_week_courses_num()
        assert result == data["expect"]

    @pytest.mark.parametrize("data", test_advanced_search_reset_datas)
    def test_advanced_search_reset(self,data):
        '''
        驗證重置按鈕有效
        :return:
        '''
        result = self.main. \
            goto_teacher_management_degree(data["memu"]). \
            get_yy_mm_dd(data["year"],data["month"],data["day"]).\
            get_all_facCode(). \
            click_advanced_search(). \
            advanced_search_course_code(data["course_code"]).\
            advanced_search_confirm().\
            advanced_search_reset().\
            get_current_week_courses_num()
        assert result != data["expect"]


    @pytest.mark.parametrize("data", test_get_H_S_N_course_room_datas)
    def test_get_H_S_N_course_room(self, data):
        '''
        驗證線下課程、混合課程、特俗混合課程的課室顯示正常
        :return:
        '''
        result = self.main. \
            goto_teacher_management_degree(data["memu"]). \
            get_yy_mm_dd(data["year"], data["month"], data["day"]). \
            get_all_facCode().\
            simply_search(data["keywords"]). \
            get_course_details(data["week"],data["course_num"]).\
            get_H_S_N_course_room()
        assert result == data["expect"]

    @pytest.mark.parametrize("data", test_get_H_S_N_course_zoom_datas)
    def test_get_H_S_N_course_zoom(self, data):
        '''
        驗證混合課程、特俗混合課程的雲課堂顯示正常
        :return:
        '''
        result = self.main. \
            goto_teacher_management_degree(data["memu"]). \
            get_yy_mm_dd(data["year"], data["month"], data["day"]). \
            get_all_facCode().\
            simply_search(data["keywords"]). \
            get_course_details(data["week"],data["course_num"]).\
            get_H_S_N_course_zoom()
        assert result == data["expect"]

    @pytest.mark.parametrize("data", test_get_Z_M_course_room_datas)
    def test_get_Z_M_course_room(self, data):
        '''
        驗證雲課堂/網課的url地址顯示正常
        :return:
        '''
        result = self.main. \
            goto_teacher_management_degree(data["memu"]). \
            get_yy_mm_dd(data["year"], data["month"], data["day"]). \
            get_all_facCode().\
            simply_search(data["keywords"]). \
            get_course_details(data["week"],data["course_num"]).\
            get_Z_M_course_room()
        assert result == data["expect"]


    @pytest.mark.parametrize("data", test_get_course_details_student_num_datas)
    def test_get_course_details_student_num(self, data):
        '''
        驗證卡片上學生總數
        :return:
        '''
        result = self.main. \
            goto_teacher_management_degree(data["memu"]). \
            get_yy_mm_dd(data["year"], data["month"], data["day"]). \
            get_all_facCode().\
            simply_search(data["keywords"]). \
            get_course_details(data["week"],data["course_num"]). \
            get_course_details_student_num()
        assert result == data["expect"]

    @pytest.mark.parametrize("data", test_search_studentname_datas)
    def test_search_studentname(self, data):
        '''
        驗證班級同學頁面查詢姓名正確,必須輸入英文名稱,元素定位寫死了英文名稱
        :return:
        '''
        result = self.main. \
            goto_teacher_management_degree(data["memu"]). \
            get_yy_mm_dd(data["year"], data["month"], data["day"]). \
            get_all_facCode().\
            simply_search(data["keywords"]). \
            get_course_details(data["week"],data["course_num"]). \
            goto_classmate().\
            search_studentname(data["stu_keywords"])
        assert result == data["expect"]

    @pytest.mark.parametrize("data", test_search_studentstaffNo_datas)
    def test_search_studentstaffNo(self, data):
        '''
        驗證班級同學頁面查詢學號正確
        :return:
        '''
        result = self.main. \
            goto_teacher_management_degree(data["memu"]). \
            get_yy_mm_dd(data["year"], data["month"], data["day"]). \
            get_all_facCode().\
            simply_search(data["keywords"]). \
            get_course_details(data["week"],data["course_num"]). \
            goto_classmate().\
            search_studentstaffNo(data["stu_keywords"])
        assert result == data["expect"]

    @pytest.mark.parametrize("data", test_get_lessontime_datas)
    def test_get_lessontime(self, data):
        '''
        驗證班級同學頁面顯示授課時間
        :return:
        '''
        result = self.main. \
            goto_teacher_management_degree(data["memu"]). \
            get_yy_mm_dd(data["year"], data["month"], data["day"]). \
            get_all_facCode().\
            simply_search(data["keywords"]). \
            get_course_details(data["week"],data["course_num"]). \
            goto_classmate(). \
            get_lessontime()
        assert result[:10] == data["expect"]

    @pytest.mark.parametrize("data", test_get_lesson_student_num_datas)
    def test_get_lesson_student_num(self, data):
        '''
        驗證班級同學頁面顯示人數
        :return:
        '''
        result = self.main. \
            goto_teacher_management_degree(data["memu"]). \
            get_yy_mm_dd(data["year"], data["month"], data["day"]). \
            get_all_facCode().\
            simply_search(data["keywords"]). \
            get_course_details(data["week"],data["course_num"]). \
            goto_classmate(). \
            get_lesson_student_num()
        assert result == data["expect"]

    @pytest.mark.parametrize("data", test_back_to_teacher_management_degree_datas)
    def test_back_to_teacher_management_degree(self, data):
        '''
        驗證班級同學頁面返回上一頁保持進入前頁面不變
        :return:
        '''
        result = self.main. \
            goto_teacher_management_degree(data["memu"]). \
            get_yy_mm_dd(data["year"], data["month"], data["day"]). \
            get_all_facCode().\
            simply_search(data["keywords"]). \
            get_course_details(data["week"],data["course_num"]). \
            goto_classmate(). \
            back_to_teacher_management_degree().\
            get_current_week_courses_num()
        assert result == data["expect"]
Пример #28
0
 def setup_class(self):
     '''
     非調試端口用
     '''
     self.main = Main().goto_login(). \
         username(self._setup_datas["username"]).password(self._setup_datas["password"]).save()
Пример #29
0
class Test_Search_Student:

    _do_excel = Do_Excel(username_dir, 'user_s')
    _cases = _do_excel.read_excel()
    _setup_datas = get_env()


    _working = _get_working()
    if _working == "port":
        def setup(self):
            '''
            開啓調試端口啓用
            '''
            self.main = Main()
        def teardown(self):
            '''
            開啓調試端口啓用
            '''
            try:
                self.main.close_drawer()
            except Exception as e:
                pass


    else:
        def setup_class(self):
            '''
            非調試端口用
            '''
            self.main = Main().goto_login(). \
                username(self._setup_datas["username"]).password(self._setup_datas["password"]).save()

        def teardown(self):
            try:
                self.main.close_drawer()
            except Exception as e:
                pass

        def teardown_class(self):
            '''
            非調試端口啓用
            '''
            self.main.close()

    @pytest.mark.parametrize("data", _cases)
    def test_search_student_username(self, data):
        '''
        查找學生數量,驗證賬號存在
        '''
        result = self.main.goto_unified_data(). \
            goto_user().goto_student(). \
            search_user_s(data.username).\
            get_the_fir_row_text(data.username)

        assert True == result

    @pytest.mark.parametrize("data", _cases)
    def test_get_staffNo_for_search_username(self, data):
        '''
        查找學生賬號,返回學生學號
        '''
        try:
            result = self.main.goto_unified_data(). \
                goto_user().goto_student(). \
                search_user_s(data.username).get_the_first_staffNo(data.username)
            db = shelve.open("staffNo_s")
            self._do_excel.write_excel(data.id + 1, 3,db["staffNo_s"])
            db.close()
            assert True == result
        except AssertionError as e:
            self._do_excel.write_excel(data.id + 1, 3,'None')
            raise e
Пример #30
0
 def setup(self):
     self.main = Main()