Commit | Line | Data |
---|---|---|
6a488035 TO |
1 | <?php |
2 | /* | |
3 | +--------------------------------------------------------------------+ | |
81621fee | 4 | | CiviCRM version 4.7 | |
6a488035 | 5 | +--------------------------------------------------------------------+ |
fa938177 | 6 | | Copyright CiviCRM LLC (c) 2004-2016 | |
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 | +--------------------------------------------------------------------+ | |
d25dd0ee | 25 | */ |
6a488035 | 26 | |
6a488035 | 27 | require_once 'CiviTest/CiviSeleniumTestCase.php'; |
e9479dcf EM |
28 | |
29 | /** | |
30 | * Class WebTest_Profile_BatchUpdateTest | |
31 | */ | |
6a488035 TO |
32 | class WebTest_Profile_BatchUpdateTest extends CiviSeleniumTestCase { |
33 | ||
6a488035 TO |
34 | protected function setUp() { |
35 | parent::setUp(); | |
36 | } | |
37 | ||
00be9182 | 38 | public function testBatchUpdateWithContactSubtypes() { |
6a488035 TO |
39 | // Log in using webtestLogin() method |
40 | $this->webtestLogin(); | |
b2552577 | 41 | |
6a488035 TO |
42 | // Add new individual using Quick Add block on the main page |
43 | $firstName1 = "John_" . substr(sha1(rand()), 0, 7); | |
012c1133 | 44 | $lastName1 = "Smiths_x" . substr(sha1(rand()), 0, 7); |
45 | $Name1 = $lastName1 . ', ' . $firstName1; | |
6a488035 | 46 | $this->webtestAddContact($firstName1, $lastName1, "$firstName1.$lastName1@example.com"); |
b2552577 | 47 | |
6a488035 TO |
48 | // Add new individual using Quick Add block on the main page |
49 | $firstName2 = "James_" . substr(sha1(rand()), 0, 7); | |
012c1133 | 50 | $lastName2 = "Smiths_x" . substr(sha1(rand()), 0, 7); |
6a488035 | 51 | $Name2 = $lastName2 . ', ' . $firstName2; |
b2552577 | 52 | |
6a488035 | 53 | $firstName3 = "James_" . substr(sha1(rand()), 0, 7); |
012c1133 | 54 | $lastName3 = "Smiths_x" . substr(sha1(rand()), 0, 7); |
6a488035 TO |
55 | $Name3 = $lastName3 . ', ' . $firstName3; |
56 | ||
57 | $this->webtestAddContact($firstName2, $lastName2, "$firstName2.$lastName2@example.com", "Student"); | |
6a488035 | 58 | $this->webtestAddContact($firstName3, $lastName3, "$firstName3.$lastName3@example.com", "Staff"); |
6a488035 | 59 | |
012c1133 | 60 | $profileTitle = 'Batch Profile test_' . substr(sha1(rand()), 0, 7); |
38bf8139 PJ |
61 | $profileFields = array( |
62 | array( | |
63 | 'type' => 'Individual', | |
64 | 'name' => 'Last Name', | |
21dfd5f5 TO |
65 | 'label' => 'Last Name', |
66 | ), | |
38bf8139 | 67 | ); |
6a488035 | 68 | $this->addProfile($profileTitle, $profileFields); |
b2552577 | 69 | $this->openCiviPage('contact/search', 'reset=1', '_qf_Basic_refresh'); |
6a488035 TO |
70 | $this->type('sort_name', "Smiths_x"); |
71 | $this->click('_qf_Basic_refresh'); | |
6a488035 | 72 | |
ec5b3633 | 73 | // Update multiple contacts |
6a488035 TO |
74 | $this->waitForElementPresent('CIVICRM_QFID_ts_all_4'); |
75 | $this->click('CIVICRM_QFID_ts_all_4'); | |
76 | ||
b581842f | 77 | $this->select('task', "label=Update multiple contacts"); |
6a488035 TO |
78 | $this->waitForElementPresent('_qf_PickProfile_next'); |
79 | $this->waitForElementPresent('uf_group_id'); | |
80 | $this->select('uf_group_id', "label={$profileTitle}"); | |
81 | $this->click('_qf_PickProfile_next'); | |
82 | ||
83 | $this->waitForElementPresent('_qf_Batch_next'); | |
84 | ||
85 | $this->isElementPresent("xpath=//form[@id='Batch']/div[2]/table/tbody//tr/td[text()='{$Name2}']"); | |
86 | $this->isElementPresent("xpath=//form[@id='Batch']/div[2]/table/tbody//tr/td[text()='{$Name1}']"); | |
87 | $this->isElementPresent("xpath=//form[@id='Batch']/div[2]/table/tbody//tr/td[text()='{$Name3}']"); | |
b2552577 | 88 | // selecting first check of profile |
6a488035 | 89 | $this->click("xpath=//form[@id='Batch']/div[2]/table/tbody/tr/td[2]/input"); |
b2552577 | 90 | |
6a488035 TO |
91 | $this->waitForElementPresent('_qf_Batch_next'); |
92 | $this->click("xpath=//table[@class='crm-copy-fields']/thead/tr/td[2]/img"); | |
efb29358 CW |
93 | // Because it tends to cause problems, all uses of sleep() must be justified in comments |
94 | // Sleep should never be used for wait for anything to load from the server | |
95 | // Justification for this instance: FIXME | |
6a488035 TO |
96 | sleep(5); |
97 | //$this->waitForPageToLoad($this->getTimeoutMsec()); | |
98 | $this->waitForElementPresent('_qf_Batch_next'); | |
99 | $this->click('_qf_Batch_next'); | |
100 | $this->waitForElementPresent('_qf_Result_done'); | |
101 | $this->click('_qf_Result_done'); | |
102 | ||
b2552577 PJ |
103 | // Find contact and assert for contact sub type |
104 | $this->openCiviPage('contact/search', 'reset=1', '_qf_Basic_refresh'); | |
012c1133 | 105 | $this->type('sort_name', $firstName2); |
6a488035 TO |
106 | $this->click('_qf_Basic_refresh'); |
107 | $this->waitForElementPresent("xpath=//div[@class='crm-search-results']/table/tbody//td/span/a[text()='View']"); | |
108 | $this->click("xpath=//div[@class='crm-search-results']/table/tbody//td/span/a[text()='View']"); | |
b2552577 | 109 | $this->waitForPageToLoad($this->getTimeoutMsec()); |
6a488035 TO |
110 | |
111 | $xpath = "xpath=//div[@id='contact-summary']/div/div[2]/div/div/div[2]/div[@class='crm-content crm-contact_type_label']"; | |
112 | $this->verifyText($xpath, preg_quote("Student")); | |
113 | ||
b2552577 | 114 | $this->openCiviPage('contact/search', 'reset=1', '_qf_Basic_refresh'); |
012c1133 | 115 | $this->type('sort_name', $firstName3); |
6a488035 TO |
116 | $this->click('_qf_Basic_refresh'); |
117 | $this->waitForElementPresent("xpath=//div[@class='crm-search-results']/table/tbody//td/span/a[text()='View']"); | |
118 | $this->click("xpath=//div[@class='crm-search-results']/table/tbody//td/span/a[text()='View']"); | |
b2552577 PJ |
119 | $this->waitForPageToLoad($this->getTimeoutMsec()); |
120 | ||
6a488035 TO |
121 | $xpath = "xpath=//div[@id='contact-summary']/div/div[2]/div/div/div[2]/div[@class='crm-content crm-contact_type_label']"; |
122 | $this->verifyText($xpath, preg_quote("Staff")); | |
123 | } | |
124 | ||
00be9182 | 125 | public function testBatchUpdate() { |
f75b8467 | 126 | $this->markTestSkipped('Skipping for now as it works fine locally.'); |
6a488035 TO |
127 | // Log in using webtestLogin() method |
128 | $this->webtestLogin(); | |
129 | ||
130 | // Add new individual using Quick Add block on the main page | |
131 | $firstName1 = "John_" . substr(sha1(rand()), 0, 7); | |
012c1133 | 132 | $lastName = "Smith_" . substr(sha1(rand()), 0, 7); |
133 | $Name1 = $lastName . ', ' . $firstName1; | |
6a488035 | 134 | $this->webtestAddContact($firstName1, $lastName, "$firstName1.$lastName@example.com"); |
6a488035 TO |
135 | |
136 | // Add new individual using Quick Add block on the main page | |
137 | $firstName1 = "James_" . substr(sha1(rand()), 0, 7); | |
138 | $Name2 = $lastName . ', ' . $firstName1; | |
139 | $this->webtestAddContact($firstName1, $lastName, "$firstName1.$lastName@example.com"); | |
012c1133 | 140 | $profileTitle = 'Batch Profile test for contacts ' . substr(sha1(rand()), 0, 7); |
141 | $profileFor = 'Contacts'; | |
6a488035 TO |
142 | $customDataArr = $this->_addCustomData($profileFor); |
143 | $this->_addProfile($profileTitle, $customDataArr, $profileFor); | |
144 | ||
145 | //setting ckeditor as WYSIWYG | |
b2552577 | 146 | $this->openCiviPage('admin/setting/preferences/display', 'reset=1', '_qf_Display_next-bottom'); |
6a488035 TO |
147 | $this->select('editor_id', 'CKEditor'); |
148 | $this->click('_qf_Display_next-bottom'); | |
149 | $this->waitForPageToLoad($this->getTimeoutMsec()); | |
150 | ||
151 | // Find Contact | |
b2552577 | 152 | $this->openCiviPage('contact/search', 'reset=1', '_qf_Basic_refresh'); |
6a488035 TO |
153 | $this->type('sort_name', $lastName); |
154 | $this->click('_qf_Basic_refresh'); | |
6a488035 | 155 | |
ec5b3633 | 156 | // Update multiple contacts |
6a488035 TO |
157 | $this->waitForElementPresent('CIVICRM_QFID_ts_all_4'); |
158 | $this->click('CIVICRM_QFID_ts_all_4'); | |
159 | ||
b581842f | 160 | $this->select('task', "label=Update multiple contacts"); |
6a488035 TO |
161 | $this->waitForElementPresent('_qf_PickProfile_next'); |
162 | ||
163 | $this->select('uf_group_id', "label={$profileTitle}"); | |
164 | $this->click('_qf_PickProfile_next'); | |
165 | ||
166 | $this->waitForElementPresent('_qf_Batch_next'); | |
167 | ||
168 | $this->isElementPresent("xpath=//form[@id='Batch']/div[2]/table/tbody//tr/td[text()='{$Name2}']"); | |
169 | $this->isElementPresent("xpath=//form[@id='Batch']/div[2]/table/tbody//tr/td[text()='{$Name1}']"); | |
170 | ||
171 | // selecting first check of profile | |
172 | $this->click("xpath=//form[@id='Batch']/div[2]/table/tbody/tr/td[2]/table/tbody/tr/td/input[2]"); | |
b2552577 | 173 | |
6a488035 TO |
174 | // selecting second check of profile |
175 | $this->click("xpath=//form[@id='Batch']/div[2]/table/tbody/tr/td[3]/input[2]"); | |
176 | // clicking copy values to rows of first check and verifying | |
177 | // if other check Profile Field check box are affected | |
178 | ||
179 | $this->click("xpath=//table[@class='crm-copy-fields']/thead/tr/td[2]/img"); | |
efb29358 CW |
180 | // Because it tends to cause problems, all uses of sleep() must be justified in comments |
181 | // Sleep should never be used for wait for anything to load from the server | |
182 | // Justification for this instance: FIXME | |
6a488035 TO |
183 | sleep(5); |
184 | if ($this->isChecked("xpath=//form[@id='Batch']/div[2]/table/tbody/tr/td[3]/input[2]") && | |
185 | !$this->isChecked("xpath=//form[@id='Batch']/div[2]/table/tbody/tr/td[3]/input[4]") && | |
186 | !$this->isChecked("xpath=//form[@id='Batch']/div[2]/table/tbody/tr/td[3]/input[6]") && | |
187 | //verification for second field first row | |
188 | !$this->isChecked("xpath=//form[@id='Batch']/div[2]/table/tbody/tr[2]/td[3]/input[2]") && | |
189 | !$this->isChecked("xpath=//form[@id='Batch']/div[2]/table/tbody/tr[2]/td[3]/input[4]") && | |
190 | !$this->isChecked("xpath=//form[@id='Batch']/div[2]/table/tbody/tr[2]/td[3]/input[6]") && | |
191 | //verification for first field second row | |
192 | $this->isChecked("xpath=//form[@id='Batch']/div[2]/table/tbody/tr[2]/td[2]/table/tbody/tr/td/input[2]") && | |
193 | !$this->isChecked("xpath=//form[@id='Batch']/div[2]/table/tbody/tr[2]/td[2]/table/tbody/tr/td[2]/input[2]") && | |
194 | !$this->isChecked("xpath=//form[@id='Batch']/div[2]/table/tbody/tr[2]/td[2]/table/tbody/tr[2]/td/input[2]") | |
195 | ) { | |
196 | $assertCheck = TRUE; | |
197 | } | |
012c1133 | 198 | else { |
199 | $assertCheck = FALSE; | |
200 | } | |
6a488035 TO |
201 | |
202 | $this->assertTrue($assertCheck, 'copy rows for field one failed'); | |
203 | ||
204 | $this->click("xpath=//table[@class='crm-copy-fields']/thead/tr/td[3]/img"); | |
efb29358 CW |
205 | // Because it tends to cause problems, all uses of sleep() must be justified in comments |
206 | // Sleep should never be used for wait for anything to load from the server | |
207 | // Justification for this instance: FIXME | |
6a488035 TO |
208 | sleep(5); |
209 | if ($this->isChecked("xpath=//form[@id='Batch']/div[2]/table/tbody/tr/td[3]/input[2]") && | |
210 | !$this->isChecked("xpath=//form[@id='Batch']/div[2]/table/tbody/tr/td[3]/input[4]") && | |
211 | !$this->isChecked("xpath=//form[@id='Batch']/div[2]/table/tbody/tr/td[3]/input[6]") && | |
212 | //verification for second field first row | |
213 | $this->isChecked("xpath=//form[@id='Batch']/div[2]/table/tbody/tr[2]/td[3]/input[2]") && | |
214 | !$this->isChecked("xpath=//form[@id='Batch']/div[2]/table/tbody/tr[2]/td[3]/input[4]") && | |
215 | !$this->isChecked("xpath=//form[@id='Batch']/div[2]/table/tbody/tr[2]/td[3]/input[6]") && | |
216 | //verification for first field second row | |
217 | $this->isChecked("xpath=//form[@id='Batch']/div[2]/table/tbody/tr[2]/td[2]/table/tbody/tr/td/input[2]") && | |
218 | !$this->isChecked("xpath=//form[@id='Batch']/div[2]/table/tbody/tr[2]/td[2]/table/tbody/tr/td[2]/input[2]") && | |
219 | !$this->isChecked("xpath=//form[@id='Batch']/div[2]/table/tbody/tr[2]/td[2]/table/tbody/tr[2]/td/input[2]") | |
220 | ) { | |
221 | $assertCheck = TRUE; | |
222 | } | |
012c1133 | 223 | else { |
224 | $assertCheck = FALSE; | |
225 | } | |
6a488035 TO |
226 | |
227 | $this->assertTrue($assertCheck, 'copy rows for field two failed'); | |
228 | ||
229 | $dateElementIdFirstRow = $this->getAttribute("xpath=//form[@id='Batch']/div[2]/table/tbody/tr/td[4]/input/@id"); | |
230 | $dateElementIdSecondRow = $this->getAttribute("xpath=//form[@id='Batch']/div[2]/table/tbody/tr[2]/td[4]/input/@id"); | |
231 | ||
232 | $this->webtestFillDateTime($dateElementIdFirstRow, "+1 week"); | |
233 | $this->click("xpath=//table[@class='crm-copy-fields']/thead/tr/td[4]/img"); | |
efb29358 CW |
234 | // Because it tends to cause problems, all uses of sleep() must be justified in comments |
235 | // Sleep should never be used for wait for anything to load from the server | |
236 | // Justification for this instance: FIXME | |
6a488035 TO |
237 | sleep(5); |
238 | ||
f6dd1ca6 | 239 | if ($this->getValue("{$dateElementIdFirstRow}_time") == $this->getValue("{$dateElementIdSecondRow}_time") && $this->getValue("{$dateElementIdFirstRow}") == $this->getValue("{$dateElementIdSecondRow}")) { |
6a488035 TO |
240 | $assertCheck = TRUE; |
241 | } | |
012c1133 | 242 | else { |
243 | $assertCheck = FALSE; | |
244 | } | |
6a488035 TO |
245 | |
246 | $this->assertTrue($assertCheck, 'date / time coping failed'); | |
247 | ||
248 | $richTextAreaIdOne = $this->getAttribute("xpath=//form[@id='Batch']/div[2]/table/tbody/tr/td[5]/textarea/@id"); | |
249 | $richTextAreaIdTwo = $this->getAttribute("xpath=//form[@id='Batch']/div[2]/table/tbody/tr[2]/td[5]/textarea/@id"); | |
250 | ||
251 | $this->fillRichTextField($richTextAreaIdOne, 'This is Test Introductory Message', 'CKEditor'); | |
252 | $this->click("xpath=//table[@class='crm-copy-fields']/thead/tr/td[5]/img"); | |
efb29358 CW |
253 | // Because it tends to cause problems, all uses of sleep() must be justified in comments |
254 | // Sleep should never be used for wait for anything to load from the server | |
255 | // Justification for this instance: FIXME | |
6a488035 TO |
256 | sleep(5); |
257 | ||
258 | if ($this->getValue($richTextAreaIdOne) == $this->getValue($richTextAreaIdTwo)) { | |
259 | $assertCheck = TRUE; | |
260 | } | |
012c1133 | 261 | else { |
262 | $assertCheck = FALSE; | |
263 | } | |
6a488035 TO |
264 | |
265 | $this->assertTrue($assertCheck, 'Rich Text Area coping failed'); | |
266 | ||
267 | // selecting first check of profile | |
268 | $this->click("xpath=//form[@id='Batch']/div[2]/table/tbody/tr/td[6]/input"); | |
269 | // selecting second check of profile | |
270 | $this->click("xpath=//form[@id='Batch']/div[2]/table/tbody/tr/td[7]/input"); | |
271 | // clicking copy values to rows of first check and verifying | |
272 | // if other radio Profile Field radio buttons are affected | |
273 | ||
274 | $this->click("xpath=//table[@class='crm-copy-fields']/thead/tr/td[6]/img"); | |
efb29358 CW |
275 | // Because it tends to cause problems, all uses of sleep() must be justified in comments |
276 | // Sleep should never be used for wait for anything to load from the server | |
277 | // Justification for this instance: FIXME | |
6a488035 TO |
278 | sleep(5); |
279 | if ($this->isChecked("xpath=//form[@id='Batch']/div[2]/table/tbody/tr/td[7]/input") && | |
280 | !$this->isChecked("xpath=//form[@id='Batch']/div[2]/table/tbody/tr/td[7]/input[2]") && | |
281 | !$this->isChecked("xpath=//form[@id='Batch']/div[2]/table/tbody/tr/td[7]/input[3]") && | |
282 | //verification for second field first row | |
283 | !$this->isChecked("xpath=//form[@id='Batch']/div[2]/table/tbody/tr[2]/td[7]/input") && | |
284 | !$this->isChecked("xpath=//form[@id='Batch']/div[2]/table/tbody/tr[2]/td[7]/input[2]") && | |
285 | !$this->isChecked("xpath=//form[@id='Batch']/div[2]/table/tbody/tr[2]/td[7]/input[3]") && | |
286 | //verification for first field second row | |
287 | $this->isChecked("xpath=//form[@id='Batch']/div[2]/table/tbody/tr[2]/td[6]/input") && | |
288 | !$this->isChecked("xpath=//form[@id='Batch']/div[2]/table/tbody/tr[2]/td[6]/input[2]") && | |
289 | !$this->isChecked("xpath=//form[@id='Batch']/div[2]/table/tbody/tr[2]/td[6]/input[3]") | |
290 | ) { | |
291 | $assertCheck = TRUE; | |
292 | } | |
012c1133 | 293 | else { |
294 | $assertCheck = FALSE; | |
295 | } | |
6a488035 TO |
296 | |
297 | $this->assertTrue($assertCheck, 'copy rows for field one failed[radio button]'); | |
298 | ||
299 | $this->click("xpath=//table[@class='crm-copy-fields']/thead/tr/td[7]/img"); | |
efb29358 CW |
300 | // Because it tends to cause problems, all uses of sleep() must be justified in comments |
301 | // Sleep should never be used for wait for anything to load from the server | |
302 | // Justification for this instance: FIXME | |
6a488035 TO |
303 | sleep(5); |
304 | if ($this->isChecked("xpath=//form[@id='Batch']/div[2]/table/tbody/tr/td[7]/input") && | |
305 | !$this->isChecked("xpath=//form[@id='Batch']/div[2]/table/tbody/tr/td[7]/input[2]") && | |
306 | !$this->isChecked("xpath=//form[@id='Batch']/div[2]/table/tbody/tr/td[7]/input[3]") && | |
307 | //verification for second field first row | |
308 | $this->isChecked("xpath=//form[@id='Batch']/div[2]/table/tbody/tr[2]/td[7]/input") && | |
309 | !$this->isChecked("xpath=//form[@id='Batch']/div[2]/table/tbody/tr[2]/td[7]/input[2]") && | |
310 | !$this->isChecked("xpath=//form[@id='Batch']/div[2]/table/tbody/tr[2]/td[7]/input[3]") && | |
311 | //verification for first field second row | |
312 | $this->isChecked("xpath=//form[@id='Batch']/div[2]/table/tbody/tr[2]/td[6]/input") && | |
313 | !$this->isChecked("xpath=//form[@id='Batch']/div[2]/table/tbody/tr[2]/td[6]/input[2]") && | |
314 | !$this->isChecked("xpath=//form[@id='Batch']/div[2]/table/tbody/tr[2]/td[6]/input[3]") | |
315 | ) { | |
316 | $assertCheck = TRUE; | |
317 | } | |
012c1133 | 318 | else { |
319 | $assertCheck = FALSE; | |
320 | } | |
6a488035 TO |
321 | |
322 | $this->assertTrue($assertCheck, 'copy rows for field two failed[radio button]'); | |
323 | ||
6a488035 | 324 | //campaign test for interview |
b2552577 | 325 | //enable CiviCampaign module if necessary |
b9715b8a | 326 | $this->enableComponents("CiviCampaign"); |
6a488035 TO |
327 | |
328 | //Adding a survey | |
b2552577 | 329 | $this->openCiviPage('survey/add', 'reset=1', '_qf_Main_upload-bottom'); |
6a488035 TO |
330 | $surveyTitle = "BatchUpdateTest Survey" . substr(sha1(rand()), 0, 7); |
331 | $this->type("title", $surveyTitle); | |
332 | $this->select('activity_type_id', 'label=Survey'); | |
333 | $this->click('_qf_Main_upload-bottom'); | |
334 | $this->waitForElementPresent('_qf_Questions_cancel-bottom'); | |
335 | $this->select("//form[@id='Questions']/div[2]/table/tbody/tr[1]/td[2]/div/div/span/select", "label={$profileTitle}"); | |
336 | $this->click('_qf_Questions_upload_next-bottom'); | |
337 | $this->waitForElementPresent('_qf_Results_cancel-bottom'); | |
338 | $this->click('CIVICRM_QFID_1_option_type'); | |
339 | $this->type('option_label_1', 'option1'); | |
340 | $this->type('option_value_1', 'option1'); | |
341 | $this->type('option_label_2', 'option2'); | |
342 | $this->type('option_value_2', 'option2'); | |
343 | $this->click('_qf_Results_upload_done-bottom'); | |
344 | $this->waitForPageToLoad($this->getTimeoutMsec()); | |
345 | ||
a25af9ce | 346 | //Reserve and interview respondents |
38bf8139 | 347 | $this->openCiviPage('campaign', 'reset=1&subPage=survey'); |
131d5a64 WA |
348 | $this->waitForElementPresent("xpath=//table[@class='surveys dataTable no-footer']/tbody//tr/td[2]/div/a[text()='{$surveyTitle}']/../../following-sibling::td[@class=' crm-campaign-voterLinks']/span/ul/li/a"); |
349 | $this->click("xpath=//table[@class='surveys dataTable no-footer']/tbody//tr/td[2]/div/a[text()='{$surveyTitle}']/../../following-sibling::td[@class=' crm-campaign-voterLinks']/span/ul/li/a"); | |
6a488035 TO |
350 | $this->waitForPageToLoad($this->getTimeoutMsec()); |
351 | $this->click("xpath=//div[@id='search_form_reserve']/div"); | |
352 | $this->waitForElementPresent('sort_name'); | |
353 | $this->type('sort_name', $lastName); | |
354 | $this->waitForElementPresent('_qf_Search_refresh'); | |
151d1477 | 355 | $this->clickLink('_qf_Search_refresh', 'toggleSelect'); |
a25af9ce | 356 | $this->click('toggleSelect'); |
f1690d4a | 357 | $this->select('task', "value=2"); |
6a488035 | 358 | $this->waitForElementPresent('_qf_Reserve_next_reserveToInterview-top'); |
f4c17a3c | 359 | $this->clickLink('_qf_Reserve_next_reserveToInterview-top', '_qf_Interview_cancel_interview'); |
6a488035 | 360 | |
64b211dd RK |
361 | $this->isElementPresent("xpath=//div[@class='dataTables_wrapper no-footer']/table/tbody//tr/td[2][text()='{$Name2}']"); |
362 | $this->isElementPresent("xpath=//div[@class='dataTables_wrapper no-footer']/table/tbody//tr/td[2][text()='{$Name1}']"); | |
6a488035 TO |
363 | |
364 | //edition to be done here | |
365 | // selecting first check of profile | |
151d1477 | 366 | $this->click("xpath=//div[@class='dataTables_wrapper no-footer']/table/tbody/tr/td[3]/input[2]"); |
6a488035 | 367 | // selecting second check of profile |
151d1477 | 368 | $this->click("xpath=//div[@class='dataTables_wrapper no-footer']/table/tbody/tr/td[4]/input[2]"); |
6a488035 TO |
369 | // clicking copy values to rows of first check and verifying |
370 | // if other check Profile Field check box are affected | |
371 | ||
151d1477 | 372 | $this->click("xpath=//div[@class='dataTables_wrapper no-footer']/table/thead/tr/th[3]/div/img"); |
efb29358 CW |
373 | // Because it tends to cause problems, all uses of sleep() must be justified in comments |
374 | // Sleep should never be used for wait for anything to load from the server | |
375 | // Justification for this instance: FIXME | |
6a488035 | 376 | sleep(5); |
151d1477 | 377 | if ($this->isChecked("xpath=//div[@class='dataTables_wrapper no-footer']/table/tbody/tr/td[4]/input[2]") && |
378 | !$this->isChecked("xpath=//div[@class='dataTables_wrapper no-footer']/table/tbody/tr/td[4]/input[4]") && | |
379 | !$this->isChecked("xpath=//div[@class='dataTables_wrapper no-footer']/table/tbody/tr/td[4]/input[6]") && | |
6a488035 | 380 | //verification for second field first row |
151d1477 | 381 | !$this->isChecked("xpath=//div[@class='dataTables_wrapper no-footer']/table/tbody/tr[2]/td[4]/input[2]") && |
382 | !$this->isChecked("xpath=//div[@class='dataTables_wrapper no-footer']/table/tbody/tr[2]/td[4]/input[4]") && | |
383 | !$this->isChecked("xpath=//div[@class='dataTables_wrapper no-footer']/table/tbody/tr[2]/td[4]/input[6]") && | |
6a488035 | 384 | //verification for first field second row |
151d1477 | 385 | $this->isChecked("xpath=//div[@class='dataTables_wrapper no-footer']/table/tbody/tr[2]/td[3]/input[2]") && |
386 | !$this->isChecked("xpath=//div[@class='dataTables_wrapper no-footer']/table/tbody/tr[2]/td[3]/input[4]") && | |
387 | !$this->isChecked("xpath=//div[@class='dataTables_wrapper no-footer']/table/tbody/tr[2]/td[3]/input[6]") | |
6a488035 TO |
388 | ) { |
389 | $assertCheck = TRUE; | |
390 | } | |
012c1133 | 391 | else { |
392 | $assertCheck = FALSE; | |
393 | } | |
6a488035 TO |
394 | |
395 | $this->assertTrue($assertCheck, 'copy rows for field one failed for inteview (campaign)'); | |
396 | ||
151d1477 | 397 | $this->click("xpath=//div[@class='dataTables_wrapper no-footer']/table/thead/tr/th[4]/div/img"); |
efb29358 CW |
398 | // Because it tends to cause problems, all uses of sleep() must be justified in comments |
399 | // Sleep should never be used for wait for anything to load from the server | |
400 | // Justification for this instance: FIXME | |
6a488035 | 401 | sleep(5); |
151d1477 | 402 | if ($this->isChecked("xpath=//div[@class='dataTables_wrapper no-footer']/table/tbody/tr/td[4]/input[2]") && |
403 | !$this->isChecked("xpath=//div[@class='dataTables_wrapper no-footer']/table/tbody/tr/td[4]/input[4]") && | |
404 | !$this->isChecked("xpath=//div[@class='dataTables_wrapper no-footer']/table/tbody/tr/td[4]/input[6]") && | |
6a488035 | 405 | //verification for second field first row |
151d1477 | 406 | $this->isChecked("xpath=//div[@class='dataTables_wrapper no-footer']/table/tbody/tr[2]/td[4]/input[2]") && |
407 | !$this->isChecked("xpath=//div[@class='dataTables_wrapper no-footer']/table/tbody/tr[2]/td[4]/input[4]") && | |
408 | !$this->isChecked("xpath=//div[@class='dataTables_wrapper no-footer']/table/tbody/tr[2]/td[4]/input[6]") && | |
6a488035 | 409 | //verification for first field second row |
151d1477 | 410 | $this->isChecked("xpath=//div[@class='dataTables_wrapper no-footer']/table/tbody/tr[2]/td[3]/input[2]") && |
411 | !$this->isChecked("xpath=//div[@class='dataTables_wrapper no-footer']/table/tbody/tr[2]/td[3]/input[4]") && | |
412 | !$this->isChecked("xpath=//div[@class='dataTables_wrapper no-footer']/table/tbody/tr[2]/td[3]/input[6]") | |
6a488035 TO |
413 | ) { |
414 | $assertCheck = TRUE; | |
415 | } | |
012c1133 | 416 | else { |
417 | $assertCheck = FALSE; | |
418 | } | |
6a488035 TO |
419 | |
420 | $this->assertTrue($assertCheck, 'copy rows for field two failed for inteview (campaign)'); | |
421 | ||
151d1477 | 422 | $dateElementIdFirstRow = $this->getAttribute("xpath=//div[@class='dataTables_wrapper no-footer']/table/tbody/tr/td[5]/input/@id"); |
423 | $dateElementIdSecondRow = $this->getAttribute("xpath=//div[@class='dataTables_wrapper no-footer']/table/tbody/tr[2]/td[5]/input/@id"); | |
6a488035 TO |
424 | |
425 | $this->webtestFillDateTime($dateElementIdFirstRow, "+1 week"); | |
151d1477 | 426 | $this->click("xpath=//div[@class='dataTables_wrapper no-footer']/table/thead/tr/th[5]/div/img"); |
efb29358 CW |
427 | // Because it tends to cause problems, all uses of sleep() must be justified in comments |
428 | // Sleep should never be used for wait for anything to load from the server | |
429 | // Justification for this instance: FIXME | |
6a488035 TO |
430 | sleep(5); |
431 | ||
f6dd1ca6 | 432 | if ($this->getValue("{$dateElementIdFirstRow}_time") == $this->getValue("{$dateElementIdSecondRow}_time") && $this->getValue("{$dateElementIdFirstRow}") == $this->getValue("{$dateElementIdSecondRow}")) { |
6a488035 TO |
433 | $assertCheck = TRUE; |
434 | } | |
012c1133 | 435 | else { |
436 | $assertCheck = FALSE; | |
437 | } | |
6a488035 TO |
438 | |
439 | $this->assertTrue($assertCheck, 'date / time coping failed for inteview (campaign)'); | |
440 | ||
151d1477 | 441 | $this->type("xpath=//div[@class='dataTables_wrapper no-footer']/table/tbody/tr/td[@class='note']/input", 'This is Test Introductory Message'); |
442 | $this->click("xpath=//div[@class='dataTables_wrapper no-footer']/table/thead/tr/th[8]/div/img"); | |
efb29358 CW |
443 | // Because it tends to cause problems, all uses of sleep() must be justified in comments |
444 | // Sleep should never be used for wait for anything to load from the server | |
445 | // Justification for this instance: FIXME | |
6a488035 TO |
446 | sleep(5); |
447 | ||
151d1477 | 448 | if ($this->getValue("xpath=//div[@class='dataTables_wrapper no-footer']/table/tbody/tr/td[@class='note']/input") == $this->getValue("xpath=//div[@class='dataTables_wrapper no-footer']/table/tbody/tr[2]/td[@class='note']/input")) { |
6a488035 TO |
449 | $assertCheck = TRUE; |
450 | } | |
012c1133 | 451 | else { |
452 | $assertCheck = FALSE; | |
453 | } | |
6a488035 TO |
454 | |
455 | $this->assertTrue($assertCheck, 'Note Custom field coping failed'); | |
456 | ||
151d1477 | 457 | $this->click("xpath=//div[@class='dataTables_wrapper no-footer']/table/tbody/tr/td[6]/input"); |
6a488035 | 458 | // selecting second check of profile |
151d1477 | 459 | $this->click("xpath=//div[@class='dataTables_wrapper no-footer']/table/tbody/tr/td[7]/input"); |
6a488035 TO |
460 | // clicking copy values to rows of first check and verifying |
461 | // if other radio Profile Field radio buttons are affected | |
462 | ||
151d1477 | 463 | $this->click("xpath=//div[@class='dataTables_wrapper no-footer']/table/thead/tr/th[6]/div/img"); |
efb29358 CW |
464 | // Because it tends to cause problems, all uses of sleep() must be justified in comments |
465 | // Sleep should never be used for wait for anything to load from the server | |
466 | // Justification for this instance: FIXME | |
6a488035 | 467 | sleep(5); |
151d1477 | 468 | if ($this->isChecked("xpath=//div[@class='dataTables_wrapper no-footer']/table/tbody/tr/td[7]/input") && |
469 | !$this->isChecked("xpath=//div[@class='dataTables_wrapper no-footer']/table/tbody/tr/td[7]/input[2]") && | |
470 | !$this->isChecked("xpath=//div[@class='dataTables_wrapper no-footer']/table/tbody/tr/td[7]/input[3]") && | |
6a488035 | 471 | //verification for second field first row |
151d1477 | 472 | !$this->isChecked("xpath=//div[@class='dataTables_wrapper no-footer']/table/tbody/tr[2]/td[7]/input") && |
473 | !$this->isChecked("xpath=//div[@class='dataTables_wrapper no-footer']/table/tbody/tr[2]/td[7]/input[2]") && | |
474 | !$this->isChecked("xpath=//div[@class='dataTables_wrapper no-footer']/table/tbody/tr[2]/td[7]/input[3]") && | |
6a488035 | 475 | //verification for first field second row |
151d1477 | 476 | $this->isChecked("xpath=//div[@class='dataTables_wrapper no-footer']/table/tbody/tr[2]/td[6]/input") && |
477 | !$this->isChecked("xpath=//div[@class='dataTables_wrapper no-footer']/table/tbody/tr[2]/td[6]/input[2]") && | |
478 | !$this->isChecked("xpath=//div[@class='dataTables_wrapper no-footer']/table/tbody/tr[2]/td[6]/input[3]") | |
6a488035 TO |
479 | ) { |
480 | $assertCheck = TRUE; | |
481 | } | |
012c1133 | 482 | else { |
483 | $assertCheck = FALSE; | |
484 | } | |
6a488035 TO |
485 | |
486 | $this->assertTrue($assertCheck, 'copy rows for field one failed for inteview (campaign)[radio button]'); | |
487 | ||
151d1477 | 488 | $this->click("xpath=//div[@class='dataTables_wrapper no-footer']/table/thead/tr/th[7]/div/img"); |
efb29358 CW |
489 | // Because it tends to cause problems, all uses of sleep() must be justified in comments |
490 | // Sleep should never be used for wait for anything to load from the server | |
491 | // Justification for this instance: FIXME | |
6a488035 | 492 | sleep(5); |
151d1477 | 493 | if ($this->isChecked("xpath=//div[@class='dataTables_wrapper no-footer']/table/tbody/tr/td[7]/input") && |
494 | !$this->isChecked("xpath=//div[@class='dataTables_wrapper no-footer']/table/tbody/tr/td[7]/input[2]") && | |
495 | !$this->isChecked("xpath=//div[@class='dataTables_wrapper no-footer']/table/tbody/tr/td[7]/input[3]") && | |
6a488035 | 496 | //verification for second field first row |
151d1477 | 497 | $this->isChecked("xpath=//div[@class='dataTables_wrapper no-footer']/table/tbody/tr[2]/td[7]/input") && |
498 | !$this->isChecked("xpath=//div[@class='dataTables_wrapper no-footer']/table/tbody/tr[2]/td[7]/input[2]") && | |
499 | !$this->isChecked("xpath=//div[@class='dataTables_wrapper no-footer']/table/tbody/tr[2]/td[7]/input[3]") && | |
6a488035 | 500 | //verification for first field second row |
151d1477 | 501 | $this->isChecked("xpath=//div[@class='dataTables_wrapper no-footer']/table/tbody/tr[2]/td[6]/input") && |
502 | !$this->isChecked("xpath=//div[@class='dataTables_wrapper no-footer']/table/tbody/tr[2]/td[6]/input[2]") && | |
503 | !$this->isChecked("xpath=//div[@class='dataTables_wrapper no-footer']/table/tbody/tr[2]/td[6]/input[3]") | |
6a488035 TO |
504 | ) { |
505 | $assertCheck = TRUE; | |
506 | } | |
012c1133 | 507 | else { |
508 | $assertCheck = FALSE; | |
509 | } | |
6a488035 TO |
510 | |
511 | $this->assertTrue($assertCheck, 'copy rows for field two failed for inteview (campaign)[radio button]'); | |
151d1477 | 512 | $this->clickLink("_qf_Interview_cancel_interview"); |
6a488035 TO |
513 | |
514 | //change the editor back to ckeditor | |
38bf8139 | 515 | $this->openCiviPage('admin/setting/preferences/display', 'reset=1', '_qf_Display_next-bottom'); |
6a488035 TO |
516 | $this->select('editor_id', 'CKEditor'); |
517 | $this->click('_qf_Display_next-bottom'); | |
518 | $this->waitForPageToLoad($this->getTimeoutMsec()); | |
519 | } | |
520 | ||
4cbe18b8 EM |
521 | /** |
522 | * @param $profileTitle | |
523 | * @param $customDataArr | |
524 | * @param $profileFor | |
525 | */ | |
00be9182 | 526 | public function _addProfile($profileTitle, $customDataArr, $profileFor) { |
42daf119 | 527 | |
38bf8139 | 528 | $this->openCiviPage('admin/uf/group', 'reset=1'); |
6a488035 | 529 | |
39a2888d | 530 | $this->clickLink('link=Add Profile', '_qf_Group_cancel-bottom'); |
6a488035 TO |
531 | |
532 | // Add membership custom data field to profile | |
6a488035 | 533 | $this->type('title', $profileTitle); |
6a488035 | 534 | |
39a2888d CW |
535 | // Standalone form or directory |
536 | $this->click('uf_group_type_Profile'); | |
537 | ||
538 | $this->clickLink('_qf_Group_next-bottom'); | |
539 | ||
6c5f7368 | 540 | $this->waitForText('crm-notification-container', "Your CiviCRM Profile '{$profileTitle}' has been added. You can add fields to this profile now."); |
6a488035 | 541 | |
151d1477 | 542 | $this->waitForElementPresent("field_name[0]"); |
39a2888d | 543 | foreach ($customDataArr as $customDataParams) { |
6a488035 TO |
544 | $this->select('field_name[0]', "label={$profileFor}"); |
545 | $this->select('field_name[1]', "label={$customDataParams[1]} :: {$customDataParams[0]}"); | |
546 | $this->click('field_name[1]'); | |
547 | $this->click('label'); | |
548 | ||
549 | // Clicking save and new | |
550 | $this->click('_qf_Field_next_new-bottom'); | |
6c5f7368 | 551 | $this->waitForText('crm-notification-container', "Your CiviCRM Profile Field '{$customDataParams[1]}' has been saved to '{$profileTitle}'."); |
39a2888d | 552 | $this->waitForElementPresent("xpath=//select[@id='field_name_1'][@style='display: none;']"); |
6a488035 TO |
553 | } |
554 | } | |
555 | ||
4cbe18b8 EM |
556 | /** |
557 | * @param $profileFor | |
558 | * | |
559 | * @return array | |
560 | */ | |
00be9182 | 561 | public function _addCustomData($profileFor) { |
6a488035 TO |
562 | $returnArray = array(); |
563 | $customGroupTitle = 'Custom_' . substr(sha1(rand()), 0, 4); | |
42daf119 | 564 | |
38bf8139 | 565 | $this->openCiviPage('admin/custom/group', 'reset=1'); |
6a488035 TO |
566 | |
567 | //add new custom data | |
39a2888d | 568 | $this->clickLink("//a[@id='newCustomDataGroup']/span"); |
6a488035 TO |
569 | |
570 | //fill custom group title | |
571 | $this->click("title"); | |
572 | $this->type("title", $customGroupTitle); | |
573 | ||
574 | //custom group extends | |
575 | $this->click("extends[0]"); | |
576 | $this->select("extends[0]", "label={$profileFor}"); | |
577 | if ($this->isElementPresent('//option')) { | |
578 | $this->click("//option[@value='']"); | |
579 | } | |
580 | ||
39a2888d | 581 | $this->clickLink('_qf_Group_next-bottom'); |
6a488035 TO |
582 | |
583 | //Is custom group created? | |
6c5f7368 | 584 | $this->waitForText('crm-notification-container', "Your custom field set '{$customGroupTitle}' has been added. You can add custom fields now."); |
6a488035 TO |
585 | |
586 | //for checkbox 1 | |
151d1477 | 587 | $this->waitForElementPresent("label"); |
6a488035 | 588 | $checkLabel1 = 'Custom Check One Text_' . substr(sha1(rand()), 0, 4); |
9ec35253 | 589 | $this->waitForAjaxContent(); |
6a488035 TO |
590 | $this->type('label', $checkLabel1); |
591 | $this->click('data_type[0]'); | |
592 | $this->select('data_type[0]', "label=Alphanumeric"); | |
593 | $this->select('data_type[1]', "label=CheckBox"); | |
594 | ||
595 | // enter checkbox options | |
596 | $checkOneOptionLabel1 = 'optionLabel_' . substr(sha1(rand()), 0, 5); | |
597 | $this->type('option_label_1', $checkOneOptionLabel1); | |
598 | $this->type('option_value_1', 1); | |
599 | $checkOneOptionLabel2 = 'optionLabel_' . substr(sha1(rand()), 0, 5); | |
600 | $this->type('option_label_2', $checkOneOptionLabel2); | |
601 | $this->type('option_value_2', 2); | |
602 | $this->click("link=another choice"); | |
603 | $checkOneOptionLabel3 = 'optionLabel_' . substr(sha1(rand()), 0, 5); | |
604 | $this->type('option_label_3', $checkOneOptionLabel3); | |
605 | $this->type('option_value_3', 3); | |
606 | ||
607 | //setting options per line to check CRM-9938 | |
608 | $this->type("options_per_line", 2); | |
b2552577 | 609 | |
6a488035 | 610 | //clicking save |
186e16a0 | 611 | $this->clickLink('_qf_Field_next_new-top', '_qf_Field_done-bottom', FALSE); |
6a488035 TO |
612 | |
613 | //Is custom field created | |
f1690d4a | 614 | $this->waitForText('crm-notification-container', "Custom field '$checkLabel1' has been saved."); |
186e16a0 | 615 | $this->waitForElementPresent("label"); |
6a488035 TO |
616 | $returnArray[1] = array($customGroupTitle, $checkLabel1); |
617 | ||
618 | // create another custom field - Integer Radio | |
6a488035 TO |
619 | //for checkbox 2 |
620 | $checkLabel2 = 'Custom Check Two Text_' . substr(sha1(rand()), 0, 4); | |
9ec35253 | 621 | $this->waitForAjaxContent(); |
6a488035 TO |
622 | $this->type('label', $checkLabel2); |
623 | $this->click('data_type[0]'); | |
624 | $this->select('data_type[0]', "label=Alphanumeric"); | |
625 | $this->select('data_type[1]', "label=CheckBox"); | |
626 | ||
627 | // enter checkbox options | |
628 | $checkTwoOptionLabel1 = 'optionLabel_' . substr(sha1(rand()), 0, 5); | |
629 | $this->type('option_label_1', $checkTwoOptionLabel1); | |
630 | $this->type('option_value_1', 1); | |
631 | $checkTwoOptionLabel2 = 'optionLabel_' . substr(sha1(rand()), 0, 5); | |
632 | $this->type('option_label_2', $checkTwoOptionLabel2); | |
633 | $this->type('option_value_2', 2); | |
634 | $this->click("link=another choice"); | |
635 | $checkTwoOptionLabel3 = 'optionLabel_' . substr(sha1(rand()), 0, 5); | |
636 | $this->type('option_label_3', $checkTwoOptionLabel3); | |
637 | $this->type('option_value_3', 3); | |
638 | ||
639 | //clicking save | |
186e16a0 | 640 | $this->clickLink('_qf_Field_next_new-top', '_qf_Field_done-bottom', FALSE); |
6a488035 TO |
641 | |
642 | //Is custom field created | |
f1690d4a | 643 | $this->waitForText('crm-notification-container', "Custom field '$checkLabel2' has been saved."); |
6a488035 TO |
644 | $returnArray[2] = array($customGroupTitle, $checkLabel2); |
645 | ||
6a488035 | 646 | // create another custom field - Date |
186e16a0 | 647 | $this->waitForElementPresent("label"); |
6a488035 | 648 | $dateFieldLabel = 'Custom Date Field' . substr(sha1(rand()), 0, 4); |
9ec35253 | 649 | $this->waitForAjaxContent(); |
6a488035 TO |
650 | $this->type('label', $dateFieldLabel); |
651 | $this->click('data_type[0]'); | |
652 | $this->select('data_type[0]', "label=Date"); | |
653 | $this->waitForElementPresent('start_date_years'); | |
654 | ||
655 | // enter years prior to current date | |
656 | $this->type('start_date_years', 3); | |
657 | ||
e4f46be0 | 658 | // enter years up to the end year |
6a488035 TO |
659 | $this->type('end_date_years', 3); |
660 | ||
661 | // select the date and time format | |
662 | $this->select('date_format', "value=yy-mm-dd"); | |
663 | $this->select('time_format', "value=2"); | |
664 | ||
665 | //clicking save | |
186e16a0 | 666 | $this->clickLink('_qf_Field_next_new-top', '_qf_Field_done-bottom', FALSE); |
6a488035 | 667 | //Is custom field created |
f1690d4a | 668 | $this->waitForText('crm-notification-container', "Custom field '$dateFieldLabel' has been saved."); |
6a488035 TO |
669 | $returnArray[3] = array($customGroupTitle, $dateFieldLabel); |
670 | ||
6a488035 | 671 | //create rich text editor field |
186e16a0 | 672 | $this->waitForElementPresent("label"); |
6a488035 | 673 | $richTextField = 'Custom Rich TextField_' . substr(sha1(rand()), 0, 4); |
9ec35253 | 674 | $this->waitForAjaxContent(); |
6a488035 TO |
675 | $this->type('label', $richTextField); |
676 | $this->click('data_type[0]'); | |
677 | $this->select('data_type[0]', "label=Note"); | |
438c4f5d | 678 | $this->select('data_type[1]', "value=RichTextEditor"); |
6a488035 TO |
679 | |
680 | //clicking save | |
186e16a0 | 681 | $this->clickLink('_qf_Field_next_new-top', '_qf_Field_done-bottom', FALSE); |
6a488035 TO |
682 | |
683 | //Is custom field created | |
f1690d4a | 684 | $this->waitForText('crm-notification-container', "Custom field '$richTextField' has been saved."); |
6a488035 TO |
685 | $returnArray[4] = array($customGroupTitle, $richTextField); |
686 | ||
6a488035 TO |
687 | //create radio button field |
688 | //for radio 1 | |
186e16a0 | 689 | $this->waitForElementPresent("label"); |
6a488035 | 690 | $radioLabel1 = 'Custom Radio One Text_' . substr(sha1(rand()), 0, 4); |
9ec35253 | 691 | $this->waitForAjaxContent(); |
6a488035 TO |
692 | $this->type('label', $radioLabel1); |
693 | $this->click('data_type[0]'); | |
694 | $this->select('data_type[0]', "label=Alphanumeric"); | |
695 | $this->select('data_type[1]', "label=Radio"); | |
696 | ||
697 | // enter radio options | |
698 | $radioOneOptionLabel1 = 'optionLabel_' . substr(sha1(rand()), 0, 5); | |
699 | $this->type('option_label_1', $radioOneOptionLabel1); | |
700 | $this->type('option_value_1', 1); | |
701 | $radioOneOptionLabel2 = 'optionLabel_' . substr(sha1(rand()), 0, 5); | |
702 | $this->type('option_label_2', $radioOneOptionLabel2); | |
703 | $this->type('option_value_2', 2); | |
704 | $this->click("link=another choice"); | |
705 | $radioOneOptionLabel3 = 'optionLabel_' . substr(sha1(rand()), 0, 5); | |
706 | $this->type('option_label_3', $radioOneOptionLabel3); | |
707 | $this->type('option_value_3', 3); | |
708 | ||
709 | //clicking save | |
186e16a0 | 710 | $this->clickLink('_qf_Field_next_new-top', '_qf_Field_done-bottom', FALSE); |
6a488035 TO |
711 | |
712 | //Is custom field created | |
f1690d4a | 713 | $this->waitForText('crm-notification-container', "Custom field '$radioLabel1' has been saved."); |
6a488035 TO |
714 | $returnArray[5] = array($customGroupTitle, $radioLabel1); |
715 | ||
39a2888d | 716 | // create another custom field - Alpha Radio |
6a488035 | 717 | //for radio 2 |
186e16a0 | 718 | $this->waitForElementPresent("label"); |
6a488035 | 719 | $radioLabel2 = 'Custom Radio Two Text_' . substr(sha1(rand()), 0, 4); |
9ec35253 | 720 | $this->waitForAjaxContent(); |
6a488035 TO |
721 | $this->type('label', $radioLabel2); |
722 | $this->click('data_type[0]'); | |
723 | $this->select('data_type[0]', "label=Alphanumeric"); | |
724 | $this->select('data_type[1]', "label=Radio"); | |
725 | ||
726 | // enter radio options | |
727 | $radioTwoOptionLabel1 = 'optionLabel_' . substr(sha1(rand()), 0, 5); | |
728 | $this->type('option_label_1', $radioTwoOptionLabel1); | |
729 | $this->type('option_value_1', 1); | |
730 | $radioTwoOptionLabel2 = 'optionLabel_' . substr(sha1(rand()), 0, 5); | |
731 | $this->type('option_label_2', $radioTwoOptionLabel2); | |
732 | $this->type('option_value_2', 2); | |
733 | $this->click("link=another choice"); | |
734 | $radioTwoOptionLabel3 = 'optionLabel_' . substr(sha1(rand()), 0, 5); | |
735 | $this->type('option_label_3', $radioTwoOptionLabel3); | |
736 | $this->type('option_value_3', 3); | |
737 | ||
738 | //clicking save | |
151d1477 | 739 | $this->clickLink('_qf_Field_done', 'newCustomField', FALSE); |
6a488035 TO |
740 | |
741 | //Is custom field created | |
f1690d4a | 742 | $this->waitForText('crm-notification-container', "Custom field '$radioLabel2' has been saved."); |
6a488035 TO |
743 | $returnArray[6] = array($customGroupTitle, $radioLabel2); |
744 | ||
745 | return $returnArray; | |
746 | } | |
96025800 | 747 | |
b9715b8a | 748 | } |