Skip to content

feat(goto): add --wait-loaded flag for async-rendered content#71

Merged
avifenesh merged 7 commits intomainfrom
feature/wait-loaded-68
Feb 25, 2026
Merged

feat(goto): add --wait-loaded flag for async-rendered content#71
avifenesh merged 7 commits intomainfrom
feature/wait-loaded-68

Conversation

@avifenesh
Copy link
Collaborator

Summary

  • Add --wait-loaded flag to the goto action for pages with async-rendered content
  • Combines network idle, DOM stability, loading indicator absence detection (spinners, skeletons, progress bars, aria-busy), and a final DOM quiet period
  • Integrates with all existing goto code paths (normal, ensure-auth, checkpoint, no-display)
  • Includes timeout validation to guard against NaN and negative values

Test Plan

  • 500 tests passing (21 new tests for --wait-loaded)
  • Flag parsing validates correctly as boolean
  • CLI integration test against example.com
  • Timeout validation handles edge cases (NaN, negative, zero)
  • npm run validate passes

Related Issues

Closes #68

Add waitForLoaded function to browser-launcher that combines three
phases: network idle + DOM stability (via existing waitForStable),
loading indicator absence detection (spinners, skeletons, progress
bars, aria-busy elements), and a final 300ms DOM quiet period.

Wire --wait-loaded into all four goto snapshot paths, register as
boolean flag, expose in macro helpers, and update help text.

Closes #68
- Guard against null document.body in indicator check and MutationObserver
- Limit TreeWalker to 5000 nodes to prevent DoS on huge DOMs
- Use querySelectorAll with combined selectors for efficient polling
- Ensure MutationObserver disconnect in all resolve paths
- Parse loadedTimeout once at top of goto case (DRY)
- Add tests for null guard, node limit, querySelectorAll, DRY timeout
parseInt can return NaN for malformed input. Guard against NaN and
negative values by falling back to the 15000ms default.
Previous validation with Math.max/|| allowed negative values to
produce 0ms timeout. Use explicit > 0 check so NaN, negative, and
zero all fall back to the 15000ms default.
Keep improved timeout validation from feature branch and incorporate
auth wall checkpoint tests from main.
@avifenesh avifenesh merged commit ba55082 into main Feb 25, 2026
2 checks passed
@avifenesh avifenesh deleted the feature/wait-loaded-68 branch February 25, 2026 15:09
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add --wait-loaded flag for pages with async-rendered content

1 participant