3 +--------------------------------------------------------------------+
4 | CiviCRM version 4.5 |
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_Event_ParticipantSearchTest
32 class WebTest_Event_ParticipantSearchTest
extends CiviSeleniumTestCase
{
34 protected function setUp() {
41 function _checkStrings(&$strings) {
42 // search for elements
43 foreach ($strings as $string) {
44 $this->assertTrue($this->isTextPresent($string), "Could not find $string on page");
48 function testParticipantSearchForm() {
49 $this->webtestLogin();
51 // visit event search page
52 $this->openCiviPage("event/search", "reset=1");
54 $stringsToCheck = array(
60 'Participant is a Test?',
61 'Participant is Pay Later?',
64 // check that the custom data is also there
68 $this->_checkStrings($stringsToCheck);
71 function testParticipantSearchForce() {
72 $this->webtestLogin();
74 // visit event search page
75 $this->openCiviPage("event/search", "reset=1&force=1");
77 // assume generated DB
78 // there are participants
79 $this->assertTrue($this->isTextPresent("Select Records"), "A forced event search did not return any results");
82 function testParticipantSearchEmpty() {
83 $this->webtestLogin();
85 // visit event search page
86 $this->openCiviPage("event/search", "reset=1");
88 $crypticName = "foobardoogoo_" . md5(time());
89 $this->type("sort_name", $crypticName);
91 $this->clickLink("_qf_Search_refresh");
93 $stringsToCheck = array(
94 'No matches found for',
99 $this->_checkStrings($stringsToCheck);
102 function testParticipantSearchEventName() {
103 $this->webtestLogin();
105 // visit event search page
106 $this->openCiviPage("event/search", "reset=1");
107 $this->waitForElementPresent('_qf_Search_refresh');
109 $eventName = "Fall Fundraiser Dinner";
110 $this->select2("event_id", $eventName);
112 $this->clickLink("_qf_Search_refresh", "search-status");
114 $stringsToCheck = array(
115 "Event = $eventName",
117 'Edit Search Criteria',
120 $this->_checkStrings($stringsToCheck);
123 function testParticipantSearchEventDate() {
125 $this->webtestLogin();
127 // visit event search page
128 $this->openCiviPage("event/search", "reset=1");
130 $this->select('event_relative', "label=Choose Date Range");
131 $this->webtestFillDate('event_start_date_low', '-2 year');
132 $this->webtestFillDate('event_end_date_high', '+1 year');
134 $this->clickLink("_qf_Search_refresh");
136 $stringsToCheck = array(
137 "Start Date - greater than or equal to",
139 "End Date - less than or equal to",
141 'Edit Search Criteria',
144 $this->_checkStrings($stringsToCheck);
147 function testParticipantSearchEventDateAndType() {
149 $this->webtestLogin();
151 // visit event search page
152 $this->openCiviPage("event/search", "reset=1");
154 $eventTypeName = 'Fundraiser';
155 $this->waitForElementPresent('event_type_id');
156 $this->select2("event_type_id", $eventTypeName);
157 $this->select('event_relative', "label=Choose Date Range");
158 $this->webtestFillDate('event_start_date_low', '-2 year');
159 $this->webtestFillDate('event_end_date_high', '+1 year');
162 $this->click("_qf_Search_refresh");
163 $this->waitForElementPresent("search-status");
165 $stringsToCheck = array(
166 "Start Date - greater than or equal to",
168 "End Date - less than or equal to",
169 "Event Type - $eventTypeName",
171 'Edit Search Criteria',
174 $this->_checkStrings($stringsToCheck);
177 function testParticipantSearchCustomField() {
179 $this->webtestLogin();
181 // visit event search page
182 $this->openCiviPage("event/search", "reset=1");
184 $this->select("css=select[data-crm-custom='Food_Preference:Soup_Selection']", 'Chicken Combo');
186 $this->clickLink("_qf_Search_refresh");
188 // note since this is generated data
189 // we are not sure if someone has this selection, so
190 // we are not testing for an empty record set
191 $stringsToCheck = array("Soup Selection = Chicken Combo");
193 $this->_checkStrings($stringsToCheck);
195 $this->select("css=select[data-crm-custom='Food_Preference:Soup_Selection']", 'Salmon Stew');
196 $this->clickLink("_qf_Search_refresh");
198 $stringsToCheck = array("Soup Selection = Salmon Stew");
200 $this->_checkStrings($stringsToCheck);
203 function testParticipantSearchForceAndView() {
205 $this->webtestLogin();
207 // visit event search page
208 $this->openCiviPage("event/search", "reset=1&force=1");
210 // assume generated DB
211 // there are participants
212 $this->assertTrue($this->isTextPresent("Select Records"), "A forced event search did not return any results");
214 $this->waitForElementPresent("xpath=id('participantSearch')/table/tbody/tr/td[11]/span/a[text()='View']");
215 $this->click("xpath=id('participantSearch')/table/tbody/tr/td[11]/span/a[text()='View']");
216 $this->waitForTextPresent("View Event Registration");
218 // ensure we get to particpant view
219 $stringsToCheck = array(
225 $this->_checkStrings($stringsToCheck);
228 function testParticipantSearchForceAndEdit() {
230 $this->webtestLogin();
232 // visit event search page
233 $this->openCiviPage("event/search", "reset=1&force=1");
235 // assume generated DB
236 // there are participants
237 $this->assertTrue($this->isTextPresent("Select Records"), "A forced event search did not return any results");
239 $this->waitForElementPresent("xpath=id('participantSearch')/table/tbody/tr/td[11]/span/a[text()='Edit']");
240 $this->click("xpath=id('participantSearch')/table/tbody/tr/td[11]/span/a[text()='Edit']");
241 $this->waitForTextPresent("Edit Event Registration");
243 // ensure we get to particpant view
244 $stringsToCheck = array(
250 $this->_checkStrings($stringsToCheck);