Repository navigation
test(overlay): make the real app diagnosis and page highlight tests stable - #408
Merged
Merged
Conversation
…osis tests The tests slept 20 to 60 ms and hoped Angular had run its tick and the signal write hook had loaded by then. On a busy machine neither was true, so the timer test saw no cycle at all and the click test lost the signal it wrote. Wait for the app to be stable after each write, and poll until the write hook is set, instead of fixed delays.
The highlight-in-page test imported overlay.ts inside its body, which spent 2 to 3 seconds transforming the module graph against the 5 second timeout, and faked requestAnimationFrame, so advancing a minute replayed the box's follow loop thousands of times. Import the overlay with the file and fake only setTimeout and clearTimeout, the timers under test.
Contributor
|
View your CI Pipeline Execution ↗ for commit a38e48d
💡 Verify your cache is correct by running tasks in a sandbox. Read docs ↗ ☁️ Nx Cloud last updated this comment at |
🚀 Deploying Preview to Cloudflare 🚀Preview Deployments by commit
|
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 and why
Two package tests failed under load. Only the two test files change. No product code changes, nothing is skipped, no assertion changes and no timeout is raised.
cd-diagnosis-real. The tests waited fixed delays instead of the real conditions: 20 ms for the signal write hook (a dynamic import) to be installed, and 20 to 60 ms for Angular's zoneless tick. On a busy machine the tick had not run yet, soreport.cycleswas empty. They now:appRef.whenStable()after bootstrap and after each click or timer write;setTimeoutcallback has run;vi.waitForthe write hook instead of sleeping.page-highlight. "keeps a panel highlight until a clear arrives" importedoverlay.tsinside the test body, which took 2 to 3.5 s of the 5 s timeout.vi.useFakeTimers()also fakedrequestAnimationFrame, so advancing the minute-long safety timer replayed about 4,400 redraw frames. Under load it timed out every time and left its overlay running, which then broke the next test. NowinitOverlayis imported at the top of the file, and onlysetTimeoutandclearTimeoutare faked.How it was verified
30 runs of both files each, with 6 busy-loop processes on a 4-core machine for "under load":
pnpm commit:checkpnpm format:checkpnpm typecheckpnpm test:devtools: 3 full runs, all passingpnpm test:panel(noapp/change)Summary by CodeRabbit