feat: 重构测试框架并优化代码结构
refactor(tests): 将e2e_tests迁移到tests_suite和api_integration_tests style: 为Java类添加文档注释 docs: 更新.gitignore和配置文件 test: 添加性能测试和Playwright测试脚本 chore: 清理旧测试文件和配置
This commit is contained in:
@@ -0,0 +1,26 @@
|
||||
import pytest
|
||||
from typing import Generator
|
||||
from playwright.sync_api import Page, Browser, BrowserContext
|
||||
from config import settings
|
||||
|
||||
|
||||
@pytest.fixture(scope="function")
|
||||
def page(browser: Browser) -> Generator[Page, None, None]:
|
||||
context = browser.new_context(
|
||||
viewport={"width": 1280, "height": 720},
|
||||
locale="zh-CN"
|
||||
)
|
||||
page = context.new_page()
|
||||
page.set_default_timeout(30000)
|
||||
yield page
|
||||
context.close()
|
||||
|
||||
|
||||
@pytest.fixture(scope="function")
|
||||
def authenticated_page(page: Page, web_base_url: str) -> Page:
|
||||
page.goto(f"{web_base_url}/login")
|
||||
page.fill("input[name='username']", settings.TEST_USERNAME)
|
||||
page.fill("input[name='password']", settings.TEST_PASSWORD)
|
||||
page.click("button[type='submit']")
|
||||
page.wait_for_url(f"{web_base_url}/**")
|
||||
return page
|
||||
Reference in New Issue
Block a user