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->type("event_name", $eventName);
104 $this->type("event_id", 1);
106 $this->click("_qf_Search_refresh");
107 $this->waitForPageToLoad($this->getTimeoutMsec());
109 $stringsToCheck = array(
110 "Event = $eventName",
112 'Edit Search Criteria',
115 $this->_checkStrings($stringsToCheck);
118 function testParticipantSearchEventDate() {
120 $this->webtestLogin();
122 // visit event search page
123 $this->openCiviPage("event/search", "reset=1");
125 $this->select('event_relative', "label=Choose Date Range");
126 $this->webtestFillDate('event_start_date_low', '-2 year');
127 $this->webtestFillDate('event_end_date_high', '+1 year');
129 $this->click("_qf_Search_refresh");
130 $this->waitForPageToLoad($this->getTimeoutMsec());
132 $stringsToCheck = array(
133 "Start Date - greater than or equal to",
135 "End Date - less than or equal to",
137 'Edit Search Criteria',
140 $this->_checkStrings($stringsToCheck);
143 function testParticipantSearchEventDateAndType() {
145 $this->webtestLogin();
147 // visit event search page
148 $this->openCiviPage("event/search", "reset=1");
150 $this->select('event_relative', "label=Choose Date Range");
151 $this->webtestFillDate('event_start_date_low', '-2 year');
152 $this->webtestFillDate('event_end_date_high', '+1 year');
154 $eventTypeName = 'Fundraiser';
155 $this->type("event_type", $eventTypeName);
156 $this->type("event_type_id", 3);
158 $this->click("_qf_Search_refresh");
159 $this->waitForPageToLoad($this->getTimeoutMsec());
161 $stringsToCheck = array(
162 "Start Date - greater than or equal to",
164 "End Date - less than or equal to",
165 "Event Type - $eventTypeName",
167 'Edit Search Criteria',
170 $this->_checkStrings($stringsToCheck);
173 function testParticipantSearchCustomField() {
175 $this->webtestLogin();
177 // visit event search page
178 $this->openCiviPage("event/search", "reset=1");
180 $this->click("xpath=//div[@id='Food_Preference']/div[2]/table/tbody/tr/td[2]//label[contains(text(),'Chicken Combo')]");
182 $this->click("_qf_Search_refresh");
183 $this->waitForPageToLoad($this->getTimeoutMsec());
185 // note since this is generated data
186 // we are not sure if someone has this selection, so
187 // we are not testing for an empty record set
188 $stringsToCheck = array("Soup Selection = Chicken Combo");
190 $this->_checkStrings($stringsToCheck);
192 $this->click("xpath=//div[@id='Food_Preference']/div[2]/table/tbody/tr/td[2]//label[contains(text(),'Salmon Stew')]");
193 $this->click("_qf_Search_refresh");
194 $this->waitForPageToLoad($this->getTimeoutMsec());
196 $stringsToCheck = array("Soup Selection = Salmon Stew");
198 $this->_checkStrings($stringsToCheck);
201 function testParticipantSearchForceAndView() {
203 $this->webtestLogin();
205 // visit event search page
206 $this->openCiviPage("event/search", "reset=1&force=1");
208 // assume generated DB
209 // there are participants
210 $this->assertTrue($this->isTextPresent("Select Records"), "A forced event search did not return any results");
212 $this->waitForElementPresent("xpath=id('participantSearch')/table/tbody/tr/td[11]/span/a[text()='View']");
213 $this->click("xpath=id('participantSearch')/table/tbody/tr/td[11]/span/a[text()='View']");
214 $this->waitForElementPresent("_qf_ParticipantView_cancel-bottom");
216 // ensure we get to particpant view
217 $stringsToCheck = array(
219 "Event Registration",
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->waitForElementPresent("_qf_Participant_cancel-bottom");
243 // ensure we get to particpant view
244 $stringsToCheck = array(
245 "Edit Event Registration",
251 $this->_checkStrings($stringsToCheck);