fix: filter ion-page-hidden elements before asserting hydration in JQ…#18
Merged
fix: filter ion-page-hidden elements before asserting hydration in JQ…#18
Conversation
…uery/Chainable branches In the JQuery and Chainable branches, the hydration assertion ran on the full element set before hidden-page elements were filtered out. If all elements were on hidden pages and lacked the .hydrated class, Cypress's .not() command would retry until timeout rather than returning an empty set. The fix uses jQuery's native .not() synchronously inside a .then() callback to filter hidden elements first, then skips the hydration assertion when the filtered set is empty.
There was a problem hiding this comment.
Pull request overview
Fixes a Cypress timeout edge case by ensuring elements inside hidden Ionic pages are filtered out before asserting .hydrated for jQuery and Chainable selector inputs.
Changes:
- Replace the jQuery/
Chainablehydration-then-filter flow with a filter-then-hydration assertion (filterThenAssertHydrated()). - Skip hydration assertions when the post-filter set is empty to avoid Cypress retry timeouts.
- Add Cypress E2E coverage for the hidden-page filtering order regression.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
| src/helpers/get-from-supported-selector.ts | Introduces filterThenAssertHydrated() and switches jQuery/Chainable branches to filter hidden-page elements before hydration assertions. |
| cypress/e2e/get-from-supported-selector.spec.ts | Adds regression tests ensuring hidden, non-hydrated matches don’t cause timeouts and that visible matches are returned correctly. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Route the string-selector path through the same filter-then-assert flow as Chainable/JQuery inputs, so hidden page matches are removed before checking hydrated class. Prevents timeout retries when all matches are inside ion-page-hidden and never hydrated, returning an empty set instead. Add a Cypress regression test for the css-selector hidden-only non-hydrated scenario.
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 2 out of 2 changed files in this pull request and generated 2 comments.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
…uery/Chainable branches
In the JQuery and Chainable branches, the hydration assertion ran on the full element set before hidden-page elements were filtered out. If all elements were on hidden pages and lacked the .hydrated class, Cypress's .not() command would retry until timeout rather than returning an empty set.
The fix uses jQuery's native .not() synchronously inside a .then() callback to filter hidden elements first, then skips the hydration assertion when the filtered set is empty.