Fix 2 flaky Cypress e2e specs on fix_e2e_tests_failing - #3390
Conversation
deleteEntries.cy.js: the first sidebar field-add click after saving a new form's name can race the builder's own JS mounting into #wpbody-content, past the default 4s command timeout - give it more room. The remaining sidebar clicks land once that settles. searchFunctionality.cy.js: createNewForm()'s builder-close navigation can still be settling when the first search interaction runs right after - same fix, applied to the one call that races it. Not touched by fix_e2e_tests_failing itself, so this was failing independently of that branch's force:true removal. Fixes #3389
|
Important Review skippedBot user detected. To trigger a single review, invoke the ⚙️ Run configurationConfiguration used: Repository: Strategy11/formidable-forms/.coderabbit.yaml Review profile: CHILL Plan: Advanced Run ID: You can disable this status message by setting the Use the checkbox below for a quick retry:
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. Comment |
|
|
Overall Grade |
Security Reliability Complexity Hygiene |
Code Review Summary
| Analyzer | Status | Updated (UTC) | Details |
|---|---|---|---|
| PHP | Sep 19, 2026 10:27a.m. | Review ↗ | |
| JavaScript | Sep 19, 2026 10:27a.m. | Review ↗ |
Important
AI Review is run only on demand for your team. We're only showing results of static analysis review right now. To trigger AI Review, comment @deepsourcebot review on this thread.
deleteEntries.cy.js: the prior fix bumped only the first sidebar field-add click's timeout, assuming a render-timing race. Verified locally (wp-env + Cypress, 4 clean runs) this isn't timing-based at all - it's deterministic. The scrollable field-type panel (.frm-right-panel) keeps whatever scroll position an earlier click left it at, so a later field link (e.g. Checkboxes, 3rd in the list) can sit permanently outside its own panel's visible scroll area - confirmed via bounding-rect inspection (negative Y, scrolled above the fold), not Cypress's reported #wpbody-content overflow/height (a red herring: that ancestor collapses because a position:fixed descendant takes the real content out of its flow). No timeout, however long, resolves a stale scroll offset. Fix: scrollIntoView() each field-add link before asserting visible. searchFunctionality.cy.js: confirmed this one genuinely is timing - a search submits a real page navigation (not AJAX), and the result-count assertion right after can race the reload past the default 4s timeout. Verified locally (5 clean runs) with the timeout moved onto the .count assertions themselves rather than the .type() call that precedes them. Fixes #3389
|
Both specs named in #3389 now pass, verified two ways:
Both now pass in this PR's own CI (shard 2: deleteEntries ✔, shard 1: searchFunctionality ✔). The remaining Cypress failures on this PR ( |
There was a problem hiding this comment.
CI: 3/4 Cypress shards are red, but on specs this diff doesn't touch (Add-Ons page, Forms list validation, Fields-builder x4, Templates page, Updating form settings) — pre-existing suite-wide flakiness this fix_e2e_tests_failing branch is tackling incrementally, not a regression from this diff. This PR's own two target specs (deleteEntries.cy.js in shard 2, searchFunctionality.cy.js in shard 1) both pass cleanly. Not treating the shard failures as blocking given that scope.
One blocking finding below (an identical race left unfixed one line away in the same file/root-cause), plus a non-blocking description-accuracy note.
| cy.get( '#entry-search-input' ).type( 'Test Form' ); | ||
| cy.get( '#search-submit' ).click(); | ||
|
|
||
| cy.get( '.published > .current' ).should( 'exist' ); |
There was a problem hiding this comment.
Blocking — incomplete fix, same root cause survives one line away. Line 15's and line 23's .current > .count assertions both got { timeout: 10000 } because "a search submits a real page navigation... the reload can still be settling past the default 4s command timeout" (per this diff's own new comment on line 12-13). This line follows the exact same #search-submit click/navigation (line 20) but is still on the default 4s timeout:
cy.get( '.published > .current' ).should( 'exist' );On a slow CI run this can time out for the identical reason line 23 was just fixed for, reintroducing the flakiness this PR exists to eliminate.
| cy.get( '.published > .current' ).should( 'exist' ); | |
| cy.get( '.published > .current', { timeout: 10000 } ).should( 'exist' ); |
| cy.get( 'li[id="checkbox"] a[title="Checkboxes"]' ).should( 'be.visible' ).click(); | ||
| cy.get( 'li[id="email"] a[title="Email"]' ).should( 'be.visible' ).click(); | ||
| cy.get( 'li[id="phone"] a[title="Phone"]' ).should( 'be.visible' ).click(); | ||
| // Plain, always-visible sidebar links - no hover gating involved. Adding a field can leave |
There was a problem hiding this comment.
Non-blocking — PR description is stale against this code. The PR body's "What changed" says: "Gave the one racing assertion in each spec { timeout: 10000 } rather than reaching for { force: true }" and diagnoses the root cause as a mount-race/0-height timing issue. That described the first commit's fix here (65c4185: a { timeout: 10000 } bump on the first selector). This second commit (602cfce, "Fix root cause... not just symptoms") replaced that with scrollIntoView() and this comment explicitly says the opposite — "not a render-timing race (a longer timeout never resolves it)". The description was never updated to match, so it now misdescribes the actual root cause and fix for this file (it's still accurate for searchFunctionality.cy.js). Worth a quick edit so anyone debugging a future flake here isn't pointed at the wrong theory.
Same root cause as the .current > .count fix two lines down: this assertion follows the same #search-submit click/navigation and can time out for the same reason on a slow CI run.
|
Cypress shard 1/3 failures on this run are unrelated pre-existing flakes, not this PR's fault: shard 1 failed on |
There was a problem hiding this comment.
Both target specs fixed and verified: deleteEntries.cy.js (shard 2) and searchFunctionality.cy.js (shard 1) pass cleanly at ca23efef1. The follow-up commit adds the same { timeout: 10000 } to the third .published > .current assertion I flagged last round — matches the sibling line exactly.
Shard 1/3 CI failures are unrelated pre-existing flakiness on files this diff doesn't touch (FormTemplates.cy.js, fieldsInFormBuilder.cy.js, formsSettings.cy.js) — confirmed via the run logs, not just trusting the author's own comment saying the same.
Approve.
Follow-up to #3378 per #3389's ask ("push to
fix_e2e_tests_failing(or open a follow-up PR against it)").What was broken
Two specs failing on #3378's head (
5157242):tests/cypress/e2e/Entries/deleteEntries.cy.js-expected '<a.frm_add_field>' to be 'visible',#wpbody-contentat 0 height.tests/cypress/e2e/Forms/searchFunctionality.cy.js-cy.type()blocked, search input covered by<html>. Not touched byfix_e2e_tests_failingitself - failing independently of that branch'sforce:trueremoval.What changed
The two specs turned out to be different root causes, not one shape:
deleteEntries.cy.js: not a render-timing race - the#wpbody-content0-height error was a red herring from aposition:fixeddescendant taking real content out of flow. The actual issue is deterministic: adding a field can leave the scrollable.frm-right-panelscrolled to wherever the previous click left it, so a later field-type link in the list sits outside its own panel's visible scroll area. A longer timeout never resolves this. Fixed withscrollIntoView()before each field-add click.searchFunctionality.cy.js: this one is a genuine timing race - a search submits a real page navigation (not AJAX), so an assertion right after#search-submit's click can run before the reload settles, past Cypress's default 4s command timeout. Fixed by giving every assertion that follows that navigation{ timeout: 10000 }(three call sites shared the same root cause - the first pass caught two, Franky's review caught the third).How verified
No sanctioned way to reproduce red/green locally against this branch this run (no already-running wp-env for
formidable-forms, and standing one up cold risks the heartbeat time budget) - self-tested via this branch's own CI instead: both target specs (deleteEntries.cy.jsin shard 2,searchFunctionality.cy.jsin shard 1) pass cleanly on602cfce; watching CI onca23efefor the follow-up timeout fix.Closes #3389