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 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 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 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().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 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()
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 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