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)
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)
class TestAuthsNewStuList: name = "test12" pas = "******" application_name = "入學" staffNo = "1102853A-S011-0262" def setup_class(self): self.main = Main() def teardown_class(self): self.main.quit() def setup(self): self.index = self.main.goto_index() def teardown(self): self.index.backto_index() def test_menus_noexist(self): result = self.main.goto_login().\ username(self.name).password(self.pas).save().\ goto_application().\ goto_registration(self.application_name).\ goto_newstulist() assert result == False def test_export(self): result = self.main.goto_login(). \ username(self.name).password(self.pas).save(). \ goto_application(). \ goto_registration(self.application_name).\ goto_newstulist().\ export() assert result == False def test_detail(self): result = self.main.goto_login(). \ username(self.name).password(self.pas).save(). \ goto_application(self.application_name). \ goto_result = self.main.goto_login(). \ username(self.name).password(self.pas).save(). \ goto_application(). \ goto_registration(self.application_name).\ goto_newstulist().goto_detail_nosearch() print(f"打印result:{result}") assert result == "-" def test_student_detail(self): result = self.main.goto_login(). \ username(self.name).password(self.pas).save(). \ goto_application(self.application_name). \ goto_result = self.main.goto_login(). \ username(self.name).password(self.pas).save(). \ goto_application(). \ goto_registration(self.application_name). \ goto_newstulist(). \ simple_search(self.staffNo). \ goto_details(self.staffNo).\ goto_event_detail() assert result == False def test_eventdetail_edit(self): result = self.main.goto_login(). \ username(self.name).password(self.pas).save(). \ goto_application(self.application_name). \ goto_result = self.main.goto_login(). \ username(self.name).password(self.pas).save(). \ goto_application(). \ goto_registration(self.application_name). \ goto_newstulist(). \ simple_search(self.staffNo). \ goto_details(self.staffNo).\ edit_dress() assert result == False