-
Notifications
You must be signed in to change notification settings - Fork 330
fix(dialog-select): [dialog-select] modify e2e test #3793
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
WalkthroughUpdates 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 Changes
Estimated code review effort🎯 2 (Simple) | ⏱️ ~8 minutes
Poem
Pre-merge checks and finishing touches❌ Failed checks (1 warning)
✅ Passed checks (2 passed)
✨ Finishing touches
🧪 Generate unit tests (beta)
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. Comment |
There was a problem hiding this 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
📒 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.
PR
PR Checklist
Please check if your PR fulfills the following requirements:
PR Type
What kind of change does this PR introduce?
修复e2e测试用例
What is the current behavior?
Issue Number: N/A
What is the new behavior?
Does this PR introduce a breaking change?
Other information
Summary by CodeRabbit