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