From c900afb192bd3837797957c845c150956cedeb2e Mon Sep 17 00:00:00 2001 From: jitendrapurohit Date: Thu, 15 May 2014 19:05:57 +0530 Subject: [PATCH] Web Test Fix 4.5alpha1 --- .../Contact/ContactReferenceFieldTest.php | 26 ++++++++++--------- .../Contact/TaskActionAddToGroupTest.php | 8 +++--- .../UpdatePendingContributionTest.php | 3 ++- .../WebTest/Event/AddParticipationTest.php | 4 +-- .../Member/FixedMembershipTypeTest.php | 8 +++--- .../Member/OnlineMembershipRenewTest.php | 4 +-- 6 files changed, 28 insertions(+), 25 deletions(-) diff --git a/tests/phpunit/WebTest/Contact/ContactReferenceFieldTest.php b/tests/phpunit/WebTest/Contact/ContactReferenceFieldTest.php index f0b795f26c..ff586fcbf7 100644 --- a/tests/phpunit/WebTest/Contact/ContactReferenceFieldTest.php +++ b/tests/phpunit/WebTest/Contact/ContactReferenceFieldTest.php @@ -121,7 +121,7 @@ class WebTest_Contact_ContactReferenceFieldTest extends CiviSeleniumTestCase { $this->click("xpath=//form[@id='Field']//a[text()='Advanced Filter']"); $this->waitForElementPresent("filter"); - $this->type("filter", "action=lookup&contact_type=Organization"); + $this->type("filter", "action=get&contact_type=Organization"); //clicking save $this->click("_qf_Field_next-bottom"); @@ -147,20 +147,22 @@ class WebTest_Contact_ContactReferenceFieldTest extends CiviSeleniumTestCase { // Visit custom group preview page $this->openCiviPage('admin/custom/group', "action=preview&reset=1&id={$customGroupId}"); - $this->type("custom_{$contactRefFieldID1}_-1", "Anderson"); - $this->fireEvent("custom_{$contactRefFieldID1}_-1", "focus"); - $this->click("custom_{$contactRefFieldID1}_-1"); - $this->waitForElementPresent("css=div.ac_results-inner li"); - $this->assertElementContainsText("css=div.ac_results-inner li", "{$contact1}@example.com"); - $this->assertElementNotContainsText("css=div.ac_results-inner ul li", "{$contact2}@example.com"); + $this->clickAt("//*[@id='custom_{$contactRefFieldID1}_-1']/../div/a"); + $this->keyDown("//*[@id='select2-drop']/div/input", " "); + $this->type("//*[@id='select2-drop']/div/input", "Anderson"); + $this->typeKeys("//*[@id='select2-drop']/div/input", "Anderson"); + $this->waitForElementPresent("css=div.select2-result-label span"); + $this->assertElementContainsText("css=div.select2-result-label", "{$contact1}@example.com"); + $this->assertElementNotContainsText("css=div.select2-result-label", "{$contact2}@example.com"); $this->openCiviPage('admin/custom/group', "action=preview&reset=1&id={$customGroupId}"); - $this->type("custom_{$contactRefFieldID2}_-1", $org1); - $this->fireEvent("custom_{$contactRefFieldID2}_-1", "focus"); - $this->click("custom_{$contactRefFieldID2}_-1"); - $this->waitForElementPresent("css=div.ac_results-inner li"); - $this->assertElementContainsText("css=div.ac_results-inner li", "{$org1}@example.com"); + $this->clickAt("//*[@id='custom_{$contactRefFieldID2}_-1']/../div/a"); + $this->keyDown("//*[@id='select2-drop']/div/input", " "); + $this->type("//*[@id='select2-drop']/div/input", $org1); + $this->typeKeys("//*[@id='select2-drop']/div/input", $org1); + $this->waitForElementPresent("css=div.select2-result-label"); + $this->assertElementContainsText("css=div.select2-result-label", "{$org1}@example.com"); } } diff --git a/tests/phpunit/WebTest/Contact/TaskActionAddToGroupTest.php b/tests/phpunit/WebTest/Contact/TaskActionAddToGroupTest.php index ab9a07ca1e..9648b8df42 100644 --- a/tests/phpunit/WebTest/Contact/TaskActionAddToGroupTest.php +++ b/tests/phpunit/WebTest/Contact/TaskActionAddToGroupTest.php @@ -88,7 +88,7 @@ class WebTest_Contact_TaskActionAddToGroupTest extends CiviSeleniumTestCase { // Search by group membership in newly created group $this->openCiviPage('contact/search/advanced', 'reset=1'); - $this->select("crmasmSelect1", "label=" . $newGroupName); + $this->select("group", "label=" . $newGroupName); $this->click("_qf_Advanced_refresh"); $this->waitForPageToLoad($this->getTimeoutMsec()); @@ -114,10 +114,10 @@ class WebTest_Contact_TaskActionAddToGroupTest extends CiviSeleniumTestCase { $this->waitForPageToLoad($this->getTimeoutMsec()); $this->type("xpath=//*[@id='Basic-rows-per-page-select']", '25'); - $this->waitForElementPresent("xpath=//*[@id='Basic-rows-per-page-select']"); + $this->waitForElementPresent("toggleSelect"); $this->click("toggleSelect"); $this->click("xpath=//div[@class='crm-content-block']/div/div[2]/div/span[2]/a"); - $this->waitForElementPresent("Go"); + $this->waitForText("xpath=//div[@class='crm-content-block']/div/div[2]/div/span[2]/a", "First"); $this->click("toggleSelect"); $this->select("task", "label=Add Contacts to Group"); $this->click("Go"); @@ -134,7 +134,7 @@ class WebTest_Contact_TaskActionAddToGroupTest extends CiviSeleniumTestCase { $this->waitForText('crm-notification-container', "50 contacts added to group"); $this->openCiviPage('contact/search/advanced', 'reset=1'); - $this->select("crmasmSelect1", "label=" . $newGroupName); + $this->select("group", "label=" . $newGroupName); $this->click("_qf_Advanced_refresh"); $this->waitForPageToLoad($this->getTimeoutMsec()); diff --git a/tests/phpunit/WebTest/Contribute/UpdatePendingContributionTest.php b/tests/phpunit/WebTest/Contribute/UpdatePendingContributionTest.php index 338558e78c..56204097ff 100644 --- a/tests/phpunit/WebTest/Contribute/UpdatePendingContributionTest.php +++ b/tests/phpunit/WebTest/Contribute/UpdatePendingContributionTest.php @@ -157,6 +157,7 @@ class WebTest_Contribute_UpdatePendingContributionTest extends CiviSeleniumTestC // go to soft creditor contact view page - this also does the soft credit check $this->click("xpath=id('ContributionView')/div[2]/div/div[1][contains(text(), 'Soft Credit')]/../div[2]/table[1]/tbody//tr/td[1]/a[contains(text(), '{$softCreditFname} {$softCreditLname}')]"); + $this->waitForPageToLoad($this->getTimeoutMsec()); // go to contribution tab $this->waitForElementPresent("css=li#tab_contribute a"); $this->click("css=li#tab_contribute a"); @@ -249,7 +250,7 @@ class WebTest_Contribute_UpdatePendingContributionTest extends CiviSeleniumTestC $this->type("sort_name", "$lastName, $firstName"); $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"); + $this->clickLink("xpath=//div[@id='contributionSearch']//table//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' => "{$firstName} {$lastName}", diff --git a/tests/phpunit/WebTest/Event/AddParticipationTest.php b/tests/phpunit/WebTest/Event/AddParticipationTest.php index ee4852bb94..7b12137292 100644 --- a/tests/phpunit/WebTest/Event/AddParticipationTest.php +++ b/tests/phpunit/WebTest/Event/AddParticipationTest.php @@ -248,7 +248,7 @@ class WebTest_Event_AddParticipationTest extends CiviSeleniumTestCase { $this->waitForElementPresent("xpath=//div[@class='crm-customData-block']//div[@class='custom-group custom-group-$customGroupTitle crm-accordion-wrapper collapsed']"); $this->click("xpath=//div[@class='crm-customData-block']//div[@class='custom-group custom-group-$customGroupTitle crm-accordion-wrapper collapsed']//div[1]"); $this->click("xpath=//div[@class='crm-customData-block']//div[@class='custom-group custom-group-$customGroupTitle crm-accordion-wrapper']//div[2]//table//tbody//tr[2]//td[2]//table//tbody//tr[1]//td[1]//label"); - $this->click("xpath=//div[@class='crm-customData-block']//sdiv[@class='custom-group custom-group-$customGroupTitle crm-accordion-wrapper']//div[2]//table//tbody//tr[4]//td[2]//table//tbody//tr[1]//td[1]//label"); + $this->click("xpath=//div[@class='crm-customData-block']//div[@class='custom-group custom-group-$customGroupTitle crm-accordion-wrapper']//div[2]//table//tbody//tr[4]//td[2]//table//tbody//tr[1]//td[1]//label"); // Choose Registration Date. // Using helper webtestFillDate function. @@ -313,12 +313,12 @@ class WebTest_Event_AddParticipationTest extends CiviSeleniumTestCase { array( 'From' => $displayName, 'Financial Type' => 'Event Fee', - 'Total Amount' => '$ 800.00', 'Contribution Status' => 'Completed', 'Paid By' => 'Check', 'Check Number' => '1044', ) ); + $this->verifyText("xpath=//table/tbody/tr/td[text()='Total Amount']/following-sibling::td/strong", preg_quote('$ 800.00'), 'In line ' . __LINE__); } function testEventAddMultipleParticipants() { diff --git a/tests/phpunit/WebTest/Member/FixedMembershipTypeTest.php b/tests/phpunit/WebTest/Member/FixedMembershipTypeTest.php index 68e3e92a94..52b6de6d5e 100644 --- a/tests/phpunit/WebTest/Member/FixedMembershipTypeTest.php +++ b/tests/phpunit/WebTest/Member/FixedMembershipTypeTest.php @@ -161,11 +161,11 @@ SELECT end_event_adjust_interval // Clicking save. $this->click('_qf_Membership_upload'); - $this->waitForPageToLoad($this->getTimeoutMsec()); // page was loaded $this->waitForTextPresent($sourceText); + $this->waitForElementPresent("xpath=//div[@id='memberships']//table//tbody/tr[1]/td[9]/span/a[text()='View']"); // Is status message correct? $this->assertTrue($this->isTextPresent("Membership Type $title membership for $firstName $lastName has been added."), "Status message didn't show up after saving!" @@ -317,7 +317,7 @@ SELECT end_event_adjust_interval // Clicking save. $this->click('_qf_Membership_upload'); - $this->waitForPageToLoad($this->getTimeoutMsec()); + $this->waitForElementPresent("xpath=//div[@id='memberships']//table//tbody/tr[1]/td[9]/span/a[text()='View']"); // page was loaded $this->waitForTextPresent($sourceText); @@ -466,7 +466,7 @@ SELECT end_event_adjust_interval // Clicking save. $this->click('_qf_Membership_upload'); - $this->waitForPageToLoad($this->getTimeoutMsec()); + $this->waitForElementPresent("xpath=//div[@id='memberships']//table//tbody/tr[1]/td[9]/span/a[text()='View']"); // page was loaded $this->waitForTextPresent($sourceText); @@ -617,7 +617,7 @@ SELECT end_event_adjust_interval // Clicking save. $this->click('_qf_Membership_upload'); - $this->waitForPageToLoad($this->getTimeoutMsec()); + $this->waitForElementPresent("xpath=//div[@id='memberships']//table//tbody/tr[1]/td[9]/span/a[text()='View']"); // page was loaded $this->waitForTextPresent($sourceText); diff --git a/tests/phpunit/WebTest/Member/OnlineMembershipRenewTest.php b/tests/phpunit/WebTest/Member/OnlineMembershipRenewTest.php index fcf49e9443..719dca4164 100644 --- a/tests/phpunit/WebTest/Member/OnlineMembershipRenewTest.php +++ b/tests/phpunit/WebTest/Member/OnlineMembershipRenewTest.php @@ -406,7 +406,7 @@ class WebTest_Member_OnlineMembershipRenewTest extends CiviSeleniumTestCase { $this->waitForElementPresent('link=Add Membership Type'); $this->waitForText('crm-notification-container', "The membership type 'Membership Type $title' has been saved."); - $url = $this->getAttribute("xpath=//div[@id='membership_type']//div[@class='dataTables_wrapper']//table/tbody//tr/td[1][text()='{$membershipTypeTitle}']/../td[12]/span/a[3][text()='Delete']/@href"); + $url = $this->getAttribute("xpath=//div[@id='membership_type']//div[@id='option11_wrapper']//table/tbody//tr/td[1][text()='{$membershipTypeTitle}']/../td[12]/span/a[3][text()='Delete']/@href"); $matches = array(); preg_match('/id=([0-9]+)/', $url, $matches); @@ -459,7 +459,7 @@ class WebTest_Member_OnlineMembershipRenewTest extends CiviSeleniumTestCase { $this->click('link=Title'); $this->waitForElementPresent('_qf_Settings_cancel-bottom'); $this->click('is_organization'); - $this->select('onbehalf_profile_id', "value=9"); + $this->select("xpath=//input[@id='onbehalf_profile_id']/parent::td/div/div/span/select", "value=9"); $this->type('for_organization', "On behalf $hash"); $this->click('_qf_Settings_next-bottom'); $this->waitForPageToLoad($this->getTimeoutMsec()); -- 2.25.1