Skip to content

CODAP-1695: wait for a closing attribute menu before reopening it - #2827

Merged
kswenson merged 1 commit into
mainfrom
CODAP-1695-fix-flaky-table-spec-again
Nov 21, 2026
Merged

kswenson merged 1 commit into
mainfrom
CODAP-1695-fix-flaky-table-spec-again

Conversation

@kswenson

Copy link
Copy Markdown
Member

Summary

Fixes the root cause of the flaky table.spec.ts › "edits, re-randomizes, and deletes formulas" test, which failed again on main after #2825 (and before it, at 074e413a1).

Cause. Chakra's menu applies visibility: hidden when its close animation ends (its exit variant's transitionEnd), even if the menu has been reopened in the meantime. Choosing a menu item, or clicking elsewhere such as the Undo button, closes the menu. A test that reopens it within that ~0.1s animation leaves it open (aria-expanded="true") but invisible, and it stays that way. The failing runs show exactly that state: opacity: 1; visibility: hidden; transform: none.

Fix. openAttributeMenu now waits for that attribute's menu to finish closing before clicking it. Some closed menus never get visibility: hidden and stay visibility: visible at opacity: 0, so either state counts as closed. A first attempt that waited for every attribute menu to be hidden broke 19 tests for that reason. closeAttributeMenu's comment is also corrected: the menu wasn't closing "on its own", the test's own clicks were closing it.

How the earlier fixes made this possible

This is the third PR for this flake, and the first two are what made the cause findable:

  • CODAP-1695: stabilize the table formula test #2794 made closeAttributeMenu close the menu only if it's still open. Investigating it showed, from the Cypress Cloud log, that the menu really was closed after the Undo step, which ruled out several theories and pointed at that part of the test.
  • CODAP-1695: harden flaky table and map Cypress specs #2810 made openAttributeMenu fail as soon as a menu that opened doesn't become visible, instead of at some later step, and logged uncaught exceptions. That moved the failure to the exact reopen, put the menu's style in the error message, and showed that no exception was involved. The Cypress Cloud command log for that failure laid out the close-then-reopen sequence step by step.

With the failure pinned to one call and the stuck style in hand, the mechanism could be read from Chakra's menu animation and then reproduced on demand.

Testing

  • Reproduction: with 4x CPU throttling and retries off, the formula test failed 20 of 20 runs before this change, with the same error as CI.
  • After: the same burn-in passes 20 of 20.
  • Every spec that uses openAttributeMenu passes locally with retries off: table, plugin, formula/formula-component, table-index, attribute-focus-restore. case-card uses its own helper and also passes.
  • lint:build passes.

Notes

  • A real user could hit the same Chakra behavior by reopening a menu within ~0.1s of closing it: the menu would be open but invisible until clicked again. Not addressed here, since it's unlikely to matter in practice.
  • This PR doesn't reopen CODAP-1695; it's referenced for history.

🤖 Generated with Claude Code

Chakra's menu applies `visibility: hidden` when its close animation
ends, even if the menu has been reopened in the meantime. Choosing a
menu item or clicking elsewhere (e.g. Undo) closes the menu, so a test
that reopens it within that ~0.1s animation leaves it open but
invisible, and openAttributeMenu's visibility check times out. That is
the table.spec.ts formula test failure on main, where the menu reads
`opacity: 1; visibility: hidden; transform: none`.

openAttributeMenu now waits for that attribute's menu to finish
closing before clicking it. Some closed menus never get
`visibility: hidden` and stay `visibility: visible` at `opacity: 0`, so
either state counts as closed. With 4x CPU throttling and retries off,
the formula test failed 20 of 20 runs before this change and passes 20
of 20 after; every spec that uses the helper passes.

Also correct closeAttributeMenu's comment, which said the menu closes
"on its own" for unknown reasons.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@kswenson kswenson added the v3 CODAP v3 label Nov 21, 2026
@coderabbitai

coderabbitai Bot commented Nov 21, 2026 •

Copy link
Copy Markdown
Contributor

Explain Change →

Caution

Review failed

The pull request is closed.

  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

Share

@codecov

codecov Bot commented Nov 21, 2026 •

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 76.30%. Comparing base (49e28d3) to head (268bad5).
⚠️ Report is 4 commits behind head on main.

❗ There is a different number of reports uploaded between BASE (49e28d3) and HEAD (268bad5). Click for more details.

HEAD has 14 uploads less than BASE
Flag BASE (49e28d3) HEAD (268bad5)
cypress 15 1
Additional details and impacted files
@@             Coverage Diff             @@
##             main    #2827       +/-   ##
===========================================
- Coverage   89.42%   76.30%   -13.12%     
===========================================
  Files         872      872               
  Lines       50762    50762               
  Branches    12515    12941      +426     
===========================================
- Hits        45394    38736     -6658     
- Misses       5352    11989     +6637     
- Partials       16       37       +21     
Flag Coverage Δ
cypress 37.02% <ø> (-32.83%) ⬇️
jest 68.56% <ø> (ø)

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

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 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.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

🟢 Approval recommended

No active review issues are reported for the test-only attribute-menu synchronization change.

No open issues 🎉

What changed in this PR

This PR addresses the recurring table formula-test flake by synchronizing CODAP v3’s Cypress attribute-menu helper with Chakra’s closing animation. It changes test behavior only, not application behavior.

Changes:

  • Waits for the selected attribute’s menu to finish closing before reopening it, accepting either hidden visibility or zero opacity.
  • Corrects the closeAttributeMenu comment to explain that menu actions and outside clicks can already have closed the menu.
File Description
v3/​cypress/​support/​elements/​table-tile.ts Adds the closing-state wait and clarifies the existing close-helper comment.

Review effort: Balanced

@cypress

cypress Bot commented Nov 21, 2026 •

Copy link
Copy Markdown

codap-v3    Run #13160

Run Properties:  status check passed Passed #13160  •  git commit b7d94e8c5f: Increment the build number
Project codap-v3
Branch Review main
Run status status check passed Passed #13160
Run duration 02m 27s
Commit git commit b7d94e8c5f: Increment the build number
Committer github-actions[bot]
View all properties for this run ↗︎

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

@kswenson
kswenson marked this pull request as ready for review November 21, 2026 02:27
@kswenson
kswenson merged commit f1d38c6 into main Nov 21, 2026
14 of 15 checks passed
@kswenson
kswenson deleted the CODAP-1695-fix-flaky-table-spec-again branch November 21, 2026 02:27

This branch was previously deployed

1 inactive deployment
development — 268bad55 Deployed Nov 21, 2026 by github-actions[bot]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

v3 CODAP v3

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants