Skip to content

fix(e2e): derive burndown current-month assertion from the clock#88

Merged
san360 merged 1 commit into
microsoft:mainfrom
JuliusGruber:fix/burndown-current-month-dynamic
Jun 3, 2026
Merged

fix(e2e): derive burndown current-month assertion from the clock#88
san360 merged 1 commit into
microsoft:mainfrom
JuliusGruber:fix/burndown-current-month-dynamic

Conversation

@JuliusGruber
Copy link
Copy Markdown
Contributor

Description

The Burndown › shows current month e2e test hard-coded expect(content).toContain('May 2026'). The burndown page, however, derives its month label from the live system clock:

  • src/webview/page-burndown.ts defaults selectedMonth from new Date(), and
  • renders it via formatMonthLabelnew Date(year, month - 1).toLocaleString('default', { month: 'long', year: 'numeric' }).

So the assertion only passed during May 2026 and fails on every later month — the page correctly renders "June 2026", "July 2026", … while the test still expects "May 2026". It is a time-bomb assertion that silently rots on each month rollover.

This derives the expected label the same way the component does, so the test tracks the current month instead of a hard-coded string:

const expectedMonth = new Date().toLocaleString('default', { month: 'long', year: 'numeric' });
expect(content).toContain(expectedMonth);

Test-only change — no production code touched.

Related Issues

None.

Checklist

  • npm run check passes — deferred to CI for this test-only change (eslint/cspell are scoped to src/, not tests/).
  • Changes are covered by tests — this is the test; the tests/e2e/burndown.spec.ts burndown spec runs green (5/5) in an environment where the e2e harness bootstraps.
  • Documentation updated — n/a (test-only).

The "shows current month" test hard-coded `toContain('May 2026')`, but the
burndown page computes its month label from the live system clock: page-burndown.ts
defaults selectedMonth from `new Date()` and renders it via formatMonthLabel's
`toLocaleString('default', { month: 'long', year: 'numeric' })`.

The assertion therefore only passed during May 2026 and fails on every later
month (the page correctly renders "June 2026", etc.). Derive the expected label
the same way the component does so the test tracks the clock instead of going
stale on each month rollover. Test-only change.
@san360
Copy link
Copy Markdown
Contributor

san360 commented Jun 3, 2026

@JuliusGruber Thanks for the PR, Could you please accept contributor's agreement as descrbed in https://github.com/microsoft/ContributorLicenseAgreement#accepting

@JuliusGruber
Copy link
Copy Markdown
Contributor Author

@microsoft-github-policy-service agree

@san360 san360 merged commit 89c7688 into microsoft:main Jun 3, 2026
5 checks passed
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.

3 participants