Skip to content

Commit f026b36

Browse files
ChristianHuehnchristian-huehn-mwclaude
authored
test(visualization): fix flaky mapTreeView E2E test in CI (#4386)
Add explicit waitForSelector before opening context menu to ensure element is fully rendered and interactive. This prevents race conditions in CI environments where folder expansion and Angular change detection take longer than local development. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-authored-by: Christian Hühn <christian.huehn@maibornwolff.de> Co-authored-by: Claude <noreply@anthropic.com>
1 parent b0679c8 commit f026b36

File tree

2 files changed

+34
-0
lines changed

2 files changed

+34
-0
lines changed
Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
---
2+
name: Fix flaky mapTreeView E2E test
3+
issue: N/A
4+
state: complete
5+
version: 1.137.0
6+
---
7+
8+
## Goal
9+
10+
Fix the flaky E2E test "NodeContextMenu path should remain marked when hovering over another mapTreeView Element" that fails in CI due to race condition when waiting for child elements after folder expansion.
11+
12+
## Tasks
13+
14+
### 1. Add explicit wait in openContextMenu method
15+
- Add `waitForSelector` with increased timeout (15s) before clicking element
16+
- Ensures element is fully rendered and interactive before attempting context menu action
17+
- Fixes race condition where child elements aren't ready after folder expansion in CI environments
18+
19+
### 2. Verify fix doesn't break existing tests
20+
- Run all mapTreeView E2E tests locally
21+
- Confirm both test cases still pass
22+
23+
## Steps
24+
25+
- [x] Create plan
26+
- [x] Add explicit wait in openContextMenu method
27+
- [x] Update plan state to complete
28+
29+
## Notes
30+
31+
- Root cause: In CI environments, folder expansion triggers Angular change detection and CSS layout updates that take longer than the current 100ms buffer
32+
- The `clickButtonOnPageElement` helper has a 10s timeout, but the element might not exist yet when that's called
33+
- Adding the wait inside `openContextMenu` fixes it for all callers, not just this specific test

visualization/app/codeCharta/ui/ribbonBar/searchPanel/mapTreeView/mapTreeView.level.po.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ import { clickButtonOnPageElement } from "../../../../../puppeteer.helper"
22

33
export class MapTreeViewLevelPageObject {
44
async openContextMenu(path: string) {
5+
await page.waitForSelector(`[id='${path}']`, { visible: true })
56
await clickButtonOnPageElement(`[id='${path}']`, { button: "right" })
67
await page.waitForSelector("#codemap-context-menu", { visible: true })
78
await page.waitForSelector(".tree-element-label.marked")

0 commit comments

Comments
 (0)