test(dashboard): add regression guards for duplicate widget renders#2840
Open
Honey-pg wants to merge 1 commit into
Open
test(dashboard): add regression guards for duplicate widget renders#2840Honey-pg wants to merge 1 commit into
Honey-pg wants to merge 1 commit into
Conversation
The duplicate inline widgets bug was fixed in aba0430; these tests prevent reintroduction via a static page.tsx guard and E2E DOM/API assertions. Co-authored-by: Cursor <cursoragent@cursor.com>
GSSoC Label Checklist 🏷️@Priyanshu-byte-coder — please apply the appropriate labels before merging: Difficulty (pick one):
Quality (optional):
Validation (required to score):
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
The duplicate inline widgets bug was fixed in aba0430; these tests prevent reintroduction via a static page.tsx guard and E2E DOM/API assertions.
Summary
Adds regression tests to ensure dashboard analytics widgets are not rendered twice in
page.tsx. The duplicate inline widgets bug was already fixed inaba0430; this PR adds a static guard onpage.tsxand E2E DOM/API assertions so the issue cannot be reintroduced.Closes #2535
Type of Change
What Changed
test/dashboard-page-no-duplicate-widgets.test.ts— assertssrc/app/dashboard/page.tsxdelegates toCustomizableDashboardand does not directly import or renderRepoAnalyticsExplorer,PRMetrics,PRBreakdownChart, orPRReviewTrendCharte2e/dashboard.spec.ts— verifies each analytics widget region/heading renders once and metrics API calls stay within expected boundse2e/helpers/dashboard-mocks.js— added/api/metrics/pr-review-timestub (used byPRReviewTrendChart, notpr-review-trend)e2e/dashboard-widgets.spec.js— replaced.first()with.toHaveCount(1)for PR Analytics headingHow to Test
npm test test/dashboard-page-no-duplicate-widgets.test.tsnpm run test:e2e -- e2e/dashboard.spec.ts -g "duplicate"/dashboardin the browser, open DevTools → Network, filter/api/metrics/, and scroll through the Analytics sectionExpected result: All tests pass. Each analytics widget appears once in the DOM, and metrics endpoints are not called excessively (duplicate inline widgets would produce extra regions and API calls).
Checklist
console.log, debug code, or commented-out blocksnpm run lintpasses locallynpm run type-check)Additional Context
No production code changes. The original bug was fixed in
aba0430, which removed inline dashboard widgets frompage.tsxin favor ofCustomizableDashboard.The E2E API assertions use min/max bounds rather than exactly-one call per endpoint because:
/api/metrics/pr-review-timeis legitimately called by bothMiniPRTrendChart(inside PR Metrics) and the PR Review Trend widget