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_Profile_MultiRecordProfileAddTest | |
31 | */ | |
6a488035 TO |
32 | class WebTest_Profile_MultiRecordProfileAddTest extends CiviSeleniumTestCase { |
33 | ||
34 | protected function setUp() { | |
35 | parent::setUp(); | |
36 | } | |
37 | function testAdminAddNewProfile() { | |
6a488035 | 38 | $this->webtestLogin(); |
a90b085c PJ |
39 | list($id, $profileTitle) = $this->_addNewProfile(); |
40 | $this->_deleteProfile($id, $profileTitle); | |
6a488035 TO |
41 | } |
42 | ||
43 | function testUserAddNewProfile() { | |
050fb75a PJ |
44 | //add the required permission |
45 | $permissions = array( | |
46 | 'edit-2-profile-listings-and-forms', | |
47 | 'edit-2-access-all-custom-data', | |
48 | 'edit-2-access-civicrm' | |
49 | ); | |
50 | $this->changePermissions($permissions); | |
a90b085c PJ |
51 | list($id, $profileTitle) = $this->_addNewProfile(TRUE, FALSE, TRUE); |
52 | $this->_deleteProfile($id, $profileTitle); | |
6a488035 | 53 | } |
b2552577 | 54 | |
6a488035 | 55 | function testAddNewNonMultiProfile() { |
6a488035 | 56 | $this->webtestLogin(); |
a90b085c PJ |
57 | list($id, $profileTitle) = $this->_addNewProfile(FALSE); |
58 | $this->_deleteProfile($id, $profileTitle); | |
6a488035 | 59 | } |
b2552577 | 60 | |
6a488035 | 61 | function testNonSearchableMultiProfile() { |
6a488035 | 62 | $this->webtestLogin(); |
a90b085c PJ |
63 | list($id, $profileTitle) = $this->_addNewProfile(TRUE, TRUE); |
64 | $this->_deleteProfile($id, $profileTitle); | |
6a488035 | 65 | } |
b2552577 | 66 | |
4cbe18b8 EM |
67 | /** |
68 | * @param bool $checkMultiRecord | |
69 | * @param bool $checkSearchable | |
70 | * @param bool $userCheck | |
71 | * | |
72 | * @return array | |
73 | */ | |
6a488035 | 74 | function _addNewProfile($checkMultiRecord = TRUE, $checkSearchable = FALSE, $userCheck = FALSE) { |
6a488035 | 75 | $params = $this->_testCustomAdd($checkSearchable); |
42daf119 | 76 | |
38bf8139 | 77 | $this->openCiviPage('admin/uf/group', 'reset=1'); |
6a488035 | 78 | |
b2552577 | 79 | $this->click('newCiviCRMProfile-top'); |
6a488035 TO |
80 | $this->waitForElementPresent('_qf_Group_next-bottom'); |
81 | ||
82 | //Name of profile | |
83 | $profileTitle = 'profile_' . substr(sha1(rand()), 0, 7); | |
84 | $this->type('title', $profileTitle); | |
85 | ||
f1690d4a | 86 | $this->click('uf_group_type_Profile'); |
6a488035 | 87 | //profile Used for |
6a488035 TO |
88 | $this->click('uf_group_type_User Account'); |
89 | ||
90 | //Profile Advance Settings | |
91 | $this->click("//form[@id='Group']/div[2]/div[2]/div[1]"); | |
92 | ||
93 | //If you want member(s) of your organization to receive a | |
94 | //notification email whenever this Profile | |
95 | //form is used to enter or update contact information, enter one or more email addresses here. | |
96 | $this->type('notify', 'This is notify email'); | |
97 | ||
98 | //Drupal user account registration option | |
99 | $this->click('CIVICRM_QFID_0_8'); | |
100 | ||
101 | //What to do upon duplicate match | |
102 | $this->click('CIVICRM_QFID_1_4'); | |
103 | ||
104 | //Proximity search options | |
105 | $this->click('CIVICRM_QFID_0_14'); | |
106 | ||
107 | // enable maping for contact | |
108 | $this->click('is_map'); | |
109 | ||
110 | // include a link in the listings to Edit profile fields | |
111 | $this->click('is_edit_link'); | |
112 | ||
113 | //to view contacts' Drupal user account information | |
114 | $this->click('is_uf_link'); | |
115 | ||
116 | //click on save | |
117 | $this->click('_qf_Group_next'); | |
6a488035 TO |
118 | |
119 | //check for profile create | |
6c5f7368 | 120 | $this->waitForText('crm-notification-container', "Your CiviCRM Profile '{$profileTitle}' has been added. You can add fields to this profile now."); |
6a488035 TO |
121 | |
122 | //Add field to profile | |
123 | $this->waitForElementPresent('field_name[0]'); | |
124 | $this->click('field_name[0]'); | |
125 | $this->select('field_name[0]', 'value=Contact'); | |
b2552577 | 126 | $this->click("//option[@value='Contact']"); |
6a488035 TO |
127 | $this->click('field_name_1'); |
128 | $this->select('field_name_1', 'label='.$params['textFieldLabel'].' :: '.$params['customGroupTitle']); | |
129 | if ($checkMultiRecord) { | |
130 | $this->click('is_multi_summary'); | |
131 | } | |
132 | if (!$checkSearchable) { | |
133 | $this->click('is_searchable'); | |
134 | $this->select('visibility', 'value=Public Pages and Listings'); | |
135 | } | |
136 | else { | |
137 | $this->select('visibility', 'value=User and User Admin Only'); | |
138 | } | |
139 | $this->click('in_selector'); | |
140 | $this->click('is_required'); | |
141 | $this->type('help_post', 'This is help for profile field'); | |
142 | $this->click('_qf_Field_next_new-top'); | |
143 | $this->waitForPageToLoad($this->getTimeoutMsec()); | |
144 | $this->click('field_name[0]'); | |
145 | $this->select('field_name[0]', 'value=Contact'); | |
146 | $this->click("//option[@value='Contact']"); | |
147 | $this->click('field_name_1'); | |
148 | $this->select('field_name_1', 'label='.$params['selectFieldLabel'].' :: '.$params['customGroupTitle']); | |
149 | if ($checkMultiRecord) { | |
150 | $this->click('is_multi_summary'); | |
151 | } | |
152 | $this->select('visibility', 'value=Public Pages and Listings'); | |
153 | $this->click('is_searchable'); | |
154 | $this->click('in_selector'); | |
155 | $this->type('help_post', 'This is help for profile field'); | |
156 | $this->click('_qf_Field_next_new-top'); | |
157 | ||
158 | // Add Contact | |
159 | $this->waitForPageToLoad($this->getTimeoutMsec()); | |
160 | $this->click('field_name[0]'); | |
161 | $this->select('field_name[0]', 'value=Student'); | |
162 | $this->click("//option[@value='Student']"); | |
b2552577 | 163 | |
6a488035 TO |
164 | $this->click('field_name_1'); |
165 | $this->select('field_name_1', 'value=first_name'); | |
166 | $this->click('is_multi_summary'); | |
167 | $this->select('visibility', 'value=Public Pages and Listings'); | |
168 | $this->click('is_searchable'); | |
169 | $this->click('in_selector'); | |
170 | $this->type('help_post', 'This is help for profile field'); | |
171 | $this->click('_qf_Field_next_new-top'); | |
172 | $this->waitForPageToLoad($this->getTimeoutMsec()); | |
173 | $this->click('field_name[0]'); | |
174 | $this->select('field_name[0]', 'value=Student'); | |
175 | $this->click("//option[@value='Student']"); | |
176 | $this->click('field_name_1'); | |
177 | $this->select('field_name_1', 'value=last_name'); | |
178 | $this->select('visibility', 'value=Public Pages and Listings'); | |
179 | $this->click('is_searchable'); | |
180 | $this->click('in_selector'); | |
181 | $this->type('help_post', 'This is help for profile field'); | |
182 | $this->click('_qf_Field_next_new-top'); | |
183 | ||
184 | $this->waitForPageToLoad($this->getTimeoutMsec()); | |
185 | $this->click('field_name[0]'); | |
186 | $this->select('field_name[0]', 'value=Contact'); | |
187 | $this->click("//option[@value='Contact']"); | |
188 | $this->click('field_name_1'); | |
189 | $this->select('field_name_1', 'value=email'); | |
190 | $this->select('visibility', 'value=Public Pages and Listings'); | |
191 | $this->click('is_searchable'); | |
192 | $this->type('help_post', 'This is help for profile field'); | |
193 | $this->click('_qf_Field_next'); | |
194 | //click on save | |
195 | $this->waitForPageToLoad($this->getTimeoutMsec()); | |
196 | ||
f1690d4a | 197 | $uselink = explode('?', $this->getAttribute("xpath=//*[@id='field_page']/div[1]/a[4]@href")); |
198 | $this->openCiviPage('profile/create', "$uselink[1]", '_qf_Edit_cancel'); | |
6a488035 TO |
199 | $recordNew = $this->_addRecords('Create'); |
200 | $this->waitForPageToLoad($this->getTimeoutMsec()); | |
a471a3b6 | 201 | $elements = $this->parseURL(); |
9c7c904f | 202 | |
6a488035 TO |
203 | $gid = $elements['queryString']['gid']; |
204 | $id = $elements['queryString']['id']; | |
b2552577 | 205 | |
6a488035 | 206 | if ($userCheck) { |
b2552577 PJ |
207 | //add drupal user |
208 | $this->openCiviPage('contact/view/useradd', "reset=1&action=add&cid=$id", 'cms_name'); | |
6a488035 TO |
209 | $this->type('cms_name', $recordNew['firstname']); |
210 | $this->type('cms_pass', $recordNew['firstname']); | |
211 | $this->type('cms_confirm_pass', $recordNew['firstname']); | |
212 | $this->click('_qf_Useradd_next-bottom'); | |
213 | $this->waitForPageToLoad($this->getTimeoutMsec()); | |
42daf119 CW |
214 | $this->webtestLogout(); |
215 | ||
050fb75a | 216 | $this->webtestLogin($recordNew['firstname'], $recordNew['firstname']); |
6a488035 | 217 | } |
d45e6108 | 218 | $this->openCiviPage('profile/edit', "reset=1&id=$id&gid=$gid", NULL); |
6a488035 | 219 | if (!$checkMultiRecord) { |
9c7c904f | 220 | $this->assertElementContainsText('crm-container', 'No records'); |
a90b085c | 221 | return array($gid, $profileTitle); |
6a488035 | 222 | } |
ee88fff2 PJ |
223 | $this->waitForElementPresent("//a/span[contains(text(), 'Add New Record')]"); |
224 | $this->click("//a/span[contains(text(), 'Add New Record')]"); | |
f1690d4a | 225 | $this->waitForElementPresent("_qf_Edit_cancel"); |
6a488035 | 226 | $record1 = $this->_addRecords(); |
f1690d4a | 227 | $this->waitForElementPresent("//div[@id='custom--table-wrapper']/div/div/table/tbody/tr[2]/td[1]"); |
228 | $alertText = $this->getAlert(); | |
229 | $this->assertEquals("Thank you. Your information has been saved.", $alertText); | |
230 | $this->waitForElementPresent("//a/span[contains(text(), 'Add New Record')]"); | |
231 | $this->verifyText("//div[@id='custom--table-wrapper']/div/div/table/thead/tr/th[1]", preg_quote($params['textFieldLabel'])); | |
232 | $this->verifyText("//div[@id='custom--table-wrapper']/div/div/table/tbody/tr[2]/td[1]", preg_quote($record1['text'])); | |
ee88fff2 | 233 | $this->click("//a/span[contains(text(), 'Add New Record')]"); |
6a488035 | 234 | $record2 = $this->_addRecords(); |
f1690d4a | 235 | $this->waitForElementPresent("//div[@id='custom--table-wrapper']/div/div/table/tbody/tr[3]/td[1]"); |
236 | $alertText = $this->getAlert(); | |
237 | $this->assertEquals("Thank you. Your information has been saved.", $alertText); | |
238 | $this->waitForElementPresent("//div[@id='custom--table-wrapper']/div/div/table/tbody/tr[3]/td[1]"); | |
239 | $this->verifyText("//div[@id='custom--table-wrapper']/div/div/table/tbody/tr[3]/td[1]", preg_quote($record2['text'])); | |
b2552577 | 240 | |
6a488035 | 241 | // Check Max Record Limit |
ee88fff2 | 242 | $this->verifyElementNotPresent("//a/span[contains(text(), 'Add New Record')]"); |
b2552577 | 243 | |
6a488035 | 244 | //Check for edit functionality |
efb29358 CW |
245 | // Because it tends to cause problems, all uses of sleep() must be justified in comments |
246 | // Sleep should never be used for wait for anything to load from the server | |
247 | // Justification for this instance: FIXME | |
6a488035 | 248 | sleep(3); |
f1690d4a | 249 | $this->click("//div[@id='custom--table-wrapper']/div/div/table/tbody/tr/td[3]/span/a[text()='Edit']"); |
97e557d7 | 250 | $this->waitForElementPresent("xpath=//div[@class='ui-dialog-content ui-widget-content modal-dialog crm-ajax-container']/form/div[2]//div[@id='crm-profile-block']//div[@class='crm-submit-buttons']/span/input[@class='validate crm-form-submit default crm-form-submit']"); |
f1690d4a | 251 | $this->verifyText("//div[@id='custom--table-wrapper']/div/div/table/thead/tr/th[1]", preg_quote($params['textFieldLabel'])); |
252 | $this->type("//div[@id='crm-profile-block']/div/div[2]/input[@class='crm-form-text required']", $recordNew['text'].'edit'); | |
97e557d7 | 253 | $this->click("xpath=//div[@class='ui-dialog-content ui-widget-content modal-dialog crm-ajax-container']/form/div[2]//div[@id='crm-profile-block']//div[@class='crm-submit-buttons']/span/input[@class='validate crm-form-submit default crm-form-submit']"); |
f1690d4a | 254 | $this->waitForText("//div[@id='custom--table-wrapper']/div/div/table/tbody/tr[1]/td[1]", $recordNew['text'].'edit'); |
255 | $editalertText = $this->getAlert(); | |
256 | $this->assertEquals("Thank you. Your information has been saved.", $editalertText); | |
257 | $this->verifyText("//div[@id='custom--table-wrapper']/div/div/table/tbody/tr[1]/td[1]", preg_quote($recordNew['text'].'edit')); | |
b2552577 | 258 | |
6a488035 | 259 | // Check the delete functionality |
f1690d4a | 260 | $this->click("//div[@id='custom--table-wrapper']/div/div/table/tbody/tr/td[3]/span/a[text()='Delete']"); |
261 | $this->waitForElementPresent("xpath=//div[@class='ui-dialog-content ui-widget-content modal-dialog crm-ajax-container']/form/div[2]/div"); | |
262 | $this->assertElementContainsText("xpath=//div[@class='ui-dialog-content ui-widget-content modal-dialog crm-ajax-container']/form/div[2]/div", 'Are you sure you want to delete this record?'); | |
263 | $this->click('_qf_Edit_upload_delete'); | |
efb29358 CW |
264 | // Because it tends to cause problems, all uses of sleep() must be justified in comments |
265 | // Sleep should never be used for wait for anything to load from the server | |
266 | // Justification for this instance: FIXME | |
6a488035 | 267 | sleep(3); |
b2552577 | 268 | |
f1690d4a | 269 | $delText = $this->getAlert(); |
270 | $this->assertEquals("Deleted Your record has been deleted.", $delText); | |
6a488035 | 271 | // Check the view functionality |
efb29358 CW |
272 | // Because it tends to cause problems, all uses of sleep() must be justified in comments |
273 | // Sleep should never be used for wait for anything to load from the server | |
274 | // Justification for this instance: FIXME | |
6a488035 | 275 | sleep(3); |
f1690d4a | 276 | $this->click("//div[@id='custom--table-wrapper']/div/div/table/tbody/tr/td[3]/span/a[text()='View']"); |
277 | $this->waitForText("xpath=//div[@class='ui-dialog-titlebar ui-widget-header ui-corner-all ui-helper-clearfix']", 'View '.$params['customGroupTitle']); | |
278 | $this->assertElementContainsText("xpath=//div[@class='ui-dialog-content ui-widget-content modal-dialog crm-ajax-container']", $params['textFieldLabel']); | |
6a488035 | 279 | if ($checkSearchable) { |
9c7c904f | 280 | $this->verifyElementNotPresent("//div[@id='profile-dialog']/div/div/div/div/div[1]/div[2]/a"); |
a90b085c | 281 | return array($gid, $profileTitle); |
6a488035 | 282 | } |
b2552577 | 283 | |
6a488035 TO |
284 | // Check Search Functionality |
285 | if (!$userCheck) { | |
f1690d4a | 286 | $this->click("//div[@class='ui-dialog-content ui-widget-content modal-dialog crm-ajax-container']/div/div/div/div/div[2]/a"); |
6a488035 | 287 | $this->waitForElementPresent("//form[@id='Search']"); |
9c7c904f | 288 | $this->verifyText("//form[@id='Search']/div[2]/div[2]/div[2]/table/tbody/tr[2]/td[2]", preg_quote($recordNew['firstname'])); |
38bf8139 | 289 | $this->openCiviPage('profile/view', "reset=1&id=$id&gid=$gid", "//div[@id='row-first_name']/div[2]/a"); |
6a488035 TO |
290 | $this->click("//div[@id='row-first_name']/div[2]/a"); |
291 | $this->waitForElementPresent("//form[@id='Search']"); | |
292 | // Check that Email column is not present in selector results | |
9c7c904f PJ |
293 | $this->verifyElementNotPresent("//form[@id='Search']/div[2]/div[2]/div[2]/table/tbody/tr/th[7]/a[@label='Email (Primary)']"); |
294 | $this->verifyText("//form[@id='Search']/div[2]/div[2]/div[2]/table/tbody/tr/th[3]/a", preg_quote($params['textFieldLabel'])); | |
295 | $this->verifyText("//form[@id='Search']/div[2]/div[2]/div[2]/table/tbody/tr[2]/td[3]", preg_quote($record1['text'])); | |
296 | $this->verifyText("//form[@id='Search']/div[2]/div[2]/div[2]/table/tbody/tr[3]/td[3]", preg_quote($record2['text'])); | |
6a488035 | 297 | } |
a90b085c PJ |
298 | return array($gid, $profileTitle); |
299 | } | |
300 | ||
4cbe18b8 EM |
301 | /** |
302 | * @param $gid | |
303 | * @param $profileTitle | |
304 | */ | |
a90b085c | 305 | function _deleteProfile($gid, $profileTitle) { |
050fb75a | 306 | $this->webtestLogin(); |
a90b085c PJ |
307 | $this->openCiviPage("admin/uf/group", "action=delete&id={$gid}", '_qf_Group_next-bottom'); |
308 | $this->click('_qf_Group_next-bottom'); | |
309 | $this->waitForPageToLoad($this->getTimeoutMsec()); | |
310 | $this->assertElementContainsText('crm-container', "Your CiviCRM Profile '{$profileTitle}' has been deleted."); | |
6a488035 TO |
311 | } |
312 | ||
4cbe18b8 EM |
313 | /** |
314 | * @param $checkSearchable | |
315 | * | |
316 | * @return mixed | |
317 | */ | |
6a488035 | 318 | function _testCustomAdd($checkSearchable) { |
42daf119 | 319 | |
38bf8139 | 320 | $this->openCiviPage('admin/custom/group', 'action=add&reset=1'); |
6a488035 TO |
321 | |
322 | //fill custom group title | |
323 | $params['customGroupTitle'] = 'custom_group' . substr(sha1(rand()), 0, 3); | |
324 | $this->click("title"); | |
325 | $this->type("title", $params['customGroupTitle']); | |
326 | ||
327 | //custom group extends | |
328 | $this->click("extends[0]"); | |
329 | $this->select("extends[0]", "label=Contacts"); | |
330 | $this->click("//option[@value='Contact']"); | |
331 | $this->waitForElementPresent("//input[@id='is_multiple']"); | |
332 | $this->click("//input[@id='is_multiple']"); | |
333 | $this->type("max_multiple", 3); | |
334 | $this->click("//form[@id='Group']/div[2]/div[3]/span[1]/input"); | |
335 | $this->waitForPageToLoad($this->getTimeoutMsec()); | |
336 | ||
337 | //Is custom group created? | |
38bf8139 | 338 | $this->assertElementContainsText('crm-container', $params['customGroupTitle']); |
6a488035 TO |
339 | //add custom field - alphanumeric text |
340 | $params['textFieldLabel'] = 'test_text_field' . substr(sha1(rand()), 0, 3); | |
341 | $this->click("header"); | |
342 | $this->type("label", $params['textFieldLabel']); | |
343 | //Is searchable? | |
344 | if (!$checkSearchable) { | |
345 | $this->click("is_searchable"); | |
346 | } | |
347 | $this->click("_qf_Field_next_new-bottom"); | |
348 | $this->waitForPageToLoad($this->getTimeoutMsec()); | |
349 | $this->click("data_type[0]"); | |
350 | $this->select("data_type[0]", "value=0"); | |
351 | $this->click("//option[@value='0']"); | |
352 | $this->click("data_type[1]"); | |
353 | $this->select("data_type[1]", "label=Select"); | |
354 | $this->click("//option[@value='Select']"); | |
355 | ||
356 | $params['selectFieldLabel'] = 'test_select' . substr(sha1(rand()), 0, 5); | |
357 | $this->type("label", $params['selectFieldLabel']); | |
358 | $selectOptionLabel1 = 'option1' . substr(sha1(rand()), 0, 3); | |
359 | $this->type("option_label_1", $selectOptionLabel1); | |
360 | $this->type("option_value_1", "1"); | |
361 | $selectOptionLabel2 = 'option2' . substr(sha1(rand()), 0, 3); | |
362 | $this->type("option_label_2", $selectOptionLabel2); | |
363 | $this->type("option_value_2", "2"); | |
364 | $this->click("link=another choice"); | |
365 | ||
366 | //enter pre help message | |
367 | $this->type("help_pre", "this is field pre help"); | |
368 | ||
369 | //enter post help message | |
370 | $this->type("help_post", "this field post help"); | |
371 | ||
372 | //Is searchable? | |
373 | $this->click("is_searchable"); | |
374 | ||
375 | //clicking save | |
f1690d4a | 376 | $this->click("_qf_Field_next-bottom"); |
6a488035 TO |
377 | |
378 | //Is custom field created? | |
f1690d4a | 379 | $this->waitForText('crm-notification-container', $params['selectFieldLabel']); |
6a488035 TO |
380 | return $params; |
381 | } | |
382 | ||
4cbe18b8 EM |
383 | /** |
384 | * @param string $context | |
385 | * @param string $parentElement | |
386 | * | |
387 | * @return mixed | |
388 | */ | |
f1690d4a | 389 | function _addRecords($context = 'Edit', $parentElement = '//') { |
6a488035 | 390 | $params['text'] = 'text' . substr(sha1(rand()), 0, 3); |
f1690d4a | 391 | $this->waitForElementPresent("//div[@id='crm-profile-block']/div/div[2]/input[@class='crm-form-text required']"); |
392 | $this->type("//div[@id='crm-profile-block']/div/div[2]/input[@class='crm-form-text required']", $params['text']); | |
6a488035 TO |
393 | if ($context == 'Create') { |
394 | $params['firstname'] = 'John' . substr(sha1(rand()), 0, 3); | |
395 | $this->type('first_name', $params['firstname']); | |
396 | $params['lastname'] = 'Anderson' . substr(sha1(rand()), 0, 3); | |
397 | $this->type('last_name', $params['lastname']); | |
398 | $params['email'] = $params['firstname'].$params['lastname'].'@exa.com'; | |
399 | $this->type('email-Primary', $params['email']); | |
f1690d4a | 400 | $this->waitForElementPresent("//div[@id='crm-profile-block']//div/div[2]/select"); |
401 | $this->select("//div[@id='crm-profile-block']//div/div[2]/select",'value=1'); | |
97e557d7 | 402 | $this->click("xpath=//div[@id='crm-profile-block']//div[@class='crm-submit-buttons']/span/input[@class='validate crm-form-submit default crm-form-submit']"); |
f1690d4a | 403 | } |
404 | else { | |
405 | $this->waitForElementPresent("//div[@id='crm-profile-block']//div/div[2]/select"); | |
406 | $this->select("//div[@id='crm-profile-block']//div/div[2]/select",'value=1'); | |
97e557d7 | 407 | $this->click("xpath=//div[@class='ui-dialog-content ui-widget-content modal-dialog crm-ajax-container']/form/div[2]//div[@id='crm-profile-block']//div[@class='crm-submit-buttons']/span/input[@class='validate crm-form-submit default crm-form-submit']"); |
6a488035 | 408 | } |
6a488035 TO |
409 | return $params; |
410 | } | |
232624b1 | 411 | } |