Exemplo n.º 1
0
 @Test
 public void testSendMessage() {
   String text = "Message";
   waitUntil(() -> controller.textarea != null);
   Identity i = controller.identity;
   controller.contact = new Contact(i.getAlias(), i.getDropUrls(), i.getEcPublicKey());
   clickOn("#textarea").write(text);
   robot.push(KeyCode.ENTER);
   List<DropMessage> list = receiveMessages();
   assertEquals(1, list.size());
   assertEquals(text, TextMessage.fromJson(list.get(0).getDropPayload()).getText());
   assertEquals(new Date().getTime(), list.get(0).getCreationDate().getTime(), 100000);
   assertEquals(controller.identity.getId(), list.get(0).getSender().getId());
 }
Exemplo n.º 2
0
  @Test
  public void multilineInput() {
    controller.contact =
        new Contact(identity.getAlias(), identity.getDropUrls(), identity.getEcPublicKey());
    FxRobot textArea = clickOn("#textarea");
    textArea.write("line1");
    robot.press(KeyCode.SHIFT);
    try {
      robot.push(KeyCode.ENTER);
    } finally {
      robot.release(KeyCode.SHIFT);
    }
    robot.write("line2");

    submitChat();

    DropMessage message = receiveMessages().get(0);
    assertEquals(DropMessageRepository.PAYLOAD_TYPE_MESSAGE, message.getDropPayloadType());
    assertEquals("line1\nline2", TextMessage.fromJson(message.getDropPayload()).getText());
  }