Commit | Line | Data |
---|---|---|
6a488035 TO |
1 | <?php |
2 | /* | |
3 | +--------------------------------------------------------------------+ | |
06a1bc01 | 4 | | CiviCRM version 4.5 | |
6a488035 | 5 | +--------------------------------------------------------------------+ |
06a1bc01 | 6 | | Copyright CiviCRM LLC (c) 2004-2014 | |
6a488035 TO |
7 | +--------------------------------------------------------------------+ |
8 | | This file is a part of CiviCRM. | | |
9 | | | | |
10 | | CiviCRM is free software; you can copy, modify, and distribute it | | |
11 | | under the terms of the GNU Affero General Public License | | |
12 | | Version 3, 19 November 2007 and the CiviCRM Licensing Exception. | | |
13 | | | | |
14 | | CiviCRM is distributed in the hope that it will be useful, but | | |
15 | | WITHOUT ANY WARRANTY; without even the implied warranty of | | |
16 | | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. | | |
17 | | See the GNU Affero General Public License for more details. | | |
18 | | | | |
19 | | You should have received a copy of the GNU Affero General Public | | |
20 | | License along with this program; if not, contact CiviCRM LLC | | |
21 | | at info[AT]civicrm[DOT]org. If you have questions about the | | |
22 | | GNU Affero General Public License or the licensing of CiviCRM, | | |
23 | | see the CiviCRM license FAQ at http://civicrm.org/licensing | | |
24 | +--------------------------------------------------------------------+ | |
25 | */ | |
26 | ||
6a488035 TO |
27 | require_once 'CiviTest/CiviSeleniumTestCase.php'; |
28 | class WebTest_Contact_MergeContactsTest extends CiviSeleniumTestCase { | |
29 | ||
30 | protected function setUp() { | |
31 | parent::setUp(); | |
32 | } | |
33 | ||
34 | function testIndividualAdd() { | |
6a488035 TO |
35 | $this->webtestLogin(); |
36 | ||
071a6d2e | 37 | $this->openCiviPage("contact/add", "reset=1&ct=Individual"); |
6a488035 TO |
38 | |
39 | // add contact1 | |
40 | //select prefix | |
41 | $prefix = 'Mr.'; | |
42 | $this->click("prefix_id"); | |
43 | $this->select("prefix_id", "label=$prefix"); | |
44 | ||
45 | //fill in first name | |
46 | $firstName = substr(sha1(rand()), 0, 7); | |
47 | $this->type('first_name', $firstName); | |
48 | ||
49 | //fill in last name | |
50 | $lastName = substr(sha1(rand()), 0, 7); | |
51 | $this->type('last_name', $lastName); | |
52 | ||
53 | //fill in email id | |
54 | $this->type('email_1_email', "{$firstName}.{$lastName}@example.com"); | |
55 | ||
56 | //fill in billing email id | |
57 | $this->click('addEmail'); | |
58 | $this->waitForElementPresent('email_2_email'); | |
59 | $this->type('email_2_email', "$firstName.$lastName@billing.com"); | |
60 | $this->select('email_2_location_type_id', 'value=5'); | |
61 | ||
62 | // Clicking save. | |
63 | $this->click("_qf_Contact_upload_view"); | |
64 | $this->waitForPageToLoad($this->getTimeoutMsec()); | |
6c5f7368 | 65 | $this->waitForText('crm-notification-container', "Contact Saved"); |
6a488035 TO |
66 | |
67 | // Add Contact to a group | |
68 | $group = 'Newsletter Subscribers'; | |
69 | $this->click('css=li#tab_group a'); | |
70 | $this->waitForElementPresent('_qf_GroupContact_next'); | |
71 | $this->select('group_id', "label=$group"); | |
72 | $this->click('_qf_GroupContact_next'); | |
0cff9fd6 | 73 | $this->waitForElementPresent('link=Delete'); |
6c5f7368 | 74 | $this->waitForText('crm-notification-container', "Added to Group"); |
6a488035 TO |
75 | |
76 | // Add Tags to the contact | |
77 | $tag = 'Government Entity'; | |
78 | $this->click("css=li#tab_tag a"); | |
79 | $this->waitForElementPresent('tagtree'); | |
80 | $this->click("xpath=//div[@id='tagtree']/ul//li/input/../label[text()='$tag']"); | |
81 | $this->click("css=#tab_summary a"); | |
82 | $this->assertElementContainsText('css=.crm-summary-block #tags', $tag); | |
83 | ||
84 | // Add an activity | |
85 | $subject = "This is subject of test activity being added through activity tab of contact summary screen."; | |
86 | $this->addActivity($firstName, $lastName, $subject); | |
87 | ||
88 | // contact2: duplicate of contact1. | |
071a6d2e | 89 | $this->openCiviPage("contact/add", "reset=1&ct=Individual"); |
6a488035 TO |
90 | |
91 | //fill in first name | |
92 | $this->type("first_name", $firstName); | |
93 | ||
94 | //fill in last name | |
95 | $this->type("last_name", $lastName); | |
96 | ||
97 | //fill in email | |
98 | $this->type("email_1_email", "{$firstName}.{$lastName}@example.com"); | |
99 | ||
100 | // Clicking save. | |
101 | $this->click("_qf_Contact_refresh_dedupe"); | |
102 | $this->waitForPageToLoad($this->getTimeoutMsec()); | |
103 | ||
baaf85ee | 104 | $this->waitForText('crm-notification-container', "One matching contact was found. You can View or Edit the existing contact."); |
6a488035 TO |
105 | $this->click("_qf_Contact_upload_duplicate"); |
106 | $this->waitForPageToLoad($this->getTimeoutMsec()); | |
6c5f7368 | 107 | $this->waitForText('crm-notification-container', "Contact Saved"); |
6a488035 TO |
108 | |
109 | // Add second pair of dupes so we can test Merge and Goto Next Pair | |
110 | $fname2 = 'Janet'; | |
111 | $lname2 = 'Rogers' . substr(sha1(rand()), 0, 7); | |
112 | $email2 = "{$fname2}.{$lname2}@example.org"; | |
113 | $this->webtestAddContact($fname2, $lname2, $email2); | |
114 | ||
115 | // Can not use helper for 2nd contact since it is a dupe | |
071a6d2e | 116 | $this->openCiviPage("contact/add", "reset=1&ct=Individual"); |
6a488035 TO |
117 | $this->type("first_name", $fname2); |
118 | $this->type("last_name", $lname2); | |
119 | $this->type("email_1_email", $email2); | |
120 | $this->click("_qf_Contact_refresh_dedupe"); | |
121 | $this->waitForPageToLoad($this->getTimeoutMsec()); | |
baaf85ee | 122 | $this->waitForText('crm-notification-container', "One matching contact was found. You can View or Edit the existing contact."); |
6a488035 TO |
123 | $this->click("_qf_Contact_upload_duplicate"); |
124 | $this->waitForPageToLoad($this->getTimeoutMsec()); | |
6c5f7368 | 125 | $this->waitForText('crm-notification-container', "Contact Saved"); |
6a488035 TO |
126 | |
127 | // Find and Merge Contacts with Supervised Rule | |
071a6d2e | 128 | $this->openCiviPage("contact/dedupefind", "reset=1&rgid=1&action=renew"); |
6a488035 TO |
129 | |
130 | // reload the page | |
071a6d2e | 131 | $this->openCiviPage("contact/dedupefind", "reset=1&rgid=1&action=update"); |
6a488035 TO |
132 | |
133 | // Select the contacts to be merged | |
134 | $this->select("name=option51_length", "value=100"); | |
6a488035 | 135 | |
efb29358 | 136 | $this->waitForElementPresent("xpath=//a[text()='$firstName $lastName']/../../td[4]/a[text()='merge']"); |
6a488035 TO |
137 | $this->click("xpath=//a[text()='$firstName $lastName']/../../td[4]/a[text()='merge']"); |
138 | $this->waitForElementPresent('_qf_Merge_cancel-bottom'); | |
139 | ||
225a8648 | 140 | $this->clickLink("css=div.crm-contact-merge-form-block div.action-link a", '_qf_Merge_cancel-bottom'); |
6a488035 TO |
141 | |
142 | // Move the activities, groups, etc to the main contact and merge using Merge and Goto Next Pair | |
143 | $this->check('move_prefix_id'); | |
144 | $this->check('move_location_email_2'); | |
145 | $this->check('move_rel_table_activities'); | |
146 | $this->check('move_rel_table_groups'); | |
147 | $this->check('move_rel_table_tags'); | |
225a8648 | 148 | $this->clickLink('_qf_Merge_next-bottom', '_qf_Merge_cancel-bottom'); |
6a488035 TO |
149 | $this->assertTrue($this->isTextPresent('Contacts Merged'), "Contacts Merged text was not found after merge."); |
150 | ||
151 | // Check that we are viewing the next Merge Pair (our 2nd contact, since the merge list is ordered by contact_id) | |
152 | $this->assertTrue($this->isTextPresent("{$fname2} {$lname2}"), "Redirect for Goto Next Pair after merge did not work."); | |
153 | ||
154 | // Ensure that the duplicate contact has been deleted | |
42daf119 | 155 | $this->openCiviPage("contact/search/advanced", "reset=1", '_qf_Advanced_refresh'); |
6a488035 TO |
156 | $this->type('sort_name', $firstName); |
157 | $this->check('deleted_contacts'); | |
158 | $this->click('_qf_Advanced_refresh'); | |
159 | $this->waitForPageToLoad($this->getTimeoutMsec()); | |
160 | $this->assertTrue($this->isTextPresent('1 Contact'), "Deletion of duplicate contact during merge was not successful. Dupe contact not found when searching trash."); | |
161 | ||
162 | // Search for the main contact | |
42daf119 | 163 | $this->openCiviPage("contact/search/advanced", "reset=1", '_qf_Advanced_refresh'); |
6a488035 TO |
164 | $this->type('sort_name', $firstName); |
165 | $this->click('_qf_Advanced_refresh'); | |
166 | $this->waitForElementPresent("xpath=//form[@id='Advanced']/div[3]/div/div[2]/table/tbody/tr"); | |
167 | ||
168 | $this->click("//form[@id='Advanced']/div[3]/div/div[2]/table/tbody/tr/td[11]/span[1]/a[text()='View']"); | |
169 | $this->waitForPageToLoad($this->getTimeoutMsec()); | |
170 | ||
171 | // Verify prefix merged | |
172 | // $this->verifyText( "xpath=//div[@class='left-corner']/h2", preg_quote( "$prefix $firstName $lastName" ) ); | |
173 | ||
174 | // Verify billing email merged | |
175 | $this->isElementPresent("xpath=//div[@class='contact_details']/div[1][@class='contact_panel']/div[1][@class='contactCardLeft']/table/tbody/tr[4]/td[2]/span/a[text()='$firstName.$lastName@billing.com']"); | |
176 | ||
177 | // Verify activity merged | |
178 | $this->click("css=li#tab_activity a"); | |
179 | $this->waitForElementPresent("xpath=//table[@id='contact-activity-selector-activity']/tbody/tr"); | |
180 | $this->verifyText("xpath=//table[@id='contact-activity-selector-activity']/tbody/tr/td[5]/a", | |
181 | preg_quote("$lastName, $firstName") | |
182 | ); | |
183 | ||
184 | // Verify group merged | |
185 | $this->click("css=li#tab_group a"); | |
e9322446 | 186 | $this->waitForElementPresent("GroupContact"); |
187 | $this->waitForElementPresent("xpath=//form[@id='GroupContact']//div[@class='view-content view-contact-groups']//div/table/tbody/tr/td/a"); | |
188 | $this->verifyText("xpath=//form[@id='GroupContact']//div[@class='view-content view-contact-groups']//div/table/tbody/tr/td/a", | |
6a488035 TO |
189 | preg_quote("$group") |
190 | ); | |
191 | ||
192 | // Verify tag merged | |
193 | $this->click("css=li#tab_tag a"); | |
194 | $this->waitForElementPresent('check_5'); | |
195 | $this->assertChecked("check_3"); | |
196 | } | |
197 | ||
4cbe18b8 EM |
198 | /** |
199 | * @param $firstName | |
200 | * @param $lastName | |
201 | * @param $subject | |
202 | */ | |
6a488035 TO |
203 | function addActivity($firstName, $lastName, $subject) { |
204 | $withContact = substr(sha1(rand()), 0, 7); | |
205 | $this->webtestAddContact($withContact, "Anderson", $withContact . "@anderson.name"); | |
206 | ||
207 | $this->click("css=li#tab_activity a"); | |
208 | ||
209 | // waiting for the activity dropdown to show up | |
210 | $this->waitForElementPresent("other_activity"); | |
211 | ||
212 | // Select the activity type from the activity dropdown | |
213 | $this->select("other_activity", "label=Meeting"); | |
214 | ||
215 | // waitForPageToLoad is not always reliable. Below, we're waiting for the submit | |
216 | // button at the end of this page to show up, to make sure it's fully loaded. | |
217 | $this->waitForElementPresent("_qf_Activity_upload"); | |
218 | ||
6a488035 TO |
219 | // ...and verifying if the page contains properly formatted display name for chosen contact. |
220 | $this->assertTrue($this->isTextPresent("Anderson, " . $withContact), "Contact not found in line " . __LINE__); | |
221 | ||
222 | // Now we're filling the "Assigned To" field. | |
223 | // Typing contact's name into the field (using typeKeys(), not type()!)... | |
0cff9fd6 | 224 | $this->select2("assignee_contact_id", $firstName,TRUE,FALSE); |
6a488035 TO |
225 | |
226 | // ...and verifying if the page contains properly formatted display name for chosen contact. | |
227 | $this->assertTrue($this->isTextPresent("$lastName, " . $firstName), "Contact not found in line " . __LINE__); | |
228 | ||
229 | // Since we're here, let's check if screen help is being displayed properly | |
0cff9fd6 | 230 | $this->assertTrue($this->isTextPresent("A copy of this activity will be emailed to each Assignee.")); |
6a488035 TO |
231 | |
232 | // Putting the contents into subject field - assigning the text to variable, it'll come in handy later | |
233 | // For simple input fields we can use field id as selector | |
234 | $this->type("subject", $subject); | |
235 | $this->type("location", "Some location needs to be put in this field."); | |
236 | ||
237 | // Choosing the Date. | |
238 | // Please note that we don't want to put in fixed date, since | |
239 | // we want this test to work in the future and not fail because | |
240 | // of date being set in the past. Therefore, using helper webtestFillDateTime function. | |
241 | $this->webtestFillDateTime('activity_date_time', '+1 month 11:10PM'); | |
242 | ||
243 | // Setting duration. | |
244 | $this->type("duration", "30"); | |
245 | ||
246 | // Putting in details. | |
247 | $this->type("details", "Really brief details information."); | |
248 | ||
249 | // Making sure that status is set to Scheduled (using value, not label). | |
250 | $this->select("status_id", "value=1"); | |
251 | ||
252 | // Setting priority. | |
253 | $this->select("priority_id", "value=1"); | |
254 | ||
255 | // Clicking save. | |
256 | $this->click("_qf_Activity_upload"); | |
0cff9fd6 | 257 | $this->waitForElementPresent("crm-notification-container"); |
6a488035 TO |
258 | |
259 | // Is status message correct? | |
baaf85ee | 260 | $this->waitForText('crm-notification-container', "Activity '$subject' has been saved.", "Status message didn't show up after saving!"); |
6a488035 TO |
261 | } |
262 | ||
6a488035 | 263 | function testMergeTest() { |
6a488035 TO |
264 | $this->webtestLogin(); |
265 | ||
071a6d2e | 266 | $this->openCiviPage("contact/add", "reset=1&ct=Individual"); |
6a488035 TO |
267 | |
268 | // add contact1 | |
269 | //fill in first name | |
270 | $firstName = substr(sha1(rand()), 0, 7); | |
271 | $this->type('first_name', $firstName); | |
272 | ||
273 | //fill in last name | |
274 | $lastName = substr(sha1(rand()), 0, 7); | |
275 | $this->type('last_name', $lastName); | |
276 | ||
277 | //fill in email id | |
278 | $this->type('email_1_email', "{$firstName}.{$lastName}@example.com"); | |
279 | ||
280 | //fill in billing email id | |
281 | $this->click('addEmail'); | |
282 | $this->waitForElementPresent('email_2_email'); | |
283 | $this->type('email_2_email', "$firstName.$lastName@billing.com"); | |
284 | $this->select('email_2_location_type_id', 'value=5'); | |
285 | ||
286 | //fill in home phone no | |
287 | $this->type('phone_1_phone', "9876543210"); | |
288 | ||
289 | //fill in billing phone id | |
290 | $this->click('addPhone'); | |
291 | $this->waitForElementPresent('phone_2_phone'); | |
292 | $this->type('phone_2_phone', "9876543120"); | |
293 | $this->select('phone_2_location_type_id', 'value=5'); | |
294 | ||
295 | // Clicking save. | |
296 | $this->click("_qf_Contact_upload_view"); | |
297 | $this->waitForPageToLoad($this->getTimeoutMsec()); | |
6c5f7368 | 298 | $this->waitForText('crm-notification-container', "Contact Saved"); |
6a488035 TO |
299 | |
300 | // contact2: duplicate of contact1. | |
071a6d2e | 301 | $this->openCiviPage("contact/add", "reset=1&ct=Individual"); |
6a488035 TO |
302 | |
303 | //fill in first name | |
304 | $this->type("first_name", $firstName); | |
305 | ||
306 | //fill in last name | |
307 | $this->type("last_name", $lastName); | |
308 | ||
309 | //fill in email | |
310 | $this->type("email_1_email", "{$firstName}.{$lastName}@example.com"); | |
311 | ||
312 | //fill in home phone no | |
313 | $this->type('phone_1_phone', "9876543211"); | |
314 | ||
315 | // Clicking save. | |
316 | $this->click("_qf_Contact_refresh_dedupe"); | |
317 | $this->waitForPageToLoad($this->getTimeoutMsec()); | |
318 | ||
baaf85ee | 319 | $this->waitForText('crm-notification-container', "One matching contact was found. You can View or Edit the existing contact."); |
6a488035 TO |
320 | $this->click("_qf_Contact_upload_duplicate"); |
321 | $this->waitForPageToLoad($this->getTimeoutMsec()); | |
6c5f7368 | 322 | $this->waitForText('crm-notification-container', "Contact Saved"); |
6a488035 TO |
323 | |
324 | // Find and Merge Contacts with Supervised Rule | |
071a6d2e | 325 | $this->openCiviPage("contact/dedupefind", "reset=1&rgid=1&action=renew"); |
6a488035 TO |
326 | |
327 | // Select the contacts to be merged | |
328 | $this->select("name=option51_length", "value=100"); | |
329 | $this->waitForElementPresent("xpath=//a[text()='$firstName $lastName']"); | |
330 | $this->click("xpath=//a[text()='$firstName $lastName']/../../td[4]/a[text()='merge']"); | |
331 | $this->waitForElementPresent('_qf_Merge_cancel-bottom'); | |
e9322446 | 332 | $this->clickLink("css=div.crm-contact-merge-form-block div.action-link a", "xpath=//form[@id='Merge']/div[2]/table/tbody/tr[3]/td[4]/span[text()='(overwrite)']", FALSE); |
333 | $this->waitForElementPresent("xpath=//form[@id='Merge']/div[2]/table/tbody/tr[5]/td[4]/span[text()='(add)']"); | |
6a488035 TO |
334 | $this->waitForElementPresent('_qf_Merge_cancel-bottom'); |
335 | ||
336 | $this->check("move_location_email_1"); | |
337 | $this->check("location[email][1][operation]"); | |
338 | $this->check("move_location_email_2"); | |
339 | $this->check("move_location_phone_1"); | |
340 | $this->check("location[phone][1][operation]"); | |
341 | $this->check("move_location_phone_2"); | |
342 | $this->click("_qf_Merge_next-bottom"); | |
343 | $this->waitForPageToLoad($this->getTimeoutMsec()); | |
344 | ||
345 | $this->assertTrue($this->isTextPresent('Contacts Merged')); | |
346 | $this->assertTrue($this->isElementPresent("xpath=//div[@id='email-block']/div/div/div[2]/div[1][contains(text(), 'Home')]")); | |
347 | $this->assertTrue($this->isElementPresent("xpath=//div[@id='email-block']/div/div/div[2]/div[2]/a[text() = '{$firstName}.{$lastName}@example.com']")); | |
348 | $this->assertTrue($this->isElementPresent("xpath=//div[@id='email-block']/div/div/div[3]/div[1][contains(text(), 'Home')]")); | |
349 | $this->assertTrue($this->isElementPresent("xpath=//div[@id='email-block']/div/div/div[3]/div[2]/a[text() ='{$firstName}.{$lastName}@example.com']")); | |
350 | $this->assertTrue($this->isElementPresent("xpath=//div[@id='email-block']/div/div/div[4]/div[1][contains(text(), 'Billing')]")); | |
351 | $this->assertTrue($this->isElementPresent("xpath=//div[@id='email-block']/div/div/div[4]/div[2]/a[text() ='$firstName.$lastName@billing.com']")); | |
352 | $this->assertTrue($this->isElementPresent("xpath=//div[@id='phone-block']/div/div/div[2]/div[1][contains(text(), 'Home')]")); | |
353 | $this->assertTrue($this->isElementPresent("xpath=//div[@id='phone-block']/div/div/div[2]/div[2][contains(text(), '9876543211')]")); | |
354 | $this->assertTrue($this->isElementPresent("xpath=//div[@id='phone-block']/div/div/div[3]/div[1][contains(text(), 'Home')]")); | |
355 | $this->assertTrue($this->isElementPresent("xpath=//div[@id='phone-block']/div/div/div[3]/div[2][contains(text(), '9876543210')]")); | |
356 | $this->assertTrue($this->isElementPresent("xpath=//div[@id='phone-block']/div/div/div[4]/div[1][contains(text(), 'Billing')]")); | |
357 | $this->assertTrue($this->isElementPresent("xpath=//div[@id='phone-block']/div/div/div[4]/div[2][contains(text(), '9876543120')]")); | |
358 | ||
359 | //Merge with the feature of (add) | |
071a6d2e | 360 | $this->openCiviPage("contact/add", "reset=1&ct=Individual"); |
6a488035 TO |
361 | |
362 | // add contact1 | |
363 | //fill in first name | |
364 | $firstName1 = substr(sha1(rand()), 0, 7); | |
365 | $this->type('first_name', $firstName1); | |
366 | ||
367 | //fill in last name | |
368 | $lastName1 = substr(sha1(rand()), 0, 7); | |
369 | $this->type('last_name', $lastName1); | |
370 | ||
371 | //fill in billing email id | |
372 | $this->waitForElementPresent('email_1_email'); | |
373 | $this->type('email_1_email', "$firstName1.$lastName1@example.com"); | |
374 | $this->select('email_1_location_type_id', 'value=5'); | |
375 | ||
376 | $this->click('addEmail'); | |
377 | $this->waitForElementPresent('email_2_email'); | |
378 | $this->type('email_2_email', "$firstName.$lastName@home.com"); | |
379 | $this->select('email_2_location_type_id', 'value=1'); | |
380 | ||
381 | //fill in home phone no | |
382 | $this->type('phone_1_phone', "9876543210"); | |
383 | ||
384 | // Clicking save. | |
385 | $this->click("_qf_Contact_upload_view"); | |
386 | $this->waitForPageToLoad($this->getTimeoutMsec()); | |
6c5f7368 | 387 | $this->waitForText('crm-notification-container', "Contact Saved"); |
6a488035 TO |
388 | |
389 | // contact2: duplicate of contact1. | |
071a6d2e | 390 | $this->openCiviPage("contact/add", "reset=1&ct=Individual"); |
6a488035 TO |
391 | |
392 | //fill in first name | |
393 | $this->type("first_name", $firstName1); | |
394 | ||
395 | //fill in last name | |
396 | $this->type("last_name", $lastName1); | |
397 | ||
398 | //fill in email | |
399 | $this->type("email_1_email", "{$firstName1}.{$lastName1}@example.com"); | |
400 | ||
401 | //fill in billing phone no | |
402 | $this->type('phone_1_phone', "9876543120"); | |
403 | $this->select('phone_1_location_type_id', 'value=5'); | |
404 | ||
405 | // Clicking save. | |
406 | $this->click("_qf_Contact_refresh_dedupe"); | |
407 | $this->waitForPageToLoad($this->getTimeoutMsec()); | |
baaf85ee | 408 | $this->waitForText('crm-notification-container', "One matching contact was found. You can View or Edit the existing contact."); |
6a488035 TO |
409 | $this->click("_qf_Contact_upload_duplicate"); |
410 | $this->waitForPageToLoad($this->getTimeoutMsec()); | |
6c5f7368 | 411 | $this->waitForText('crm-notification-container', "Contact Saved"); |
6a488035 TO |
412 | |
413 | // Find and Merge Contacts with Supervised Rule | |
071a6d2e | 414 | $this->openCiviPage("contact/dedupefind", "reset=1&rgid=1&action=renew"); |
6a488035 TO |
415 | |
416 | // Select the contacts to be merged | |
417 | $this->select("name=option51_length", "value=100"); | |
e9322446 | 418 | $this->waitForElementPresent("xpath=//*[@id='DedupeFind']//table[@class='pagerDisplay dataTable no-footer']/tbody//tr/td[1]/a[text()='57e10a6 9a3de85']/../../td[2]/a[text()='57e10a6 9a3de85']"); |
419 | $this->click("xpath=//*[@id='DedupeFind']//table[@class='pagerDisplay dataTable no-footer']/tbody//tr/td[1]/a[text()='$firstName1 $lastName1']/../../td[2]/a[text()='$firstName1 $lastName1']/../../td[4]/a[text()='merge']"); | |
6a488035 | 420 | $this->waitForElementPresent('_qf_Merge_cancel-bottom'); |
e9322446 | 421 | $this->clickLink("css=div.crm-contact-merge-form-block div.action-link a", "xpath=//form[@id='Merge']/div[2]/table/tbody/tr[4]/td[4]/span[text()='(overwrite)']"); |
422 | $this->waitForElementPresent("xpath=//form[@id='Merge']/div[2]/table/tbody/tr[3]/td[4]/span[text()='(add)']"); | |
423 | $this->waitForElementPresent("xpath=//form[@id='Merge']/div[2]/table/tbody/tr[4]/td[4]/span[text()='(overwrite)']"); | |
6a488035 TO |
424 | $this->select('location_email_1_locTypeId', 'value=3'); |
425 | $this->select('location_phone_1_locTypeId', 'value=1'); | |
426 | $this->assertFalse($this->isElementPresent("xpath=//form[@id='Merge']/div[2]/table/tbody/tr[2]/td[4]/span[text()='(overwrite)']")); | |
427 | $this->assertFalse($this->isElementPresent("xpath=//form[@id='Merge']/div[2]/table/tbody/tr[4]/td[4]/span[text()='(overwrite)']")); | |
428 | $this->assertTrue($this->isElementPresent("xpath=//form[@id='Merge']/div[2]/table/tbody/tr[3]/td[4]/span[text()='(add)']")); | |
429 | $this->waitForElementPresent('_qf_Merge_cancel-bottom'); | |
430 | ||
431 | $this->check("move_location_email_1"); | |
432 | $this->check("move_location_phone_1"); | |
433 | $this->click("_qf_Merge_next-bottom"); | |
434 | $this->waitForPageToLoad($this->getTimeoutMsec()); | |
435 | ||
436 | $this->assertTrue($this->isTextPresent('Contacts Merged')); | |
437 | $this->assertTrue($this->isElementPresent("xpath=//div[@id='email-block']/div/div/div[2]/div[1][contains(text(), 'Home')]")); | |
438 | $this->assertTrue($this->isElementPresent("xpath=//div[@id='email-block']/div/div/div[2]/div[2]/a[text() ='{$firstName1}.{$lastName1}@example.com']")); | |
439 | $this->assertTrue($this->isElementPresent("xpath=//div[@id='email-block']/div/div/div[3]/div[1][contains(text(), 'Main')]")); | |
440 | $this->assertTrue($this->isElementPresent("xpath=//div[@id='email-block']/div/div/div[3]/div[2]/a[text() ='{$firstName1}.{$lastName1}@example.com']")); | |
441 | $this->assertTrue($this->isElementPresent("xpath=//div[@id='phone-block']/div/div/div[2]/div[1][contains(text(), 'Billing')]")); | |
442 | $this->assertTrue($this->isElementPresent("xpath=//div[@id='phone-block']/div/div/div[2]/div[2][contains(text(), '9876543120')]")); | |
443 | $this->assertTrue($this->isElementPresent("xpath=//div[@id='phone-block']/div/div/div[3]/div[1][contains(text(), 'Home')]")); | |
444 | $this->assertTrue($this->isElementPresent("xpath=//div[@id='phone-block']/div/div/div[3]/div[2][contains(text(), '9876543210')]")); | |
445 | } | |
446 | ||
447 | function testBatchMerge(){ | |
6a488035 TO |
448 | $this->webtestLogin(); |
449 | ||
450 | // add contact1 and its duplicate | |
451 | //first name | |
452 | $firstName = "Kerry".substr(sha1(rand()), 0, 7); | |
453 | //last name | |
454 | $lastName = "King".substr(sha1(rand()), 0, 7); | |
455 | $this->_createContacts($firstName,$lastName); | |
456 | ||
457 | //add contact2 and its duplicate | |
458 | //These are the contacts with conflicts in communication preference.these contacts will be skipped during merge. | |
071a6d2e | 459 | $this->openCiviPage("contact/add", "reset=1&ct=Individual"); |
6a488035 TO |
460 | |
461 | //fill in first name | |
462 | $firstName1 = "Kurt".substr(sha1(rand()), 0, 7); | |
463 | $this->type('first_name', $firstName1); | |
464 | ||
465 | //fill in last name | |
466 | $lastName1 = "Cobain".substr(sha1(rand()), 0, 7); | |
467 | $this->type('last_name', $lastName1); | |
468 | ||
469 | //fill in email id | |
470 | $this->type('email_1_email', "{$firstName1}.{$lastName1}@example.com"); | |
471 | ||
472 | //fill in billing email id | |
473 | $this->click('addEmail'); | |
474 | $this->waitForElementPresent('email_2_email'); | |
475 | $this->type('email_2_email', "$firstName1.$lastName1@billing.com"); | |
476 | $this->select('email_2_location_type_id', 'value=5'); | |
477 | ||
478 | //fill in home phone no | |
479 | $this->type('phone_1_phone', "9876543210"); | |
480 | ||
481 | //fill in billing phone id | |
482 | $this->click('addPhone'); | |
483 | $this->waitForElementPresent('phone_2_phone'); | |
484 | $this->type('phone_2_phone', "9876543120"); | |
485 | $this->select('phone_2_location_type_id', 'value=5'); | |
486 | ||
487 | //select communication preference | |
488 | $this->check("privacy[do_not_phone]"); | |
489 | ||
490 | //Clicking save. | |
491 | $this->click("_qf_Contact_upload_view"); | |
492 | $this->waitForPageToLoad($this->getTimeoutMsec()); | |
6c5f7368 | 493 | $this->waitForText('crm-notification-container', "Contact Saved"); |
6a488035 TO |
494 | |
495 | //duplicate of contact2. | |
071a6d2e | 496 | $this->openCiviPage("contact/add", "reset=1&ct=Individual"); |
6a488035 TO |
497 | |
498 | //fill in first name | |
499 | $this->type("first_name", $firstName1); | |
500 | ||
501 | //fill in last name | |
502 | $this->type("last_name", $lastName1); | |
503 | ||
504 | //fill in email | |
505 | $this->type("email_1_email", "{$firstName1}.{$lastName1}@example.com"); | |
506 | ||
507 | //fill in home phone no | |
508 | $this->type('phone_1_phone', "9876543211"); | |
509 | ||
510 | //select communication preference | |
511 | $this->check("preferred_communication_method[1]"); | |
512 | ||
513 | // Clicking save. | |
514 | $this->click("_qf_Contact_refresh_dedupe"); | |
515 | $this->waitForPageToLoad($this->getTimeoutMsec()); | |
516 | ||
baaf85ee | 517 | $this->waitForText('crm-notification-container', "One matching contact was found. You can View or Edit the existing contact."); |
6a488035 TO |
518 | $this->click("_qf_Contact_upload_duplicate"); |
519 | $this->waitForPageToLoad($this->getTimeoutMsec()); | |
6c5f7368 | 520 | $this->waitForText('crm-notification-container', "Contact Saved"); |
6a488035 TO |
521 | |
522 | // add contact3 and its duplicate | |
523 | //fill in first name | |
524 | $firstName2 = "David".substr(sha1(rand()), 0, 7); | |
525 | //fill in last name | |
526 | $lastName2 = "Gilmour".substr(sha1(rand()), 0, 7); | |
527 | $this->_createContacts($firstName2,$lastName2); | |
528 | ||
529 | // add contact4 and its duplicate | |
530 | //fill in first name | |
531 | $firstName3 = "Dave".substr(sha1(rand()), 0, 7); | |
532 | //fill in last name | |
533 | $lastName3 = "Mustaine".substr(sha1(rand()), 0, 7); | |
534 | $this->_createContacts($firstName3,$lastName3); | |
535 | ||
536 | // Find and Merge Contacts with Supervised Rule | |
071a6d2e | 537 | $this->openCiviPage("contact/dedupefind", "reset=1&rgid=1&action=renew", "css=#DedupeFind table.pagerDisplay tbody tr"); |
6a488035 TO |
538 | |
539 | $this->select("name=option51_length", "value=100"); | |
540 | $totalContacts = $this->getXpathCount("//table[@class='pagerDisplay']/tbody/tr"); | |
541 | $this->click("xpath=//form[@id='DedupeFind']//a/span[text()='Batch Merge Duplicates']"); | |
542 | ||
543 | // Check confirmation alert. | |
544 | $this->assertTrue( | |
545 | (bool)preg_match("/^This will run the batch merge process on the listed duplicates. The operation will run in safe mode - only records with no direct data conflicts will be merged. Click OK to proceed if you are sure you wish to run this operation./", | |
546 | $this->getConfirmation() | |
547 | )); | |
548 | $this->chooseOkOnNextConfirmation(); | |
549 | $this->waitForPageToLoad($this->getTimeoutMsec()); | |
efb29358 | 550 | $this->waitForElementPresent('civicrm-footer'); |
6c5f7368 | 551 | $this->waitForText('crm-notification-container', "safe mode"); |
efb29358 CW |
552 | |
553 | // If we are still on the dedupe table page, count unmerged contacts | |
554 | if ($this->isElementPresent("//table[@class='pagerDisplay']")) { | |
555 | // Wait for datatable to load | |
556 | $this->waitForElementPresent("//table[@class='pagerDisplay']/tbody/tr"); | |
557 | $unMergedContacts = $this->getXpathCount("//table[@class='pagerDisplay']/tbody/tr"); | |
558 | } | |
559 | else { | |
560 | $unMergedContacts = 0; | |
561 | } | |
6a488035 | 562 | |
6a488035 | 563 | $mergedContacts = $totalContacts - $unMergedContacts; |
6a488035 TO |
564 | |
565 | //check the existence of merged contacts | |
566 | $contactEmails = array( | |
567 | 1 => "{$firstName}.{$lastName}@example.com", | |
568 | 2 => "{$firstName2}.{$lastName2}@example.com", | |
569 | 3 => "{$firstName3}.{$lastName3}@example.com" | |
570 | ); | |
571 | ||
efb29358 | 572 | foreach($contactEmails as $key => $value) { |
6a488035 TO |
573 | $this->click('sort_name_navigation'); |
574 | $this->type('css=input#sort_name_navigation', $value); | |
575 | $this->typeKeys('css=input#sort_name_navigation', $value); | |
576 | // Wait for result list. | |
0cff9fd6 | 577 | $this->waitForElementPresent("css=ul.ui-autocomplete li.ui-menu-item"); |
6a488035 TO |
578 | |
579 | // Visit contact summary page. | |
0cff9fd6 | 580 | $this->clickLink("css=ul.ui-autocomplete li.ui-menu-item", 'civicrm-footer'); |
6a488035 TO |
581 | } |
582 | } | |
583 | ||
584 | /** | |
585 | * Helper FN | |
586 | */ | |
ada104d5 AW |
587 | function _createContacts($firstName = NULL, $lastName = NULL, $organizationName = NULL, $contactType = 'Individual') { |
588 | if ($contactType == 'Individual') { | |
589 | // add contact | |
590 | $this->openCiviPage("contact/add", "reset=1&ct=Individual"); | |
591 | //fill in first name | |
592 | $this->type('first_name', $firstName); | |
6a488035 | 593 | |
ada104d5 AW |
594 | //fill in last name |
595 | $this->type('last_name', $lastName); | |
6a488035 | 596 | |
ada104d5 AW |
597 | //fill in email id |
598 | $this->type('email_1_email', "{$firstName}.{$lastName}@example.com"); | |
6a488035 | 599 | |
ada104d5 AW |
600 | //fill in billing email id |
601 | $this->click('addEmail'); | |
602 | $this->waitForElementPresent('email_2_email'); | |
603 | $this->type('email_2_email', "$firstName.$lastName@billing.com"); | |
604 | $this->select('email_2_location_type_id', 'value=5'); | |
605 | ||
606 | // Clicking save. | |
607 | $this->click("_qf_Contact_upload_view"); | |
608 | $this->waitForPageToLoad($this->getTimeoutMsec()); | |
609 | $this->waitForText('crm-notification-container', "Contact Saved"); | |
610 | ||
611 | //duplicate of above contact. | |
612 | $this->openCiviPage("contact/add", "reset=1&ct=Individual"); | |
613 | ||
614 | //fill in first name | |
615 | $this->type("first_name", $firstName); | |
616 | ||
617 | //fill in last name | |
618 | $this->type("last_name", $lastName); | |
619 | ||
620 | //fill in email | |
621 | $this->type("email_1_email", "{$firstName}.{$lastName}@example.com"); | |
622 | ||
623 | // Clicking save. | |
624 | $this->click("_qf_Contact_refresh_dedupe"); | |
625 | $this->waitForPageToLoad($this->getTimeoutMsec()); | |
626 | ||
627 | $this->waitForText('crm-notification-container', "One matching contact was found. You can View or Edit the existing contact."); | |
628 | $this->click("_qf_Contact_upload_duplicate"); | |
629 | $this->waitForPageToLoad($this->getTimeoutMsec()); | |
630 | $this->waitForText('crm-notification-container', "Contact Saved"); | |
631 | } | |
632 | elseif ($contactType == 'Organization') { | |
633 | // add contact | |
634 | $this->openCiviPage("contact/add", "reset=1&ct=Organization"); | |
635 | //fill in Organization name | |
636 | $this->type('organization_name', $organizationName); | |
637 | ||
638 | //fill in email id | |
639 | $this->type('email_1_email', "{$organizationName}@org.com"); | |
640 | // Clicking save. | |
641 | $this->click("_qf_Contact_upload_view-bottom"); | |
642 | $this->waitForPageToLoad($this->getTimeoutMsec()); | |
643 | $this->waitForText('crm-notification-container', "Contact Saved"); | |
644 | $mainId = explode("CiviCRM ID:", trim($this->getText("xpath=//div[@id='crm-record-log']/span[@class='col1']"))); | |
645 | $mainId = trim($mainId[1]); | |
646 | ||
647 | //Duplicate of above contact. | |
648 | $this->openCiviPage("contact/add", "reset=1&ct=Organization"); | |
649 | ||
650 | //fill in Organization name | |
651 | $this->type('organization_name', $organizationName); | |
652 | ||
653 | //fill in email id | |
654 | $this->type('email_1_email', "{$organizationName}@org.com"); | |
655 | ||
656 | // Clicking save. | |
657 | $this->click("_qf_Contact_upload_view-bottom"); | |
658 | $this->waitForPageToLoad($this->getTimeoutMsec()); | |
659 | ||
660 | $this->waitForText('crm-notification-container', "One matching contact was found. You can View or Edit the existing contact."); | |
661 | $this->click("_qf_Contact_upload_duplicate"); | |
662 | $this->waitForPageToLoad($this->getTimeoutMsec()); | |
663 | $this->waitForText('crm-notification-container', "Contact Saved"); | |
664 | $duplicateId = explode("CiviCRM ID:", trim($this->getText("xpath=//div[@id='crm-record-log']/span[@class='col1']"))); | |
665 | $duplicateId = trim($duplicateId[1]); | |
666 | ||
667 | return array( | |
668 | 'mainId' => $mainId, | |
669 | 'duplicateId' => $duplicateId | |
670 | ); | |
671 | } | |
672 | } | |
673 | ||
674 | /** | |
675 | * Helper FN | |
676 | * to create new membershiptype | |
677 | */ | |
678 | function addMembershipType($membershipOrganization) { | |
679 | $this->openCiviPage("admin/member/membershipType", "reset=1&action=browse"); | |
680 | $this->click("link=Add Membership Type"); | |
681 | $this->waitForElementPresent('_qf_MembershipType_cancel-bottom'); | |
682 | ||
683 | $this->type('name', "Membership Type $membershipOrganization"); | |
0cff9fd6 | 684 | $this->select2('member_of_contact_id', $membershipOrganization); |
ada104d5 AW |
685 | |
686 | $this->type('minimum_fee', '1'); | |
687 | $this->select( 'financial_type_id', 'value=2' ); | |
688 | $this->type('duration_interval', 1); | |
689 | $this->select('duration_unit', "label=year"); | |
690 | ||
0cff9fd6 | 691 | $this->select('period_type', "label=Fixed"); |
ada104d5 AW |
692 | $this->waitForElementPresent('fixed_period_rollover_day[d]'); |
693 | ||
694 | // fixed period start set to April 1 | |
695 | $this->select('fixed_period_start_day[M]', 'value=4'); | |
696 | // rollover date set to Jan 31 | |
697 | $this->select('fixed_period_rollover_day[M]', 'value=1'); | |
698 | ||
699 | // Employer of relationship | |
700 | $this->select('relationship_type_id', 'value=5_b_a'); | |
701 | $this->click('_qf_MembershipType_upload-bottom'); | |
702 | $this->waitForElementPresent('link=Add Membership Type'); | |
0cff9fd6 | 703 | $this->waitForText("crm-notification-container", "The membership type 'Membership Type $membershipOrganization' has been saved."); |
ada104d5 AW |
704 | } |
705 | ||
706 | /** | |
707 | * Test for CRM-12695 fix | |
708 | */ | |
709 | function testMergeOrganizations() { | |
710 | $this->webtestLogin(); | |
711 | ||
712 | // build organisation name | |
713 | $orgnaizationName = 'org_'.substr(sha1(rand()), 0, 7); | |
714 | ||
715 | $contactIds = array(); | |
716 | // create organization and its duplicate | |
717 | $contactIds = $this->_createContacts(NULL, NULL, $orgnaizationName, 'Organization'); | |
718 | ||
719 | /*** Add Membership Type - start ***/ | |
720 | $this->addMembershipType($orgnaizationName); | |
721 | /*** Add Membership Type - end ***/ | |
722 | ||
723 | //create a New Individual to be related to main organization | |
724 | $firstName = substr(sha1(rand()), 0, 7); | |
725 | $this->webtestAddContact($firstName, "Anderson", "$firstName@anderson.name"); | |
726 | $sortName = "Anderson, $firstName"; | |
727 | ||
728 | // go to main organization contact to add membership | |
729 | $this->openCiviPage("contact/view", "reset=1&cid={$contactIds['mainId']}"); | |
730 | // click through to the membership view screen | |
731 | $this->click("css=li#tab_member a"); | |
732 | ||
733 | $this->waitForElementPresent("link=Add Membership"); | |
734 | $this->click("link=Add Membership"); | |
735 | ||
736 | $this->waitForElementPresent("_qf_Membership_cancel-bottom"); | |
737 | ||
738 | // fill in Membership Organization and Type | |
739 | $this->select("membership_type_id[0]", "label={$orgnaizationName}"); | |
740 | $this->waitForElementPresent("membership_type_id[1]"); | |
741 | // Wait for membership type select to reload | |
742 | $this->waitForTextPresent("Membership Type $orgnaizationName"); | |
743 | $this->select("membership_type_id[1]", "label=Membership Type $orgnaizationName"); | |
744 | ||
745 | $sourceText = "Membership-Organization Duplicate Merge Webtest"; | |
746 | // fill in Source | |
747 | $this->type("source", $sourceText); | |
748 | ||
749 | // Let Join Date stay default | |
750 | ||
751 | // fill in Start Date | |
752 | $this->webtestFillDate('start_date'); | |
6a488035 TO |
753 | |
754 | // Clicking save. | |
ada104d5 | 755 | $this->click("_qf_Membership_upload"); |
0cff9fd6 | 756 | $this->waitForElementPresent('crm-notification-container'); |
ada104d5 AW |
757 | // page was loaded |
758 | $this->waitForTextPresent($sourceText); | |
759 | // Is status message correct? | |
760 | $this->waitForText('crm-notification-container', "membership for $orgnaizationName has been added."); | |
6a488035 | 761 | |
ada104d5 AW |
762 | // add relationship "Employer of" |
763 | // click through to the relationship view screen | |
764 | $this->click("css=li#tab_rel a"); | |
6a488035 | 765 | |
ada104d5 AW |
766 | // wait for add Relationship link |
767 | $this->waitForElementPresent('link=Add Relationship'); | |
768 | $this->click('link=Add Relationship'); | |
6a488035 | 769 | |
ada104d5 AW |
770 | //choose the created relationship type |
771 | $this->waitForElementPresent("relationship_type_id"); | |
772 | $this->select('relationship_type_id', "value=5_b_a"); | |
6a488035 | 773 | |
ada104d5 | 774 | //fill in the individual |
0cff9fd6 | 775 | $this->select2('related_contact_id', $sortName, TRUE, FALSE); |
6a488035 | 776 | |
0cff9fd6 | 777 | $this->waitForElementPresent("_qf_Relationship_upload"); |
ada104d5 AW |
778 | |
779 | //fill in the relationship start date | |
780 | //$this->webtestFillDate('start_date', '-2 year'); | |
781 | //$this->webtestFillDate('end_date', '+1 year'); | |
782 | ||
783 | $description = "Well here is some description !!!!"; | |
784 | $this->type("description", $description); | |
785 | ||
786 | //save the relationship | |
0cff9fd6 | 787 | $this->click("_qf_Relationship_upload"); |
788 | $this->isTextPresent("Current Relationships"); | |
ada104d5 AW |
789 | |
790 | //check the status message | |
0cff9fd6 | 791 | $this->waitForText('crm-notification-container', "Relationship created."); |
ada104d5 | 792 | |
0cff9fd6 | 793 | $this->waitForElementPresent("xpath=//table[@id='crm-contact-relationship-selector-current']/tbody//tr/td[9]/span/a[text()='View']"); |
ada104d5 AW |
794 | $this->waitForElementPresent("xpath=//a[text()='$sortName']"); |
795 | $this->click("xpath=//a[text()='$sortName']"); | |
6a488035 TO |
796 | $this->waitForPageToLoad($this->getTimeoutMsec()); |
797 | ||
ada104d5 AW |
798 | // Check if Membership for the individual is created |
799 | $this->waitForElementPresent("xpath=//li[@id='tab_member']/a/em"); | |
800 | $this->verifyText("xpath=//li[@id='tab_member']/a/em", 1); | |
801 | ||
802 | //create a New Individual to be related to duplicate organization | |
803 | $firstNameOther = substr(sha1(rand()), 0, 7); | |
804 | $this->webtestAddContact($firstNameOther, "Harmison", "$firstNameOther@harmison.name"); | |
805 | $sortNameOther = "Harmison, $firstNameOther"; | |
806 | ||
807 | // go to main organization contact to add membership | |
808 | $this->openCiviPage("contact/view", "reset=1&cid={$contactIds['duplicateId']}"); | |
809 | ||
810 | // add relationship "Employer of" | |
811 | // click through to the relationship view screen | |
812 | $this->click("css=li#tab_rel a"); | |
813 | ||
814 | // wait for add Relationship link | |
815 | $this->waitForElementPresent('link=Add Relationship'); | |
816 | $this->click('link=Add Relationship'); | |
817 | ||
818 | //choose the created relationship type | |
819 | $this->waitForElementPresent("relationship_type_id"); | |
820 | $this->select('relationship_type_id', "value=5_b_a"); | |
821 | ||
822 | //fill in the individual | |
0cff9fd6 | 823 | $this->select2('related_contact_id', $sortNameOther, TRUE, FALSE); |
ada104d5 | 824 | |
0cff9fd6 | 825 | $this->waitForElementPresent("_qf_Relationship_upload"); |
ada104d5 AW |
826 | |
827 | //fill in the relationship start date | |
828 | $this->webtestFillDate('start_date', '-2 year'); | |
829 | $this->webtestFillDate('end_date', '+1 year'); | |
830 | ||
831 | $description = "Well here is some description !!!!"; | |
832 | $this->type("description", $description); | |
833 | ||
834 | //save the relationship | |
835 | //$this->click("_qf_Relationship_upload"); | |
0cff9fd6 | 836 | $this->click("_qf_Relationship_upload"); |
837 | $this->isTextPresent("Current Relationships"); | |
ada104d5 AW |
838 | |
839 | //check the status message | |
0cff9fd6 | 840 | $this->isTextPresent("Relationship created."); |
ada104d5 | 841 | |
0cff9fd6 | 842 | $this->waitForElementPresent("xpath=//table[@id='crm-contact-relationship-selector-current']/tbody//tr/td[9]/span/a[text()='View']"); |
ada104d5 AW |
843 | |
844 | // go directly to contact merge page. | |
845 | $this->openCiviPage("contact/merge", "reset=1&cid={$contactIds['mainId']}&oid={$contactIds['duplicateId']}&action=update&rgid=2"); | |
846 | ||
847 | $this->waitForElementPresent('_qf_Merge_cancel-bottom'); | |
848 | $this->click('_qf_Merge_next-bottom'); | |
6a488035 | 849 | $this->waitForPageToLoad($this->getTimeoutMsec()); |
ada104d5 AW |
850 | |
851 | // click through to the relationship view screen | |
852 | $this->click("css=li#tab_rel a"); | |
853 | ||
854 | // wait for add Relationship link | |
0cff9fd6 | 855 | $this->waitForElementPresent("xpath=//a[text()='$sortName']"); |
ada104d5 AW |
856 | // go to duplicate organization's related contact |
857 | // to check if membership is added to that contact | |
0cff9fd6 | 858 | $this->click("xpath=//a[text()='$sortName']"); |
ada104d5 AW |
859 | $this->waitForPageToLoad($this->getTimeoutMsec()); |
860 | ||
861 | // Check if Membership for the individual is created | |
862 | $this->waitForElementPresent("xpath=//li[@id='tab_member']/a/em"); | |
863 | $this->verifyText("xpath=//li[@id='tab_member']/a/em", 1); | |
6a488035 TO |
864 | } |
865 | } | |
866 |