$tag = 'Government Entity';
$this->click("css=li#tab_tag a");
$this->waitForElementPresent('tagtree');
- $this->click("xpath=//div[@id='tagtree']/ul//li/input/../label[text()='$tag']");
+ $this->click("xpath=//div[@id='tagtree']/ul//li/input/../span/label[text()='$tag']");
$this->click("css=#tab_summary a");
$this->assertElementContainsText('css=.crm-summary-block #tags', $tag);
$this->select("name=option51_length", "value=100");
$this->waitForElementPresent("xpath=//a[text()='$firstName $lastName']/../../td[4]/a[text()='merge']");
- $this->click("xpath=//a[text()='$firstName $lastName']/../../td[4]/a[text()='merge']");
+ $this->clickLink("xpath=//a[text()='$firstName $lastName']/../../td[4]/a[text()='merge']");
$this->waitForElementPresent('_qf_Merge_cancel-bottom');
$this->clickLink("css=div.crm-contact-merge-form-block div.action-link a", '_qf_Merge_cancel-bottom');
// Ensure that the duplicate contact has been deleted
$this->openCiviPage("contact/search/advanced", "reset=1", '_qf_Advanced_refresh');
$this->type('sort_name', $firstName);
- $this->check('deleted_contacts');
+ $this->click('deleted_contacts');
$this->click('_qf_Advanced_refresh');
$this->waitForPageToLoad($this->getTimeoutMsec());
$this->assertTrue($this->isTextPresent('1 Contact'), "Deletion of duplicate contact during merge was not successful. Dupe contact not found when searching trash.");
// Verify activity merged
$this->click("css=li#tab_activity a");
- $this->waitForElementPresent("xpath=//table[@id='contact-activity-selector-activity']/tbody/tr");
- $this->verifyText("xpath=//table[@id='contact-activity-selector-activity']/tbody/tr/td[5]/a",
+ $this->waitForElementPresent("xpath=//table[@class='contact-activity-selector-activity dataTable no-footer']/tbody/tr");
+ $this->verifyText("xpath=//table[@class='contact-activity-selector-activity dataTable no-footer']/tbody/tr/td[5]/a",
preg_quote("$lastName, $firstName")
);
$this->assertChecked("check_3");
}
+ function testMergeContactSubType() {
+ $this->webtestLogin();
+ $this->openCiviPage("contact/add", "reset=1&ct=Individual");
+ $this->waitForElementPresent('_qf_Contact_cancel-bottom');
+ //fill in first name
+ $firstName = "Anderson".substr(sha1(rand()), 0, 4);
+ $this->type('first_name', $firstName);
+
+ //fill in last name
+ $lastName = substr(sha1(rand()), 0, 4);
+ $this->type('last_name', $lastName);
+
+ //fill in email id
+ $this->waitForElementPresent('email_1_email');
+ $this->type('email_1_email', "{$firstName}.{$lastName}@example.com");
+ $this->waitForElementPresent('contact_sub_type');
+ $this->select('contact_sub_type', "Parent");
+
+ // Clicking save.
+ $this->click("_qf_Contact_upload_view");
+ $this->waitForPageToLoad($this->getTimeoutMsec());
+ $this->waitForText('crm-notification-container', "Contact Saved");
+
+ // contact2: contact with same email id as contact 1.
+ $this->openCiviPage("contact/add", "reset=1&ct=Individual");
+ $this->waitForElementPresent('_qf_Contact_cancel-bottom');
+
+ $fName = "John".substr(sha1(rand()), 0, 4);
+ $this->type('first_name', $fName);
+ $lName = substr(sha1(rand()), 0, 4);
+ $this->type('last_name', $lName);
+ $this->type('email_1_email', "{$firstName}.{$lastName}@example.com");
+ $this->waitForElementPresent('contact_sub_type');
+ $this->multiselect2('contact_sub_type', array("Student", "Staff"));
+ $this->click("_qf_Contact_upload_view");
+ $this->waitForText('crm-notification-container', "Contact Saved");
+ $this->openCiviPage("contact/deduperules", "reset=1");
+ $this->click("xpath=//*[@id='option12']/tbody/tr[3]/td[3]/span/a[1][contains(text(),'Use Rule')]");
+ $this->waitForElementPresent('_qf_DedupeFind_submit-bottom');
+ $this->click("_qf_DedupeFind_next-bottom");
+
+ $this->waitForElementPresent("xpath=//table[@id='option51']/tbody/tr[1]/td[4]/a[text()='merge']");
+ $this->waitForElementPresent("xpath=//*[@id='DedupeFind']/a[3]/span[contains(text(),'Done')]");
+ $this->isElementPresent("xpath=//table[@id='option51']/tbody/tr/td[1]/a[text()='{$firstName} {$lastName}']/../td[2]/a[text()='{$fName} {$lName}']");
+ $this->click("xpath=//table[@id='option51']/tbody/tr[1]/td[4]/a[text()='merge']");
+ $this->waitForElementPresent('_qf_Merge_cancel-bottom');
+ $this->click('toggleSelect');
+ $this->click('_qf_Merge_next-bottom');
+ $this->waitForPageToLoad($this->getTimeoutMsec());
+ $this->assertTrue($this->isTextPresent("Staff, Student"));
+ }
/**
* @param $firstName
* @param $lastName
$this->assertTrue($this->isTextPresent('Contacts Merged'));
$this->assertTrue($this->isElementPresent("xpath=//div[@id='email-block']/div/div/div[2]/div[1][contains(text(), 'Home')]"));
- $this->assertTrue($this->isElementPresent("xpath=//div[@id='email-block']/div/div/div[2]/div[2]/a[text() = '{$firstName}.{$lastName}@example.com']"));
+ $this->assertTrue($this->isElementPresent("xpath=//div[@id='email-block']/div/div/div[2]/div[2]/a[contains(text(), '{$firstName}.{$lastName}@example.com')]"));
$this->assertTrue($this->isElementPresent("xpath=//div[@id='email-block']/div/div/div[3]/div[1][contains(text(), 'Home')]"));
- $this->assertTrue($this->isElementPresent("xpath=//div[@id='email-block']/div/div/div[3]/div[2]/a[text() ='{$firstName}.{$lastName}@example.com']"));
+ $this->assertTrue($this->isElementPresent("xpath=//div[@id='email-block']/div/div/div[3]/div[2]/a[contains(text(), '{$firstName}.{$lastName}@example.com')]"));
$this->assertTrue($this->isElementPresent("xpath=//div[@id='email-block']/div/div/div[4]/div[1][contains(text(), 'Billing')]"));
- $this->assertTrue($this->isElementPresent("xpath=//div[@id='email-block']/div/div/div[4]/div[2]/a[text() ='$firstName.$lastName@billing.com']"));
+ $this->assertTrue($this->isElementPresent("xpath=//div[@id='email-block']/div/div/div[4]/div[2]/a[contains(text(), '$firstName.$lastName@billing.com')]"));
$this->assertTrue($this->isElementPresent("xpath=//div[@id='phone-block']/div/div/div[2]/div[1][contains(text(), 'Home')]"));
$this->assertTrue($this->isElementPresent("xpath=//div[@id='phone-block']/div/div/div[2]/div[2][contains(text(), '9876543211')]"));
$this->assertTrue($this->isElementPresent("xpath=//div[@id='phone-block']/div/div/div[3]/div[1][contains(text(), 'Home')]"));
// Select the contacts to be merged
$this->select("name=option51_length", "value=100");
- $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']");
- $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']");
+ $this->waitForElementPresent("xpath=//table[@class='pagerDisplay dataTable no-footer']/tbody//tr/td[1]/a[text()='$firstName1 $lastName1']/../../td[2]/a[text()='$firstName1 $lastName1']");
+ $this->click("xpath=//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']");
$this->waitForElementPresent('_qf_Merge_cancel-bottom');
$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)']");
$this->waitForElementPresent("xpath=//form[@id='Merge']/div[2]/table/tbody/tr[3]/td[4]/span[text()='(add)']");
$this->assertTrue($this->isTextPresent('Contacts Merged'));
$this->assertTrue($this->isElementPresent("xpath=//div[@id='email-block']/div/div/div[2]/div[1][contains(text(), 'Home')]"));
- $this->assertTrue($this->isElementPresent("xpath=//div[@id='email-block']/div/div/div[2]/div[2]/a[text() ='{$firstName1}.{$lastName1}@example.com']"));
+ $this->assertTrue($this->isElementPresent("xpath=//div[@id='email-block']/div/div/div[2]/div[2]/a[contains(text(), '{$firstName1}.{$lastName1}@example.com')]"));
$this->assertTrue($this->isElementPresent("xpath=//div[@id='email-block']/div/div/div[3]/div[1][contains(text(), 'Main')]"));
- $this->assertTrue($this->isElementPresent("xpath=//div[@id='email-block']/div/div/div[3]/div[2]/a[text() ='{$firstName1}.{$lastName1}@example.com']"));
+ $this->assertTrue($this->isElementPresent("xpath=//div[@id='email-block']/div/div/div[3]/div[2]/a[contains(text(), '{$firstName1}.{$lastName1}@example.com')]"));
$this->assertTrue($this->isElementPresent("xpath=//div[@id='phone-block']/div/div/div[2]/div[1][contains(text(), 'Billing')]"));
$this->assertTrue($this->isElementPresent("xpath=//div[@id='phone-block']/div/div/div[2]/div[2][contains(text(), '9876543120')]"));
$this->assertTrue($this->isElementPresent("xpath=//div[@id='phone-block']/div/div/div[3]/div[1][contains(text(), 'Home')]"));
//check the status message
$this->waitForText('crm-notification-container', "Relationship created.");
- $this->waitForElementPresent("xpath=//table[@id='crm-contact-relationship-selector-current']/tbody//tr/td[9]/span/a[text()='View']");
+ $this->waitForElementPresent("xpath=//table[@class='crm-contact-relationship-selector-current dataTable no-footer']/tbody//tr/td[9]/span/a[text()='View']");
$this->waitForElementPresent("xpath=//a[text()='$sortName']");
$this->click("xpath=//a[text()='$sortName']");
$this->waitForPageToLoad($this->getTimeoutMsec());
//check the status message
$this->isTextPresent("Relationship created.");
- $this->waitForElementPresent("xpath=//table[@id='crm-contact-relationship-selector-current']/tbody//tr/td[9]/span/a[text()='View']");
+ $this->waitForElementPresent("xpath=//table[@class='crm-contact-relationship-selector-current dataTable no-footer']/tbody//tr/td[9]/span/a[text()='View']");
// go directly to contact merge page.
$this->openCiviPage("contact/merge", "reset=1&cid={$contactIds['mainId']}&oid={$contactIds['duplicateId']}&action=update&rgid=2");