From 77660ee213c01f0d0d456c35cadf5baa20853f8f Mon Sep 17 00:00:00 2001 From: Web Access Date: Thu, 7 Jan 2016 18:41:58 +0530 Subject: [PATCH] Webtests Fixes for 4.6 --- tests/phpunit/WebTest/ACL/AssignUsersToRolesTest.php | 2 ++ .../WebTest/Contact/AdvancedSearchedRelatedContactTest.php | 4 ++-- tests/phpunit/WebTest/Contribute/StandaloneAddTest.php | 1 + .../phpunit/WebTest/Contribute/UpdateContributionTest.php | 4 ++-- .../WebTest/Contribute/UpdatePendingContributionTest.php | 7 ++++--- tests/phpunit/WebTest/Mailing/MailingTest.php | 2 +- tests/phpunit/WebTest/Member/EditMembershipTest.php | 1 + .../phpunit/WebTest/Member/OnlineMembershipCreateTest.php | 3 ++- 8 files changed, 15 insertions(+), 9 deletions(-) diff --git a/tests/phpunit/WebTest/ACL/AssignUsersToRolesTest.php b/tests/phpunit/WebTest/ACL/AssignUsersToRolesTest.php index f24349b1fe..13d7f955ac 100755 --- a/tests/phpunit/WebTest/ACL/AssignUsersToRolesTest.php +++ b/tests/phpunit/WebTest/ACL/AssignUsersToRolesTest.php @@ -95,6 +95,7 @@ class WebTest_ACL_AssignUsersToRolesTest extends CiviSeleniumTestCase { $this->open($this->sboxPath . "admin/people/create"); $this->waitForElementPresent("edit-submit"); $user = "TestUser" . substr(sha1(rand()), 0, 4); + $this->waitForElementPresent("edit-name"); $this->type("edit-name", $user); $emailId = substr(sha1(rand()), 0, 7) . '@web.com'; $this->type("edit-mail", $emailId); @@ -244,6 +245,7 @@ class WebTest_ACL_AssignUsersToRolesTest extends CiviSeleniumTestCase { $this->open($this->sboxPath . "admin/people/create"); $this->waitForElementPresent("edit-submit"); $name = "TestUser" . substr(sha1(rand()), 0, 4); + $this->waitForElementPresent("edit-name"); $this->type("edit-name", $name); $emailId = substr(sha1(rand()), 0, 7) . '@web.com'; $this->type("edit-mail", $emailId); diff --git a/tests/phpunit/WebTest/Contact/AdvancedSearchedRelatedContactTest.php b/tests/phpunit/WebTest/Contact/AdvancedSearchedRelatedContactTest.php index 011e388453..bfdb836c36 100644 --- a/tests/phpunit/WebTest/Contact/AdvancedSearchedRelatedContactTest.php +++ b/tests/phpunit/WebTest/Contact/AdvancedSearchedRelatedContactTest.php @@ -301,8 +301,8 @@ class WebTest_Contact_AdvancedSearchedRelatedContactTest extends CiviSeleniumTes $this->waitForElementPresent("event_type_id"); $this->select2("event_type_id", "Conference"); $this->click("_qf_Advanced_refresh"); - $this->waitForElementPresent("xpath=id('search-status')"); - $this->assertElementContainsText('search-status', '2 Contacts'); + $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"); } public function testAdvanceSearchForLog() { diff --git a/tests/phpunit/WebTest/Contribute/StandaloneAddTest.php b/tests/phpunit/WebTest/Contribute/StandaloneAddTest.php index 27bdcf162d..8fa2c2688c 100644 --- a/tests/phpunit/WebTest/Contribute/StandaloneAddTest.php +++ b/tests/phpunit/WebTest/Contribute/StandaloneAddTest.php @@ -82,6 +82,7 @@ class WebTest_Contribute_StandaloneAddTest extends CiviSeleniumTestCase { $this->click("xpath=//div[@class='ui-dialog-buttonset']/button/span[text()=' Assign Account']"); $this->waitForElementPresent("xpath=//div[@class='ui-dialog-buttonset']/button/span[text()='Save']"); $this->select('account_relationship', "label=Sales Tax Account is"); + $this->waitForAjaxContent(); $this->select('financial_account_id', "label=" . $financialAccountTitle); $this->click("xpath=//div[@class='ui-dialog-buttonset']/button/span[text()='Save']"); $this->waitForElementPresent("xpath=//div[@class='ui-dialog-buttonset']/button/span[text()=' Assign Account']"); diff --git a/tests/phpunit/WebTest/Contribute/UpdateContributionTest.php b/tests/phpunit/WebTest/Contribute/UpdateContributionTest.php index 78fc7d0b79..ca1654e910 100755 --- a/tests/phpunit/WebTest/Contribute/UpdateContributionTest.php +++ b/tests/phpunit/WebTest/Contribute/UpdateContributionTest.php @@ -323,9 +323,9 @@ class WebTest_Contribute_UpdateContributionTest extends CiviSeleniumTestCase { $defaults = array(); $items = CRM_Financial_BAO_FinancialItem::retrieve($itemParams, $defaults); $this->assertEquals($items->amount, $itemParams['amount'], 'Verify Amount for financial Item'); - $totalAmount = $this->_getPremiumActualCost($items->id, 'Accounts Receivable', NULL, "-100.00", "'civicrm_financial_item'"); + $totalAmount = $this->_getPremiumActualCost($items->id, NULL, 'Accounts Receivable', "-100.00", "'civicrm_financial_item'"); $this->assertEquals($totalAmount, "-$amount", 'Verify Amount for Financial Trxn'); - $totalAmount = $this->_getPremiumActualCost($contId, 'Accounts Receivable', NULL, "-100.00", "'civicrm_contribution'"); + $totalAmount = $this->_getPremiumActualCost($contId, NULL, 'Accounts Receivable', "-100.00", "'civicrm_contribution'"); $this->assertEquals($totalAmount, "-$amount", 'Verify Amount for Financial Trxn'); } diff --git a/tests/phpunit/WebTest/Contribute/UpdatePendingContributionTest.php b/tests/phpunit/WebTest/Contribute/UpdatePendingContributionTest.php index bccb1ea3cd..af67ed00a0 100644 --- a/tests/phpunit/WebTest/Contribute/UpdatePendingContributionTest.php +++ b/tests/phpunit/WebTest/Contribute/UpdatePendingContributionTest.php @@ -237,7 +237,8 @@ class WebTest_Contribute_UpdatePendingContributionTest extends CiviSeleniumTestC $this->click("xpath=//div[@class='crm-section other_amount-section']//div[2]/input"); $this->type("xpath=//div[@class='crm-section other_amount-section']//div[2]/input", 100); - $this->click("xpath=//div[@class='crm-section payment_processor-section']/div[2]//label[text()='Pay later label {$hash}']"); + $this->waitForAjaxContent(); + $this->click("xpath=//label[text()='Pay later label {$hash}']"); $streetAddress = "100 Main Street"; $this->type("street_address-1", $streetAddress); $this->type("city-1", "San Francisco"); @@ -257,8 +258,8 @@ class WebTest_Contribute_UpdatePendingContributionTest extends CiviSeleniumTestC $this->openCiviPage("contribute/search", "reset=1", "contribution_date_low"); $this->type("sort_name", $contact['sort_name']); - $this->clickLink("_qf_Search_refresh", "xpath=//div[@id='contributionSearch']//table//tbody/tr[2]/td[11]/span/a[text()='View']"); - $this->clickLink("xpath=//div[@id='contributionSearch']//table//tbody/tr[2]/td[11]/span/a[text()='View']", "_qf_ContributionView_cancel-bottom", FALSE); + $this->clickLink("_qf_Search_refresh", "xpath=//table[@class='selector row-highlight']/tbody/tr[2]/td[11]/span/a[text()='View']"); + $this->clickLink("xpath=//table[@class='selector row-highlight']/tbody/tr[2]/td[11]/span/a[text()='View']", "_qf_ContributionView_cancel-bottom", FALSE); // View Contribution Record and test for expected values $expected = array( 'From' => $contact['display_name'], diff --git a/tests/phpunit/WebTest/Mailing/MailingTest.php b/tests/phpunit/WebTest/Mailing/MailingTest.php index 6df6957c28..787bf1e0e7 100644 --- a/tests/phpunit/WebTest/Mailing/MailingTest.php +++ b/tests/phpunit/WebTest/Mailing/MailingTest.php @@ -402,7 +402,7 @@ class WebTest_Mailing_MailingTest extends CiviSeleniumTestCase { //check redirected page to Scheduled and Sent Mailings and verify for mailing name $this->waitForTextPresent("Find Mailings"); - $this->assertElementContainsText("xpath=//table[@class='selector row-highlight']/tbody//tr//td", "Mailing $mailingName Webtest"); + $this->assertElementContainsText("xpath=//form[@class='CRM_Mailing_Form_Search']/table[@class='selector row-highlight']/tbody//tr//td", "Mailing $mailingName Webtest"); // directly send schedule mailing -- not working right now $this->openCiviPage("mailing/queue", "reset=1"); diff --git a/tests/phpunit/WebTest/Member/EditMembershipTest.php b/tests/phpunit/WebTest/Member/EditMembershipTest.php index efc824d235..be7a32b32b 100644 --- a/tests/phpunit/WebTest/Member/EditMembershipTest.php +++ b/tests/phpunit/WebTest/Member/EditMembershipTest.php @@ -82,6 +82,7 @@ class WebTest_Member_EditMembershipTest extends CiviSeleniumTestCase { $this->click("xpath=//div[@class='ui-dialog-buttonset']/button/span[text()=' Assign Account']"); $this->waitForElementPresent("xpath=//div[@class='ui-dialog-buttonset']/button/span[text()='Save']"); $this->select('account_relationship', "label=Sales Tax Account is"); + $this->waitForAjaxContent(); $this->select('financial_account_id', "label=" . $financialAccountTitle); $this->click("xpath=//div[@class='ui-dialog-buttonset']/button/span[text()='Save']"); $this->waitForElementPresent("xpath=//div[@class='ui-dialog-buttonset']/button/span[text()=' Assign Account']"); diff --git a/tests/phpunit/WebTest/Member/OnlineMembershipCreateTest.php b/tests/phpunit/WebTest/Member/OnlineMembershipCreateTest.php index eda26ef030..667d437e16 100644 --- a/tests/phpunit/WebTest/Member/OnlineMembershipCreateTest.php +++ b/tests/phpunit/WebTest/Member/OnlineMembershipCreateTest.php @@ -227,7 +227,8 @@ class WebTest_Member_OnlineMembershipCreateTest extends CiviSeleniumTestCase { $this->type("xpath=//div[@class='content other_amount-content']/input", $otherAmount); } if ($payLater) { - $this->click("xpath=//div[@class='crm-section payment_processor-section']/div[2]//label[text()='Pay later label {$hash}']"); + $this->waitForAjaxContent(); + $this->click("xpath=//label[text()='Pay later label {$hash}']"); } $this->type("email-5", $firstName . "@example.com"); $this->waitForElementPresent("first_name"); -- 2.25.1