Files
AppAutoTest/test_cases/test_wan_android_home.py
CNWei 6ad6b7ff84 fix(conftest,config_loader): 修复 get_caps 的 Capabilities 加载逻辑
- 新增 pytest_addoption 增加 "--caps_name" 获取配置文件中的设备/平台名称
- 修复 get_caps 的 Capabilities 加载逻辑
- 优化 其他优化 enums.py
- 删除 移除部分文档,代码,第三方包(loguru)
2026-02-28 16:08:14 +08:00

59 lines
1.7 KiB
Python
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

#!/usr/bin/env python
# coding=utf-8
"""
@author: CNWei,ChenWei
@Software: PyCharm
@contact: t6g888@163.com
@file: test_wan_android_home
@date: 2026/1/30 17:42
@desc:
"""
import logging
import os
import allure
from page_objects.wan_android_home import HomePage
from page_objects.wan_android_project import ProjectPage
# 配置日志
logger = logging.getLogger(__name__)
@allure.epic("测试用例示例")
@allure.feature("登录模块")
class TestWanAndroidHome:
@allure.story("常规登录场景")
@allure.title("使用合法账号登录成功")
@allure.severity(allure.severity_level.BLOCKER)
@allure.description("""
验证用户在正常网络环境下:
1. 处理初始化弹窗和广告
2. 输入正确账号密码后成功登录
""")
@allure.link("https://docs.example.com/login_spec", name="登录业务说明文档")
@allure.issue("BUG-1001", "已知偶发我是一个bug")
def test_api_demos_success(self, driver):
"""
测试场景:使用正确的用户名和密码登录成功
"""
home = HomePage(driver)
# 执行业务逻辑
home.click_open()
home.login(os.getenv("USER_NAME"), os.getenv("PASS_WORD"))
# 断言部分使用 allure.step 包装,使其在报告中也是一个可读的步骤
with allure.step("断言"):
assert os.getenv("USER_NAME") == 'admintest123456'
# 页面跳转
with allure.step("验证页面跳转"):
project = home.go_to(ProjectPage)
project.switch_to_project()
project.assert_text(*project.pro_table_title, expected_text='完整项目')
project.delay(5)