From f952d4f0184513c5223bf38d81715dc2148eec8f Mon Sep 17 00:00:00 2001 From: Web Access Date: Tue, 3 Nov 2015 18:48:10 +0530 Subject: [PATCH] Webtest fixes- Master --- .../WebTest/Contact/MergeContactsTest.php | 31 ++++++++++--------- .../Contact/TaskActionAddToGroupTest.php | 4 +-- .../Mailing/AddMessageTemplateTest.php | 5 ++- .../WebTest/Report/LoggingReportTest.php | 3 +- 4 files changed, 21 insertions(+), 22 deletions(-) diff --git a/tests/phpunit/WebTest/Contact/MergeContactsTest.php b/tests/phpunit/WebTest/Contact/MergeContactsTest.php index aa0111438b..d5f4ee6be6 100644 --- a/tests/phpunit/WebTest/Contact/MergeContactsTest.php +++ b/tests/phpunit/WebTest/Contact/MergeContactsTest.php @@ -136,10 +136,10 @@ class WebTest_Contact_MergeContactsTest extends CiviSeleniumTestCase { $this->openCiviPage("contact/dedupefind", "reset=1&rgid=1&action=update"); // Select the contacts to be merged - $this->select("name=option51_length", "value=100"); - - $this->waitForElementPresent("xpath=//a[text()='$firstName $lastName']/../../td[4]/a[text()='merge']"); - $this->clickLink("xpath=//a[text()='$firstName $lastName']/../../td[4]/a[text()='merge']"); + $this->waitForElementPresent('dupePairs_length'); + $this->select("name=dupePairs_length", "value=100"); + $this->waitForElementPresent("xpath=//table[@id='dupePairs']/tbody//tr/td[5]/a[text()='$firstName $lastName']/../../td[8]/a[text()='merge']"); + $this->click("xpath=//table[@id='dupePairs']/tbody//tr/td[5]/a[text()='$firstName $lastName']/../../td[8]/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'); @@ -181,10 +181,8 @@ class WebTest_Contact_MergeContactsTest extends CiviSeleniumTestCase { // Verify activity merged $this->click("css=li#tab_activity 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->waitForElementPresent("xpath=//table[@class='dataTable no-footer']/tbody/tr"); + $this->verifyText("xpath=//table[@class='dataTable no-footer']/tbody/tr/td[5]/a", preg_quote("$lastName, $firstName")); // Verify group merged $this->click("css=li#tab_group a"); @@ -241,10 +239,10 @@ class WebTest_Contact_MergeContactsTest extends CiviSeleniumTestCase { $this->waitForElementPresent('_qf_DedupeFind_submit-bottom'); $this->click("_qf_DedupeFind_next-bottom"); - $this->waitForElementPresent("xpath=//form[@id='DedupeFind']/div[2]/div/table/tbody/tr[1]/td[4]/a[text()='merge']"); - $this->waitForElementPresent("xpath=//form[@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("xpath=//table[@id='dupePairs']/tbody//tr/td[5]/a[text()='$firstName $lastName']/../../td[8]/a[text()='merge']"); + $this->waitForElementPresent("xpath=//form[@id='DedupeFind']//a/span[contains(text(),'Done')]"); + $this->isElementPresent("xpath=//table[@id='dupePairs']/tbody//tr//td/a[text()='$firstName $lastName']/../../td[5]/a[text()='{$fName} {$lName}']/../../td[8]/a[text()='merge']"); + $this->click("xpath=//table[@id='dupePairs']/tbody//tr//td/a[text()='{$firstName} {$lastName}']/../../td[8]/a[text()='merge']"); $this->waitForElementPresent('_qf_Merge_cancel-bottom'); $this->click('toggleSelect'); $this->click('_qf_Merge_next-bottom'); @@ -382,7 +380,8 @@ class WebTest_Contact_MergeContactsTest extends CiviSeleniumTestCase { $this->openCiviPage("contact/dedupefind", "reset=1&rgid=1&action=renew"); // Select the contacts to be merged - $this->select("name=option51_length", "value=100"); + $this->waitForElementPresent('dupePairs_length'); + $this->select("name=dupePairs_length", "value=100"); $this->waitForElementPresent("xpath=//a[text()='$firstName $lastName']"); $this->click("xpath=//a[text()='$firstName $lastName']/../../td[4]/a[text()='merge']"); $this->waitForElementPresent('_qf_Merge_cancel-bottom'); @@ -471,7 +470,8 @@ class WebTest_Contact_MergeContactsTest extends CiviSeleniumTestCase { $this->openCiviPage("contact/dedupefind", "reset=1&rgid=1&action=renew"); // Select the contacts to be merged - $this->select("name=option51_length", "value=100"); + $this->waitForElementPresent('dupePairs_length'); + $this->select("name=dupePairs_length", "value=100"); $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'); @@ -593,7 +593,8 @@ class WebTest_Contact_MergeContactsTest extends CiviSeleniumTestCase { // Find and Merge Contacts with Supervised Rule $this->openCiviPage("contact/dedupefind", "reset=1&rgid=1&action=renew", "css=#DedupeFind table.pagerDisplay tbody tr"); - $this->select("name=option51_length", "value=100"); + $this->waitForElementPresent('dupePairs_length'); + $this->select("name=dupePairs_length", "value=100"); $totalContacts = $this->getXpathCount("//table[@class='pagerDisplay']/tbody/tr"); $this->click("//form[@id='DedupeFind']//a/span[contains(text(),'Batch Merge Duplicates')]"); diff --git a/tests/phpunit/WebTest/Contact/TaskActionAddToGroupTest.php b/tests/phpunit/WebTest/Contact/TaskActionAddToGroupTest.php index f2f58a6215..39a1d38649 100644 --- a/tests/phpunit/WebTest/Contact/TaskActionAddToGroupTest.php +++ b/tests/phpunit/WebTest/Contact/TaskActionAddToGroupTest.php @@ -52,8 +52,8 @@ class WebTest_Contact_TaskActionAddToGroupTest extends CiviSeleniumTestCase { $cids[] = $this->urlArg('cid'); // update email of new contact - $this->waitForElementPresent("//ul[@id='actions']/li/a/span[text()='Edit']"); - $this->click("//ul[@id='actions']/li/a/span[text()='Edit']"); + $this->waitForElementPresent("xpath=//div[@class='crm-actions-ribbon']/ul[@id='actions']//li/a/span[text()=' Edit']"); + $this->click("xpath=//div[@class='crm-actions-ribbon']/ul[@id='actions']//li/a/span[text()=' Edit']"); $this->waitForPageToLoad($this->getTimeoutMsec()); $this->type("email_1_email", $emailString . $i . 'webtest'); $this->click("_qf_Contact_upload_view"); diff --git a/tests/phpunit/WebTest/Mailing/AddMessageTemplateTest.php b/tests/phpunit/WebTest/Mailing/AddMessageTemplateTest.php index 7672af4155..2ec18bbf0e 100644 --- a/tests/phpunit/WebTest/Mailing/AddMessageTemplateTest.php +++ b/tests/phpunit/WebTest/Mailing/AddMessageTemplateTest.php @@ -133,12 +133,12 @@ class WebTest_Mailing_AddMessageTemplateTest extends CiviSeleniumTestCase { $this->click('subject'); // check for default settings options - $this->click("xpath=//ul/li/a[text()='Tracking']"); + $this->click('link=Tracking'); $this->assertChecked("url_tracking"); $this->assertChecked("open_tracking"); // check for default header and footer ( with label ) - $this->click("xpath=//ul/li/a[text()='Header and Footer']"); + $this->click('link=Header and Footer'); $this->select('header_id', "label=Mailing Header"); $this->select('footer_id', "label=Mailing Footer"); @@ -154,7 +154,6 @@ class WebTest_Mailing_AddMessageTemplateTest extends CiviSeleniumTestCase { // finally schedule the mail by clicking submit $this->click("xpath=//center/a/div[text()='Submit Mailing']"); - $this->waitForPageToLoad($this->getTimeoutMsec()); //check redirected page to Scheduled and Sent Mailings and verify for mailing name $this->waitForTextPresent("Find Mailings"); diff --git a/tests/phpunit/WebTest/Report/LoggingReportTest.php b/tests/phpunit/WebTest/Report/LoggingReportTest.php index 4754ede2a3..ebf8276157 100644 --- a/tests/phpunit/WebTest/Report/LoggingReportTest.php +++ b/tests/phpunit/WebTest/Report/LoggingReportTest.php @@ -78,7 +78,7 @@ class WebTest_Report_LoggingReportTest extends CiviSeleniumTestCase { // Because it tends to cause problems, all uses of sleep() must be justified in comments // Sleep should never be used for wait for anything to load from the server // Justification for this instance: FIXME - sleep(3); + $this->waitForElementPresent("tagtree"); $this->click("xpath=//div[@id='tagtree']/ul//li/span/label[text()='Company']"); $this->waitForTextPresent("Saved"); $this->click("xpath=//div[@id='tagtree']/ul//li/span/label[text()='Government Entity']"); @@ -92,7 +92,6 @@ class WebTest_Report_LoggingReportTest extends CiviSeleniumTestCase { // Because it tends to cause problems, all uses of sleep() must be justified in comments // Sleep should never be used for wait for anything to load from the server // Justification for this instance: FIXME - sleep(3); $this->click("xpath=//div[@class='view-content']//div[@class='action-link']/a"); $this->waitForElementPresent("_qf_Note_upload-top"); -- 2.25.1