From 0ef7acd25e2ba00a1ea328ef8f5ef61e85dcc1de Mon Sep 17 00:00:00 2001 From: Web Access Date: Tue, 2 Feb 2016 18:48:48 +0530 Subject: [PATCH] Test fixes --- .../WebTest/Case/CaseCustomFieldsTest.php | 8 +++----- .../WebTest/Contact/RelationshipAddTest.php | 20 +++++++++---------- .../Contribute/ContributionPageAddTest.php | 7 ++++--- .../Member/OfflineMembershipRenewTest.php | 3 ++- 4 files changed, 19 insertions(+), 19 deletions(-) diff --git a/tests/phpunit/WebTest/Case/CaseCustomFieldsTest.php b/tests/phpunit/WebTest/Case/CaseCustomFieldsTest.php index 6501cfc44e..66ca602e38 100644 --- a/tests/phpunit/WebTest/Case/CaseCustomFieldsTest.php +++ b/tests/phpunit/WebTest/Case/CaseCustomFieldsTest.php @@ -48,10 +48,7 @@ class WebTest_Case_CaseCustomFieldsTest extends CiviSeleniumTestCase { $this->clickLink("newCustomDataGroup"); $this->type("title", $customGrp1); $this->select("extends[0]", "value=Case"); - // 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(1); + $this->waitForAjaxContent(); $this->select("extends_1", "value=2"); $this->clickLink("_qf_Group_next-bottom"); @@ -142,6 +139,7 @@ class WebTest_Case_CaseCustomFieldsTest extends CiviSeleniumTestCase { // verify if custom data is present $this->openCiviPage('case', 'reset=1'); + $this->waitForElementPresent("xpath=//table[@class='caseSelector']/tbody//tr/td[2]/a[text()='{$client['sort_name']}']/../../td[9]/span/a[1][text()='Manage']"); $this->clickLink("xpath=//table[@class='caseSelector']/tbody//tr/td[2]/a[text()='{$client['sort_name']}']/../../td[9]/span/a[1][text()='Manage']"); $this->clickAjaxLink("css=#{$customGrp1} .crm-accordion-header", "css=#{$customGrp1} a.button"); @@ -398,7 +396,7 @@ class WebTest_Case_CaseCustomFieldsTest extends CiviSeleniumTestCase { $cusId_1 = 'custom_' . $customId[0] . '_1'; $cusId_2 = 'custom_' . $customId[1] . '_1'; $this->clickLink("css=#{$customGrp1} a.button", '_qf_CustomData_cancel-bottom', FALSE); - + $this->waitForElementPresent("xpath=//span[@class='ui-dialog-title']"); $this->assertElementContainsText("xpath=//span[@class='ui-dialog-title']", "Edit $customGrp1"); $custFname = "Miky" . substr(sha1(rand()), 0, 7); diff --git a/tests/phpunit/WebTest/Contact/RelationshipAddTest.php b/tests/phpunit/WebTest/Contact/RelationshipAddTest.php index 1255f48c82..3519cdcf37 100644 --- a/tests/phpunit/WebTest/Contact/RelationshipAddTest.php +++ b/tests/phpunit/WebTest/Contact/RelationshipAddTest.php @@ -92,8 +92,8 @@ class WebTest_Contact_RelationshipAddTest extends CiviSeleniumTestCase { //check the status message $this->waitForText('crm-notification-container', 'Relationship created.'); - $this->waitForElementPresent("xpath=//div[@class='crm-contact-relationship-current']/div[@class='dataTables_wrapper no-footer']/table/tbody/tr/td[9]//span//a[text()='View']"); - $this->click("xpath=//div[@class='crm-contact-relationship-current']/div[@class='dataTables_wrapper no-footer']/table/tbody/tr/td[9]//span//a[text()='View']"); + $this->waitForElementPresent("xpath=//div[@class='dataTables_wrapper no-footer']/table/tbody/tr/td[9]//span//a[text()='View']"); + $this->click("xpath=//div[@class='dataTables_wrapper no-footer']/table/tbody/tr/td[9]//span//a[text()='View']"); $this->webtestVerifyTabularData( array( @@ -173,8 +173,8 @@ class WebTest_Contact_RelationshipAddTest extends CiviSeleniumTestCase { //save the relationship $this->click('_qf_Relationship_upload-bottom'); - $this->waitForElementPresent("xpath=//div[@id='contact-summary-relationship-tab']/div[@class='crm-contact-relationship-current']/div/table/tbody/tr/td[9]//span//a[text()='View']"); - $this->click("xpath=//div[@id='contact-summary-relationship-tab']/div[@class='crm-contact-relationship-current']/div/table/tbody/tr/td[9]//span//a[text()='View']"); + $this->waitForElementPresent("xpath=//div[@class='dataTables_wrapper no-footer']/table/tbody/tr/td[9]//span//a[text()='View']"); + $this->click("xpath=//div[@class='dataTables_wrapper no-footer']/table/tbody/tr/td[9]//span//a[text()='View']"); $this->webtestVerifyTabularData( array( @@ -265,8 +265,8 @@ class WebTest_Contact_RelationshipAddTest extends CiviSeleniumTestCase { //save the relationship $this->click('_qf_Relationship_upload-bottom'); - $this->waitForElementPresent("xpath=//div[@id='contact-summary-relationship-tab']/div[@class='crm-contact-relationship-current']/div/table/tbody/tr/td[9]//span//a[text()='View']"); - $this->click("xpath=//div[@id='contact-summary-relationship-tab']/div[@class='crm-contact-relationship-current']/div/table/tbody/tr/td[9]//span//a[text()='View']"); + $this->waitForElementPresent("xpath=//div[@class='dataTables_wrapper no-footer']/table/tbody/tr/td[9]//span//a[text()='View']"); + $this->click("xpath=//div[@class='dataTables_wrapper no-footer']/table/tbody/tr/td[9]//span//a[text()='View']"); $this->webtestVerifyTabularData( array( @@ -332,8 +332,8 @@ class WebTest_Contact_RelationshipAddTest extends CiviSeleniumTestCase { //check the status message $this->waitForText('crm-notification-container', 'Relationship created.'); - $this->waitForElementPresent("xpath=//div[@id='contact-summary-relationship-tab']/div[2]/div[1]/table/tbody/tr/td[9]/span[1]//a[text()='View']"); - $this->click("xpath=//div[@id='contact-summary-relationship-tab']/div[2]/div[1]/table/tbody/tr/td[9]/span[1]//a[text()='View']"); + $this->waitForElementPresent("xpath=//div[@class='dataTables_wrapper no-footer']/table/tbody/tr/td[9]/span[1]//a[text()='View']"); + $this->click("xpath=//div[@class='dataTables_wrapper no-footer']/table/tbody/tr/td[9]/span[1]//a[text()='View']"); $this->webtestVerifyTabularData( array( @@ -406,8 +406,8 @@ class WebTest_Contact_RelationshipAddTest extends CiviSeleniumTestCase { //check the status message $this->waitForText('crm-notification-container', 'Relationship created.'); - $this->waitForElementPresent("xpath=//div[@id='contact-summary-relationship-tab']/div[@class='crm-contact-relationship-current']/div/table/tbody/tr/td[9]//span//a[text()='View']"); - $this->click("xpath=//div[@id='contact-summary-relationship-tab']/div[@class='crm-contact-relationship-current']/div/table/tbody/tr/td[9]//span//a[text()='View']"); + $this->waitForElementPresent("xpath=//div[@class='dataTables_wrapper no-footer']/table/tbody/tr/td[9]//span//a[text()='View']"); + $this->click("xpath=//div[@class='dataTables_wrapper no-footer']/table/tbody/tr/td[9]//span//a[text()='View']"); $this->webtestVerifyTabularData( array( diff --git a/tests/phpunit/WebTest/Contribute/ContributionPageAddTest.php b/tests/phpunit/WebTest/Contribute/ContributionPageAddTest.php index e2566474e6..b8a95a70ed 100644 --- a/tests/phpunit/WebTest/Contribute/ContributionPageAddTest.php +++ b/tests/phpunit/WebTest/Contribute/ContributionPageAddTest.php @@ -259,8 +259,8 @@ class WebTest_Contribute_ContributionPageAddTest extends CiviSeleniumTestCase { $this->waitForElementPresent("financial_type_id"); $this->type("sort_name", $firstName); $this->select('financial_type_id', "label=Donation"); - $this->clickLink('_qf_Search_refresh', "xpath=//table[@class='selector row-highlight']/tbody/tr[1]/td[10]/span//a[text()='View']", FALSE); - $this->clickLink("xpath=//table[@class='selector row-highlight']/tbody/tr[1]/td[10]/span//a[text()='View']", '_qf_ContributionView_cancel-bottom', FALSE); + $this->clickLink('_qf_Search_refresh', "xpath=//table[@class='selector row-highlight']/tbody/tr/td[10]/span//a[text()='View']", FALSE); + $this->click("xpath=//div[@id='contributionSearch']/table[@class='selector row-highlight']/tbody/tr/td[10]/span//a[text()='View']"); $this->waitForAjaxContent(); $expected = array( 'From' => "{$firstName} {$lastName}", @@ -274,7 +274,8 @@ class WebTest_Contribute_ContributionPageAddTest extends CiviSeleniumTestCase { $this->openCiviPage("member/search", "reset=1", 'member_source'); $this->type('sort_name', "$lastName $firstName"); $this->clickLink('_qf_Search_refresh', "xpath=//table[@class='selector row-highlight']/tbody/tr[1]/td[11]/span//a[text()='View']", FALSE); - $this->clickLink("xpath=//table[@class='selector row-highlight']/tbody/tr[1]/td[11]/span//a[text()='View']", '_qf_MembershipView_cancel-bottom', FALSE); + $this->click("xpath=//table[@class='selector row-highlight']/tbody/tr[1]/td[11]/span//a[text()='View']"); + $this->waitForAjaxContent(); //View Membership Record $expected = array( diff --git a/tests/phpunit/WebTest/Member/OfflineMembershipRenewTest.php b/tests/phpunit/WebTest/Member/OfflineMembershipRenewTest.php index 2376083cf2..0a2822adde 100644 --- a/tests/phpunit/WebTest/Member/OfflineMembershipRenewTest.php +++ b/tests/phpunit/WebTest/Member/OfflineMembershipRenewTest.php @@ -162,6 +162,7 @@ class WebTest_Member_OfflineMembershipRenewTest extends CiviSeleniumTestCase { // select the financial type for the selected membership type $this->select('financial_type_id', 'value=2'); + $this->waitForAjaxContent(); // the amount for the selected membership type $this->type('total_amount', '100.00'); @@ -201,7 +202,7 @@ class WebTest_Member_OfflineMembershipRenewTest extends CiviSeleniumTestCase { // click through to the membership view screen $this->waitForAjaxContent(); - $this->click("xpath=//table[@class='display dataTable no-footer']/tbody/tr/td[9]/span/a[contains(text(), 'View')]"); + $this->click("xpath=//div[@id='memberships']/div/table[@class='display dataTable no-footer']/tbody/tr/td[9]/span/a[contains(text(), 'View')]"); $this->waitForElementPresent("_qf_MembershipView_cancel-bottom"); $joinDate = date('F jS, Y'); -- 2.25.1