Skip to content

fix(challenge): use headless in-app webview for test runner#1781

Merged
Nirajn2311 merged 2 commits into
freeCodeCamp:mainfrom
Sembauke:fix/challenge-headless-test-runner
May 5, 2026
Merged

fix(challenge): use headless in-app webview for test runner#1781
Nirajn2311 merged 2 commits into
freeCodeCamp:mainfrom
Sembauke:fix/challenge-headless-test-runner

Conversation

@Sembauke
Copy link
Copy Markdown
Member

Summary

  • replace the hidden 1x1 challenge test runner InAppWebView with a HeadlessInAppWebView
  • move test runner initialization into ChallengeViewModel lifecycle
  • guard test execution when the test runner is still initializing
  • make webview disposal idempotent

Why

The challenge runner depended on a hidden rendered widget instead of a true headless runtime, which made lifecycle handling more fragile.

Validation

  • flutter analyze lib/ui/views/learn/challenge/challenge_view.dart lib/ui/views/learn/challenge/challenge_viewmodel.dart

Comment thread mobile-app/lib/ui/views/learn/challenge/challenge_viewmodel.dart Outdated
await _babelWebView.dispose();
await _localhostServer.close();
if (_webViewsClosed) return;
_webViewsClosed = true;
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Better to set this after the webviews are closed and not before

@Nirajn2311
Copy link
Copy Markdown
Member

I'm gonna miss the test runner been a pixel on the screen 😆

@Nirajn2311 Nirajn2311 merged commit 5b35abd into freeCodeCamp:main May 5, 2026
3 of 6 checks passed
@Sembauke Sembauke deleted the fix/challenge-headless-test-runner branch May 13, 2026 06:04
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.

2 participants