test(angular): assert sidemenu routerLink binding instead of flaky rendered href#1879
Merged
Conversation
…ndered href
The sidemenu 'should have urls' specs read ion-item.getAttribute('href'),
which Ionic's RouterLinkDelegate applies through its own async write queue.
Reading it after a single synchronous detectChanges() is flaky (FW-6264) and
intermittently fails CI on the angular starter, which blocked the deploy.
Assert the RouterLink binding directly via the directive's urlTree, which
resolves synchronously, so the result no longer depends on Ionic's async
href write. Verified 12/12 green on both the angular and angular-standalone
sidemenu starters.
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.
What is the current behavior?
The sidemenu
should have urlsspec readsion-item.getAttribute('href')right after a singledetectChanges(). Ionic'sRouterLinkDelegateapplies that href through its own async (rAF-based) write queue, so the attribute is often stillnullwhen the assertion runs. The test fails intermittently, and it failed three times in a row onmainafter #1878 merged, which failedverify-testand skipped thedeployjob, so the Angular dependency fix never shipped to the CDN. This is the flakiness tracked in FW-6264.What is the new behavior?
The test now asserts the
routerLinkbinding directly through theRouterLinkdirective'surlTree, which resolves synchronously from the bound commands, so it no longer depends on when Ionic writes the renderedhref. Applied to both theangularandangular-standalonesidemenu starters. I ran each 12 times locally and both were green every time; the old version flaked on roughly 40% of runs.The non-standalone
should have menu labelstest staysxit'd. That one readsion-labeltextContent, which is a separate Stencil slot-hydration timing issue, still owned by FW-6264.Does this introduce a breaking change?
Other information
Once this lands, the
deployjob onmainshould pass and ship the #1878 dependency fix (FW-7584) to the CDN.