Exemplo n.º 1
0
class TestBox:
    def setup_class(self):
        self.app = App()

    def teardown_class(self):
        self.app.stop()

    def setup(self):
        self.index = self.app.start().goto_index()

    def teardown(self):
        # self.app.back(5)
        self.app.close()

    def test_personinfor(self):
        '''
        应用的坐标根据账号不同有变化,要实时更新
        :return:
        '''
        email = "*****@*****.**"
        phone = "85857569"
        x = 95
        y = 807
        result = self.index.goto_workbench(x,y).goto_storagebox().\
            complete_personinfo().goto_editpage().\
            mailbox(email).contact_number(phone).\
            click_save().toast()
        assert "保存成功" in result
Exemplo n.º 2
0
class TestSignAll:
    '''
    驗證多個賬號的課程類型
    '''
    def setup_class(self):
        self.app = App()

    def teardown_class(self):
        self.app.stop()

    def setup(self):
        '''
        正常打開APP應用進入工作台
        :return:
        '''
        self.login = self.app.start().goto_login()

    def teardown(self):
        x=522
        y=986
        self.app.close().goto_person_info(520, 979). \
            goto_setting(293, 485). \
            logout(285, 263)

    @pytest.mark.parametrize("data", get_room_type_datas)
    def test_get_room_type(self,data):
        '''
        獲取課程教室,網課-》網課,雲課堂-》雲課堂
        '''
        result = self.login. \
            switch_to_context(). \
            username(data["username"]).password(data["password"]).click_save(286,444).\
            goto_workbench(174, 978). \
            goto_class_sign_in(data["signin_x"], data["signin_y"]). \
            signpage_switch_to_context(). \
            get_room_type()
        assert data["expect"] == result

    @pytest.mark.parametrize("data", supplementarysign_datas)
    def test_supplementarysign(self,data):
        '''
        驗證從APP補簽成功
        '''
        result = self.login. \
            switch_to_context(). \
            username(data["username"]).password(data["password"]).click_save(286,444).\
            goto_workbench(174, 978). \
            goto_class_sign_in(data["signin_x"], data["signin_y"]). \
            signpage_switch_to_context(). \
            goto_supplementarysign().\
            supplementarysign(data["remark"]). \
            signpage_switch_to_context(). \
            get_suppl_current_sign_present()
        assert data["expect"] == result
Exemplo n.º 3
0
class TestClassTimeTable:

    def setup_class(self):
        self.app = App()

    def teardown_class(self):
        # self.app.stop()
        pass

    def setup(self):
        # self.login = self.app.start().goto_login()
        self.index = self.app.start().goto_index()

    def teardown(self):
        # self.app.back_to_index().\
        #     goto_index().\
        #     goto_person_info(memu_person).\
        #     goto_settings().\
        #     logout(logout_datas["logout_x"],logout_datas["logout_y"])
        try:
            self.app.close()
        except Exception as e:
            raise e

    @pytest.mark.parametrize("data", test_today_term_datas)
    def test_today_term(self,data):
        '''
        校驗today對應的學期正確性
        '''
        result = self.index. \
            goto_class_timetable(data["class_x"],data["class_y"]).\
            switch_to_context().\
            click_today().\
            get_term()
        assert data["expect"] == result

    @pytest.mark.parametrize("data", test_today_term_datas)
    def test_current_week(self,data):
        '''
        校驗打開課表定位當前週
        '''
        result = self.index. \
            goto_class_timetable(data["class_x"],data["class_y"]).\
            switch_to_context().\
            get_current_day()
        assert time.strftime('%m/%d',time.localtime(time.time())) in result

    @pytest.mark.parametrize("data", test_course_type_or_status_datas)
    def test_course_type_or_status(self, data):
        '''
        list頁,驗證指定科目的類型為雲課堂/網課
        list頁,驗證指定科目的狀態
        '''
        result = self.index. \
            goto_class_timetable(data["class_x"], data["class_y"]). \
            switch_to_context(). \
            goto_studentcourses(). \
            get_course_type_or_status(data["course_code"])
        assert data["expect"] == result

    @pytest.mark.parametrize("data", test_course_z_m_status_datas)
    def test_course_z_m_status(self, data):
        '''
        list頁,校驗網課/云課堂的狀態
        '''
        result = self.index. \
            goto_class_timetable(data["class_x"], data["class_y"]). \
            switch_to_context(). \
            goto_studentcourses(). \
            get_course_z_m_status(data["course_code"])
        assert data["expect"] == result

    @pytest.mark.parametrize("data", test_course_z_m_status_datas)
    def test_course_z_m_status(self, data):
        '''
        校驗課程詳情頁該課程類型
        '''
        result = self.index. \
            goto_class_timetable(data["class_x"], data["class_y"]). \
            switch_to_context(). \
            goto_studentcourses(). \
            get_course_z_m_status(data["course_code"])
        assert data["expect"] == result
Exemplo n.º 4
0
class TestSign:
    def setup_class(self):
        self.app = App()

    def teardown_class(self):
        self.app.stop()
        # pass

    def setup(self):
        '''
        正常打開APP應用進入工作台
        :return:
        '''
        # self.signin = self.app.start().\
        #     goto_index().\
        #     goto_workbench().\
        #     goto_class_sign_in(self._x,self._y)
        '''
        臨時入口測試,不重新打開APP,從工作台開始
        '''
        self.start = self.app.start()

    def teardown(self):
        self.app.close()

    @pytest.mark.parametrize("data", [fulldatas])
    def test_fullattendance(self, data):
        '''
        獲取應簽到人數
        '''
        result = self.start. \
            goto_index(). \
            goto_workbench(174, 978). \
            goto_class_sign_in(data["signin_x"], data["signin_y"]).\
            signpage_switch_to_context().\
            current_sign_fullattendance()
        assert data["expect"] == result

        # result = self.start.goto_index().\
        #     goto_workbench(174,978).\
        #     goto_class_sign_in().\
        #     signpage_switch_to_context().\
        #     current_sign_fullattendance()
        # assert data["expect"] == result

    @pytest.mark.parametrize("data", [presentdatas])
    def test_present(self, data):
        '''
        获取已签到人数
        '''
        result = self.start. \
            goto_index(). \
            goto_workbench(174, 978). \
            goto_class_sign_in(data["signin_x"], data["signin_y"]). \
            signpage_switch_to_context().\
            current_sign_present()
        assert data["expect"] == result

    @pytest.mark.parametrize("data", [absentdatas])
    def test_absent(self, data):
        '''
        获取未到人数
        '''
        result = self.start. \
            goto_index(). \
            goto_workbench(174, 978). \
            goto_class_sign_in(data["signin_x"], data["signin_y"]). \
            signpage_switch_to_context(). \
            current_sign_absent()
        assert data["expect"] == result

    @pytest.mark.parametrize("data", [get_room_type_datas])
    def test_get_room_type(self, data):
        '''
        獲取課程教室,網課-》網課,雲課堂-》雲課堂
        '''
        result = self.start. \
            goto_index(). \
            goto_workbench(174, 978). \
            goto_class_sign_in(data["signin_x"], data["signin_y"]). \
            signpage_switch_to_context(). \
            get_room_type()
        assert data["expect"] == result

    @pytest.mark.parametrize("data", [student_actual_attendance_datas])
    def test_student_actual_attendance(self, data):
        '''
        檢查該科目學生實際簽到次數
        '''
        result = self.start. \
            goto_index(). \
            goto_workbench(174, 978). \
            goto_class_sign_in(data["signin_x"], data["signin_y"]). \
            signpage_switch_to_context(). \
            goto_course_statistics().\
            switch_to_window().\
            stu_actual_attendance(data["staffNo"])
        assert data["expect"] == result

    @pytest.mark.parametrize("data", [student_supplementarysign_num_datas])
    def test_student_supplementarysign_num(self, data):
        '''
        獲取該科目、該學生簽到統計頁面的補簽數量
        '''
        result = self.start. \
            goto_index(). \
            goto_workbench(174, 978). \
            goto_class_sign_in(data["signin_x"], data["signin_y"]). \
            signpage_switch_to_context(). \
            goto_course_statistics().\
            switch_to_window(). \
            goto_student_statistics(data["staffNo"]).\
            switch_to_window().\
            get_supplementarysign_num()
        assert data["expect"] == result

    @pytest.mark.parametrize("data",
                             [student_the_supplementarysign_text_datas])
    def test_student_the_supplementarysign_text(self, data):
        '''
        驗證該學生第N條記錄的補簽toast
        '''
        result = self.start. \
            goto_index(). \
            goto_workbench(174, 978). \
            goto_class_sign_in(data["signin_x"], data["signin_y"]). \
            signpage_switch_to_context(). \
            goto_course_statistics(). \
            switch_to_window(). \
            goto_student_statistics(data["staffNo"]). \
            switch_to_window().\
            get_the_supplementarysign_text(data["supplementarysign_num"])
        assert data["expect"] == result

    @pytest.mark.parametrize("data", [student_the_supplementarysign_num_datas])
    def test_student_the_supplementarysign_num(self, data):
        '''
        驗證該學生當前頁面補簽數量
        '''
        result = self.start. \
            goto_index(). \
            goto_workbench(174, 978). \
            goto_class_sign_in(data["signin_x"], data["signin_y"]). \
            signpage_switch_to_context(). \
            goto_course_statistics(). \
            switch_to_window(). \
            goto_student_statistics(data["staffNo"]). \
            switch_to_window(). \
            get_supplementarysign_num()
        assert data["expect"] == result

    @pytest.mark.parametrize("data", [supplementarysign_datas])
    def test_supplementarysign(self, data):
        '''
        驗證從APP補簽成功
        '''
        result = self.start. \
            goto_index(). \
            goto_workbench(174, 978). \
            goto_class_sign_in(data["signin_x"], data["signin_y"]). \
            signpage_switch_to_context().\
            goto_supplementarysign().\
            supplementarysign(data["remark"]). \
            signpage_switch_to_context(). \
            get_suppl_current_sign_present()
        assert data["expect"] == result

    @pytest.mark.parametrize("data", [test_statistics_search_datas])
    def test_statistics_search(self, data):
        '''
        檢查簽到統計頁面查詢功能
        '''
        result = self.start. \
            goto_index(). \
            goto_workbench(174, 978). \
            goto_class_sign_in(data["signin_x"], data["signin_y"]). \
            signpage_switch_to_context().\
            goto_statistics().\
            search_courses(data["value"])
        assert data["expect"] == result