Commit | Line | Data |
---|---|---|
6a488035 TO |
1 | <?php |
2 | /* | |
3 | +--------------------------------------------------------------------+ | |
81621fee | 4 | | CiviCRM version 4.7 | |
6a488035 | 5 | +--------------------------------------------------------------------+ |
fa938177 | 6 | | Copyright CiviCRM LLC (c) 2004-2016 | |
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_TaskActionSendSMS | |
31 | */ | |
6a488035 TO |
32 | class WebTest_Contact_TaskActionSendSMS extends CiviSeleniumTestCase { |
33 | ||
34 | protected function setUp() { | |
35 | parent::setUp(); | |
36 | } | |
37 | ||
00be9182 | 38 | public function testSMSToContacts() { |
6a488035 TO |
39 | $this->webtestLogin(); |
40 | ||
41 | // ADD a New Group | |
42daf119 | 42 | $this->openCiviPage("group/add", "reset=1", "_qf_Edit_upload"); |
6a488035 TO |
43 | |
44 | $smsGroupName = 'group_' . substr(sha1(rand()), 0, 7); | |
45 | ||
46 | $this->type("title", $smsGroupName); | |
47 | $this->type("description", "New sms group for Webtest"); | |
48 | $this->select("visibility", "value=Public Pages"); | |
49 | ||
50 | $this->click("_qf_Edit_upload"); | |
51 | $this->waitForPageToLoad($this->getTimeoutMsec()); | |
52 | ||
53 | // ADD contact1 | |
071a6d2e | 54 | $this->openCiviPage("contact/add", "reset=1&ct=Individual"); |
6a488035 TO |
55 | $firstName = substr(sha1(rand()), 0, 7); |
56 | $this->type('first_name', $firstName); | |
57 | ||
58 | $lastName = substr(sha1(rand()), 0, 7); | |
59 | $this->type('last_name', $lastName); | |
60 | ||
61 | $this->waitForElementPresent('phone_1_phone'); | |
62 | $this->type('phone_1_phone', "911234567890"); | |
63 | ||
64 | $this->select('phone_1_phone_type_id', 'label=Mobile'); | |
65 | ||
66 | $this->click("_qf_Contact_upload_view"); | |
67 | $this->waitForPageToLoad($this->getTimeoutMsec()); | |
6c5f7368 | 68 | $this->waitForText('crm-notification-container', "Contact Saved"); |
6a488035 TO |
69 | |
70 | $this->click('css=li#tab_group a'); | |
71 | $this->waitForElementPresent('_qf_GroupContact_next'); | |
72 | $this->select('group_id', "label=$smsGroupName"); | |
73 | $this->click('_qf_GroupContact_next'); | |
74 | $this->waitForPageToLoad($this->getTimeoutMsec()); | |
6c5f7368 | 75 | $this->waitForText('crm-notification-container', "Added to Group"); |
6a488035 TO |
76 | |
77 | // ADD contact2 | |
071a6d2e | 78 | $this->openCiviPage("contact/add", "reset=1&ct=Individual"); |
6a488035 TO |
79 | $firstName = substr(sha1(rand()), 0, 7); |
80 | $this->type('first_name', $firstName); | |
81 | ||
82 | $lastName = substr(sha1(rand()), 0, 7); | |
83 | $this->type('last_name', $lastName); | |
84 | ||
85 | $this->waitForElementPresent('phone_1_phone'); | |
86 | $this->type('phone_1_phone', "911234567891"); | |
87 | ||
88 | $this->select('phone_1_phone_type_id', 'label=Mobile'); | |
89 | ||
90 | $this->click("_qf_Contact_upload_view"); | |
91 | $this->waitForPageToLoad($this->getTimeoutMsec()); | |
6c5f7368 | 92 | $this->waitForText('crm-notification-container', "Contact Saved"); |
6a488035 TO |
93 | |
94 | $this->click('css=li#tab_group a'); | |
95 | $this->waitForElementPresent('_qf_GroupContact_next'); | |
96 | $this->select('group_id', "label=$smsGroupName"); | |
97 | $this->click('_qf_GroupContact_next'); | |
98 | $this->waitForPageToLoad($this->getTimeoutMsec()); | |
6c5f7368 | 99 | $this->waitForText('crm-notification-container', "Added to Group"); |
6a488035 TO |
100 | |
101 | // Do an advanced search | |
102 | $this->click("css=ul#civicrm-menu li.crm-Search"); | |
225a8648 | 103 | $this->clickLink("css=ul#civicrm-menu li.crm-Advanced_Search a", "email"); |
6a488035 TO |
104 | |
105 | $this->select("crmasmSelect1", "label=$smsGroupName"); | |
106 | ||
225a8648 | 107 | $this->clickLink("_qf_Advanced_refresh", 'CIVICRM_QFID_ts_all_12'); |
6a488035 TO |
108 | $this->click('CIVICRM_QFID_ts_all_12'); |
109 | ||
110 | // Perform a task action | |
7f82e636 | 111 | $this->select("task", "label=SMS - schedule/send"); |
225a8648 | 112 | $this->clickLink("Go", 'activity_subject'); |
6a488035 TO |
113 | $this->type('activity_subject', "Send SMS to Contacts of {$smsGroupName}"); |
114 | $this->type('text_message', "Test SMS to Contacts of {$smsGroupName}"); | |
115 | $this->click("_qf_SMS_upload-bottom"); | |
116 | $this->waitForPageToLoad($this->getTimeoutMsec()); | |
117 | ||
118 | $this->assertTrue($this->isTextPresent('Your message has been sent.'), "Test SMS could not be sent!"); | |
119 | } | |
96025800 | 120 | |
6a488035 | 121 | } |