title: Flutter Widget Test: AutoRouter operation requested with a context that does not include an AutoRouter
body: <p>I'm using the <a href="https://pub.dev/packages/auto_route" rel="nofollow noreferrer">auto_route</a> package in my flutter project and wrapped my App in <code>MaterialApp.router</code>.</p>
  <p>Now I want to test a widget which calls <code>AutoRouter.of(context).pop();</code> in one place.</p>
  <p>My test looks like this:</p>
  <pre class="lang-dart prettyprint-override"><code> testWidgets('my widget test',
       (WidgetTester tester) async {
     await tester.pumpWidget(
       MaterialApp(
         home: MyWidget(),
       ),
     );
   });
  </code></pre>
  <p>Pumping the widget understandably throws the following error message:</p>
  <p><code>AutoRouter operation requested with a context that does not include an AutoRouter. The context used to retrieve the Router must be that of a widget that is a descendant of an AutoRouter widget.</code></p>
  <p>So I somehow need to provide an <code>AutoRouter</code> instance above my widgetin my test.</p>
  <p>My widget also uses <code>MediaQuery</code> and I needed to wrap my tested widget inside <code>MaterialApp</code> to avoid an error which was thrown due to <code>MediaQuery.of(context)</code> lookup.</p>
  <p>I guess I need to do something similar with <code>AutoRouter</code> but couldn't figure it out yet. Is there something like a <code>MockAutoRouter</code>?</p>
  <p>Happy for any help.</p>