- 优化 将 trace_step 移至 decorators.py,并引入 ContextVar 实现日志层级缩进。 - 新增 完善 StepTracer 和 action_screenshot 的 Docstrings,明确参数含义。 - 移除 清理了 logger.py - 优化 main.py 中重复的目录创建逻辑及旧版冗余注释。 - 规范 修正函数命名,提升代码在 BasePage 方案下的复用性。
40 lines
1017 B
Python
40 lines
1017 B
Python
#!/usr/bin/env python
|
|
# coding=utf-8
|
|
|
|
"""
|
|
@author: CNWei,ChenWei
|
|
@Software: PyCharm
|
|
@contact: t6g888@163.com
|
|
@file: test_settings
|
|
@date: 2026/1/16 15:56
|
|
@desc:
|
|
"""
|
|
import logging
|
|
|
|
import allure
|
|
|
|
from utils.decorators import step_trace
|
|
|
|
logger = logging.getLogger(__name__)
|
|
@allure.epic("中银国际移动端重构项目")
|
|
@allure.feature("登认证模块")
|
|
@step_trace("验证失败",)
|
|
def test_settings_page_display(driver):
|
|
"""
|
|
测试设置页面是否成功加载
|
|
"""
|
|
# 此时 driver 已经通过 fixture 完成了初始化
|
|
current_act = driver.current_activity
|
|
logger.info(f"捕获到当前 Activity: {current_act}")
|
|
|
|
assert ".app.main.launcher.LauncherActivity" in current_act
|
|
|
|
|
|
def test_wifi_entry_exists(driver):
|
|
"""
|
|
简单的元素查找示例
|
|
"""
|
|
# 这里的 driver 就是 appium.webdriver.Remote 实例
|
|
# 假设我们要查找“网络”相关的 ID
|
|
# el = driver.find_element(by='id', value='android:id/title')
|
|
assert driver.session_id is not None |