openSessionScreen static method

Future<void> openSessionScreen(
  1. WidgetTester tester,
  2. EnsembleTestCase testCase, {
  3. required NavigationFlowRecorder navigationFlow,
})

Implementation

static Future<void> openSessionScreen(
    WidgetTester tester, EnsembleTestCase testCase,
    {required NavigationFlowRecorder navigationFlow}) async {
  final startScreen = testCase.startScreen;
  if (startScreen == null || startScreen.isEmpty) {
    throw EnsembleTestFailure(
      'Session test "${testCase.id}" requires startScreen',
    );
  }
  final context = Utils.globalAppKey.currentContext;
  if (context == null) {
    throw EnsembleTestFailure(
      'Cannot open "$startScreen" because the saved app session is not mounted',
    );
  }

  ScreenTracker().clearAll();
  navigationFlow.clear();
  ScreenController().navigateToScreen(
    context,
    screenId: startScreen,
    screenName: startScreen,
    pageArgs: testCase.startScreenInputs,
    routeOption: RouteOption.clearAllScreens,
  );
  await tester.pump();
  await waitForInitialWidgets(tester, testCase: testCase);
}