+--------------------------------------------------------------------+
*/
-
require_once 'CiviTest/CiviSeleniumTestCase.php';
class WebTest_Mailing_MailingTest extends CiviSeleniumTestCase {
}
function testAddMailing() {
- $this->open($this->sboxPath);
$this->webtestLogin();
//----do create test mailing group
- // Go directly to the URL of the screen that you will be testing (New Group).
$this->openCiviPage("group/add", "reset=1", "_qf_Edit_upload");
// make group name
$this->click("css=li#tab_group a");
$this->waitForElementPresent("_qf_GroupContact_next");
$this->select("group_id", "$groupName");
- $this->click("_qf_GroupContact_next");
- $this->waitForPageToLoad($this->getTimeoutMsec());
- $this->waitForElementPresent("_qf_GroupContact_next");
+ $this->clickLink("_qf_GroupContact_next", "_qf_GroupContact_next");
// configure default mail-box
- $this->openCiviPage("admin/mailSettings", "action=update&id=1&reset=1", '_qf_MailSettings_cancel-bottom');
- $this->type('name', 'Test Domain');
- $this->type('domain', 'example.com');
- $this->select('protocol', 'value=1');
- $this->click('_qf_MailSettings_next-bottom');
- $this->waitForPageToLoad($this->getTimeoutMsec());
+ $this->setupDefaultMailbox();
- // Go directly to Schedule and Send Mailing form
$this->openCiviPage("mailing/send", "reset=1", "_qf_Group_cancel");
//-------select recipients----------
// verify email
$this->verifyText("xpath=//table[@id='mailing_event']/tbody//tr/td[2]", preg_quote("mailino$firstName@mailson.co.in"));
- require_once 'CRM/Mailing/Event/DAO/Queue.php';
$eventQueue = new CRM_Mailing_Event_DAO_Queue();
$eventQueue->contact_id = $contactId;
$eventQueue->find(TRUE);
$permission = array('edit-1-access-civimail-subscribeunsubscribe-pages');
$this->changePermissions($permission);
- $this->openCiviPage('logout', 'reset=1', NULL);
+ $this->webtestLogout();
// build forward url
$forwardUrl = array("mailing/forward", "reset=1&jid={$eventQueue->job_id}&qid={$eventQueue->id}&h={$eventQueue->hash}");
$this->waitForPageToLoad($this->getTimeoutMsec());
$this->assertElementContainsText('css=div.messages', 'Mailing is forwarded successfully to 2 email addresses');
- $this->open($this->sboxPath);
$this->waitForPageToLoad($this->getTimeoutMsec());
$this->webtestLogin();
// $unsubscribeUrl = "civicrm/mailing/optout?reset=1&jid={$eventQueue->job_id}&qid={$eventQueue->id}&h={$eventQueue->hash}&confirm=1";
// // logout to unsubscribe
- // $this->open($this->sboxPath . 'civicrm/logout?reset=1');
- // $this->waitForPageToLoad($this->getTimeoutMsec());
+ // $this->webtestLogout();
// // click(visit) unsubscribe path
// $this->open($this->sboxPath . $unsubscribeUrl);
// //------ end unsubscribe -------
}
-
+
function testAdvanceSearchAndReportCheck() {
- $this->open($this->sboxPath);
$this->webtestLogin();
- // Go directly to the URL of the screen that you will be testing (New Group).
$this->openCiviPage("group/add", "reset=1", "_qf_Edit_upload");
// make group name
$this->click("css=li#tab_group a");
$this->waitForElementPresent("_qf_GroupContact_next");
$this->select("group_id", "$groupName");
- $this->click("_qf_GroupContact_next");
- $this->waitForPageToLoad($this->getTimeoutMsec());
- $this->waitForElementPresent("_qf_GroupContact_next");
+ $this->clickLink("_qf_GroupContact_next", "_qf_GroupContact_next");
// configure default mail-box
$this->openCiviPage("admin/mailSettings", "action=update&id=1&reset=1", '_qf_MailSettings_cancel-bottom');
$this->click('_qf_MailSettings_next-bottom');
$this->waitForPageToLoad($this->getTimeoutMsec());
- // Go directly to Schedule and Send Mailing form
+ // Go to Schedule and Send Mailing form
$this->openCiviPage('mailing/send', 'reset=1', '_qf_Group_cancel');
//-------select recipients----------
// fill subject for mailing
$this->type("subject", "Test subject {$mailingName} for Webtest");
-
+
// check for default option enabled
$this->assertChecked("CIVICRM_QFID_1_upload_type");
$this->verifyText("xpath=//table//tr[td/a[text()='Successful Deliveries']]/descendant::td[2]", preg_quote("1 (100.00%)"));
$summaryInfoLinks = array('Intended Recipients', 'Successful Deliveries', 'Tracked Opens', 'Click-throughs', 'Forwards', 'Replies', 'Bounces', 'Unsubscribe Requests','Opt-out Requests');
-
+
//check for report and adv search links
foreach($summaryInfoLinks as $value) {
$this->assertTrue($this->isElementPresent("xpath=//fieldset/legend[text()='Delivery Summary']/../table//tr[td/a[text()='{$value}']]/descendant::td[3]/span/a[1][text()='Report']"), "Report link missing for {$value}");
}
}
}
-}
\ No newline at end of file
+}