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';
28 class WebTest_Event_ParticipantSearchTest
extends CiviSeleniumTestCase
{
30 protected function setUp() {
34 function _checkStrings(&$strings) {
35 // search for elements
36 foreach ($strings as $string) {
37 $this->assertTrue($this->isTextPresent($string), "Could not find $string on page");
41 function testParticipantSearchForm() {
42 $this->webtestLogin();
44 // visit event search page
45 $this->openCiviPage("event/search", "reset=1");
47 $stringsToCheck = array(
53 'Participant is a Test?',
54 'Participant is Pay Later?',
57 // check that the custom data is also there
61 $this->_checkStrings($stringsToCheck);
64 function testParticipantSearchForce() {
65 $this->webtestLogin();
67 // visit event search page
68 $this->openCiviPage("event/search", "reset=1&force=1");
70 // assume generated DB
71 // there are participants
72 $this->assertTrue($this->isTextPresent("Select Records"), "A forced event search did not return any results");
75 function testParticipantSearchEmpty() {
76 $this->webtestLogin();
78 // visit event search page
79 $this->openCiviPage("event/search", "reset=1");
81 $crypticName = "foobardoogoo_" . md5(time());
82 $this->type("sort_name", $crypticName);
84 $this->click("_qf_Search_refresh");
85 $this->waitForPageToLoad($this->getTimeoutMsec());
87 $stringsToCheck = array(
88 'No matches found for',
93 $this->_checkStrings($stringsToCheck);
96 function testParticipantSearchEventName() {
97 $this->webtestLogin();
99 // visit event search page
100 $this->openCiviPage("event/search", "reset=1");
102 $eventName = "Fall Fundraiser Dinner";
103 $this->select2("event_id", $eventName);
105 $this->click("_qf_Search_refresh");
106 $this->waitForPageToLoad($this->getTimeoutMsec());
108 $stringsToCheck = array(
109 "Event = $eventName",
111 'Edit Search Criteria',
114 $this->_checkStrings($stringsToCheck);
117 function testParticipantSearchEventDate() {
119 $this->webtestLogin();
121 // visit event search page
122 $this->openCiviPage("event/search", "reset=1");
124 $this->select('event_relative', "label=Choose Date Range");
125 $this->webtestFillDate('event_start_date_low', '-2 year');
126 $this->webtestFillDate('event_end_date_high', '+1 year');
128 $this->click("_qf_Search_refresh");
129 $this->waitForPageToLoad($this->getTimeoutMsec());
131 $stringsToCheck = array(
132 "Start Date - greater than or equal to",
134 "End Date - less than or equal to",
136 'Edit Search Criteria',
139 $this->_checkStrings($stringsToCheck);
142 function testParticipantSearchEventDateAndType() {
144 $this->webtestLogin();
146 // visit event search page
147 $this->openCiviPage("event/search", "reset=1");
149 $this->select('event_relative', "label=Choose Date Range");
150 $this->webtestFillDate('event_start_date_low', '-2 year');
151 $this->webtestFillDate('event_end_date_high', '+1 year');
153 $eventTypeName = 'Fundraiser';
154 $this->select2("event_type_id", $eventTypeName);
156 $this->click("_qf_Search_refresh");
157 $this->waitForPageToLoad($this->getTimeoutMsec());
159 $stringsToCheck = array(
160 "Start Date - greater than or equal to",
162 "End Date - less than or equal to",
163 "Event Type - $eventTypeName",
165 'Edit Search Criteria',
168 $this->_checkStrings($stringsToCheck);
171 function testParticipantSearchCustomField() {
173 $this->webtestLogin();
175 // visit event search page
176 $this->openCiviPage("event/search", "reset=1");
178 $this->click("xpath=//div[@id='Food_Preference']/div[2]/table/tbody/tr/td[2]//label[contains(text(),'Chicken Combo')]");
180 $this->click("_qf_Search_refresh");
181 $this->waitForPageToLoad($this->getTimeoutMsec());
183 // note since this is generated data
184 // we are not sure if someone has this selection, so
185 // we are not testing for an empty record set
186 $stringsToCheck = array("Soup Selection = Chicken Combo");
188 $this->_checkStrings($stringsToCheck);
190 $this->click("xpath=//div[@id='Food_Preference']/div[2]/table/tbody/tr/td[2]//label[contains(text(),'Salmon Stew')]");
191 $this->click("_qf_Search_refresh");
192 $this->waitForPageToLoad($this->getTimeoutMsec());
194 $stringsToCheck = array("Soup Selection = Salmon Stew");
196 $this->_checkStrings($stringsToCheck);
199 function testParticipantSearchForceAndView() {
201 $this->webtestLogin();
203 // visit event search page
204 $this->openCiviPage("event/search", "reset=1&force=1");
206 // assume generated DB
207 // there are participants
208 $this->assertTrue($this->isTextPresent("Select Records"), "A forced event search did not return any results");
210 $this->waitForElementPresent("xpath=id('participantSearch')/table/tbody/tr/td[11]/span/a[text()='View']");
211 $this->click("xpath=id('participantSearch')/table/tbody/tr/td[11]/span/a[text()='View']");
212 $this->waitForElementPresent("_qf_ParticipantView_cancel-bottom");
214 // ensure we get to particpant view
215 $stringsToCheck = array(
217 "Event Registration",
223 $this->_checkStrings($stringsToCheck);
226 function testParticipantSearchForceAndEdit() {
228 $this->webtestLogin();
230 // visit event search page
231 $this->openCiviPage("event/search", "reset=1&force=1");
233 // assume generated DB
234 // there are participants
235 $this->assertTrue($this->isTextPresent("Select Records"), "A forced event search did not return any results");
237 $this->waitForElementPresent("xpath=id('participantSearch')/table/tbody/tr/td[11]/span/a[text()='Edit']");
238 $this->click("xpath=id('participantSearch')/table/tbody/tr/td[11]/span/a[text()='Edit']");
239 $this->waitForElementPresent("_qf_Participant_cancel-bottom");
241 // ensure we get to particpant view
242 $stringsToCheck = array(
243 "Edit Event Registration",
249 $this->_checkStrings($stringsToCheck);