3 +--------------------------------------------------------------------+
4 | CiviCRM version 4.5 |
5 +--------------------------------------------------------------------+
6 | Copyright CiviCRM LLC (c) 2004-2014 |
7 +--------------------------------------------------------------------+
8 | This file is a part of CiviCRM. |
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. |
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. |
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 +--------------------------------------------------------------------+
27 require_once 'CiviTest/CiviSeleniumTestCase.php';
30 * Class WebTest_Profile_BatchUpdateTest
32 class WebTest_Profile_BatchUpdateTest
extends CiviSeleniumTestCase
{
34 protected function setUp() {
38 function testBatchUpdateWithContactSubtypes() {
39 // Log in using webtestLogin() method
40 $this->webtestLogin();
42 // Add new individual using Quick Add block on the main page
43 $firstName1 = "John_" . substr(sha1(rand()), 0, 7);
44 $lastName1 = "Smiths_x" . substr(sha1(rand()), 0, 7);
45 $Name1 = $lastName1 . ', ' . $firstName1;
46 $this->webtestAddContact($firstName1, $lastName1, "$firstName1.$lastName1@example.com");
48 // Add new individual using Quick Add block on the main page
49 $firstName2 = "James_" . substr(sha1(rand()), 0, 7);
50 $lastName2 = "Smiths_x" . substr(sha1(rand()), 0, 7);
51 $Name2 = $lastName2 . ', ' . $firstName2;
53 $firstName3 = "James_" . substr(sha1(rand()), 0, 7);
54 $lastName3 = "Smiths_x" . substr(sha1(rand()), 0, 7);
55 $Name3 = $lastName3 . ', ' . $firstName3;
57 $this->webtestAddContact($firstName2, $lastName2, "$firstName2.$lastName2@example.com", "Student");
58 $this->webtestAddContact($firstName3, $lastName3, "$firstName3.$lastName3@example.com", "Staff");
60 $profileTitle = 'Batch Profile test_' . substr(sha1(rand()), 0, 7);
61 $profileFields = array(
63 'type' => 'Individual',
64 'name' => 'Last Name',
65 'label' => 'Last Name'
68 $this->addProfile($profileTitle, $profileFields);
69 $this->openCiviPage('contact/search', 'reset=1', '_qf_Basic_refresh');
70 $this->type('sort_name', "Smiths_x");
71 $this->click('_qf_Basic_refresh');
73 // Batch Update Via Profile
74 $this->waitForElementPresent('CIVICRM_QFID_ts_all_4');
75 $this->click('CIVICRM_QFID_ts_all_4');
77 $this->select('task', "label=Batch Update via Profile");
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');
83 $this->waitForElementPresent('_qf_Batch_next');
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}']");
88 // selecting first check of profile
89 $this->click("xpath=//form[@id='Batch']/div[2]/table/tbody/tr/td[2]/input");
91 $this->waitForElementPresent('_qf_Batch_next');
92 $this->click("xpath=//table[@class='crm-copy-fields']/thead/tr/td[2]/img");
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
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');
103 // Find contact and assert for contact sub type
104 $this->openCiviPage('contact/search', 'reset=1', '_qf_Basic_refresh');
105 $this->type('sort_name', $firstName2);
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']");
109 $this->waitForPageToLoad($this->getTimeoutMsec());
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"));
114 $this->openCiviPage('contact/search', 'reset=1', '_qf_Basic_refresh');
115 $this->type('sort_name', $firstName3);
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']");
119 $this->waitForPageToLoad($this->getTimeoutMsec());
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"));
125 function testBatchUpdate() {
126 // Log in using webtestLogin() method
127 $this->webtestLogin();
129 // Add new individual using Quick Add block on the main page
130 $firstName1 = "John_" . substr(sha1(rand()), 0, 7);
131 $lastName = "Smith_" . substr(sha1(rand()), 0, 7);
132 $Name1 = $lastName . ', ' . $firstName1;
133 $this->webtestAddContact($firstName1, $lastName, "$firstName1.$lastName@example.com");
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");
139 $profileTitle = 'Batch Profile test for contacts ' . substr(sha1(rand()), 0, 7);
140 $profileFor = 'Contacts';
141 $customDataArr = $this->_addCustomData($profileFor);
142 $this->_addProfile($profileTitle, $customDataArr, $profileFor);
144 //setting ckeditor as WYSIWYG
145 $this->openCiviPage('admin/setting/preferences/display', 'reset=1', '_qf_Display_next-bottom');
146 $this->select('editor_id', 'CKEditor');
147 $this->click('_qf_Display_next-bottom');
148 $this->waitForPageToLoad($this->getTimeoutMsec());
151 $this->openCiviPage('contact/search', 'reset=1', '_qf_Basic_refresh');
152 $this->type('sort_name', $lastName);
153 $this->click('_qf_Basic_refresh');
155 // Batch Update Via Profile
156 $this->waitForElementPresent('CIVICRM_QFID_ts_all_4');
157 $this->click('CIVICRM_QFID_ts_all_4');
159 $this->select('task', "label=Batch Update via Profile");
160 $this->waitForElementPresent('_qf_PickProfile_next');
162 $this->select('uf_group_id', "label={$profileTitle}");
163 $this->click('_qf_PickProfile_next');
165 $this->waitForElementPresent('_qf_Batch_next');
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}']");
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]");
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
178 $this->click("xpath=//table[@class='crm-copy-fields']/thead/tr/td[2]/img");
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
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]")
198 $assertCheck = FALSE;
201 $this->assertTrue($assertCheck, 'copy rows for field one failed');
203 $this->click("xpath=//table[@class='crm-copy-fields']/thead/tr/td[3]/img");
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
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]")
223 $assertCheck = FALSE;
226 $this->assertTrue($assertCheck, 'copy rows for field two failed');
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");
231 $this->webtestFillDateTime($dateElementIdFirstRow, "+1 week");
232 $this->click("xpath=//table[@class='crm-copy-fields']/thead/tr/td[4]/img");
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
238 if ($this->getValue("{$dateElementIdFirstRow}_time") == $this->getValue("{$dateElementIdSecondRow}_time") && $this->getValue("{$dateElementIdFirstRow}_display") == $this->getValue("{$dateElementIdSecondRow}_display")) {
242 $assertCheck = FALSE;
245 $this->assertTrue($assertCheck, 'date / time coping failed');
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");
250 $this->fillRichTextField($richTextAreaIdOne, 'This is Test Introductory Message', 'CKEditor');
251 $this->click("xpath=//table[@class='crm-copy-fields']/thead/tr/td[5]/img");
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
257 if ($this->getValue($richTextAreaIdOne) == $this->getValue($richTextAreaIdTwo)) {
261 $assertCheck = FALSE;
264 $this->assertTrue($assertCheck, 'Rich Text Area coping failed');
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
273 $this->click("xpath=//table[@class='crm-copy-fields']/thead/tr/td[6]/img");
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
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]")
293 $assertCheck = FALSE;
296 $this->assertTrue($assertCheck, 'copy rows for field one failed[radio button]');
298 $this->click("xpath=//table[@class='crm-copy-fields']/thead/tr/td[7]/img");
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
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]")
318 $assertCheck = FALSE;
321 $this->assertTrue($assertCheck, 'copy rows for field two failed[radio button]');
323 //test with tinymce editor
324 $this->openCiviPage('admin/setting/preferences/display', 'reset=1', '_qf_Display_next-bottom');
325 $this->select('editor_id', 'TinyMCE');
326 $this->click('_qf_Display_next-bottom');
327 $this->waitForPageToLoad($this->getTimeoutMsec());
330 $this->openCiviPage('contact/search', 'reset=1', '_qf_Basic_refresh');
331 $this->type('sort_name', $lastName);
332 $this->click('_qf_Basic_refresh');
334 // Batch Update Via Profile
335 $this->waitForElementPresent('CIVICRM_QFID_ts_all_4');
336 $this->click('CIVICRM_QFID_ts_all_4');
338 $this->select('task', "label=Batch Update via Profile");
339 $this->waitForElementPresent('_qf_PickProfile_next');
341 $this->select('uf_group_id', "label={$profileTitle}");
342 $this->click('_qf_PickProfile_next');
344 $this->waitForElementPresent('_qf_Batch_next');
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}']");
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");
352 $this->selectFrame("css=td.mceIframeContainer iframe#{$richTextAreaIdOne}_ifr");
353 $this->type("//html/body", 'this is intro text');
354 $this->selectFrame('relative=top');
356 $this->click("xpath=//table[@class='crm-copy-fields']/thead/tr/td[5]/img");
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
362 if ($this->getValue($richTextAreaIdOne) == $this->getValue($richTextAreaIdTwo)) {
366 $assertCheck = FALSE;
369 $this->assertTrue($assertCheck, 'Rich Text Area coping failed [TinyMCE]');
371 //campaign test for interview
372 //enable CiviCampaign module if necessary
373 $this->enableComponents("CiviCampaign");
376 $this->openCiviPage('survey/add', 'reset=1', '_qf_Main_upload-bottom');
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());
393 //Reserve and interview respondents
394 $this->openCiviPage('campaign', 'reset=1&subPage=survey');
395 $this->waitForElementPresent("xpath=//table[@class='surveys dataTable no-footer']/tbody//tr/td[2]/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]/a[text()='{$surveyTitle}']/../following-sibling::td[@class=' crm-campaign-voterLinks']/span/ul/li/a");
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');
402 $this->clickLink('_qf_Search_refresh', 'toggleSelect');
403 $this->click('toggleSelect');
404 $this->select('task', "value=2");
405 $this->waitForElementPresent('_qf_Reserve_next_reserveToInterview-top');
406 $this->clickLink('_qf_Reserve_next_reserveToInterview-top', '_qf_Interview_cancel_interview');
408 $this->isElementPresent("xpath=//div[@class='dataTables_wrapper no-footer']/table/tbody//tr/td[text()='{$Name2}']");
409 $this->isElementPresent("xpath=//div[@class='dataTables_wrapper no-footer']/table/tbody//tr/td[text()='{$Name1}']");
411 //edition to be done here
412 // selecting first check of profile
413 $this->click("xpath=//div[@class='dataTables_wrapper no-footer']/table/tbody/tr/td[3]/input[2]");
414 // selecting second check of profile
415 $this->click("xpath=//div[@class='dataTables_wrapper no-footer']/table/tbody/tr/td[4]/input[2]");
416 // clicking copy values to rows of first check and verifying
417 // if other check Profile Field check box are affected
419 $this->click("xpath=//div[@class='dataTables_wrapper no-footer']/table/thead/tr/th[3]/div/img");
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
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]") &&
427 //verification for second field first row
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]") &&
431 //verification for first field second row
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]")
439 $assertCheck = FALSE;
442 $this->assertTrue($assertCheck, 'copy rows for field one failed for inteview (campaign)');
444 $this->click("xpath=//div[@class='dataTables_wrapper no-footer']/table/thead/tr/th[4]/div/img");
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
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]") &&
452 //verification for second field first row
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]") &&
456 //verification for first field second row
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]")
464 $assertCheck = FALSE;
467 $this->assertTrue($assertCheck, 'copy rows for field two failed for inteview (campaign)');
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");
472 $this->webtestFillDateTime($dateElementIdFirstRow, "+1 week");
473 $this->click("xpath=//div[@class='dataTables_wrapper no-footer']/table/thead/tr/th[5]/div/img");
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
479 if ($this->getValue("{$dateElementIdFirstRow}_time") == $this->getValue("{$dateElementIdSecondRow}_time") && $this->getValue("{$dateElementIdFirstRow}_display") == $this->getValue("{$dateElementIdSecondRow}_display")) {
483 $assertCheck = FALSE;
486 $this->assertTrue($assertCheck, 'date / time coping failed for inteview (campaign)');
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");
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
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")) {
499 $assertCheck = FALSE;
502 $this->assertTrue($assertCheck, 'Note Custom field coping failed');
504 $this->click("xpath=//div[@class='dataTables_wrapper no-footer']/table/tbody/tr/td[6]/input");
505 // selecting second check of profile
506 $this->click("xpath=//div[@class='dataTables_wrapper no-footer']/table/tbody/tr/td[7]/input");
507 // clicking copy values to rows of first check and verifying
508 // if other radio Profile Field radio buttons are affected
510 $this->click("xpath=//div[@class='dataTables_wrapper no-footer']/table/thead/tr/th[6]/div/img");
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
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]") &&
518 //verification for second field first row
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]") &&
522 //verification for first field second row
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]")
530 $assertCheck = FALSE;
533 $this->assertTrue($assertCheck, 'copy rows for field one failed for inteview (campaign)[radio button]');
535 $this->click("xpath=//div[@class='dataTables_wrapper no-footer']/table/thead/tr/th[7]/div/img");
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
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]") &&
543 //verification for second field first row
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]") &&
547 //verification for first field second row
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]")
555 $assertCheck = FALSE;
558 $this->assertTrue($assertCheck, 'copy rows for field two failed for inteview (campaign)[radio button]');
559 $this->clickLink("_qf_Interview_cancel_interview");
561 //change the editor back to ckeditor
562 $this->openCiviPage('admin/setting/preferences/display', 'reset=1', '_qf_Display_next-bottom');
563 $this->select('editor_id', 'CKEditor');
564 $this->click('_qf_Display_next-bottom');
565 $this->waitForPageToLoad($this->getTimeoutMsec());
569 * @param $profileTitle
570 * @param $customDataArr
573 function _addProfile($profileTitle, $customDataArr, $profileFor) {
575 $this->openCiviPage('admin/uf/group', 'reset=1');
577 $this->clickLink('link=Add Profile', '_qf_Group_cancel-bottom');
579 // Add membership custom data field to profile
580 $this->type('title', $profileTitle);
582 // Standalone form or directory
583 $this->click('uf_group_type_Profile');
585 $this->clickLink('_qf_Group_next-bottom');
587 $this->waitForText('crm-notification-container', "Your CiviCRM Profile '{$profileTitle}' has been added. You can add fields to this profile now.");
589 $this->waitForElementPresent("field_name[0]");
590 foreach ($customDataArr as $customDataParams) {
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');
596 // Clicking save and new
597 $this->click('_qf_Field_next_new-bottom');
598 $this->waitForText('crm-notification-container', "Your CiviCRM Profile Field '{$customDataParams[1]}' has been saved to '{$profileTitle}'.");
599 $this->waitForElementPresent("xpath=//select[@id='field_name_1'][@style='display: none;']");
608 function _addCustomData($profileFor) {
609 $returnArray = array();
610 $customGroupTitle = 'Custom_' . substr(sha1(rand()), 0, 4);
612 $this->openCiviPage('admin/custom/group', 'reset=1');
614 //add new custom data
615 $this->clickLink("//a[@id='newCustomDataGroup']/span");
617 //fill custom group title
618 $this->click("title");
619 $this->type("title", $customGroupTitle);
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='']");
628 $this->clickLink('_qf_Group_next-bottom');
630 //Is custom group created?
631 $this->waitForText('crm-notification-container', "Your custom field set '{$customGroupTitle}' has been added. You can add custom fields now.");
634 $this->waitForElementPresent("label");
635 $checkLabel1 = 'Custom Check One Text_' . substr(sha1(rand()), 0, 4);
636 $this->type('label', $checkLabel1);
637 $this->click('data_type[0]');
638 $this->select('data_type[0]', "label=Alphanumeric");
639 $this->select('data_type[1]', "label=CheckBox");
641 // enter checkbox options
642 $checkOneOptionLabel1 = 'optionLabel_' . substr(sha1(rand()), 0, 5);
643 $this->type('option_label_1', $checkOneOptionLabel1);
644 $this->type('option_value_1', 1);
645 $checkOneOptionLabel2 = 'optionLabel_' . substr(sha1(rand()), 0, 5);
646 $this->type('option_label_2', $checkOneOptionLabel2);
647 $this->type('option_value_2', 2);
648 $this->click("link=another choice");
649 $checkOneOptionLabel3 = 'optionLabel_' . substr(sha1(rand()), 0, 5);
650 $this->type('option_label_3', $checkOneOptionLabel3);
651 $this->type('option_value_3', 3);
653 //setting options per line to check CRM-9938
654 $this->type("options_per_line", 2);
657 $this->clickLink('_qf_Field_next_new-top', '_qf_Field_done-bottom', FALSE);
659 //Is custom field created
660 $this->waitForText('crm-notification-container', "Custom field '$checkLabel1' has been saved.");
661 $this->waitForElementPresent("label");
662 $returnArray[1] = array($customGroupTitle, $checkLabel1);
664 // create another custom field - Integer Radio
666 $checkLabel2 = 'Custom Check Two Text_' . substr(sha1(rand()), 0, 4);
667 $this->type('label', $checkLabel2);
668 $this->click('data_type[0]');
669 $this->select('data_type[0]', "label=Alphanumeric");
670 $this->select('data_type[1]', "label=CheckBox");
672 // enter checkbox options
673 $checkTwoOptionLabel1 = 'optionLabel_' . substr(sha1(rand()), 0, 5);
674 $this->type('option_label_1', $checkTwoOptionLabel1);
675 $this->type('option_value_1', 1);
676 $checkTwoOptionLabel2 = 'optionLabel_' . substr(sha1(rand()), 0, 5);
677 $this->type('option_label_2', $checkTwoOptionLabel2);
678 $this->type('option_value_2', 2);
679 $this->click("link=another choice");
680 $checkTwoOptionLabel3 = 'optionLabel_' . substr(sha1(rand()), 0, 5);
681 $this->type('option_label_3', $checkTwoOptionLabel3);
682 $this->type('option_value_3', 3);
685 $this->clickLink('_qf_Field_next_new-top', '_qf_Field_done-bottom', FALSE);
687 //Is custom field created
688 $this->waitForText('crm-notification-container', "Custom field '$checkLabel2' has been saved.");
689 $returnArray[2] = array($customGroupTitle, $checkLabel2);
691 // create another custom field - Date
692 $this->waitForElementPresent("label");
693 $dateFieldLabel = 'Custom Date Field' . substr(sha1(rand()), 0, 4);
694 $this->type('label', $dateFieldLabel);
695 $this->click('data_type[0]');
696 $this->select('data_type[0]', "label=Date");
697 $this->waitForElementPresent('start_date_years');
699 // enter years prior to current date
700 $this->type('start_date_years', 3);
702 // enter years upto the end year
703 $this->type('end_date_years', 3);
705 // select the date and time format
706 $this->select('date_format', "value=yy-mm-dd");
707 $this->select('time_format', "value=2");
710 $this->clickLink('_qf_Field_next_new-top', '_qf_Field_done-bottom', FALSE);
711 //Is custom field created
712 $this->waitForText('crm-notification-container', "Custom field '$dateFieldLabel' has been saved.");
713 $returnArray[3] = array($customGroupTitle, $dateFieldLabel);
715 //create rich text editor field
716 $this->waitForElementPresent("label");
717 $richTextField = 'Custom Rich TextField_' . substr(sha1(rand()), 0, 4);
718 $this->type('label', $richTextField);
719 $this->click('data_type[0]');
720 $this->select('data_type[0]', "label=Note");
721 $this->select('data_type[1]', "label=RichTextEditor");
724 $this->clickLink('_qf_Field_next_new-top', '_qf_Field_done-bottom', FALSE);
726 //Is custom field created
727 $this->waitForText('crm-notification-container', "Custom field '$richTextField' has been saved.");
728 $returnArray[4] = array($customGroupTitle, $richTextField);
730 //create radio button field
732 $this->waitForElementPresent("label");
733 $radioLabel1 = 'Custom Radio One Text_' . substr(sha1(rand()), 0, 4);
734 $this->type('label', $radioLabel1);
735 $this->click('data_type[0]');
736 $this->select('data_type[0]', "label=Alphanumeric");
737 $this->select('data_type[1]', "label=Radio");
739 // enter radio options
740 $radioOneOptionLabel1 = 'optionLabel_' . substr(sha1(rand()), 0, 5);
741 $this->type('option_label_1', $radioOneOptionLabel1);
742 $this->type('option_value_1', 1);
743 $radioOneOptionLabel2 = 'optionLabel_' . substr(sha1(rand()), 0, 5);
744 $this->type('option_label_2', $radioOneOptionLabel2);
745 $this->type('option_value_2', 2);
746 $this->click("link=another choice");
747 $radioOneOptionLabel3 = 'optionLabel_' . substr(sha1(rand()), 0, 5);
748 $this->type('option_label_3', $radioOneOptionLabel3);
749 $this->type('option_value_3', 3);
752 $this->clickLink('_qf_Field_next_new-top', '_qf_Field_done-bottom', FALSE);
754 //Is custom field created
755 $this->waitForText('crm-notification-container', "Custom field '$radioLabel1' has been saved.");
756 $returnArray[5] = array($customGroupTitle, $radioLabel1);
758 // create another custom field - Alpha Radio
760 $this->waitForElementPresent("label");
761 $radioLabel2 = 'Custom Radio Two Text_' . substr(sha1(rand()), 0, 4);
762 $this->type('label', $radioLabel2);
763 $this->click('data_type[0]');
764 $this->select('data_type[0]', "label=Alphanumeric");
765 $this->select('data_type[1]', "label=Radio");
767 // enter radio options
768 $radioTwoOptionLabel1 = 'optionLabel_' . substr(sha1(rand()), 0, 5);
769 $this->type('option_label_1', $radioTwoOptionLabel1);
770 $this->type('option_value_1', 1);
771 $radioTwoOptionLabel2 = 'optionLabel_' . substr(sha1(rand()), 0, 5);
772 $this->type('option_label_2', $radioTwoOptionLabel2);
773 $this->type('option_value_2', 2);
774 $this->click("link=another choice");
775 $radioTwoOptionLabel3 = 'optionLabel_' . substr(sha1(rand()), 0, 5);
776 $this->type('option_label_3', $radioTwoOptionLabel3);
777 $this->type('option_value_3', 3);
780 $this->clickLink('_qf_Field_done', 'newCustomField', FALSE);
782 //Is custom field created
783 $this->waitForText('crm-notification-container', "Custom field '$radioLabel2' has been saved.");
784 $returnArray[6] = array($customGroupTitle, $radioLabel2);