3 +--------------------------------------------------------------------+
4 | CiviCRM version 4.6 |
5 +--------------------------------------------------------------------+
6 | Copyright CiviCRM LLC (c) 2004-2014 |
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_TaskActionSendSMS
32 class WebTest_Contact_TaskActionSendSMS
extends CiviSeleniumTestCase
{
34 protected function setUp() {
38 public function testSMSToContacts() {
39 $this->webtestLogin();
42 $this->openCiviPage("group/add", "reset=1", "_qf_Edit_upload");
44 $smsGroupName = 'group_' . substr(sha1(rand()), 0, 7);
46 $this->type("title", $smsGroupName);
47 $this->type("description", "New sms group for Webtest");
48 $this->select("visibility", "value=Public Pages");
50 $this->click("_qf_Edit_upload");
51 $this->waitForPageToLoad($this->getTimeoutMsec());
54 $this->openCiviPage("contact/add", "reset=1&ct=Individual");
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->waitForText('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->waitForText('crm-notification-container', "Added to Group");
78 $this->openCiviPage("contact/add", "reset=1&ct=Individual");
79 $firstName = substr(sha1(rand()), 0, 7);
80 $this->type('first_name', $firstName);
82 $lastName = substr(sha1(rand()), 0, 7);
83 $this->type('last_name', $lastName);
85 $this->waitForElementPresent('phone_1_phone');
86 $this->type('phone_1_phone', "911234567891");
88 $this->select('phone_1_phone_type_id', 'label=Mobile');
90 $this->click("_qf_Contact_upload_view");
91 $this->waitForPageToLoad($this->getTimeoutMsec());
92 $this->waitForText('crm-notification-container', "Contact Saved");
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());
99 $this->waitForText('crm-notification-container', "Added to Group");
101 // Do an advanced search
102 $this->click("css=ul#civicrm-menu li.crm-Search");
103 $this->clickLink("css=ul#civicrm-menu li.crm-Advanced_Search a", "email");
105 $this->select("crmasmSelect1", "label=$smsGroupName");
107 $this->clickLink("_qf_Advanced_refresh", 'CIVICRM_QFID_ts_all_12');
108 $this->click('CIVICRM_QFID_ts_all_12');
110 // Perform a task action
111 $this->select("task", "label=Send SMS to Contacts");
112 $this->clickLink("Go", 'activity_subject');
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());
118 $this->assertTrue($this->isTextPresent('Your message has been sent.'), "Test SMS could not be sent!");