Commit | Line | Data |
---|---|---|
6a488035 TO |
1 | <?php |
2 | /* | |
3 | +--------------------------------------------------------------------+ | |
81621fee | 4 | | CiviCRM version 4.7 | |
6a488035 | 5 | +--------------------------------------------------------------------+ |
e7112fa7 | 6 | | Copyright CiviCRM LLC (c) 2004-2015 | |
6a488035 TO |
7 | +--------------------------------------------------------------------+ |
8 | | This file is a part of CiviCRM. | | |
9 | | | | |
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. | | |
13 | | | | |
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. | | |
18 | | | | |
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 | +--------------------------------------------------------------------+ | |
d25dd0ee | 25 | */ |
6a488035 | 26 | |
6a488035 | 27 | require_once 'CiviTest/CiviSeleniumTestCase.php'; |
e9479dcf EM |
28 | |
29 | /** | |
30 | * Class WebTest_Contact_TaskActionSendMassMailing | |
31 | */ | |
6a488035 TO |
32 | class WebTest_Contact_TaskActionSendMassMailing extends CiviSeleniumTestCase { |
33 | ||
34 | protected function setUp() { | |
35 | parent::setUp(); | |
36 | } | |
37 | ||
00be9182 | 38 | public function testSelectedContacts() { |
6a488035 TO |
39 | $this->webtestLogin(); |
40 | ||
225a8648 | 41 | // make group |
6a488035 | 42 | $groupName = 'group_' . substr(sha1(rand()), 0, 7); |
225a8648 | 43 | $this->WebtestAddGroup($groupName); |
6a488035 TO |
44 | |
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"); | |
225a8648 | 47 | $this->clickLink("css=ul#civicrm-menu li.crm-Advanced_Search a", "email"); |
6a488035 | 48 | |
6a488035 TO |
49 | $this->click("_qf_Advanced_refresh"); |
50 | $this->waitForPageToLoad($this->getTimeoutMsec()); | |
51 | ||
6a488035 TO |
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"); | |
2053a3e9 | 54 | $this->waitForText('search-status', "50 Selected records only"); |
7f82e636 | 55 | $this->select("task", "label=Email - schedule/send via CiviMail"); |
2053a3e9 | 56 | $this->clickLink("Go"); |
6a488035 TO |
57 | |
58 | //-------select recipients---------- | |
59 | ||
60 | $mailingName = 'Selected Contact Mailing Test ' . substr(sha1(rand()), 0, 7); | |
61 | ||
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"); | |
67 | ||
68 | //--------track and respond---------- | |
69 | ||
70 | $this->waitForElementPresent("_qf_Settings_next"); | |
71 | ||
72 | // check for default settings options | |
73 | $this->assertChecked("url_tracking"); | |
74 | $this->assertChecked("open_tracking"); | |
75 | ||
76 | $this->click("_qf_Settings_next"); | |
77 | ||
78 | //--------Mailing content------------ | |
79 | // fill subject for mailing | |
80 | $this->waitForElementPresent("subject"); | |
81 | $this->type("subject", "Test subject {$mailingName} for Webtest"); | |
82 | ||
83 | // check for default option enabled | |
2053a3e9 | 84 | $this->assertChecked("CIVICRM_QFID_1_upload_type"); |
6a488035 TO |
85 | |
86 | // HTML format message | |
87 | $HTMLMessage = "This is HTML formatted content for Mailing {$mailingName} Webtest."; | |
88 | $this->fillRichTextField("html_message", $HTMLMessage); | |
89 | ||
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."); | |
93 | ||
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"); | |
98 | ||
99 | $this->waitForElementPresent("_qf_Test_next"); | |
100 | $this->click("_qf_Test_next"); | |
101 | ||
102 | //----------Schedule or Send------------ | |
103 | ||
104 | $this->waitForElementPresent("_qf_Schedule_next"); | |
105 | ||
106 | $this->assertChecked("now"); | |
107 | ||
108 | $this->click("_qf_Schedule_next"); | |
109 | $this->waitForPageToLoad($this->getTimeoutMsec()); | |
110 | ||
111 | //----------end New Mailing------------- | |
112 | ||
113 | //check redirected page to Scheduled and Sent Mailings and verify for mailing name | |
2053a3e9 RN |
114 | $this->waitForText('page-title', "Scheduled and Sent Mailings"); |
115 | $this->waitForText('css=.selector', "$mailingName"); | |
6a488035 TO |
116 | |
117 | //--------- mail delivery verification--------- | |
118 | ||
119 | // test undelivered report | |
120 | ||
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()); | |
124 | ||
125 | // verify undelivered status message | |
2053a3e9 | 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."); |
6a488035 TO |
127 | |
128 | // directly send schedule mailing -- not working right now | |
071a6d2e | 129 | $this->openCiviPage("mailing/queue", "reset=1"); |
6a488035 TO |
130 | |
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()); | |
134 | } | |
96025800 | 135 | |
6a488035 | 136 | } |