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() {
37 function _checkStrings(&$strings) {
38 // search for elements
39 foreach ($strings as $string) {
40 $this->assertTrue($this->isTextPresent($string), "Could not find $string on page");
44 function testParticipantSearchForm() {
45 $this->webtestLogin();
47 // visit event search page
48 $this->openCiviPage("event/search", "reset=1");
50 $stringsToCheck = array(
56 'Participant is a Test?',
57 'Participant is Pay Later?',
60 // check that the custom data is also there
64 $this->_checkStrings($stringsToCheck);
67 function testParticipantSearchForce() {
68 $this->webtestLogin();
70 // visit event search page
71 $this->openCiviPage("event/search", "reset=1&force=1");
73 // assume generated DB
74 // there are participants
75 $this->assertTrue($this->isTextPresent("Select Records"), "A forced event search did not return any results");
78 function testParticipantSearchEmpty() {
79 $this->webtestLogin();
81 // visit event search page
82 $this->openCiviPage("event/search", "reset=1");
84 $crypticName = "foobardoogoo_" . md5(time());
85 $this->type("sort_name", $crypticName);
87 $this->click("_qf_Search_refresh");
88 $this->waitForPageToLoad($this->getTimeoutMsec());
90 $stringsToCheck = array(
91 'No matches found for',
96 $this->_checkStrings($stringsToCheck);
99 function testParticipantSearchEventName() {
100 $this->webtestLogin();
102 // visit event search page
103 $this->openCiviPage("event/search", "reset=1");
105 $eventName = "Fall Fundraiser Dinner";
106 $this->select2("event_id", $eventName);
108 $this->click("_qf_Search_refresh");
109 $this->waitForPageToLoad($this->getTimeoutMsec());
111 $stringsToCheck = array(
112 "Event = $eventName",
114 'Edit Search Criteria',
117 $this->_checkStrings($stringsToCheck);
120 function testParticipantSearchEventDate() {
122 $this->webtestLogin();
124 // visit event search page
125 $this->openCiviPage("event/search", "reset=1");
127 $this->select('event_relative', "label=Choose Date Range");
128 $this->webtestFillDate('event_start_date_low', '-2 year');
129 $this->webtestFillDate('event_end_date_high', '+1 year');
131 $this->click("_qf_Search_refresh");
132 $this->waitForPageToLoad($this->getTimeoutMsec());
134 $stringsToCheck = array(
135 "Start Date - greater than or equal to",
137 "End Date - less than or equal to",
139 'Edit Search Criteria',
142 $this->_checkStrings($stringsToCheck);
145 function testParticipantSearchEventDateAndType() {
147 $this->webtestLogin();
149 // visit event search page
150 $this->openCiviPage("event/search", "reset=1");
152 $this->select('event_relative', "label=Choose Date Range");
153 $this->webtestFillDate('event_start_date_low', '-2 year');
154 $this->webtestFillDate('event_end_date_high', '+1 year');
156 $eventTypeName = 'Fundraiser';
157 $this->select2("event_type_id", $eventTypeName);
159 $this->click("_qf_Search_refresh");
160 $this->waitForPageToLoad($this->getTimeoutMsec());
162 $stringsToCheck = array(
163 "Start Date - greater than or equal to",
165 "End Date - less than or equal to",
166 "Event Type - $eventTypeName",
168 'Edit Search Criteria',
171 $this->_checkStrings($stringsToCheck);
174 function testParticipantSearchCustomField() {
176 $this->webtestLogin();
178 // visit event search page
179 $this->openCiviPage("event/search", "reset=1");
181 $this->click("xpath=//div[@id='Food_Preference']/div[2]/table/tbody/tr/td[2]//label[contains(text(),'Chicken Combo')]");
183 $this->click("_qf_Search_refresh");
184 $this->waitForPageToLoad($this->getTimeoutMsec());
186 // note since this is generated data
187 // we are not sure if someone has this selection, so
188 // we are not testing for an empty record set
189 $stringsToCheck = array("Soup Selection = Chicken Combo");
191 $this->_checkStrings($stringsToCheck);
193 $this->click("xpath=//div[@id='Food_Preference']/div[2]/table/tbody/tr/td[2]//label[contains(text(),'Salmon Stew')]");
194 $this->click("_qf_Search_refresh");
195 $this->waitForPageToLoad($this->getTimeoutMsec());
197 $stringsToCheck = array("Soup Selection = Salmon Stew");
199 $this->_checkStrings($stringsToCheck);
202 function testParticipantSearchForceAndView() {
204 $this->webtestLogin();
206 // visit event search page
207 $this->openCiviPage("event/search", "reset=1&force=1");
209 // assume generated DB
210 // there are participants
211 $this->assertTrue($this->isTextPresent("Select Records"), "A forced event search did not return any results");
213 $this->waitForElementPresent("xpath=id('participantSearch')/table/tbody/tr/td[11]/span/a[text()='View']");
214 $this->click("xpath=id('participantSearch')/table/tbody/tr/td[11]/span/a[text()='View']");
215 $this->waitForElementPresent("_qf_ParticipantView_cancel-bottom");
217 // ensure we get to particpant view
218 $stringsToCheck = array(
220 "Event Registration",
226 $this->_checkStrings($stringsToCheck);
229 function testParticipantSearchForceAndEdit() {
231 $this->webtestLogin();
233 // visit event search page
234 $this->openCiviPage("event/search", "reset=1&force=1");
236 // assume generated DB
237 // there are participants
238 $this->assertTrue($this->isTextPresent("Select Records"), "A forced event search did not return any results");
240 $this->waitForElementPresent("xpath=id('participantSearch')/table/tbody/tr/td[11]/span/a[text()='Edit']");
241 $this->click("xpath=id('participantSearch')/table/tbody/tr/td[11]/span/a[text()='Edit']");
242 $this->waitForElementPresent("_qf_Participant_cancel-bottom");
244 // ensure we get to particpant view
245 $stringsToCheck = array(
246 "Edit Event Registration",
252 $this->_checkStrings($stringsToCheck);