openSessionScreen static method

Future<void> openSessionScreen(
  1. WidgetTester tester,
  2. EnsembleTestCase testCase
)

Implementation

static Future<void> openSessionScreen(
  WidgetTester tester,
  EnsembleTestCase testCase,
) 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();
  YamlTestSession.navigationFlow.clear();
  ScreenController().navigateToScreen(
    context,
    screenId: startScreen,
    pageArgs: testCase.startScreenInputs,
    routeOption: RouteOption.clearAllScreens,
  );
  await tester.pump();
  await waitForInitialWidgets(tester, testCase: testCase);
}