/**
  * In this test, the e-mail was created and saved in draft folder. Checks if
  * turn on the important flag.
  *
  * CTV3-843
  * http://comunidadeexpresso.serpro.gov.br/testlink/linkto.php?tprojectPrefix=CTV3&item=testcase&id=CTV3-843
  */
 public function test_CTV3_843_Save_Draft_Important_Flag()
 {
     $mailPage = new MailPage($this);
     //load test data
     $MAIL_RECIPIENT = $this->getGlobalValue('user.1.email');
     $MAIL_SUBJECT = $this->getTestValue('mail.subject');
     $MAIL_CONTENT = $this->getTestValue('mail.content');
     //testStart
     $mailPage->clickWriteEmailButton();
     $widgetCompose = $mailPage->getWidgetCompose();
     $widgetCompose->clickOnRecipientField();
     $widgetCompose->type($MAIL_RECIPIENT);
     $widgetCompose->typeEnter();
     $widgetCompose->typeSubject($MAIL_SUBJECT);
     $widgetCompose->typeMessageBodyBeforeSignature($MAIL_CONTENT);
     $widgetCompose->clickImportantRadio();
     $widgetCompose->clickSaveDraftButton();
     $this->assertFalse($widgetCompose->isDisplayed(), 'Compose Window should have been closed, but it is still visible');
     $mailPage->clickOnFolderByName('Rascunhos');
     $headlinesEntry = $mailPage->getHeadlinesEntryBySubject($MAIL_SUBJECT);
     $this->assertTrue($headlinesEntry->hasImportantIcon(), 'Headline should have been listed as important, but it was not');
     $headlinesEntry->click();
     $this->waitForAjaxAndAnimations();
     $widgetCompose = $mailPage->getWidgetCompose();
     $this->assertTrue($widgetCompose->isImportantCheckboxChecked(), 'Checkbox was marked as important, but it was not');
 }
 /**
  * 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');
 }
 public function test_CTV3_987_Schedules_Views_Week()
 {
     $SENDER_LOGIN = $this->getGlobalValue('user.1.login');
     $SENDER_PASSWORD = $this->getGlobalValue('user.1.password');
     $loginPage = new LoginPage($this);
     $loginPage->doLogin($SENDER_LOGIN, $SENDER_PASSWORD);
     $mailPage = new MailPage($this);
     $mailPage->clickCalendar();
     $calendar = new CalendarPage($this);
     $calendar->clickViewWeek();
     $this->waitForAjaxAndAnimations();
     $this->assertContains(DateUtils::getNumericDayMonth(), $calendar->getDayWeekToday(), "The today does not match in day and month of Calendar of week");
     $this->assertContains(DateUtils::getShortDayOfWeek(), $calendar->getDayWeekToday(), "The today does not match in today's day of Calendar of week");
     //Verify if has the format date in layout title
     $this->assertTrue(preg_match_all("/\\A\\d{1,2}( [a-z]{3})? - \\d{1,2} [a-z]{3,}, \\d{4}\\z/", $calendar->getMonthAndYearInLayoutTitle(), $matches) == 1, "No match date of week in layout title  on Calendar of week");
     $calendar->clickLastWeekButton();
     $this->assertTrue(preg_match_all("/\\A\\d{1,2}( [a-z]{3})? - \\d{1,2} [a-z]{3,}, \\d{4}\\z/", $calendar->getMonthAndYearInLayoutTitle(), $matches) == 1, "No match date of last week in layout title on Calendar of week");
     $calendar->clickNextWeekButton();
     $calendar->clickNextWeekButton();
     $this->assertTrue(preg_match_all("/\\A\\d{1,2}( [a-z]{3})? - \\d{1,2} [a-z]{3,}, \\d{4}\\z/", $calendar->getMonthAndYearInLayoutTitle(), $matches) == 1, "No match date of Next week in layout title  on Calendar of week");
 }
 /**
  * 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 test opens the details of a message and uses option "Mover para...
  *   Modelos" of the message menu to move the message to that folder. After
  *   that, checks if the message is no longer in Inbox and is now in Modelos folder.
  *
  * - CTV3-1019
  *   http://comunidadeexpresso.serpro.gov.br/testlink/linkto.php?tprojectPrefix=CTV3&item=testcase&id=CTV3-1019
  *
  */
 public function test_CTV3_1019_Move_Open_Mail()
 {
     $mailPage = new MailPage($this);
     //load test data
     $MAIL_RECIPIENT = $this->getGlobalValue('user.1.email');
     $MAIL_SUBJECT = $this->getTestValue('mail.subject');
     //testStart
     $mailPage->sendMail(array($MAIL_RECIPIENT), $MAIL_SUBJECT, 'Move open email to Modelos folder');
     $this->waitForAjaxAndAnimations();
     $mailPage->clickRefreshButton();
     $mailPage->waitForEmailToArrive($MAIL_SUBJECT);
     $headlinesEntry = $mailPage->getHeadlinesEntryBySubject($MAIL_SUBJECT);
     $headlinesEntry->click();
     $this->waitForAjaxAndAnimations();
     $widgetMessages = $mailPage->getWidgetMessages();
     $messageUnit = $widgetMessages->getSingleMessageUnitInConversation();
     $messageUnit->clickMenuOptionMove('Modelos');
     $this->waitForAjaxAndAnimations();
     $headlinesEntry = $mailPage->getHeadlinesEntryBySubject($MAIL_SUBJECT);
     $this->assertNull($headlinesEntry, 'A mail with subject $MAIL_SUBJECT was moved, it could still be found in the inbox folder');
     $mailPage->clickOnFolderByName('Modelos');
     $this->waitForAjaxAndAnimations();
     $headlinesEntry = $mailPage->getHeadlinesEntryBySubject($MAIL_SUBJECT);
     $this->assertNotNull($headlinesEntry, 'A mail with subject $MAIL_SUBJECT was moved, but it could not be found on Modelos 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 __construct(MailPage $mailPage, $contactsAutocompleteFrame)
 {
     parent::__construct($mailPage->getTestCase(), $contactsAutocompleteFrame);
     $this->mailPage = $mailPage;
 }
 /**
  * Creates a test scenario to create a message in draft folder
  *
  * @param ExpressoLiteTest $test The test case that will create the scenario
  * @param stdObj $params A object containing all the necessary parameters for this scenario.
  * This object must have the following fields.
  *
  * senderLogin => login of the user that will create the draft
  * senderPassword => password of the user that will create the draft
  * recipentMail => the draft recipent's e-mail address
  * subject => subject of the draft
  * content => content of the draft
  */
 public static function createMessageDraft(ExpressoLiteTest $test, $params)
 {
     $test->doLogin($params->senderLogin, $params->senderPassword);
     $mailPage = new MailPage($test);
     $mailPage->clickWriteEmailButton();
     $widgetCompose = $mailPage->getWidgetCompose();
     $widgetCompose->clickOnRecipientField();
     $widgetCompose->type($params->recipentMail);
     $widgetCompose->typeEnter();
     $widgetCompose->typeSubject($params->subject);
     $widgetCompose->typeMessageBodyBeforeSignature($params->content);
     $widgetCompose->clickSaveDraftButton();
     $widgetCompose->waitForAjaxAndAnimations();
     $mailPage->clickLogout();
 }
 /**
  * Overview:
  * This test ,it is open and close the message.Selects and marks a message and
  * clicks the "Marcar como não lida" in menu option. Checks if the message was
  * really marked as unread
  *
  * - CTV3-1057
  *   http://comunidadeexpresso.serpro.gov.br/testlink/linkto.php?tprojectPrefix=CTV3&item=testcase&id=CTV3-1057
  */
 public function test_CTV3_1057_MarkUnreadOpenMail()
 {
     $mailPage = new MailPage($this);
     //load test data
     $MAIL_RECIPENT = $this->getGlobalValue('user.1.email');
     $MAIL_SUBJECT = $this->getTestValue('mail.subject');
     //testStart
     $mailPage->sendMail(array($MAIL_RECIPENT), $MAIL_SUBJECT, 'Marcando como não lido');
     $this->waitForAjaxAndAnimations();
     $mailPage->clickRefreshButton();
     $mailPage->waitForEmailToArrive($MAIL_SUBJECT);
     $headlinesEntry = $mailPage->getHeadlinesEntryBySubject($MAIL_SUBJECT);
     $headlinesEntry->click();
     $this->waitForAjaxAndAnimations();
     $widgetMessages = $mailPage->getWidgetMessages();
     $messageUnit = $widgetMessages->getSingleMessageUnitInConversation();
     $messageUnit->clickMenuOptionMove('Marcar como não lida');
     $this->waitForAjaxAndAnimations();
     $headlinesEntry = $mailPage->getHeadlinesEntryBySubject($MAIL_SUBJECT);
     $this->assertEquals(HeadlinesEntry::UNREAD_STATUS, $headlinesEntry->getReadStatus(), 'The message was marked as "Unread", but it was not changed');
 }
 /**
  * Overview:
  *
  * - This teste checks if the message changes its highlight status.
  *
  * - CTV3-892
  *   http://comunidadeexpresso.serpro.gov.br/testlink/linkto.php?tprojectPrefix=CTV3&item=testcase&id=CTV3-892
  *
  */
 public function test_CTV3_892_ToggleHighlightMail()
 {
     $mailPage = new MailPage($this);
     //load test data
     $MAIL_RECIPENT = $this->getGlobalValue('user.1.email');
     $MAIL_SUBJECT = $this->getTestValue('mail.subject');
     //testStart
     $mailPage->sendMail(array($MAIL_RECIPENT), $MAIL_SUBJECT, 'Changes its highlight');
     $this->waitForAjaxAndAnimations();
     $mailPage->clickRefreshButton();
     $mailPage->waitForEmailToArrive($MAIL_SUBJECT);
     $headlinesEntry = $mailPage->getHeadlinesEntryBySubject($MAIL_SUBJECT);
     $headlinesEntry->toggleCheckbox();
     $mailPage->clickMenuOptionHighlight();
     $this->waitForAjaxAndAnimations();
     $headlinesEntry = $mailPage->getHeadlinesEntryBySubject($MAIL_SUBJECT);
     $this->assertTrue($headlinesEntry->hasHighlightIcon(), 'Headline should have been listed as highlight, but it was not (BEFORE a refresh)');
     $mailPage->clickRefreshButton();
     $headlinesEntry = $mailPage->getHeadlinesEntryBySubject($MAIL_SUBJECT);
     $this->assertTrue($headlinesEntry->hasHighlightIcon(), 'Headline should have been listed as highlight, but it was not (AFTER a refresh)');
     $headlinesEntry->toggleCheckbox();
     $mailPage->clickMenuOptionHighlight();
     $this->waitForAjaxAndAnimations();
     $headlinesEntry = $mailPage->getHeadlinesEntryBySubject($MAIL_SUBJECT);
     $this->assertFalse($headlinesEntry->hasHighlightIcon(), 'Headline should not have been listed as highlight, but it was (BEFORE a refresh)');
     $mailPage->clickRefreshButton();
     $headlinesEntry = $mailPage->getHeadlinesEntryBySubject($MAIL_SUBJECT);
     $this->assertFalse($headlinesEntry->hasHighlightIcon(), 'Headline should not have been listed as highlight, but it was(AFTER a refresh)');
 }
 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');
 }
 public function test_Ctv3_1027_Check_Edit_Personal_Contact()
 {
     $USER_LOGIN = $this->getGlobalValue('user.1.login');
     $USER_PASSWORD = $this->getGlobalValue('user.1.password');
     $CONTACT_1_EMAIL = $this->getTestValue('contact.1.mail');
     $CONTACT_1_NAME = $this->getTestValue('contact.1.name');
     $FIELD_COMPANY = $this->getTestValue('field.company');
     $MAIL_SUBJECT = $this->getTestValue('mail.subject');
     $MAIL_CONTENT = $this->getTestValue('mail.content');
     //testStart
     $loginPage = new LoginPage($this);
     $loginPage->doLogin($USER_LOGIN, $USER_PASSWORD);
     //Sending an e-mail to generate the personal contact to be used in the test
     $mailPage = new MailPage($this);
     $mailPage->sendMail(array($CONTACT_1_EMAIL), $MAIL_SUBJECT, $MAIL_CONTENT);
     $mailPage->clickAddressbook();
     $addressbookPage = new AddressbookPage($this);
     $addressbookPage->clickPersonalCatalog();
     $this->waitForAjaxAndAnimations();
     $mailPage->clearSearchField();
     $mailPage->typeSearchText($CONTACT_1_NAME);
     $mailPage->clickSearchButton();
     $this->waitForAjaxAndAnimations();
     $contactListItem = $addressbookPage->getCatalogEntryByName($CONTACT_1_NAME);
     $contactListItem->click();
     $this->waitForAjaxAndAnimations();
     $widgetContactDetails = $addressbookPage->getWidgetContactDetails();
     // Checking other fields will only be possible when the system allows personal contact edition
     $this->assertEquals('true', $widgetContactDetails->isReadonlyField($FIELD_COMPANY), "The field '{$FIELD_COMPANY}' is not readonly");
 }
 /**
  * Creates a new WidgetMessages object
  *
  * @param MailPage $mailPage The mail page to which this object belongs
  * @param unknown $rightSection A reference to the right section that
  * contains the widget
  */
 public function __construct(MailPage $mailPage, $rightSection)
 {
     parent::__construct($mailPage->getTestCase(), $rightSection);
     $this->mailPage = $mailPage;
 }
 /**
  * Creates a new HeadlinesEntry object
  *
  * @param MailPage $mailPage The mail page to which this entry belongs
  * @param unknown $headlinesEntryDiv A reference to the main div of this headline
  */
 public function __construct(MailPage $mailPage, $headlinesEntryDiv)
 {
     parent::__construct($mailPage->getTestCase(), $headlinesEntryDiv);
     $this->mailPage = $mailPage;
 }
 /**
  * Tests sending a simple e-mail,with cc and checking if the e-mail composition
  * screen opens and close as expected. Also checks if the recipients copy receives
  * the e-mail.
  *
  *   CTV3-1052
  *   http://comunidadeexpresso.serpro.gov.br/testlink/linkto.php?tprojectPrefix=CTV3&item=testcase&id=CTV3-1052
  */
 public function test_CTV3_1052_Send_Bcc_Mail()
 {
     $mailPage = new MailPage($this);
     //load test data
     $MAIL_BCC_RECIPIENT = $this->getGlobalValue('user.2.email');
     $MAIL_SENDER = $this->getGlobalValue('user.2.email');
     $MAIL_SUBJECT = $this->getTestValue('mail.subject');
     $MAIL_CONTENT = $this->getTestValue('mail.content');
     //testStart
     $mailPage->clickWriteEmailButton();
     $widgetCompose = $mailPage->getWidgetCompose();
     $this->assertTrue($widgetCompose->isDisplayed(), 'Compose Window should be displayed, but it is not');
     $widgetCompose->clickOnBccToggleButton();
     $this->waitForAjaxAndAnimations();
     $widgetCompose->type($MAIL_BCC_RECIPIENT);
     $widgetCompose->typeEnter();
     $widgetCompose->typeSubject($MAIL_SUBJECT);
     $widgetCompose->typeMessageBodyBeforeSignature($MAIL_CONTENT);
     $widgetCompose->clickSendMailButton();
     $this->waitForAjaxAndAnimations();
     $this->assertFalse($widgetCompose->isDisplayed(), 'Compose Window should have been closed, but it is still visible');
     $mailPage->clickRefreshButton();
     $this->waitForAjaxAndAnimations();
     $mailPage->waitForEmailToArrive($MAIL_SUBJECT);
     $headlinesEntry = $mailPage->clickOnHeadlineBySubject($MAIL_SUBJECT);
     $widgetMessages = $mailPage->getWidgetMessages();
     $messageUnit = $widgetMessages->getSingleMessageUnitInConversation();
     $this->assertContains('(ninguém)', $messageUnit->getToAddresses(), 'The to address content differs from the expected');
     $this->assertFalse($messageUnit->isBccAddressesDisplayed(), 'Bcc tag should not have been displayed, but it was');
     $mailPage->clickLayoutBackButton();
     $this->waitForAjaxAndAnimations();
     $mailPage->clickOnFolderByName('Enviados');
     $this->waitForAjaxAndAnimations();
     $headlinesEntry = $mailPage->getHeadlinesEntryBySubject($MAIL_SUBJECT);
     $this->assertNotNull($headlinesEntry, "A mail with subject {$MAIL_SUBJECT} was sent, but it could not be found on Sent folder");
     $headlinesEntry->click();
     $this->waitForAjaxAndAnimations();
     $widgetMessages = $mailPage->getWidgetMessages();
     $messageUnit = $widgetMessages->getSingleMessageUnitInConversation();
     $this->assertContains('(ninguém)', $messageUnit->getToAddresses(), 'The to address content differs from the expected');
     $this->assertEquals("({$MAIL_SENDER})", $messageUnit->getFromMail(), 'Message sender mail does not match');
     $this->assertContains("{$MAIL_SENDER}", $messageUnit->getBccAddresses(), 'Message bcc recipient mail does not match');
 }
 /**
  * Checks the reply e-mail feature. In this test, user 1 sends an e-mail
  * to new user and this recipient is saved in the personal catalog
  *
  * CTV3-1015
  * http://comunidadeexpresso.serpro.gov.br/testlink/linkto.php?tprojectPrefix=CTV3&item=testcase&id=CTV3-1015
  */
 public function test_CTV3_1015_Send_Mail_Saved_Recipient()
 {
     //load test data
     $SENDER_LOGIN = $this->getGlobalValue('user.1.login');
     $SENDER_PASSWORD = $this->getGlobalValue('user.1.password');
     $RECIPIENT_MAIL = $this->getTestValue('recipient.mail');
     $RECIPIENT_NAME = $this->getTestValue('recipient.name');
     $MAIL_SUBJECT = $this->getTestValue('mail.subject');
     $MAIL_CONTENT = $this->getTestValue('mail.content');
     //testStart
     $loginPage = new LoginPage($this);
     $loginPage->doLogin($SENDER_LOGIN, $SENDER_PASSWORD);
     $mailPage = new MailPage($this);
     $mailPage->sendMail(array($RECIPIENT_MAIL), $MAIL_SUBJECT, $MAIL_CONTENT);
     $mailPage->clickAddressbook();
     $addressbookPage = new AddressbookPage($this);
     $addressbookPage->clickPersonalCatalog();
     $this->waitForAjaxAndAnimations();
     $contactListItem = $addressbookPage->getCatalogEntryByName($RECIPIENT_NAME);
     $this->assertEquals($RECIPIENT_NAME, $contactListItem->getNameFromContact(), 'Mail was send but, the new recipient is not created in personal catalog ');
 }
 /**
  * Overview:
  *
  * - This teste checks if the message has the search criteria in the folder.
  *
  * - CTV3-893
  *   http://comunidadeexpresso.serpro.gov.br/testlink/linkto.php?tprojectPrefix=CTV3&item=testcase&id=CTV3-893
  */
 public function test_CTV3_893_Find_Search_Text()
 {
     $mailPage = new MailPage($this);
     //load test data
     $MAIL_RECIPENT = $this->getGlobalValue('user.1.email');
     $MAIL1_SUBJECT = $this->getTestValue('mail1.subject');
     $MAIL1_CONTENT = $this->getTestValue('mail1.content');
     $MAIL2_SUBJECT = $this->getTestValue('mail2.subject');
     $MAIL2_CONTENT = $this->getTestValue('mail2.content');
     $MAIL3_SUBJECT = $this->getTestValue('mail3.subject');
     $MAIL3_CONTENT = $this->getTestValue('mail3.content');
     $COMMON_TEXT_FRAGMENT = $this->getTestValue('common.text.fragment');
     $INEXISTENT_TEXT_FRAGMENT = $this->getTestValue('inexistent.text.fragment');
     //testStart
     $mailPage->sendMail(array($MAIL_RECIPENT), $MAIL1_SUBJECT, $MAIL1_CONTENT);
     $this->waitForAjaxAndAnimations();
     $mailPage->sendMail(array($MAIL_RECIPENT), $MAIL2_SUBJECT, $MAIL2_CONTENT);
     $this->waitForAjaxAndAnimations();
     $mailPage->sendMail(array($MAIL_RECIPENT), $MAIL2_SUBJECT, $MAIL2_CONTENT);
     $this->waitForAjaxAndAnimations();
     $mailPage->sendMail(array($MAIL_RECIPENT), $MAIL3_SUBJECT, $MAIL3_CONTENT);
     $this->waitForAjaxAndAnimations();
     $mailPage->waitForEmailToArrive($MAIL1_SUBJECT);
     $mailPage->waitForEmailToArrive($MAIL2_SUBJECT);
     $mailPage->waitForEmailToArrive($MAIL3_SUBJECT);
     $mailPage->typeSearchText($COMMON_TEXT_FRAGMENT);
     $mailPage->clickSearchButton();
     $this->waitForAjaxAndAnimations();
     $messages = $mailPage->getArrayOfHeadlinesEntries();
     $this->assertEquals(3, count($messages), 'There are diferent number of messages after find criteria applied');
     $mailPage->clearSearchField();
     $mailPage->clickSearchButton();
     $this->waitForAjaxAndAnimations();
     $mailPage->typeSearchText($INEXISTENT_TEXT_FRAGMENT);
     $mailPage->clickSearchButton();
     $this->waitForAjaxAndAnimations();
     $messages = $mailPage->getArrayOfHeadlinesEntries();
     $this->assertEquals(0, count($messages), 'The total of messages differs from zero after find criteria applied');
 }