From 4ea7e2aa43b59fbce3efdc60df2109ad497331d2 Mon Sep 17 00:00:00 2001 From: Web Access Date: Wed, 27 Apr 2016 18:50:55 +0530 Subject: [PATCH] Webtests fixes - CRM:18454 --- tests/phpunit/CiviTest/CiviSeleniumTestCase.php | 2 +- .../WebTest/Contact/AdvancedSearchedRelatedContactTest.php | 6 ++++-- tests/phpunit/WebTest/Contact/SearchBuilderTest.php | 3 ++- tests/phpunit/WebTest/Contact/TaskActionAddToGroupTest.php | 3 +++ .../Contribute/OnlineMultiplePaymentProcessorTest.php | 6 ++++-- 5 files changed, 14 insertions(+), 6 deletions(-) diff --git a/tests/phpunit/CiviTest/CiviSeleniumTestCase.php b/tests/phpunit/CiviTest/CiviSeleniumTestCase.php index e2da3a3c16..4024dc65f3 100644 --- a/tests/phpunit/CiviTest/CiviSeleniumTestCase.php +++ b/tests/phpunit/CiviTest/CiviSeleniumTestCase.php @@ -1548,7 +1548,7 @@ class CiviSeleniumTestCase extends PHPUnit_Extensions_SeleniumTestCase { $this->type('duration_interval', $duration_interval); $this->select('duration_unit', "label={$duration_unit}"); - + $this->waitForElementPresent('period_type'); $this->select('period_type', "value={$period_type}"); $this->click('_qf_MembershipType_upload-bottom'); diff --git a/tests/phpunit/WebTest/Contact/AdvancedSearchedRelatedContactTest.php b/tests/phpunit/WebTest/Contact/AdvancedSearchedRelatedContactTest.php index 0321ac540f..65674caee4 100644 --- a/tests/phpunit/WebTest/Contact/AdvancedSearchedRelatedContactTest.php +++ b/tests/phpunit/WebTest/Contact/AdvancedSearchedRelatedContactTest.php @@ -153,6 +153,7 @@ class WebTest_Contact_AdvancedSearchedRelatedContactTest extends CiviSeleniumTes $this->waitForElementPresent("_qf_EventInfo_upload-bottom"); $this->select("event_type_id", "value=1"); + $this->waitForAjaxContent(); // Attendee role s/b selected now. $this->select("default_role_id", "value=1"); @@ -188,6 +189,7 @@ class WebTest_Contact_AdvancedSearchedRelatedContactTest extends CiviSeleniumTes $this->type("address_1_city", "San Francisco"); $this->type("address_1_postal_code", "94117"); $this->select('address_1_country_id', 'UNITED STATES'); + $this->waitForAjaxContent(); $this->select("address_1_state_province_id", "value=1004"); $this->type("email_1_email", "info@civicrm.org"); @@ -246,7 +248,7 @@ class WebTest_Contact_AdvancedSearchedRelatedContactTest extends CiviSeleniumTes $this->clickLink("_qf_Basic_refresh", "//div[@class='crm-search-results']/table[@class='selector row-highlight']/tbody/tr/", FALSE); // click through to the Contribution view screen - $this->click("xpath=//div[@class='crm-search-results']/table[@class='selector row-highlight']/tbody/tr/td[11]//span/a[text()='View']"); + $this->click("xpath=//table[@class='selector row-highlight']/tbody/tr/td[11]//span/a[text()='View']"); $this->waitForPageToLoad($this->getTimeoutMsec()); $this->click("css=li#tab_rel a"); @@ -304,7 +306,7 @@ class WebTest_Contact_AdvancedSearchedRelatedContactTest extends CiviSeleniumTes $this->select2("event_type_id", "Conference"); $this->click("_qf_Advanced_refresh"); $this->waitForElementPresent("xpath=//div[@class='crm-content-block']//div[@id='search-status']"); - $this->assertElementContainsText("xpath=//div[@class='crm-content-block']//div[@id='search-status']/table/tbody/tr[1]/td[1]", "2 Contacts"); + $this->assertElementContainsText("xpath=//div[@id='search-status']/table/tbody/tr[1]/td[1]", "2 Contacts"); } public function testAdvanceSearchForLog() { diff --git a/tests/phpunit/WebTest/Contact/SearchBuilderTest.php b/tests/phpunit/WebTest/Contact/SearchBuilderTest.php index c2723e417c..50ea4b529e 100644 --- a/tests/phpunit/WebTest/Contact/SearchBuilderTest.php +++ b/tests/phpunit/WebTest/Contact/SearchBuilderTest.php @@ -463,6 +463,7 @@ class WebTest_Contact_SearchBuilderTest extends CiviSeleniumTestCase { $this->select("membership_type_id[0]", "label={$membershipTypes['member_of_contact']}"); // select membership type + $this->waitForElementPresent("membership_type_id[1]"); $this->select("membership_type_id[1]", "label={$membershipTypes['membership_type']}"); // fill in Source @@ -532,7 +533,7 @@ class WebTest_Contact_SearchBuilderTest extends CiviSeleniumTestCase { $this->openCiviPage("member/search", "reset=1", "_qf_Search_refresh"); $this->select2('membership_type_id', $membershipTypes['membership_type'], TRUE); $this->clickLink('_qf_Search_refresh'); - $this->assertElementContainsText("xpath=//div[@class='crm-content-block']//div[@id='search-status']/table/tbody/tr[1]/td[1]", "2 Result"); + $this->assertElementContainsText("xpath=//div[@id='search-status']/table/tbody/tr[1]/td[1]", "2 Result"); $this->click("xpath=//div[@class='crm-accordion-header crm-master-accordion-header']"); $this->multiselect2("membership_status_id", array("New", "Grace")); diff --git a/tests/phpunit/WebTest/Contact/TaskActionAddToGroupTest.php b/tests/phpunit/WebTest/Contact/TaskActionAddToGroupTest.php index 25506f605a..97f227fc38 100644 --- a/tests/phpunit/WebTest/Contact/TaskActionAddToGroupTest.php +++ b/tests/phpunit/WebTest/Contact/TaskActionAddToGroupTest.php @@ -70,8 +70,11 @@ class WebTest_Contact_TaskActionAddToGroupTest extends CiviSeleniumTestCase { $this->assertTrue($this->isTextPresent("2 Contacts"), 'Looking for 2 results with email like ' . $emailString); // Click "check all" box and act on "Add to group" action + $this->waitForAjaxContent(); $this->click('toggleSelect'); + $this->waitForAjaxContent(); $this->waitForText("xpath=//input[@value='ts_sel']/following-sibling::label/span", '2'); + $this->waitForAjaxContent(); $this->select("task", "label=Group - add contacts"); $this->waitForPageToLoad($this->getTimeoutMsec()); diff --git a/tests/phpunit/WebTest/Contribute/OnlineMultiplePaymentProcessorTest.php b/tests/phpunit/WebTest/Contribute/OnlineMultiplePaymentProcessorTest.php index 7ba6e8b0ce..adeca9dbcf 100644 --- a/tests/phpunit/WebTest/Contribute/OnlineMultiplePaymentProcessorTest.php +++ b/tests/phpunit/WebTest/Contribute/OnlineMultiplePaymentProcessorTest.php @@ -77,13 +77,14 @@ class WebTest_Contribute_OnlineMultiplePaymentProcessorTest extends CiviSelenium $this->type("first_name", $firstName); $this->type("last_name", $lastName); - $this->type("xpath=//div[@class='crm-section other_amount-section']//div[2]/input", 100); + $this->type("xpath=//div[@class='crm-section other_amount-section']//div/input", 100); $streetAddress = "100 Main Street"; $this->type("street_address-1", $streetAddress); $this->type("city-1", "San Francisco"); $this->type("postal_code-1", "94117"); $this->select("country-1", "value=1228"); + $this->waitForElementPresent("state_province-1"); $this->select("state_province-1", "value=1001"); $this->assertTrue($this->isTextPresent("Payment Method")); @@ -160,13 +161,14 @@ class WebTest_Contribute_OnlineMultiplePaymentProcessorTest extends CiviSelenium $this->type("first_name", $firstName); $this->type("last_name", $lastName); - $this->type("xpath=//div[@class='crm-section other_amount-section']//div[2]/input", 100); + $this->type("xpath=//div[@class='crm-section other_amount-section']//div/input", 100); $streetAddress = "100 Main Street"; $this->type("street_address-1", $streetAddress); $this->type("city-1", "San Francisco"); $this->type("postal_code-1", "94117"); $this->select("country-1", "value=1228"); + $this->waitForElementPresent("state_province-1"); $this->select("state_province-1", "value=1001"); $this->assertTrue($this->isTextPresent("Payment Method")); -- 2.25.1