Skip to content

fix: fix stress tests#40

Merged
raven-wing merged 1 commit into
Problematy:mainfrom
raven-wing:fix_stress_test
Feb 12, 2026
Merged

fix: fix stress tests#40
raven-wing merged 1 commit into
Problematy:mainfrom
raven-wing:fix_stress_test

Conversation

@raven-wing

@raven-wing raven-wing commented Feb 12, 2026

Copy link
Copy Markdown
Contributor

Summary by CodeRabbit

  • Tests
    • Enhanced stress test reliability and efficiency through improved marker detection logic and optimized stabilization detection. Streamlined marker interaction flow for more consistent test execution.

@coderabbitai

coderabbitai Bot commented Feb 12, 2026

Copy link
Copy Markdown
📝 Walkthrough

Walkthrough

The stress test flow is reworked with adjusted stabilization parameters: maximum attempts increased to 300, consecutive stable readings reduced to 2, and sleep interval decreased to 0.2 seconds. Marker interaction logic is simplified by replacing iterative cluster expansion with a visibility-based JavaScript approach that directly locates and clicks visible clusters within the viewport.

Changes

Cohort / File(s) Summary
Stress Test Flow Optimization
tests/stress/test_stress.py
Restructured stabilization logic with new parameters (max_attempts: 300, stable_readings: 2, sleep: 0.2s). Replaced iterative cluster-click expansion with visibility-based JavaScript helper to locate clickable elements within viewport bounds. Updated marker interaction flow to work with new visibility approach, including popup interaction adjustments and error messages.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

Poem

🐰 Clicks grow swifter, waits grow wise,
JavaScript helpers see with fresh eyes,
Visible markers in viewport's gleam,
Stress tests flow smoother than a dream!

🚥 Pre-merge checks | ✅ 2 | ❌ 1
❌ Failed checks (1 inconclusive)
Check name Status Explanation Resolution
Title check ❓ Inconclusive The title 'fix: fix stress tests' is vague and repetitive, using the generic term 'fix' without clarifying the specific issue being addressed or the nature of the changes made. Replace with a more specific title that describes the actual change, such as 'refactor stress test flow with improved marker interaction logic' or 'optimize stress test stabilization parameters and marker detection'.
✅ Passed checks (2 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Docstring Coverage ✅ Passed Docstring coverage is 100.00% which is sufficient. The required threshold is 80.00%.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing touches
  • 📝 Generate docstrings
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment

No actionable comments were generated in the recent review. 🎉

🧹 Recent nitpick comments
tests/stress/test_stress.py (3)

53-74: Stability confirmation window reduced from 1.5s to 0.4s — worth noting the trade-off.

The total timeout stays at ~60s (300 × 0.2s120 × 0.5s), but the stability window dropped from 1.5s (3 readings × 0.5s) to just 0.4s (2 readings × 0.2s). If markers load in bursts with >0.4s gaps between batches, the count could be declared stable prematurely, leading to flaky undercounts.

If the previous 3-reading requirement was causing false timeouts, consider keeping stable_count >= 3 but with the shorter 0.2s sleep (giving a 0.6s confirmation window) — a middle ground between responsiveness and confidence.


103-112: Magic numbers for UI chrome offsets — consider extracting named constants.

220 (left panel width) and 60 (navbar height) are layout-dependent values. If the UI changes, these will silently fail to exclude the chrome areas. Extracting them as constants (e.g., LEFT_PANEL_WIDTH, NAVBAR_HEIGHT) at module or class level would improve readability and make future maintenance easier.


116-118: .as_element() called twice — store the result to avoid redundancy.

cluster.as_element() is evaluated on line 117 for the assertion and then called again on line 118 for the click. Same pattern repeats on lines 129-130. Store the handle once:

Proposed fix
             cluster = page.evaluate_handle(find_visible_js, ".marker-cluster")
-            assert cluster.as_element(), "No visible cluster found"
-            cluster.as_element().click()
+            cluster_el = cluster.as_element()
+            assert cluster_el, "No visible cluster found"
+            cluster_el.click()

And similarly for lines 125-130:

             marker = page.evaluate_handle(
                 find_visible_js,
                 ".leaflet-marker-icon:not(.marker-cluster)",
             )
-            assert marker.as_element(), "No visible individual marker found"
-            marker.as_element().click()
+            marker_el = marker.as_element()
+            assert marker_el, "No visible individual marker found"
+            marker_el.click()

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

Copy link
Copy Markdown

🧪 E2E Test Results

📊 View full workflow run
🔗 Commit: e36b8ae

📊 E2E Stress Test Performance

Status: PASSED (11888.43ms max < 25000ms limit)

Metric Value
Average Time 10491.08ms
Minimum Time 9700.25ms
Maximum Time 11888.43ms
Completed Runs 5/5
Avg Markers Loaded 77
📈 Individual Run Times
Run Time (ms) Markers
Run 1 9700.25ms 77
Run 2 10128.09ms 77
Run 3 10026.04ms 77
Run 4 10712.58ms 77
Run 5 11888.43ms 77

@raven-wing raven-wing merged commit c25676c into Problematy:main Feb 12, 2026
2 checks passed
@raven-wing raven-wing deleted the fix_stress_test branch February 12, 2026 04:10
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.

1 participant