From c543dff8a8e79187ce3fde83781ea9d6f43edd18 Mon Sep 17 00:00:00 2001 From: Web Access Date: Wed, 9 Dec 2015 18:48:31 +0530 Subject: [PATCH] Webtests Fix --- .../WebTest/Activity/ContactContextAddTest.php | 3 +++ .../WebTest/Contact/SearchBuilderTest.php | 5 ++++- .../WebTest/Contribute/StandaloneAddTest.php | 16 ++++++++-------- .../UpdateBatchPendingContributionTest.php | 4 ++-- tests/phpunit/WebTest/Event/AddPricesetTest.php | 12 ++++++------ .../Member/OfflineMembershipRenewTest.php | 8 ++++---- .../WebTest/Member/OnlineMembershipRenewTest.php | 2 +- 7 files changed, 28 insertions(+), 22 deletions(-) diff --git a/tests/phpunit/WebTest/Activity/ContactContextAddTest.php b/tests/phpunit/WebTest/Activity/ContactContextAddTest.php index 3223014566..5388b2139b 100644 --- a/tests/phpunit/WebTest/Activity/ContactContextAddTest.php +++ b/tests/phpunit/WebTest/Activity/ContactContextAddTest.php @@ -168,6 +168,7 @@ class WebTest_Activity_ContactContextAddTest extends CiviSeleniumTestCase { $this->waitForText("xpath=//div[@id='s2id_target_contact_id']", 'Anderson, ' . $firstName3, 'Contact not found in line ' . __LINE__); //filling the second target Contact + $this->waitForAjaxContent(); $this->click("xpath=//div[@id='s2id_target_contact_id']/ul/li/input"); $this->keyDown("xpath=//div[@id='s2id_target_contact_id']/ul/li/input", " "); $this->type("xpath=//div[@id='s2id_target_contact_id']/ul/li/input", $firstName1); @@ -183,6 +184,7 @@ class WebTest_Activity_ContactContextAddTest extends CiviSeleniumTestCase { $this->waitForText("xpath=//div[@id='s2id_target_contact_id']", "$firstName1", 'Contact not found in line ' . __LINE__); //filling the third target contact + $this->waitForAjaxContent(); $this->click("xpath=//div[@id='s2id_target_contact_id']/ul/li/input"); $this->keyDown("xpath=//div[@id='s2id_target_contact_id']/ul/li/input", " "); $this->type("xpath=//div[@id='s2id_target_contact_id']/ul/li/input", $firstName2); @@ -204,6 +206,7 @@ class WebTest_Activity_ContactContextAddTest extends CiviSeleniumTestCase { $this->type("subject", $subject); $this->webtestFillDateTime('activity_date_time', '+1 month 11:10PM'); + $this->waitForAjaxContent(); $this->select("status_id", "value=1"); // Clicking save. diff --git a/tests/phpunit/WebTest/Contact/SearchBuilderTest.php b/tests/phpunit/WebTest/Contact/SearchBuilderTest.php index 49bafb4eea..7206d70205 100644 --- a/tests/phpunit/WebTest/Contact/SearchBuilderTest.php +++ b/tests/phpunit/WebTest/Contact/SearchBuilderTest.php @@ -510,12 +510,14 @@ class WebTest_Contact_SearchBuilderTest extends CiviSeleniumTestCase { $this->waitForText('search-status', "1 Contact"); $this->click("xpath=//div[@class='crm-accordion-header crm-master-accordion-header']"); + $this->waitForElementPresent("xpath=//div[@id='map-field']/div[1]/table/tbody/tr[2]/td/a"); $this->click("xpath=//div[@id='map-field']/div[1]/table/tbody/tr[2]/td/a"); $this->enterValues(1, 2, 'Membership', 'Membership Status', NULL, 'IN', array('New', 'Grace')); $this->clickLink('_qf_Builder_refresh'); $this->waitForText('search-status', "2 Contacts"); $this->click("xpath=//div[@class='crm-accordion-header crm-master-accordion-header']"); + $this->waitForElementPresent("xpath=//div[@id='map-field']/div[1]/table/tbody/tr[2]/td/a"); $this->click("xpath=//div[@id='map-field']/div[1]/table/tbody/tr[2]/td/a"); $this->enterValues(1, 2, 'Membership', 'Membership Status', NULL, 'IN', array('Current', 'Expired')); $this->clickLink('_qf_Builder_refresh'); @@ -533,10 +535,11 @@ class WebTest_Contact_SearchBuilderTest extends CiviSeleniumTestCase { $this->waitForText('search-status', "2 Results"); $this->openCiviPage("member/search", "reset=1", "_qf_Search_refresh"); + $this->waitForAjaxContent(); $this->click("xpath=//div[@class='crm-accordion-header crm-master-accordion-header']"); $this->select2('membership_type_id', $membershipTypes['membership_type'], TRUE); $this->multiselect2("membership_status_id", array("New")); - $this->clickLink('_qf_Search_refresh'); + $this->click('_qf_Search_refresh'); $this->waitForText('search-status', "1 Result"); } diff --git a/tests/phpunit/WebTest/Contribute/StandaloneAddTest.php b/tests/phpunit/WebTest/Contribute/StandaloneAddTest.php index 64d6c26070..50483ade16 100644 --- a/tests/phpunit/WebTest/Contribute/StandaloneAddTest.php +++ b/tests/phpunit/WebTest/Contribute/StandaloneAddTest.php @@ -77,15 +77,15 @@ class WebTest_Contribute_StandaloneAddTest extends CiviSeleniumTestCase { $this->addeditFinancialType($financialType); // Assign the created Financial Account $financialAccountTitle to $financialType - $this->click("xpath=id('ltype')/div/table/tbody/tr/td[1]/div[text()='$financialType[name]']/../../td[7]/span/a[text()='Accounts']"); - $this->waitForElementPresent("xpath=//div[@class='ui-dialog-buttonset']//button/span[contains(text(), 'Assign Account')]"); - $this->click("xpath=//div[@class='ui-dialog-buttonset']//button/span[contains(text(), 'Assign Account')]"); + $this->click("xpath=id('ltype')/div/table/tbody/tr/td[1]/div[text()='$financialType[name]']/../../td[7]//span//a[text()='Accounts']"); + $this->waitForElementPresent("xpath=//div[@class='ui-dialog-buttonset']//button//span[contains(text(), 'Assign Account')]"); + $this->click("xpath=//div[@class='ui-dialog-buttonset']//button//span[contains(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[contains(text(), 'Assign Account')]"); + $this->waitForElementPresent("xpath=//div[@class='ui-dialog-buttonset']//button//span[contains(text(), 'Assign Account')]"); $this->openCiviPage("contribute/add", "reset=1&context=standalone", "_qf_Contribution_upload"); @@ -142,13 +142,13 @@ class WebTest_Contribute_StandaloneAddTest extends CiviSeleniumTestCase { $this->waitForText("crm-notification-container", "The contribution record has been saved."); // verify if Membership is created - $this->waitForElementPresent("xpath=//div[@class='view-content']//table[@class='selector row-highlight']//tbody/tr[1]/td[8]/span/a[text()='View']"); + $this->waitForElementPresent("xpath=//table[@class='selector row-highlight']//tbody/tr[1]/td[8]/span//a[text()='View']"); - $contriID = $this->urlArg('id', $this->getAttribute("xpath=//div[@class='view-content']//table[@class='selector row-highlight']//tbody/tr[1]/td[8]/span/a[text()='Edit']@href")); - $contactID = $this->urlArg('cid', $this->getAttribute("xpath=//div[@class='view-content']//table[@class='selector row-highlight']//tbody/tr[1]/td[8]/span/a[text()='Edit']@href")); + $contriID = $this->urlArg('id', $this->getAttribute("xpath=//table[@class='selector row-highlight']//tbody/tr[1]/td[8]/span//a[text()='Edit']@href")); + $contactID = $this->urlArg('cid', $this->getAttribute("xpath=//table[@class='selector row-highlight']//tbody/tr[1]/td[8]/span//a[text()='Edit']@href")); //click through to the Membership view screen - $this->click("xpath=//div[@class='view-content']//table[@class='selector row-highlight']//tbody/tr[1]/td[8]/span/a[text()='View']"); + $this->click("xpath=//table[@class='selector row-highlight']//tbody/tr[1]/td[8]/span//a[text()='View']"); $this->waitForElementPresent("_qf_ContributionView_cancel-bottom"); $expected = array( diff --git a/tests/phpunit/WebTest/Contribute/UpdateBatchPendingContributionTest.php b/tests/phpunit/WebTest/Contribute/UpdateBatchPendingContributionTest.php index e675d0c7f8..1448792be7 100644 --- a/tests/phpunit/WebTest/Contribute/UpdateBatchPendingContributionTest.php +++ b/tests/phpunit/WebTest/Contribute/UpdateBatchPendingContributionTest.php @@ -63,7 +63,7 @@ class WebTest_Contribute_UpdateBatchPendingContributionTest extends CiviSelenium $this->click("_qf_Search_refresh"); $this->waitForPageToLoad($this->getTimeoutMsec()); - $this->click("xpath=//div[@id='contributionSearch']/table[@class='selector row-highlight']/tbody/tr[1]/td[11]/span/a[text()='View']"); + $this->click("xpath=//table[@class='selector row-highlight']/tbody/tr[1]/td[10]/span//a[text()='View']"); $this->waitForElementPresent("_qf_ContributionView_cancel-bottom"); $expected = array( 'Received Into' => "Deposit Bank Account", @@ -121,7 +121,7 @@ class WebTest_Contribute_UpdateBatchPendingContributionTest extends CiviSelenium $this->click("_qf_Search_refresh"); $this->waitForPageToLoad($this->getTimeoutMsec()); - $this->click("xpath=//div[@id='contributionSearch']/table[@class='selector row-highlight']/tbody/tr[1]/td[11]/span/a[text()='View']"); + $this->click("xpath=//table[@class='selector row-highlight']/tbody/tr[1]/td[10]/span//a[text()='View']"); $this->waitForElementPresent("_qf_ContributionView_cancel-bottom"); $expected = array( 'Received Into' => "Deposit Bank Account", diff --git a/tests/phpunit/WebTest/Event/AddPricesetTest.php b/tests/phpunit/WebTest/Event/AddPricesetTest.php index f69ffdb641..ff36b23417 100644 --- a/tests/phpunit/WebTest/Event/AddPricesetTest.php +++ b/tests/phpunit/WebTest/Event/AddPricesetTest.php @@ -619,9 +619,9 @@ class WebTest_Event_AddPricesetTest extends CiviSeleniumTestCase { // Is status message correct? $this->waitForText("crm-notification-container", "Event registration for $displayName has been added"); - $this->waitForElementPresent("xpath=//form[@id='Search']/table/tbody/tr[1]/td[8]/span/a[text()='View']"); + $this->waitForElementPresent("xpath=//form[@id='Search']/table/tbody/tr[1]/td[8]/span//a[text()='View']"); //click through to the participant view screen - $this->click("xpath=//form[@id='Search']/table/tbody/tr[1]/td[8]/span/a[text()='View']"); + $this->click("xpath=//form[@id='Search']/table/tbody/tr[1]/td[8]/span//a[text()='View']"); $this->waitForElementPresent('_qf_ParticipantView_cancel-bottom'); $this->webtestVerifyTabularData( @@ -662,7 +662,7 @@ class WebTest_Event_AddPricesetTest extends CiviSeleniumTestCase { $this->_checkLineItems($expectedLineItems); // check contribution record as well // click through to the contribution view screen - $this->click("xpath=//*[@id='ParticipantView']/div[2]/table[@class='selector row-highlight']/tbody/tr[1]/td[8]/span/a[text()='View']"); + $this->click("xpath=//table[@class='selector row-highlight']/tbody/tr[1]/td[8]/span//a[text()='View']"); $this->waitForElementPresent('_qf_ContributionView_cancel-bottom'); $this->webtestVerifyTabularData( @@ -681,7 +681,7 @@ class WebTest_Event_AddPricesetTest extends CiviSeleniumTestCase { $this->openCiviPage('admin/price/field', "reset=1&action=browse&sid={$sid}", 'newPriceField'); $this->click("xpath=//table[@id='options']/tbody/tr[3]/td[8]/a[text()='Edit Price Options']"); $this->waitForElementPresent("xpath=//span[contains(text(), 'Done')]"); - $this->click("xpath=//table[@id='options']/tbody/tr/td/div[text()='First Night']/../following-sibling::td[8]/span/a[text()='Edit Option']"); + $this->click("xpath=//table[@id='options']/tbody/tr/td/div[text()='First Night']/../following-sibling::td[8]/span//a[text()='Edit Option']"); $this->waitForElementPresent("_qf_Option_cancel"); $this->type('label', 'First Night Edited'); $this->click('_qf_Option_next'); @@ -689,8 +689,8 @@ class WebTest_Event_AddPricesetTest extends CiviSeleniumTestCase { $this->openCiviPage('event/search', "reset=1", '_qf_Search_refresh'); $this->select2('participant_fee_id', 'First Night Edited'); - $this->clickLink('_qf_Search_refresh'); - $this->clickLink("xpath=//div[@id='participantSearch']//table//tbody/tr[1]/td[11]/span/a[text()='View']", "xpath=//span[contains(text(), 'Done')]", FALSE); + $this->click('_qf_Search_refresh'); + $this->clickLink("xpath=//div[@id='participantSearch']//table//tbody/tr[1]/td[11]/span//a[text()='View']", "xpath=//span[contains(text(), 'Done')]", FALSE); $expectedLineItems[4][1] = 'Evening Sessions - First Night Edited'; $this->_checkLineItems($expectedLineItems); } diff --git a/tests/phpunit/WebTest/Member/OfflineMembershipRenewTest.php b/tests/phpunit/WebTest/Member/OfflineMembershipRenewTest.php index ef0cafaf98..2376083cf2 100644 --- a/tests/phpunit/WebTest/Member/OfflineMembershipRenewTest.php +++ b/tests/phpunit/WebTest/Member/OfflineMembershipRenewTest.php @@ -294,10 +294,10 @@ class WebTest_Member_OfflineMembershipRenewTest extends CiviSeleniumTestCase { // page was loaded $this->waitForTextPresent($sourceText); - $this->waitForElementPresent("xpath=//div[@id='memberships']//table/tbody/tr/td[9]/span/a[text()='View']"); + $this->waitForElementPresent("xpath=//div[@id='memberships']//table/tbody/tr/td[9]/span//a[text()='View']"); // click through to the membership view screen - $this->click("xpath=//div[@id='memberships']//table/tbody/tr/td[9]/span/a[text()='View']"); + $this->click("xpath=//div[@id='memberships']//table/tbody/tr/td[9]/span//a[text()='View']"); $this->waitForElementPresent('_qf_MembershipView_cancel-bottom'); @@ -401,10 +401,10 @@ class WebTest_Member_OfflineMembershipRenewTest extends CiviSeleniumTestCase { // page was loaded $this->waitForTextPresent($sourceText); - $this->waitForElementPresent("xpath=//div[@id='memberships']//table/tbody/tr/td[9]/span/a[text()='View']"); + $this->waitForElementPresent("xpath=//div[@id='memberships']//table/tbody/tr/td[9]/span//a[text()='View']"); // click through to the membership view screen - $this->click("xpath=//div[@id='memberships']//table/tbody/tr/td[9]/span/a[text()='View']"); + $this->click("xpath=//div[@id='memberships']//table/tbody/tr/td[9]/span//a[text()='View']"); $this->waitForElementPresent("xpath=//button//span[contains(text(),'Done')]"); diff --git a/tests/phpunit/WebTest/Member/OnlineMembershipRenewTest.php b/tests/phpunit/WebTest/Member/OnlineMembershipRenewTest.php index 3c44d66573..d7aa11aa2c 100644 --- a/tests/phpunit/WebTest/Member/OnlineMembershipRenewTest.php +++ b/tests/phpunit/WebTest/Member/OnlineMembershipRenewTest.php @@ -685,7 +685,7 @@ class WebTest_Member_OnlineMembershipRenewTest extends CiviSeleniumTestCase { $title = substr(sha1(rand()), 0, 7); $membershipTypeTitle = "Membership Type $title"; $this->type('name', "Membership Type $title"); - + $this->waitForAjaxContent(); $this->select2('member_of_contact_id', 'Default Organization'); $this->type('minimum_fee', '100'); -- 2.25.1