3 +--------------------------------------------------------------------+
4 | CiviCRM version 4.3 |
5 +--------------------------------------------------------------------+
6 | Copyright CiviCRM LLC (c) 2004-2013 |
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 +--------------------------------------------------------------------+
28 require_once 'CiviTest/CiviSeleniumTestCase.php';
29 class WebTest_Contact_TaskActionSendSMS
extends CiviSeleniumTestCase
{
31 protected function setUp() {
35 function testSMSToContacts() {
36 $this->open($this->sboxPath
);
37 $this->webtestLogin();
40 $this->open($this->sboxPath
. "civicrm/group/add?reset=1");
41 $this->waitForElementPresent("_qf_Edit_upload");
43 $smsGroupName = 'group_' . substr(sha1(rand()), 0, 7);
45 $this->type("title", $smsGroupName);
46 $this->type("description", "New sms group for Webtest");
47 $this->select("visibility", "value=Public Pages");
49 $this->click("_qf_Edit_upload");
50 $this->waitForPageToLoad($this->getTimeoutMsec());
53 $this->open($this->sboxPath
. "civicrm/contact/add?reset=1&ct=Individual");
54 $this->waitForPageToLoad($this->getTimeoutMsec());
55 $firstName = substr(sha1(rand()), 0, 7);
56 $this->type('first_name', $firstName);
58 $lastName = substr(sha1(rand()), 0, 7);
59 $this->type('last_name', $lastName);
61 $this->waitForElementPresent('phone_1_phone');
62 $this->type('phone_1_phone', "911234567890");
64 $this->select('phone_1_phone_type_id', 'label=Mobile');
66 $this->click("_qf_Contact_upload_view");
67 $this->waitForPageToLoad($this->getTimeoutMsec());
68 $this->assertElementContainsText('crm-notification-container', "Contact Saved");
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());
75 $this->assertElementContainsText('crm-notification-container', "Added to Group");
78 $this->open($this->sboxPath
. "civicrm/contact/add?reset=1&ct=Individual");
79 $this->waitForPageToLoad($this->getTimeoutMsec());
80 $firstName = substr(sha1(rand()), 0, 7);
81 $this->type('first_name', $firstName);
83 $lastName = substr(sha1(rand()), 0, 7);
84 $this->type('last_name', $lastName);
86 $this->waitForElementPresent('phone_1_phone');
87 $this->type('phone_1_phone', "911234567891");
89 $this->select('phone_1_phone_type_id', 'label=Mobile');
91 $this->click("_qf_Contact_upload_view");
92 $this->waitForPageToLoad($this->getTimeoutMsec());
93 $this->assertElementContainsText('crm-notification-container', "Contact Saved");
95 $this->click('css=li#tab_group a');
96 $this->waitForElementPresent('_qf_GroupContact_next');
97 $this->select('group_id', "label=$smsGroupName");
98 $this->click('_qf_GroupContact_next');
99 $this->waitForPageToLoad($this->getTimeoutMsec());
100 $this->assertElementContainsText('crm-notification-container', "Added to Group");
102 // Do an advanced search
103 $this->click("css=ul#civicrm-menu li.crm-Search");
104 $this->click("css=ul#civicrm-menu li.crm-Advanced_Search a");
106 $this->waitForPageToLoad($this->getTimeoutMsec());
107 $this->waitForElementPresent("email");
109 $this->select("crmasmSelect1", "label=$smsGroupName");
111 $this->click("_qf_Advanced_refresh");
112 $this->waitForPageToLoad($this->getTimeoutMsec());
114 $this->waitForElementPresent('CIVICRM_QFID_ts_all_12');
115 $this->click('CIVICRM_QFID_ts_all_12');
117 // Perform a task action
118 $this->select("task", "label=Send SMS to Contacts");
120 $this->waitForPageToLoad($this->getTimeoutMsec());
122 $this->waitForElementPresent('activity_subject');
123 $this->type('activity_subject', "Send SMS to Contacts of {$smsGroupName}");
124 $this->type('text_message', "Test SMS to Contacts of {$smsGroupName}");
125 $this->click("_qf_SMS_upload-bottom");
126 $this->waitForPageToLoad($this->getTimeoutMsec());
128 $this->assertTrue($this->isTextPresent('Your message has been sent.'), "Test SMS could not be sent!");