File tree Expand file tree Collapse file tree 1 file changed +8
-2
lines changed
core/src/androidTest/java/com/amplifyframework/devmenu Expand file tree Collapse file tree 1 file changed +8
-2
lines changed Original file line number Diff line number Diff line change 2929import org .junit .Before ;
3030import org .junit .Test ;
3131
32+ import java .util .concurrent .CountDownLatch ;
33+
3234import static androidx .test .espresso .Espresso .onView ;
3335import static org .junit .Assert .assertEquals ;
3436import static org .junit .Assert .assertNotNull ;
3840 */
3941public final class DevMenuMainViewInstrumentationTest {
4042 // A navigation host controller for testing.
41- private TestNavHostController navHostController ;
43+ private volatile TestNavHostController navHostController ;
4244
4345 /**
4446 * Go to the main screen of the developer menu.
47+ * @throws Exception if fragment doesn't attach
4548 */
4649 @ Before
47- public void resetView () {
50+ public void resetView () throws Exception {
51+ CountDownLatch latch = new CountDownLatch (1 );
4852 FragmentScenario <DevMenuMainFragment > mainMenuScenario =
4953 FragmentScenario .launchInContainer (DevMenuMainFragment .class );
5054 mainMenuScenario .onFragment (fragment -> {
5155 navHostController = new TestNavHostController (ApplicationProvider .getApplicationContext ());
5256 navHostController .setGraph (R .navigation .dev_menu_nav_graph );
5357 Navigation .setViewNavController (fragment .requireView (), navHostController );
58+ latch .countDown ();
5459 });
60+ latch .await ();
5561 }
5662
5763
You can’t perform that action at this time.
0 commit comments