Repository navigation
Stabilize kebab handling in UI tests - #52434
Conversation
Closes keycloak#52433 Signed-off-by: Alexander Schwartz <alexander.schwartz@ibm.com>
There was a problem hiding this comment.
🟡 Changes recommended
The final menu-item click remains outside the retry block, leaving the reported race partially unresolved.
Once you've addressed the issues Copilot identified, you can request another Copilot review.
Pull request overview
Hardens row-level kebab actions against transient menu-rendering failures.
Changes:
- Retries opening the kebab menu and checking item visibility.
- Adds a 10-second retry timeout.
File summaries
| File | Description |
|---|---|
js/apps/admin-ui/test/utils/table.ts |
Adds retry handling to row kebab interactions. |
Review details
- Files reviewed: 1/1 changed files
- Comments generated: 1
- Review effort level: Balanced
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
Signed-off-by: Alexander Schwartz <alexander.schwartz@ibm.com>
There was a problem hiding this comment.
🟡 Changes recommended
The retry block can repeat a successfully dispatched, side-effecting menu action.
Once you've addressed the issues Copilot identified, you can request another Copilot review.
Review details
- Files reviewed: 1/1 changed files
- Comments generated: 1
- Review effort level: Balanced
|
@edewit - that's beyond my understanding of React, and possibly also difficult to backport to earlier branches. What about merging this one first and backporting it to stabilize the tests, and then you proceed with your larger refactoring? |
Closes #52433
Summary
Hardens
clickRowKebabItemintable.tsto retry the kebab toggle click when the dropdown menu fails to appear, matching the stabilization pattern used for other table helpers in PR #50995.What changed
clickRowKebabItemnow uses Playwright'sexpect().toPass()to retry the toggle-click + visibility-assertion sequence with a 10-second timeout. Once the menu item is confirmed visible, it clicks it.Design decisions
expect().toPass()over manual try-catch loop: A try-catch retry loop is functionally an if-statement — it branches on transient state, which is the same anti-pattern Playwright's assertion-based API is designed to avoid.toPass()is the idiomatic Playwright retry primitive.No
aria-expandedguard before clicking: Checking toggle state then conditionally clicking is a TOCTOU race (state can change between check and click). Instead, the retry naturally handles toggle ambiguity — if one attempt closes an already-open menu, the next attempt re-opens it.No
Escapeto dismiss menus between retries: Pressing Escape is a blunt instrument that could interfere with other page elements (modals, notifications). The retry loop resolves the toggle state without side effects.All row-level kebab actions covered:
clickRowKebabItemis the shared helper for all row kebab interactions across the test suite. The toolbar-level kebab (clickTableToolbarItem) was already hardened in PR try and make tests more stable #50995.