class TestAddMember: def setup(self): # 启动app self.app = App() self.main = self.app.start().main() def teardown(self): # 关掉app self.app.stop() @pytest.mark.parametrize( ("name", "phone", "email", "gender"), yaml.safe_load(open("./test_contact.yml", encoding="utf-8"))) def test_add_member(self, name, phone, email, gender): # 测试添加成员 self.invite_page = self.main.\ to_address_list().\ to_add_member().add_manually().add_name(name).\ add_email(email).add_phone(phone).set_gender(gender).click_save() assert "成功" in self.invite_page.get_toast() @pytest.mark.parametrize("name", yaml.safe_load( open("./del_contact.yml", encoding="utf-8"))) def test_del_member(self, name): # 测试删除成员 self.edit_page = self.main.to_address_list().to_manage_contacts( ).to_edit_member(name).del_member() assert self.edit_page.get_member_name(name)
class TestWX: def setup_class(self): self.app = App() def setup(self): self.main = self.app.start().goto_main() def test_addcontact(self): name = "hogwarts_00004" gender = "男" phonenum = "13812121215" result = self.main.goto_contactlist(). \ add_member().add_member_manul(). \ edit_contact(name, gender, phonenum).verify_toast() assert '添加成功' == result def test_addcontact1(self): name = "hogwarts_00003" gender = "男" phonenum = "13812121214" result = self.main.goto_contactlist(). \ add_member().add_member_manul(). \ edit_contact(name, gender, phonenum).verify_toast() assert '添加成功' == result def teardown_class(self): self.app.stop()
class TestAddContact: def setup_class(self): self.app = App() self.app.start() self.main = self.app.goto_main() def test_add_member(self): self.main.goto_address().goto_addmember().add_member_menual( ).add_contact()
class Testdaka(): def setup(self): self.app = App() self.main = self.app.start().goto_main() def teardown(self): self.app.stop() def test_daka(self): value = self.main.goto_gongzuotai().outside_daka() assert_that(True,equal_to(value)) # if __name__=='__main__': # pytest.main()
class TestDeleteMember: # class的driver共用 def setup_class(self): self.app = App() self.contact = DataUtils().load_data("../data/contact.yaml")["contact"] def setup(self): self.main = self.app.start().goto_main() @pytest.mark.skip def test_delete_member(self): member_name = self.contact["name"] search_page: SearchPage = self.main.goto_contact_page().goto_search_page() members = search_page.search(member_name) origin_length = len(members) assert_that(origin_length, is_not(0), "search member is exist") if origin_length != 0: search_page.goto_personal_detail_page(members[0]).goto_personal_edit_page().delete_member() assert_that(len(search_page.search(member_name)), is_(origin_length - 1), "delete success") def test_add_member(self): # print(DataUtils().load_data("../data/contact.yaml")) result = self.main.goto_contact_page().add_contact_manually().edit_member(self.contact["name"], self.contact["gender"], self.contact["phonenum"]).verify_toast() assert '添加成功' == result
class TestContact: def setup_class(self): self.app = App() def teardown_class(self): self.app.stop() def setup(self): self.main = self.app.start().goto_main() def teardown(self): self.app.back(5) @pytest.mark.parametrize('name,gender,phonenum', addcontactdatas) def test_addcontact(self, name, gender, phonenum): ''' 添加联系人 ''' # name = "霍格name2" # gender = "女" # phonenum = "13700000002" mypage = self.main.goto_contactlist(). \ add_contact().add_menual(). \ set_name(name).set_gender(gender).set_phonnum(phonenum).click_save() text = mypage.get_toast() # mypage.add_menual() assert '成功' in text self.app.back()
class TestWX: def setup_class(self): self.app = App() def setup(self): self.main = self.app.start().goto_main() def test_add_contact(self): name = "Wu3" gender = '男' phonenum = '18672909814' result = self.main.goto_contactlist().add_member().add_member_manul( ).edit_contact(name, gender, phonenum).verify_toast() assert result == '添加成功' def teardown(self): self.app.stop()
class TestContact: def setup(self): self.app = App() self.main = self.app.start().main() def test_addcontact(self): invitpage = self.main.goto_addresslist().add_member(). \ addmember_by_manul().input_name().set_gender() \ .input_phonenum().click_save()
class TestContact: def setup(self): self.app = App() self.main = self.app.start().goto_main() def teardown(self): self.app.stop() def test_addcontact(self): name = "hogwarts__004" gender = "男" phonenum = "13500000003" result = self.main.goto_address() \ .click_addmember(). \ add_member_menual(). \ add_contact(name, gender, phonenum).get_toast() assert '添加成功' == result
class TestDeleteMember: def setup(self): self.app = App() self.main = self.app.start().goto_mainpage() def test_delete_member(self): username = "******" self.main.goto_address1().get_member( username).member_info().member_details().edit_member() result = self.app.driver.page_source assert username not in result
class Test_contact: def setup(self): self.app = App() self.main = self.app.start().goto_main() def test_addcontact(self): name = "hogwarts__002" gender = "男" phonenum = "13500000001" result = self.main.goto_address().click_addmember().add_member_manual() assert result
class TestContact: def setup(self): self.app = App() self.main = self.app.start().goto_main() def teardown(self): self.app.stop() def test_addcontact(self): """ 添加联系人 """ name = "aaaa014" gender = "男" phonenum = "13512340024" result = self.main.goto_address() \ .click_addmember() \ .add_member_menual() \ .add_contact(name, gender, phonenum).get_toast() assert '添加成功' == result def test_deletecontact(self): """ 删除联系人 :return: """ contactname = 'aaaa011' self.main.goto_address() \ .click_contact(contactname). \ click_menu(). \ click_edit_member() \ .delete_member(). \ click_ok() assert contactname not in self.main.goto_address().driver.page_source
class TestContact: def setup(self): # 实例化app self.app = App() self.main = self.app.start().goto_main() def teardown(self): self.app.stop() def test_add_contact(self): # name = "hogwarts_003" # gender = "男" # phonenum = "13500000003" result = self.main.goto_address() \ .click_addmember() \ .add_member_menual() \ .add_contact().get_toast() assert '添加成功' == result def test_delete_contact(self): name = 'hogwarts_004' result = self.main.goto_address().select_member(name).click_more( ).click_editmember().click_delete().search_member() assert '网络查找手机/邮箱:' in result
class TestContactPO: def setup(self): self.app = App() self.main = self.app.start().main() @pytest.mark.parametrize( 'username, gender, phonenum', [ ('霍格沃兹学员7', '男', '13812345607'), # ('霍格沃兹学员3', '女', '13812345601'), # ('霍格沃兹学员4', '男', '13812345602'), ]) def test_addcontact(self, username, gender, phonenum): contactaddpage = self.main.goto_address().add_member().click_menualadd() \ .set_name(username).set_gender(gender).set_phonenum(phonenum).click_save() contactaddpage.get_toast()
class TestContact: def setup(self): self.app=App() self.main=self.app.start().goto_main() def test_addcontact(self): name = 'name12' gender = '女' phoneNum = '13800011668' result=self.main.goto_address().click_addmember().add_member_menual().add_contact(name,gender,phoneNum).get_toast() assert '添加成功'==result def test_delete_member(self): name = '5677' delete = self.main.goto_address().goto_personal_info(name).goto_personal_info_setting().goto_edit_member().delete_member() assert True != delete.find_member(name)
class TestContact: def setup(self): self.app = App() self.main = self.app.start().goto_man() def test_appcontact(self): name = "Hogwarts_001" gender = "男" phonenum = "16325578903" result = self.main.goto_address().click_addmember().add_member_menual( ).add_contact(name, gender, phonenum).get_toast() assert '添加成功' == result def test_delcontact(self): name = "Hogwarts_001" result = self.main.goto_address().click_editicon().choose_name( name).click_delete_button().click_confirm_button( ).cannot_find_name(name) assert True == result
class TestContact(): def setup_class(self): self.app = App() def teardown_class(self): self.app.stop() def setup(self): self.main = self.app.start().goto_main() def teardown(self): self.app.back(5) # 返回5次,尽量回到首页,目的是为了用例间不受干扰 @pytest.mark.parametrize('name,gender,phonenum', data_add) def test_addcontact(self, name, gender, phonenum): """ 添加联系人 :return: """ # name="冰墩墩1" # gender='女' # phonenum='13910000000' """ 业务流程 --清晰明确 1. App(),调用方法atart() --启动app,goto_main() --进入主页 2. 主页有2个方法,选择通讯录,选择添加联系人,选择手动添加,进入添加页 3. 调用添加字段的方法 """ mypage_add = self.main.goto_contactListPage().add_contact().add_menual().\ set_name(name).set_gender(gender).set_phonenum(phonenum).click_save() text = mypage_add.get_toast() # mypage.add_munual() assert '成功' in text self.app.back() @pytest.mark.parametrize('name', data_del) def test_deletecontact(self, name): mypage_dele = self.main.goto_contactListPage().search_contact().\ send_contact(name).click_contact(name).delinfo().editinfo().delelement().delconfirm()
class TestContact: def setup_class(self): self.app = App() def setup(self): self.main = self.app.start().goto_main() def teardown_class(self): self.app.stop() def teardown(self): self.app.back(5) @pytest.mark.parametrize('name,gender,phone', data) def test_addcontact(self, name, gender, phone): # name = '自动化11' # gender = '男' # phone = '15812345676' mypage = self.main.goto_contactlist().addcontact().add_menual( ).set_name(name).set_gender(gender).set_phone(phone).click_save() text = mypage.get_toast() assert '成功' in text self.app.back()
def setup(self): self.app = App() self.main = self.app.start().goto_man()
def test_wework(self): self.app = App() invitepage = self.app.start().main().goto_memberlist().goto_add_member().goto_manual_addmember().input_name().input_gender().input_phonenumber().save() assert "成功" in invitepage.get_toast()
def setup(self): # 启动app self.app = App() self.main = self.app.start().main()
def setup_class(self): self.app = App()
def test_add_member_success(self): App().start().goto_contact().goto_add_member().add_member()
def setup_class(self): self.app = App() self.app.start() self.main = self.app.goto_main()
def setup(self): # 实例化app self.app = App() self.main = self.app.start().goto_main()
def setup_class(self): self.app = App() self.contact = DataUtils().load_data("../data/contact.yaml")["contact"]