3 +--------------------------------------------------------------------+
4 | CiviCRM version 4.6 |
5 +--------------------------------------------------------------------+
6 | Copyright CiviCRM LLC (c) 2004-2015 |
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 public 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 public 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 public 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 public 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 public function testParticipantSearchEventName() {
103 $this->markTestSkipped('Skipping for now as it works fine locally.');
104 $this->webtestLogin();
106 // visit event search page
107 $this->openCiviPage("event/search", "reset=1");
108 $this->waitForElementPresent('_qf_Search_refresh');
110 $eventName = "Fall Fundraiser Dinner";
111 $this->waitForElementPresent("event_id");
112 $this->select2("event_id", $eventName);
114 $this->click("_qf_Search_refresh");
115 $this->waitForPageToLoad($this->getTimeoutMsec());
117 $stringsToCheck = array(
118 "Event = $eventName",
120 'Edit Search Criteria',
123 $this->_checkStrings($stringsToCheck);
126 public function testParticipantSearchEventDate() {
128 $this->webtestLogin();
130 // visit event search page
131 $this->openCiviPage("event/search", "reset=1");
133 $this->select('event_relative', "label=Choose Date Range");
134 $this->webtestFillDate('event_start_date_low', '-2 year');
135 $this->webtestFillDate('event_end_date_high', '+1 year');
137 $this->clickLink("_qf_Search_refresh");
139 $stringsToCheck = array(
140 "Start Date - greater than or equal to",
142 "End Date - less than or equal to",
144 'Edit Search Criteria',
147 $this->_checkStrings($stringsToCheck);
150 public function testParticipantSearchEventDateAndType() {
151 $this->markTestSkipped('Skipping for now as it works fine locally.');
152 $this->webtestLogin();
154 // visit event search page
155 $this->openCiviPage("event/search", "reset=1");
157 $eventTypeName = 'Fundraiser';
158 $this->waitForElementPresent('event_type_id');
159 $this->select2("event_type_id", $eventTypeName);
160 $this->waitForElementPresent('event_relative');
161 $this->select('event_relative', "label=Choose Date Range");
162 $this->webtestFillDate('event_start_date_low', '-2 year');
163 $this->webtestFillDate('event_end_date_high', '+1 year');
165 $this->click("_qf_Search_refresh");
166 $this->waitForPageToLoad($this->getTimeoutMsec());
167 $this->waitForElementPresent("xpath=//form[@id='Search']/div[3]/div/div[1]/div");
169 $stringsToCheck = array(
170 "Start Date - greater than or equal to",
172 "End Date - less than or equal to",
173 "Event Type = $eventTypeName",
175 'Edit Search Criteria',
178 $this->_checkStrings($stringsToCheck);
181 public function testParticipantSearchCustomField() {
183 $this->webtestLogin();
185 // visit event search page
186 $this->openCiviPage("event/search", "reset=1");
188 $this->select("css=select[data-crm-custom='Food_Preference:Soup_Selection']", 'Chicken Combo');
190 $this->clickLink("_qf_Search_refresh");
192 // note since this is generated data
193 // we are not sure if someone has this selection, so
194 // we are not testing for an empty record set
195 $stringsToCheck = array("Soup Selection = Chicken Combo");
197 $this->_checkStrings($stringsToCheck);
199 $this->select("css=select[data-crm-custom='Food_Preference:Soup_Selection']", 'Salmon Stew');
200 $this->clickLink("_qf_Search_refresh");
202 $stringsToCheck = array("Soup Selection = Salmon Stew");
204 $this->_checkStrings($stringsToCheck);
207 public function testParticipantSearchForceAndView() {
209 $this->webtestLogin();
211 // visit event search page
212 $this->openCiviPage("event/search", "reset=1&force=1");
214 // assume generated DB
215 // there are participants
216 $this->assertTrue($this->isTextPresent("Select Records"), "A forced event search did not return any results");
218 $this->waitForElementPresent("xpath=id('participantSearch')/table/tbody/tr/td[11]/span/a[text()='View']");
219 $this->click("xpath=id('participantSearch')/table/tbody/tr/td[11]/span/a[text()='View']");
220 $this->waitForTextPresent("View Event Registration");
222 // ensure we get to particpant view
223 $stringsToCheck = array(
229 $this->_checkStrings($stringsToCheck);
232 public function testParticipantSearchForceAndEdit() {
234 $this->webtestLogin();
236 // visit event search page
237 $this->openCiviPage("event/search", "reset=1&force=1");
239 // assume generated DB
240 // there are participants
241 $this->assertTrue($this->isTextPresent("Select Records"), "A forced event search did not return any results");
243 $this->waitForElementPresent("xpath=id('participantSearch')/table/tbody/tr/td[11]/span/a[text()='Edit']");
244 $this->click("xpath=id('participantSearch')/table/tbody/tr/td[11]/span/a[text()='Edit']");
245 $this->waitForElementPresent("xpath=//button//span[contains(text(),'Save')]");
247 // ensure we get to particpant view
248 $stringsToCheck = array(
254 $this->_checkStrings($stringsToCheck);