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_Case_ActivityToCaseTest | |
31 | */ | |
6a488035 TO |
32 | class WebTest_Case_ActivityToCaseTest extends CiviSeleniumTestCase { |
33 | ||
34 | protected function setUp() { | |
35 | parent::setUp(); | |
36 | } | |
37 | ||
38 | function testAddActivityToCase() { | |
6a488035 | 39 | // Log in as admin first to verify permissions for CiviCase |
42daf119 | 40 | $this->webtestLogin('true'); |
6a488035 TO |
41 | |
42 | // Enable CiviCase module if necessary | |
b9715b8a | 43 | $this->enableComponents("CiviCase"); |
6a488035 TO |
44 | |
45 | // let's give full CiviCase permissions to demo user (registered user). | |
46 | $permission = array('edit-2-access-all-cases-and-activities', 'edit-2-access-my-cases-and-activities', 'edit-2-administer-civicase', 'edit-2-delete-in-civicase'); | |
47 | $this->changePermissions($permission); | |
48 | ||
42daf119 CW |
49 | // Log in as normal user |
50 | $this->webtestLogin(); | |
51 | ||
d2771e94 | 52 | $this->openCiviPage('case/add', 'reset=1&action=add&atype=13&context=standalone', '_qf_Case_upload-bottom'); |
6a488035 TO |
53 | |
54 | // Adding contact with randomized first name (so we can then select that contact when creating case) | |
55 | // We're using pop-up New Contact dialog | |
56 | $firstName = substr(sha1(rand()), 0, 7); | |
57 | $lastName = "Fraser"; | |
58 | $contactName = "{$lastName}, {$firstName}"; | |
59 | $displayName = "{$firstName} {$lastName}"; | |
60 | $email = "{$lastName}.{$firstName}@example.org"; | |
44c45561 | 61 | $this->webtestNewDialogContact($firstName, $lastName, $email, $type = 4, "s2id_client_id"); |
6a488035 TO |
62 | |
63 | // Fill in other form values. We'll use a case type which is included in CiviCase sample data / xml files. | |
64 | $caseTypeLabel = "Adult Day Care Referral"; | |
65 | $subject = "Safe daytime setting - senior female"; | |
66 | $this->select('medium_id', 'value=1'); | |
67 | $this->type('activity_location', 'Main offices'); | |
68 | $details = "65 year old female needs safe location during the day for herself and her dog. She is in good health but somewhat disoriented."; | |
69 | $this->fillRichTextField("activity_details", $details, 'CKEditor'); | |
70 | $this->type('activity_subject', $subject); | |
71 | ||
72 | $this->select('case_type_id', "label={$caseTypeLabel}"); | |
73 | ||
74 | // Choose Case Start Date. | |
75 | // Using helper webtestFillDate function. | |
76 | $this->webtestFillDate('start_date', 'now'); | |
77 | $today = date('F jS, Y', strtotime('now')); | |
76e86fd8 | 78 | |
6a488035 | 79 | $this->type('duration', "20"); |
44c45561 | 80 | $this->clickLink('_qf_Case_upload-bottom', '_qf_CaseView_cancel-bottom', FALSE); |
6a488035 TO |
81 | |
82 | // Is status message correct? | |
6c5f7368 | 83 | $this->waitForText('crm-notification-container', "Case opened successfully."); |
6a488035 TO |
84 | $customGroupTitle = 'Custom_' . substr(sha1(rand()), 0, 7); |
85 | ||
86 | $this->_testAddNewActivity($firstName, $subject, $customGroupTitle, $contactName); | |
87 | } | |
88 | ||
8e05e179 JP |
89 | function testLinkCases() { |
90 | $this->webtestLogin(); | |
3f4fcdb9 RK |
91 | |
92 | // Enable CiviCase module if necessary | |
ca70bd72 | 93 | $this->enableComponents("CiviCase"); |
3f4fcdb9 | 94 | |
8e05e179 JP |
95 | //Add Case 1 |
96 | $this->openCiviPage('case/add', 'reset=1&action=add&atype=13&context=standalone', '_qf_Case_upload-bottom'); | |
97 | ||
98 | // Adding contact with randomized first name (so we can then select that contact when creating case) | |
99 | // We're using pop-up New Contact dialog | |
100 | $firstName = substr(sha1(rand()), 0, 7); | |
101 | $lastName = "Fraser"; | |
102 | $contactName = "{$lastName}, {$firstName}"; | |
103 | $displayName = "{$firstName} {$lastName}"; | |
104 | $email = "{$lastName}.{$firstName}@example.org"; | |
105 | $this->webtestNewDialogContact($firstName, $lastName, $email, $type = 4, "s2id_client_id"); | |
106 | ||
107 | // Fill in other form values. We'll use a case type which is included in CiviCase sample data / xml files. | |
108 | $caseTypeLabel = "Adult Day Care Referral"; | |
109 | $subject = "Safe daytime setting - senior female"; | |
110 | $this->select('medium_id', 'value=1'); | |
111 | $this->type('activity_location', 'Main offices'); | |
112 | $details = "65 year old female needs safe location during the day for herself and her dog. She is in good health but somewhat disoriented."; | |
113 | $this->fillRichTextField("activity_details", $details, 'CKEditor'); | |
114 | $this->type('activity_subject', $subject); | |
115 | ||
116 | $this->select('case_type_id', "label={$caseTypeLabel}"); | |
117 | ||
118 | // Choose Case Start Date. | |
119 | // Using helper webtestFillDate function. | |
120 | $this->webtestFillDate('start_date', 'now'); | |
121 | $today = date('F jS, Y', strtotime('now')); | |
122 | ||
123 | $this->type('duration', "20"); | |
124 | $this->clickLink('_qf_Case_upload-bottom', '_qf_CaseView_cancel-bottom', FALSE); | |
125 | ||
126 | // Is status message correct? | |
127 | $this->waitForText('crm-notification-container', "Case opened successfully."); | |
128 | ||
129 | //Add Case 2 | |
130 | $this->openCiviPage('case/add', 'reset=1&action=add&atype=13&context=standalone', '_qf_Case_upload-bottom'); | |
131 | ||
132 | // Adding contact with randomized first name (so we can then select that contact when creating case) | |
133 | // We're using pop-up New Contact dialog | |
134 | $firstName2 = substr(sha1(rand()), 0, 7); | |
135 | $lastName2 = "Fraser"; | |
136 | $contactName2 = "{$lastName}, {$firstName}"; | |
137 | $displayName2 = "{$firstName} {$lastName}"; | |
138 | $email2 = "{$lastName2}.{$firstName2}@example.org"; | |
139 | $this->webtestNewDialogContact($firstName2, $lastName2, $email2, $type = 4, "s2id_client_id"); | |
140 | ||
141 | // Fill in other form values. We'll use a case type which is included in CiviCase sample data / xml files. | |
142 | $caseTypeLabel2 = "Adult Day Care Referral"; | |
143 | $subject2 = "Subject For Case 2"; | |
144 | $this->select('medium_id', 'value=1'); | |
145 | $this->type('activity_location', 'Main offices'); | |
146 | $details2 = "Details For Case 2"; | |
147 | $this->fillRichTextField("activity_details", $details2, 'CKEditor'); | |
148 | $this->type('activity_subject', $subject2); | |
149 | ||
150 | $this->select('case_type_id', "label={$caseTypeLabel2}"); | |
151 | ||
152 | // Choose Case Start Date. | |
153 | // Using helper webtestFillDate function. | |
154 | $this->webtestFillDate('start_date', 'now'); | |
155 | $today = date('F jS, Y', strtotime('now')); | |
156 | ||
157 | $this->type('duration', "20"); | |
158 | $this->clickLink('_qf_Case_upload-bottom', '_qf_CaseView_cancel-bottom', FALSE); | |
159 | ||
160 | // Is status message correct? | |
161 | $this->waitForText('crm-notification-container', "Case opened successfully."); | |
162 | ||
163 | //Add Link Case Activity | |
164 | $this->select('add_activity_type_id', 'Link Cases'); | |
165 | $this->waitForElementPresent("_qf_Activity_cancel-bottom"); | |
166 | $this->select2('link_to_case_id', $firstName); | |
167 | $activitydetails = 'Details of Link Case Activity'; | |
168 | $this->fillRichTextField("details", $activitydetails, 'CKEditor'); | |
169 | $this->click('activity-details'); | |
170 | $this->waitForElementPresent('subject'); | |
171 | $activitySubject = 'Link Case Activity between case 1 and case 2'; | |
172 | $activitylocation = 'Main Office Building'; | |
173 | $this->select2('source_contact_id', $firstName2); | |
174 | $this->type('subject', $activitySubject); | |
175 | $this->type('location', $activitylocation); | |
176 | $this->click('_qf_Activity_upload-bottom'); | |
177 | $id = $this->urlArg('id'); | |
178 | $this->waitForText("case_id_$id", $activitySubject); | |
179 | $this->click("xpath=//a[contains(text(),'$activitySubject')]"); | |
180 | ||
181 | $LinkCaseActivityData = array( | |
182 | "Client" => $firstName2, | |
183 | "Activity Type" => "Link Cases", | |
184 | "Subject" => $activitySubject, | |
185 | "Reported By" => "{$firstName2} {$lastName2}", | |
186 | "Medium" => "Phone", | |
187 | "Location" => $activitylocation, | |
188 | "Date and Time" => $today, | |
189 | "Details" => $activitydetails, | |
190 | "Status" => "Scheduled", | |
191 | "Priority" => "Normal", | |
192 | ); | |
193 | $this->webtestVerifyTabularData($LinkCaseActivityData); | |
194 | } | |
4cbe18b8 EM |
195 | /** |
196 | * @param $firstName | |
197 | * @param $caseSubject | |
198 | * @param $customGroupTitle | |
199 | * @param $contactName | |
200 | */ | |
6a488035 TO |
201 | function _testAddNewActivity($firstName, $caseSubject, $customGroupTitle, $contactName) { |
202 | $customDataParams = $this->_addCustomData($customGroupTitle); | |
203 | //$customDataParams = array( 'optionLabel_47d58', 'custom_8_-1' ); | |
204 | ||
205 | // Adding Adding contact with randomized first name for test testContactContextActivityAdd | |
206 | // We're using Quick Add block on the main page for this. | |
207 | $firstName1 = substr(sha1(rand()), 0, 7); | |
208 | $this->webtestAddContact($firstName1, "Summerson", $firstName1 . "@summerson.name"); | |
209 | $firstName2 = substr(sha1(rand()), 0, 7); | |
210 | $this->webtestAddContact($firstName2, "Anderson", $firstName2 . "@anderson.name"); | |
211 | ||
6a488035 TO |
212 | $this->click("css=li#tab_activity a"); |
213 | ||
214 | // waiting for the activity dropdown to show up | |
215 | $this->waitForElementPresent("other_activity"); | |
216 | ||
217 | // Select the activity type from the activity dropdown | |
218 | $this->select("other_activity", "label=Meeting"); | |
219 | ||
220 | // waitForPageToLoad is not always reliable. Below, we're waiting for the submit | |
221 | // button at the end of this page to show up, to make sure it's fully loaded. | |
222 | $this->waitForElementPresent("_qf_Activity_upload-bottom"); | |
223 | ||
6a488035 | 224 | // ...and verifying if the page contains properly formatted display name for chosen contact. |
44c45561 | 225 | $this->waitForText("xpath=//div[@id='s2id_target_contact_id']", 'Anderson, ' . $firstName2, "Contact not found in line " . __LINE__); |
6a488035 TO |
226 | |
227 | // Now we're filling the "Assigned To" field. | |
228 | // Typing contact's name into the field (using typeKeys(), not type()!)... | |
44c45561 | 229 | $this->click("xpath=//div[@id='s2id_assignee_contact_id']/ul/li/input"); |
230 | $this->keyDown("xpath=//div[@id='s2id_assignee_contact_id']/ul/li/input", " "); | |
231 | $this->type("xpath=//div[@id='s2id_assignee_contact_id']/ul/li/input", $firstName1); | |
232 | $this->typeKeys("xpath=//div[@id='s2id_assignee_contact_id']/ul/li/input", $firstName1); | |
6a488035 TO |
233 | |
234 | // ...waiting for drop down with results to show up... | |
44c45561 | 235 | $this->waitForElementPresent("xpath=//div[@class='select2-result-label']"); |
6a488035 TO |
236 | |
237 | //..need to use mouseDownAt on first result (which is a li element), click does not work | |
44c45561 | 238 | $this->clickAt("xpath=//div[@class='select2-result-label']"); |
6a488035 TO |
239 | |
240 | // ...again, waiting for the box with contact name to show up... | |
44c45561 | 241 | $this->waitForText("xpath=//div[@id='s2id_assignee_contact_id']","$firstName1"); |
6a488035 TO |
242 | |
243 | // ...and verifying if the page contains properly formatted display name for chosen contact. | |
44c45561 | 244 | $this->assertElementContainsText("xpath=//div[@id='s2id_assignee_contact_id']", "Summerson, $firstName1", 'Contact not found in line ' . __LINE__); |
6a488035 TO |
245 | |
246 | // Putting the contents into subject field - assigning the text to variable, it'll come in handy later | |
247 | $subject = "This is subject of test activity being added through activity tab of contact summary screen."; | |
248 | // For simple input fields we can use field id as selector | |
249 | $this->type("subject", $subject); | |
250 | $this->type("location", "Some location needs to be put in this field."); | |
251 | ||
252 | // Choosing the Date. | |
253 | // Please note that we don't want to put in fixed date, since | |
254 | // we want this test to work in the future and not fail because | |
255 | // of date being set in the past. Therefore, using helper webtestFillDateTime function. | |
256 | $this->webtestFillDateTime('activity_date_time', '+1 month 11:10PM'); | |
257 | ||
258 | // Setting duration. | |
259 | $this->type("duration", "30"); | |
260 | ||
261 | // Putting in details. | |
262 | $this->type("details", "Really brief details information."); | |
263 | ||
264 | // Making sure that status is set to Scheduled (using value, not label). | |
265 | $this->select("status_id", "value=1"); | |
266 | ||
267 | // Setting priority. | |
268 | $this->select("priority_id", "value=1"); | |
269 | ||
270 | $textField = 'This is test custom data'; | |
44c45561 | 271 | $this->click("xpath=//div[@id='customData']//div[@class='custom-group custom-group-$customGroupTitle crm-accordion-wrapper collapsed']"); |
272 | $this->waitForElementPresent("xpath=//div[@class='crm-accordion-body']//table/tbody/tr[2]/td[2]/table/tbody/tr/td[1]/input"); | |
273 | $this->click("xpath=//div[@class='crm-accordion-body']//table/tbody/tr[2]/td[2]/table/tbody/tr/td[1]/input"); | |
6a488035 TO |
274 | $this->type($customDataParams[1], $textField); |
275 | ||
276 | // Scheduling follow-up. | |
277 | $this->click("css=.crm-activity-form-block-schedule_followup div.crm-accordion-header"); | |
278 | $this->select("followup_activity_type_id", "value=1"); | |
279 | $this->webtestFillDateTime('followup_date', '+2 months 10:00AM'); | |
280 | $this->type("followup_activity_subject", "This is subject of schedule follow-up activity"); | |
281 | ||
282 | // Clicking save. | |
283 | $this->click("_qf_Activity_upload-bottom"); | |
6a488035 TO |
284 | |
285 | // Is status message correct? | |
6c5f7368 | 286 | $this->waitForText('crm-notification-container', $subject); |
6a488035 TO |
287 | |
288 | // click through to the Activity view screen | |
ca70bd72 RK |
289 | $this->waitForElementPresent("xpath=//div[@class='dataTables_wrapper no-footer']/table/tbody//tr/td[5]/a[text()='Summerson, $firstName1']/../../td[8]/span/a[1][text()='View']"); |
290 | $this->click("xpath=//div[@class='dataTables_wrapper no-footer']/table/tbody//tr/td[5]/a[text()='Summerson, $firstName1']/../../td[8]/span/a[1][text()='View']"); | |
291 | $this->waitForElementPresent("xpath=//div[@class='dataTables_wrapper no-footer']/table/tbody//tr/td[5]/a[text()='Summerson, $firstName1']/../../td[8]/span[2][text()='more']/ul[1]/li[1]/a"); | |
292 | $this->click("xpath=//div[@class='dataTables_wrapper no-footer']/table/tbody//tr/td[5]/a[text()='Summerson, $firstName1']/../../td[8]/span[2][text()='more']/ul[1]/li[1]/a"); | |
6a488035 TO |
293 | |
294 | // file activity on case | |
ca70bd72 | 295 | $this->waitForElementPresent('file_on_case_unclosed_case_id'); |
44c45561 | 296 | $this->select2('file_on_case_unclosed_case_id', $firstName); |
297 | $this->assertElementContainsText("xpath=//div[@id='s2id_file_on_case_unclosed_case_id']", "$firstName", 'Contact not found in line ' . __LINE__); | |
ca70bd72 | 298 | $this->type('file_on_case_activity_subject', $subject); |
44c45561 | 299 | $this->click("xpath=//div[@class='ui-dialog-buttonset']/button/span[text()='Save']"); |
ca70bd72 | 300 | $this->waitForElementPresent("xpath=//div[@class='dataTables_wrapper no-footer']/table/tbody//tr/td[5]/a[text()='Summerson, $firstName1']/../../td[8]/span/a[1][text()='View']"); |
6a488035 TO |
301 | |
302 | // verify if custom data is present | |
d2771e94 | 303 | $this->openCiviPage('case', 'reset=1'); |
6a488035 TO |
304 | $this->click("xpath=//table[@class='caseSelector']/tbody//tr/td[2]/a[text()='{$contactName}']/../../td[9]/span/a[text()='Manage']"); |
305 | ||
306 | $this->waitForElementPresent('_qf_CaseView_cancel-bottom'); | |
44c45561 | 307 | $id = $this->urlArg('id'); |
308 | $this->waitForElementPresent("xpath=//div[@id='activities']//table[@id='case_id_".$id."']/tbody/tr[1]/td[2]"); | |
6a488035 | 309 | |
44c45561 | 310 | $this->click("xpath=//div[@id='activities']//table[@id='case_id_".$id."']/tbody/tr[1]/td[2]//a[text()='{$subject}']"); |
6a488035 | 311 | |
44c45561 | 312 | $this->waitForElementPresent('ActivityView'); |
6a488035 | 313 | $this->waitForElementPresent("css=table#crm-activity-view-table tr.crm-case-activityview-form-block-groupTitle"); |
d2771e94 | 314 | $this->assertElementContainsText('crm-activity-view-table', "$textField"); |
44c45561 | 315 | $this->click("xpath=//span[@class='ui-button-icon-primary ui-icon ui-icon-closethick']"); |
316 | $this->waitForElementPresent("xpath=//div[@id='activities']//table[@id='case_id_".$id."']/tbody/tr[1]/td[2]"); | |
6a488035 | 317 | |
44c45561 | 318 | $this->click("xpath=//div[@id='activities']//table[@id='case_id_".$id."']/tbody//tr/td[2]/a[text()='{$subject}']/../../td[6]/a[text()='Scheduled']"); |
6a488035 | 319 | |
baaf85ee | 320 | $this->waitForElementPresent("xpath=//html/body/div[7]"); |
6a488035 TO |
321 | $this->waitForElementPresent('activity_change_status'); |
322 | ||
323 | // change activity status | |
324 | $this->select('activity_change_status', 'value=2'); | |
e1326164 | 325 | $this->click("xpath=//div[@class='ui-dialog-buttonset']/button[2]/span[text()='Continue']"); |
d2771e94 | 326 | $this->openCiviPage('case', 'reset=1'); |
6a488035 TO |
327 | $this->click("xpath=//table[@class='caseSelector']/tbody//tr/td[2]/a[text()='{$contactName}']/../../td[9]/span/a[text()='Manage']"); |
328 | $this->waitForElementPresent('_qf_CaseView_cancel-bottom'); | |
44c45561 | 329 | $id2 = $this->urlArg('id'); |
330 | $this->waitForElementPresent("xpath=//div[@id='activities']//table[@id='case_id_".$id2."']/tbody/tr[1]/td[2]"); | |
331 | $this->click("xpath=//div[@id='activities']//table[@id='case_id_".$id2."']//a[text()='{$subject}']"); | |
332 | $this->waitForElementPresent('ActivityView'); | |
6a488035 TO |
333 | $this->waitForElementPresent("css=table#crm-activity-view-table tr.crm-case-activityview-form-block-groupTitle"); |
334 | } | |
335 | ||
4cbe18b8 EM |
336 | /** |
337 | * @param $customGroupTitle | |
338 | * | |
339 | * @return array | |
340 | */ | |
6a488035 | 341 | function _addCustomData($customGroupTitle) { |
42daf119 | 342 | |
d2771e94 | 343 | $this->openCiviPage('admin/custom/group', 'reset=1'); |
6a488035 TO |
344 | |
345 | //add new custom data | |
57e9cdaf | 346 | $this->clickLink("//a[@id='newCustomDataGroup']/span"); |
6a488035 TO |
347 | |
348 | //fill custom group title | |
349 | $this->click("title"); | |
350 | $this->type("title", $customGroupTitle); | |
351 | ||
352 | //custom group extends | |
353 | $this->click("extends[0]"); | |
354 | $this->select("extends[0]", "value=Activity"); | |
355 | $this->click("//option[@value='Activity']"); | |
7df6dc24 | 356 | $this->clickLink('_qf_Group_next-bottom'); |
6a488035 TO |
357 | |
358 | //Is custom group created? | |
6c5f7368 | 359 | $this->waitForText('crm-notification-container', "Your custom field set '{$customGroupTitle}' has been added. You can add custom fields now."); |
6a488035 TO |
360 | |
361 | // create a custom field - Integer Radio | |
57e9cdaf | 362 | $this->clickLinkSuppressPopup('newCustomField', "data_type[0]"); |
6a488035 TO |
363 | $this->click("data_type[0]"); |
364 | $this->select("data_type[0]", "value=1"); | |
365 | $this->click("//option[@value='1']"); | |
366 | $this->click("data_type[1]"); | |
367 | $this->select("data_type[1]", "value=Radio"); | |
368 | $this->click("//option[@value='Radio']"); | |
369 | ||
370 | $radioFieldLabel = 'Custom Field Radio_' . substr(sha1(rand()), 0, 4); | |
371 | $this->type("label", $radioFieldLabel); | |
372 | $radioOptionLabel1 = 'optionLabel_' . substr(sha1(rand()), 0, 5); | |
373 | $this->type("option_label_1", $radioOptionLabel1); | |
374 | $this->type("option_value_1", "1"); | |
375 | $radioOptionLabel2 = 'optionLabel_' . substr(sha1(rand()), 0, 5); | |
376 | $this->type("option_label_2", $radioOptionLabel2); | |
377 | $this->type("option_value_2", "2"); | |
378 | ||
379 | //select options per line | |
380 | $this->type("options_per_line", "3"); | |
381 | ||
382 | //enter pre help msg | |
383 | $this->type("help_pre", "this is field pre help"); | |
384 | ||
385 | //enter post help msg | |
386 | $this->type("help_post", "this is field post help"); | |
387 | ||
388 | //Is searchable? | |
389 | $this->click("is_searchable"); | |
390 | ||
391 | //clicking save | |
57e9cdaf | 392 | $this->clickLink("_qf_Field_next_new-bottom", "_qf_Field_next_new-bottom"); |
6a488035 TO |
393 | |
394 | //Is custom field created | |
44c45561 | 395 | $this->waitForText('crm-notification-container', "Custom field '$radioFieldLabel' has been saved."); |
6a488035 TO |
396 | |
397 | // create another custom field - text field | |
6a488035 TO |
398 | $textFieldLabel = 'Custom Field Text_' . substr(sha1(rand()), 0, 4); |
399 | $this->type('label', $textFieldLabel); | |
400 | ||
401 | //enter pre help msg | |
402 | $this->type('help_pre', "this is field pre help"); | |
403 | ||
404 | //enter post help msg | |
405 | $this->type('help_post', "this is field post help"); | |
406 | ||
407 | //Is searchable? | |
408 | $this->click('is_searchable'); | |
409 | ||
410 | //clicking save | |
57e9cdaf | 411 | $this->clickLink("_qf_Field_done-bottom", "//a[@id='newCustomField']/span"); |
6a488035 TO |
412 | |
413 | //Is custom field created | |
44c45561 | 414 | $this->waitForText('crm-notification-container', "Custom field '$textFieldLabel' has been saved."); |
ca70bd72 | 415 | $textFieldId = explode('&id=', $this->getAttribute("xpath=//table[@id='options']/tbody//tr/td[1]/span[text()='$textFieldLabel']/../../td[8]/span/a[1][text()='Edit Field']/@href")); |
6a488035 TO |
416 | $textFieldId = $textFieldId[1]; |
417 | ||
418 | return array($radioOptionLabel1, "custom_{$textFieldId}_-1"); | |
419 | } | |
420 | } | |
421 |