Skip to content

test(at): fix AT-SPI yaml suites, 14/14 smoke pass - #314

Merged
deepin-bot[bot] merged 1 commit into
linuxdeepin:masterfrom
re2zero:at-fix
Aug 4, 2026
Merged

test(at): fix AT-SPI yaml suites, 14/14 smoke pass#314
deepin-bot[bot] merged 1 commit into
linuxdeepin:masterfrom
re2zero:at-fix

Conversation

@re2zero

@re2zero re2zero commented Aug 4, 2026

Copy link
Copy Markdown
Contributor
  • fix assert element role predicates (framework: dogtail roleName)
  • fix context menu navigation via AT-SPI focus events fallback
  • scale menu: use arrow button popup (popup: click) with real item nav
  • dedup theme menu suite (keep items-style v2)
  • tab suite: locate page tab by role without hidden parent
  • add accessible names for BrowserMenu and find search edit

Smoke: 14 passed, 0 failed. Validate: Gate 1-5 PASS.

Summary by Sourcery

Update AT-SPI accessibility test suites and element mappings to align with current UI semantics, improving reliability of menu, tab, sidebar, scale, and context menu automation.

New Features:

  • Expose accessible names for the browser main menu and search widget to support AT-SPI-based navigation and assertions.
  • Add a dedicated thumbnail toggle element in the title bar and AT tree for expanding/collapsing the sidebar via accessibility tests.

Bug Fixes:

  • Correct element role and selector mappings in AT test YAML to match actual widget roles, fixing previously broken assertions and navigation.
  • Fix context menu and main menu navigation flows in AT suites to ensure focus, page navigation, and menu actions are exercised through reliable selectors and events.

Enhancements:

  • Simplify and modernize AT test case descriptions and selectors, including menu, tab bar, scale controls, and side-panel interactions.
  • Streamline theme menu coverage by removing the legacy suite and keeping the items-based theme menu suite as the single source of truth.

Tests:

  • Revise multiple AT YAML suites (sidebar buttons, thumbnails, catalog, bookmarks, tab management, search, scale, theme menu, document/context menus, note and bookmark menus) to improve robustness and coverage of UI behaviors under accessibility automation.

@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, you have reached your weekly rate limit of 500000 diff characters.

Please try again later or upgrade to continue using Sourcery

@sourcery-ai

sourcery-ai Bot commented Aug 4, 2026

Copy link
Copy Markdown

Reviewer's Guide

This PR updates AT-SPI YAML suites and element metadata so accessibility automation matches the actual widget roles, names, and focus behavior, while adding accessible names in the C++ UI code for the search box and browser menu, and simplifying/modernizing several menu navigation suites.

File-Level Changes

Change Details Files
Align assert/selectors with real AT-SPI roles and names to fix dogtail role-based predicates.
  • Remove hard-coded role predicates from multiple assert_element/mouse_click steps where the role was either incorrect or unnecessary for matching.
  • Normalize element role definitions in elements.yaml, including changing tab-related elements to use consistent page tab roles and updating or removing outdated role entries.
  • Clean up comments and metadata in cases_mapped.yaml and suite-cases.yaml to reflect current action lists and non-GUI case reasons without quotes.
tests/at/cases_mapped.yaml
tests/at/suite-cases.yaml
tests/at/yaml/elements.yaml
Improve sidebar/tab/search/scale suites to reflect actual navigation flows and side-panel toggle behavior.
  • Introduce Button_ThumbnailToggle (n224) and add steps to click it before using sidebar buttons in multiple suites.
  • Adjust tab management suites to target the actual page tab element (normal.pdf) instead of the add button, and simplify scroll assertions to assert presence of the tab instead of scroll buttons.
  • Revise titlebar search suite to open the search box via the main menu, then use parent-based selectors (Form_findSearchEdit_P) for the search line edit and clear button.
  • Update scale input suites to drop redundant role predicates and rely on the scale edit element reference, with streamlined assert steps.
tests/at/cases_mapped.yaml
tests/at/suite-cases.yaml
tests/at/at-tree.yaml
tests/at/yaml/elements.yaml
Rework context and main menu suites to use robust selectors and to assert app responsiveness after menu interactions.
  • Replace pageEdit panel selectors with Form_CentralDocPage for document-area context menu actions across doc, note, bookmark, and scale suites.
  • Change scale context menu interactions from right-clicking the text field to using the arrow-button popup (Form_scaleEdit_P with popup: click) and selecting specific scale options.
  • Restructure main menu navigation to focus on tool selection and search open/close, and add assert_visible/assert_element steps that verify the central document page remains responsive after menu operations.
  • Add or update summary asserts in multiple suites (context menu doc/scale/note/bookmark) to assert_visible on Form_CentralDocPage rather than Button_SelectFile.
tests/at/cases_mapped.yaml
tests/at/suite-cases.yaml
Deduplicate and modernize theme menu testing, keeping only the items-based v2 suite.
  • Remove the older suite_theme_menu definitions from both mapped and suite-cases YAMLs that relied on hovering over the toolbar theme menu.
  • Retain and lightly tidy suite_theme_menu_v2, which uses dtk_main_menu items for theme selection and asserts the main "open file" button remains visible.
  • Ensure elements.yaml and at-tree.yaml still include the theme menu popup and menu-item roles for 浅色, 深色, 跟随系统.
tests/at/cases_mapped.yaml
tests/at/suite-cases.yaml
tests/at/yaml/elements.yaml
tests/at/at-tree.yaml
Add accessible names and configuration in C++ widgets to make AT-SPI automation selectors stable.
  • In FindWidget::initWidget, set accessible names on the search edit container (Form_findSearchEdit_P) and its lineEdit (DLineEditChildLineEdit), and enable the clear button via setClearButtonEnabled(true).
  • In BrowserMenu constructor, set an accessible name Menu_Browser so AT tooling can target the browser menu reliably.
  • In TitleWidget constructor, set accessible name Button_ThumbnailToggle on the thumbnail toggle icon button to match new YAML selectors.
reader/widgets/FindWidget.cpp
reader/browser/BrowserMenu.cpp
reader/uiframe/TitleWidget.cpp

Tips and commands

Interacting with Sourcery

  • Trigger a new review: Comment @sourcery-ai review on the pull request.
  • Continue discussions: Reply directly to Sourcery's review comments.
  • Generate a GitHub issue from a review comment: Ask Sourcery to create an
    issue from a review comment by replying to it. You can also reply to a
    review comment with @sourcery-ai issue to create an issue from it.
  • Generate a pull request title: Write @sourcery-ai anywhere in the pull
    request title to generate a title at any time. You can also comment
    @sourcery-ai title on the pull request to (re-)generate the title at any time.
  • Generate a pull request summary: Write @sourcery-ai summary anywhere in
    the pull request body to generate a PR summary at any time exactly where you
    want it. You can also comment @sourcery-ai summary on the pull request to
    (re-)generate the summary at any time.
  • Generate reviewer's guide: Comment @sourcery-ai guide on the pull
    request to (re-)generate the reviewer's guide at any time.
  • Resolve all Sourcery comments: Comment @sourcery-ai resolve on the
    pull request to resolve all Sourcery comments. Useful if you've already
    addressed all the comments and don't want to see them anymore.
  • Dismiss all Sourcery reviews: Comment @sourcery-ai dismiss on the pull
    request to dismiss all existing Sourcery reviews. Especially useful if you
    want to start fresh with a new review - don't forget to comment
    @sourcery-ai review to trigger a new review!

Customizing Your Experience

Access your dashboard to:

  • Enable or disable review features such as the Sourcery-generated pull request
    summary, the reviewer's guide, and others.
  • Change the review language.
  • Add, remove or edit custom review instructions.
  • Adjust other review settings.

Getting Help

- fix assert element role predicates (framework: dogtail roleName)
- fix context menu navigation via AT-SPI focus events fallback
- scale menu: use arrow button popup (popup: click) with real item nav
- dedup theme menu suite (keep items-style v2)
- tab suite: locate page tab by role without hidden parent
- add accessible names for BrowserMenu and find search edit

Log: fix AT-SPI yaml suites, 14/14 smoke pass
PMS: 无
@deepin-ci-robot

Copy link
Copy Markdown

deepin pr auto review

★ 总体评分:100分

■ 【总体评价】

代码实现了无障碍测试适配缺陷修复,逻辑严谨且质量优秀
语法逻辑完全正确,代码质量优秀,性能无损耗且无安全漏洞,符合满分标准

■ 【详细分析】

  • 1.语法逻辑(完全正确)✓

C++代码部分在BrowserMenu::BrowserMenu、TitleWidget::TitleWidget、FindWidget::initWidget中准确调用了setAccessibleName,位置均在对象实例化及objectName设置之后,符合Qt对象生命周期与属性设置逻辑。YAML测试用例部分移除了冗余的role字段,修正了错误的元素选择器(如将pageEdit修正为Form_CentralDocPage),补充了缺失的侧边栏展开前置交互步骤,逻辑连贯且无语法错误。
建议:保持当前的属性设置顺序,确保accessibleName在UI控件完整初始化后赋值

  • 2.代码质量(优秀)✓

无障碍命名规范严格遵循“控件类型_功能描述”的模式(如Menu_Browser、Button_ThumbnailToggle、Form_findSearchEdit_P),语义清晰。测试用例进行了大规模的冗余清理,删除了过时的suite_theme_menu用例及无效的action列表注释,统一了交互描述,大幅提升了YAML配置的可维护性和可读性。
建议:后续新增AT节点时,继续保持at-tree.yaml与elements.yaml中节点定义的同步更新

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

本次修改仅在控件构造或初始化阶段增加了少量的QString赋值操作,属于O(1)常量级开销,对应用启动和运行时性能无任何可感知影响。YAML配置的精简反而减少了测试框架解析时的内存占用。
建议:无需优化

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

漏洞对比统计:新增漏洞 0 个,减少漏洞 0 个,持平 0 个
本次变更仅涉及UI控件属性字符串绑定和测试配置文件调整,不包含任何网络请求、文件读写、命令执行或用户输入解析逻辑,不存在命令注入、路径遍历等攻击面。
建议:维持当前安全的纯UI层修改模式

■ 【改进建议代码示例】

// FindWidget.cpp — 增加防御性编程检查,确保内部控件获取安全
void FindWidget::initWidget()
{
    qCDebug(appLog) << "Initializing find widget controls";
    m_pSearchEdit = new DSearchEdit(this);
    m_pSearchEdit->setObjectName("findSearchEdit_P");
    m_pSearchEdit->setAccessibleName("Form_findSearchEdit_P");
    
    // 防御性检查:确保 lineEdit() 返回有效指针后再设置属性
    if (QLineEdit *pLineEd = m_pSearchEdit->lineEdit()) {
        pLineEd->setObjectName("findSearchEdit");
        pLineEd->setAccessibleName("DLineEditChildLineEdit");
        pLineEd->setFocusPolicy(Qt::StrongFocus);
    } else {
        qCWarning(appLog) << "FindWidget::initWidget() - DSearchEdit::lineEdit() returned nullptr";
    }
    
    connect(m_pSearchEdit, &DSearchEdit::returnPressed, this, &FindWidget::onSearchStart);
    connect(m_pSearchEdit, &DSearchEdit::textChanged, this, &FindWidget::onTextChanged);
}

@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 Aug 4, 2026

Copy link
Copy Markdown
Contributor Author

/merge

@deepin-bot
deepin-bot Bot merged commit d92d544 into linuxdeepin:master Aug 4, 2026
12 checks passed
@re2zero
re2zero deleted the at-fix branch August 4, 2026 01:30
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