title: Flutter, flutter_localization and testing (pass only one test if i try mock localization)
body: <p>I write simple project for catch my problem</p>
  
  <p><a href="https://gist.github.com/imigalkin/5ecddacec27e160d0017a63d4a14a1b0" rel="nofollow noreferrer">https://gist.github.com/imigalkin/5ecddacec27e160d0017a63d4a14a1b0</a></p>
  
  <p>If i run tests in this project separately they pass. But if i try to run all the tests the second test fail. What i do wrong?</p>
  
  <p>flutter doctor:</p>
  
  <pre><code>Doctor summary (to see all details, run flutter doctor -v):
  [✓] Flutter (Channel stable, v1.12.13+hotfix.8, on Mac OS X 10.15.3 19D76, locale en-GB)
  
  [✓] Android toolchain - develop for Android devices (Android SDK version 29.0.2)
  [✓] Xcode - develop for iOS and macOS (Xcode 11.3)
  [✓] Android Studio (version 3.5)
  [✓] VS Code (version 1.42.1)
  [!] Connected device
      ! No devices available
  </code></pre>
  
  <p>Error:</p>
  
  <pre><code>00:03 +1: two
  ══╡ EXCEPTION CAUGHT BY FLUTTER TEST FRAMEWORK ╞════════════════════════════════════════════════════
  The following TestFailure object was thrown running a test:
    Expected: exactly one matching node in the widget tree
    Actual: _TextFinder:&lt;zero widgets with text "HOME" (ignoring offstage widgets)&gt;
     Which: means none were found but one was expected
  
  When the exception was thrown, this was the stack:
  #4      main.&lt;anonymous closure&gt; (file:///Volumes/data/code/flutter/_learn/try_widget_tests/test/widget_test.dart:49:5)
  &lt;asynchronous suspension&gt;
  #5      testWidgets.&lt;anonymous closure&gt;.&lt;anonymous closure&gt; (package:flutter_test/src/widget_tester.dart:124:25)
  #6      TestWidgetsFlutterBinding._runTestBody (package:flutter_test/src/binding.dart:696:19)
  &lt;asynchronous suspension&gt;
  #9      TestWidgetsFlutterBinding._runTest (package:flutter_test/src/binding.dart:679:14)
  #10     AutomatedTestWidgetsFlutterBinding.runTest.&lt;anonymous closure&gt; (package:flutter_test/src/binding.dart:1050:24)
  #16     AutomatedTestWidgetsFlutterBinding.runTest (package:flutter_test/src/binding.dart:1047:15)
  #17     testWidgets.&lt;anonymous closure&gt; (package:flutter_test/src/widget_tester.dart:121:22)
  #18     Declarer.test.&lt;anonymous closure&gt;.&lt;anonymous closure&gt;.&lt;anonymous closure&gt; (package:test_api/src/backend/declarer.dart:171:27)
  &lt;asynchronous suspension&gt;
  #19     Invoker.waitForOutstandingCallbacks.&lt;anonymous closure&gt; (package:test_api/src/backend/invoker.dart:242:15)
  #24     Invoker.waitForOutstandingCallbacks (package:test_api/src/backend/invoker.dart:239:5)
  #25     Declarer.test.&lt;anonymous closure&gt;.&lt;anonymous closure&gt; (package:test_api/src/backend/declarer.dart:169:33)
  #30     Declarer.test.&lt;anonymous closure&gt; (package:test_api/src/backend/declarer.dart:168:13)
  #31     Invoker._onRun.&lt;anonymous closure&gt;.&lt;anonymous closure&gt;.&lt;anonymous closure&gt;.&lt;anonymous closure&gt; (package:test_api/src/backend/invoker.dart:392:25)
  #45     _Timer._runTimers (dart:isolate-patch/timer_impl.dart:384:19)
  #46     _Timer._handleMessage (dart:isolate-patch/timer_impl.dart:418:5)
  #47     _RawReceivePortImpl._handleMessage (dart:isolate-patch/isolate_patch.dart:174:12)
  (elided 28 frames from class _FakeAsync, package dart:async, package dart:async-patch, and package stack_trace)
  
  This was caught by the test expectation on the following line:
    file:///Volumes/data/code/flutter/_learn/try_widget_tests/test/widget_test.dart line 49
  The test description was:
    two
  ════════════════════════════════════════════════════════════════════════════════════════════════════
  00:03 +1 -1: two [E]
    Test failed. See exception logs above.
    The test description was: two
  
  00:03 +1 -1: Some tests failed.
  </code></pre>