Skip to content

Conversation

@jennifer-shehane
Copy link
Member

@jennifer-shehane jennifer-shehane commented Dec 18, 2025

Additional details

The test does not retry after 1 alias times out was flaky, failing with:

  • TypeError: Cannot read properties of undefined (reading 'routeId')
  • done() called multiple times

cy.retry was resolving with undefined instead of rejecting in two cases:

  1. When timeout exceeded but options.error was not set.
    • This was what is happening in our flaky test that sets _runnableTimeout to force timeout scenarios. In normal user scenarios, options.error is always set before calling cy.retry() so this is a test-specific edge case.
  2. When ended() returned true (promise canceled or runnable changed):
    • When Cypress.stop() is called, a test is manually stopped, or the command queue is canceled
    • When a test ends and a new test starts, when a test is skipped, or during test retries
    • Due to a known Bluebird bug, cancellations don't propagate fast enough through promise chains, causing retry code to execute between runnables. This is more likely with fast-running tests or when tests are stopped/skipped.

To fix:

  • Always throw error when timeout exceeded, even if error is not set (defensive fix for test scenarios and edge cases)
  • Reject promise when ended() returns true, instead of returning undefined (fixes real-world issue affecting users who stop tests)

Note

Ensure cy.retry always rejects on timeout or when ended (canceled/runnable changed), preventing Promise.map from treating failures as successes; adds tests and stabilizes a flaky e2e test; updates changelog.

  • Driver (retries):
    • Update packages/driver/src/cy/retries.ts to always throw when timeout is exceeded (even without error) and reject when ended() is true (canceled/runnable changed), including checks before/after cy:command:retry.
  • Tests:
    • Add comprehensive unit tests in packages/driver/test/unit/cy/retries.spec.ts covering timeout/ended rejection and Promise.map behavior.
    • Stabilize e2e spec packages/driver/cypress/e2e/commands/waiting.cy.js by guarding done() and using Promise.onPossiblyUnhandledRejection with a single-invocation wrapper in the "does not retry after 1 alias times out" test.
  • Changelog:
    • Document bugfix in cli/CHANGELOG.md under 15.8.2 for cy.wait() crash with multiple aliases when retries are canceled or run between runnables.

Written by Cursor Bugbot for commit cd65f42. This will update automatically on new commits. Configure here.

Steps to test

How has the user experience changed?

PR Tasks

@jennifer-shehane jennifer-shehane self-assigned this Dec 18, 2025
@cypress
Copy link

cypress bot commented Dec 18, 2025

cypress    Run #68129

Run Properties:  status check failed Failed #68129  •  git commit cd65f42f37: Merge branch 'fix-promise-map-retry-failures' of https://github.com/cypress-io/c...
Project cypress
Branch Review fix-promise-map-retry-failures
Run status status check failed Failed #68129
Run duration 14m 26s
Commit git commit cd65f42f37: Merge branch 'fix-promise-map-retry-failures' of https://github.com/cypress-io/c...
Committer Jennifer Shehane
View all properties for this run ↗︎

Test results
Tests that failed  Failures 9
Tests that were flaky  Flaky 1
Tests that did not run due to a developer annotating a test with .skip  Pending 821
Tests that did not run due to a failure in a mocha hook  Skipped 4
Tests that passed  Passing 6982
View all changes introduced in this branch ↗︎

Warning

Partial Report: The results for the Application Quality reports may be incomplete.

UI Coverage  38.41%
  Untested elements 173  
  Tested elements 111  
Accessibility  98.79%
  Failed rules  1 critical   6 serious   1 moderate   1 minor
  Failed elements 59  

Tests for review

Failed  commands/querying/querying.cy.ts • 2 failed tests • 5x-driver-electron

View Output

Test Artifacts
src/cy/commands/querying > #get > cancels existing promises Test Replay
src/cy/commands/querying > #contains > cancels existing promises Test Replay
Failed  e2e/origin/cookie_login.cy.ts • 0 failed tests • 5x-driver-electron

View Output

Test Artifacts
Failed  memory/memory.cy.js • 0 failed tests • 5x-driver-electron

View Output

Test Artifacts
Failed  commands/actions/click.cy.ts • 0 failed tests • 5x-driver-electron

View Output

Test Artifacts
Failed  commands/actions/type_special_chars.cy.ts • 0 failed tests • 5x-driver-electron

View Output

Test Artifacts

The first 5 failed specs are shown, see all 1117 specs in Cypress Cloud.

Flakiness  cypress/e2e/commands/net_stubbing.cy.ts • 1 flaky test • 5x-driver-firefox

View Output

Test Artifacts
... > stops waiting when an xhr request is canceled
    </td>
  </tr></table>

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.

2 participants