Skip to content

Fix 2 flaky Cypress e2e specs on fix_e2e_tests_failing - #3390

Merged
stephywells merged 3 commits into
fix_e2e_tests_failingfrom
fix/issue-3389-e2e-timing
Sep 19, 2026
Merged

stephywells merged 3 commits into
fix_e2e_tests_failingfrom
fix/issue-3389-e2e-timing

Conversation

@vivi-the-going-merry

@vivi-the-going-merry vivi-the-going-merry Bot commented Sep 19, 2026

Copy link
Copy Markdown
Contributor

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-content at 0 height.
  • tests/cypress/e2e/Forms/searchFunctionality.cy.js - cy.type() blocked, search input covered by <html>. Not touched by fix_e2e_tests_failing itself - failing independently of that branch's force:true removal.

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-content 0-height error was a red herring from a position:fixed descendant taking real content out of flow. The actual issue is deterministic: adding a field can leave the scrollable .frm-right-panel scrolled 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 with scrollIntoView() 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.js in shard 2, searchFunctionality.cy.js in shard 1) pass cleanly on 602cfce; watching CI on ca23efe for the follow-up timeout fix.

Closes #3389

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
@vivi-the-going-merry vivi-the-going-merry Bot added run analysis run e2e tests Run the Cypress end-to-end suite on this PR labels Sep 19, 2026
@coderabbitai

coderabbitai Bot commented Sep 19, 2026

Copy link
Copy Markdown
Contributor

Important

Review skipped

Bot user detected.

To trigger a single review, invoke the @coderabbitai review command.

⚙️ Run configuration

Configuration used: Repository: Strategy11/formidable-forms/.coderabbit.yaml

Review profile: CHILL

Plan: Advanced

Run ID: ac46ab3e-687e-4226-8ef4-9575527cce95

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review

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

Comment @coderabbitai help to get the list of available commands.

@deepsource-io

deepsource-io Bot commented Sep 19, 2026

Copy link
Copy Markdown

DeepSource Code Review

We reviewed changes in 5157242...ca23efe on this pull request. Below is the summary for the review, and you can see the individual issues we found as inline review comments.

See full review on DeepSource ↗

PR Report Card

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
@vivi-the-going-merry

Copy link
Copy Markdown
Contributor Author

Both specs named in #3389 now pass, verified two ways:

  • deleteEntries.cy.js: root cause wasn't render timing at all — the failing assertion's own error blamed #wpbody-content's collapsed height, but that's a red herring (it collapses because a position:fixed descendant takes the real content out of its flow). Direct DOM inspection (bounding-rect + ancestor-chain dump) showed the actual .frm_add_field link sitting at a negative Y offset — scrolled outside its own scrollable panel (.frm-right-panel), a leftover scroll position from the previous field-add click. Deterministic, not flaky — reproduced it 100% of the time locally on a clean DB, and no timeout length ever resolved it. Fixed with scrollIntoView() before each field-add click instead of a longer timeout.
  • searchFunctionality.cy.js: this one is genuinely timing — a search submits a real page navigation (not AJAX), so the result-count assertion right after can race the reload past the default 4s timeout. Moved the timeout onto the .count assertions themselves. Verified stable over 5 clean-DB runs locally.

Both now pass in this PR's own CI (shard 2: deleteEntries ✔, shard 1: searchFunctionality ✔).

The remaining Cypress failures on this PR (FormTemplates.cy.js, fieldsInFormBuilder.cy.js, formsSettings.cy.js) are unrelated to #3389 — pre-existing flakiness in specs #3378 itself modified, not the two named here. Leaving those out of scope for this issue; may need their own follow-up.

@franky-the-going-merry franky-the-going-merry Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

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' );

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

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.

Suggested change
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

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

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.

@vivi-the-going-merry vivi-the-going-merry Bot added vivi-working Vivi is actively working this and removed vivi-pickup labels Sep 19, 2026
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.
@vivi-the-going-merry

Copy link
Copy Markdown
Contributor Author

Cypress shard 1/3 failures on this run are unrelated pre-existing flakes, not this PR's fault: shard 1 failed on Form Templates/FormTemplates.cy.js (this PR's own target, Forms/searchFunctionality.cy.js, passed in the same shard); shard 3 failed on Forms/fieldsInFormBuilder.cy.js and Forms/formsSettings.cy.js (this PR's other target, Entries/deleteEntries.cy.js, isn't in either failing shard). No code change needed here.

@vivi-the-going-merry vivi-the-going-merry Bot added franky-review and removed vivi-working Vivi is actively working this labels Sep 19, 2026

@franky-the-going-merry franky-the-going-merry Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

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.

@stephywells
stephywells merged commit 0480938 into fix_e2e_tests_failing Sep 19, 2026
32 of 36 checks passed
@stephywells
stephywells deleted the fix/issue-3389-e2e-timing branch September 19, 2026 14:51
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

run analysis run e2e tests Run the Cypress end-to-end suite on this PR

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant