Commit | Line | Data |
---|---|---|
6a488035 TO |
1 | <?php |
2 | /* | |
3 | +--------------------------------------------------------------------+ | |
81621fee | 4 | | CiviCRM version 4.7 | |
6a488035 | 5 | +--------------------------------------------------------------------+ |
e7112fa7 | 6 | | Copyright CiviCRM LLC (c) 2004-2015 | |
6a488035 TO |
7 | +--------------------------------------------------------------------+ |
8 | | This file is a part of CiviCRM. | | |
9 | | | | |
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. | | |
13 | | | | |
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. | | |
18 | | | | |
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 | +--------------------------------------------------------------------+ | |
e70a7fc0 | 25 | */ |
6a488035 | 26 | |
6a488035 | 27 | require_once 'CiviTest/CiviSeleniumTestCase.php'; |
e9479dcf EM |
28 | |
29 | /** | |
30 | * Class WebTest_Event_ParticipantSearchTest | |
31 | */ | |
6a488035 TO |
32 | class WebTest_Event_ParticipantSearchTest extends CiviSeleniumTestCase { |
33 | ||
34 | protected function setUp() { | |
35 | parent::setUp(); | |
36 | } | |
37 | ||
4cbe18b8 EM |
38 | /** |
39 | * @param $strings | |
40 | */ | |
00be9182 | 41 | public function _checkStrings(&$strings) { |
6a488035 TO |
42 | // search for elements |
43 | foreach ($strings as $string) { | |
44 | $this->assertTrue($this->isTextPresent($string), "Could not find $string on page"); | |
45 | } | |
46 | } | |
47 | ||
00be9182 | 48 | public function testParticipantSearchForm() { |
6a488035 TO |
49 | $this->webtestLogin(); |
50 | ||
51 | // visit event search page | |
071a6d2e | 52 | $this->openCiviPage("event/search", "reset=1"); |
6a488035 TO |
53 | |
54 | $stringsToCheck = array( | |
55 | 'Participant Name', | |
56 | 'Event Name', | |
57 | 'Event Dates', | |
58 | 'Participant Status', | |
59 | 'Participant Role', | |
60 | 'Participant is a Test?', | |
61 | 'Participant is Pay Later?', | |
62 | 'Fee Level', | |
63 | 'Fee Amount', | |
64 | // check that the custom data is also there | |
65 | 'Food Preference', | |
66 | 'Soup Selection', | |
67 | ); | |
68 | $this->_checkStrings($stringsToCheck); | |
69 | } | |
70 | ||
00be9182 | 71 | public function testParticipantSearchForce() { |
6a488035 TO |
72 | $this->webtestLogin(); |
73 | ||
74 | // visit event search page | |
071a6d2e | 75 | $this->openCiviPage("event/search", "reset=1&force=1"); |
6a488035 TO |
76 | |
77 | // assume generated DB | |
78 | // there are participants | |
79 | $this->assertTrue($this->isTextPresent("Select Records"), "A forced event search did not return any results"); | |
80 | } | |
81 | ||
00be9182 | 82 | public function testParticipantSearchEmpty() { |
6a488035 TO |
83 | $this->webtestLogin(); |
84 | ||
85 | // visit event search page | |
071a6d2e | 86 | $this->openCiviPage("event/search", "reset=1"); |
6a488035 TO |
87 | |
88 | $crypticName = "foobardoogoo_" . md5(time()); | |
89 | $this->type("sort_name", $crypticName); | |
90 | ||
c3ad8633 | 91 | $this->clickLink("_qf_Search_refresh"); |
6a488035 TO |
92 | |
93 | $stringsToCheck = array( | |
94 | 'No matches found for', | |
95 | 'Name or Email LIKE', | |
96 | $crypticName, | |
97 | ); | |
98 | ||
99 | $this->_checkStrings($stringsToCheck); | |
100 | } | |
101 | ||
00be9182 | 102 | public function testParticipantSearchEventName() { |
a49e5dea | 103 | $this->markTestSkipped('Skipping for now as it works fine locally.'); |
6a488035 TO |
104 | $this->webtestLogin(); |
105 | ||
106 | // visit event search page | |
071a6d2e | 107 | $this->openCiviPage("event/search", "reset=1"); |
4cbbec00 | 108 | $this->waitForElementPresent('_qf_Search_refresh'); |
6a488035 TO |
109 | |
110 | $eventName = "Fall Fundraiser Dinner"; | |
195986f2 | 111 | $this->waitForElementPresent("event_id"); |
ed174dea | 112 | $this->select2("event_id", $eventName); |
6a488035 | 113 | |
38653166 | 114 | $this->click("_qf_Search_refresh"); |
115 | $this->waitForPageToLoad($this->getTimeoutMsec()); | |
6a488035 TO |
116 | |
117 | $stringsToCheck = array( | |
118 | "Event = $eventName", | |
119 | 'Select Records:', | |
120 | 'Edit Search Criteria', | |
121 | ); | |
122 | ||
123 | $this->_checkStrings($stringsToCheck); | |
124 | } | |
125 | ||
00be9182 | 126 | public function testParticipantSearchEventDate() { |
6a488035 TO |
127 | |
128 | $this->webtestLogin(); | |
129 | ||
130 | // visit event search page | |
071a6d2e | 131 | $this->openCiviPage("event/search", "reset=1"); |
6a488035 TO |
132 | |
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'); | |
136 | ||
c3ad8633 | 137 | $this->clickLink("_qf_Search_refresh"); |
6a488035 TO |
138 | |
139 | $stringsToCheck = array( | |
140 | "Start Date - greater than or equal to", | |
141 | '...AND...', | |
142 | "End Date - less than or equal to", | |
143 | 'Select Records:', | |
144 | 'Edit Search Criteria', | |
145 | ); | |
146 | ||
147 | $this->_checkStrings($stringsToCheck); | |
148 | } | |
149 | ||
00be9182 | 150 | public function testParticipantSearchEventDateAndType() { |
a49e5dea | 151 | $this->markTestSkipped('Skipping for now as it works fine locally.'); |
6a488035 TO |
152 | $this->webtestLogin(); |
153 | ||
154 | // visit event search page | |
071a6d2e | 155 | $this->openCiviPage("event/search", "reset=1"); |
6a488035 | 156 | |
57c2bdf0 | 157 | $eventTypeName = 'Fundraiser'; |
8fb46c61 | 158 | $this->waitForElementPresent('event_type_id'); |
57c2bdf0 | 159 | $this->select2("event_type_id", $eventTypeName); |
195986f2 | 160 | $this->waitForElementPresent('event_relative'); |
6a488035 TO |
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'); | |
164 | ||
4cbbec00 | 165 | $this->click("_qf_Search_refresh"); |
38653166 | 166 | $this->waitForPageToLoad($this->getTimeoutMsec()); |
63d14d48 | 167 | $this->waitForElementPresent("xpath=//form[@id='Search']/div[3]/div/div[1]/div"); |
6a488035 TO |
168 | |
169 | $stringsToCheck = array( | |
170 | "Start Date - greater than or equal to", | |
171 | '...AND...', | |
172 | "End Date - less than or equal to", | |
752b08dc | 173 | "Event Type = $eventTypeName", |
6a488035 TO |
174 | 'Select Records:', |
175 | 'Edit Search Criteria', | |
176 | ); | |
177 | ||
178 | $this->_checkStrings($stringsToCheck); | |
179 | } | |
180 | ||
00be9182 | 181 | public function testParticipantSearchCustomField() { |
a90dac23 | 182 | $this->markTestSkipped('Skipping for now as it works fine locally.'); |
6a488035 TO |
183 | $this->webtestLogin(); |
184 | ||
185 | // visit event search page | |
071a6d2e | 186 | $this->openCiviPage("event/search", "reset=1"); |
6a488035 | 187 | |
e739afc3 | 188 | $this->select("css=select[data-crm-custom='Food_Preference:Soup_Selection']", 'Chicken Combo'); |
6a488035 | 189 | |
c3ad8633 | 190 | $this->clickLink("_qf_Search_refresh"); |
6a488035 TO |
191 | |
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"); | |
196 | ||
197 | $this->_checkStrings($stringsToCheck); | |
198 | ||
e739afc3 | 199 | $this->select("css=select[data-crm-custom='Food_Preference:Soup_Selection']", 'Salmon Stew'); |
c3ad8633 | 200 | $this->clickLink("_qf_Search_refresh"); |
6a488035 TO |
201 | |
202 | $stringsToCheck = array("Soup Selection = Salmon Stew"); | |
203 | ||
204 | $this->_checkStrings($stringsToCheck); | |
205 | } | |
206 | ||
00be9182 | 207 | public function testParticipantSearchForceAndView() { |
6a488035 TO |
208 | |
209 | $this->webtestLogin(); | |
210 | ||
211 | // visit event search page | |
071a6d2e | 212 | $this->openCiviPage("event/search", "reset=1&force=1"); |
6a488035 TO |
213 | |
214 | // assume generated DB | |
215 | // there are participants | |
216 | $this->assertTrue($this->isTextPresent("Select Records"), "A forced event search did not return any results"); | |
217 | ||
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']"); | |
3e60ff7f | 220 | $this->waitForTextPresent("View Event Registration"); |
6a488035 TO |
221 | |
222 | // ensure we get to particpant view | |
223 | $stringsToCheck = array( | |
6a488035 TO |
224 | "Name", |
225 | "Event", | |
226 | "Participant Role", | |
227 | ); | |
228 | ||
229 | $this->_checkStrings($stringsToCheck); | |
230 | } | |
231 | ||
00be9182 | 232 | public function testParticipantSearchForceAndEdit() { |
6a488035 TO |
233 | |
234 | $this->webtestLogin(); | |
235 | ||
236 | // visit event search page | |
071a6d2e | 237 | $this->openCiviPage("event/search", "reset=1&force=1"); |
6a488035 TO |
238 | |
239 | // assume generated DB | |
240 | // there are participants | |
241 | $this->assertTrue($this->isTextPresent("Select Records"), "A forced event search did not return any results"); | |
242 | ||
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']"); | |
94b3c290 | 245 | $this->waitForElementPresent("xpath=//button//span[contains(text(),'Save')]"); |
6a488035 TO |
246 | |
247 | // ensure we get to particpant view | |
248 | $stringsToCheck = array( | |
6a488035 TO |
249 | "Participant", |
250 | "Event", | |
251 | "Participant Role", | |
252 | ); | |
253 | ||
254 | $this->_checkStrings($stringsToCheck); | |
255 | } | |
96025800 | 256 | |
6a488035 | 257 | } |