Skip to content

Conversation

@James-9696
Copy link
Collaborator

@James-9696 James-9696 commented Oct 31, 2025

PR

PR Checklist

Please check if your PR fulfills the following requirements:

  • The commit message follows our Commit Message Guidelines
  • Tests for the changes have been added (for bug fixes / features)
  • Docs have been added / updated (for bug fixes / features)

PR Type

What kind of change does this PR introduce?

  • Bugfix
  • Feature
  • Code style update (formatting, local variables)
  • Refactoring (no functional changes, no api changes)
  • Build related changes
  • CI related changes
  • Documentation content changes
  • Other... Please describe:
    修复e2e测试用例

What is the current behavior?

Issue Number: N/A

What is the new behavior?

Does this PR introduce a breaking change?

  • Yes
  • No

Other information

Summary by CodeRabbit

  • Tests
    • Enhanced test specifications for tree selection dialog functionality with improved interaction selectors and assertion validation.

@coderabbitai
Copy link

coderabbitai bot commented Oct 31, 2025

Walkthrough

Updates to a Playwright test file for nested tree selection in dialog-select component. Test selectors are modified to use role-based locators, and assertions are updated to check for the is-checked class instead of directly inspecting radio input elements.

Changes

Cohort / File(s) Summary
Test selector and assertion updates
examples/sites/demos/pc/app/dialog-select/nest-tree-single.spec.ts
First interaction selector changed from text-based to role-based (getByRole('treeitem')); assertions updated to check is-checked class on the element itself rather than radio input state. Second interaction sequence simplified to target single element '二级 5' with updated assertion logic.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~8 minutes

  • Verify that role-based selectors (getByRole('treeitem', { name: '...' })) correctly identify the intended tree items
  • Confirm that the is-checked class is the appropriate assertion mechanism for this component's checked state
  • Ensure test coverage and intent remain intact after selector migration

Poem

🐰 Through nested trees with selectors new,
Role-based queries guide us true,
Classes checked with careful care,
Our test assertions shine so fair! ✨

Pre-merge checks and finishing touches

❌ Failed checks (1 warning)
Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. You can run @coderabbitai generate docstrings to improve docstring coverage.
✅ Passed checks (2 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title Check ✅ Passed The title "fix(dialog-select): [dialog-select] modify e2e test" is directly and fully related to the changeset, which modifies a dialog-select component's e2e test file by updating selectors and assertions. The title clearly indicates this is about fixing e2e tests for the dialog-select component, which accurately reflects the primary change. While the title contains some redundancy by mentioning "dialog-select" twice (in the conventional scope and again in brackets) and uses the relatively generic term "modify," it remains clear and specific enough for a teammate to understand the main purpose of the PR when scanning history.
✨ Finishing touches
  • 📝 Generate docstrings
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@github-actions github-actions bot added the bug Something isn't working label Oct 31, 2025
@James-9696 James-9696 changed the title fix(dialog-select): modify e2e test fix(dialog-select): [dialog-select] modify e2e test Oct 31, 2025
Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 0

🧹 Nitpick comments (1)
examples/sites/demos/pc/app/dialog-select/nest-tree-single.spec.ts (1)

20-21: Consider using consistent selector strategy.

Line 16 uses a role-based selector (getByRole('treeitem', ...)), while line 20 uses a text-based selector (getByText). For consistency and maintainability, consider using the same selector strategy throughout the test.

Apply this diff to use a consistent role-based selector:

-  current = await page.getByText('二级 5')
+  current = await page.getByRole('treeitem', { name: '二级 5' }).locator('label')
   await expect(current).not.toHaveClass(/is-checked/)
📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between d1d116d and 891c81c.

📒 Files selected for processing (1)
  • examples/sites/demos/pc/app/dialog-select/nest-tree-single.spec.ts (1 hunks)
🔇 Additional comments (1)
examples/sites/demos/pc/app/dialog-select/nest-tree-single.spec.ts (1)

16-18: The code follows established codebase conventions; no changes needed.

The assertion strategy in lines 16-18 aligns with the pattern used across 30+ tests in the codebase (tree-select, tree-menu, transfer, radio, checkbox, and link-menu tests). The toHaveClass(/is-checked/) pattern on label elements is the established convention for verifying selection state in TinyVue components. The component design treats the CSS class as the source of truth for tree selection state, making this approach consistent and appropriate.

While the grid-based dialog test uses a different approach (input.isChecked()), the tree test's method is both functional and aligned with codebase patterns.

@zzcr zzcr merged commit 05d67e5 into opentiny:dev Oct 31, 2025
16 of 21 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants