1. 新增 Joyhub_ui_auto_test/ 目录: - tests/ - 测试用例目录 - pages/ - 页面元素定位 - config/ - 配置文件 - utils/ - 工具类 - test_data/ - 测试数据 - reports/ - 测试报告 - webapp-testing/ - WebApp测试相关 2. 配置文件: - pytest.ini - pytest配置 - requirements.txt - 依赖列表 - README.md - 项目说明
15 lines
319 B
Python
15 lines
319 B
Python
import re
|
|
|
|
from playwright.sync_api import Page, expect
|
|
|
|
|
|
class BasePage:
|
|
def __init__(self, page: Page):
|
|
self.page = page
|
|
|
|
def goto(self, path: str = ""):
|
|
self.page.goto(path)
|
|
|
|
def assert_title_contains(self, text: str):
|
|
expect(self.page).to_have_title(re.compile(re.escape(text)))
|