/**
  * Overview:
  *
  * This test opens a conversation, selects option "Marcar conversa como lida"
  * in the conversation menu, and then checks if the message was really marked
  * as read.
  *
  * - CTV3-1058
  *   http://comunidadeexpresso.serpro.gov.br/testlink/linkto.php?tprojectPrefix=CTV3&item=testcase&id=CTV3-1058
  */
 public function test_CTV3_1058_MarkReadThreadMail()
 {
     //load test data
     $SENDER_LOGIN = $this->getGlobalValue('user.1.login');
     $SENDER_PASSWORD = $this->getGlobalValue('user.1.password');
     $RECIPIENT_LOGIN = $this->getGlobalValue('user.2.login');
     $RECIPIENT_PASSWORD = $this->getGlobalValue('user.2.password');
     $RECIPIENT_MAIL = $this->getGlobalValue('user.2.email');
     $MAIL_SUBJECT = $this->getTestValue('mail.subject');
     $ORIGINAL_MAIL_CONTENT = $this->getTestValue('original.mail.content');
     TestScenarios::create2MessageConversation($this, (object) array('user1' => $SENDER_LOGIN, 'password1' => $SENDER_PASSWORD, 'user2' => $RECIPIENT_LOGIN, 'password2' => $RECIPIENT_PASSWORD, 'mail2' => $RECIPIENT_MAIL, 'subject' => $MAIL_SUBJECT, 'content' => $ORIGINAL_MAIL_CONTENT));
     $this->doLogin($RECIPIENT_LOGIN, $RECIPIENT_PASSWORD);
     $mailPage = new MailPage($this);
     $mailPage->waitForEmailToArrive($MAIL_SUBJECT);
     $mailPage->clickOnHeadlineBySubject($MAIL_SUBJECT);
     $this->waitForAjaxAndAnimations();
     $widgetMessages = $mailPage->getWidgetMessages();
     $widgetMessages->clickSubjectMenuOptionMarkUnread();
     $mailPage->clickOnHeadlineBySubject($MAIL_SUBJECT);
     $this->waitForAjaxAndAnimations();
     $widgetMessages = $mailPage->getWidgetMessages();
     $widgetMessages->clickSubjectMenuOptionMarkRead();
     $this->waitForAjaxAndAnimations();
     $mailPage->clickOnHeadlineBySubject($MAIL_SUBJECT);
     $headlinesEntry = $mailPage->getHeadlinesEntryBySubject($MAIL_SUBJECT);
     $this->assertEquals(HeadlinesEntry::READ_STATUS, $headlinesEntry->getReadStatus(), 'The message was marked as "Read", but it was not changed');
     $widgetMessages->clickSubjectMenuOptionMarkRead();
     $this->assertAlertTextEquals('Nenhuma mensagem a ser marcada como  lida.', 'System did not show message indicating no message tobe marked as read');
     $this->dismissAlert();
 }
 /**
  * Overview:
  *
  * This tests moves an opened conversation to folder "Modelo", and then
  * checks if the message is no longer present in the Inbox folder, but is
  * present in the target folder.
  *
  * - CTV3-1020
  *   http://comunidadeexpresso.serpro.gov.br/testlink/linkto.php?tprojectPrefix=CTV3&item=testcase&id=CTV3-1020
  *
  */
 public function test_CTV3_1020_Move_Thread_Mail()
 {
     //load test data
     $SENDER_LOGIN = $this->getGlobalValue('user.1.login');
     $SENDER_PASSWORD = $this->getGlobalValue('user.1.password');
     $RECIPIENT_LOGIN = $this->getGlobalValue('user.2.login');
     $RECIPIENT_PASSWORD = $this->getGlobalValue('user.2.password');
     $RECIPIENT_MAIL = $this->getGlobalValue('user.2.email');
     $MAIL_SUBJECT = $this->getTestValue('mail.subject');
     $ORIGINAL_MAIL_CONTENT = $this->getTestValue('original.mail.content');
     TestScenarios::create2MessageConversation($this, (object) array('user1' => $SENDER_LOGIN, 'password1' => $SENDER_PASSWORD, 'user2' => $RECIPIENT_LOGIN, 'password2' => $RECIPIENT_PASSWORD, 'mail2' => $RECIPIENT_MAIL, 'subject' => $MAIL_SUBJECT, 'content' => $ORIGINAL_MAIL_CONTENT));
     $this->doLogin($RECIPIENT_LOGIN, $RECIPIENT_PASSWORD);
     $mailPage = new MailPage($this);
     $mailPage->waitForEmailToArrive($MAIL_SUBJECT);
     $mailPage->clickOnHeadlineBySubject($MAIL_SUBJECT);
     $this->waitForAjaxAndAnimations();
     $widgetMessages = $mailPage->getWidgetMessages();
     $widgetMessages->clickSubjectMenuOptionMove("Modelos");
     $this->waitForAjaxAndAnimations();
     $headlinesEntry = $mailPage->getHeadlinesEntryBySubject($MAIL_SUBJECT);
     $this->assertNull($headlinesEntry, 'Mail was moved, but it was not removed from headlines listing');
     $mailPage->clickOnFolderByName('Modelos');
     $this->waitForAjaxAndAnimations();
     $headlinesEntry = $mailPage->getHeadlinesEntryBySubject($MAIL_SUBJECT);
     $this->assertNotNull($headlinesEntry, 'Mail was moved, but could not be found in the Modelos folder');
     $messages = $widgetMessages->getArrayOfMessageUnitsCurrentConversation();
     $this->assertEquals(2, count($messages), 'Conversation has less messages after it was moved to another folder');
 }
 /**
  * Description:
  *
  * - This test checks the messages within a conversation are being displayed
  *   correctly. It checks if the conversation has the right number of messages
  *   and if the messages contents are correct.
  *
  * - CTV3-1048
  *   http://comunidadeexpresso.serpro.gov.br/testlink/linkto.php?tprojectPrefix=CTV3&item=testcase&id=CTV3-1048
  *
  */
 public function test_CTV3_1048_ReadThreadMail()
 {
     //load test data
     $USER_1_LOGIN = $this->getGlobalValue('user.1.login');
     $USER_1_PASSWORD = $this->getGlobalValue('user.1.password');
     $USER_2_LOGIN = $this->getGlobalValue('user.2.login');
     $USER_2_PASSWORD = $this->getGlobalValue('user.2.password');
     $USER_2_MAIL = $this->getGlobalValue('user.2.email');
     $MAIL_SUBJECT = $this->getTestValue('mail.subject');
     $ORIGINAL_MAIL_CONTENT = $this->getTestValue('original.mail.content');
     $REPLY_SECOND_MAIL_CONTENT = $this->getTestValue('reply.second.mail.content');
     TestScenarios::create2MessageConversation($this, (object) array('user1' => $USER_1_LOGIN, 'password1' => $USER_1_PASSWORD, 'user2' => $USER_2_LOGIN, 'password2' => $USER_2_PASSWORD, 'mail2' => $USER_2_MAIL, 'subject' => $MAIL_SUBJECT, 'content' => $ORIGINAL_MAIL_CONTENT));
     $this->doLogin($USER_2_LOGIN, $USER_2_PASSWORD);
     $mailPage = new MailPage($this);
     $mailPage->waitForEmailToArrive($MAIL_SUBJECT);
     $mailPage->clickOnHeadlineBySubject($MAIL_SUBJECT);
     $widgetMessages = $mailPage->getWidgetMessages();
     $messages = $widgetMessages->getArrayOfMessageUnitsCurrentConversation();
     $this->assertEquals(2, count($messages), 'The number of messages within the conversation does not match what was expected');
     $firstMessage = $messages[0];
     $this->assertFalse($firstMessage->isMessageExpanded(), 'The first message within the conversation was opened, but it shoud have been closed');
     $firstMessage->clickMessageTop();
     $this->assertTrue($firstMessage->isMessageExpanded(), 'The first message in the conversation should have been opened after it was clicked, but it is still closed');
     $this->assertContains($ORIGINAL_MAIL_CONTENT, $firstMessage->getContent(), 'The first message content differs from the expected');
     $secondMessage = $messages[1];
     $this->assertTrue($secondMessage->isMessageExpanded(), 'The second message within the conversation should be opened by default, but it was closed');
     $this->assertContains($REPLY_SECOND_MAIL_CONTENT, $secondMessage->getContent(), 'The second message content differs from the expected');
 }
 /**
  * Overview:
  *
  * - This test checks the deletion of a conversation containing several
  *   e-mails. After creating a conversations, it selects the
  *   "Apagar conversa" option in the subjects menu and then checks if the
  *   trash folder contains the removed message
  *
  * - CTV3-1017
  *   http://comunidadeexpresso.serpro.gov.br/testlink/linkto.php?tprojectPrefix=CTV3&item=testcase&id=CTV3-1017
  */
 public function test_CTV3_1017_Delete_Open_Thread_Mail()
 {
     $USER_1_LOGIN = $this->getGlobalValue('user.1.login');
     $USER_1_PASSWORD = $this->getGlobalValue('user.1.password');
     $USER_2_LOGIN = $this->getGlobalValue('user.2.login');
     $USER_2_PASSWORD = $this->getGlobalValue('user.2.password');
     $USER_2_MAIL = $this->getGlobalValue('user.2.email');
     $MAIL_SUBJECT = $this->getTestValue('mail.subject');
     $MAIL_CONTENT = $this->getTestValue('mail.content');
     TestScenarios::create2MessageConversation($this, (object) array('user1' => $USER_1_LOGIN, 'password1' => $USER_1_PASSWORD, 'user2' => $USER_2_LOGIN, 'password2' => $USER_2_PASSWORD, 'mail2' => $USER_2_MAIL, 'subject' => $MAIL_SUBJECT, 'content' => $MAIL_CONTENT));
     $this->doLogin($USER_2_LOGIN, $USER_2_PASSWORD);
     $mailPage = new MailPage($this);
     $mailPage->waitForEmailToArrive($MAIL_SUBJECT);
     $mailPage->clickOnHeadlineBySubject($MAIL_SUBJECT);
     $widgetMessages = $mailPage->getWidgetMessages();
     $widgetMessages->clickSubjectMenuOptionDelete();
     $this->waitForAjaxAndAnimations();
     $headlinesEntry = $mailPage->getHeadlinesEntryBySubject($MAIL_SUBJECT);
     $this->assertNull($headlinesEntry, 'Mail was deleted, but it was not removed from headlines listing');
     $mailPage->clickOnFolderByName('Lixeira');
     $this->waitForAjaxAndAnimations();
     $headlinesEntry = $mailPage->getHeadlinesEntryBySubject($MAIL_SUBJECT);
     $this->assertNotNull($headlinesEntry, 'Mail was deleted, but could not be found in the trash bin');
 }
 public function test_CTV3_846_Delete_Draft()
 {
     $USER_LOGIN = $this->getGlobalValue('user.1.login');
     $USER_PASSWORD = $this->getGlobalValue('user.1.password');
     $RECIPIENT_1_MAIL = $this->getGlobalValue('user.2.email');
     $MAIL_SUBJECT = $this->getTestValue('mail.subject');
     $MAIL_CONTENT = $this->getTestValue('mail.content');
     TestScenarios::createMessageDraft($this, (object) array('senderLogin' => $USER_LOGIN, 'senderPassword' => $USER_PASSWORD, 'recipentMail' => $RECIPIENT_1_MAIL, 'subject' => $MAIL_SUBJECT, 'content' => $MAIL_CONTENT));
     $this->doLogin($USER_LOGIN, $USER_PASSWORD);
     $mailPage = new MailPage($this);
     $mailPage->clickOnFolderByName('Rascunhos');
     $headlinesEntry = $mailPage->getHeadlinesEntryBySubject($MAIL_SUBJECT);
     $headlinesEntry->toggleCheckbox();
     $mailPage->clickMenuOptionDelete();
     $this->waitForAjaxAndAnimations();
     $headlinesEntry = $mailPage->getHeadlinesEntryBySubject($MAIL_SUBJECT);
     $this->assertNull($headlinesEntry, 'Mail was deleted, but it was not removed from headlines listing in Draft Folder');
     $mailPage->clickOnFolderByName('Lixeira');
     $this->waitForAjaxAndAnimations();
     $headlinesEntry = $mailPage->getHeadlinesEntryBySubject($MAIL_SUBJECT);
     $this->assertNotNull($headlinesEntry, 'Mail was deleted, but could not be found in the trash bin');
 }