From c79fb98ebe4f29e7830d7d87f8cf002ecad4cc2a Mon Sep 17 00:00:00 2001 From: Web Access Date: Tue, 24 Nov 2015 18:55:18 +0530 Subject: [PATCH] Webtests Fixes - master --- .../WebTest/ACL/AssignUsersToRolesTest.php | 2 ++ .../WebTest/Member/OfflineMembershipRenewTest.php | 15 +++++++-------- .../Pledge/ContactContextPledgePaymentAddTest.php | 5 +++-- .../phpunit/WebTest/Report/LoggingReportTest.php | 6 ++---- 4 files changed, 14 insertions(+), 14 deletions(-) diff --git a/tests/phpunit/WebTest/ACL/AssignUsersToRolesTest.php b/tests/phpunit/WebTest/ACL/AssignUsersToRolesTest.php index 87c66e1c56..10f39e3b24 100755 --- a/tests/phpunit/WebTest/ACL/AssignUsersToRolesTest.php +++ b/tests/phpunit/WebTest/ACL/AssignUsersToRolesTest.php @@ -167,6 +167,7 @@ class WebTest_ACL_AssignUsersToRolesTest extends CiviSeleniumTestCase { $this->clickLink("_qf_EntityRole_next-botttom", 'newACL', FALSE); //Create ACL granting 'Edit' access on smart group to the role + $this->waitForAjaxContent(); $this->openCiviPage("acl", "reset=1"); $this->click('newACL'); $this->waitForElementPresent("group_id"); @@ -178,6 +179,7 @@ class WebTest_ACL_AssignUsersToRolesTest extends CiviSeleniumTestCase { $this->clickLink("_qf_ACL_next-bottom", 'newACL', FALSE); //ACL granting edit permission on events. + $this->waitForAjaxContent(); $this->click('newACL'); $this->waitForElementPresent('name'); $this->type("name", "Edit All Events $label"); diff --git a/tests/phpunit/WebTest/Member/OfflineMembershipRenewTest.php b/tests/phpunit/WebTest/Member/OfflineMembershipRenewTest.php index 3f22d75cc8..ef0cafaf98 100644 --- a/tests/phpunit/WebTest/Member/OfflineMembershipRenewTest.php +++ b/tests/phpunit/WebTest/Member/OfflineMembershipRenewTest.php @@ -72,7 +72,7 @@ class WebTest_Member_OfflineMembershipRenewTest 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: make sure onchange for total_amount has a chance to fire - sleep(2); + $this->waitForAjaxContent(); // Clicking save. $this->click('_qf_Membership_upload-bottom'); @@ -82,11 +82,10 @@ class WebTest_Member_OfflineMembershipRenewTest extends CiviSeleniumTestCase { // Is status message correct? $this->waitForText('crm-notification-container', "{$membershipTypes['membership_type']} membership for $firstName Memberson has been added."); - - $this->waitForElementPresent("xpath=//div[@id='memberships']//table/tbody/tr/td[9]/span[2][text()='Renew...']/ul/li/a[text()='Renew']"); + $this->waitForElementPresent("xpath=//table[@class='display dataTable no-footer']/tbody/tr/td[9]/span[2][text()='Renew...']/ul/li/a[text()='Renew']"); // click through to the Membership Renewal Link - $this->click("xpath=//div[@id='memberships']//table/tbody/tr/td[9]/span[2][text()='Renew...']/ul/li/a[text()='Renew']"); + $this->click("xpath=//table[@class='display dataTable no-footer']/tbody/tr/td[9]/span[2][text()='Renew...']/ul/li/a[text()='Renew']"); $this->waitForElementPresent('_qf_MembershipRenewal_cancel-bottom'); @@ -96,10 +95,10 @@ class WebTest_Member_OfflineMembershipRenewTest extends CiviSeleniumTestCase { // page was loaded $this->waitForAjaxContent(); $this->waitForTextPresent($sourceText); - $this->waitForElementPresent("xpath=//div[@id='memberships']/div/table[@class='display dataTable no-footer']/tbody/tr/td[9]/span[1]/a[1][contains(text(),'View')]"); + $this->waitForElementPresent("xpath=//table[@class='display dataTable no-footer']/tbody/tr/td[9]/span[1]/a[1][contains(text(),'View')]"); // click through to the membership view screen - $this->click("xpath=//div[@id='memberships']/div/table[@class='display dataTable no-footer']/tbody/tr/td[9]/span[1]/a[1][contains(text(),'View')]"); + $this->click("xpath=//table[@class='display dataTable no-footer']/tbody/tr/td[9]/span[1]/a[1][contains(text(),'View')]"); $this->waitForElementPresent("xpath=//button//span[contains(text(),'Done')]"); @@ -259,7 +258,7 @@ class WebTest_Member_OfflineMembershipRenewTest 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: make sure onchange for total_amount has a chance to fire - sleep(2); + $this->waitForAjaxContent(); // Clicking save. $this->click('_qf_Membership_upload-bottom'); @@ -287,7 +286,7 @@ class WebTest_Member_OfflineMembershipRenewTest 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: wait for onchange handler - sleep(2); + $this->waitForAjaxContent(); // save the renewed membership $this->click('_qf_MembershipRenewal_upload-bottom'); diff --git a/tests/phpunit/WebTest/Pledge/ContactContextPledgePaymentAddTest.php b/tests/phpunit/WebTest/Pledge/ContactContextPledgePaymentAddTest.php index 581ece384f..ddc55861a2 100644 --- a/tests/phpunit/WebTest/Pledge/ContactContextPledgePaymentAddTest.php +++ b/tests/phpunit/WebTest/Pledge/ContactContextPledgePaymentAddTest.php @@ -179,8 +179,8 @@ class WebTest_Pledge_ContactContextPledgePaymentAddTest extends CiviSeleniumTest $this->waitForElementPresent("_qf_Contribution_upload"); $this->click("_qf_Contribution_upload"); - $this->waitForElementPresent("xpath=//div[@class='view-content']//table//tbody/tr[1]/td[10]/span/a[text()='View']"); - $this->click("xpath=//div[@class='view-content']//table//tbody/tr[1]/td[10]/span/a[text()='View']"); + $this->waitForElementPresent("xpath=//form[@class='CRM_Pledge_Form_Search crm-search-form']/div[@class='view-content']//table//tbody/tr[1]/td[10]/span/a[text()='View']"); + $this->click("xpath=//form[@class='CRM_Pledge_Form_Search crm-search-form']/div[@class='view-content']//table//tbody/tr[1]/td[10]/span/a[text()='View']"); $this->waitForElementPresent("_qf_PledgeView_next-bottom"); $this->webtestVerifyTabularData(array( @@ -197,6 +197,7 @@ class WebTest_Pledge_ContactContextPledgePaymentAddTest extends CiviSeleniumTest ) ); $this->openCiviPage('admin/setting/localization', 'reset=1'); + $this->waitForElementPresent("currencyLimit"); $this->select("currencyLimit", "value=FJD"); $this->click("remove"); $this->click("_qf_Localization_next-bottom"); diff --git a/tests/phpunit/WebTest/Report/LoggingReportTest.php b/tests/phpunit/WebTest/Report/LoggingReportTest.php index b4786e84fd..d11190e211 100644 --- a/tests/phpunit/WebTest/Report/LoggingReportTest.php +++ b/tests/phpunit/WebTest/Report/LoggingReportTest.php @@ -88,10 +88,8 @@ class WebTest_Report_LoggingReportTest extends CiviSeleniumTestCase { //add new note $this->waitForElementPresent("xpath=//li[@id='tab_note']/a"); $this->click("xpath=//li[@id='tab_note']/a"); - // 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 - $this->click("xpath=//div[@class='view-content']//div[@class='action-link']/a"); + $this->waitForAjaxContent(); + $this->click("xpath=//div[@class='view-content']//div[@class='action-link']/a[@class='button medium-popup']"); $this->waitForElementPresent("_qf_Note_upload-top"); $noteSubject = "test note" . substr(sha1(rand()), 0, 7); -- 2.25.1