3 +--------------------------------------------------------------------+
4 | CiviCRM version 4.6 |
5 +--------------------------------------------------------------------+
6 | Copyright CiviCRM LLC (c) 2004-2015 |
7 +--------------------------------------------------------------------+
8 | This file is a part of CiviCRM. |
10 | CiviCRM is free software; you can copy, modify, and distribute it |
11 | under the terms of the GNU Affero General Public License |
12 | Version 3, 19 November 2007 and the CiviCRM Licensing Exception. |
14 | CiviCRM is distributed in the hope that it will be useful, but |
15 | WITHOUT ANY WARRANTY; without even the implied warranty of |
16 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. |
17 | See the GNU Affero General Public License for more details. |
19 | You should have received a copy of the GNU Affero General Public |
20 | License along with this program; if not, contact CiviCRM LLC |
21 | at info[AT]civicrm[DOT]org. If you have questions about the |
22 | GNU Affero General Public License or the licensing of CiviCRM, |
23 | see the CiviCRM license FAQ at http://civicrm.org/licensing |
24 +--------------------------------------------------------------------+
27 require_once 'CiviTest/CiviSeleniumTestCase.php';
30 * Class WebTest_Contact_TaskActionSendMassMailing
32 class WebTest_Contact_TaskActionSendMassMailing
extends CiviSeleniumTestCase
{
34 protected function setUp() {
38 public function testSelectedContacts() {
39 $this->webtestLogin();
42 $groupName = 'group_' . substr(sha1(rand()), 0, 7);
43 $this->WebtestAddGroup($groupName);
45 // Use class names for menu items since li array can change based on which components are enabled
46 $this->click("css=ul#civicrm-menu li.crm-Search");
47 $this->clickLink("css=ul#civicrm-menu li.crm-Advanced_Search a", "email");
49 $this->click("_qf_Advanced_refresh");
50 $this->waitForPageToLoad($this->getTimeoutMsec());
52 // Click "check all" box and act on "Add to group" action
53 $this->click("//form[@id='Advanced']/div[3]/div/div[2]/table/thead/tr/th[1]/input");
54 $this->waitForText('search-status', "50 Selected records only");
55 $this->select("task", "label=Schedule/Send a Mass Mailing");
56 $this->clickLink("Go");
58 //-------select recipients----------
60 $mailingName = 'Selected Contact Mailing Test ' . substr(sha1(rand()), 0, 7);
62 $this->waitForElementPresent("name");
63 $this->type("name", "$mailingName");
64 $this->select("baseGroup", "label=$groupName");
65 $this->click("//option[@value='4']");
66 $this->click("_qf_Group_next");
68 //--------track and respond----------
70 $this->waitForElementPresent("_qf_Settings_next");
72 // check for default settings options
73 $this->assertChecked("url_tracking");
74 $this->assertChecked("open_tracking");
76 $this->click("_qf_Settings_next");
78 //--------Mailing content------------
79 // fill subject for mailing
80 $this->waitForElementPresent("subject");
81 $this->type("subject", "Test subject {$mailingName} for Webtest");
83 // check for default option enabled
84 $this->assertChecked("CIVICRM_QFID_1_upload_type");
86 // HTML format message
87 $HTMLMessage = "This is HTML formatted content for Mailing {$mailingName} Webtest.";
88 $this->fillRichTextField("html_message", $HTMLMessage);
90 // Open Plain-text Format pane and type text format msg
91 $this->click("//fieldset[@id='compose_id']/div[2]/div[1]");
92 $this->type("text_message", "This is text formatted content for Mailing {$mailingName} Webtest.");
94 // select default header and footer ( with label )
95 $this->select("header_id", "label=Mailing Header");
96 $this->select("footer_id", "label=Mailing Footer");
97 $this->click("_qf_Upload_upload");
99 $this->waitForElementPresent("_qf_Test_next");
100 $this->click("_qf_Test_next");
102 //----------Schedule or Send------------
104 $this->waitForElementPresent("_qf_Schedule_next");
106 $this->assertChecked("now");
108 $this->click("_qf_Schedule_next");
109 $this->waitForPageToLoad($this->getTimeoutMsec());
111 //----------end New Mailing-------------
113 //check redirected page to Scheduled and Sent Mailings and verify for mailing name
114 $this->waitForText('page-title', "Scheduled and Sent Mailings");
115 $this->waitForText('css=.selector', "$mailingName");
117 //--------- mail delivery verification---------
119 // test undelivered report
121 // click report link of created mailing
122 $this->click("xpath=//table//tbody/tr[td[1]/text()='$mailingName']/descendant::a[text()='Report']");
123 $this->waitForPageToLoad($this->getTimeoutMsec());
125 // verify undelivered status message
126 $this->waitForText("css=.messages", "Delivery has not yet begun for this mailing. If the scheduled delivery date and time is past, ask the system administrator or technical support contact for your site to verify that the automated mailer task \('cron job'\) is running - and how frequently.");
128 // directly send schedule mailing -- not working right now
129 $this->openCiviPage("mailing/queue", "reset=1");
131 //click report link of created mailing
132 $this->click("xpath=//table//tbody/tr[td[1]/text()='$mailingName']/descendant::a[text()='Report']");
133 $this->waitForPageToLoad($this->getTimeoutMsec());