createPin method

Future<void> createPin(
  1. String spaceId,
  2. String title,
  3. String content,
  4. String url,
)

Implementation

Future<void> createPin(
  String spaceId,
  String title,
  String content,
  String url,
) async {
  await find.byKey(Keys.mainNav).should(findsOneWidget);
  final quickJumpKey = find.byKey(MainNavKeys.quickJump);
  await quickJumpKey.should(findsOneWidget);
  await quickJumpKey.tap();

  final pinActionKey = find.byKey(QuickJumpKeys.createPinAction);
  await tester.ensureVisible(pinActionKey);
  await pinActionKey.should(findsOneWidget);
  await pinActionKey.tap();

  final titleField = find.byKey(CreatePinPage.titleFieldKey);
  await titleField.should(findsOneWidget);
  await titleField.enterTextWithoutReplace(title);

  final descriptionField = find.byKey(CreatePinPage.descriptionFieldKey);
  await descriptionField.should(findsOneWidget);
  final textEditorState =
      (tester.firstState(descriptionField) as HtmlEditorState).editorState;
  await textEditorState.insertText(0, content, path: [0]);
  textEditorState.service.keyboardService!.closeKeyboard();
  await selectSpace(spaceId, SelectSpaceFormField.openKey);

  final submit = find.byKey(CreatePinPage.submitBtn);
  await tester.ensureVisible(submit);
  await submit.tap();
}