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