feat: 重构测试框架 — 覆盖 6 端 (管理端 + 小程序 + 4 个移动端)
目录结构: tests/web/admin/ 管理端 (Playwright) tests/web/mini_program/ 司机端小程序 (Playwright/微信 WebView) tests/app/driver_android/ 司机安卓 (Appium) tests/app/shipper_android/ 货主安卓 (Appium) tests/app/driver_ios/ 司机苹果 (Appium) tests/app/shipper_ios/ 货主苹果 (Appium) 公共模块: tests/app/_shared.py driver+ensure_logged_in 工厂 tests/app/_base_page.py App Page Object 基类 配置: test_config.yaml 拆分为 6 个独立 section + 货主账号
This commit is contained in:
@@ -0,0 +1,27 @@
|
||||
"""司机苹果端 fixture — Appium + 登录态复用。"""
|
||||
|
||||
import pytest
|
||||
from tests.app._shared import create_driver, make_ensure_logged_in, save_failure_screenshot
|
||||
|
||||
from tests.app._shared import pytest_runtest_makereport # noqa: F401
|
||||
|
||||
|
||||
@pytest.fixture
|
||||
def driver(driver_ios_config, request):
|
||||
"""司机苹果端 driver。"""
|
||||
cfg = driver_ios_config
|
||||
d = None
|
||||
try:
|
||||
d = create_driver(cfg, platform="ios")
|
||||
yield d
|
||||
save_failure_screenshot(d, cfg, "ios", request)
|
||||
finally:
|
||||
if d is not None:
|
||||
d.quit()
|
||||
|
||||
|
||||
@pytest.fixture
|
||||
def ensure_logged_in(driver_ios_config, config):
|
||||
"""确保已登录态(司机角色)。"""
|
||||
fn = make_ensure_logged_in(driver_ios_config, config, account_role="driver")
|
||||
return lambda d: fn(d)
|
||||
@@ -0,0 +1,18 @@
|
||||
"""司机苹果端 — 冒烟测试。"""
|
||||
|
||||
import pytest
|
||||
|
||||
pytestmark = [pytest.mark.driver_ios]
|
||||
|
||||
|
||||
class TestDriverIosSmoke:
|
||||
"""司机苹果端基础验证。"""
|
||||
|
||||
@pytest.mark.p0
|
||||
@pytest.mark.smoke
|
||||
def test_home_page_loaded(self, driver, ensure_logged_in):
|
||||
"""验证登录态有效,首页正常。"""
|
||||
ensure_logged_in(driver)
|
||||
from appium.webdriver.common.appiumby import AppiumBy
|
||||
home = driver.find_element(AppiumBy.ACCESSIBILITY_ID, "tab_home")
|
||||
assert home.is_displayed(), "首页 tab 应可见"
|
||||
Reference in New Issue
Block a user