Skip to content

test: flutter test suite has ~49 failing tests and a 10-minute smoke-test timeout — needs test-isolation investigation #672

Description

@akintewe

While getting flutter analyze fully clean (#670, PR #671), running the full test suite (flutter test --exclude-tags integration, the exact command CI runs) surfaced ~49 failing tests and a widget_test.dart smoke test that hits a 10-minute timeout, even after fixing an unrelated CI-reliability bug (a live-testnet integration test that was missing its @Tags(['integration']) annotation and therefore ran every time — fixed in PR #671).

This has not been investigated in depth — PR #671 was scoped to flutter analyze, and this is a distinctly different, likely test-isolation/concurrency problem, not a batch of individually-broken assertions.

What's known so far

Spot-checking one failure found a clear, pre-existing root cause unrelated to anything in #670/#671: test/features/dashboard/streak_freeze_provider_test.dart (a file untouched by that PR) fails with:

'package:supabase_flutter/src/supabase.dart': Failed assertion: line 45 pos 7: '_instance._isInitialized':
You must initialize the supabase instance before calling Supabase.instance

— this file never calls Supabase.initialize() in its own setUp/setUpAll, unlike other test files that do (e.g. wallet_screen_test.dart, deep_link_service_test.dart). Given Supabase.initialize() is a one-time, idempotent call per process, and flutter test may share workers/isolates across files depending on concurrency settings, this smells like a broader pattern: individual test files relying on Supabase.initialize() having already been called by whichever OTHER file happened to run first in the same worker, rather than each file guaranteeing its own setup. That would explain both the sporadic-looking failure list (which files fail depends on run/worker ordering) and the smoke-test timeout (if two tests interfere via shared global state — e.g. FlutterError.onError — under concurrent execution).

Full list of failing tests (from a single flutter test --exclude-tags integration run)

  • test/core/services/notification_permission_service_test.dart — 2 failures
  • test/features/dashboard/dashboard_repository_test.dart — 2 failures
  • test/features/dashboard/dashboard_screen_test.dart — 1 failure
  • test/features/dashboard/streak_freeze_card_test.dart — 4 failures
  • test/features/dashboard/streak_freeze_provider_test.dart — 7 failures (confirmed root cause above)
  • test/features/global_mirror/gift_screen_test.dart — 1 failure
  • test/features/global_mirror/global_mirror_notifier_test.dart — 1 failure
  • test/features/global_mirror/statistics_panel_test.dart — 9 failures
  • test/features/global_mirror/video_feed_screen_test.dart — 1 failure
  • test/features/leaderboard/current_user_id_provider_test.dart — 3 failures
  • test/features/settings/settings_screen_test.dart — 4 failures
  • test/features/stellar/get_live_balances_test.dart — 1 failure
  • test/widget/login_screen_test.dart — 7 failures
  • test/widget/reset_password_screen_test.dart — 2 failures
  • test/widget_test.dart — 1 failure (10-minute timeout, likely collateral from whatever's happening above rather than its own bug — the smoke test itself is simple)

Suggested approach

  1. First establish whether this is a concurrency/worker-sharing issue: re-run with flutter test --exclude-tags integration --concurrency=1 and see if the failure count changes significantly. If most failures disappear, this confirms cross-file global-state interference (Supabase init, or something else) rather than 49 independently broken tests.
  2. If concurrency is the cause, the real fix is making every test file that touches Supabase.instance call Supabase.initialize() (or an equivalent mock setup) in its own setUpAll, so no file depends on another file's setup having run first — same pattern already used correctly in wallet_screen_test.dart and deep_link_service_test.dart.
  3. If concurrency isn't the whole story, work through the remaining files' failures individually — several are UI-assertion-shaped (e.g. statistics_panel_test.dart's 9 region-classification failures, login_screen_test.dart's widget-rendering failures) and may need the same kind of "re-verify against the real current widget structure" treatment already applied to `wallet_screen_test.dart" in fix(ci): repair broken _shared imports and unformatted Dart files breaking CI #669.

Acceptance criteria

  • flutter test --exclude-tags integration passes with 0 failures
  • No test relies on setup performed by another test file (each file's Supabase/mock state is self-contained)
  • CI's Test step (part of the Format · Analyze · Test job) is fully green

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workingflutterFlutter app / UI relatedtestingWriting or fixing tests

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions