self.publish_page.find_publish_btn().click() # 定义业务层 class PublishProxy: def __init__(self): self.publish_handle = PublishHandle() # 发布文章 def publish_article(self, title, content, channel): # 输入文章标题 self.publish_handle.input_title(title) self.publish_handle.input_content(content) self.publish_handle.choice_cover() self.publish_handle.choice_channel(channel) self.publish_handle.click_publish_btn() if __name__ == '__main__': loginProxy = LoginProxy() loginProxy.login("13911111111", '246810') time.sleep(3) homeProxy = HomeProxy() print('hello:', homeProxy.get_username_msg()) homeProxy.go_publish_page() publishProxy = PublishProxy() publishProxy.publish_article("titleAAA", 'contentAAA', "ios") time.sleep(3) UtilsDriver.quit_mp_driver()
def __init__(self): self.publish_page = PublishPage() self.driver = UtilsDriver.get_mp_driver()
def __init__(self): self.driver = UtilsDriver.get_mp_driver()
def __init__(self): self.driver = UtilsDriver.get_app_driver() # 获取app驱动
def test_publish_article(self): # 跳转到发布文章页面 self.home_proxy.go_publish_page() self.publish_proxy.publish_article("测试标题AAA", "测试内容AAA", "ios") assert is_exist(UtilsDriver.get_mp_driver(), '新增文章成功')
def test_login(self, username, code, expect): self.login_proxy.login(username, code) user = self.home_proxy.get_username_msg() time.sleep(1) allure.attach(UtilsDriver.get_mp_driver().get_screenshot_as_png(), "登录截图", allure.attachment_type.PNG) assert user in expect
def teardown_class(self): UtilsDriver.quit_mp_driver()