From: Coleman Watts Date: Wed, 20 Mar 2013 21:12:50 +0000 (-0700) Subject: Start migrating to use clickLink method X-Git-Url: https://vcs.fsf.org/?a=commitdiff_plain;h=225a8648b15f8a60486e07d9b3d9bade5db65a1b;p=civicrm-core.git Start migrating to use clickLink method --- diff --git a/tests/phpunit/CiviTest/CiviSeleniumTestCase.php b/tests/phpunit/CiviTest/CiviSeleniumTestCase.php index 874a7badfa..642ecaf513 100644 --- a/tests/phpunit/CiviTest/CiviSeleniumTestCase.php +++ b/tests/phpunit/CiviTest/CiviSeleniumTestCase.php @@ -952,9 +952,7 @@ class CiviSeleniumTestCase extends PHPUnit_Extensions_SeleniumTestCase { $this->click('is_separate_payment'); } } - $this->click('_qf_MembershipBlock_next'); - $this->waitForPageToLoad($this->getTimeoutMsec()); - $this->waitForElementPresent('_qf_MembershipBlock_next-bottom'); + $this->clickLink('_qf_MembershipBlock_next', '_qf_MembershipBlock_next-bottom'); $text = "'MembershipBlock' information has been saved."; $this->assertTrue($this->isTextPresent($text), 'Missing text: ' . $text); } @@ -1228,8 +1226,7 @@ class CiviSeleniumTestCase extends PHPUnit_Extensions_SeleniumTestCase { } // Clicking save. - $this->click('_qf_Edit_upload-bottom'); - $this->waitForPageToLoad($this->getTimeoutMsec()); + $this->clickLink('_qf_Edit_upload-bottom'); // Is status message correct? $this->assertElementContainsText('crm-notification-container', "$groupName"); @@ -1511,10 +1508,7 @@ class CiviSeleniumTestCase extends PHPUnit_Extensions_SeleniumTestCase { } $this->waitForElementPresent("xpath=//table/tbody//tr/td[1][text()='{$editfinancialAccount}']/../td[9]/span/a[text()='Edit']"); - $this->click("xpath=//table/tbody//tr/td[1][text()='{$editfinancialAccount}']/../td[9]/span/a[text()='Edit']"); - $this->waitForPageToLoad($this->getTimeoutMsec()); - - $this->waitForElementPresent('_qf_FinancialAccount_cancel-botttom'); + $this->clickLink("xpath=//table/tbody//tr/td[1][text()='{$editfinancialAccount}']/../td[9]/span/a[text()='Edit']", '_qf_FinancialAccount_cancel-botttom'); // Change Financial Account Name if ($financialAccountTitle) { diff --git a/tests/phpunit/WebTest/Campaign/CampaignDescriptionTest.php b/tests/phpunit/WebTest/Campaign/CampaignDescriptionTest.php index 235c895b43..1e1a354cb6 100644 --- a/tests/phpunit/WebTest/Campaign/CampaignDescriptionTest.php +++ b/tests/phpunit/WebTest/Campaign/CampaignDescriptionTest.php @@ -82,11 +82,7 @@ class WebTest_Campaign_CampaignDescriptionTest extends CiviSeleniumTestCase { //Opening Edit Page of the created Campaign $this->waitForElementPresent("//div[@id='campaignList']/div[@class='dataTables_wrapper']/table/tbody//tr/td[text()='{$campaignTitle}']/../td[13]/span/a[text()='Edit']"); - $this->click("//div[@id='campaignList']/div[@class='dataTables_wrapper']/table/tbody//tr/td[text()='{$campaignTitle}']/../td[13]/span/a[text()='Edit']"); - $this->waitForPageToLoad($this->getTimeoutMsec()); - - //Checking for Proper description present - $this->waitForElementPresent("//textarea[@id='description']"); + $this->clickLink("//div[@id='campaignList']/div[@class='dataTables_wrapper']/table/tbody//tr/td[text()='{$campaignTitle}']/../td[13]/span/a[text()='Edit']", "//textarea[@id='description']"); $fetchedVaue = $this->getValue('description'); $this->assertEquals($campaignDescription, $fetchedVaue); } diff --git a/tests/phpunit/WebTest/Campaign/OnlineContributionTest.php b/tests/phpunit/WebTest/Campaign/OnlineContributionTest.php index 7459e0237b..c485c4f144 100644 --- a/tests/phpunit/WebTest/Campaign/OnlineContributionTest.php +++ b/tests/phpunit/WebTest/Campaign/OnlineContributionTest.php @@ -284,10 +284,7 @@ class WebTest_Campaign_OnlineContributionTest extends CiviSeleniumTestCase { $this->select("billing_country_id-5", "value=1228"); $this->select("billing_state_province_id-5", "value=1004"); $this->type("billing_postal_code-5", "94129"); - $this->click("_qf_Main_upload-bottom"); - - $this->waitForPageToLoad($this->getTimeoutMsec()); - $this->waitForElementPresent("_qf_Confirm_next-bottom"); + $this->clickLink("_qf_Main_upload-bottom", "_qf_Confirm_next-bottom"); $this->clickLink("_qf_Confirm_next-bottom", NULL); diff --git a/tests/phpunit/WebTest/Campaign/OnlineEventRegistrationTest.php b/tests/phpunit/WebTest/Campaign/OnlineEventRegistrationTest.php index ca54af6e16..3aed99ea4a 100644 --- a/tests/phpunit/WebTest/Campaign/OnlineEventRegistrationTest.php +++ b/tests/phpunit/WebTest/Campaign/OnlineEventRegistrationTest.php @@ -253,11 +253,7 @@ class WebTest_Campaign_OnlineEventRegistrationTest extends CiviSeleniumTestCase // verify event input on info page // start at Manage Events listing $this->openCiviPage("event/manage", "reset=1"); - $this->click("link=$eventTitle"); - - $this->waitForPageToLoad($this->getTimeoutMsec()); - // Look for Register button - $this->waitForElementPresent("link=Register Now"); + $this->clickLink("link=$eventTitle", "link=Register Now"); // Check for correct event info strings $this->assertStringsPresent($eventInfoStrings); diff --git a/tests/phpunit/WebTest/Campaign/SurveyUsageScenarioTest.php b/tests/phpunit/WebTest/Campaign/SurveyUsageScenarioTest.php index 3686085043..7e51c9936a 100644 --- a/tests/phpunit/WebTest/Campaign/SurveyUsageScenarioTest.php +++ b/tests/phpunit/WebTest/Campaign/SurveyUsageScenarioTest.php @@ -287,14 +287,8 @@ class WebTest_Campaign_SurveyUsageScenarioTest extends CiviSeleniumTestCase { $this->click("xpath=id('mark_x_$id[1]')"); $this->waitForElementPresent("Go"); - $this->click("Go"); - $this->waitForPageToLoad($this->getTimeoutMsec()); - - $this->waitForElementPresent("_qf_Release_done-bottom"); - $this->click("_qf_Release_done-bottom"); - $this->waitForPageToLoad($this->getTimeoutMsec()); - // wait for Access Keys div to appear at bottom of page - since this page may take a while - $this->waitForElementPresent('access'); + $this->clickLink("Go", "_qf_Release_done-bottom"); + $this->clickLink("_qf_Release_done-bottom", 'access'); $this->assertElementContainsText("crm-notification-container", "released"); // check whether contact is available for reserving again @@ -415,9 +409,7 @@ class WebTest_Campaign_SurveyUsageScenarioTest extends CiviSeleniumTestCase { $this->select('visibility', "value=Public Pages and Listings"); $this->check('is_searchable'); $this->check('in_selector'); - $this->click('_qf_Field_next_new-bottom'); - $this->waitForPageToLoad($this->getTimeoutMsec()); - $this->waitForElementPresent('_qf_Field_cancel-bottom'); + $this->clickLink('_qf_Field_next_new-bottom', '_qf_Field_cancel-bottom'); // Custom Data Fields $this->select('field_name[0]', "value=Contact"); @@ -497,10 +489,7 @@ class WebTest_Campaign_SurveyUsageScenarioTest extends CiviSeleniumTestCase { $this->click("Go"); $this->waitForElementPresent('_qf_Reserve_done_reserve-bottom'); - $this->click('_qf_Reserve_done_reserve-bottom'); - $this->waitForPageToLoad($this->getTimeoutMsec()); - // wait for Access Keys div to appear at bottom of page - since this page may take a while - $this->waitForElementPresent('access'); + $this->clickLink('_qf_Reserve_done_reserve-bottom', 'access'); $this->assertElementContainsText("crm-notification-container", "2"); $this->openCiviPage("report/survey/detail", "reset=1", '_qf_SurveyDetails_submit'); diff --git a/tests/phpunit/WebTest/Case/ActivityToCaseTest.php b/tests/phpunit/WebTest/Case/ActivityToCaseTest.php index 9233a8acce..0901c74418 100644 --- a/tests/phpunit/WebTest/Case/ActivityToCaseTest.php +++ b/tests/phpunit/WebTest/Case/ActivityToCaseTest.php @@ -74,11 +74,7 @@ class WebTest_Case_ActivityToCaseTest extends CiviSeleniumTestCase { $today = date('F jS, Y', strtotime('now')); // echo 'Today is ' . $today; $this->type('duration', "20"); - $this->click('_qf_Case_upload-bottom'); - - // We should be at manage case screen - $this->waitForPageToLoad($this->getTimeoutMsec()); - $this->waitForElementPresent('_qf_CaseView_cancel-bottom'); + $this->clickLink('_qf_Case_upload-bottom', '_qf_CaseView_cancel-bottom'); // Is status message correct? $this->assertElementContainsText('crm-notification-container', "Case opened successfully.", "Save successful status message didn't show up after saving!"); diff --git a/tests/phpunit/WebTest/Case/AddCaseTest.php b/tests/phpunit/WebTest/Case/AddCaseTest.php index e984c7651c..4e6ad2ae1c 100644 --- a/tests/phpunit/WebTest/Case/AddCaseTest.php +++ b/tests/phpunit/WebTest/Case/AddCaseTest.php @@ -54,18 +54,14 @@ class WebTest_Case_AddCaseTest extends CiviSeleniumTestCase { $this->waitForElementPresent("_qf_Edit_next"); $this->type("first_name", $testUserFirstName); $this->type("last_name", $testUserLastName); - $this->click("_qf_Edit_next"); - $this->waitForPageToLoad($this->getTimeoutMsec()); - $this->waitForElementPresent("profilewrap4"); + $this->clickLink("_qf_Edit_next", "profilewrap4"); // Is status message correct? $this->assertElementContainsText('crm-container', "Thank you. Your information has been saved.", "Save successful status message didn't show up after saving profile to update testUserName!"); $this->openCiviPage('case/add', 'reset=1&action=add&atype=13&context=standalone', '_qf_Case_upload-bottom'); // Try submitting the form without creating or selecting a contact (test for CRM-7971) - $this->click("_qf_Case_upload-bottom"); - $this->waitForPageToLoad($this->getTimeoutMsec()); - $this->waitForElementPresent("css=span.crm-error"); + $this->clickLink("_qf_Case_upload-bottom", "css=span.crm-error"); $this->assertElementContainsText('Case', "Please select a contact or create new contact", "Expected form rule error for submit without selecting contact did not show up after clicking Save."); // Adding contact with randomized first name (so we can then select that contact when creating case) @@ -100,11 +96,7 @@ class WebTest_Case_AddCaseTest extends CiviSeleniumTestCase { $today = date('F jS, Y', strtotime('now')); // echo 'Today is ' . $today; $this->type("duration", "20"); - $this->click("_qf_Case_upload-bottom"); - - // We should be at manage case screen - $this->waitForPageToLoad($this->getTimeoutMsec()); - $this->waitForElementPresent("_qf_CaseView_cancel-bottom"); + $this->clickLink("_qf_Case_upload-bottom", "_qf_CaseView_cancel-bottom"); // Is status message correct? $this->assertElementContainsText('crm-notification-container', "Case opened successfully.", "Save successful status message didn't show up after saving!"); diff --git a/tests/phpunit/WebTest/Case/CaseCustomFieldsTest.php b/tests/phpunit/WebTest/Case/CaseCustomFieldsTest.php index 847d089bbf..baa52f8eb5 100644 --- a/tests/phpunit/WebTest/Case/CaseCustomFieldsTest.php +++ b/tests/phpunit/WebTest/Case/CaseCustomFieldsTest.php @@ -76,16 +76,12 @@ class WebTest_Case_CaseCustomFieldsTest extends CiviSeleniumTestCase { $testUserLastName = "Testuserlast"; $this->type("first_name", $testUserFirstName); $this->type("last_name", $testUserLastName); - $this->click("_qf_Edit_next"); - $this->waitForPageToLoad($this->getTimeoutMsec()); - $this->waitForElementPresent("profilewrap4"); + $this->clickLink("_qf_Edit_next", "profilewrap4"); $this->openCiviPage('case/add', 'reset=1&action=add&atype=13&context=standalone', '_qf_Case_upload-bottom'); // Try submitting the form without creating or selecting a contact (test for CRM-7971) - $this->click("_qf_Case_upload-bottom"); - $this->waitForPageToLoad($this->getTimeoutMsec()); - $this->waitForElementPresent("css=span.crm-error"); + $this->clickLink("_qf_Case_upload-bottom", "css=span.crm-error"); // Adding contact with randomized first name (so we can then select that contact when creating case) // We're using pop-up New Contact dialog @@ -131,11 +127,7 @@ class WebTest_Case_CaseCustomFieldsTest extends CiviSeleniumTestCase { $this->type("{$cusId_1}", $custFname); $this->type("{$cusId_2}", $custMname); $this->type("{$cusId_3}", $custLname); - $this->click("_qf_Case_upload-bottom"); - - // We should be at manage case screen - $this->waitForPageToLoad($this->getTimeoutMsec()); - $this->waitForElementPresent("_qf_CaseView_cancel-bottom"); + $this->clickLink("_qf_Case_upload-bottom", "_qf_CaseView_cancel-bottom"); // Is status message correct? $this->assertTextPresent("Case opened successfully.", "Save successful status message didn't show up after saving!"); diff --git a/tests/phpunit/WebTest/Case/CaseDashboardTest.php b/tests/phpunit/WebTest/Case/CaseDashboardTest.php index 7b28b73e04..f7d704aca0 100644 --- a/tests/phpunit/WebTest/Case/CaseDashboardTest.php +++ b/tests/phpunit/WebTest/Case/CaseDashboardTest.php @@ -53,9 +53,7 @@ class WebTest_Case_CaseDashboardTest extends CiviSeleniumTestCase { // The header text of the table changes too $this->assertElementContainsText('crm-container', "Summary of Case Involvement"); - $this->click("name=allupcoming value=1"); - $this->waitForPageToLoad($this->getTimeoutMsec()); - $this->waitForElementPresent("css=a.button"); + $this->clickLink("name=allupcoming value=1", "css=a.button"); $this->assertTrue($this->isChecked("name=allupcoming value=1"), 'Selection of All Cases failed.'); $this->assertElementContainsText('crm-container', "Summary of All Cases"); @@ -64,30 +62,22 @@ class WebTest_Case_CaseDashboardTest extends CiviSeleniumTestCase { $this->openCiviPage('case', 'reset=1', 'css=a.button'); // Click on find my cases and check if right radio is checked - $this->click("name=find_my_cases"); - $this->waitForPageToLoad($this->getTimeoutMsec()); - $this->waitForElementPresent("css=input.form-submit"); + $this->clickLink("name=find_my_cases", "css=input.form-submit"); $this->assertTrue($this->isChecked("name=case_owner value=2"), 'Find my cases button not properly setting search form value to my cases.'); // Go back to dashboard $this->openCivipage('case', 'reset=1', 'css=a.button'); // Click on a drilldown cell and check if right radio is checked - $this->click("css=a.crm-case-summary-drilldown"); - $this->waitForPageToLoad($this->getTimeoutMsec()); - $this->waitForElementPresent("css=input.form-submit"); + $this->clickLink("css=a.crm-case-summary-drilldown", "css=input.form-submit"); $this->assertTrue($this->isChecked("name=case_owner value=1"), 'Drilldown on dashboard summary cells not properly setting search form value to all cases.'); // Go back to dashboard and reset to my cases $this->openCiviPage('case', 'reset=1', 'css=a.button'); - $this->click("name=allupcoming value=0"); - $this->waitForPageToLoad($this->getTimeoutMsec()); - $this->waitForElementPresent("css=a.button"); + $this->clickLink("name=allupcoming value=0", "css=a.button"); // Click on a drilldown cell and check if right radio is checked - $this->click("css=a.crm-case-summary-drilldown"); - $this->waitForPageToLoad($this->getTimeoutMsec()); - $this->waitForElementPresent("css=input.form-submit"); + $this->clickLink("css=a.crm-case-summary-drilldown", "css=input.form-submit"); $this->assertTrue($this->isChecked("name=case_owner value=2"), 'Drilldown on dashboard summary cells not properly setting search form value to my cases.'); } } diff --git a/tests/phpunit/WebTest/Contact/AdvancedSearchedRelatedContactTest.php b/tests/phpunit/WebTest/Contact/AdvancedSearchedRelatedContactTest.php index cb6d589012..674ac270bd 100644 --- a/tests/phpunit/WebTest/Contact/AdvancedSearchedRelatedContactTest.php +++ b/tests/phpunit/WebTest/Contact/AdvancedSearchedRelatedContactTest.php @@ -88,9 +88,7 @@ class WebTest_Contact_AdvancedSearchedRelatedContactTest extends CiviSeleniumTes $this->openCiviPage('contact/search', 'reset=1', '_qf_Basic_refresh'); $this->type("sort_name", $sortName); $this->select("contact_type", "value=Individual"); - $this->click("_qf_Basic_refresh"); - $this->waitForPageToLoad($this->getTimeoutMsec()); - $this->waitForElementPresent("xpath=//form[@id='Basic']/div[3]/div/div[2]/table/tbody/tr/"); + $this->clickLink("_qf_Basic_refresh", "xpath=//form[@id='Basic']/div[3]/div/div[2]/table/tbody/tr/"); // click through to the Relationship view screen $this->click("xpath=//form[@id='Basic']/div[3]/div/div[2]/table/tbody/tr/td[11]/span/a[text()='View']"); @@ -219,9 +217,7 @@ class WebTest_Contact_AdvancedSearchedRelatedContactTest extends CiviSeleniumTes $this->openCiviPage('contact/search', 'reset=1', '_qf_Basic_refresh'); $this->type("sort_name", $ContactName); $this->select("contact_type", "value=Individual"); - $this->click("_qf_Basic_refresh"); - $this->waitForPageToLoad($this->getTimeoutMsec()); - $this->waitForElementPresent("xpath=//form[@id='Basic']/div[3]/div/div[2]/table/tbody/tr/"); + $this->clickLink("_qf_Basic_refresh", "xpath=//form[@id='Basic']/div[3]/div/div[2]/table/tbody/tr/"); // click through to the Contribution view screen $this->click("xpath=//form[@id='Basic']/div[3]/div/div[2]/table/tbody/tr/td[11]/span/a[text()='View']"); diff --git a/tests/phpunit/WebTest/Contact/DeceasedContactsAdvancedSearchTest.php b/tests/phpunit/WebTest/Contact/DeceasedContactsAdvancedSearchTest.php index ef49d038f0..49d8f39c4b 100644 --- a/tests/phpunit/WebTest/Contact/DeceasedContactsAdvancedSearchTest.php +++ b/tests/phpunit/WebTest/Contact/DeceasedContactsAdvancedSearchTest.php @@ -62,11 +62,7 @@ class WebTest_Contact_DeceasedContactsAdvancedSearchTest extends CiviSeleniumTes $this->click('demographics'); $this->waitForElementPresent('CIVICRM_QFID_1_is_deceased'); $this->click('CIVICRM_QFID_1_is_deceased'); - $this->click('_qf_Advanced_refresh'); - $this->waitForPageToLoad($this->getTimeoutMsec()); - - // Remove contacts from group - $this->waitForElementPresent('Go'); + $this->clickLink('_qf_Advanced_refresh', 'Go'); $this->assertElementContainsText('search-status', '2 Contacts'); $this->click("toggleSelect"); $this->waitForTextPresent('2 Selected records only'); diff --git a/tests/phpunit/WebTest/Contact/InlineFieldsEditTest.php b/tests/phpunit/WebTest/Contact/InlineFieldsEditTest.php index 8b7fcf5e43..f4d4a4297b 100644 --- a/tests/phpunit/WebTest/Contact/InlineFieldsEditTest.php +++ b/tests/phpunit/WebTest/Contact/InlineFieldsEditTest.php @@ -142,9 +142,7 @@ class WebTest_Contact_InlineFieldsEditTest extends CiviSeleniumTestCase { $this->type('organization_name', $orgName); $this->type('street_address-1', 'Test Org Street'); $this->type('city-1', 'Test Org City'); - $this->click('_qf_Edit_next'); - $this->waitForPageToLoad($this->getTimeoutMsec()); - $this->waitForElementPresent('selected_shared_address-2'); + $this->clickLink('_qf_Edit_next', 'selected_shared_address-2'); $this->waitForTextPresent('Test Org Street'); $this->inlineEdit('address-block-2', array( 'address_2_location_type_id' => array('Work'), diff --git a/tests/phpunit/WebTest/Contact/MergeContactsTest.php b/tests/phpunit/WebTest/Contact/MergeContactsTest.php index 771bacbca9..eaf9642713 100644 --- a/tests/phpunit/WebTest/Contact/MergeContactsTest.php +++ b/tests/phpunit/WebTest/Contact/MergeContactsTest.php @@ -138,9 +138,7 @@ class WebTest_Contact_MergeContactsTest extends CiviSeleniumTestCase { $this->click("xpath=//a[text()='$firstName $lastName']/../../td[4]/a[text()='merge']"); $this->waitForElementPresent('_qf_Merge_cancel-bottom'); - $this->click("css=div.crm-contact-merge-form-block div.action-link a"); - $this->waitForPageToLoad($this->getTimeoutMsec()); - $this->waitForElementPresent('_qf_Merge_cancel-bottom'); + $this->clickLink("css=div.crm-contact-merge-form-block div.action-link a", '_qf_Merge_cancel-bottom'); // Move the activities, groups, etc to the main contact and merge using Merge and Goto Next Pair $this->check('move_prefix_id'); @@ -148,9 +146,7 @@ class WebTest_Contact_MergeContactsTest extends CiviSeleniumTestCase { $this->check('move_rel_table_activities'); $this->check('move_rel_table_groups'); $this->check('move_rel_table_tags'); - $this->click('_qf_Merge_next-bottom'); - $this->waitForPageToLoad($this->getTimeoutMsec()); - $this->waitForElementPresent('_qf_Merge_cancel-bottom'); + $this->clickLink('_qf_Merge_next-bottom', '_qf_Merge_cancel-bottom'); $this->assertTrue($this->isTextPresent('Contacts Merged'), "Contacts Merged text was not found after merge."); // Check that we are viewing the next Merge Pair (our 2nd contact, since the merge list is ordered by contact_id) @@ -342,9 +338,7 @@ class WebTest_Contact_MergeContactsTest extends CiviSeleniumTestCase { $this->waitForElementPresent("xpath=//a[text()='$firstName $lastName']"); $this->click("xpath=//a[text()='$firstName $lastName']/../../td[4]/a[text()='merge']"); $this->waitForElementPresent('_qf_Merge_cancel-bottom'); - $this->click("css=div.crm-contact-merge-form-block div.action-link a"); - $this->waitForPageToLoad($this->getTimeoutMsec()); - $this->waitForElementPresent("xpath=//form[@id='Merge']/div[2]/table/tbody/tr[2]/td[4]/span[text()='(overwrite)']"); + $this->clickLink("css=div.crm-contact-merge-form-block div.action-link a", "xpath=//form[@id='Merge']/div[2]/table/tbody/tr[2]/td[4]/span[text()='(overwrite)']"); $this->waitForElementPresent("xpath=//form[@id='Merge']/div[2]/table/tbody/tr[3]/td[4]/span[text()='(add)']"); $this->waitForElementPresent('_qf_Merge_cancel-bottom'); @@ -433,9 +427,7 @@ class WebTest_Contact_MergeContactsTest extends CiviSeleniumTestCase { $this->waitForElementPresent("xpath=//table[@class='pagerDisplay']/tbody//tr/td[1]/a[text()='$firstName1 $lastName1']/../../td[2]/a[text()='$firstName1 $lastName1']"); $this->click("xpath=//table[@class='pagerDisplay']/tbody//tr/td[1]/a[text()='$firstName1 $lastName1']/../../td[2]/a[text()='$firstName1 $lastName1']/../../td[4]/a[text()='merge']"); $this->waitForElementPresent('_qf_Merge_cancel-bottom'); - $this->click("css=div.crm-contact-merge-form-block div.action-link a"); - $this->waitForPageToLoad($this->getTimeoutMsec()); - $this->waitForElementPresent("xpath=//form[@id='Merge']/div[2]/table/tbody/tr[2]/td[4]/span[text()='(overwrite)']"); + $this->clickLink("css=div.crm-contact-merge-form-block div.action-link a", "xpath=//form[@id='Merge']/div[2]/table/tbody/tr[2]/td[4]/span[text()='(overwrite)']"); $this->waitForElementPresent("xpath=//form[@id='Merge']/div[2]/table/tbody/tr[3]/td[4]/span[text()='(add)']"); $this->waitForElementPresent("xpath=//form[@id='Merge']/div[2]/table/tbody/tr[4]/td[4]/span[text()='(overwrite)']"); $this->select('location_email_1_locTypeId', 'value=3'); @@ -594,9 +586,7 @@ class WebTest_Contact_MergeContactsTest extends CiviSeleniumTestCase { $this->waitForElementPresent("css=div.ac_results-inner li"); // Visit contact summary page. - $this->click("css=div.ac_results-inner li"); - $this->waitForPageToLoad($this->getTimeoutMsec()); - $this->waitForElementPresent('civicrm-footer'); + $this->clickLink("css=div.ac_results-inner li", 'civicrm-footer'); } } diff --git a/tests/phpunit/WebTest/Contact/SearchBuilderTest.php b/tests/phpunit/WebTest/Contact/SearchBuilderTest.php index c9c2bac270..0802fc1ef4 100644 --- a/tests/phpunit/WebTest/Contact/SearchBuilderTest.php +++ b/tests/phpunit/WebTest/Contact/SearchBuilderTest.php @@ -386,9 +386,7 @@ class WebTest_Contact_SearchBuilderTest extends CiviSeleniumTestCase { $this->webtestNewDialogContact($firstName, 'Contributor', $firstName . '@example.com'); $this->select('financial_type_id', $financialType); $this->type('total_amount', 100 * $i); - $this->click('_qf_Contribution_upload_new'); - $this->waitForPageToLoad($this->getTimeoutMsec()); - $this->waitForElementPresent('_qf_Contribution_upload_new'); + $this->clickLink('_qf_Contribution_upload_new', '_qf_Contribution_upload_new'); } $this->openCiviPage("contact/search/builder", "reset=1", "_qf_Builder_refresh"); diff --git a/tests/phpunit/WebTest/Contact/SearchTest.php b/tests/phpunit/WebTest/Contact/SearchTest.php index 6b0bd3f47d..61fad92512 100644 --- a/tests/phpunit/WebTest/Contact/SearchTest.php +++ b/tests/phpunit/WebTest/Contact/SearchTest.php @@ -78,14 +78,10 @@ class WebTest_Contact_SearchTest extends CiviSeleniumTestCase { $this->type("css=input#sort_name_navigation", 'ada'); $this->typeKeys("css=input#sort_name_navigation", 'ada'); - $this->click("_qf_Basic_refresh"); + $this->clickLink("_qf_Basic_refresh"); - // wait for result list - $this->waitForPageToLoad($this->getTimeoutMsec()); // make sure we're on search results page $this->waitForElementPresent("alpha-filter"); - // wait for bottom of page to load (access is in footer) - $this->waitForElementPresent("access"); // Is contact present in search result? $this->assertElementContainsText('css=.crm-search-results > table.row-highlight', $sortName); diff --git a/tests/phpunit/WebTest/Contact/SignatureTest.php b/tests/phpunit/WebTest/Contact/SignatureTest.php index 577a2d0282..a4943857a4 100644 --- a/tests/phpunit/WebTest/Contact/SignatureTest.php +++ b/tests/phpunit/WebTest/Contact/SignatureTest.php @@ -68,9 +68,7 @@ class WebTest_Contact_SignatureTest extends CiviSeleniumTestCase { // Go for Ckeck Your Editor, Click on Send Mail $this->click("//a[@id='crm-contact-actions-link']/span"); - $this->click('link=Send an Email'); - $this->waitForPageToLoad($this->getTimeoutMsec()); - $this->waitForElementPresent('subject'); + $this->clickLink('link=Send an Email', 'subject'); $this->click('subject'); $subject = 'Subject_' . substr(sha1(rand()), 0, 8); @@ -126,9 +124,7 @@ class WebTest_Contact_SignatureTest extends CiviSeleniumTestCase { // Go for Ckeck Your Editor, Click on Send Mail $this->click("//a[@id='crm-contact-actions-link']/span"); - $this->click('link=Send an Email'); - $this->waitForPageToLoad($this->getTimeoutMsec()); - $this->waitForElementPresent('subject'); + $this->clickLink('link=Send an Email', 'subject'); $this->click('subject'); $subject = 'Subject_' . substr(sha1(rand()), 0, 7); @@ -183,14 +179,10 @@ class WebTest_Contact_SignatureTest extends CiviSeleniumTestCase { $this->type('activity_subject', $subject); - $this->click('_qf_Search_refresh'); - $this->waitForPageToLoad($this->getTimeoutMsec()); - $this->waitForElementPresent('Search'); + $this->clickLink('_qf_Search_refresh', 'Search'); // View your Activity - $this->click("xpath=id('Search')/div[3]/div/div[2]/table/tbody/tr[2]/td[9]/span/a[text()='View']"); - $this->waitForPageToLoad($this->getTimeoutMsec()); - $this->waitForElementPresent('_qf_ActivityView_next-bottom'); + $this->clickLink("xpath=id('Search')/div[3]/div/div[2]/table/tbody/tr[2]/td[9]/span/a[text()='View']", '_qf_ActivityView_next-bottom'); // Is signature correct? in Activity $this->assertTextPresent($signature); diff --git a/tests/phpunit/WebTest/Contact/TaskActionSendMassMailing.php b/tests/phpunit/WebTest/Contact/TaskActionSendMassMailing.php index d6f4ee6d48..2362f4887d 100644 --- a/tests/phpunit/WebTest/Contact/TaskActionSendMassMailing.php +++ b/tests/phpunit/WebTest/Contact/TaskActionSendMassMailing.php @@ -35,37 +35,17 @@ class WebTest_Contact_TaskActionSendMassMailing extends CiviSeleniumTestCase { function testSelectedContacts() { $this->webtestLogin(); - $this->openCiviPage('group/add', 'reset=1', "_qf_Edit_upload"); - - // make group name + // make group $groupName = 'group_' . substr(sha1(rand()), 0, 7); - - // fill group name - $this->type("title", $groupName); - - // fill description - $this->type("description", "New mailing group for Webtest"); - - // enable Mailing List - $this->click("group_type[2]"); - - // select Visibility as Public Pages - $this->select("visibility", "value=Public Pages"); - - // Clicking save. - $this->click("_qf_Edit_upload"); - $this->waitForPageToLoad($this->getTimeoutMsec()); + $this->WebtestAddGroup($groupName); // Use class names for menu items since li array can change based on which components are enabled $this->click("css=ul#civicrm-menu li.crm-Search"); - $this->click("css=ul#civicrm-menu li.crm-Advanced_Search a"); + $this->clickLink("css=ul#civicrm-menu li.crm-Advanced_Search a", "email"); - $this->waitForPageToLoad($this->getTimeoutMsec()); - $this->waitForElementPresent("email"); $this->click("_qf_Advanced_refresh"); $this->waitForPageToLoad($this->getTimeoutMsec()); - // Click "check all" box and act on "Add to group" action $this->click("//form[@id='Advanced']/div[3]/div/div[2]/table/thead/tr/th[1]/input"); $this->select("task", "label=Schedule/Send a Mass Mailing"); diff --git a/tests/phpunit/WebTest/Contact/TaskActionSendSMS.php b/tests/phpunit/WebTest/Contact/TaskActionSendSMS.php index de62e62bad..8e1a36074c 100644 --- a/tests/phpunit/WebTest/Contact/TaskActionSendSMS.php +++ b/tests/phpunit/WebTest/Contact/TaskActionSendSMS.php @@ -97,25 +97,16 @@ class WebTest_Contact_TaskActionSendSMS extends CiviSeleniumTestCase { // Do an advanced search $this->click("css=ul#civicrm-menu li.crm-Search"); - $this->click("css=ul#civicrm-menu li.crm-Advanced_Search a"); - - $this->waitForPageToLoad($this->getTimeoutMsec()); - $this->waitForElementPresent("email"); + $this->clickLink("css=ul#civicrm-menu li.crm-Advanced_Search a", "email"); $this->select("crmasmSelect1", "label=$smsGroupName"); - $this->click("_qf_Advanced_refresh"); - $this->waitForPageToLoad($this->getTimeoutMsec()); - - $this->waitForElementPresent('CIVICRM_QFID_ts_all_12'); + $this->clickLink("_qf_Advanced_refresh", 'CIVICRM_QFID_ts_all_12'); $this->click('CIVICRM_QFID_ts_all_12'); // Perform a task action $this->select("task", "label=Send SMS to Contacts"); - $this->click("Go"); - $this->waitForPageToLoad($this->getTimeoutMsec()); - - $this->waitForElementPresent('activity_subject'); + $this->clickLink("Go", 'activity_subject'); $this->type('activity_subject', "Send SMS to Contacts of {$smsGroupName}"); $this->type('text_message', "Test SMS to Contacts of {$smsGroupName}"); $this->click("_qf_SMS_upload-bottom"); diff --git a/tests/phpunit/WebTest/Contribute/AddBatchesTest.php b/tests/phpunit/WebTest/Contribute/AddBatchesTest.php index baab533d6d..b56f1edb36 100644 --- a/tests/phpunit/WebTest/Contribute/AddBatchesTest.php +++ b/tests/phpunit/WebTest/Contribute/AddBatchesTest.php @@ -134,13 +134,8 @@ class WebTest_Contribute_AddBatchesTest extends CiviSeleniumTestCase { if ($type == "Contribution") { $this->openCiviPage("contribute/search", "reset=1", "contribution_date_low"); $this->type("sort_name", "{$data['first_name']} {$data['last_name']}"); - $this->click("_qf_Search_refresh"); - $this->waitForPageToLoad($this->getTimeoutMsec()); - - $this->waitForElementPresent("xpath=//div[@id='contributionSearch']//table//tbody/tr[1]/td[11]/span/a[text()='View']"); - $this->click("xpath=//div[@id='contributionSearch']//table//tbody/tr[1]/td[11]/span/a[text()='View']"); - $this->waitForPageToLoad($this->getTimeoutMsec()); - $this->waitForElementPresent("_qf_ContributionView_cancel-bottom"); + $this->clickLink("_qf_Search_refresh", "xpath=//div[@id='contributionSearch']//table//tbody/tr[1]/td[11]/span/a[text()='View']"); + $this->clickLink("xpath=//div[@id='contributionSearch']//table//tbody/tr[1]/td[11]/span/a[text()='View']", "_qf_ContributionView_cancel-bottom"); $expected = array( 'From' => "{$data['first_name']} {$data['last_name']}", 'Financial Type' => $data['financial_type'], @@ -154,11 +149,7 @@ class WebTest_Contribute_AddBatchesTest extends CiviSeleniumTestCase { // select contact $this->type("sort_name", "{$data['first_name']} {$data['last_name']}"); - $this->click("_qf_Search_refresh"); - $this->waitForPageToLoad($this->getTimeoutMsec()); - - //View Membership - $this->waitForElementPresent("xpath=//div[@id='memberSearch']//table//tbody/tr[1]/td[11]/span/a[text()='View']"); + $this->clickLink("_qf_Search_refresh", "xpath=//div[@id='memberSearch']//table//tbody/tr[1]/td[11]/span/a[text()='View']"); $this->click("xpath=//div[@id='memberSearch']//table/tbody/tr[1]/td[11]/span/a[text()='View']"); $this->waitForElementPresent("_qf_MembershipView_cancel-bottom"); $expected = array( @@ -184,9 +175,7 @@ class WebTest_Contribute_AddBatchesTest extends CiviSeleniumTestCase { function _verifyData($data, $type) { $this->waitForElementPresent("xpath=//div[@id='crm-batch-selector_wrapper']//table//tbody/tr[1]/td[7]/span/a[text()='Enter records']"); - $this->click("xpath=//div[@id='crm-batch-selector_wrapper']//table//tbody/tr[1]/td[7]/span/a[text()='Enter records']"); - $this->waitForPageToLoad($this->getTimeoutMsec()); - $this->waitForElementPresent("_qf_Entry_upload"); + $this->clickLink("xpath=//div[@id='crm-batch-selector_wrapper']//table//tbody/tr[1]/td[7]/span/a[text()='Enter records']", "_qf_Entry_upload"); $this->click("_qf_Entry_upload"); $this->waitForPageToLoad($this->getTimeoutMsec()); foreach ($data as $value) { diff --git a/tests/phpunit/WebTest/Contribute/AddPricesetTest.php b/tests/phpunit/WebTest/Contribute/AddPricesetTest.php index 88da4c392d..8a171f0790 100644 --- a/tests/phpunit/WebTest/Contribute/AddPricesetTest.php +++ b/tests/phpunit/WebTest/Contribute/AddPricesetTest.php @@ -84,10 +84,7 @@ class WebTest_Contribute_AddPricesetTest extends CiviSeleniumTestCase { $this->type('help_pre', $setHelp); $this->assertChecked('is_active', 'Verify that Is Active checkbox is set.'); - $this->click('_qf_Set_next-bottom'); - - $this->waitForPageToLoad($this->getTimeoutMsec()); - $this->waitForElementPresent('_qf_Field_next-bottom'); + $this->clickLink('_qf_Set_next-bottom', '_qf_Field_next-bottom'); } function _testAddPriceFields(&$fields, &$validateString, $financialType, $dateSpecificFields = FALSE) { @@ -163,9 +160,7 @@ class WebTest_Contribute_AddPricesetTest extends CiviSeleniumTestCase { break; } $this->select('financial_type_id', "label={$financialType}"); - $this->click('_qf_Field_next_new-bottom'); - $this->waitForPageToLoad($this->getTimeoutMsec()); - $this->waitForElementPresent('_qf_Field_next-bottom'); + $this->clickLink('_qf_Field_next_new-bottom', '_qf_Field_next-bottom'); } } @@ -230,11 +225,7 @@ class WebTest_Contribute_AddPricesetTest extends CiviSeleniumTestCase { $this->openCiviPage("admin/price", "reset=1"); // Use the price set id ($sid) to pick the correct row - $this->click("css=tr#row_{$sid} a[title='View and Edit Price Fields']"); - - $this->waitForPageToLoad($this->getTimeoutMsec()); - // Look for Register button - $this->waitForElementPresent('Link=Add Price Field'); + $this->clickLink("css=tr#row_{$sid} a[title='View and Edit Price Fields']", 'Link=Add Price Field'); // Check for expected price set field strings $this->assertStringsPresent($validateStrings); } @@ -438,10 +429,7 @@ class WebTest_Contribute_AddPricesetTest extends CiviSeleniumTestCase { $this->select('billing_country_id-5', 'value=1228'); $this->select('billing_state_province_id-5', 'value=1004'); $this->type('billing_postal_code-5', '94129'); - $this->click('_qf_Main_upload-bottom'); - - $this->waitForPageToLoad($this->getTimeoutMsec()); - $this->waitForElementPresent('_qf_Confirm_next-bottom'); + $this->clickLink('_qf_Main_upload-bottom', '_qf_Confirm_next-bottom'); $this->click('_qf_Confirm_next-bottom'); $this->waitForPageToLoad($this->getTimeoutMsec()); @@ -455,14 +443,8 @@ class WebTest_Contribute_AddPricesetTest extends CiviSeleniumTestCase { $this->openCiviPage("contribute/search", "reset=1", 'contribution_date_low'); $this->type('sort_name', "$firstName $lastName"); - $this->click('_qf_Search_refresh'); - - $this->waitForPageToLoad($this->getTimeoutMsec()); - - $this->waitForElementPresent("xpath=//div[@id='contributionSearch']//table//tbody/tr[1]/td[11]/span/a[text()='View']"); - $this->click("xpath=//div[@id='contributionSearch']//table//tbody/tr[1]/td[11]/span/a[text()='View']"); - $this->waitForPageToLoad($this->getTimeoutMsec()); - $this->waitForElementPresent("_qf_ContributionView_cancel-bottom"); + $this->clickLink('_qf_Search_refresh', "xpath=//div[@id='contributionSearch']//table//tbody/tr[1]/td[11]/span/a[text()='View']"); + $this->clickLink("xpath=//div[@id='contributionSearch']//table//tbody/tr[1]/td[11]/span/a[text()='View']", "_qf_ContributionView_cancel-bottom"); // View Contribution Record and test for expected values $expected = array( @@ -566,10 +548,7 @@ class WebTest_Contribute_AddPricesetTest extends CiviSeleniumTestCase { $this->select('billing_country_id-5', 'value=1228'); $this->select('billing_state_province_id-5', 'value=1004'); $this->type('billing_postal_code-5', '94129'); - $this->click('_qf_Main_upload-bottom'); - - $this->waitForPageToLoad($this->getTimeoutMsec()); - $this->waitForElementPresent('_qf_Confirm_next-bottom'); + $this->clickLink('_qf_Main_upload-bottom', '_qf_Confirm_next-bottom'); $this->click('_qf_Confirm_next-bottom'); $this->waitForPageToLoad($this->getTimeoutMsec()); @@ -581,14 +560,8 @@ class WebTest_Contribute_AddPricesetTest extends CiviSeleniumTestCase { $this->openCiviPage("contribute/search", "reset=1", 'contribution_date_low'); $this->type('sort_name', "$firstName $lastName"); - $this->click('_qf_Search_refresh'); - - $this->waitForPageToLoad($this->getTimeoutMsec()); - - $this->waitForElementPresent("xpath=//div[@id='contributionSearch']//table//tbody/tr[1]/td[11]/span/a[text()='View']"); - $this->click("xpath=//div[@id='contributionSearch']//table//tbody/tr[1]/td[11]/span/a[text()='View']"); - $this->waitForPageToLoad($this->getTimeoutMsec()); - $this->waitForElementPresent('_qf_ContributionView_cancel-bottom'); + $this->clickLink('_qf_Search_refresh', "xpath=//div[@id='contributionSearch']//table//tbody/tr[1]/td[11]/span/a[text()='View']"); + $this->clickLink("xpath=//div[@id='contributionSearch']//table//tbody/tr[1]/td[11]/span/a[text()='View']", '_qf_ContributionView_cancel-bottom'); // View Contribution Record and test for expected values $expected = array( @@ -677,11 +650,7 @@ class WebTest_Contribute_AddPricesetTest extends CiviSeleniumTestCase { $this->webtestFillDate('thankyou_date'); // Clicking save. - $this->click('_qf_Contribution_upload'); - $this->waitForPageToLoad($this->getTimeoutMsec()); - - // Is status message correct? - $this->waitForElementPresent("xpath=//div[@id='Contributions']//table//tbody/tr[1]/td[8]/span/a[text()='View']"); + $this->clickLink('_qf_Contribution_upload', "xpath=//div[@id='Contributions']//table//tbody/tr[1]/td[8]/span/a[text()='View']"); $this->assertTrue($this->isTextPresent('The contribution record has been saved.'), "Status message didn't show up after saving!"); //click through to the Contribution view screen diff --git a/tests/phpunit/WebTest/Contribute/ContactContextAddTest.php b/tests/phpunit/WebTest/Contribute/ContactContextAddTest.php index ef66abe8a5..6869140ced 100644 --- a/tests/phpunit/WebTest/Contribute/ContactContextAddTest.php +++ b/tests/phpunit/WebTest/Contribute/ContactContextAddTest.php @@ -145,9 +145,7 @@ class WebTest_Contribute_ContactContextAddTest extends CiviSeleniumTestCase { $this->webtestFillDate('fulfilled_date'); // Clicking save. - $this->click("_qf_Contribution_upload-bottom"); - $this->waitForPageToLoad($this->getTimeoutMsec()); - $this->waitForElementPresent('civicrm-footer'); + $this->clickLink("_qf_Contribution_upload-bottom", 'civicrm-footer'); // Is status message correct? $this->assertElementContainsText('crm-notification-container', "The contribution record has been saved"); diff --git a/tests/phpunit/WebTest/Contribute/ContributionPageAddTest.php b/tests/phpunit/WebTest/Contribute/ContributionPageAddTest.php index 130ce7798c..e615587309 100644 --- a/tests/phpunit/WebTest/Contribute/ContributionPageAddTest.php +++ b/tests/phpunit/WebTest/Contribute/ContributionPageAddTest.php @@ -157,9 +157,7 @@ class WebTest_Contribute_ContributionPageAddTest extends CiviSeleniumTestCase { $this->type('first_name', $firstName); $this->type('last_name', $lastName); - $this->click('_qf_Main_upload-bottom'); - $this->waitForPageToLoad($this->getTimeoutMsec()); - $this->waitForElementPresent('_qf_Confirm_next-bottom'); + $this->clickLink('_qf_Main_upload-bottom', '_qf_Confirm_next-bottom'); $this->click('_qf_Confirm_next-bottom'); $this->waitForPageToLoad($this->getTimeoutMsec()); @@ -172,15 +170,8 @@ class WebTest_Contribute_ContributionPageAddTest extends CiviSeleniumTestCase { $this->type('sort_name', "$firstName $lastName"); $this->select('financial_type_id',"label=Member Dues"); - $this->click('_qf_Search_refresh'); - - $this->waitForPageToLoad($this->getTimeoutMsec()); - - //View Contribution for membership fee - $this->waitForElementPresent("xpath=//div[@id='contributionSearch']//table//tbody/tr[1]/td[11]/span/a[text()='View']"); - $this->click("xpath=//div[@id='contributionSearch']//table//tbody/tr[1]/td[11]/span/a[text()='View']"); - $this->waitForPageToLoad($this->getTimeoutMsec()); - $this->waitForElementPresent('_qf_ContributionView_cancel-bottom'); + $this->clickLink('_qf_Search_refresh', "xpath=//div[@id='contributionSearch']//table//tbody/tr[1]/td[11]/span/a[text()='View']"); + $this->clickLink("xpath=//div[@id='contributionSearch']//table//tbody/tr[1]/td[11]/span/a[text()='View']", '_qf_ContributionView_cancel-bottom'); $expected = array( 'From' => "{$firstName} {$lastName}", 'Financial Type' => 'Member Dues', @@ -196,14 +187,9 @@ class WebTest_Contribute_ContributionPageAddTest extends CiviSeleniumTestCase { $this->click("xpath=id('Search')/x:div[2]/x:div/x:div[1]"); $this->waitForElementPresent("financial_type_id"); $this->select('financial_type_id',"label=Donation"); - $this->click('_qf_Search_refresh'); + $this->clickLink('_qf_Search_refresh', "xpath=//div[@id='contributionSearch']//table//tbody/tr[1]/td[11]/span/a[text()='View']"); - $this->waitForPageToLoad($this->getTimeoutMsec()); - $this->waitForElementPresent("xpath=//div[@id='contributionSearch']//table//tbody/tr[1]/td[11]/span/a[text()='View']"); - - $this->click("xpath=//div[@id='contributionSearch']//table//tbody/tr[1]/td[11]/span/a[text()='View']"); - $this->waitForPageToLoad($this->getTimeoutMsec()); - $this->waitForElementPresent('_qf_ContributionView_cancel-bottom'); + $this->clickLink("xpath=//div[@id='contributionSearch']//table//tbody/tr[1]/td[11]/span/a[text()='View']", '_qf_ContributionView_cancel-bottom'); $expected = array( 'From' => "{$firstName} {$lastName}", 'Financial Type' => 'Donation', @@ -216,14 +202,8 @@ class WebTest_Contribute_ContributionPageAddTest extends CiviSeleniumTestCase { //Find Member $this->openCiviPage("member/search", "reset=1", 'member_source'); $this->type('sort_name', "$firstName $lastName"); - $this->click('_qf_Search_refresh'); - $this->waitForPageToLoad($this->getTimeoutMsec()); - - //visit the Member View link - $this->waitForElementPresent("xpath=//div[@id='memberSearch']//table//tbody/tr[1]/td[11]/span/a[text()='View']"); - $this->click("xpath=//div[@id='memberSearch']//table//tbody/tr[1]/td[11]/span/a[text()='View']"); - $this->waitForPageToLoad($this->getTimeoutMsec()); - $this->waitForElementPresent('_qf_MembershipView_cancel-bottom'); + $this->clickLink('_qf_Search_refresh', "xpath=//div[@id='memberSearch']//table//tbody/tr[1]/td[11]/span/a[text()='View']"); + $this->clickLink("xpath=//div[@id='memberSearch']//table//tbody/tr[1]/td[11]/span/a[text()='View']", '_qf_MembershipView_cancel-bottom'); //View Membership Record $expected = array( diff --git a/tests/phpunit/WebTest/Contribute/OnBehalfOfOrganization.php b/tests/phpunit/WebTest/Contribute/OnBehalfOfOrganization.php index e2549418b5..7859f78fe7 100644 --- a/tests/phpunit/WebTest/Contribute/OnBehalfOfOrganization.php +++ b/tests/phpunit/WebTest/Contribute/OnBehalfOfOrganization.php @@ -123,9 +123,7 @@ class WebTest_Contribute_OnBehalfOfOrganization extends CiviSeleniumTestCase { $this->waitForElementPresent("_qf_Edit_next"); $this->type("first_name", $firstName); $this->type("last_name", $lastName); - $this->click("_qf_Edit_next"); - $this->waitForPageToLoad($this->getTimeoutMsec()); - $this->waitForElementPresent("profilewrap4"); + $this->clickLink("_qf_Edit_next", "profilewrap4"); // Is status message correct? $this->assertTextPresent("Thank you. Your information has been saved.", "Save successful status message didn't show up after saving profile to update testUserName!"); @@ -454,9 +452,7 @@ class WebTest_Contribute_OnBehalfOfOrganization extends CiviSeleniumTestCase { $this->waitForElementPresent("_qf_Edit_next"); $this->type("first_name", $firstName); $this->type("last_name", $lastName); - $this->click("_qf_Edit_next"); - $this->waitForPageToLoad($this->getTimeoutMsec()); - $this->waitForElementPresent("profilewrap4"); + $this->clickLink("_qf_Edit_next", "profilewrap4"); $urlElements = $this->parseURL(); print_r($urlElements); @@ -588,11 +584,7 @@ class WebTest_Contribute_OnBehalfOfOrganization extends CiviSeleniumTestCase { $this->select("onbehalf_state_province-3", "label=Alabama"); $this->waitForElementPresent("_qf_Main_upload-bottom"); - $this->click("_qf_Main_upload-bottom"); - - $this->waitForPageToLoad($this->getTimeoutMsec()); - - $this->waitForElementPresent("_qf_Confirm_next-bottom"); + $this->clickLink("_qf_Main_upload-bottom", "_qf_Confirm_next-bottom"); $this->click("_qf_Confirm_next-bottom"); $this->waitForPageToLoad($this->getTimeoutMsec()); @@ -643,10 +635,7 @@ class WebTest_Contribute_OnBehalfOfOrganization extends CiviSeleniumTestCase { $this->select("billing_country_id-5", "value=1228"); $this->select("billing_state_province_id-5", "value=1004"); $this->type("billing_postal_code-5", "94129"); - $this->click("_qf_Main_upload-bottom"); - - $this->waitForPageToLoad($this->getTimeoutMsec()); - $this->waitForElementPresent("_qf_Confirm_next-bottom"); + $this->clickLink("_qf_Main_upload-bottom", "_qf_Confirm_next-bottom"); $this->click("_qf_Confirm_next-bottom"); $this->waitForPageToLoad($this->getTimeoutMsec()); @@ -659,14 +648,8 @@ class WebTest_Contribute_OnBehalfOfOrganization extends CiviSeleniumTestCase { //Find Contribution $this->openCiviPage("contribute/search", "reset=1"); $this->type("sort_name", $orgName); - $this->click("_qf_Search_refresh"); - - $this->waitForPageToLoad($this->getTimeoutMsec()); - - $this->waitForElementPresent("xpath=//div[@id='contributionSearch']//table//tbody/tr[1]/td[11]/span/a[text()='View']"); - $this->click("xpath=//div[@id='contributionSearch']//table//tbody/tr[1]/td[11]/span/a[text()='View']"); - $this->waitForPageToLoad($this->getTimeoutMsec()); - $this->waitForElementPresent("_qf_ContributionView_cancel-bottom"); + $this->clickLink("_qf_Search_refresh", "xpath=//div[@id='contributionSearch']//table//tbody/tr[1]/td[11]/span/a[text()='View']"); + $this->clickLink("xpath=//div[@id='contributionSearch']//table//tbody/tr[1]/td[11]/span/a[text()='View']", "_qf_ContributionView_cancel-bottom"); // verify contrb created $expected = array( @@ -879,21 +862,15 @@ class WebTest_Contribute_OnBehalfOfOrganization extends CiviSeleniumTestCase { $this->select("billing_state_province_id-5", "value=1004"); $this->type("billing_postal_code-5", "94129"); - $this->click("_qf_Main_upload-bottom"); - $this->waitForPageToLoad($this->getTimeoutMsec()); - $this->waitForElementPresent("_qf_Confirm_next-bottom"); + $this->clickLink("_qf_Main_upload-bottom", "_qf_Confirm_next-bottom"); $this->click("_qf_Confirm_next-bottom"); $this->waitForPageToLoad($this->getTimeoutMsec()); //Find Contribution $this->openCiviPage("contribute/search", "reset=1"); $this->type("sort_name", $orgName1); - $this->click("_qf_Search_refresh"); - $this->waitForPageToLoad($this->getTimeoutMsec()); - $this->waitForElementPresent("xpath=//div[@id='contributionSearch']//table//tbody/tr[1]/td[11]/span/a[text()='View']"); - $this->click("xpath=//div[@id='contributionSearch']//table//tbody/tr[1]/td[11]/span/a[text()='View']"); - $this->waitForPageToLoad($this->getTimeoutMsec()); - $this->waitForElementPresent("_qf_ContributionView_cancel-bottom"); + $this->clickLink("_qf_Search_refresh", "xpath=//div[@id='contributionSearch']//table//tbody/tr[1]/td[11]/span/a[text()='View']"); + $this->clickLink("xpath=//div[@id='contributionSearch']//table//tbody/tr[1]/td[11]/span/a[text()='View']", "_qf_ContributionView_cancel-bottom"); // verify contrb created $expected = array( @@ -1042,9 +1019,7 @@ class WebTest_Contribute_OnBehalfOfOrganization extends CiviSeleniumTestCase { $this->select('field_name[0]', 'value=Membership'); $this->select('field_name[1]', 'label=Campaign'); $this->click('field_name[1]'); - $this->click('_qf_Field_next_new-bottom'); - $this->waitForPageToLoad($this->getTimeoutMsec()); - $this->waitForElementPresent('_qf_Field_cancel-bottom'); + $this->clickLink('_qf_Field_next_new-bottom', '_qf_Field_cancel-bottom'); $this->select('field_name[0]', 'value=Membership'); $this->select('field_name[1]', "label=$fieldTitle :: $groupTitle"); @@ -1232,21 +1207,15 @@ class WebTest_Contribute_OnBehalfOfOrganization extends CiviSeleniumTestCase { $this->select("credit_card_exp_date[M]", "value=1"); $this->select("credit_card_exp_date[Y]", "value=2020"); - $this->click("_qf_Main_upload-bottom"); - $this->waitForPageToLoad($this->getTimeoutMsec()); - $this->waitForElementPresent("_qf_Confirm_next-bottom"); + $this->clickLink("_qf_Main_upload-bottom", "_qf_Confirm_next-bottom"); $this->click("_qf_Confirm_next-bottom"); $this->waitForPageToLoad($this->getTimeoutMsec()); //Find Membership for organization $this->openCiviPage("member/search", "reset=1"); $this->type("sort_name", $orgName1); - $this->click("_qf_Search_refresh"); - $this->waitForPageToLoad($this->getTimeoutMsec()); - $this->waitForElementPresent("xpath=//div[@id='memberSearch']//table//tbody/tr[1]/td[11]/span/a[text()='View']"); - $this->click("xpath=//div[@id='memberSearch']//table//tbody/tr[1]/td[11]/span/a[text()='View']"); - $this->waitForPageToLoad($this->getTimeoutMsec()); - $this->waitForElementPresent("_qf_MembershipView_cancel-bottom"); + $this->clickLink("_qf_Search_refresh", "xpath=//div[@id='memberSearch']//table//tbody/tr[1]/td[11]/span/a[text()='View']"); + $this->clickLink("xpath=//div[@id='memberSearch']//table//tbody/tr[1]/td[11]/span/a[text()='View']", "_qf_MembershipView_cancel-bottom"); //verify contrb created $expected = array( @@ -1326,9 +1295,7 @@ class WebTest_Contribute_OnBehalfOfOrganization extends CiviSeleniumTestCase { $this->waitForElementPresent("_qf_Edit_next"); $this->type("first_name", $firstName); $this->type("last_name", $lastName); - $this->click("_qf_Edit_next"); - $this->waitForPageToLoad($this->getTimeoutMsec()); - $this->waitForElementPresent("profilewrap4"); + $this->clickLink("_qf_Edit_next", "profilewrap4"); $urlElements = $this->parseURL(); $cid = $urlElements['queryString']['id']; @@ -1465,10 +1432,7 @@ class WebTest_Contribute_OnBehalfOfOrganization extends CiviSeleniumTestCase { $this->select("billing_country_id-5", "value=1228"); $this->select("billing_state_province_id-5", "value=1004"); $this->type("billing_postal_code-5", "94129"); - $this->click("_qf_Main_upload-bottom"); - - $this->waitForPageToLoad($this->getTimeoutMsec()); - $this->waitForElementPresent("_qf_Confirm_next-bottom"); + $this->clickLink("_qf_Main_upload-bottom", "_qf_Confirm_next-bottom"); $this->click("_qf_Confirm_next-bottom"); $this->waitForPageToLoad($this->getTimeoutMsec()); diff --git a/tests/phpunit/WebTest/Contribute/OnlineContributionTest.php b/tests/phpunit/WebTest/Contribute/OnlineContributionTest.php index 63b9d64148..fa13a747e4 100644 --- a/tests/phpunit/WebTest/Contribute/OnlineContributionTest.php +++ b/tests/phpunit/WebTest/Contribute/OnlineContributionTest.php @@ -129,10 +129,7 @@ class WebTest_Contribute_OnlineContributionTest extends CiviSeleniumTestCase { $this->select("billing_country_id-5", "value=1228"); $this->select("billing_state_province_id-5", "value=1004"); $this->type("billing_postal_code-5", "94129"); - $this->click("_qf_Main_upload-bottom"); - - $this->waitForPageToLoad($this->getTimeoutMsec()); - $this->waitForElementPresent("_qf_Confirm_next-bottom"); + $this->clickLink("_qf_Main_upload-bottom", "_qf_Confirm_next-bottom"); $this->click("_qf_Confirm_next-bottom"); $this->waitForPageToLoad($this->getTimeoutMsec()); @@ -146,14 +143,8 @@ class WebTest_Contribute_OnlineContributionTest extends CiviSeleniumTestCase { $this->openCiviPage("contribute/search", "reset=1", "contribution_date_low"); $this->type("sort_name", "$firstName $lastName"); - $this->click("_qf_Search_refresh"); - - $this->waitForPageToLoad($this->getTimeoutMsec()); - - $this->waitForElementPresent("xpath=//div[@id='contributionSearch']//table//tbody/tr[1]/td[11]/span/a[text()='View']"); - $this->click("xpath=//div[@id='contributionSearch']//table//tbody/tr[1]/td[11]/span/a[text()='View']"); - $this->waitForPageToLoad($this->getTimeoutMsec()); - $this->waitForElementPresent("_qf_ContributionView_cancel-bottom"); + $this->clickLink("_qf_Search_refresh", "xpath=//div[@id='contributionSearch']//table//tbody/tr[1]/td[11]/span/a[text()='View']"); + $this->clickLink("xpath=//div[@id='contributionSearch']//table//tbody/tr[1]/td[11]/span/a[text()='View']", "_qf_ContributionView_cancel-bottom"); //View Contribution Record and verify data $expected = array( diff --git a/tests/phpunit/WebTest/Contribute/OnlineMultiplePaymentProcessorTest.php b/tests/phpunit/WebTest/Contribute/OnlineMultiplePaymentProcessorTest.php index 74802aac0c..b14fddf333 100644 --- a/tests/phpunit/WebTest/Contribute/OnlineMultiplePaymentProcessorTest.php +++ b/tests/phpunit/WebTest/Contribute/OnlineMultiplePaymentProcessorTest.php @@ -104,11 +104,7 @@ class WebTest_Contribute_OnlineMultiplePaymentProcessorTest extends CiviSelenium $this->select("billing_country_id-5", "value=1228"); $this->select("billing_state_province_id-5", "value=1004"); $this->type("billing_postal_code-5", "94129"); - $this->click("_qf_Main_upload-bottom"); - - $this->waitForPageToLoad($this->getTimeoutMsec()); - - $this->waitForElementPresent("_qf_Confirm_next-bottom"); + $this->clickLink("_qf_Main_upload-bottom", "_qf_Confirm_next-bottom"); $this->click("_qf_Confirm_next-bottom"); $this->waitForPageToLoad($this->getTimeoutMsec()); @@ -176,10 +172,7 @@ class WebTest_Contribute_OnlineMultiplePaymentProcessorTest extends CiviSelenium $xpath = "xpath=//label[text() = '{$payLaterText}']/preceding-sibling::input[1]"; $this->click($xpath); - $this->click("_qf_Main_upload-bottom"); - $this->waitForPageToLoad($this->getTimeoutMsec()); - - $this->waitForElementPresent("_qf_Confirm_next-bottom"); + $this->clickLink("_qf_Main_upload-bottom", "_qf_Confirm_next-bottom"); $payLaterInstructionsText = "Pay later instructions $hash"; $this->assertTrue($this->isTextPresent($payLaterInstructionsText)); @@ -194,14 +187,8 @@ class WebTest_Contribute_OnlineMultiplePaymentProcessorTest extends CiviSelenium $this->type('sort_name', "$firstName $lastName"); $this->check('contribution_test'); - $this->click('_qf_Search_refresh'); - - $this->waitForPageToLoad($this->getTimeoutMsec()); - - $this->waitForElementPresent("xpath=//div[@id='contributionSearch']//table//tbody/tr[1]/td[11]/span/a[text()='View']"); - $this->click("xpath=//div[@id='contributionSearch']//table//tbody/tr[1]/td[11]/span/a[text()='View']"); - $this->waitForPageToLoad($this->getTimeoutMsec()); - $this->waitForElementPresent('_qf_ContributionView_cancel-bottom'); + $this->clickLink('_qf_Search_refresh', "xpath=//div[@id='contributionSearch']//table//tbody/tr[1]/td[11]/span/a[text()='View']"); + $this->clickLink("xpath=//div[@id='contributionSearch']//table//tbody/tr[1]/td[11]/span/a[text()='View']", '_qf_ContributionView_cancel-bottom'); $expected = array( 'From' => "{$firstName} {$lastName}", 'Financial Type' => 'Donation', diff --git a/tests/phpunit/WebTest/Contribute/PCPAddTest.php b/tests/phpunit/WebTest/Contribute/PCPAddTest.php index d21749d6d8..ec854e7b61 100755 --- a/tests/phpunit/WebTest/Contribute/PCPAddTest.php +++ b/tests/phpunit/WebTest/Contribute/PCPAddTest.php @@ -110,9 +110,7 @@ class WebTest_Contribute_PCPAddTest extends CiviSeleniumTestCase { $this->webtestAddCreditCardDetails(); $this->webtestAddBillingDetails($firstName, $middleName, $lastName); - $this->click("_qf_Main_upload-bottom"); - $this->waitForPageToLoad($this->getTimeoutMsec()); - $this->waitForElementPresent("_qf_Confirm_next-bottom"); + $this->clickLink("_qf_Main_upload-bottom", "_qf_Confirm_next-bottom"); $this->click("_qf_Confirm_next-bottom"); $this->waitForElementPresent("thankyou_footer"); @@ -167,9 +165,7 @@ class WebTest_Contribute_PCPAddTest extends CiviSeleniumTestCase { $this->webtestAddCreditCardDetails(); $this->webtestAddBillingDetails($donorFirstName, $middleName, $donorLastName); - $this->click("_qf_Main_upload-bottom"); - $this->waitForPageToLoad($this->getTimeoutMsec()); - $this->waitForElementPresent("_qf_Confirm_next-bottom"); + $this->clickLink("_qf_Main_upload-bottom", "_qf_Confirm_next-bottom"); $this->click("_qf_Confirm_next-bottom"); $this->waitForElementPresent("thankyou_footer"); @@ -182,14 +178,8 @@ class WebTest_Contribute_PCPAddTest extends CiviSeleniumTestCase { $this->select('contribution_pcp_made_through_id', "label={$pcpTitle}"); - $this->click("_qf_Search_refresh"); - - $this->waitForPageToLoad($this->getTimeoutMsec()); - - $this->waitForElementPresent("xpath=//div[@id='contributionSearch']//table//tbody/tr[1]/td[11]/span/a[text()='View']"); - $this->click("xpath=//div[@id='contributionSearch']//table//tbody/tr[1]/td[11]/span/a[text()='View']"); - $this->waitForPageToLoad($this->getTimeoutMsec()); - $this->waitForElementPresent("_qf_ContributionView_cancel-bottom"); + $this->clickLink("_qf_Search_refresh", "xpath=//div[@id='contributionSearch']//table//tbody/tr[1]/td[11]/span/a[text()='View']"); + $this->clickLink("xpath=//div[@id='contributionSearch']//table//tbody/tr[1]/td[11]/span/a[text()='View']", "_qf_ContributionView_cancel-bottom"); // View Contribution Record and test for expected values $expected = array( diff --git a/tests/phpunit/WebTest/Contribute/UpdatePendingContributionTest.php b/tests/phpunit/WebTest/Contribute/UpdatePendingContributionTest.php index 8c81f556ee..eb9400a3ba 100644 --- a/tests/phpunit/WebTest/Contribute/UpdatePendingContributionTest.php +++ b/tests/phpunit/WebTest/Contribute/UpdatePendingContributionTest.php @@ -252,10 +252,7 @@ class WebTest_Contribute_UpdatePendingContributionTest extends CiviSeleniumTestC $this->select("country-1", "value=1228"); $this->select("state_province-1", "value=1001"); - $this->click("_qf_Main_upload-bottom"); - - $this->waitForPageToLoad($this->getTimeoutMsec()); - $this->waitForElementPresent("_qf_Confirm_next-bottom"); + $this->clickLink("_qf_Main_upload-bottom", "_qf_Confirm_next-bottom"); $this->click("_qf_Confirm_next-bottom"); $this->waitForPageToLoad($this->getTimeoutMsec()); @@ -267,14 +264,8 @@ class WebTest_Contribute_UpdatePendingContributionTest extends CiviSeleniumTestC $this->openCiviPage("contribute/search", "reset=1", "contribution_date_low"); $this->type("sort_name", "$lastName, $firstName"); - $this->click("_qf_Search_refresh"); - - $this->waitForPageToLoad($this->getTimeoutMsec()); - - $this->waitForElementPresent("xpath=//div[@id='contributionSearch']//table//tbody/tr[2]/td[11]/span/a[text()='View']"); - $this->click("xpath=//div[@id='contributionSearch']//table//tbody/tr[2]/td[11]/span/a[text()='View']"); - $this->waitForPageToLoad($this->getTimeoutMsec()); - $this->waitForElementPresent("_qf_ContributionView_cancel-bottom"); + $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"); // View Contribution Record and test for expected values $expected = array( 'From' => "{$firstName} {$lastName}", diff --git a/tests/phpunit/WebTest/Contribute/VerifySSLContributionTest.php b/tests/phpunit/WebTest/Contribute/VerifySSLContributionTest.php index 45735c2bc2..a2c360bcb4 100644 --- a/tests/phpunit/WebTest/Contribute/VerifySSLContributionTest.php +++ b/tests/phpunit/WebTest/Contribute/VerifySSLContributionTest.php @@ -118,9 +118,7 @@ class WebTest_Contribute_VerifySSLContributionTest extends CiviSeleniumTestCase } // submit contribution - $this->click("_qf_Main_upload-bottom"); - $this->waitForPageToLoad($this->getTimeoutMsec()); - $this->waitForElementPresent("_qf_Confirm_next-bottom"); + $this->clickLink("_qf_Main_upload-bottom", "_qf_Confirm_next-bottom"); // confirm contribution $this->click("_qf_Confirm_next-bottom"); diff --git a/tests/phpunit/WebTest/Event/AddEventTest.php b/tests/phpunit/WebTest/Event/AddEventTest.php index abee5ed6bd..8a07f2cfd1 100644 --- a/tests/phpunit/WebTest/Event/AddEventTest.php +++ b/tests/phpunit/WebTest/Event/AddEventTest.php @@ -422,9 +422,7 @@ class WebTest_Event_AddEventTest extends CiviSeleniumTestCase { $this->type("discount_name_1", $discount1); $this->webtestFillDate("discount_start_date_1", "-3 week"); $this->webtestFillDate("discount_end_date_1", "-2 week"); - $this->click("_qf_Fee_submit"); - $this->waitForPageToLoad($this->getTimeoutMsec()); - $this->waitForElementPresent("discounted_value_1_1"); + $this->clickLink("_qf_Fee_submit", "discounted_value_1_1"); $this->type("discounted_value_1_1","225.00"); $this->type("discounted_value_2_1","300.00"); @@ -436,9 +434,7 @@ class WebTest_Event_AddEventTest extends CiviSeleniumTestCase { $this->type("discount_name_2", $discount2); $this->webtestFillDate("discount_start_date_2", "-1 week"); $this->webtestFillDate("discount_end_date_2", "+1 week"); - $this->click("_qf_Fee_submit"); - $this->waitForPageToLoad($this->getTimeoutMsec()); - $this->waitForElementPresent("discounted_value_2_1"); + $this->clickLink("_qf_Fee_submit", "discounted_value_2_1"); $this->type("discounted_value_1_2","225.00"); $this->type("discounted_value_2_2","300.00"); } diff --git a/tests/phpunit/WebTest/Event/AddPricesetTest.php b/tests/phpunit/WebTest/Event/AddPricesetTest.php index 67bd75aa26..8f9044eb06 100644 --- a/tests/phpunit/WebTest/Event/AddPricesetTest.php +++ b/tests/phpunit/WebTest/Event/AddPricesetTest.php @@ -79,10 +79,7 @@ class WebTest_Event_AddPricesetTest extends CiviSeleniumTestCase { $this->type('help_pre', $setHelp); $this->assertChecked('is_active', 'Verify that Is Active checkbox is set.'); - $this->click('_qf_Set_next-bottom'); - - $this->waitForPageToLoad($this->getTimeoutMsec()); - $this->waitForElementPresent('_qf_Field_next-bottom'); + $this->clickLink('_qf_Set_next-bottom', '_qf_Field_next-bottom'); } function _testAddPriceFields(&$fields, &$validateStrings, $dateSpecificFields = FALSE) { @@ -163,9 +160,7 @@ class WebTest_Event_AddPricesetTest extends CiviSeleniumTestCase { default: break; } - $this->click('_qf_Field_next_new-bottom'); - $this->waitForPageToLoad($this->getTimeoutMsec()); - $this->waitForElementPresent('_qf_Field_next-bottom'); + $this->clickLink('_qf_Field_next_new-bottom', '_qf_Field_next-bottom'); } } @@ -175,11 +170,7 @@ class WebTest_Event_AddPricesetTest extends CiviSeleniumTestCase { $this->openCiviPage('admin/price', 'reset=1'); // Use the price set id ($sid) to pick the correct row - $this->click("css=tr#row_{$sid} a[title='Preview Price Set']"); - - $this->waitForPageToLoad($this->getTimeoutMsec()); - // Look for Register button - $this->waitForElementPresent('_qf_Preview_cancel-bottom'); + $this->clickLink("css=tr#row_{$sid} a[title='Preview Price Set']", '_qf_Preview_cancel-bottom'); // Check for expected price set field strings $this->assertStringsPresent($validateStrings); @@ -310,9 +301,7 @@ class WebTest_Event_AddPricesetTest extends CiviSeleniumTestCase { $this->select('billing_state_province_id-5', 'value=1004'); $this->type('billing_postal_code-5', '94129'); - $this->click('_qf_Register_upload-bottom'); - $this->waitForPageToLoad($this->getTimeoutMsec()); - $this->waitForElementPresent('_qf_Confirm_next-bottom'); + $this->clickLink('_qf_Register_upload-bottom', '_qf_Confirm_next-bottom'); $confirmStrings = array('Event Fee(s)', 'Billing Name and Address', 'Credit Card Information'); $this->assertStringsPresent($confirmStrings); $this->click('_qf_Confirm_next-bottom'); @@ -327,11 +316,7 @@ class WebTest_Event_AddPricesetTest extends CiviSeleniumTestCase { $this->openCiviPage('event/search', 'reset=1', '_qf_Search_refresh'); $this->type('sort_name', "$email"); - $this->click('_qf_Search_refresh'); - - $this->waitForPageToLoad($this->getTimeoutMsec()); - - $this->waitForElementPresent("xpath=id('participantSearch')/table/tbody/tr/td[11]/span/a[text()='View']"); + $this->clickLink('_qf_Search_refresh', "xpath=id('participantSearch')/table/tbody/tr/td[11]/span/a[text()='View']"); $this->click("xpath=id('participantSearch')/table/tbody/tr/td[11]/span/a[text()='View']"); $this->waitForElementPresent('_qf_ParticipantView_cancel-bottom'); diff --git a/tests/phpunit/WebTest/Event/EventListingTest.php b/tests/phpunit/WebTest/Event/EventListingTest.php index a560e664d0..b5a0ffce8c 100644 --- a/tests/phpunit/WebTest/Event/EventListingTest.php +++ b/tests/phpunit/WebTest/Event/EventListingTest.php @@ -145,11 +145,7 @@ class WebTest_Event_EventListingTest extends CiviSeleniumTestCase { $this->type("max_participants", "6"); $this->click("is_public"); - $this->click("_qf_EventInfo_upload-bottom"); - - // Wait for Location tab form to load - $this->waitForPageToLoad($this->getTimeoutMsec()); - $this->waitForElementPresent("_qf_Location_upload_done-bottom"); + $this->clickLink("_qf_EventInfo_upload-bottom", "_qf_Location_upload_done-bottom"); $this->click("_qf_Location_upload_done-bottom"); diff --git a/tests/phpunit/WebTest/Event/EventWaitListTest.php b/tests/phpunit/WebTest/Event/EventWaitListTest.php index eeab2e8cd9..760b350119 100644 --- a/tests/phpunit/WebTest/Event/EventWaitListTest.php +++ b/tests/phpunit/WebTest/Event/EventWaitListTest.php @@ -154,11 +154,7 @@ class WebTest_Event_EventWaitListTest extends CiviSeleniumTestCase { // verify event input on info page // start at Manage Events listing $this->openCiviPage("event/manage", "reset=1"); - $this->click("link=$eventTitle"); - $this->waitForPageToLoad($this->getTimeoutMsec()); - - // Look for Register button - $this->waitForElementPresent("link=Register Now"); + $this->clickLink("link=$eventTitle", "link=Register Now"); // Check for correct event info strings $this->assertStringsPresent($eventInfoStrings); diff --git a/tests/phpunit/WebTest/Event/MultipleEventRegistrationbyCartTest.php b/tests/phpunit/WebTest/Event/MultipleEventRegistrationbyCartTest.php index 840a91f222..239a09301f 100755 --- a/tests/phpunit/WebTest/Event/MultipleEventRegistrationbyCartTest.php +++ b/tests/phpunit/WebTest/Event/MultipleEventRegistrationbyCartTest.php @@ -290,9 +290,7 @@ class WebTest_Event_MultipleEventRegistrationbyCartTest extends CiviSeleniumTest $this->type("discount_name_1", "Early-bird" . substr(sha1(rand()), 0, 7)); $this->webtestFillDate("discount_start_date_1", "-1 week"); $this->webtestFillDate("discount_end_date_1", "+2 week"); - $this->click("_qf_Fee_submit"); - $this->waitForPageToLoad($this->getTimeoutMsec()); - $this->waitForElementPresent("discounted_value_2_1"); + $this->clickLink("_qf_Fee_submit", "discounted_value_2_1"); $this->type("discounted_value_1_1","225.00"); $this->type("discounted_value_2_1","300.00"); $this->click("xpath=//fieldset[@id='discount']/fieldset/table/tbody/tr[2]/td[3]/input"); @@ -333,11 +331,7 @@ class WebTest_Event_MultipleEventRegistrationbyCartTest extends CiviSeleniumTest // verify event input on info page // start at Manage Events listing $this->openCiviPage("event/manage", "reset=1"); - $this->click("link=$eventTitle"); - $this->waitForPageToLoad($this->getTimeoutMsec()); - - // Look for Add to Cart button - $this->waitForElementPresent("link=Add to Cart"); + $this->clickLink("link=$eventTitle", "link=Add to Cart"); $this->click("link=Add to Cart"); $this->waitForPageToLoad($this->getTimeoutMsec()); $this->assertTrue($this->isTextPresent("$eventTitle has been added to your cart")); diff --git a/tests/phpunit/WebTest/Event/MultiprofileEventTest.php b/tests/phpunit/WebTest/Event/MultiprofileEventTest.php index 6cc9a3231e..919c6cc2c4 100644 --- a/tests/phpunit/WebTest/Event/MultiprofileEventTest.php +++ b/tests/phpunit/WebTest/Event/MultiprofileEventTest.php @@ -89,12 +89,8 @@ class WebTest_Event_MultiprofileEventTest extends CiviSeleniumTestCase { // Find Main Participant $this->openCiviPage("event/search", "reset=1"); $this->type("sort_name", $firstName); - $this->click("_qf_Search_refresh"); - $this->waitForPageToLoad($this->getTimeoutMsec()); - $this->waitForElementPresent("xpath=//div[@id='participantSearch']//table//tbody/tr[1]/td[11]/span/a[text()='View']"); - $this->click("xpath=//div[@id='participantSearch']//table//tbody/tr[1]/td[11]/span/a[text()='View']"); - $this->waitForPageToLoad($this->getTimeoutMsec()); - $this->waitForElementPresent("_qf_ParticipantView_cancel-top"); + $this->clickLink("_qf_Search_refresh", "xpath=//div[@id='participantSearch']//table//tbody/tr[1]/td[11]/span/a[text()='View']"); + $this->clickLink("xpath=//div[@id='participantSearch']//table//tbody/tr[1]/td[11]/span/a[text()='View']", "_qf_ParticipantView_cancel-top"); $name = $firstName . " " . $lastName; $status = 'Registered'; @@ -106,12 +102,8 @@ class WebTest_Event_MultiprofileEventTest extends CiviSeleniumTestCase { // Find additional Participant $this->openCiviPage("event/search", "reset=1"); $this->type("sort_name", $participantfname); - $this->click("_qf_Search_refresh"); - $this->waitForPageToLoad($this->getTimeoutMsec()); - $this->waitForElementPresent("xpath=//div[@id='participantSearch']//table//tbody/tr[1]/td[11]/span/a[text()='View']"); - $this->click("xpath=//div[@id='participantSearch']//table//tbody/tr[1]/td[11]/span/a[text()='View']"); - $this->waitForPageToLoad($this->getTimeoutMsec()); - $this->waitForElementPresent("_qf_ParticipantView_cancel-top"); + $this->clickLink("_qf_Search_refresh", "xpath=//div[@id='participantSearch']//table//tbody/tr[1]/td[11]/span/a[text()='View']"); + $this->clickLink("xpath=//div[@id='participantSearch']//table//tbody/tr[1]/td[11]/span/a[text()='View']", "_qf_ParticipantView_cancel-top"); $name = $participantfname . " " . $participantlname; $status = 'Registered'; @@ -201,12 +193,8 @@ class WebTest_Event_MultiprofileEventTest extends CiviSeleniumTestCase { // Find Main Participant $this->openCiviPage("event/search", "reset=1"); $this->type("sort_name", $firstName); - $this->click("_qf_Search_refresh"); - $this->waitForPageToLoad($this->getTimeoutMsec()); - $this->waitForElementPresent("xpath=//div[@id='participantSearch']//table//tbody/tr[1]/td[11]/span/a[text()='View']"); - $this->click("xpath=//div[@id='participantSearch']//table//tbody/tr[1]/td[11]/span/a[text()='View']"); - $this->waitForPageToLoad($this->getTimeoutMsec()); - $this->waitForElementPresent("_qf_ParticipantView_cancel-top"); + $this->clickLink("_qf_Search_refresh", "xpath=//div[@id='participantSearch']//table//tbody/tr[1]/td[11]/span/a[text()='View']"); + $this->clickLink("xpath=//div[@id='participantSearch']//table//tbody/tr[1]/td[11]/span/a[text()='View']", "_qf_ParticipantView_cancel-top"); $name = $firstName . " " . $lastName; $status = 'Registered'; @@ -218,12 +206,8 @@ class WebTest_Event_MultiprofileEventTest extends CiviSeleniumTestCase { // Find additional Participant $this->openCiviPage("event/search", "reset=1"); $this->type("sort_name", $participantfname); - $this->click("_qf_Search_refresh"); - $this->waitForPageToLoad($this->getTimeoutMsec()); - $this->waitForElementPresent("xpath=//div[@id='participantSearch']//table//tbody/tr[1]/td[11]/span/a[text()='View']"); - $this->click("xpath=//div[@id='participantSearch']//table//tbody/tr[1]/td[11]/span/a[text()='View']"); - $this->waitForPageToLoad($this->getTimeoutMsec()); - $this->waitForElementPresent("_qf_ParticipantView_cancel-top"); + $this->clickLink("_qf_Search_refresh", "xpath=//div[@id='participantSearch']//table//tbody/tr[1]/td[11]/span/a[text()='View']"); + $this->clickLink("xpath=//div[@id='participantSearch']//table//tbody/tr[1]/td[11]/span/a[text()='View']", "_qf_ParticipantView_cancel-top"); $name = $participantfname . " " . $participantlname; $status = 'Registered'; @@ -247,12 +231,8 @@ class WebTest_Event_MultiprofileEventTest extends CiviSeleniumTestCase { // Find Main Participant $this->openCiviPage('event/search', "reset=1"); $this->type("sort_name", $firstName2); - $this->click("_qf_Search_refresh"); - $this->waitForPageToLoad($this->getTimeoutMsec()); - $this->waitForElementPresent("xpath=//div[@id='participantSearch']//table//tbody/tr[1]/td[11]/span/a[text()='View']"); - $this->click("xpath=//div[@id='participantSearch']//table//tbody/tr[1]/td[11]/span/a[text()='View']"); - $this->waitForPageToLoad($this->getTimeoutMsec()); - $this->waitForElementPresent("_qf_ParticipantView_cancel-top"); + $this->clickLink("_qf_Search_refresh", "xpath=//div[@id='participantSearch']//table//tbody/tr[1]/td[11]/span/a[text()='View']"); + $this->clickLink("xpath=//div[@id='participantSearch']//table//tbody/tr[1]/td[11]/span/a[text()='View']", "_qf_ParticipantView_cancel-top"); $name = $firstName2 . " " . $lastName2; $status = 'Registered'; @@ -264,12 +244,8 @@ class WebTest_Event_MultiprofileEventTest extends CiviSeleniumTestCase { // Find additional Participant $this->openCiviPage("event/search", "reset=1"); $this->type("sort_name", $participantfname2); - $this->click("_qf_Search_refresh"); - $this->waitForPageToLoad($this->getTimeoutMsec()); - $this->waitForElementPresent("xpath=//div[@id='participantSearch']//table//tbody/tr[1]/td[11]/span/a[text()='View']"); - $this->click("xpath=//div[@id='participantSearch']//table//tbody/tr[1]/td[11]/span/a[text()='View']"); - $this->waitForPageToLoad($this->getTimeoutMsec()); - $this->waitForElementPresent("_qf_ParticipantView_cancel-top"); + $this->clickLink("_qf_Search_refresh", "xpath=//div[@id='participantSearch']//table//tbody/tr[1]/td[11]/span/a[text()='View']"); + $this->clickLink("xpath=//div[@id='participantSearch']//table//tbody/tr[1]/td[11]/span/a[text()='View']", "_qf_ParticipantView_cancel-top"); $name = $participantfname2 . " " . $participantlname2; $status = 'Registered'; @@ -687,9 +663,7 @@ class WebTest_Event_MultiprofileEventTest extends CiviSeleniumTestCase { $this->type("nick_name", "Nick1"); $this->type("url-1", "http://www.part.com"); - $this->click("_qf_Participant_1_next-Array"); - $this->waitForPageToLoad($this->getTimeoutMsec()); - $this->waitForElementPresent("_qf_Confirm_next-bottom"); + $this->clickLink("_qf_Participant_1_next-Array", "_qf_Confirm_next-bottom"); $this->click("_qf_Confirm_next-bottom"); $this->waitForPageToLoad($this->getTimeoutMsec()); } @@ -755,9 +729,7 @@ class WebTest_Event_MultiprofileEventTest extends CiviSeleniumTestCase { $this->type("current_employer", "ABCD"); $this->type("job_title", "BATCHER"); - $this->click("_qf_Participant_1_next-Array"); - $this->waitForPageToLoad($this->getTimeoutMsec()); - $this->waitForElementPresent("_qf_Confirm_next-bottom"); + $this->clickLink("_qf_Participant_1_next-Array", "_qf_Confirm_next-bottom"); $this->click("_qf_Confirm_next-bottom"); } diff --git a/tests/phpunit/WebTest/Event/PCPAddTest.php b/tests/phpunit/WebTest/Event/PCPAddTest.php index 5e83bb3805..340e8486c3 100644 --- a/tests/phpunit/WebTest/Event/PCPAddTest.php +++ b/tests/phpunit/WebTest/Event/PCPAddTest.php @@ -436,10 +436,7 @@ class WebTest_Event_PCPAddTest extends CiviSeleniumTestCase { $this->click("_qf_Search_refresh"); $this->waitForPageToLoad($this->getTimeoutMsec()); - $this->click("xpath=//div[@id='participantSearch']/table/tbody//tr/td[@class='crm-participant-sort_name']/a[text()='{$sortName}']/../../td[11]/span/a[text()='View']"); - $this->waitForPageToLoad($this->getTimeoutMsec()); - - $this->waitForElementPresent("xpath=//table[@class='selector']/tbody/tr/td[8]/span/a[text()='View']"); + $this->clickLink("xpath=//div[@id='participantSearch']/table/tbody//tr/td[@class='crm-participant-sort_name']/a[text()='{$sortName}']/../../td[11]/span/a[text()='View']", "xpath=//table[@class='selector']/tbody/tr/td[8]/span/a[text()='View']"); $this->click("xpath=//table[@class='selector']/tbody/tr/td[8]/span/a[text()='View']"); $this->waitForPageToLoad($this->getTimeoutMsec()); diff --git a/tests/phpunit/WebTest/Event/ParticipantCountTest.php b/tests/phpunit/WebTest/Event/ParticipantCountTest.php index 91d4c7fed4..475b7f8587 100644 --- a/tests/phpunit/WebTest/Event/ParticipantCountTest.php +++ b/tests/phpunit/WebTest/Event/ParticipantCountTest.php @@ -184,9 +184,7 @@ class WebTest_Event_ParticipantCountTest extends CiviSeleniumTestCase { else { $this->_testAddMultipleChoiceOptions($field['options']); } - $this->click('_qf_Field_next_new-bottom'); - $this->waitForPageToLoad($this->getTimeoutMsec()); - $this->waitForElementPresent('_qf_Field_next-bottom'); + $this->clickLink('_qf_Field_next_new-bottom', '_qf_Field_next-bottom'); } // create event. @@ -303,10 +301,7 @@ class WebTest_Event_ParticipantCountTest extends CiviSeleniumTestCase { $this->type('help_pre', 'This is test priceset.'); $this->assertChecked('is_active', 'Verify that Is Active checkbox is set.'); - $this->click('_qf_Set_next-bottom'); - - $this->waitForPageToLoad($this->getTimeoutMsec()); - $this->waitForElementPresent('_qf_Field_next-bottom'); + $this->clickLink('_qf_Set_next-bottom', '_qf_Field_next-bottom'); } function _testAddMultipleChoiceOptions($options) { @@ -411,9 +406,7 @@ class WebTest_Event_ParticipantCountTest extends CiviSeleniumTestCase { $this->select('billing_state_province_id-5', 'value=1004'); $this->type('billing_postal_code-5', '94129'); - $this->click('_qf_Register_upload-bottom'); - $this->waitForPageToLoad($this->getTimeoutMsec()); - $this->waitForElementPresent('_qf_Confirm_next-bottom'); + $this->clickLink('_qf_Register_upload-bottom', '_qf_Confirm_next-bottom'); $confirmStrings = array('Event Fee(s)', 'Billing Name and Address', 'Credit Card Information'); $this->assertStringsPresent($confirmStrings); $this->click('_qf_Confirm_next-bottom'); diff --git a/tests/phpunit/WebTest/Event/PricesetMaxCountTest.php b/tests/phpunit/WebTest/Event/PricesetMaxCountTest.php index c979bc1660..fbf33a8749 100644 --- a/tests/phpunit/WebTest/Event/PricesetMaxCountTest.php +++ b/tests/phpunit/WebTest/Event/PricesetMaxCountTest.php @@ -1020,10 +1020,7 @@ class WebTest_Event_PricesetMaxCountTest extends CiviSeleniumTestCase { $this->type('help_pre', 'This is test priceset.'); $this->assertChecked('is_active', 'Verify that Is Active checkbox is set.'); - $this->click('_qf_Set_next-bottom'); - - $this->waitForPageToLoad($this->getTimeoutMsec()); - $this->waitForElementPresent('_qf_Field_next-bottom'); + $this->clickLink('_qf_Set_next-bottom', '_qf_Field_next-bottom'); } function _testAddPriceFields($fields) { diff --git a/tests/phpunit/WebTest/Financial/FinancialAccountTest.php b/tests/phpunit/WebTest/Financial/FinancialAccountTest.php index 99af6fbb28..e8891f6794 100644 --- a/tests/phpunit/WebTest/Financial/FinancialAccountTest.php +++ b/tests/phpunit/WebTest/Financial/FinancialAccountTest.php @@ -65,9 +65,7 @@ class WebTest_Financial_FinancialAccountTest extends CiviSeleniumTestCase { $this->waitForElementPresent("xpath=//table/tbody//tr/td[1][text()='{$financialAccountTitle}']/../td[9]/span/a[text()='Edit']"); - $this->click("xpath=//table/tbody//tr/td[1][text()='{$financialAccountTitle}']/../td[9]/span/a[text()='Edit']"); - $this->waitForPageToLoad($this->getTimeoutMsec()); - $this->waitForElementPresent('_qf_FinancialAccount_cancel-botttom'); + $this->clickLink("xpath=//table/tbody//tr/td[1][text()='{$financialAccountTitle}']/../td[9]/span/a[text()='Edit']", '_qf_FinancialAccount_cancel-botttom'); //Varify Data after Adding new Financial Account $verifyData = array('name' => $financialAccountTitle, 'description' => $financialAccountDescription, @@ -111,9 +109,7 @@ class WebTest_Financial_FinancialAccountTest extends CiviSeleniumTestCase { $orgName = $orgNameEdit; } $this->waitForElementPresent("xpath=//table/tbody//tr/td[1][text()='{$financialAccountTitle}']/../td[9]/span/a[text()='Edit']"); - $this->click("xpath=//table/tbody//tr/td[1][text()='{$financialAccountTitle}']/../td[9]/span/a[text()='Edit']"); - $this->waitForPageToLoad($this->getTimeoutMsec()); - $this->waitForElementPresent('_qf_FinancialAccount_cancel-botttom'); + $this->clickLink("xpath=//table/tbody//tr/td[1][text()='{$financialAccountTitle}']/../td[9]/span/a[text()='Edit']", '_qf_FinancialAccount_cancel-botttom'); $verifyData = array( 'name' => $financialAccountTitle, 'description' => $financialAccountDescription, diff --git a/tests/phpunit/WebTest/Financial/FinancialAccountTypeTest.php b/tests/phpunit/WebTest/Financial/FinancialAccountTypeTest.php index 8d74cd370a..20221e7765 100644 --- a/tests/phpunit/WebTest/Financial/FinancialAccountTypeTest.php +++ b/tests/phpunit/WebTest/Financial/FinancialAccountTypeTest.php @@ -68,9 +68,7 @@ class WebTest_Financial_FinancialAccountTypeTest extends CiviSeleniumTestCase { $this->waitForElementPresent("xpath=//table/tbody//tr/td[1][text()='{$financialAccountTitle}']/../td[9]/span/a[text()='Edit']"); - $this->click("xpath=//table/tbody//tr/td[1][text()='{$financialAccountTitle}']/../td[9]/span/a[text()='Edit']"); - $this->waitForPageToLoad($this->getTimeoutMsec()); - $this->waitForElementPresent('_qf_FinancialAccount_cancel-botttom'); + $this->clickLink("xpath=//table/tbody//tr/td[1][text()='{$financialAccountTitle}']/../td[9]/span/a[text()='Edit']", '_qf_FinancialAccount_cancel-botttom'); //Varify Data after Adding new Financial Account $verifyData = array( @@ -146,9 +144,7 @@ class WebTest_Financial_FinancialAccountTypeTest extends CiviSeleniumTestCase { $this->click('_qf_FinancialTypeAccount_next'); $this->waitForElementPresent("xpath=id('ltype')/div/table/tbody/tr/td[1][text()='Accounts Receivable']/../td[7]/span/a[text()='Edit']"); $this->verifyText("xpath=id('ltype')/div/table/tbody/tr/td[1][text()='Accounts Receivable']/../td[2]", preg_quote('Accounts Receivable Account is')); - $this->click("xpath=id('ltype')/div/table/tbody/tr/td[1][text()='Accounts Receivable']/../td[7]/span/a[text()='Delete']"); - $this->waitForPageToLoad($this->getTimeoutMsec()); - $this->waitForElementPresent('_qf_FinancialTypeAccount_next-botttom'); + $this->clickLink("xpath=id('ltype')/div/table/tbody/tr/td[1][text()='Accounts Receivable']/../td[7]/span/a[text()='Delete']", '_qf_FinancialTypeAccount_next-botttom'); $this->click('_qf_FinancialTypeAccount_next-botttom'); $this->waitForPageToLoad($this->getTimeoutMsec()); $this->assertElementContainsText('crm-notification-container', 'Selected financial type account has been deleted.', 'Missing text: ' . 'Selected financial type account has been deleted.'); diff --git a/tests/phpunit/WebTest/Financial/FinancialBatchExport.php b/tests/phpunit/WebTest/Financial/FinancialBatchExport.php index a3d83c5b9d..d323a3d94a 100644 --- a/tests/phpunit/WebTest/Financial/FinancialBatchExport.php +++ b/tests/phpunit/WebTest/Financial/FinancialBatchExport.php @@ -111,9 +111,7 @@ class WebTest_Financial_FinancialBatchExport extends CiviSeleniumTestCase { $this->openCiviPage("dashboard", "reset=1"); $this->waitForPageToLoad($this->getTimeoutMsec()); - $this->click("xpath=//div[@id='recently-viewed']/ul/li[1]/a"); - $this->waitForPageToLoad($this->getTimeoutMsec()); - $this->waitForElementPresent("_qf_Activity_cancel-bottom"); + $this->clickLink("xpath=//div[@id='recently-viewed']/ul/li[1]/a", "_qf_Activity_cancel-bottom"); $this->webtestVerifyTabularData( array( 'Current Attachment(s)' => 'Financial_Transactions_' diff --git a/tests/phpunit/WebTest/Grant/ContactContextAddTest.php b/tests/phpunit/WebTest/Grant/ContactContextAddTest.php index ff426cab7e..7022adec4d 100644 --- a/tests/phpunit/WebTest/Grant/ContactContextAddTest.php +++ b/tests/phpunit/WebTest/Grant/ContactContextAddTest.php @@ -109,17 +109,10 @@ class WebTest_Grant_ContactContextAddTest extends CiviSeleniumTestCase { $this->type('note', "Grant Note for $firstName"); // Clicking save. - $this->click('_qf_Grant_upload'); - - // wait for page to load - $this->waitForPageToLoad($this->getTimeoutMsec()); - - // verify if grant is created with presence of view link - $this->waitForElementPresent("xpath=//div[@id='Grants']//table/tbody/tr[1]/td[8]/span/a[text()='View']"); + $this->clickLink('_qf_Grant_upload', "xpath=//div[@id='Grants']//table/tbody/tr[1]/td[8]/span/a[text()='View']"); // click through to the Grant view screen - $this->click("xpath=//div[@id='Grants']//table/tbody/tr[1]/td[8]/span/a[text()='View']"); - $this->waitForElementPresent('_qf_GrantView_cancel-bottom'); + $this->clickLink("xpath=//div[@id='Grants']//table/tbody/tr[1]/td[8]/span/a[text()='View']", '_qf_GrantView_cancel-bottom'); $gDate = date('F jS, Y', strtotime('now')); diff --git a/tests/phpunit/WebTest/Grant/CustomFieldsetTest.php b/tests/phpunit/WebTest/Grant/CustomFieldsetTest.php index e13a93db16..04f860fc0c 100644 --- a/tests/phpunit/WebTest/Grant/CustomFieldsetTest.php +++ b/tests/phpunit/WebTest/Grant/CustomFieldsetTest.php @@ -95,11 +95,7 @@ class WebTest_Grant_CustomFieldsetTest extends CiviSeleniumTestCase { $this->assertElementContainsText($grantFieldSet, $grantField); $this->type('id=amount_total', '100.00'); $this->type("css=div#$grantFieldSet input.form-text", '99.99'); - $this->click('id=_qf_Grant_upload-bottom'); - $this->waitForPageToLoad($this->getTimeoutMsec()); - - // Verify grant is created with presence of view link - $this->waitForElementPresent("xpath=//div[@id='Grants']//table/tbody/tr[1]/td[8]/span/a[text()='View']"); + $this->clickLink('id=_qf_Grant_upload-bottom', "xpath=//div[@id='Grants']//table/tbody/tr[1]/td[8]/span/a[text()='View']"); // Click through to the Grant view screen $this->click("xpath=//div[@id='Grants']//table/tbody/tr[1]/td[8]/span/a[text()='View']"); diff --git a/tests/phpunit/WebTest/Grant/StandaloneAddTest.php b/tests/phpunit/WebTest/Grant/StandaloneAddTest.php index f7b3d6ff5f..dc88af9913 100644 --- a/tests/phpunit/WebTest/Grant/StandaloneAddTest.php +++ b/tests/phpunit/WebTest/Grant/StandaloneAddTest.php @@ -90,11 +90,7 @@ class WebTest_Grant_StandaloneAddTest extends CiviSeleniumTestCase { $this->type("note", "Grant Note"); // Clicking save. - $this->click("_qf_Grant_upload"); - $this->waitForPageToLoad($this->getTimeoutMsec()); - - // verify if Grant is created - $this->waitForElementPresent("xpath=//div[@id='Grants']//table//tbody/tr[1]/td[8]/span/a[text()='View']"); + $this->clickLink("_qf_Grant_upload", "xpath=//div[@id='Grants']//table//tbody/tr[1]/td[8]/span/a[text()='View']"); //click through to the Grant view screen $this->click("xpath=//div[@id='Grants']//table/tbody/tr[1]/td[8]/span/a[text()='View']"); diff --git a/tests/phpunit/WebTest/Import/ImportCiviSeleniumTestCase.php b/tests/phpunit/WebTest/Import/ImportCiviSeleniumTestCase.php index 68ab6a87b2..284cd69443 100644 --- a/tests/phpunit/WebTest/Import/ImportCiviSeleniumTestCase.php +++ b/tests/phpunit/WebTest/Import/ImportCiviSeleniumTestCase.php @@ -142,11 +142,7 @@ class ImportCiviSeleniumTestCase extends CiviSeleniumTestCase { $this->_checkImportMapperData($headers, $rows, $existingMapping, isset($other['checkMapperHeaders']) ? $other['checkMapperHeaders'] : array()); // Submit form. - $this->click('_qf_Preview_next-bottom'); - $this->waitForPageToLoad($this->getTimeoutMsec()); - - // Visit summary page. - $this->waitForElementPresent("_qf_Summary_next"); + $this->clickLink('_qf_Preview_next-bottom', "_qf_Summary_next"); // Check success message. $this->assertTrue($this->isTextPresent("Import has completed successfully. The information below summarizes the results.")); diff --git a/tests/phpunit/WebTest/Mailing/MailingTest.php b/tests/phpunit/WebTest/Mailing/MailingTest.php index f605b8c539..a10584d1dc 100644 --- a/tests/phpunit/WebTest/Mailing/MailingTest.php +++ b/tests/phpunit/WebTest/Mailing/MailingTest.php @@ -74,9 +74,7 @@ class WebTest_Mailing_MailingTest extends CiviSeleniumTestCase { $this->click("css=li#tab_group a"); $this->waitForElementPresent("_qf_GroupContact_next"); $this->select("group_id", "$groupName"); - $this->click("_qf_GroupContact_next"); - $this->waitForPageToLoad($this->getTimeoutMsec()); - $this->waitForElementPresent("_qf_GroupContact_next"); + $this->clickLink("_qf_GroupContact_next", "_qf_GroupContact_next"); // configure default mail-box $this->setupDefaultMailbox(); @@ -341,9 +339,7 @@ class WebTest_Mailing_MailingTest extends CiviSeleniumTestCase { $this->click("css=li#tab_group a"); $this->waitForElementPresent("_qf_GroupContact_next"); $this->select("group_id", "$groupName"); - $this->click("_qf_GroupContact_next"); - $this->waitForPageToLoad($this->getTimeoutMsec()); - $this->waitForElementPresent("_qf_GroupContact_next"); + $this->clickLink("_qf_GroupContact_next", "_qf_GroupContact_next"); // configure default mail-box $this->openCiviPage("admin/mailSettings", "action=update&id=1&reset=1", '_qf_MailSettings_cancel-bottom'); diff --git a/tests/phpunit/WebTest/Member/ContactContextAddTest.php b/tests/phpunit/WebTest/Member/ContactContextAddTest.php index 743f940c67..88d714891b 100644 --- a/tests/phpunit/WebTest/Member/ContactContextAddTest.php +++ b/tests/phpunit/WebTest/Member/ContactContextAddTest.php @@ -128,10 +128,7 @@ class WebTest_Member_ContactContextAddTest extends CiviSeleniumTestCase { 'Source' => $sourceText, ); $this->webtestVerifyTabularData($verifyData); - $this->click("_qf_MembershipView_cancel-bottom"); - - $this->waitForPageToLoad($this->getTimeoutMsec()); - $this->waitForElementPresent("xpath=//div[@id='memberships']/div/table/tbody//tr/td[1][text()='{$memTypeParams['membership_type']}']/../td[7]"); + $this->clickLink("_qf_MembershipView_cancel-bottom", "xpath=//div[@id='memberships']/div/table/tbody//tr/td[1][text()='{$memTypeParams['membership_type']}']/../td[7]"); $this->click("xpath=//div[@id='memberships']/div/table/tbody//tr/td[1][text()='{$memTypeParams['membership_type']}']/../td[9]/span/a[2][text()='Edit']"); $this->waitForElementPresent("_qf_Membership_cancel-bottom"); diff --git a/tests/phpunit/WebTest/Member/DefaultMembershipPricesetTest.php b/tests/phpunit/WebTest/Member/DefaultMembershipPricesetTest.php index d575758744..1bc3dd55c9 100755 --- a/tests/phpunit/WebTest/Member/DefaultMembershipPricesetTest.php +++ b/tests/phpunit/WebTest/Member/DefaultMembershipPricesetTest.php @@ -83,9 +83,7 @@ class WebTest_Member_DefaultMembershipPricesetTest extends CiviSeleniumTestCase $this->_testDefaultSenarios("National_Membership_{$title}-section", 2); $this->contactInfoFill($firstName, $lastName, $email, $contactParams, $streetAddress); - $this->click("_qf_Main_upload-bottom"); - $this->waitForPageToLoad($this->getTimeoutMsec()); - $this->waitForElementPresent("_qf_Confirm_next-bottom"); + $this->clickLink("_qf_Main_upload-bottom", "_qf_Confirm_next-bottom"); $this->click("_qf_Confirm_next-bottom"); $this->waitForPageToLoad($this->getTimeoutMsec()); @@ -97,9 +95,7 @@ class WebTest_Member_DefaultMembershipPricesetTest extends CiviSeleniumTestCase $this->_testDefaultSenarios("National_Membership_{$title}-section", 4); $this->_testDefaultSenarios("Second_Membership_{$title}-section", 2); $this->contactInfoFill($firstName, $lastName, $email, $contactParams, $streetAddress); - $this->click("_qf_Main_upload-bottom"); - $this->waitForPageToLoad($this->getTimeoutMsec()); - $this->waitForElementPresent("_qf_Confirm_next-bottom"); + $this->clickLink("_qf_Main_upload-bottom", "_qf_Confirm_next-bottom"); $this->click("_qf_Confirm_next-bottom"); $this->waitForPageToLoad($this->getTimeoutMsec()); @@ -111,9 +107,7 @@ class WebTest_Member_DefaultMembershipPricesetTest extends CiviSeleniumTestCase $this->_testDefaultSenarios("National_Membership_{$title}-section", 3); $this->contactInfoFill($firstName, $lastName, $email, $contactParams, $streetAddress); - $this->click("_qf_Main_upload-bottom"); - $this->waitForPageToLoad($this->getTimeoutMsec()); - $this->waitForElementPresent("_qf_Confirm_next-bottom"); + $this->clickLink("_qf_Main_upload-bottom", "_qf_Confirm_next-bottom"); $this->click("_qf_Confirm_next-bottom"); $this->waitForPageToLoad($this->getTimeoutMsec()); @@ -124,9 +118,7 @@ class WebTest_Member_DefaultMembershipPricesetTest extends CiviSeleniumTestCase $this->_testDefaultSenarios("National_Membership_{$title}-section", 1); $this->contactInfoFill($firstName, $lastName, $email, $contactParams, $streetAddress); - $this->click("_qf_Main_upload-bottom"); - $this->waitForPageToLoad($this->getTimeoutMsec()); - $this->waitForElementPresent("_qf_Main_upload-bottom"); + $this->clickLink("_qf_Main_upload-bottom", "_qf_Main_upload-bottom"); $this->assertTrue($this->isTextPresent("You already have a lifetime membership and cannot select a membership with a shorter term.")); } @@ -176,10 +168,7 @@ class WebTest_Member_DefaultMembershipPricesetTest extends CiviSeleniumTestCase $this->type('help_pre', $setHelp); $this->assertChecked('is_active', 'Verify that Is Active checkbox is set.'); - $this->click('_qf_Set_next-bottom'); - - $this->waitForPageToLoad($this->getTimeoutMsec()); - $this->waitForElementPresent('_qf_Field_next-bottom'); + $this->clickLink('_qf_Set_next-bottom', '_qf_Field_next-bottom'); $this->assertTrue($this->isTextPresent("Your Set '{$setTitle}' has been added. You can add fields to this set now.")); } @@ -265,9 +254,7 @@ class WebTest_Member_DefaultMembershipPricesetTest extends CiviSeleniumTestCase break; } $this->select("financial_type_id", "label={$contributionType}"); - $this->click('_qf_Field_next_new-bottom'); - $this->waitForPageToLoad($this->getTimeoutMsec()); - $this->waitForElementPresent('_qf_Field_next-bottom'); + $this->clickLink('_qf_Field_next_new-bottom', '_qf_Field_next-bottom'); $this->assertTrue($this->isTextPresent("Price Field '{$label}' has been saved.")); } return array($memTypeTitle1, $memTypeTitle2, $memTypeTitle3); diff --git a/tests/phpunit/WebTest/Member/OfflineAutoRenewMembershipTest.php b/tests/phpunit/WebTest/Member/OfflineAutoRenewMembershipTest.php index 9b8e03819d..8fc3386c20 100644 --- a/tests/phpunit/WebTest/Member/OfflineAutoRenewMembershipTest.php +++ b/tests/phpunit/WebTest/Member/OfflineAutoRenewMembershipTest.php @@ -100,10 +100,7 @@ class WebTest_Member_OfflineAutoRenewMembershipTest extends CiviSeleniumTestCase $this->type("sort_name", "$firstName $lastName"); $this->click("member_test"); - $this->click("_qf_Search_refresh"); - $this->waitForPageToLoad($this->getTimeoutMsec()); - - $this->waitForElementPresent("xpath=//div[@id='memberSearch']/table/tbody/tr[1]/td[11]/span/a[text()='View']"); + $this->clickLink("_qf_Search_refresh", "xpath=//div[@id='memberSearch']/table/tbody/tr[1]/td[11]/span/a[text()='View']"); $this->click("xpath=//div[@id='memberSearch']/table/tbody/tr[1]/td[11]/span/a[text()='View']"); $this->waitForElementPresent("_qf_MembershipView_cancel-bottom"); diff --git a/tests/phpunit/WebTest/Member/OnlineAutoRenewMembershipGCTest.php b/tests/phpunit/WebTest/Member/OnlineAutoRenewMembershipGCTest.php index 3a125b0eba..8ec979063b 100644 --- a/tests/phpunit/WebTest/Member/OnlineAutoRenewMembershipGCTest.php +++ b/tests/phpunit/WebTest/Member/OnlineAutoRenewMembershipGCTest.php @@ -46,9 +46,7 @@ class WebTest_Member_OnlineAutoRenewMembershipGCTest extends CiviSeleniumTestCas $lastName = 'Smith_' . substr(sha1(rand()), 0, 7); $this->type('email-5', "{$lastName}@example.com"); - $this->click("_qf_Main_upload-bottom"); - $this->waitForPageToLoad($this->getTimeoutMsec()); - $this->waitForElementPresent("_qf_Confirm_next_checkout"); + $this->clickLink("_qf_Main_upload-bottom", "_qf_Confirm_next_checkout"); $text = 'I want this membership to be renewed automatically every 1 year(s).'; $this->assertElementContainsText('css=div.display-block', $text, 'Missing text: ' . $text); @@ -80,9 +78,7 @@ class WebTest_Member_OnlineAutoRenewMembershipGCTest extends CiviSeleniumTestCas $lastName = 'Smith_' . substr(sha1(rand()), 0, 7); $this->type('email-5', "{$lastName}@example.com"); - $this->click("_qf_Main_upload-bottom"); - $this->waitForPageToLoad($this->getTimeoutMsec()); - $this->waitForElementPresent("_qf_Confirm_next_checkout"); + $this->clickLink("_qf_Main_upload-bottom", "_qf_Confirm_next_checkout"); $text = 'I want this membership to be renewed automatically every 1 year(s).'; $this->assertElementContainsText('css=div.display-block', $text, 'Missing text: ' . $text); diff --git a/tests/phpunit/WebTest/Member/OnlineAutoRenewMembershipTest.php b/tests/phpunit/WebTest/Member/OnlineAutoRenewMembershipTest.php index a98a05bf98..328613dcff 100644 --- a/tests/phpunit/WebTest/Member/OnlineAutoRenewMembershipTest.php +++ b/tests/phpunit/WebTest/Member/OnlineAutoRenewMembershipTest.php @@ -49,9 +49,7 @@ class WebTest_Member_OnlineAutoRenewMembershipTest extends CiviSeleniumTestCase $this->type('email-5', "{$lastName}@example.com"); - $this->click("_qf_Main_upload-bottom"); - $this->waitForPageToLoad($this->getTimeoutMsec()); - $this->waitForElementPresent("_qf_Confirm_next-bottom"); + $this->clickLink("_qf_Main_upload-bottom", "_qf_Confirm_next-bottom"); $text = 'I want this membership to be renewed automatically every 1 year(s).'; $this->assertElementContainsText('css=div.display-block', $text, 'Missing text: ' . $text); diff --git a/tests/phpunit/WebTest/Member/OnlineMembershipAddPricesetTest.php b/tests/phpunit/WebTest/Member/OnlineMembershipAddPricesetTest.php index cd0dfd3be7..9dfcf65509 100644 --- a/tests/phpunit/WebTest/Member/OnlineMembershipAddPricesetTest.php +++ b/tests/phpunit/WebTest/Member/OnlineMembershipAddPricesetTest.php @@ -205,10 +205,7 @@ class WebTest_Member_OnlineMembershipAddPricesetTest extends CiviSeleniumTestCas $this->type('help_pre', $setHelp); $this->assertChecked('is_active', 'Verify that Is Active checkbox is set.'); - $this->click('_qf_Set_next-bottom'); - - $this->waitForPageToLoad($this->getTimeoutMsec()); - $this->waitForElementPresent('_qf_Field_next-bottom'); + $this->clickLink('_qf_Set_next-bottom', '_qf_Field_next-bottom'); $this->assertElementContainsText('crm-notification-container', "Your Set '{$setTitle}' has been added. You can add fields to this set now."); } @@ -266,9 +263,7 @@ class WebTest_Member_OnlineMembershipAddPricesetTest extends CiviSeleniumTestCas break; } $this->select("financial_type_id", "label={$contributionType}"); - $this->click('_qf_Field_next_new-bottom'); - $this->waitForPageToLoad($this->getTimeoutMsec()); - $this->waitForElementPresent('_qf_Field_next-bottom'); + $this->clickLink('_qf_Field_next_new-bottom', '_qf_Field_next-bottom'); $this->assertElementContainsText('crm-notification-container', "Price Field '{$label}' has been saved."); } return array($memTypeTitle1, $memTypeTitle2); @@ -280,11 +275,7 @@ class WebTest_Member_OnlineMembershipAddPricesetTest extends CiviSeleniumTestCas $this->openCiviPage('admin/price', 'reset=1'); // Use the price set id ($sid) to pick the correct row - $this->click("css=tr#row_{$sid} a[title='Preview Price Set']"); - - $this->waitForPageToLoad($this->getTimeoutMsec()); - // Look for Register button - $this->waitForElementPresent('_qf_Preview_cancel-bottom'); + $this->clickLink("css=tr#row_{$sid} a[title='Preview Price Set']", '_qf_Preview_cancel-bottom'); // Check for expected price set field strings $this->assertStringsPresent($validateStrings); @@ -338,10 +329,7 @@ class WebTest_Member_OnlineMembershipAddPricesetTest extends CiviSeleniumTestCas $this->select("billing_country_id-5", "value=1228"); $this->select("billing_state_province_id-5", "value=1004"); $this->type("billing_postal_code-5", "94129"); - $this->click("_qf_Main_upload-bottom"); - - $this->waitForPageToLoad($this->getTimeoutMsec()); - $this->waitForElementPresent("_qf_Confirm_next-bottom"); + $this->clickLink("_qf_Main_upload-bottom", "_qf_Confirm_next-bottom"); $this->click("_qf_Confirm_next-bottom"); $this->waitForPageToLoad($this->getTimeoutMsec()); @@ -400,9 +388,7 @@ class WebTest_Member_OnlineMembershipAddPricesetTest extends CiviSeleniumTestCas if($renew){ $this->openCiviPage('member/search', 'reset=1', 'member_end_date_high'); $this->type("sort_name", "{$contactParams['first_name']} {$contactParams['last_name']}"); - $this->click("_qf_Search_refresh"); - $this->waitForPageToLoad($this->getTimeoutMsec()); - $this->waitForElementPresent("xpath=//div[@id='memberSearch']/table/tbody/tr"); + $this->clickLink("_qf_Search_refresh", "xpath=//div[@id='memberSearch']/table/tbody/tr"); $this->click("xpath=//div[@id='memberSearch']/table/tbody//tr/td[4][text()='{$memTypeTitle1}']/../td[11]/span/a[text()='View']"); $this->waitForElementPresent("_qf_MembershipView_cancel-bottom"); $year = CRM_Utils_Date::processDate($this->getText("xpath=//form[@id='MembershipView']//table/tbody/tr/td[text()='End date']/following-sibling::td")); @@ -458,10 +444,7 @@ class WebTest_Member_OnlineMembershipAddPricesetTest extends CiviSeleniumTestCas $this->select("billing_country_id-5", "value=1228"); $this->select("billing_state_province_id-5", "value=1004"); $this->type("billing_postal_code-5", "94129"); - $this->click("_qf_Main_upload-bottom"); - - $this->waitForPageToLoad($this->getTimeoutMsec()); - $this->waitForElementPresent("_qf_Confirm_next-bottom"); + $this->clickLink("_qf_Main_upload-bottom", "_qf_Confirm_next-bottom"); $this->click("_qf_Confirm_next-bottom"); $this->waitForPageToLoad($this->getTimeoutMsec()); diff --git a/tests/phpunit/WebTest/Member/OnlineMembershipCreateTest.php b/tests/phpunit/WebTest/Member/OnlineMembershipCreateTest.php index 2abf1e9ada..0cc25d9735 100644 --- a/tests/phpunit/WebTest/Member/OnlineMembershipCreateTest.php +++ b/tests/phpunit/WebTest/Member/OnlineMembershipCreateTest.php @@ -104,9 +104,7 @@ class WebTest_Member_OnlineMembershipCreateTest extends CiviSeleniumTestCase { $this->openCiviPage("admin/contribute/membership", "reset=1&action=update&id={$pageId}", '_qf_MembershipBlock_next-bottom'); $this->click("membership_type_$memTypeId1"); $this->click("membership_type_$memTypeId2"); - $this->click('_qf_MembershipBlock_next'); - $this->waitForPageToLoad($this->getTimeoutMsec()); - $this->waitForElementPresent('_qf_MembershipBlock_next-bottom'); + $this->clickLink('_qf_MembershipBlock_next', '_qf_MembershipBlock_next-bottom'); $text = "'MembershipBlock' information has been saved."; $this->assertElementContainsText('crm-notification-container', $text, 'Missing text: ' . $text); @@ -126,11 +124,7 @@ class WebTest_Member_OnlineMembershipCreateTest extends CiviSeleniumTestCase { $this->openCiviPage("member/search", "reset=1", "member_end_date_high"); $this->type("sort_name", "$firstName $lastName"); - $this->click("_qf_Search_refresh"); - - $this->waitForPageToLoad($this->getTimeoutMsec()); - - $this->waitForElementPresent("xpath=//div[@id='memberSearch']/table/tbody/tr"); + $this->clickLink("_qf_Search_refresh", "xpath=//div[@id='memberSearch']/table/tbody/tr"); $this->click("xpath=//div[@id='memberSearch']/table/tbody/tr/td[11]/span/a[text()='View']"); $this->waitForElementPresent("_qf_MembershipView_cancel-bottom"); @@ -308,13 +302,8 @@ class WebTest_Member_OnlineMembershipCreateTest extends CiviSeleniumTestCase { $this->openCiviPage("contribute/search","reset=1", "contribution_date_low"); $this->type("sort_name", "$firstName $lastName"); - $this->click("_qf_Search_refresh"); - $this->waitForPageToLoad($this->getTimeoutMsec()); - - $this->waitForElementPresent("xpath=//div[@id='contributionSearch']//table//tbody/tr[1]/td[11]/span/a[text()='View']"); - $this->click("xpath=//div[@id='contributionSearch']//table//tbody/tr[1]/td[11]/span/a[text()='View']"); - $this->waitForPageToLoad($this->getTimeoutMsec()); - $this->waitForElementPresent("_qf_ContributionView_cancel-bottom"); + $this->clickLink("_qf_Search_refresh", "xpath=//div[@id='contributionSearch']//table//tbody/tr[1]/td[11]/span/a[text()='View']"); + $this->clickLink("xpath=//div[@id='contributionSearch']//table//tbody/tr[1]/td[11]/span/a[text()='View']", "_qf_ContributionView_cancel-bottom"); //View Contribution Record and verify data $expected = array( diff --git a/tests/phpunit/WebTest/Member/OnlineMembershipRenewTest.php b/tests/phpunit/WebTest/Member/OnlineMembershipRenewTest.php index a36d5cc7fe..8319032d76 100644 --- a/tests/phpunit/WebTest/Member/OnlineMembershipRenewTest.php +++ b/tests/phpunit/WebTest/Member/OnlineMembershipRenewTest.php @@ -120,10 +120,7 @@ class WebTest_Member_OnlineMembershipRenewTest extends CiviSeleniumTestCase { $this->select("billing_state_province_id-5", "value=1004"); $this->type("billing_postal_code-5", "94129"); - $this->click("_qf_Main_upload-bottom"); - - $this->waitForPageToLoad($this->getTimeoutMsec()); - $this->waitForElementPresent("_qf_Confirm_next-bottom"); + $this->clickLink("_qf_Main_upload-bottom", "_qf_Confirm_next-bottom"); $this->click("_qf_Confirm_next-bottom"); $this->waitForPageToLoad($this->getTimeoutMsec()); @@ -134,10 +131,7 @@ class WebTest_Member_OnlineMembershipRenewTest extends CiviSeleniumTestCase { $this->openCiviPage("member/search", "reset=1", "member_end_date_high"); $this->type("sort_name", "$firstName $lastName"); - $this->click("_qf_Search_refresh"); - $this->waitForPageToLoad($this->getTimeoutMsec()); - - $this->waitForElementPresent('css=#memberSearch table tbody tr td span a.action-item-first'); + $this->clickLink("_qf_Search_refresh", 'css=#memberSearch table tbody tr td span a.action-item-first'); $this->click('css=#memberSearch table tbody tr td span a.action-item-first'); $this->waitForElementPresent("_qf_MembershipView_cancel-bottom"); @@ -183,10 +177,7 @@ class WebTest_Member_OnlineMembershipRenewTest extends CiviSeleniumTestCase { $this->select("billing_state_province_id-5", "value=1004"); $this->type("billing_postal_code-5", "94129"); - $this->click("_qf_Main_upload-bottom"); - - $this->waitForPageToLoad($this->getTimeoutMsec()); - $this->waitForElementPresent("_qf_Confirm_next-bottom"); + $this->clickLink("_qf_Main_upload-bottom", "_qf_Confirm_next-bottom"); $this->click("_qf_Confirm_next-bottom"); $this->waitForPageToLoad($this->getTimeoutMsec()); @@ -195,10 +186,7 @@ class WebTest_Member_OnlineMembershipRenewTest extends CiviSeleniumTestCase { $this->openCiviPage("member/search", "reset=1", "member_end_date_high"); $this->type("sort_name", "$firstName $lastName"); - $this->click("_qf_Search_refresh"); - $this->waitForPageToLoad($this->getTimeoutMsec()); - - $this->waitForElementPresent('css=#memberSearch table tbody tr td span a.action-item-first'); + $this->clickLink("_qf_Search_refresh", 'css=#memberSearch table tbody tr td span a.action-item-first'); $this->click('css=#memberSearch table tbody tr td span a.action-item-first'); $this->waitForElementPresent("_qf_MembershipView_cancel-bottom"); @@ -298,10 +286,7 @@ class WebTest_Member_OnlineMembershipRenewTest extends CiviSeleniumTestCase { $this->select("billing_state_province_id-5", "value=1004"); $this->type("billing_postal_code-5", "94129"); - $this->click("_qf_Main_upload-bottom"); - - $this->waitForPageToLoad($this->getTimeoutMsec()); - $this->waitForElementPresent("_qf_Confirm_next-bottom"); + $this->clickLink("_qf_Main_upload-bottom", "_qf_Confirm_next-bottom"); $this->click("_qf_Confirm_next-bottom"); $this->waitForPageToLoad($this->getTimeoutMsec()); @@ -310,10 +295,7 @@ class WebTest_Member_OnlineMembershipRenewTest extends CiviSeleniumTestCase { $this->openCiviPage("member/search", "reset=1", "member_end_date_high"); $this->type("sort_name", "$firstName $lastName"); - $this->click("_qf_Search_refresh"); - $this->waitForPageToLoad($this->getTimeoutMsec()); - - $this->waitForElementPresent('css=#memberSearch table tbody tr td span a.action-item-first'); + $this->clickLink("_qf_Search_refresh", 'css=#memberSearch table tbody tr td span a.action-item-first'); $this->click('css=#memberSearch table tbody tr td span a.action-item-first'); $this->waitForElementPresent("_qf_MembershipView_cancel-bottom"); @@ -345,10 +327,7 @@ class WebTest_Member_OnlineMembershipRenewTest extends CiviSeleniumTestCase { $this->type("cvv2", "000"); $this->select("credit_card_exp_date[M]", "value=1"); $this->select("credit_card_exp_date[Y]", "value=2020"); - $this->click("_qf_Main_upload-bottom"); - - $this->waitForPageToLoad($this->getTimeoutMsec()); - $this->waitForElementPresent("_qf_Confirm_next-bottom"); + $this->clickLink("_qf_Main_upload-bottom", "_qf_Confirm_next-bottom"); $this->click("_qf_Confirm_next-bottom"); $this->waitForPageToLoad($this->getTimeoutMsec()); @@ -356,10 +335,7 @@ class WebTest_Member_OnlineMembershipRenewTest extends CiviSeleniumTestCase { $this->openCiviPage("member/search", "reset=1", "member_end_date_high"); $this->type("sort_name", "$firstName $lastName"); - $this->click("_qf_Search_refresh"); - $this->waitForPageToLoad($this->getTimeoutMsec()); - - $this->waitForElementPresent('css=#memberSearch table tbody tr td span a.action-item-first'); + $this->clickLink("_qf_Search_refresh", 'css=#memberSearch table tbody tr td span a.action-item-first'); $this->click('css=#memberSearch table tbody tr td span a.action-item-first'); $this->waitForElementPresent("_qf_MembershipView_cancel-bottom"); @@ -542,9 +518,7 @@ class WebTest_Member_OnlineMembershipRenewTest extends CiviSeleniumTestCase { $this->select("billing_country_id-5", "value=1228"); $this->select("billing_state_province_id-5", "value=1004"); $this->type("billing_postal_code-5", "94129"); - $this->click("_qf_Main_upload-bottom"); - $this->waitForPageToLoad($this->getTimeoutMsec()); - $this->waitForElementPresent("_qf_Confirm_next-bottom"); + $this->clickLink("_qf_Main_upload-bottom", "_qf_Confirm_next-bottom"); $this->click("_qf_Confirm_next-bottom"); $this->waitForPageToLoad($this->getTimeoutMsec()); @@ -558,10 +532,7 @@ class WebTest_Member_OnlineMembershipRenewTest extends CiviSeleniumTestCase { $this->openCiviPage("member/search", "reset=1", "member_end_date_high"); $this->type("sort_name", "$organisationName"); - $this->click("_qf_Search_refresh"); - $this->waitForPageToLoad($this->getTimeoutMsec()); - - $this->waitForElementPresent('css=#memberSearch table tbody tr td span a.action-item-first'); + $this->clickLink("_qf_Search_refresh", 'css=#memberSearch table tbody tr td span a.action-item-first'); $this->click('css=#memberSearch table tbody tr td span a.action-item-first'); $this->waitForElementPresent("_qf_MembershipView_cancel-bottom"); @@ -582,10 +553,7 @@ class WebTest_Member_OnlineMembershipRenewTest extends CiviSeleniumTestCase { $this->openCiviPage("member/search", "reset=1", "member_end_date_high"); $this->type("sort_name", "$lastName, $firstName"); - $this->click("_qf_Search_refresh"); - $this->waitForPageToLoad($this->getTimeoutMsec()); - - $this->waitForElementPresent('css=#memberSearch table tbody tr td span a.action-item-first'); + $this->clickLink("_qf_Search_refresh", 'css=#memberSearch table tbody tr td span a.action-item-first'); $this->click('css=#memberSearch table tbody tr td span a.action-item-first'); $this->waitForElementPresent("_qf_MembershipView_cancel-bottom"); @@ -640,10 +608,7 @@ class WebTest_Member_OnlineMembershipRenewTest extends CiviSeleniumTestCase { $this->select("billing_state_province_id-5", "value=1004"); $this->type("billing_postal_code-5", "94129"); - $this->click("_qf_Main_upload-bottom"); - - $this->waitForPageToLoad($this->getTimeoutMsec()); - $this->waitForElementPresent("_qf_Confirm_next-bottom"); + $this->clickLink("_qf_Main_upload-bottom", "_qf_Confirm_next-bottom"); $this->click("_qf_Confirm_next-bottom"); $this->waitForPageToLoad($this->getTimeoutMsec()); @@ -656,10 +621,7 @@ class WebTest_Member_OnlineMembershipRenewTest extends CiviSeleniumTestCase { $this->openCiviPage("member/search", "reset=1", "member_end_date_high"); $this->type("sort_name", "$organisationName"); - $this->click("_qf_Search_refresh"); - $this->waitForPageToLoad($this->getTimeoutMsec()); - - $this->waitForElementPresent('css=#memberSearch table tbody tr td span a.action-item-first'); + $this->clickLink("_qf_Search_refresh", 'css=#memberSearch table tbody tr td span a.action-item-first'); $this->click('css=#memberSearch table tbody tr td span a.action-item-first'); $this->waitForElementPresent("_qf_MembershipView_cancel-bottom"); @@ -679,10 +641,7 @@ class WebTest_Member_OnlineMembershipRenewTest extends CiviSeleniumTestCase { $this->openCiviPage("member/search", "reset=1", "member_end_date_high"); $this->type("sort_name", "$lastName, $firstName"); - $this->click("_qf_Search_refresh"); - $this->waitForPageToLoad($this->getTimeoutMsec()); - - $this->waitForElementPresent('css=#memberSearch table tbody tr td span a.action-item-first'); + $this->clickLink("_qf_Search_refresh", 'css=#memberSearch table tbody tr td span a.action-item-first'); $this->click('css=#memberSearch table tbody tr td span a.action-item-first'); $this->waitForElementPresent("_qf_MembershipView_cancel-bottom"); diff --git a/tests/phpunit/WebTest/Member/SeperateMembershipPaymentTest.php b/tests/phpunit/WebTest/Member/SeperateMembershipPaymentTest.php index f3b038bb1a..81e1173ee0 100644 --- a/tests/phpunit/WebTest/Member/SeperateMembershipPaymentTest.php +++ b/tests/phpunit/WebTest/Member/SeperateMembershipPaymentTest.php @@ -103,9 +103,7 @@ class WebTest_Member_SeperateMembershipPaymentTest extends CiviSeleniumTestCase $this->openCiviPage('admin/contribute/membership', "reset=1&action=update&id={$pageId}", "_qf_MembershipBlock_next-bottom"); $this->click("membership_type_$memTypeId1"); $this->click("membership_type_$memTypeId2"); - $this->click('_qf_MembershipBlock_next'); - $this->waitForPageToLoad($this->getTimeoutMsec()); - $this->waitForElementPresent('_qf_MembershipBlock_next-bottom'); + $this->clickLink('_qf_MembershipBlock_next', '_qf_MembershipBlock_next-bottom'); $text = "'MembershipBlock' information has been saved."; $this->assertElementContainsText('crm-notification-container', $text, 'Missing text: ' . $text); $this->_testOnlineMembershipSignup($pageId, $memTypeTitle1, $cid); @@ -113,9 +111,7 @@ class WebTest_Member_SeperateMembershipPaymentTest extends CiviSeleniumTestCase //Find Member $this->openCiviPage('member/search', 'reset=1', 'member_end_date_high'); $this->type("sort_name", "$firstName1 $lastName1"); - $this->click("_qf_Search_refresh"); - $this->waitForPageToLoad($this->getTimeoutMsec()); - $this->waitForElementPresent("xpath=//div[@id='memberSearch']/table/tbody/tr"); + $this->clickLink("_qf_Search_refresh", "xpath=//div[@id='memberSearch']/table/tbody/tr"); $this->click("xpath=//div[@id='memberSearch']/table/tbody/tr/td[11]/span/a[text()='View']"); $this->waitForElementPresent("_qf_MembershipView_cancel-bottom"); diff --git a/tests/phpunit/WebTest/Pledge/ContactContextAddTest.php b/tests/phpunit/WebTest/Pledge/ContactContextAddTest.php index 450790224a..9c777138a5 100644 --- a/tests/phpunit/WebTest/Pledge/ContactContextAddTest.php +++ b/tests/phpunit/WebTest/Pledge/ContactContextAddTest.php @@ -118,10 +118,7 @@ class WebTest_Pledge_ContactContextAddTest extends CiviSeleniumTestCase { $this->verifyText("xpath=//form[@id='PledgeView']//table/tbody/tr/td[text()='{$label}']/following-sibling::td", preg_quote($value)); } - $this->click("_qf_PledgeView_next-bottom"); - $this->waitForPageToLoad($this->getTimeoutMsec()); - - $this->waitForElementPresent("xpath=//div[@id='Pledges']//table//tbody/tr[1]/td[10]/span[1]/a[text()='View']"); + $this->clickLink("_qf_PledgeView_next-bottom", "xpath=//div[@id='Pledges']//table//tbody/tr[1]/td[10]/span[1]/a[text()='View']"); $this->click("xpath=//div[@id='Pledges']//table//tbody/tr[1]/td[1]/span/a"); $this->waitForElementPresent("xpath=//div[@id='Pledges']//table//tbody//tr//td[2]/table/tbody/tr[2]/td[8]/a[text()='Record Payment (Check, Cash, EFT ...)']"); } diff --git a/tests/phpunit/WebTest/Pledge/ContactContextPledgePaymentAddTest.php b/tests/phpunit/WebTest/Pledge/ContactContextPledgePaymentAddTest.php index 58ffef1427..d0df48f102 100644 --- a/tests/phpunit/WebTest/Pledge/ContactContextPledgePaymentAddTest.php +++ b/tests/phpunit/WebTest/Pledge/ContactContextPledgePaymentAddTest.php @@ -122,10 +122,7 @@ class WebTest_Pledge_ContactContextPledgePaymentAddTest extends CiviSeleniumTest ) ); - $this->click("_qf_PledgeView_next-bottom"); - $this->waitForPageToLoad($this->getTimeoutMsec()); - - $this->waitForElementPresent("xpath=//div[@id='Pledges']//table//tbody/tr[1]/td[10]/span/a[text()='View']"); + $this->clickLink("_qf_PledgeView_next-bottom", "xpath=//div[@id='Pledges']//table//tbody/tr[1]/td[10]/span/a[text()='View']"); $this->click("xpath=//div[@id='Pledges']//table//tbody/tr[1]/td[1]/span/a"); $this->waitForElementPresent("xpath=//div[@id='Pledges']//table//tbody//tr//td/table/tbody/tr[2]/td[8]/a[text()='Record Payment (Check, Cash, EFT ...)']"); $this->click("xpath=//div[@id='Pledges']//table//tbody//tr//td/table/tbody/tr[2]/td[8]/a[text()='Record Payment (Check, Cash, EFT ...)']"); @@ -168,10 +165,7 @@ class WebTest_Pledge_ContactContextPledgePaymentAddTest extends CiviSeleniumTest ) ); - $this->click("_qf_PledgeView_next-bottom"); - $this->waitForPageToLoad($this->getTimeoutMsec()); - - $this->waitForElementPresent("xpath=//div[@id='Pledges']//table//tbody/tr[1]/td[10]/span/a[text()='View']"); + $this->clickLink("_qf_PledgeView_next-bottom", "xpath=//div[@id='Pledges']//table//tbody/tr[1]/td[10]/span/a[text()='View']"); $this->click("xpath=//div[@id='Pledges']//table//tbody/tr[1]/td[1]/span/a"); $this->waitForElementPresent("xpath=//div[@id='Pledges']//table//tbody//tr//td/table/tbody/tr[4]/td[8]/a[text()='Record Payment (Check, Cash, EFT ...)']"); $this->click("xpath=//div[@id='Pledges']//table//tbody//tr//td/table/tbody/tr[4]/td[8]/a[text()='Record Payment (Check, Cash, EFT ...)']"); @@ -302,10 +296,7 @@ class WebTest_Pledge_ContactContextPledgePaymentAddTest extends CiviSeleniumTest ) ); - $this->click("_qf_PledgeView_next-bottom"); - $this->waitForPageToLoad($this->getTimeoutMsec()); - - $this->waitForElementPresent("xpath=//div[@id='Pledges']//table//tbody/tr[1]/td[10]/span/a[text()='View']"); + $this->clickLink("_qf_PledgeView_next-bottom", "xpath=//div[@id='Pledges']//table//tbody/tr[1]/td[10]/span/a[text()='View']"); $this->click("xpath=//div[@id='Pledges']//table//tbody/tr[1]/td[1]/span/a"); $this->waitForElementPresent("xpath=//div[@id='Pledges']//table//tbody//tr//td/table/tbody/tr[2]/td[8]/a[text()='Record Payment (Check, Cash, EFT ...)']"); $this->click("xpath=//div[@id='Pledges']//table//tbody//tr//td/table/tbody/tr[2]/td[8]/a[text()='Record Payment (Check, Cash, EFT ...)']"); @@ -352,10 +343,7 @@ class WebTest_Pledge_ContactContextPledgePaymentAddTest extends CiviSeleniumTest ) ); - $this->click("_qf_PledgeView_next-bottom"); - $this->waitForPageToLoad($this->getTimeoutMsec()); - - $this->waitForElementPresent("xpath=//div[@id='Pledges']//table//tbody/tr[1]/td[10]/span/a[text()='View']"); + $this->clickLink("_qf_PledgeView_next-bottom", "xpath=//div[@id='Pledges']//table//tbody/tr[1]/td[10]/span/a[text()='View']"); $this->click("xpath=//div[@id='Pledges']//table//tbody/tr[1]/td[1]/span/a"); $this->waitForElementPresent("xpath=//div[@id='Pledges']//table//tbody//tr//td/table/tbody/tr[4]/td[8]/a[text()='Record Payment (Check, Cash, EFT ...)']"); $this->click("xpath=//div[@id='Pledges']//table//tbody//tr//td/table/tbody/tr[4]/td[8]/a[text()='Record Payment (Check, Cash, EFT ...)']"); diff --git a/tests/phpunit/WebTest/Pledge/StandaloneAddDeleteTest.php b/tests/phpunit/WebTest/Pledge/StandaloneAddDeleteTest.php index 351a7bc7b0..c94640d8d7 100644 --- a/tests/phpunit/WebTest/Pledge/StandaloneAddDeleteTest.php +++ b/tests/phpunit/WebTest/Pledge/StandaloneAddDeleteTest.php @@ -71,10 +71,7 @@ class WebTest_Pledge_StandaloneAddDeleteTest extends CiviSeleniumTestCase { 'Pledge Status' => 'Pending', ) ); - $this->click('_qf_PledgeView_next-bottom'); - $this->waitForPageToLoad("30000"); - - $this->waitForElementPresent("xpath=//div[@id='Pledges']//table//tbody/tr[1]/td[10]/span/a[text()='View']"); + $this->clickLink('_qf_PledgeView_next-bottom', "xpath=//div[@id='Pledges']//table//tbody/tr[1]/td[10]/span/a[text()='View']"); $this->click("xpath=//div[@id='Pledges']//table//tbody/tr[1]/td[1]/span/a"); $this->waitForElementPresent("xpath=//div[@id='Pledges']//table//tbody//tr//td/table/tbody/tr[2]/td[8]/a[text()='Record Payment (Check, Cash, EFT ...)']"); $this->click("xpath=//div[@id='Pledges']//table//tbody//tr//td/table/tbody/tr[2]/td[8]/a"); diff --git a/tests/phpunit/WebTest/Pledge/StandaloneAddTest.php b/tests/phpunit/WebTest/Pledge/StandaloneAddTest.php index f41579896d..152b25bb83 100644 --- a/tests/phpunit/WebTest/Pledge/StandaloneAddTest.php +++ b/tests/phpunit/WebTest/Pledge/StandaloneAddTest.php @@ -98,10 +98,7 @@ class WebTest_Pledge_StandaloneAddTest extends CiviSeleniumTestCase { 'Send additional reminders' => '4 days after the last one sent', ) ); - $this->click('_qf_PledgeView_next-bottom'); - $this->waitForPageToLoad($this->getTimeoutMsec()); - - $this->waitForElementPresent("xpath=//div[@id='Pledges']//table//tbody/tr[1]/td[10]/span/a[text()='View']"); + $this->clickLink('_qf_PledgeView_next-bottom', "xpath=//div[@id='Pledges']//table//tbody/tr[1]/td[10]/span/a[text()='View']"); $this->click("xpath=//div[@id='Pledges']//table//tbody/tr[1]/td[1]/span/a"); $this->waitForElementPresent("xpath=//div[@id='Pledges']//table//tbody//tr//td/table/tbody/tr[2]/td[8]/a[text()='Record Payment (Check, Cash, EFT ...)']"); } diff --git a/tests/phpunit/WebTest/Profile/BatchUpdateTest.php b/tests/phpunit/WebTest/Profile/BatchUpdateTest.php index e3aa6d30d9..2fc8851ef7 100644 --- a/tests/phpunit/WebTest/Profile/BatchUpdateTest.php +++ b/tests/phpunit/WebTest/Profile/BatchUpdateTest.php @@ -397,9 +397,7 @@ class WebTest_Profile_BatchUpdateTest extends CiviSeleniumTestCase { $this->waitForElementPresent('sort_name'); $this->type('sort_name', $lastName); $this->waitForElementPresent('_qf_Search_refresh'); - $this->click('_qf_Search_refresh'); - $this->waitForPageToLoad($this->getTimeoutMsec()); - $this->waitForElementPresent('Go'); + $this->clickLink('_qf_Search_refresh', 'Go'); $this->click('CIVICRM_QFID_ts_all_4'); $this->click('Go'); $this->waitForElementPresent('_qf_Reserve_next_reserveToInterview-top'); diff --git a/tests/phpunit/WebTest/Profile/SearchTest.php b/tests/phpunit/WebTest/Profile/SearchTest.php index c3ca85181a..cc2047bf10 100644 --- a/tests/phpunit/WebTest/Profile/SearchTest.php +++ b/tests/phpunit/WebTest/Profile/SearchTest.php @@ -102,11 +102,7 @@ class WebTest_Profile_SearchTest extends CiviSeleniumTestCase { $this->click('is_searchable'); $this->click('in_selector'); // click on save - $this->click('_qf_Field_next-bottom'); - $this->waitForPageToLoad($this->getTimeoutMsec()); - - // Add Individual Contact. - $this->waitForElementPresent("xpath=//div[@id='field_page']/div[1]/a[4]/span[text()='Use (create mode)']"); + $this->clickLink('_qf_Field_next-bottom', "xpath=//div[@id='field_page']/div[1]/a[4]/span[text()='Use (create mode)']"); $this->click("xpath=//div[@id='field_page']/div[1]/a[4]/span[text()='Use (create mode)']"); $this->waitForElementPresent('_qf_Edit_next'); @@ -148,11 +144,7 @@ class WebTest_Profile_SearchTest extends CiviSeleniumTestCase { // Edit first profile field $this->waitForElementPresent("xpath=//table/tbody/tr[1]/td[9]"); - $this->click("xpath=//table/tbody/tr[1]/td[9]/span[1]/a[1]"); - - // Verify that visibility field is present in edit form - $this->waitForPageToLoad($this->getTimeoutMsec()); - $this->waitForElementPresent('_qf_Field_next-bottom'); + $this->clickLink("xpath=//table/tbody/tr[1]/td[9]/span[1]/a[1]", '_qf_Field_next-bottom'); // sleep 5 to make sure jQuery is not hiding field after page load // Because it tends to cause problems, all uses of sleep() must be justified in comments diff --git a/tests/phpunit/WebTest/Report/LoggingReportTest.php b/tests/phpunit/WebTest/Report/LoggingReportTest.php index 5b15a6d3fd..c764f8c9ac 100644 --- a/tests/phpunit/WebTest/Report/LoggingReportTest.php +++ b/tests/phpunit/WebTest/Report/LoggingReportTest.php @@ -59,10 +59,7 @@ class WebTest_Report_LoggingReportTest extends CiviSeleniumTestCase { // Justification for this instance: FIXME sleep(3); $this->select("group_id", "label=Case Resources"); - $this->click("_qf_GroupContact_next"); - - $this->waitForPageToLoad($this->getTimeoutMsec()); - $this->waitForElementPresent("xpath=//form[@id='GroupContact']//div[@class='view-content']//div[@class='dataTables_wrapper']/table/tbody/tr/td[4]/a"); + $this->clickLink("_qf_GroupContact_next", "xpath=//form[@id='GroupContact']//div[@class='view-content']//div[@class='dataTables_wrapper']/table/tbody/tr/td[4]/a"); $this->click("xpath=//form[@id='GroupContact']//div[@class='view-content']//div[@class='dataTables_wrapper']/table/tbody/tr/td[4]/a"); // Check confirmation alert. @@ -130,9 +127,7 @@ class WebTest_Report_LoggingReportTest extends CiviSeleniumTestCase { $this->select("relationship_type_id", "label=Employee of"); $this->webtestFillAutocomplete("Default Organization"); $this->waitForElementPresent("quick-save"); - $this->click("quick-save"); - $this->waitForPageToLoad($this->getTimeoutMsec()); - $this->waitForElementPresent("xpath=//div[@id='current-relationships']//a[text()='Disable']"); + $this->clickLink("quick-save", "xpath=//div[@id='current-relationships']//a[text()='Disable']"); $this->click("xpath=//div[@id='current-relationships']//a[text()='Disable']"); $this->assertTrue((bool)preg_match("/^Are you sure you want to disable this relationship/", $this->getConfirmation()