fillForm method

Future<void> fillForm(
  1. Map<dynamic, String> fields, {
  2. dynamic submitBtnKey,
  3. String? selectSpaceId,
})

Implementation

Future<void> fillForm(
  Map<Key, String> fields, {
  Key? submitBtnKey,
  String? selectSpaceId,
}) async {
  for (final entry in fields.entries) {
    final textField = find.byKey(entry.key);
    await tester.ensureVisible(textField);
    await textField.should(findsOneWidget);
    await textField.enterTextWithoutReplace(entry.value);
  }
  if (selectSpaceId != null) {
    await selectSpace(selectSpaceId, SelectSpaceFormField.openKey);
  }
  if (submitBtnKey != null) {
    final submit = find.byKey(submitBtnKey);
    await tester.ensureVisible(submit);
    await submit.should(findsOneWidget);
    await submit.tap();
  }
}