_AD
(霍格沃兹_AD)
1
实战目标
课堂ppt
PPT地址
源码地址(思维导图在源码内)
内容
PO核心思想
- The public methods represent the services that the page offers
- Try not to expose the internals of the page
- Generally don’t make assertions
- Methods return other PageObjects
- Need not represent an entire page
- Different results for the same action are modelled as different methods
课件作业
注意事项
# 选择文件::类::方法执行, 并指定报告生成的路径
pytest test_add_member.py::TestAddMember::test_add_member_by_index --alluredir=./report
#main.py
from PageObjectPro.WeinxinWorkPro.page_object.add_member_page import AddMemberPage
from PageObjectPro.WeinxinWorkPro.page_object.contact_page import ContactPage
class MainPage:
def goto_add_member(self):
pass
return AddMemberPage()
def goto_contact_page(self):
pass
return ContactPage()
#contact_page.py
from PageObjectPro.WeinxinWorkPro.page_object.add_member_page import AddMemberPage
class ContactPage:
def goto_add_member(self):
pass
return AddMemberPage()
def get_member(self):
pass
return ContactPage()
# add_member_page.py
from PageObjectPro.WeinxinWorkPro.page_object.contact_page import ContactPage
class AddMemberPage:
def add_member_success(self):
pass
return ContactPage()
# test_add_member.py
from PageObjectPro.WeinxinWorkPro.page_object.main_page import MainPage
class TestAddMember:
def setup_class(self):
self.home = MainPage()
def teardown_class(self):
pass
# 从首页添加成员
def test_main_addmember(self):
self.home.goto_add_member().add_member_success().get_member()
# 从通讯录页添加成员
def test_contact_addmember(self):
self.home.goto_contact_page().goto_add_member().add_member_success().get_member()
1 个赞