feat: 新增JoyHub UI自动化测试目录
1. 新增 Joyhub_ui_auto_test/ 目录: - tests/ - 测试用例目录 - pages/ - 页面元素定位 - config/ - 配置文件 - utils/ - 工具类 - test_data/ - 测试数据 - reports/ - 测试报告 - webapp-testing/ - WebApp测试相关 2. 配置文件: - pytest.ini - pytest配置 - requirements.txt - 依赖列表 - README.md - 项目说明
This commit is contained in:
0
Joyhub_ui_auto_test/pages/__init__.py
Normal file
0
Joyhub_ui_auto_test/pages/__init__.py
Normal file
14
Joyhub_ui_auto_test/pages/base_page.py
Normal file
14
Joyhub_ui_auto_test/pages/base_page.py
Normal file
@@ -0,0 +1,14 @@
|
||||
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)))
|
||||
14
Joyhub_ui_auto_test/pages/home_page.py
Normal file
14
Joyhub_ui_auto_test/pages/home_page.py
Normal file
@@ -0,0 +1,14 @@
|
||||
from playwright.sync_api import Page, expect
|
||||
from pages.base_page import BasePage
|
||||
|
||||
|
||||
class HomePage(BasePage):
|
||||
def __init__(self, page: Page):
|
||||
super().__init__(page)
|
||||
self.body = page.locator("body")
|
||||
|
||||
def open(self):
|
||||
self.goto("/")
|
||||
|
||||
def should_be_loaded(self):
|
||||
expect(self.body).to_be_visible()
|
||||
Reference in New Issue
Block a user