Fix dashboard CSV parsing failures and add Cypress console-error coverage#2470
Conversation
Agent-Logs-Url: https://github.com/Hack23/riksdagsmonitor/sessions/8cf738c0-6695-4365-ac3f-1f25c9ee1d4b Co-authored-by: pethers <1726836+pethers@users.noreply.github.com>
Agent-Logs-Url: https://github.com/Hack23/riksdagsmonitor/sessions/8cf738c0-6695-4365-ac3f-1f25c9ee1d4b Co-authored-by: pethers <1726836+pethers@users.noreply.github.com>
Agent-Logs-Url: https://github.com/Hack23/riksdagsmonitor/sessions/8cf738c0-6695-4365-ac3f-1f25c9ee1d4b Co-authored-by: pethers <1726836+pethers@users.noreply.github.com>
Agent-Logs-Url: https://github.com/Hack23/riksdagsmonitor/sessions/8cf738c0-6695-4365-ac3f-1f25c9ee1d4b Co-authored-by: pethers <1726836+pethers@users.noreply.github.com>
🏷️ Automatic Labeling SummaryThis PR has been automatically labeled based on the files changed and PR metadata. Applied Labels: javascript,testing,size-m Label Categories
For more information, see |
🔍 Lighthouse Performance Audit
📥 Download full Lighthouse report Budget Compliance: Performance budgets enforced via |
🔍 Lighthouse Performance Audit
📥 Download full Lighthouse report Budget Compliance: Performance budgets enforced via |
There was a problem hiding this comment.
Pull request overview
This PR addresses dashboard CSV parsing/runtime regressions and strengthens Cypress dashboard checks so console-level initialization errors are surfaced during dashboard test runs.
Changes:
- Renamed fragile local Papa Parse bindings in risk and committee dashboard CSV parsing paths.
- Added dashboard
console.errorcapture/assertion helpers to Cypress support commands. - Updated dashboard Cypress suites to use
visitDashboard()and assert captured console errors.
Reviewed changes
Copilot reviewed 5 out of 5 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
src/browser/dashboards/risk-dashboard.ts |
Renames the local Papa parser binding used during CSV parsing. |
src/browser/dashboards/committees-dashboard.ts |
Renames the committee dashboard Papa parser binding and related load checks. |
cypress/support/commands.js |
Extends visitDashboard() to capture console.error and adds assertNoConsoleErrors(). |
cypress/e2e/dashboards-per-chart/_helpers.js |
Adds per-test console-error assertions to per-chart dashboard suites. |
cypress/e2e/all-dashboards.cy.js |
Uses visitDashboard() for dashboard pages and adds console-error assertions. |
| Cypress.Commands.add('assertNoConsoleErrors', () => { | ||
| cy.window().then((win) => { | ||
| const messages = (win.__rdmConsoleErrors || []).map((args) => | ||
| args.map(formatDashboardConsoleErrorArgument).join(' '), | ||
| ); | ||
| expect(messages, 'dashboard console.error messages').to.deep.equal([]); | ||
| }); |
| function formatDashboardConsoleErrorArgument(arg) { | ||
| if (arg instanceof Error) { | ||
| return `${arg.name}: ${arg.message}`; | ||
| } | ||
| if (typeof arg === 'string') { | ||
| return arg; | ||
| } | ||
| try { | ||
| return JSON.stringify(arg); |
|
@copilot apply changes based on the comments in this thread |
🔍 Lighthouse Performance Audit
📥 Download full Lighthouse report Budget Compliance: Performance budgets enforced via |
…sertions Agent-Logs-Url: https://github.com/Hack23/riksdagsmonitor/sessions/5a15ed7d-64cf-4c63-82db-16d68c658df0 Co-authored-by: pethers <1726836+pethers@users.noreply.github.com>
🔍 Lighthouse Performance Audit
📥 Download full Lighthouse report Budget Compliance: Performance budgets enforced via |
cypress/support/commands.jsfor cross-realm Error formatting and async console error assertion timing