Skip to content

test: add AT-SPI test cases and suites - #291

Merged
deepin-bot[bot] merged 1 commit into
linuxdeepin:masterfrom
re2zero:at-auto
Jul 16, 2026
Merged

test: add AT-SPI test cases and suites#291
deepin-bot[bot] merged 1 commit into
linuxdeepin:masterfrom
re2zero:at-auto

Conversation

@re2zero

@re2zero re2zero commented Jul 16, 2026

Copy link
Copy Markdown
Contributor

Add AT-SPI tree dump, case mapping files, and YAML test suites for various UI modules.

Log: add AT-SPI test cases and suites.

Add AT-SPI tree dump, case mapping files, and YAML test suites for various UI modules.

Log: add AT-SPI test cases and suites.

@sourcery-ai sourcery-ai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sorry @re2zero, your pull request is larger than the review limit of 150000 diff characters

@github-actions

Copy link
Copy Markdown
  • 敏感词检查失败, 检测到2个文件存在敏感词
详情
{
    "tests/at/cases_raw.yaml": [
        {
            "line": "    description: 3. 切换系统语言为正体中文(台湾),打开文档后查看各界面翻译是否正常",
            "line_number": 5534,
            "rule": "C02",
            "reason": "政治敏感词 | 58c3fd6695"
        },
        {
            "line": "    description: 2. 切换系统语言为繁体中文(香港),打开文档后查看各界面翻译是否正常",
            "line_number": 5531,
            "rule": "C03",
            "reason": "政治敏感词 | 90d2c17f13"
        }
    ],
    "tests/at/cases_mapped.yaml": [
        {
            "line": "    key: BackSpace",
            "line_number": 170,
            "rule": "S106",
            "reason": "Var naming | 4a2f65f2aa"
        },
        {
            "line": "    key: Escape",
            "line_number": 174,
            "rule": "S106",
            "reason": "Var naming | 0b57e3460a"
        },
        {
            "line": "    key: Return",
            "line_number": 271,
            "rule": "S106",
            "reason": "Var naming | 8be1c69b93"
        },
        {
            "line": "    key: Return",
            "line_number": 324,
            "rule": "S106",
            "reason": "Var naming | 8be1c69b93"
        },
        {
            "line": "    key: Escape",
            "line_number": 507,
            "rule": "S106",
            "reason": "Var naming | 0b57e3460a"
        },
        {
            "line": "    key: Escape",
            "line_number": 511,
            "rule": "S106",
            "reason": "Var naming | 0b57e3460a"
        },
        {
            "line": "    key: Escape",
            "line_number": 520,
            "rule": "S106",
            "reason": "Var naming | 0b57e3460a"
        },
        {
            "line": "    key: Escape",
            "line_number": 546,
            "rule": "S106",
            "reason": "Var naming | 0b57e3460a"
        },
        {
            "line": "    key: Escape",
            "line_number": 555,
            "rule": "S106",
            "reason": "Var naming | 0b57e3460a"
        },
        {
            "line": "    key: Escape",
            "line_number": 592,
            "rule": "S106",
            "reason": "Var naming | 0b57e3460a"
        },
        {
            "line": "    key: Escape",
            "line_number": 708,
            "rule": "S106",
            "reason": "Var naming | 0b57e3460a"
        },
        {
            "line": "    key: Escape",
            "line_number": 726,
            "rule": "S106",
            "reason": "Var naming | 0b57e3460a"
        },
        {
            "line": "    key: Escape",
            "line_number": 772,
            "rule": "S106",
            "reason": "Var naming | 0b57e3460a"
        },
        {
            "line": "    key: Escape",
            "line_number": 790,
            "rule": "S106",
            "reason": "Var naming | 0b57e3460a"
        }
    ]
}

@deepin-ci-robot

Copy link
Copy Markdown

deepin pr auto review

★ 总体评分:85分

■ 【总体评价】

代码实现了完整的自动化测试用例数据结构,但存在测试动作逻辑误用及大量控件缺少无障碍标识的问题
逻辑瑕疵及缺少 accessible_id 导致测试脆弱性扣15分

■ 【详细分析】

  • 1.语法逻辑(存在错误)✕

suite_context_menu_scale 等测试套件中,使用 mouse_click 动作配合 items 属性来模拟右键菜单选择(如 "双页显示"),这与 cases_mapped.yaml 中定义的 dtk_context_menu 动作不一致,会导致测试执行逻辑错误。
潜在问题:动作类型与参数不匹配导致用例无法正确执行;cases_raw.yaml 中存在大量未规范化的原始描述文本。
建议:统一使用 dtk_context_menu 进右键菜单操作;清理 cases_raw.yaml 中的非 GUI 测试用例。

  • 2.代码质量(一般)✕

测试基础设施文件结构清晰,但 element_gaps.yaml 明确指出 25 个交互元素缺少 accessible_id,这将导致自动化测试无法通过 accessible_id 精准定位元素,只能依赖 namerole,增加了测试的脆弱性。同时 cases_raw.yaml 包含大量重复的描述性文本。
潜在问题:缺少无障碍标识导致测试不稳定;数据冗余增加维护成本。
建议:在源码中为所有缺失的控件补充 setAccessibleName();精简 cases_raw.yaml,仅保留必要步骤。

  • 3.代码性能(无性能问题)✓

本次 diff 为纯 YAML 数据文件,不涉及运行时算法或循环。虽然 cases_raw.yaml 达到 7646 行,但对于静态配置文件而言,解析开销在可接受范围内。
建议:无需特殊优化。

  • 4.代码安全(存在0个安全漏洞)✓

漏洞对比统计:新增漏洞 0 个,减少漏洞 0 个,持平 0 个
本次 diff 为纯测试数据,不包含可执行代码,无注入、溢出等安全风险。

  • 建议:无需修复。

■ 【改进建议代码示例】

# 修复 suite_context_menu_scale.suite.yaml 中的动作类型误用
# 原代码错误使用 mouse_click + items
# 修复为使用 dtk_context_menu

name: 右键缩放区域菜单_suite
app: deepin-reader
module: 右键缩放区域菜单
setup:
- action: session_start
  command: deepin-reader ${TEST_FILES_DIR}/normal.pdf
  wait: 3.0
suites:
- id: suite_context_menu_scale_s1
  name: 启动 deepin-reader 并打开文档
  steps:
  - action: mouse_click
    selector:
      name: pageEdit
      role: panel
  # 修复点:将 mouse_click 改为 dtk_context_menu
  - action: dtk_context_menu
    selector:
      name: DLineEditChildLineEdit
      role: text
    items:
    - 双页显示
  - action: dtk_context_menu
    selector:
      name: DLineEditChildLineEdit
      role: text
    items:
    - 默认大小
  assert_steps:
  - action: assert_element
    ref: n6
    selector:
      name: Button_SelectFile
      role: button
teardown:
- action: session_stop

# 针对源码中缺少 accessible_name 的修复建议(以 C++/Qt 为例):
# 在对应控件的初始化代码中添加 setAccessibleName
# 例如对于 Button_SelectFile:
# button->setObjectName("Button_SelectFile");
# button->setAccessibleName("Button_SelectFile");

@deepin-ci-robot

Copy link
Copy Markdown

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by: lzwind, re2zero

The full list of commands accepted by this bot can be found here.

Details Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@re2zero

re2zero commented Jul 16, 2026

Copy link
Copy Markdown
Contributor Author

/merge

@deepin-bot
deepin-bot Bot merged commit d8a5091 into linuxdeepin:master Jul 16, 2026
12 checks passed
@re2zero
re2zero deleted the at-auto branch July 16, 2026 08:47
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants