Commit | Line | Data |
---|---|---|
6a488035 TO |
1 | <?php |
2 | /* | |
3 | +--------------------------------------------------------------------+ | |
06a1bc01 | 4 | | CiviCRM version 4.5 | |
6a488035 | 5 | +--------------------------------------------------------------------+ |
06a1bc01 | 6 | | Copyright CiviCRM LLC (c) 2004-2014 | |
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 | +--------------------------------------------------------------------+ | |
25 | */ | |
26 | ||
6a488035 | 27 | require_once 'CiviTest/CiviSeleniumTestCase.php'; |
e9479dcf EM |
28 | |
29 | /** | |
30 | * Class WebTest_Event_MultiprofileEventTest | |
31 | */ | |
6a488035 TO |
32 | class WebTest_Event_MultiprofileEventTest extends CiviSeleniumTestCase { |
33 | ||
34 | protected function setUp() { | |
35 | parent::setUp(); | |
36 | } | |
37 | ||
38 | function testCreateEventRegisterPage() { | |
6a488035 TO |
39 | // Log in using webtestLogin() method |
40 | $this->webtestLogin(); | |
41 | ||
42daf119 CW |
42 | $customGrp1 = "Custom Data1_" . substr(sha1(rand()), 0, 7); |
43 | $firstName = 'Ma' . substr(sha1(rand()), 0, 4); | |
44 | $lastName = 'An' . substr(sha1(rand()), 0, 7); | |
6a488035 TO |
45 | $participantfname = 'Dany' . substr(sha1(rand()), 0, 4); |
46 | $participantlname = 'Dan' . substr(sha1(rand()), 0, 4); | |
42daf119 CW |
47 | $email1 = $firstName . "@test.com"; |
48 | $email2 = $participantfname . "@test.com"; | |
6a488035 TO |
49 | |
50 | // We need a payment processor | |
51 | $processorName = "Webtest Dummy" . substr(sha1(rand()), 0, 7); | |
52 | $this->webtestAddPaymentProcessor($processorName); | |
53 | ||
54 | //add email to name and address profile | |
55 | $cfId = $this->_addEmailField(); | |
76e86fd8 | 56 | |
6a488035 | 57 | // create custom group1 |
071a6d2e | 58 | $this->openCiviPage("admin/custom/group", "reset=1"); |
6a488035 TO |
59 | $this->click("newCustomDataGroup"); |
60 | $this->waitForPageToLoad($this->getTimeoutMsec()); | |
61 | $this->type("title", $customGrp1); | |
62 | $this->select("extends[0]", "value=Contact"); | |
63 | $this->click("_qf_Group_next-bottom"); | |
64 | $this->waitForPageToLoad($this->getTimeoutMsec()); | |
65 | ||
66 | // get custom group id | |
a471a3b6 | 67 | $customGrpId1 = $this->urlArg('gid'); |
6a488035 TO |
68 | |
69 | $customId = $this->_testGetCustomFieldId($customGrpId1); | |
70 | ||
71 | $profileId = $this->_testGetProfileId($customId); | |
72 | ||
071a6d2e | 73 | $this->openCiviPage("event/add", "reset=1&action=add"); |
6a488035 TO |
74 | |
75 | $eventTitle = 'My Conference - ' . substr(sha1(rand()), 0, 7); | |
76 | $eventDescription = "Here is a description for this conference."; | |
77 | $this->_testAddEventInfo($eventTitle, $eventDescription); | |
78 | ||
79 | $streetAddress = "100 Main Street"; | |
80 | $this->_testAddLocation($streetAddress); | |
81 | ||
82 | $this->_testAddFees(FALSE, FALSE, $processorName); | |
83 | ||
84 | $eventPageId = $this->_testAddMultipleProfile($profileId); | |
85 | ||
86 | $this->_testEventRegistration($eventPageId, $customId, $firstName, $lastName, | |
87 | $participantfname, $participantlname, $email1, $email2 | |
88 | ); | |
89 | $this->waitForPageToLoad($this->getTimeoutMsec()); | |
90 | ||
91 | // Find Main Participant | |
071a6d2e | 92 | $this->openCiviPage("event/search", "reset=1"); |
6a488035 | 93 | $this->type("sort_name", $firstName); |
225a8648 | 94 | $this->clickLink("_qf_Search_refresh", "xpath=//div[@id='participantSearch']//table//tbody/tr[1]/td[11]/span/a[text()='View']"); |
ed174dea | 95 | $this->clickLink("xpath=//div[@id='participantSearch']//table//tbody/tr[1]/td[11]/span/a[text()='View']", "_qf_ParticipantView_cancel-top", FALSE); |
6a488035 TO |
96 | |
97 | $name = $firstName . " " . $lastName; | |
98 | $status = 'Registered'; | |
99 | ||
100 | $this->verifyText("xpath=//form[@id='ParticipantView']/div[2]/table/tbody/tr[1]/td[2]/a", preg_quote($name)); | |
101 | $this->verifyText("xpath=//form[@id='ParticipantView']/div[2]/table/tbody/tr[3]/td[2]/a", preg_quote($eventTitle)); | |
102 | $this->verifyText("xpath=//form[@id='ParticipantView']/div[2]/table/tbody/tr[6]/td[2]", preg_quote($status)); | |
103 | ||
104 | // Find additional Participant | |
071a6d2e | 105 | $this->openCiviPage("event/search", "reset=1"); |
6a488035 | 106 | $this->type("sort_name", $participantfname); |
225a8648 | 107 | $this->clickLink("_qf_Search_refresh", "xpath=//div[@id='participantSearch']//table//tbody/tr[1]/td[11]/span/a[text()='View']"); |
ed174dea | 108 | $this->clickLink("xpath=//div[@id='participantSearch']//table//tbody/tr[1]/td[11]/span/a[text()='View']", "_qf_ParticipantView_cancel-top", FALSE); |
6a488035 TO |
109 | |
110 | $name = $participantfname . " " . $participantlname; | |
111 | $status = 'Registered'; | |
112 | ||
113 | $this->verifyText("xpath=//form[@id='ParticipantView']/div[2]/table/tbody/tr[1]/td[2]/a", preg_quote($name)); | |
114 | $this->verifyText("xpath=//form[@id='ParticipantView']/div[2]/table/tbody/tr[3]/td[2]/a", preg_quote($eventTitle)); | |
115 | $this->verifyText("xpath=//form[@id='ParticipantView']/div[2]/table/tbody/tr[6]/td[2]", preg_quote($status)); | |
116 | ||
117 | // delete all custom data | |
118 | if (isset($cfId)) { | |
119 | $this->_removeEmailField($cfId); | |
120 | } | |
071a6d2e CW |
121 | foreach ($customId as $cid) { |
122 | $this->openCiviPage("admin/custom/group/field", "action=delete&reset=1&gid={$customGrpId1}&id=$cid"); | |
123 | $this->click("_qf_DeleteField_next-bottom"); | |
124 | $this->waitForPageToLoad($this->getTimeoutMsec()); | |
125 | } | |
126 | $this->openCiviPage("admin/custom/group", "action=delete&reset=1&id=$customGrpId1"); | |
6a488035 TO |
127 | $this->click("_qf_DeleteGroup_next-bottom"); |
128 | $this->waitForPageToLoad($this->getTimeoutMsec()); | |
6a488035 TO |
129 | } |
130 | ||
131 | function testAnoumyousRegisterPage() { | |
6a488035 TO |
132 | // add the required Drupal permission |
133 | $permission = array('edit-1-access-all-custom-data'); | |
134 | $this->changePermissions($permission); | |
135 | ||
42daf119 CW |
136 | $customGrp1 = "Custom Data1_" . substr(sha1(rand()), 0, 7); |
137 | $firstName = 'Ma' . substr(sha1(rand()), 0, 4); | |
138 | $lastName = 'An' . substr(sha1(rand()), 0, 7); | |
139 | $participantfname = 'Dany' . substr(sha1(rand()), 0, 4); | |
140 | $participantlname = 'Dan' . substr(sha1(rand()), 0, 4); | |
141 | $email1 = $firstName . "@test.com"; | |
142 | $email2 = $participantfname . "@test.com"; | |
143 | $firstName2 = 'Man' . substr(sha1(rand()), 0, 4); | |
144 | $lastName2 = 'Ann' . substr(sha1(rand()), 0, 7); | |
6a488035 TO |
145 | $participantfname2 = 'Adam' . substr(sha1(rand()), 0, 4); |
146 | $participantlname2 = 'Gil' . substr(sha1(rand()), 0, 4); | |
42daf119 CW |
147 | $email3 = $participantfname2 . "@test.com"; |
148 | $email4 = $firstName2 . "@test.com"; | |
6a488035 TO |
149 | |
150 | // We need a payment processor | |
151 | $processorName = "Webtest Dummy" . substr(sha1(rand()), 0, 7); | |
152 | $this->webtestAddPaymentProcessor($processorName); | |
153 | ||
154 | //add email field to name and address profile | |
d0711ea4 | 155 | $cfId = $this->_addEmailField(); |
76e86fd8 | 156 | |
6a488035 | 157 | // create custom group1 |
071a6d2e | 158 | $this->openCiviPage("admin/custom/group", "reset=1"); |
6a488035 TO |
159 | $this->click("newCustomDataGroup"); |
160 | $this->waitForPageToLoad($this->getTimeoutMsec()); | |
161 | $this->type("title", $customGrp1); | |
162 | $this->select("extends[0]", "value=Contact"); | |
163 | $this->click("_qf_Group_next-bottom"); | |
164 | $this->waitForPageToLoad($this->getTimeoutMsec()); | |
165 | ||
166 | // get custom group id | |
a471a3b6 | 167 | $customGrpId1 = $this->urlArg('gid'); |
6a488035 TO |
168 | |
169 | $customId = $this->_testGetCustomFieldId($customGrpId1); | |
170 | ||
171 | $profileId = $this->_testGetProfileId($customId); | |
172 | ||
42daf119 | 173 | $this->openCiviPage('event/add', "reset=1&action=add"); |
6a488035 TO |
174 | |
175 | $eventTitle = 'My Conference - ' . substr(sha1(rand()), 0, 7); | |
176 | $eventDescription = "Here is a description for this conference."; | |
177 | $this->_testAddEventInfo($eventTitle, $eventDescription); | |
178 | ||
179 | $streetAddress = "100 Main Street"; | |
180 | $this->_testAddLocation($streetAddress); | |
181 | ||
182 | $this->_testAddFees(FALSE, FALSE, $processorName); | |
183 | ||
184 | $eventPageId = $this->_testAddMultipleProfile($profileId); | |
185 | ||
186 | // logout | |
42daf119 | 187 | $this->webtestLogout(); |
6a488035 TO |
188 | |
189 | $this->_testEventRegistration($eventPageId, $customId, $firstName, $lastName, $participantfname, $participantlname, $email1, $email2); | |
190 | $this->waitForPageToLoad($this->getTimeoutMsec()); | |
191 | // Log in using webtestLogin() method | |
192 | $this->webtestLogin(); | |
193 | ||
194 | // Find Main Participant | |
071a6d2e | 195 | $this->openCiviPage("event/search", "reset=1"); |
6a488035 | 196 | $this->type("sort_name", $firstName); |
225a8648 | 197 | $this->clickLink("_qf_Search_refresh", "xpath=//div[@id='participantSearch']//table//tbody/tr[1]/td[11]/span/a[text()='View']"); |
ed174dea | 198 | $this->clickLink("xpath=//div[@id='participantSearch']//table//tbody/tr[1]/td[11]/span/a[text()='View']", "_qf_ParticipantView_cancel-top", FALSE); |
6a488035 TO |
199 | |
200 | $name = $firstName . " " . $lastName; | |
201 | $status = 'Registered'; | |
202 | ||
203 | $this->verifyText("xpath=//form[@id='ParticipantView']/div[2]/table/tbody/tr[1]/td[2]/a", preg_quote($name)); | |
204 | $this->verifyText("xpath=//form[@id='ParticipantView']/div[2]/table/tbody/tr[3]/td[2]/a", preg_quote($eventTitle)); | |
205 | $this->verifyText("xpath=//form[@id='ParticipantView']/div[2]/table/tbody/tr[6]/td[2]", preg_quote($status)); | |
206 | ||
207 | // Find additional Participant | |
071a6d2e | 208 | $this->openCiviPage("event/search", "reset=1"); |
6a488035 | 209 | $this->type("sort_name", $participantfname); |
225a8648 | 210 | $this->clickLink("_qf_Search_refresh", "xpath=//div[@id='participantSearch']//table//tbody/tr[1]/td[11]/span/a[text()='View']"); |
ed174dea | 211 | $this->clickLink("xpath=//div[@id='participantSearch']//table//tbody/tr[1]/td[11]/span/a[text()='View']", "_qf_ParticipantView_cancel-top", FALSE); |
6a488035 TO |
212 | |
213 | $name = $participantfname . " " . $participantlname; | |
214 | $status = 'Registered'; | |
215 | ||
216 | $this->verifyText("xpath=//form[@id='ParticipantView']/div[2]/table/tbody/tr[1]/td[2]/a", preg_quote($name)); | |
217 | $this->verifyText("xpath=//form[@id='ParticipantView']/div[2]/table/tbody/tr[3]/td[2]/a", preg_quote($eventTitle)); | |
218 | $this->verifyText("xpath=//form[@id='ParticipantView']/div[2]/table/tbody/tr[6]/td[2]", preg_quote($status)); | |
219 | ||
220 | // Edit page and remove some profile | |
221 | $this->_testRemoveProfile($eventPageId); | |
222 | ||
223 | // logout | |
42daf119 | 224 | $this->webtestLogout(); |
6a488035 TO |
225 | |
226 | $this->_testEventRegistrationAfterRemoving($eventPageId, $customId, $firstName2, $lastName2, $participantfname2, $participantlname2, $email3, $email4); | |
227 | $this->waitForPageToLoad($this->getTimeoutMsec()); | |
228 | ||
229 | // Log in using webtestLogin() method | |
230 | $this->webtestLogin(); | |
231 | ||
232 | // Find Main Participant | |
42daf119 | 233 | $this->openCiviPage('event/search', "reset=1"); |
6a488035 | 234 | $this->type("sort_name", $firstName2); |
225a8648 | 235 | $this->clickLink("_qf_Search_refresh", "xpath=//div[@id='participantSearch']//table//tbody/tr[1]/td[11]/span/a[text()='View']"); |
ed174dea | 236 | $this->clickLink("xpath=//div[@id='participantSearch']//table//tbody/tr[1]/td[11]/span/a[text()='View']", "_qf_ParticipantView_cancel-top", FALSE); |
6a488035 TO |
237 | |
238 | $name = $firstName2 . " " . $lastName2; | |
239 | $status = 'Registered'; | |
240 | ||
241 | $this->verifyText("xpath=//form[@id='ParticipantView']/div[2]/table/tbody/tr[1]/td[2]/a", preg_quote($name)); | |
242 | $this->verifyText("xpath=//form[@id='ParticipantView']/div[2]/table/tbody/tr[3]/td[2]/a", preg_quote($eventTitle)); | |
243 | $this->verifyText("xpath=//form[@id='ParticipantView']/div[2]/table/tbody/tr[6]/td[2]", preg_quote($status)); | |
244 | ||
245 | // Find additional Participant | |
071a6d2e | 246 | $this->openCiviPage("event/search", "reset=1"); |
6a488035 | 247 | $this->type("sort_name", $participantfname2); |
225a8648 | 248 | $this->clickLink("_qf_Search_refresh", "xpath=//div[@id='participantSearch']//table//tbody/tr[1]/td[11]/span/a[text()='View']"); |
ed174dea | 249 | $this->clickLink("xpath=//div[@id='participantSearch']//table//tbody/tr[1]/td[11]/span/a[text()='View']", "_qf_ParticipantView_cancel-top", FALSE); |
6a488035 TO |
250 | |
251 | $name = $participantfname2 . " " . $participantlname2; | |
252 | $status = 'Registered'; | |
253 | ||
254 | $this->verifyText("xpath=//form[@id='ParticipantView']/div[2]/table/tbody/tr[1]/td[2]/a", preg_quote($name)); | |
255 | $this->verifyText("xpath=//form[@id='ParticipantView']/div[2]/table/tbody/tr[3]/td[2]/a", preg_quote($eventTitle)); | |
256 | $this->verifyText("xpath=//form[@id='ParticipantView']/div[2]/table/tbody/tr[6]/td[2]", preg_quote($status)); | |
257 | ||
258 | // delete all custom data | |
76e86fd8 | 259 | if (isset($cfId)) { |
6a488035 TO |
260 | $this->_removeEmailField($cfId); |
261 | } | |
071a6d2e CW |
262 | foreach ($customId as $cid) { |
263 | $this->openCiviPage("admin/custom/group/field", "action=delete&reset=1&gid={$customGrpId1}&id=$cid"); | |
264 | $this->click("_qf_DeleteField_next-bottom"); | |
265 | $this->waitForPageToLoad($this->getTimeoutMsec()); | |
266 | } | |
267 | $this->openCiviPage("admin/custom/group", "action=delete&reset=1&id=$customGrpId1"); | |
6a488035 TO |
268 | $this->click("_qf_DeleteGroup_next-bottom"); |
269 | $this->waitForPageToLoad($this->getTimeoutMsec()); | |
270 | } | |
271 | ||
4cbe18b8 EM |
272 | /** |
273 | * @param $customGrpId1 | |
274 | * | |
275 | * @return array | |
276 | */ | |
6a488035 TO |
277 | function _testGetCustomFieldId($customGrpId1) { |
278 | $customId = array(); | |
279 | ||
280 | // Create a custom data to add in profile | |
281 | ||
282 | $field1 = "Fname" . substr(sha1(rand()), 0, 7); | |
283 | $field2 = "Mname" . substr(sha1(rand()), 0, 7); | |
284 | $field3 = "Lname" . substr(sha1(rand()), 0, 7); | |
285 | ||
286 | // add custom fields for group 1 | |
071a6d2e | 287 | $this->openCiviPage("admin/custom/group/field/add", "reset=1&action=add&gid=$customGrpId1"); |
6a488035 TO |
288 | $this->type("label", $field1); |
289 | $this->check("is_searchable"); | |
290 | $this->click("_qf_Field_next_new-bottom"); | |
291 | $this->waitForPageToLoad($this->getTimeoutMsec()); | |
292 | ||
293 | $this->type("label", $field2); | |
294 | $this->check("is_searchable"); | |
295 | $this->click("_qf_Field_next_new-bottom"); | |
296 | $this->waitForPageToLoad($this->getTimeoutMsec()); | |
297 | ||
298 | $this->type("label", $field3); | |
299 | $this->check("is_searchable"); | |
60709d21 | 300 | $this->click("_qf_Field_done-bottom"); |
6a488035 TO |
301 | $this->waitForPageToLoad($this->getTimeoutMsec()); |
302 | ||
303 | // get id of custom fields | |
071a6d2e | 304 | $this->openCiviPage("admin/custom/group/field", "reset=1&action=browse&gid=$customGrpId1"); |
6a488035 TO |
305 | $custom1 = explode('&id=', $this->getAttribute("xpath=//div[@id='field_page']//table/tbody//tr[1]/td[8]/span/a[text()='Edit Field']/@href")); |
306 | $custom1 = $custom1[1]; | |
307 | array_push($customId, $custom1); | |
308 | $custom2 = explode('&id=', $this->getAttribute("xpath=//div[@id='field_page']//table/tbody//tr[2]/td[8]/span/a[text()='Edit Field']/@href")); | |
309 | $custom2 = $custom2[1]; | |
310 | array_push($customId, $custom2); | |
311 | $custom3 = explode('&id=', $this->getAttribute("xpath=//div[@id='field_page']//table/tbody//tr[3]/td[8]/span/a[text()='Edit Field']/@href")); | |
312 | $custom3 = $custom3[1]; | |
313 | array_push($customId, $custom3); | |
314 | ||
315 | return $customId; | |
316 | } | |
317 | ||
4cbe18b8 EM |
318 | /** |
319 | * @param $eventPageId | |
320 | */ | |
6a488035 | 321 | function _testRemoveProfile($eventPageId) { |
071a6d2e | 322 | $this->openCiviPage("event/manage/settings", "reset=1&action=update&id=$eventPageId"); |
6a488035 TO |
323 | |
324 | // Go to Online Contribution tab | |
325 | $this->click("link=Online Registration"); | |
326 | $this->waitForElementPresent("_qf_Registration_upload-bottom"); | |
60709d21 JP |
327 | $this->click("xpath=//*[@id='additional_custom_post_id_multiple_1']/parent::td/span/a[text()='remove profile']"); |
328 | $this->click("xpath=//*[@id='additional_custom_post_id_multiple_2']/parent::td/span/a[text()='remove profile']"); | |
329 | $this->click("xpath=//*[@id='additional_custom_post_id_multiple_3']/parent::td/span/a[text()='remove profile']"); | |
330 | $this->click("xpath=//*[@id='additional_custom_post_id_multiple_4']/parent::td/span/a[text()='remove profile']"); | |
6a488035 | 331 | $this->click("_qf_Registration_upload-bottom"); |
ed174dea | 332 | $this->waitForElementPresent("_qf_Registration_upload-bottom"); |
6a488035 TO |
333 | } |
334 | ||
4cbe18b8 EM |
335 | /** |
336 | * @param $customId | |
337 | * | |
338 | * @return array | |
339 | */ | |
6a488035 TO |
340 | function _testGetProfileId($customId) { |
341 | // create profiles | |
342 | $profileId = array(); | |
343 | $profilefield = array( | |
344 | 'street_address' => 'street_address', | |
345 | 'supplemental_address_1' => 'supplemental_address_1', | |
346 | 'city' => 'city', | |
347 | ); | |
42daf119 CW |
348 | $location = 1; |
349 | $type = "Contact"; | |
6a488035 TO |
350 | $profileId1 = $this->_testCreateProfile($profilefield, $location, $type); |
351 | array_push($profileId, $profileId1); | |
352 | ||
353 | $profilefield = array( | |
354 | 'street_address' => 'street_address', | |
355 | 'city' => 'city', | |
356 | 'phone' => 'phone', | |
357 | 'postal_code' => 'postal_code', | |
358 | ); | |
42daf119 CW |
359 | $location = 0; |
360 | $type = "Contact"; | |
6a488035 TO |
361 | $profileId2 = $this->_testCreateProfile($profilefield, $location, $type); |
362 | array_push($profileId, $profileId2); | |
363 | ||
364 | $profilefield = array( | |
365 | 'nick_name' => 'nick_name', | |
366 | 'url' => 'url', | |
367 | ); | |
42daf119 CW |
368 | $location = 0; |
369 | $type = "Contact"; | |
6a488035 TO |
370 | $profileId3 = $this->_testCreateProfile($profilefield, $location, $type); |
371 | array_push($profileId, $profileId3); | |
372 | ||
373 | $profilefield = array( | |
374 | 'current_employer' => 'current_employer', | |
375 | 'job_title' => 'job_title', | |
376 | ); | |
42daf119 CW |
377 | $location = 0; |
378 | $type = "Individual"; | |
6a488035 TO |
379 | $profileId4 = $this->_testCreateProfile($profilefield, $location, $type); |
380 | array_push($profileId, $profileId4); | |
381 | ||
382 | $profilefield = array( | |
383 | 'middle_name' => 'middle_name', | |
83739141 | 384 | 'gender_id' => 'gender_id', |
6a488035 | 385 | ); |
42daf119 CW |
386 | $location = 0; |
387 | $type = "Individual"; | |
6a488035 TO |
388 | $profileId5 = $this->_testCreateProfile($profilefield, $location, $type); |
389 | array_push($profileId, $profileId5); | |
390 | ||
391 | $profilefield = array( | |
392 | 'custom_' . $customId[0] => 'custom_' . $customId[0], | |
393 | 'custom_' . $customId[1] => 'custom_' . $customId[1], | |
394 | 'custom_' . $customId[2] => 'custom_' . $customId[2], | |
395 | ); | |
42daf119 CW |
396 | $location = 0; |
397 | $type = "Contact"; | |
6a488035 TO |
398 | $profileId6 = $this->_testCreateProfile($profilefield, $location, $type); |
399 | array_push($profileId, $profileId6); | |
400 | ||
401 | $profilefield = array( | |
402 | 'participant_role' => 'participant_role', | |
403 | ); | |
42daf119 CW |
404 | $location = 0; |
405 | $type = "Participant"; | |
6a488035 TO |
406 | $profileId7 = $this->_testCreateProfile($profilefield, $location, $type); |
407 | array_push($profileId, $profileId7); | |
408 | ||
409 | return $profileId; | |
410 | } | |
411 | ||
4cbe18b8 EM |
412 | /** |
413 | * @param $profilefield | |
414 | * @param int $location | |
415 | * @param $type | |
416 | * | |
417 | * @return null | |
418 | */ | |
6a488035 TO |
419 | function _testCreateProfile($profilefield, $location = 0, $type) { |
420 | $locationfields = array( | |
421 | 'supplemental_address_1', | |
422 | 'supplemental_address_2', | |
423 | 'city', | |
424 | 'country', | |
425 | 'email', | |
426 | 'state', | |
427 | 'street_address', | |
428 | 'postal_code', | |
429 | ); | |
430 | ||
42daf119 | 431 | // Add new profile. |
6a488035 | 432 | $profilename = "Profile_" . substr(sha1(rand()), 0, 7); |
071a6d2e | 433 | $this->openCiviPage("admin/uf/group", "reset=1"); |
6a488035 TO |
434 | $this->click('newCiviCRMProfile-top'); |
435 | $this->waitForElementPresent('_qf_Group_next-top'); | |
436 | ||
437 | //Name of profile | |
438 | $this->type('title', $profilename); | |
ed174dea | 439 | $this->click('uf_group_type_Profile'); |
6a488035 TO |
440 | $this->click('_qf_Group_next-top'); |
441 | $this->waitForPageToLoad($this->getTimeoutMsec()); | |
a471a3b6 | 442 | $profileId = $this->urlArg('gid'); |
6a488035 TO |
443 | |
444 | //Add field to profile_testCreateProfile | |
445 | foreach ($profilefield as $key => $value) { | |
071a6d2e | 446 | $this->openCiviPage("admin/uf/group/field/add", "reset=1&action=add&gid=$profileId"); |
6a488035 TO |
447 | if (in_array($value, $locationfields)) { |
448 | $this->select("field_name[0]", "value={$type}"); | |
449 | $this->select("field_name[1]", "value={$value}"); | |
450 | $this->select("field_name[2]", "value={$location}"); | |
451 | $this->type("label", $value); | |
452 | } | |
453 | else { | |
454 | $this->select("field_name[0]", "value={$type}"); | |
455 | $this->select("field_name[1]", "value={$value}"); | |
456 | $this->type("label", $value); | |
457 | } | |
458 | $this->click('_qf_Field_next-top'); | |
459 | $this->waitForPageToLoad($this->getTimeoutMsec()); | |
460 | } | |
461 | return $profileId; | |
462 | } | |
463 | ||
4cbe18b8 EM |
464 | /** |
465 | * @param $eventTitle | |
466 | * @param $eventDescription | |
467 | */ | |
6a488035 | 468 | function _testAddEventInfo($eventTitle, $eventDescription) { |
6a488035 TO |
469 | $this->waitForElementPresent("_qf_EventInfo_upload-bottom"); |
470 | ||
6a488035 TO |
471 | $this->select("event_type_id", "value=1"); |
472 | ||
473 | // Attendee role s/b selected now. | |
474 | $this->select("default_role_id", "value=1"); | |
475 | ||
476 | // Enter Event Title, Summary and Description | |
477 | $this->type("title", $eventTitle); | |
478 | $this->type("summary", "This is a great conference. Sign up now!"); | |
479 | ||
480 | // Type description in ckEditor (fieldname, text to type, editor) | |
481 | $this->fillRichTextField("description", $eventDescription, 'CKEditor'); | |
482 | ||
483 | // Choose Start and End dates. | |
484 | // Using helper webtestFillDate function. | |
485 | $this->webtestFillDateTime("start_date", "+1 week"); | |
486 | $this->webtestFillDateTime("end_date", "+1 week 1 day 8 hours "); | |
487 | ||
488 | $this->type("max_participants", "50"); | |
489 | $this->click("is_map"); | |
490 | $this->click("_qf_EventInfo_upload-bottom"); | |
491 | } | |
492 | ||
4cbe18b8 EM |
493 | /** |
494 | * @param $streetAddress | |
495 | */ | |
6a488035 TO |
496 | function _testAddLocation($streetAddress) { |
497 | // Wait for Location tab form to load | |
498 | $this->waitForPageToLoad($this->getTimeoutMsec()); | |
499 | $this->waitForElementPresent("_qf_Location_upload-bottom"); | |
500 | ||
501 | // Fill in address fields | |
502 | //$streetAddress = "100 Main Street"; | |
503 | $this->type("address_1_street_address", $streetAddress); | |
504 | $this->type("address_1_city", "San Francisco"); | |
cfa3419f RK |
505 | $this->waitForElementPresent('address_1_country_id'); |
506 | $this->select("address_1_country_id", "value=1228"); | |
6a488035 TO |
507 | $this->type("address_1_postal_code", "94117"); |
508 | $this->select("address_1_state_province_id", "value=1004"); | |
509 | $this->type("email_1_email", "info@civicrm.org"); | |
510 | ||
511 | $this->click("_qf_Location_upload-bottom"); | |
512 | ||
513 | // Wait for "saved" status msg | |
ed174dea | 514 | $this->waitForElementPresent("_qf_Location_upload-bottom"); |
cfa3419f | 515 | $this->waitForText('crm-notification-container', "'Event Location' information has been saved."); |
6a488035 TO |
516 | } |
517 | ||
4cbe18b8 EM |
518 | /** |
519 | * @param bool $discount | |
520 | * @param bool $priceSet | |
521 | * @param string $processorName | |
522 | */ | |
6a488035 TO |
523 | function _testAddFees($discount = FALSE, $priceSet = FALSE, $processorName = "PP Pro") { |
524 | // Go to Fees tab | |
525 | $this->click("link=Fees"); | |
526 | $this->waitForElementPresent("_qf_Fee_upload-bottom"); | |
527 | $this->click("CIVICRM_QFID_1_is_monetary"); | |
528 | ||
529 | // select newly created processor | |
530 | $xpath = "xpath=//label[text() = '{$processorName}']/preceding-sibling::input[1]"; | |
d275114d | 531 | $this->assertElementContainsText('css=.crm-event-manage-fee-form-block-payment_processor', $processorName); |
6a488035 TO |
532 | $this->check($xpath); |
533 | $this->select("financial_type_id", "label=Event Fee"); | |
534 | if ($priceSet) { | |
535 | // get one - TBD | |
536 | } | |
537 | else { | |
538 | $this->type("label_1", "Member"); | |
539 | $this->type("value_1", "250.00"); | |
540 | $this->type("label_2", "Non-member"); | |
541 | $this->type("value_2", "325.00"); | |
542 | //set default | |
543 | $this->click("xpath=//table[@id='map-field-table']/tbody/tr[2]/td[3]/input"); | |
544 | } | |
545 | ||
546 | if ($discount) { | |
547 | // enter early bird discounts TBD | |
548 | } | |
549 | ||
550 | $this->click("_qf_Fee_upload-bottom"); | |
551 | ||
552 | // Wait for "saved" status msg | |
ed174dea | 553 | $this->waitForElementPresent("_qf_Fee_upload-bottom"); |
554 | $this->waitForTextPresent("'Fees' information has been saved."); | |
6a488035 TO |
555 | } |
556 | ||
4cbe18b8 EM |
557 | /** |
558 | * @param $profileId | |
559 | * | |
560 | * @return null | |
561 | */ | |
6a488035 TO |
562 | function _testAddMultipleProfile($profileId) { |
563 | // Go to Online Contribution tab | |
564 | $this->click("link=Online Registration"); | |
565 | $this->waitForElementPresent("_qf_Registration_upload-bottom"); | |
566 | $this->click("is_online_registration"); | |
567 | $this->check("is_multiple_registrations"); | |
60709d21 JP |
568 | $this->select("xpath=//*[@id='custom_pre_id']/parent::td/div[1]/div/span/select[@class='select2-offscreen']", "value=1"); |
569 | $this->select("xpath=//*[@id='custom_post_id']/parent::td/div[1]/div/span/select[@class='select2-offscreen']", "value=" . $profileId[3]); | |
570 | $this->select("xpath=//*[@id='additional_custom_post_id']/parent::td/div[1]/div/span/select[@class='select2-offscreen']", "- same as for main contact -"); | |
6a488035 | 571 | |
60709d21 JP |
572 | $this->waitForElementPresent("xpath=//div[@id='registration_screen']/table[2]//tbody/tr[2]/td[2]/span/a[text()='add another profile (bottom of page)']"); |
573 | $this->click("xpath=//div[@id='registration_screen']/table[2]//tbody/tr[2]/td[2]/span/a[text()='add another profile (bottom of page)']"); | |
6a488035 | 574 | $this->waitForElementPresent("custom_post_id_multiple_1"); |
60709d21 | 575 | $this->select("xpath=//*[@id='custom_post_id_multiple_1']/parent::td/div[1]/div/span/select[@class='select2-offscreen']", "value=" . $profileId[2]); |
6a488035 | 576 | |
60709d21 JP |
577 | $this->waitForElementPresent("xpath=//div[@id='registration_screen']/table[2]//tbody/tr[2]/td[2]/span/a[text()='add another profile (bottom of page)']"); |
578 | $this->click("xpath=//div[@id='registration_screen']/table[2]//tbody/tr[2]/td[2]/span/a[text()='add another profile (bottom of page)']"); | |
6a488035 | 579 | $this->waitForElementPresent("custom_post_id_multiple_2"); |
60709d21 | 580 | $this->select("xpath=//*[@id='custom_post_id_multiple_2']/parent::td/div[1]/div/span/select[@class='select2-offscreen']", "value=" . $profileId[1]); |
6a488035 | 581 | |
60709d21 JP |
582 | $this->waitForElementPresent("xpath=//div[@id='registration_screen']/table[2]//tbody/tr[2]/td[2]/span/a[text()='add another profile (bottom of page)']"); |
583 | $this->click("xpath=//div[@id='registration_screen']/table[2]//tbody/tr[2]/td[2]/span/a[text()='add another profile (bottom of page)']"); | |
6a488035 | 584 | $this->waitForElementPresent("custom_post_id_multiple_3"); |
60709d21 | 585 | $this->select("xpath=//*[@id='custom_post_id_multiple_3']/parent::td/div[1]/div/span/select[@class='select2-offscreen']", "value=" . $profileId[4]); |
6a488035 | 586 | |
60709d21 JP |
587 | $this->waitForElementPresent("xpath=//div[@id='registration_screen']/table[2]//tbody/tr[2]/td[2]/span/a[text()='add another profile (bottom of page)']"); |
588 | $this->click("xpath=//div[@id='registration_screen']/table[2]//tbody/tr[2]/td[2]/span/a[text()='add another profile (bottom of page)']"); | |
6a488035 | 589 | $this->waitForElementPresent("custom_post_id_multiple_4"); |
60709d21 | 590 | $this->select("xpath=//*[@id='custom_post_id_multiple_4']/parent::td/div[1]/div/span/select[@class='select2-offscreen']", "value=" . $profileId[5]); |
6a488035 | 591 | |
60709d21 JP |
592 | $this->waitForElementPresent("xpath=//div[@id='registration_screen']/table[2]//tbody/tr[2]/td[2]/span/a[text()='add another profile (bottom of page)']"); |
593 | $this->click("xpath=//div[@id='registration_screen']/table[2]//tbody/tr[2]/td[2]/span/a[text()='add another profile (bottom of page)']"); | |
6a488035 | 594 | $this->waitForElementPresent("custom_post_id_multiple_5"); |
60709d21 | 595 | $this->select("xpath=//*[@id='custom_post_id_multiple_5']/parent::td/div[1]/div/span/select[@class='select2-offscreen']", "value=" . $profileId[6]); |
6a488035 | 596 | |
60709d21 JP |
597 | $this->waitForElementPresent("xpath=//div[@id='registration_screen']/table[3]//tbody/tr[2]/td[2]/span/a[text()='add another profile (bottom of page)']"); |
598 | $this->click("xpath=//div[@id='registration_screen']/table[3]//tbody/tr[2]/td[2]/span/a[text()='add another profile (bottom of page)']"); | |
6a488035 | 599 | $this->waitForElementPresent("additional_custom_post_id_multiple_1"); |
60709d21 | 600 | $this->select("xpath=//*[@id='additional_custom_post_id_multiple_1']/parent::td/div[1]/div/span/select[@class='select2-offscreen']", "value=" . $profileId[5]); |
6a488035 | 601 | |
60709d21 JP |
602 | $this->waitForElementPresent("xpath=//div[@id='registration_screen']/table[3]//tbody/tr[2]/td[2]/span/a[text()='add another profile (bottom of page)']"); |
603 | $this->click("xpath=//div[@id='registration_screen']/table[3]//tbody/tr[2]/td[2]/span/a[text()='add another profile (bottom of page)']"); | |
6a488035 | 604 | $this->waitForElementPresent("additional_custom_post_id_multiple_2"); |
60709d21 | 605 | $this->select("xpath=//*[@id='additional_custom_post_id_multiple_2']/parent::td/div[1]/div/span/select[@class='select2-offscreen']", "value=" . $profileId[1]); |
6a488035 | 606 | |
60709d21 JP |
607 | $this->waitForElementPresent("xpath=//div[@id='registration_screen']/table[3]//tbody/tr[2]/td[2]/span/a[text()='add another profile (bottom of page)']"); |
608 | $this->click("xpath=//div[@id='registration_screen']/table[3]//tbody/tr[2]/td[2]/span/a[text()='add another profile (bottom of page)']"); | |
6a488035 | 609 | $this->waitForElementPresent("additional_custom_post_id_multiple_3"); |
60709d21 | 610 | $this->select("xpath=//*[@id='additional_custom_post_id_multiple_3']/parent::td/div[1]/div/span/select[@class='select2-offscreen']", "value=" . $profileId[2]); |
6a488035 | 611 | |
60709d21 JP |
612 | $this->waitForElementPresent("xpath=//div[@id='registration_screen']/table[3]//tbody/tr[2]/td[2]/span/a[text()='add another profile (bottom of page)']"); |
613 | $this->click("xpath=//div[@id='registration_screen']/table[3]//tbody/tr[2]/td[2]/span/a[text()='add another profile (bottom of page)']"); | |
6a488035 | 614 | $this->waitForElementPresent("additional_custom_post_id_multiple_4"); |
60709d21 | 615 | $this->select("xpath=//*[@id='additional_custom_post_id_multiple_4']/parent::td/div[1]/div/span/select[@class='select2-offscreen']", "value=" . $profileId[3]); |
6a488035 TO |
616 | |
617 | $this->click("CIVICRM_QFID_1_is_email_confirm"); | |
618 | $this->type("confirm_from_name", "TestEvent"); | |
619 | $this->type("confirm_from_email", "testevent@test.com"); | |
620 | $this->click("_qf_Registration_upload-bottom"); | |
621 | ||
622 | // Wait for "saved" status msg | |
ed174dea | 623 | $this->waitForElementPresent("_qf_Registration_upload-bottom"); |
624 | $this->waitForText('crm-notification-container', "'Online Registration' information has been saved."); | |
6a488035 | 625 | |
a471a3b6 | 626 | return $this->urlArg('id'); |
6a488035 TO |
627 | } |
628 | ||
4cbe18b8 EM |
629 | /** |
630 | * @param $eventPageId | |
631 | * @param $customId | |
632 | * @param $firstName | |
633 | * @param $lastName | |
634 | * @param $participantfname | |
635 | * @param $participantlname | |
636 | * @param $email1 | |
637 | * @param $email2 | |
638 | */ | |
6a488035 | 639 | function _testEventRegistration($eventPageId, $customId, $firstName, $lastName, |
d0711ea4 | 640 | $participantfname, $participantlname, $email1, $email2 |
6a488035 | 641 | ) { |
42daf119 | 642 | $this->openCiviPage("event/register", "id={$eventPageId}&reset=1", "_qf_Register_upload-bottom"); |
6a488035 TO |
643 | $this->select("additional_participants", "value=1"); |
644 | ||
645 | $this->type("email-Primary", $email1); | |
646 | $this->type("first_name", $firstName); | |
647 | $this->type("last_name", $lastName); | |
648 | $this->type("street_address-1", "Test street addres"); | |
649 | $this->type("city-1", "Mumbai"); | |
650 | $this->type("postal_code-1", "2354"); | |
651 | $this->select("state_province-1", "value=1001"); | |
652 | ||
653 | // Credit Card Info | |
654 | $this->select("credit_card_type", "value=Visa"); | |
655 | $this->type("credit_card_number", "4111111111111111"); | |
656 | $this->type("cvv2", "000"); | |
657 | $this->select("credit_card_exp_date[M]", "value=1"); | |
658 | $this->select("credit_card_exp_date[Y]", "value=2020"); | |
659 | ||
660 | //Billing Info | |
661 | $this->type("billing_first_name", $firstName . 'billing'); | |
662 | $this->type("billing_last_name", $lastName . 'billing'); | |
663 | $this->type("billing_street_address-5", "0121 Mount Highschool."); | |
664 | $this->type(" billing_city-5", "Shangai"); | |
665 | $this->select("billing_country_id-5", "value=1228"); | |
666 | $this->select("billing_state_province_id-5", "value=1004"); | |
667 | $this->type("billing_postal_code-5", "94129"); | |
668 | ||
669 | $this->type("current_employer", "ABCD"); | |
670 | $this->type("job_title", "Painter"); | |
cfa3419f | 671 | $this->waitForElementPresent('nick_name'); |
6a488035 TO |
672 | $this->type("nick_name", "Nick"); |
673 | $this->type("url-1", "http://www.test.com"); | |
674 | ||
675 | $this->type("street_address-Primary", "Primary street address"); | |
676 | $this->type("city-Primary", "primecity"); | |
677 | $this->type("phone-Primary-1", "98667764"); | |
678 | $this->type("postal_code-Primary", "6548"); | |
679 | ||
680 | $this->type("custom_" . $customId[0], "fname_custom1"); | |
681 | $this->type("custom_" . $customId[1], "mname_custom1"); | |
682 | $this->type("custom_" . $customId[2], "lname_custom1"); | |
683 | ||
684 | $this->type("middle_name", "xyz"); | |
83739141 | 685 | $this->click("name=gender_id value=2"); |
6a488035 TO |
686 | $this->select("participant_role", "value=2"); |
687 | ||
688 | $this->click("_qf_Register_upload-bottom"); | |
689 | $this->waitForElementPresent("_qf_Participant_1_next-Array"); | |
690 | ||
691 | $this->type("email-Primary", $email2); | |
692 | $this->type("first_name", $participantfname); | |
693 | $this->type("last_name", $participantlname); | |
694 | $this->type("street_address-1", "participant street addres"); | |
695 | $this->type("city-1", "pune"); | |
696 | $this->type("postal_code-1", "2354"); | |
697 | $this->select("state_province-1", "value=1001"); | |
698 | ||
699 | $this->type("current_employer", "ABCD"); | |
700 | $this->type("job_title", "Potato picker"); | |
701 | ||
702 | $this->type("custom_" . $customId[0], "participant_custom1"); | |
703 | $this->type("custom_" . $customId[1], "participant_custom1"); | |
704 | $this->type("custom_" . $customId[2], "participant_custom1"); | |
705 | ||
706 | $this->type("street_address-Primary", "Primary street address"); | |
707 | $this->type("city-Primary", "primecity"); | |
708 | $this->type("phone-Primary-1", "98667764"); | |
709 | $this->type("postal_code-Primary", "6548"); | |
710 | ||
711 | $this->type("nick_name", "Nick1"); | |
712 | $this->type("url-1", "http://www.part.com"); | |
713 | ||
225a8648 | 714 | $this->clickLink("_qf_Participant_1_next-Array", "_qf_Confirm_next-bottom"); |
6a488035 TO |
715 | $this->click("_qf_Confirm_next-bottom"); |
716 | $this->waitForPageToLoad($this->getTimeoutMsec()); | |
717 | } | |
718 | ||
4cbe18b8 EM |
719 | /** |
720 | * @param $eventPageId | |
721 | * @param $customId | |
722 | * @param $firstName2 | |
723 | * @param $lastName2 | |
724 | * @param $participantfname2 | |
725 | * @param $participantlname2 | |
726 | * @param $email3 | |
727 | * @param $email4 | |
728 | */ | |
6a488035 | 729 | function _testEventRegistrationAfterRemoving($eventPageId, $customId, $firstName2, $lastName2, $participantfname2, $participantlname2, $email3, $email4) { |
42daf119 | 730 | $this->openCiviPage("event/register", "id={$eventPageId}&reset=1", "_qf_Register_upload-bottom"); |
6a488035 TO |
731 | $this->select("additional_participants", "value=1"); |
732 | ||
733 | $this->type("email-Primary", $email4); | |
734 | $this->type("first_name", $firstName2); | |
735 | $this->type("last_name", $lastName2); | |
736 | $this->type("street_address-1", "Test street addres"); | |
737 | $this->type("city-1", "Mumbai"); | |
738 | $this->type("postal_code-1", "2354"); | |
739 | $this->select("state_province-1", "value=1001"); | |
740 | ||
741 | // Credit Card Info | |
742 | $this->select("credit_card_type", "value=Visa"); | |
743 | $this->type("credit_card_number", "4111111111111111"); | |
744 | $this->type("cvv2", "000"); | |
745 | $this->select("credit_card_exp_date[M]", "value=1"); | |
746 | $this->select("credit_card_exp_date[Y]", "value=2020"); | |
747 | ||
748 | //Billing Info | |
749 | $this->type("billing_first_name", $firstName2 . 'billing'); | |
750 | $this->type("billing_last_name", $lastName2 . 'billing'); | |
751 | $this->type("billing_street_address-5", "0121 Mount Highschool."); | |
752 | $this->type(" billing_city-5", "Shangai"); | |
753 | $this->select("billing_country_id-5", "value=1228"); | |
754 | $this->select("billing_state_province_id-5", "value=1004"); | |
755 | $this->type("billing_postal_code-5", "94129"); | |
756 | ||
757 | $this->type("current_employer", "ABCD"); | |
758 | $this->type("job_title", "Painter"); | |
759 | ||
760 | $this->type("nick_name", "Nickkk"); | |
761 | $this->type("url-1", "http://www.testweb.com"); | |
762 | ||
763 | $this->type("street_address-Primary", "Primary street address"); | |
764 | $this->type("city-Primary", "primecity"); | |
765 | $this->type("phone-Primary-1", "9866776422"); | |
766 | $this->type("postal_code-Primary", "6534"); | |
767 | ||
768 | $this->type("custom_" . $customId[0], "fname_custom1"); | |
769 | $this->type("custom_" . $customId[1], "mname_custom1"); | |
770 | $this->type("custom_" . $customId[2], "lname_custom1"); | |
771 | ||
772 | $this->type("middle_name", "xyz"); | |
83739141 | 773 | $this->click("name=gender_id value=2"); |
6a488035 TO |
774 | $this->select("participant_role", "value=2"); |
775 | ||
776 | $this->click("_qf_Register_upload-bottom"); | |
777 | $this->waitForElementPresent("_qf_Participant_1_next-Array"); | |
778 | ||
779 | $this->type("email-Primary", $email3); | |
780 | $this->type("first_name", $participantfname2); | |
781 | $this->type("last_name", $participantlname2); | |
782 | $this->type("street_address-1", "participant street addres"); | |
783 | $this->type("city-1", "pune"); | |
784 | $this->type("postal_code-1", "2354"); | |
785 | $this->select("state_province-1", "value=1001"); | |
786 | ||
787 | $this->type("current_employer", "ABCD"); | |
788 | $this->type("job_title", "BATCHER"); | |
789 | ||
225a8648 | 790 | $this->clickLink("_qf_Participant_1_next-Array", "_qf_Confirm_next-bottom"); |
6a488035 TO |
791 | $this->click("_qf_Confirm_next-bottom"); |
792 | } | |
76e86fd8 | 793 | |
4cbe18b8 EM |
794 | /** |
795 | * @return array|string | |
796 | */ | |
d0711ea4 | 797 | function _addEmailField() { |
6a488035 | 798 | //add email field in name and address profile |
42daf119 | 799 | $this->openCiviPage('admin/uf/group/field/add', 'reset=1&action=add&gid=1', "_qf_Field_next-bottom"); |
6a488035 TO |
800 | $this->select("field_name[0]", "value=Contact"); |
801 | $this->select("field_name[1]", "value=email"); | |
802 | $this->select("field_name[2]", "value=0"); | |
803 | $this->click('_qf_Field_next-bottom'); | |
804 | $this->waitForPageToLoad($this->getTimeoutMsec()); | |
76e86fd8 | 805 | |
6a488035 TO |
806 | $cfId = ""; |
807 | //check wheather webtest has created the field | |
d0711ea4 | 808 | if ($this->assertElementNotContainsText('crm-notification-container', "The selected field was not added. It already exists in this profile")) { |
6a488035 TO |
809 | $this->waitForElementPresent("xpath=//div[@id='field_page']//table/tbody//tr[8]/td[9]/span/a[text()='Edit']"); |
810 | $cfId = explode('&id=', $this->getAttribute("xpath=//div[@id='field_page']//table/tbody//tr[8]/td[9]/span/a[text()='Edit']/@href")); | |
811 | $cfId = $cfId[1]; | |
812 | } | |
813 | return $cfId; | |
814 | } | |
76e86fd8 | 815 | |
4cbe18b8 EM |
816 | /** |
817 | * @param $cfId | |
818 | */ | |
76e86fd8 | 819 | function _removeEmailField($cfId) { |
071a6d2e | 820 | $this->openCiviPage("admin/uf/group/field", "action=delete&id={$cfId}"); |
6a488035 TO |
821 | $this->click("_qf_Field_next-bottom"); |
822 | $this->waitForPageToLoad($this->getTimeoutMsec()); | |
823 | } | |
232624b1 | 824 | } |