Skip to content

[Bugfix:Developer] Fix flaky late submission Cypress test#12561

Merged
IDzyre merged 6 commits intomainfrom
fix/late-submission-flaky-tests
Mar 11, 2026
Merged

[Bugfix:Developer] Fix flaky late submission Cypress test#12561
IDzyre merged 6 commits intomainfrom
fix/late-submission-flaky-tests

Conversation

@prestoncarman
Copy link
Contributor

Why is this Change Important & Necessary?

The late_submission_warning_messages.spec.js Cypress test was failing intermittently in CI. Two root causes:

  1. Popup visibility race: giveExtensions() for team gradeables asserted #more_extension_popup existed but not that it was visible, allowing clicks inside a hidden modal.

  2. UTC / server-timezone calendar-day mismatch: Due dates were generated using getCurrentTime('threeDaysAgo') from the CI runner's local clock (UTC). The Submitty server runs in America/New_York, so when CI runs between midnight–5 AM UTC the CI calendar day is one ahead of the server's. This shifts the computed "days late" count by 1, causing expected dialog message strings to not match (e.g., "3 day(s) late" when "4 day(s) late" was expected).

What is the New Behavior?

  • Added getDueDateString(N) helper that computes N calendar days ago in America/New_York at noon, producing a stable date regardless of when (UTC time) CI runs.
  • Added getMorningDateString(N) helper (6 AM in server timezone) for late-day grant timestamps to guarantee they always precede the noon due date.
  • Refactored SubmitAndCheckMessage() to accept explicit daysLate and extensionDays numeric parameters so expected confirmation messages are assembled dynamically rather than from hardcoded strings.
  • Added .should('be.visible') to the team extension popup assertion before clicking inside it.

What steps should a reviewer take to reproduce or test the bug or new feature?

Run late_submission_warning_messages.spec.js in CI at different times of day (particularly near midnight UTC) and confirm all 4 previously intermittent failures no longer appear.

Automated Testing & Documentation

This PR fixes the automated test itself. No additional tests needed; no documentation changes required.

Other information

Not a breaking change. No migrations. No security concerns.

🤖 This change was written by Claude Code

Two root causes addressed:

1. Popup visibility race: `giveExtensions()` was asserting the team
   extension popup existed but not that it was visible before clicking
   inside it. Added `.should('be.visible')` to block until the popup
   is fully shown.

2. UTC/server-timezone calendar day boundary mismatch: due dates were
   generated with `getCurrentTime('threeDaysAgo')` using the CI
   runner's local clock (UTC). The Submitty server runs in
   America/New_York, so when CI runs in the early UTC hours the CI
   calendar date is ahead of the server's, shifting the computed
   "days late" count by 1 and causing the expected message strings to
   not match.

   Fix: replace `getCurrentTime('threeDaysAgo/twoDaysAgo')` for due
   dates with a new `getDueDateString(N)` helper that computes N days
   ago in the server's timezone and fixes the time at noon, avoiding
   the midnight boundary. Late-day grant timestamps use a new
   `getMorningDateString(N)` (6 AM) to guarantee they precede the noon
   due date. Expected day counts in `SubmitAndCheckMessage` are now
   derived from the `daysLate` parameter rather than hardcoded strings.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@codecov
Copy link

codecov bot commented Mar 10, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 21.66%. Comparing base (268d0b4) to head (221f6b3).
⚠️ Report is 3 commits behind head on main.

Additional details and impacted files

Impacted file tree graph

@@            Coverage Diff            @@
##               main   #12561   +/-   ##
=========================================
  Coverage     21.66%   21.66%           
  Complexity     9638     9638           
=========================================
  Files           268      268           
  Lines         36233    36233           
  Branches        486      486           
=========================================
  Hits           7849     7849           
  Misses        27902    27902           
  Partials        482      482           
Flag Coverage Δ
autograder 21.39% <ø> (ø)
js 2.04% <ø> (ø)
migrator 100.00% <ø> (ø)
php 20.68% <ø> (ø)
python_submitty_utils 80.08% <ø> (ø)
submitty_daemon_jobs 91.13% <ø> (ø)

Flags with carried forward coverage won't be shown. Click here to find out more.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@prestoncarman prestoncarman changed the title [Bugfix:Test] Fix flaky late submission Cypress test [Bugfix:Developer] Fix flaky late submission Cypress test Mar 10, 2026
@IDzyre IDzyre changed the title [Bugfix:Developer] Fix flaky late submission Cypress test [Bugfix:Testing] Fix flaky late submission Cypress test Mar 10, 2026
@IDzyre IDzyre changed the title [Bugfix:Testing] Fix flaky late submission Cypress test [Bugfix:Developer] Fix flaky late submission Cypress test Mar 10, 2026
Copy link
Member

@IDzyre IDzyre left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Went over the code in person, and tests now pass.

@github-project-automation github-project-automation bot moved this from Seeking Reviewer to Awaiting Maintainer Review in Submitty Development Mar 11, 2026
@IDzyre IDzyre merged commit ae76ef5 into main Mar 11, 2026
69 of 71 checks passed
@IDzyre IDzyre deleted the fix/late-submission-flaky-tests branch March 11, 2026 02:36
@github-project-automation github-project-automation bot moved this from Awaiting Maintainer Review to Done in Submitty Development Mar 11, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Archived in project

Development

Successfully merging this pull request may close these issues.

2 participants