From 071a6d2e0aa7b375dbf6fecb4333a47a8ee35856 Mon Sep 17 00:00:00 2001 From: Coleman Watts Date: Tue, 19 Mar 2013 11:50:39 -0700 Subject: [PATCH] Mass switch to openCiviPage method --- .../Admin/Form/Setting/LocalizationTest.php | 4 +- .../Campaign/OfflineEventRegistrationTest.php | 7 +- .../Campaign/PetitionUsageScenarioTest.php | 10 +-- .../WebTest/Contact/ContactTagTest.php | 2 +- .../phpunit/WebTest/Contact/GroupAddTest.php | 7 +- .../WebTest/Contact/MergeContactsTest.php | 43 ++++----- .../Contact/MultipleContactSubTypes.php | 4 +- .../Contact/PrivacyOptionSearchTest.php | 9 +- .../WebTest/Contact/ProfileChecksumTest.php | 9 +- .../WebTest/Contact/RelationshipAddTest.php | 3 +- tests/phpunit/WebTest/Contact/SearchTest.php | 14 +-- .../Contact/SearchbyDateFilterTest.php | 23 ++--- tests/phpunit/WebTest/Contact/TagAddTest.php | 2 +- .../Contact/TaskActionSendMassMailing.php | 3 +- .../WebTest/Contact/TaskActionSendSMS.php | 6 +- .../WebTest/Contribute/AddBatchesTest.php | 4 +- .../WebTest/Contribute/AddPricesetTest.php | 7 +- .../Contribute/ContributionPageAddTest.php | 16 ++-- .../Contribute/OfflineContributionTest.php | 13 +-- .../Contribute/OnBehalfOfOrganization.php | 89 +++++++------------ .../Contribute/OnlineContributionTest.php | 4 +- .../OnlineMultiplePaymentProcessorTest.php | 8 +- .../OnlineRecurContributionTest.php | 3 +- .../phpunit/WebTest/Contribute/PCPAddTest.php | 3 +- .../Contribute/UpdateContributionTest.php | 86 ++---------------- .../Contribute/VerifySSLContributionTest.php | 3 +- tests/phpunit/WebTest/Event/AddEventTest.php | 25 +++--- .../WebTest/Event/EventWaitListTest.php | 4 +- .../MultipleEventRegistrationbyCartTest.php | 29 +++--- .../WebTest/Event/MultiprofileEventTest.php | 79 ++++++---------- tests/phpunit/WebTest/Event/PCPAddTest.php | 8 +- .../WebTest/Event/ParticipantSearchTest.php | 30 ++----- .../phpunit/WebTest/Event/TellAFriendTest.php | 2 +- .../Financial/FinancialAccountTest.php | 8 +- .../Financial/FinancialBatchExport.php | 10 +-- .../WebTest/Import/AddressParsingTest.php | 39 +++----- .../WebTest/Import/ContactCustomDataTest.php | 5 +- .../WebTest/Import/ContactSubtypeTest.php | 20 ++--- tests/phpunit/WebTest/Import/ContactTest.php | 18 ++-- .../phpunit/WebTest/Import/CustomDataTest.php | 2 +- .../WebTest/Import/DuplicateMatchingTest.php | 9 +- tests/phpunit/WebTest/Import/GroupTest.php | 4 +- .../Import/ImportCiviSeleniumTestCase.php | 9 +- tests/phpunit/WebTest/Import/TagTest.php | 5 +- .../Member/DefaultMembershipPricesetTest.php | 2 +- .../Member/FixedMembershipTypeTest.php | 20 ++--- .../Member/OnlineMembershipRenewTest.php | 10 +-- .../phpunit/WebTest/Release/InstallScript.php | 2 +- 48 files changed, 236 insertions(+), 486 deletions(-) diff --git a/tests/phpunit/WebTest/Admin/Form/Setting/LocalizationTest.php b/tests/phpunit/WebTest/Admin/Form/Setting/LocalizationTest.php index 4b549fb77b..7df29c6ce8 100644 --- a/tests/phpunit/WebTest/Admin/Form/Setting/LocalizationTest.php +++ b/tests/phpunit/WebTest/Admin/Form/Setting/LocalizationTest.php @@ -34,9 +34,7 @@ class WebTest_Admin_Form_Setting_LocalizationTest extends CiviSeleniumTestCase { function testDefaultCountryIsEnabled() { $this->webtestLogin(); - $this->open($this->sboxPath . "civicrm/admin/setting/localization?reset=1"); - - $this->waitForPageToLoad($this->getTimeoutMsec()); + $this->openCiviPage("admin/setting/localization", "reset=1"); $this->addSelection("countryLimit-t", "label=United States"); $this->click("//select[@id='countryLimit-t']/option"); $this->click("//input[@name='remove' and @value='<< Remove' and @type='button' and @onclick=\"QFAMS.moveSelection('countryLimit', this.form.elements['countryLimit-f[]'], this.form.elements['countryLimit-t[]'], this.form.elements['countryLimit[]'], 'remove', 'none'); return false;\"]"); diff --git a/tests/phpunit/WebTest/Campaign/OfflineEventRegistrationTest.php b/tests/phpunit/WebTest/Campaign/OfflineEventRegistrationTest.php index 8e71a0e711..5b88d128fc 100644 --- a/tests/phpunit/WebTest/Campaign/OfflineEventRegistrationTest.php +++ b/tests/phpunit/WebTest/Campaign/OfflineEventRegistrationTest.php @@ -77,8 +77,8 @@ class WebTest_Campaign_OfflineEventRegistrationTest extends CiviSeleniumTestCase $this->webtestLogin(); $this->openCiviPage("campaign", "reset=1", "link=Add Campaign"); - if ($this->isTextPresent('No campaigns found.')) { + if ($this->isTextPresent('No campaigns found.')) { $this->openCiviPage("participant/add", "reset=1&action=add&context=standalone", "_qf_Participant_upload-bottom"); $this->assertTrue($this->isTextPresent('There are currently no active Campaigns.')); } @@ -120,7 +120,7 @@ class WebTest_Campaign_OfflineEventRegistrationTest extends CiviSeleniumTestCase function offlineParticipantAddTest($campaignTitle, $id) { // connect campaign with event - $this->open($this->sboxPath . "civicrm/event/manage&reset=1"); + $this->openCiviPage("event/manage", "reset=1"); $eventId = $this->registerUrl(); $this->openCiviPage('event/manage/settings', "reset=1&action=update&id=$eventId", "_qf_EventInfo_cancel-bottom"); @@ -216,8 +216,7 @@ class WebTest_Campaign_OfflineEventRegistrationTest extends CiviSeleniumTestCase } function registerUrl() { - $this->open($this->sboxPath . 'civicrm/event/manage?reset=1'); - $this->waitForPageToLoad($this->getTimeoutMsec()); + $this->openCiviPage("event/manage", "reset=1"); $eventId = explode('_', $this->getAttribute("//div[@id='event_status_id']//table/tbody/tr@id")); return $eventId[1]; } diff --git a/tests/phpunit/WebTest/Campaign/PetitionUsageScenarioTest.php b/tests/phpunit/WebTest/Campaign/PetitionUsageScenarioTest.php index 9fddda7bf8..5be5d26d0f 100644 --- a/tests/phpunit/WebTest/Campaign/PetitionUsageScenarioTest.php +++ b/tests/phpunit/WebTest/Campaign/PetitionUsageScenarioTest.php @@ -98,10 +98,7 @@ class WebTest_Campaign_PetitionUsageScenarioTest extends CiviSeleniumTestCase { ////////////// Create petition using New Individual profile ////////////////////// - $this->open($this->sboxPath . "civicrm/petition/add?reset=1"); - - // button at the end of this page to show up, to make sure it's fully loaded. - $this->waitForElementPresent("_qf_Petition_next-bottom"); + $this->openCiviPage("petition/add", "reset=1", "_qf_Petition_next-bottom"); // fill petition tile. $title = substr(sha1(rand()), 0, 7); @@ -188,10 +185,7 @@ class WebTest_Campaign_PetitionUsageScenarioTest extends CiviSeleniumTestCase { } // ONCE MORE, NO EMAIL VERIFICATION AND CUSTOM THANK-YOU - $this->open($this->sboxPath . "civicrm/petition/add?reset=1"); - - // button at the end of this page to show up, to make sure it's fully loaded. - $this->waitForElementPresent("_qf_Petition_next-bottom"); + $this->openCiviPage("petition/add", "reset=1", "_qf_Petition_next-bottom"); // fill petition tile. $title = substr(sha1(rand()), 0, 7); diff --git a/tests/phpunit/WebTest/Contact/ContactTagTest.php b/tests/phpunit/WebTest/Contact/ContactTagTest.php index 5f0edfbb7d..2493acfd0f 100644 --- a/tests/phpunit/WebTest/Contact/ContactTagTest.php +++ b/tests/phpunit/WebTest/Contact/ContactTagTest.php @@ -79,7 +79,7 @@ class WebTest_Contact_ContactTagTest extends CiviSeleniumTestCase { function testTagSetContact() { $this->webtestLogin(); - $this->open($this->sboxPath . "civicrm/admin/tag?action=add&reset=1&tagset=1"); + $this->openCiviPage("admin/tag", "action=add&reset=1&tagset=1"); // take a tagset name $tagSetName = 'tagset_' . substr(sha1(rand()), 0, 7); diff --git a/tests/phpunit/WebTest/Contact/GroupAddTest.php b/tests/phpunit/WebTest/Contact/GroupAddTest.php index c0ed6e8195..6b8e438ba9 100644 --- a/tests/phpunit/WebTest/Contact/GroupAddTest.php +++ b/tests/phpunit/WebTest/Contact/GroupAddTest.php @@ -157,21 +157,22 @@ class WebTest_Contact_GroupAddTest extends CiviSeleniumTestCase { ); $this->changePermissions($permissions); - // Now logout as admin, login as regular user and verify that Group settings, delete and disable links are not available + // Now logout as admin, login as regular user and verify that Group settings, + // delete and disable links are not available $this->webtestLogin($user, 'Test12345'); $this->openCiviPage('group', 'reset=1'); $this->type('title', $params['name']); $this->click('_qf_Search_refresh'); $this->waitForTextPresent("Adding new reserved group."); - // Settings link should NOT be included in selector after search returns with only the reserved group. + // Settings link should NOT be included in selector + // after search returns with only the reserved group. $this->assertElementNotContainsText("css=td.crm-group-group_links", "Settings"); //login as admin and delete the role $this->webtestLogin('admin'); $this->open($this->sboxPath . "admin/people/permissions/roles"); $this->_roleDelete($role); - } function _testCreateUser($roleid) { diff --git a/tests/phpunit/WebTest/Contact/MergeContactsTest.php b/tests/phpunit/WebTest/Contact/MergeContactsTest.php index 3fd0e8a4a4..e06de201ff 100644 --- a/tests/phpunit/WebTest/Contact/MergeContactsTest.php +++ b/tests/phpunit/WebTest/Contact/MergeContactsTest.php @@ -35,8 +35,7 @@ class WebTest_Contact_MergeContactsTest extends CiviSeleniumTestCase { function testIndividualAdd() { $this->webtestLogin(); - $this->open($this->sboxPath . "civicrm/contact/add?reset=1&ct=Individual"); - $this->waitForPageToLoad($this->getTimeoutMsec()); + $this->openCiviPage("contact/add", "reset=1&ct=Individual"); // add contact1 //select prefix @@ -88,7 +87,7 @@ class WebTest_Contact_MergeContactsTest extends CiviSeleniumTestCase { $this->addActivity($firstName, $lastName, $subject); // contact2: duplicate of contact1. - $this->open($this->sboxPath . "civicrm/contact/add?reset=1&ct=Individual"); + $this->openCiviPage("contact/add", "reset=1&ct=Individual"); //fill in first name $this->type("first_name", $firstName); @@ -115,8 +114,7 @@ class WebTest_Contact_MergeContactsTest extends CiviSeleniumTestCase { $this->webtestAddContact($fname2, $lname2, $email2); // Can not use helper for 2nd contact since it is a dupe - $this->open($this->sboxPath . "civicrm/contact/add?reset=1&ct=Individual"); - $this->waitForPageToLoad($this->getTimeoutMsec()); + $this->openCiviPage("contact/add", "reset=1&ct=Individual"); $this->type("first_name", $fname2); $this->type("last_name", $lname2); $this->type("email_1_email", $email2); @@ -128,12 +126,10 @@ class WebTest_Contact_MergeContactsTest extends CiviSeleniumTestCase { $this->assertElementContainsText('crm-notification-container', "Contact Saved"); // Find and Merge Contacts with Supervised Rule - $this->open($this->sboxPath . 'civicrm/contact/dedupefind?reset=1&rgid=1&action=renew'); - $this->waitForPageToLoad($this->getTimeoutMsec()); + $this->openCiviPage("contact/dedupefind", "reset=1&rgid=1&action=renew"); // reload the page - $this->open($this->sboxPath . 'civicrm/contact/dedupefind?reset=1&rgid=1&action=update'); - $this->waitForPageToLoad($this->getTimeoutMsec()); + $this->openCiviPage("contact/dedupefind", "reset=1&rgid=1&action=update"); // Select the contacts to be merged $this->select("name=option51_length", "value=100"); @@ -282,8 +278,7 @@ class WebTest_Contact_MergeContactsTest extends CiviSeleniumTestCase { function testMergeTest() { $this->webtestLogin(); - $this->open($this->sboxPath . "civicrm/contact/add?reset=1&ct=Individual"); - $this->waitForPageToLoad($this->getTimeoutMsec()); + $this->openCiviPage("contact/add", "reset=1&ct=Individual"); // add contact1 //fill in first name @@ -318,7 +313,7 @@ class WebTest_Contact_MergeContactsTest extends CiviSeleniumTestCase { $this->assertElementContainsText('crm-notification-container', "Contact Saved"); // contact2: duplicate of contact1. - $this->open($this->sboxPath . "civicrm/contact/add?reset=1&ct=Individual"); + $this->openCiviPage("contact/add", "reset=1&ct=Individual"); //fill in first name $this->type("first_name", $firstName); @@ -342,8 +337,7 @@ class WebTest_Contact_MergeContactsTest extends CiviSeleniumTestCase { $this->assertElementContainsText('crm-notification-container', "Contact Saved"); // Find and Merge Contacts with Supervised Rule - $this->open($this->sboxPath . 'civicrm/contact/dedupefind?reset=1&rgid=1&action=renew'); - $this->waitForPageToLoad($this->getTimeoutMsec()); + $this->openCiviPage("contact/dedupefind", "reset=1&rgid=1&action=renew"); // Select the contacts to be merged $this->select("name=option51_length", "value=100"); @@ -380,8 +374,7 @@ class WebTest_Contact_MergeContactsTest extends CiviSeleniumTestCase { $this->assertTrue($this->isElementPresent("xpath=//div[@id='phone-block']/div/div/div[4]/div[2][contains(text(), '9876543120')]")); //Merge with the feature of (add) - $this->open($this->sboxPath . "civicrm/contact/add?reset=1&ct=Individual"); - $this->waitForPageToLoad($this->getTimeoutMsec()); + $this->openCiviPage("contact/add", "reset=1&ct=Individual"); // add contact1 //fill in first name @@ -411,7 +404,7 @@ class WebTest_Contact_MergeContactsTest extends CiviSeleniumTestCase { $this->assertElementContainsText('crm-notification-container', "Contact Saved"); // contact2: duplicate of contact1. - $this->open($this->sboxPath . "civicrm/contact/add?reset=1&ct=Individual"); + $this->openCiviPage("contact/add", "reset=1&ct=Individual"); //fill in first name $this->type("first_name", $firstName1); @@ -435,8 +428,7 @@ class WebTest_Contact_MergeContactsTest extends CiviSeleniumTestCase { $this->assertElementContainsText('crm-notification-container', "Contact Saved"); // Find and Merge Contacts with Supervised Rule - $this->open($this->sboxPath . 'civicrm/contact/dedupefind?reset=1&rgid=1&action=renew'); - $this->waitForPageToLoad($this->getTimeoutMsec()); + $this->openCiviPage("contact/dedupefind", "reset=1&rgid=1&action=renew"); // Select the contacts to be merged $this->select("name=option51_length", "value=100"); @@ -483,8 +475,7 @@ class WebTest_Contact_MergeContactsTest extends CiviSeleniumTestCase { //add contact2 and its duplicate //These are the contacts with conflicts in communication preference.these contacts will be skipped during merge. - $this->open($this->sboxPath . "civicrm/contact/add?reset=1&ct=Individual"); - $this->waitForPageToLoad($this->getTimeoutMsec()); + $this->openCiviPage("contact/add", "reset=1&ct=Individual"); //fill in first name $firstName1 = "Kurt".substr(sha1(rand()), 0, 7); @@ -521,7 +512,7 @@ class WebTest_Contact_MergeContactsTest extends CiviSeleniumTestCase { $this->assertElementContainsText('crm-notification-container', "Contact Saved"); //duplicate of contact2. - $this->open($this->sboxPath . "civicrm/contact/add?reset=1&ct=Individual"); + $this->openCiviPage("contact/add", "reset=1&ct=Individual"); //fill in first name $this->type("first_name", $firstName1); @@ -562,9 +553,7 @@ class WebTest_Contact_MergeContactsTest extends CiviSeleniumTestCase { $this->_createContacts($firstName3,$lastName3); // Find and Merge Contacts with Supervised Rule - $this->open($this->sboxPath . 'civicrm/contact/dedupefind?reset=1&rgid=1&action=renew'); - $this->waitForPageToLoad($this->getTimeoutMsec()); - sleep(3); + $this->openCiviPage("contact/dedupefind", "reset=1&rgid=1&action=renew", "css=#DedupeFind table.pagerDisplay tbody tr"); $this->select("name=option51_length", "value=100"); $totalContacts = $this->getXpathCount("//table[@class='pagerDisplay']/tbody/tr"); @@ -609,7 +598,7 @@ class WebTest_Contact_MergeContactsTest extends CiviSeleniumTestCase { */ function _createContacts($firstName,$lastName){ // add contact - $this->open($this->sboxPath . "civicrm/contact/add?reset=1&ct=Individual"); + $this->openCiviPage("contact/add", "reset=1&ct=Individual"); //fill in first name $this->type('first_name', $firstName); @@ -631,7 +620,7 @@ class WebTest_Contact_MergeContactsTest extends CiviSeleniumTestCase { $this->assertElementContainsText('crm-notification-container', "Contact Saved"); //duplicate of above contact. - $this->open($this->sboxPath . "civicrm/contact/add?reset=1&ct=Individual"); + $this->openCiviPage("contact/add", "reset=1&ct=Individual"); //fill in first name $this->type("first_name", $firstName); diff --git a/tests/phpunit/WebTest/Contact/MultipleContactSubTypes.php b/tests/phpunit/WebTest/Contact/MultipleContactSubTypes.php index 4f384aeaaa..62ff4697fc 100644 --- a/tests/phpunit/WebTest/Contact/MultipleContactSubTypes.php +++ b/tests/phpunit/WebTest/Contact/MultipleContactSubTypes.php @@ -44,7 +44,7 @@ class WebTest_Contact_MultipleContactSubTypes extends CiviSeleniumTestCase { list($groupTitleForParent, $customGroupIdForParent) = $this->_addCustomData($selection2); list($groupTitleForStaff, $customGroupIdForStaff) = $this->_addCustomData($selection3); - $this->open($this->sboxPath . "civicrm/contact/add?reset=1&ct=Individual"); + $this->openCiviPage("contact/add", "reset=1&ct=Individual"); //contact details section //select prefix @@ -271,7 +271,7 @@ class WebTest_Contact_MultipleContactSubTypes extends CiviSeleniumTestCase { function _addCustomData($contactSubType) { - $this->open($this->sboxPath . "civicrm/admin/custom/group?reset=1"); + $this->openCiviPage("admin/custom/group", "reset=1"); //add new custom data $customGroupTitle = "Custom group For {$contactSubType}" . substr(sha1(rand()), 0, 4); diff --git a/tests/phpunit/WebTest/Contact/PrivacyOptionSearchTest.php b/tests/phpunit/WebTest/Contact/PrivacyOptionSearchTest.php index 8202288133..f46b81cebb 100644 --- a/tests/phpunit/WebTest/Contact/PrivacyOptionSearchTest.php +++ b/tests/phpunit/WebTest/Contact/PrivacyOptionSearchTest.php @@ -106,8 +106,7 @@ class WebTest_Contact_PrivacyOptionSearchTest extends CiviSeleniumTestCase { $this->waitForPageToLoad($this->getTimeoutMsec()); // Go to advance search, check for 'Exclude' option. - $this->open($this->sboxPath . "civicrm/contact/search/advanced?reset=1"); - $this->waitForPageToLoad($this->getTimeoutMsec()); + $this->openCiviPage("contact/search/advanced", "reset=1"); $this->select("xpath=//form[@id='Advanced']//table[1]/tbody/tr[2]/td[2]//select[1]", "label={$groupName}"); $this->waitForTextPresent($groupName); @@ -124,8 +123,7 @@ class WebTest_Contact_PrivacyOptionSearchTest extends CiviSeleniumTestCase { $this->assertTrue($this->isTextPresent("No matches found")); // Go to advance search, check for 'Include' + 'OR' options. - $this->open($this->sboxPath . "civicrm/contact/search/advanced?reset=1"); - $this->waitForPageToLoad($this->getTimeoutMsec()); + $this->openCiviPage("contact/search/advanced", "reset=1"); $this->select("xpath=//form[@id='Advanced']//table[1]/tbody/tr[2]/td[2]//select[1]", "label={$groupName}"); $this->waitForTextPresent($groupName); @@ -145,8 +143,7 @@ class WebTest_Contact_PrivacyOptionSearchTest extends CiviSeleniumTestCase { $this->assertTrue($this->isTextPresent("$lname2, $fname2")); // Go to advance search, check for 'Include' + 'AND' options. - $this->open($this->sboxPath . "civicrm/contact/search/advanced?reset=1"); - $this->waitForPageToLoad($this->getTimeoutMsec()); + $this->openCiviPage("contact/search/advanced", "reset=1"); $this->select("xpath=//form[@id='Advanced']//table[1]/tbody/tr[2]/td[2]//select[1]", "label={$groupName}"); $this->waitForTextPresent($groupName); diff --git a/tests/phpunit/WebTest/Contact/ProfileChecksumTest.php b/tests/phpunit/WebTest/Contact/ProfileChecksumTest.php index 7f91028d61..197754a982 100644 --- a/tests/phpunit/WebTest/Contact/ProfileChecksumTest.php +++ b/tests/phpunit/WebTest/Contact/ProfileChecksumTest.php @@ -112,8 +112,7 @@ class WebTest_Contact_ProfileChecksumTest extends CiviSeleniumTestCase { $this->webtestLogout(); // Go to edit profile page of the created contact. - $this->open($this->sboxPath . "civicrm/profile/edit?id={$contactId}&gid={$profileId}&reset=1&cs={$cs}"); - $this->waitForPageToLoad(2 * $this->getTimeoutMsec()); + $this->openCiviPage("profile/edit", "id={$contactId}&gid={$profileId}&reset=1&cs={$cs}"); $this->assertStringsPresent(array($profileName)); // Check all profile fields, update their values. @@ -143,8 +142,7 @@ class WebTest_Contact_ProfileChecksumTest extends CiviSeleniumTestCase { function _testCreateContactProfile($fields, $profileName) { // Add new profile. - $this->open($this->sboxPath . 'civicrm/admin/uf/group?reset=1'); - $this->waitForPageToLoad(2 * $this->getTimeoutMsec()); + $this->openCiviPage("admin/uf/group", "reset=1"); $this->click('newCiviCRMProfile-top'); $this->waitForElementPresent('_qf_Group_next-top'); @@ -157,8 +155,7 @@ class WebTest_Contact_ProfileChecksumTest extends CiviSeleniumTestCase { // Add field to the profile. foreach ($fields as $key => $values) { - $this->open($this->sboxPath . 'civicrm/admin/uf/group/field/add?reset=1&action=add&gid=' . $profileId); - $this->waitForPageToLoad($this->getTimeoutMsec()); + $this->openCiviPage("admin/uf/group/field/add", "reset=1&action=add&gid=$profileId"); $this->select("field_name[0]", "value={$values['type']}"); sleep(1); diff --git a/tests/phpunit/WebTest/Contact/RelationshipAddTest.php b/tests/phpunit/WebTest/Contact/RelationshipAddTest.php index 02f4e988c9..de2d5f651e 100644 --- a/tests/phpunit/WebTest/Contact/RelationshipAddTest.php +++ b/tests/phpunit/WebTest/Contact/RelationshipAddTest.php @@ -222,8 +222,7 @@ class WebTest_Contact_RelationshipAddTest extends CiviSeleniumTestCase { "Status message didn't show up after saving!" ); - $this->open($this->sboxPath . 'civicrm/admin/reltype?reset=1'); - $this->waitForPageToLoad($this->getTimeoutMsec()); + $this->openCiviPage("admin/reltype", "reset=1"); //validate data on selector. $data = $params; diff --git a/tests/phpunit/WebTest/Contact/SearchTest.php b/tests/phpunit/WebTest/Contact/SearchTest.php index 159dc3ed44..6b0bd3f47d 100644 --- a/tests/phpunit/WebTest/Contact/SearchTest.php +++ b/tests/phpunit/WebTest/Contact/SearchTest.php @@ -43,8 +43,7 @@ class WebTest_Contact_SearchTest extends CiviSeleniumTestCase { $sortName = "Anderson, $firstName"; $displayName = "$firstName Anderson"; - $this->open($this->sboxPath . "civicrm/dashboard?reset=1"); - $this->waitForPageToLoad($this->getTimeoutMsec()); + $this->openCiviPage("dashboard", "reset=1"); // type sortname in autocomplete $this->click("css=input#sort_name_navigation"); @@ -72,8 +71,7 @@ class WebTest_Contact_SearchTest extends CiviSeleniumTestCase { $sortName = "Adams, {$firstName}"; - $this->open($this->sboxPath . "civicrm/dashboard?reset=1"); - $this->waitForPageToLoad($this->getTimeoutMsec()); + $this->openCiviPage("dashboard", "reset=1"); // type partial sortname in autocomplete $this->click("css=input#sort_name_navigation"); @@ -132,8 +130,7 @@ class WebTest_Contact_SearchTest extends CiviSeleniumTestCase { $this->waitForElementPresent("css=.success"); // visit contact search page - $this->open($this->sboxPath . "civicrm/contact/search?reset=1"); - $this->waitForPageToLoad($this->getTimeoutMsec()); + $this->openCiviPage("contact/search", "reset=1"); // fill name as first_name $this->type("css=.crm-basic-criteria-form-block input#sort_name", $firstName); @@ -231,11 +228,8 @@ class WebTest_Contact_SearchTest extends CiviSeleniumTestCase { $this->click("_qf_GroupContact_next"); $this->waitForPageToLoad($this->getTimeoutMsec()); - // visit contact search page - $this->open($this->sboxPath . "civicrm/contact/search?reset=1"); - $this->waitForPageToLoad($this->getTimeoutMsec()); - + $this->openCiviPage("contact/search", "reset=1"); // select contact type as Indiividual $this->select("contact_type", "value=Individual"); diff --git a/tests/phpunit/WebTest/Contact/SearchbyDateFilterTest.php b/tests/phpunit/WebTest/Contact/SearchbyDateFilterTest.php index f84c9a8a2e..691b6aea4e 100644 --- a/tests/phpunit/WebTest/Contact/SearchbyDateFilterTest.php +++ b/tests/phpunit/WebTest/Contact/SearchbyDateFilterTest.php @@ -44,8 +44,7 @@ class WebTest_Contact_SearchbyDateFilterTest extends CiviSeleniumTestCase { // Test Individual panes. foreach (array_keys($allpanes) as $pane) { // Go to the Advance Search - $this->open($this->sboxPath . 'civicrm/contact/search/advanced?reset=1'); - $this->waitForPageToLoad($this->getTimeoutMsec()); + $this->openCiviPage("contact/search/advanced", "reset=1"); // Select some fields from pane. $this->_selectPaneFields($pane); @@ -60,12 +59,9 @@ class WebTest_Contact_SearchbyDateFilterTest extends CiviSeleniumTestCase { } function testIndividualSearchPage(){ - // This is the path where our testing install resides. - // The rest of URL is defined in CiviSeleniumTestCase base class, in - // class attributes. $this->webtestLogin(); - $this->open($this->sboxPath . 'civicrm/contribute/search?reset=1'); + $this->openCiviPage("contribute/search", "reset=1"); $this->select("contribution_date_relative","value=previous_before.quarter"); $this->click("_qf_Search_refresh"); $this->waitForPageToLoad(2 * $this->getTimeoutMsec()); @@ -78,7 +74,8 @@ class WebTest_Contact_SearchbyDateFilterTest extends CiviSeleniumTestCase { $this->select("contribution_date_relative","value=ending.year"); $this->click("_qf_Search_refresh"); $this->waitForPageToLoad(2 * $this->getTimeoutMsec()); - $this->open($this->sboxPath . 'civicrm/member/search?reset=1'); + + $this->openCiviPage("member/search", "reset=1"); $this->select("member_end_date_relative","value=previous_before.month"); $this->click("_qf_Search_refresh"); $this->waitForPageToLoad(2 * $this->getTimeoutMsec()); @@ -91,7 +88,8 @@ class WebTest_Contact_SearchbyDateFilterTest extends CiviSeleniumTestCase { $this->select("member_end_date_relative","value=ending.month"); $this->click("_qf_Search_refresh"); $this->waitForPageToLoad(2 * $this->getTimeoutMsec()); - $this->open($this->sboxPath . 'civicrm/event/search?reset=1'); + + $this->openCiviPage("event/search", "reset=1"); $this->select("event_relative","value=previous_before.week"); $this->click("_qf_Search_refresh"); $this->waitForPageToLoad(2 * $this->getTimeoutMsec()); @@ -104,7 +102,8 @@ class WebTest_Contact_SearchbyDateFilterTest extends CiviSeleniumTestCase { $this->select("event_relative","value=ending.week"); $this->click("_qf_Search_refresh"); $this->waitForPageToLoad(2 * $this->getTimeoutMsec()); - $this->open($this->sboxPath . 'civicrm/activity/search?reset=1'); + + $this->openCiviPage("activity/search", "reset=1"); $this->select("activity_date_relative","value=previous_before.day"); $this->click("_qf_Search_refresh"); $this->waitForPageToLoad(2 * $this->getTimeoutMsec()); @@ -117,7 +116,8 @@ class WebTest_Contact_SearchbyDateFilterTest extends CiviSeleniumTestCase { $this->select("activity_date_relative","value=ending.quarter"); $this->click("_qf_Search_refresh"); $this->waitForPageToLoad(2 * $this->getTimeoutMsec()); - $this->open($this->sboxPath . 'civicrm/pledge/search?reset=1'); + + $this->openCiviPage("pledge/search", "reset=1"); $this->select("pledge_payment_date_relative","value=greater.week"); $this->click("_qf_Search_refresh"); $this->waitForPageToLoad(2 * $this->getTimeoutMsec()); @@ -133,7 +133,8 @@ class WebTest_Contact_SearchbyDateFilterTest extends CiviSeleniumTestCase { $this->select("pledge_payment_date_relative","value=greater.month"); $this->click("_qf_Search_refresh"); $this->waitForPageToLoad(2 * $this->getTimeoutMsec()); - $this->open($this->sboxPath . 'civicrm/mailing?reset=1'); + + $this->openCiviPage("mailing", "reset=1"); $this->select("mailing_relative","value=previous_before.year"); $this->click("_qf_Search_refresh"); $this->waitForPageToLoad(2 * $this->getTimeoutMsec()); diff --git a/tests/phpunit/WebTest/Contact/TagAddTest.php b/tests/phpunit/WebTest/Contact/TagAddTest.php index 9306fd4d07..f43ecdfb17 100644 --- a/tests/phpunit/WebTest/Contact/TagAddTest.php +++ b/tests/phpunit/WebTest/Contact/TagAddTest.php @@ -73,7 +73,7 @@ class WebTest_Contact_TagAddTest extends CiviSeleniumTestCase { function testAddTagSet() { $this->webtestLogin(); - $this->open($this->sboxPath . "civicrm/admin/tag?action=add&reset=1&tagset=1"); + $this->openCiviPage("admin/tag", "action=add&reset=1&tagset=1"); // take a tagset name $tagSetName = 'tagset_' . substr(sha1(rand()), 0, 7); diff --git a/tests/phpunit/WebTest/Contact/TaskActionSendMassMailing.php b/tests/phpunit/WebTest/Contact/TaskActionSendMassMailing.php index 9bb3747044..d6f4ee6d48 100644 --- a/tests/phpunit/WebTest/Contact/TaskActionSendMassMailing.php +++ b/tests/phpunit/WebTest/Contact/TaskActionSendMassMailing.php @@ -143,8 +143,7 @@ class WebTest_Contact_TaskActionSendMassMailing extends CiviSeleniumTestCase { $this->assertTrue($this->isTextPresent("Delivery has not yet begun for this mailing. If the scheduled delivery date and time is past, ask the system administrator or technical support contact for your site to verify that the automated mailer task ('cron job') is running - and how frequently.")); // directly send schedule mailing -- not working right now - $this->open($this->sboxPath . "civicrm/mailing/queue&reset=1"); - $this->waitForPageToLoad($this->getTimeoutMsec()); + $this->openCiviPage("mailing/queue", "reset=1"); //click report link of created mailing $this->click("xpath=//table//tbody/tr[td[1]/text()='$mailingName']/descendant::a[text()='Report']"); diff --git a/tests/phpunit/WebTest/Contact/TaskActionSendSMS.php b/tests/phpunit/WebTest/Contact/TaskActionSendSMS.php index e68a987e60..de62e62bad 100644 --- a/tests/phpunit/WebTest/Contact/TaskActionSendSMS.php +++ b/tests/phpunit/WebTest/Contact/TaskActionSendSMS.php @@ -48,8 +48,7 @@ class WebTest_Contact_TaskActionSendSMS extends CiviSeleniumTestCase { $this->waitForPageToLoad($this->getTimeoutMsec()); // ADD contact1 - $this->open($this->sboxPath . "civicrm/contact/add?reset=1&ct=Individual"); - $this->waitForPageToLoad($this->getTimeoutMsec()); + $this->openCiviPage("contact/add", "reset=1&ct=Individual"); $firstName = substr(sha1(rand()), 0, 7); $this->type('first_name', $firstName); @@ -73,8 +72,7 @@ class WebTest_Contact_TaskActionSendSMS extends CiviSeleniumTestCase { $this->assertElementContainsText('crm-notification-container', "Added to Group"); // ADD contact2 - $this->open($this->sboxPath . "civicrm/contact/add?reset=1&ct=Individual"); - $this->waitForPageToLoad($this->getTimeoutMsec()); + $this->openCiviPage("contact/add", "reset=1&ct=Individual"); $firstName = substr(sha1(rand()), 0, 7); $this->type('first_name', $firstName); diff --git a/tests/phpunit/WebTest/Contribute/AddBatchesTest.php b/tests/phpunit/WebTest/Contribute/AddBatchesTest.php index eb7b511b87..baab533d6d 100644 --- a/tests/phpunit/WebTest/Contribute/AddBatchesTest.php +++ b/tests/phpunit/WebTest/Contribute/AddBatchesTest.php @@ -39,7 +39,7 @@ class WebTest_Contribute_AddBatchesTest extends CiviSeleniumTestCase { $contact = array(); //Open Live Contribution Page - $this->open($this->sboxPath . "civicrm/batch?reset=1"); + $this->openCiviPage("batch", "reset=1"); $this->click("xpath=//div[@class='crm-submit-buttons']/a"); $this->waitForElementPresent("_qf_Batch_next"); $this->type("item_count", $itemCount); @@ -70,7 +70,7 @@ class WebTest_Contribute_AddBatchesTest extends CiviSeleniumTestCase { $batchTitle = 'Batch-'.substr(sha1(rand()), 0, 7); //Open Live Contribution Page - $this->open($this->sboxPath . "civicrm/batch?reset=1"); + $this->openCiviPage("batch", "reset=1"); $this->click("xpath=//div[@class='crm-submit-buttons']/a"); $this->waitForElementPresent("_qf_Batch_next"); $this->click("title"); diff --git a/tests/phpunit/WebTest/Contribute/AddPricesetTest.php b/tests/phpunit/WebTest/Contribute/AddPricesetTest.php index 54cb3de8e4..5596d8da06 100644 --- a/tests/phpunit/WebTest/Contribute/AddPricesetTest.php +++ b/tests/phpunit/WebTest/Contribute/AddPricesetTest.php @@ -224,8 +224,7 @@ class WebTest_Contribute_AddPricesetTest extends CiviSeleniumTestCase { function _testVerifyPriceSet($validateStrings, $sid) { // verify Price Set at Preview page // start at Manage Price Sets listing - $this->open($this->sboxPath . 'civicrm/admin/price?reset=1'); - $this->waitForPageToLoad($this->getTimeoutMsec()); + $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']"); @@ -386,7 +385,7 @@ class WebTest_Contribute_AddPricesetTest extends CiviSeleniumTestCase { $processorName = 'Webtest Dummy' . substr(sha1(rand()), 0, 7); $this->webtestAddPaymentProcessor($processorName); - $this->open($this->sboxPath . 'civicrm/admin/contribute/add?reset=1&action=add'); + $this->openCiviPage("admin/contribute/add", "reset=1&action=add"); $contributionTitle = substr(sha1(rand()), 0, 7); $rand = 2 * rand(2, 50); @@ -519,7 +518,7 @@ class WebTest_Contribute_AddPricesetTest extends CiviSeleniumTestCase { $processorName = 'Webtest Dummy' . substr(sha1(rand()), 0, 7); $this->webtestAddPaymentProcessor($processorName); - $this->open($this->sboxPath . 'civicrm/admin/contribute/add?reset=1&action=add'); + $this->openCiviPage("admin/contribute/add", "reset=1&action=add"); $contributionTitle = substr(sha1(rand()), 0, 7); $rand = 2 * rand(2, 50); diff --git a/tests/phpunit/WebTest/Contribute/ContributionPageAddTest.php b/tests/phpunit/WebTest/Contribute/ContributionPageAddTest.php index 7dca440730..9c28243523 100644 --- a/tests/phpunit/WebTest/Contribute/ContributionPageAddTest.php +++ b/tests/phpunit/WebTest/Contribute/ContributionPageAddTest.php @@ -38,8 +38,7 @@ class WebTest_Contribute_ContributionPageAddTest extends CiviSeleniumTestCase { // create contribution page with randomized title and default params $pageId = $this->webtestAddContributionPage($hash, $rand, $pageTitle, array("Webtest Dummy" . substr(sha1(rand()), 0, 7) => 'Dummy'), TRUE, TRUE, 'required'); - $this->open($this->sboxPath . 'civicrm/admin/contribute?reset=1'); - $this->waitForPageToLoad(); + $this->openCiviPage("admin/contribute", "reset=1"); // search for the new contrib page and go to its test version $this->type('title', $pageTitle); @@ -48,8 +47,8 @@ class WebTest_Contribute_ContributionPageAddTest extends CiviSeleniumTestCase { // select testdrive mode $this->isTextPresent($pageTitle); - $this->open($this->sboxPath . 'civicrm/contribute/transact?reset=1&action=preview&id=' . $pageId); - $this->waitForPageToLoad($this->getTimeoutMsec()); + $this->openCiviPage("contribute/transact", "reset=1&action=preview&id=$pageId"); + // verify whatever’s possible to verify // FIXME: ideally should be expanded $texts = array( @@ -90,8 +89,7 @@ class WebTest_Contribute_ContributionPageAddTest extends CiviSeleniumTestCase { 1, 7, TRUE, TRUE, TRUE, TRUE, FALSE, TRUE ); - $this->open($this->sboxPath . 'civicrm/admin/contribute?reset=1'); - $this->waitForPageToLoad(); + $this->openCiviPage("admin/contribute", "reset=1"); // search for the new contrib page and go to its test version $this->type('title', $pageTitle); @@ -100,9 +98,8 @@ class WebTest_Contribute_ContributionPageAddTest extends CiviSeleniumTestCase { // select testdrive mode $this->isTextPresent($pageTitle); - $this->open($this->sboxPath . 'civicrm/contribute/transact?reset=1&action=preview&id=' . $pageId); + $this->openCiviPage("contribute/transact", "reset=1&action=preview&id=$pageId"); - $this->waitForPageToLoad($this->getTimeoutMsec()); $texts = array( "Title - New Membership $hash", "This is introductory message for $pageTitle", @@ -140,8 +137,7 @@ class WebTest_Contribute_ContributionPageAddTest extends CiviSeleniumTestCase { 1, 0, FALSE, FALSE, FALSE, FALSE, FALSE, TRUE, FALSE ); - $this->open($this->sboxPath . 'civicrm/admin/contribute?reset=1'); - $this->waitForPageToLoad(); + $this->openCiviPage("admin/contribute", "reset=1"); // search for the new contrib page and go to its test version $this->type('title', $pageTitle); diff --git a/tests/phpunit/WebTest/Contribute/OfflineContributionTest.php b/tests/phpunit/WebTest/Contribute/OfflineContributionTest.php index fa3df5d4ff..36d2381a10 100644 --- a/tests/phpunit/WebTest/Contribute/OfflineContributionTest.php +++ b/tests/phpunit/WebTest/Contribute/OfflineContributionTest.php @@ -40,10 +40,6 @@ class WebTest_Contribute_OfflineContributionTest extends CiviSeleniumTestCase { } function testStandaloneContributeAdd() { - // This is the path where our testing install resides. - // The rest of URL is defined in CiviSeleniumTestCase base class, in - // class attributes. - $this->open( $this->sboxPath ); $this->webtestLogin(); // Create a contact to be used as soft creditor @@ -52,8 +48,7 @@ class WebTest_Contribute_OfflineContributionTest extends CiviSeleniumTestCase { $this->webtestAddContact( $softCreditFname, $softCreditLname, false ); //financial account for check - $this->open($this->sboxPath . 'civicrm/admin/options/payment_instrument?group=payment_instrument&reset=1'); - $this->waitForPageToLoad(); + $this->openCiviPage("admin/options/payment_instrument", "group=payment_instrument&reset=1"); $financialAccount = $this->getText("xpath=//div[@id='payment_instrument']/div[2]/table/tbody//tr/td[1][text()='Check']/../td[3]"); // Add new Financial Account @@ -199,17 +194,13 @@ class WebTest_Contribute_OfflineContributionTest extends CiviSeleniumTestCase { } function testDeductibleAmount() { - // This is the path where our testing install resides. - // The rest of URL is defined in CiviSeleniumTestCase base class, in - // class attributes. - $this->open( $this->sboxPath ); $this->webtestLogin(); //add authorize .net payment processor $processorName = 'Webtest AuthNet' . substr(sha1(rand()), 0, 7); $this->webtestAddPaymentProcessor($processorName, 'AuthNet'); - $this->open($this->sboxPath . "civicrm/admin/contribute/managePremiums?action=add&reset=1"); + $this->openCiviPage("admin/contribute/managePremiums", "action=add&reset=1"); $premiumName = 'test Premium' . substr(sha1(rand()), 0, 7); $this->addPremium($premiumName, 'SKU', 3, 12, NULL, NULL); diff --git a/tests/phpunit/WebTest/Contribute/OnBehalfOfOrganization.php b/tests/phpunit/WebTest/Contribute/OnBehalfOfOrganization.php index e7a250b64e..f0292aea93 100644 --- a/tests/phpunit/WebTest/Contribute/OnBehalfOfOrganization.php +++ b/tests/phpunit/WebTest/Contribute/OnBehalfOfOrganization.php @@ -115,7 +115,7 @@ class WebTest_Contribute_OnBehalfOfOrganization extends CiviSeleniumTestCase { $this->webtestLogin(); // create new individual - $this->open($this->sboxPath . "civicrm/profile/edit?reset=1&gid=4"); + $this->openCiviPage("profile/edit", "reset=1&gid=4"); $firstName = 'John_x_' . substr(sha1(rand()), 0, 7); $lastName = 'Anderson_c_' . substr(sha1(rand()), 0, 7); @@ -132,8 +132,7 @@ class WebTest_Contribute_OnBehalfOfOrganization extends CiviSeleniumTestCase { //custom data - $this->open($this->sboxPath . "civicrm/admin/custom/group?action=add&reset=1"); - $this->waitForPageToLoad($this->getTimeoutMsec()); + $this->openCiviPage("admin/custom/group", "action=add&reset=1"); //fill custom group title $customGroupTitle = 'custom_' . substr(sha1(rand()), 0, 7); @@ -230,8 +229,7 @@ class WebTest_Contribute_OnBehalfOfOrganization extends CiviSeleniumTestCase { $this->assertTrue($this->isTextPresent("Your custom field '$radioFieldLabel' has been saved.")); //add the above custom data to the On Behalf of Profile - $this->open($this->sboxPath . "civicrm/admin/uf/group?reset=1"); - $this->waitForPageToLoad($this->getTimeoutMsec()); + $this->openCiviPage("admin/uf/group", "reset=1"); $this->click("link=Reserved Profiles"); $this->click("xpath=//div[@id='reserved-profiles']/div/div/table/tbody//tr/td[1][text()='On Behalf Of Organization']/../td[5]/span/a[text()='Fields']"); @@ -372,9 +370,7 @@ class WebTest_Contribute_OnBehalfOfOrganization extends CiviSeleniumTestCase { //check for formRule //scenario 1 : add membership data in pre / post profile and check for formRule //add new profile - $this->open($this->sboxPath . "civicrm/admin/uf/group?reset=1"); - - $this->waitForPageToLoad($this->getTimeoutMsec()); + $this->openCiviPage("admin/uf/group", "reset=1"); $this->click('link=Add Profile'); $profileTitle = "test profile" . substr(sha1(rand()), 0, 7); @@ -438,11 +434,10 @@ class WebTest_Contribute_OnBehalfOfOrganization extends CiviSeleniumTestCase { $this->webtestLogout(); } - function testOnBehalfOfOrganizationWithOrgData() - { + function testOnBehalfOfOrganizationWithOrgData() { $this->webtestLogin(); - $this->open($this->sboxPath . "civicrm/profile/edit?reset=1&gid=4"); + $this->openCiviPage("profile/edit", "reset=1&gid=4"); $firstName = 'John_x_' . substr(sha1(rand()), 0, 7); $lastName = 'Anderson_c_' . substr(sha1(rand()), 0, 7); @@ -463,8 +458,7 @@ class WebTest_Contribute_OnBehalfOfOrganization extends CiviSeleniumTestCase { //add org fields to profile - $this->open($this->sboxPath . "civicrm/admin/uf/group?reset=1"); - $this->waitForPageToLoad($this->getTimeoutMsec()); + $this->openCiviPage("admin/uf/group", "reset=1"); $this->click("link=Reserved Profiles"); $this->click("xpath=//div[@id='reserved-profiles']/div/div/table/tbody//tr/td[1][text()='On Behalf Of Organization']/../td[5]/span/a[text()='Fields']"); @@ -568,9 +562,7 @@ class WebTest_Contribute_OnBehalfOfOrganization extends CiviSeleniumTestCase { function _testOrganization($pageId, $cid, $pageTitle) { //Open Live Contribution Page - $this->open($this->sboxPath . "civicrm/contribute/transact?reset=1&id=" . $pageId); - - $this->waitForElementPresent("_qf_Main_upload-bottom"); + $this->openCiviPage("contribute/transact", "reset=1&id=$pageId", "_qf_Main_upload-bottom"); $this->waitForElementPresent("onbehalf_state_province-3"); @@ -600,9 +592,7 @@ class WebTest_Contribute_OnBehalfOfOrganization extends CiviSeleniumTestCase { function _testAnomoyousOganization($pageId, $cid, $pageTitle) { //Open Live Contribution Page - $this->open($this->sboxPath . "civicrm/contribute/transact?reset=1&id=" . $pageId); - - $this->waitForElementPresent("_qf_Main_upload-bottom"); + $this->openCiviPage("contribute/transact", "reset=1&id=$pageId", "_qf_Main_upload-bottom"); $this->click('CIVICRM_QFID_0_8'); $this->type('css=div.other_amount-section input', 60); @@ -658,7 +648,7 @@ class WebTest_Contribute_OnBehalfOfOrganization extends CiviSeleniumTestCase { $this->webtestLogin(); //Find Contribution - $this->open($this->sboxPath . "civicrm/contribute/search?reset=1"); + $this->openCiviPage("contribute/search", "reset=1"); $this->type("sort_name", $orgName); $this->click("_qf_Search_refresh"); @@ -688,8 +678,7 @@ class WebTest_Contribute_OnBehalfOfOrganization extends CiviSeleniumTestCase { $this->openCiviPage("group", "reset=1", "_qf_Search_refresh"); $groupId = $this->getText("xpath=//table[@id='crm-group-selector']/tbody//tr/td[text()='{$groupName}']/../td[2]"); - $this->open($this->sboxPath . "civicrm/contact/view?reset=1&cid={$cid}"); - $this->waitForPageToLoad($this->getTimeoutMsec()); + $this->openCiviPage("contact/view", "reset=1&cid={$cid}"); $this->click('link=Edit'); $this->waitForElementPresent('_qf_Contact_cancel-bottom'); @@ -780,8 +769,7 @@ class WebTest_Contribute_OnBehalfOfOrganization extends CiviSeleniumTestCase { $this->waitForElementPresent("xpath=//div[@id='campaigns_wrapper']//table[@id='campaigns']/tbody//tr/td[3][text()='{$title}']"); $this->assertTrue($this->isTextPresent("Campaign {$title} has been saved."), "Status message didn't show up after saving!"); - $this->open($this->sboxPath . "civicrm/admin/uf/group?reset=1"); - $this->waitForPageToLoad($this->getTimeoutMsec()); + $this->openCiviPage("admin/uf/group", "reset=1"); $this->click("link=Reserved Profiles"); $this->click("xpath=//div[@id='reserved-profiles']/div/div/table/tbody//tr/td[1][text()='On Behalf Of Organization']/../td[5]/span/a[text()='Fields']"); @@ -836,8 +824,7 @@ class WebTest_Contribute_OnBehalfOfOrganization extends CiviSeleniumTestCase { $this->waitForPageToLoad($this->getTimeoutMsec()); // open contact - $this->open($this->sboxPath . "civicrm/contact/view/rel?cid={$cid}&action=add&reset=1"); - $this->waitForPageToLoad($this->getTimeoutMsec()); + $this->openCiviPage("contact/view/rel", "cid={$cid}&action=add&reset=1"); // select relationship type $this->click("relationship_type_id"); @@ -862,8 +849,7 @@ class WebTest_Contribute_OnBehalfOfOrganization extends CiviSeleniumTestCase { $this->click("details-save"); //Open Live Contribution Page - $this->open($this->sboxPath . "civicrm/contribute/transact?reset=1&id=" . $pageId . "&cid=" . $cid); - $this->waitForElementPresent("onbehalf_state_province-3"); + $this->openCiviPage("contribute/transact", "reset=1&id={$pageId}&cid=$cid", "onbehalf_state_province-3"); $this->click('CIVICRM_QFID_amount_other_radio_4'); $this->type('amount_other', 60); $this->click('onbehalf_contribution_campaign_id'); @@ -891,7 +877,7 @@ class WebTest_Contribute_OnBehalfOfOrganization extends CiviSeleniumTestCase { $this->waitForPageToLoad($this->getTimeoutMsec()); //Find Contribution - $this->open($this->sboxPath . "civicrm/contribute/search?reset=1"); + $this->openCiviPage("contribute/search", "reset=1"); $this->type("sort_name", $orgName1); $this->click("_qf_Search_refresh"); $this->waitForPageToLoad($this->getTimeoutMsec()); @@ -912,8 +898,7 @@ class WebTest_Contribute_OnBehalfOfOrganization extends CiviSeleniumTestCase { } - $this->open($this->sboxPath . "civicrm/admin/uf/group?reset=1"); - $this->waitForPageToLoad($this->getTimeoutMsec()); + $this->openCiviPage("admin/uf/group", "reset=1"); $this->click("link=Reserved Profiles"); $this->click("xpath=//div[@id='reserved-profiles']/div/div/table/tbody//tr/td[1][text()='On Behalf Of Organization']/../td[5]/span/a[text()='Fields']"); @@ -945,8 +930,7 @@ class WebTest_Contribute_OnBehalfOfOrganization extends CiviSeleniumTestCase { $this->waitForElementPresent("xpath=//div[@id='group']/div[3]/table/tbody//tr/td[text()='{$groupName}']/../td[2]"); $groupId = $this->getText("xpath=//div[@id='group']/div[3]/table/tbody//tr/td[text()='{$groupName}']/../td[2]"); - $this->open($this->sboxPath . "civicrm/contact/view?reset=1&cid={$cid}"); - $this->waitForPageToLoad($this->getTimeoutMsec()); + $this->openCiviPage("contact/view", "reset=1&cid={$cid}"); $this->click('link=Edit'); $this->waitForElementPresent('_qf_Contact_cancel-bottom'); @@ -1039,8 +1023,7 @@ class WebTest_Contribute_OnBehalfOfOrganization extends CiviSeleniumTestCase { $this->assertTrue($this->isTextPresent("Campaign {$title} has been saved."), "Status message didn't show up after saving!"); - $this->open($this->sboxPath . "civicrm/admin/uf/group?reset=1"); - $this->waitForPageToLoad($this->getTimeoutMsec()); + $this->openCiviPage("admin/uf/group", "reset=1"); $this->click("link=Reserved Profiles"); $this->click("xpath=//div[@id='reserved-profiles']/div/div/table/tbody//tr/td[1][text()='On Behalf Of Organization']/../td[5]/span/a[text()='Fields']"); $this->waitForPageToLoad($this->getTimeoutMsec()); @@ -1132,8 +1115,7 @@ class WebTest_Contribute_OnBehalfOfOrganization extends CiviSeleniumTestCase { // create Membership type $title1 = "Membership Type" . substr(sha1(rand()), 0, 7); - $this->open($this->sboxPath . "civicrm/admin/member/membershipType?reset=1&action=browse"); - $this->waitForPageToLoad($this->getTimeoutMsec()); + $this->openCiviPage("admin/member/membershipType", "reset=1&action=browse"); $this->click("link=Add Membership Type"); $this->waitForElementPresent('_qf_MembershipType_cancel-bottom'); @@ -1165,8 +1147,7 @@ class WebTest_Contribute_OnBehalfOfOrganization extends CiviSeleniumTestCase { $typeId = $typeUrl[1]; // open contact - $this->open($this->sboxPath . "civicrm/contact/view/rel?cid={$cid}&action=add&reset=1"); - $this->waitForPageToLoad($this->getTimeoutMsec()); + $this->openCiviPage("contact/view/rel", "cid={$cid}&action=add&reset=1"); // select relationship type $this->click("relationship_type_id"); @@ -1187,8 +1168,7 @@ class WebTest_Contribute_OnBehalfOfOrganization extends CiviSeleniumTestCase { $this->click("details-save"); // open contact - $this->open($this->sboxPath . "civicrm/contact/view/rel?cid={$cid}&action=add&reset=1"); - $this->waitForPageToLoad($this->getTimeoutMsec()); + $this->openCiviPage("contact/view/rel", "cid={$cid}&action=add&reset=1"); // select relationship type $this->click("relationship_type_id"); @@ -1209,8 +1189,7 @@ class WebTest_Contribute_OnBehalfOfOrganization extends CiviSeleniumTestCase { $this->click("details-save"); // set membership type - $this->open($this->sboxPath . "civicrm/admin/contribute/membership?reset=1&action=update&id=" . $pageId); - $this->waitForElementPresent("_qf_MembershipBlock_upload_done-bottom"); + $this->openCiviPage("admin/contribute/membership", "reset=1&action=update&id=$pageId", "_qf_MembershipBlock_upload_done-bottom"); $this->click("member_is_active"); $this->click("membership_type[{$typeId}]"); $this->click("xpath=//div[@id='memberFields']//table[@class='report']/tbody//tr/td[1]/label[text()='{$title1}']/../../td[2]/input"); @@ -1249,7 +1228,7 @@ class WebTest_Contribute_OnBehalfOfOrganization extends CiviSeleniumTestCase { $this->waitForPageToLoad($this->getTimeoutMsec()); //Find Membership for organization - $this->open($this->sboxPath . "civicrm/member/search?reset=1"); + $this->openCiviPage("member/search", "reset=1"); $this->type("sort_name", $orgName1); $this->click("_qf_Search_refresh"); $this->waitForPageToLoad($this->getTimeoutMsec()); @@ -1269,8 +1248,7 @@ class WebTest_Contribute_OnBehalfOfOrganization extends CiviSeleniumTestCase { } // find membership for contact in relationship - $this->open($this->sboxPath . "civicrm/contact/view?reset=1&force=1&cid={$cid}"); - $this->waitForPageToLoad($this->getTimeoutMsec()); + $this->openCiviPage("contact/view", "reset=1&force=1&cid={$cid}"); $this->click("css=li#tab_member a"); $this->waitForElementPresent("xpath=//div[@id='memberships']/div/table//tbody//tr/td[1][text()='{$title1}']"); $this->click("xpath=//div[@id='memberships']/div/table//tbody//tr/td[1][text()='{$title1}']/../td[7]/span/a[text()='View']"); @@ -1285,8 +1263,7 @@ class WebTest_Contribute_OnBehalfOfOrganization extends CiviSeleniumTestCase { $this->verifyText("xpath=//form[@id='MembershipView']/div[2]/div/table/tbody/tr[$value]/td[2]", preg_quote($label)); } - $this->open($this->sboxPath . "civicrm/admin/uf/group?reset=1"); - $this->waitForPageToLoad($this->getTimeoutMsec()); + $this->openCiviPage("admin/uf/group", "reset=1"); $this->click("link=Reserved Profiles"); $this->click("xpath=//div[@id='reserved-profiles']/div/div/table/tbody//tr/td[1][text()='On Behalf Of Organization']/../td[5]/span/a[text()='Fields']"); $this->waitForPageToLoad($this->getTimeoutMsec()); @@ -1309,8 +1286,7 @@ class WebTest_Contribute_OnBehalfOfOrganization extends CiviSeleniumTestCase { "Status message didn't show up after saving!" ); - $this->open($this->sboxPath . "civicrm/contact/view?reset=1&cid={$cid}"); - $this->waitForPageToLoad($this->getTimeoutMsec()); + $this->openCiviPage("contact/view", "reset=1&cid={$cid}"); $this->click("css=li#tab_rel a"); $this->waitForElementPresent("xpath=//div[@id='current-relationships']/div/table/tbody//tr/td[2]/a[text()='{$orgName1}']"); @@ -1328,9 +1304,10 @@ class WebTest_Contribute_OnBehalfOfOrganization extends CiviSeleniumTestCase { } - function testOnBehalfOfOrganizationWithImage() { $this->webtestLogin(); + function testOnBehalfOfOrganizationWithImage() { + $this->webtestLogin(); - $this->open($this->sboxPath . "civicrm/profile/edit?reset=1&gid=4"); + $this->openCiviPage("profile/edit", "reset=1&gid=4"); $firstName = 'John_x_' . substr(sha1(rand()), 0, 7); $lastName = 'Anderson_c_' . substr(sha1(rand()), 0, 7); @@ -1348,8 +1325,7 @@ class WebTest_Contribute_OnBehalfOfOrganization extends CiviSeleniumTestCase { // 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!"); - $this->open($this->sboxPath . "civicrm/admin/uf/group?reset=1"); - $this->waitForPageToLoad($this->getTimeoutMsec()); + $this->openCiviPage("admin/uf/group", "reset=1"); $this->click("link=Reserved Profiles"); $this->click("xpath=//div[@id='reserved-profiles']/div/div/table/tbody//tr/td[1][text()='On Behalf Of Organization']/../td[5]/span/a[text()='Fields']"); @@ -1415,8 +1391,7 @@ class WebTest_Contribute_OnBehalfOfOrganization extends CiviSeleniumTestCase { $this->_testOrganizationWithImageUpload($pageId, $cid, $pageTitle); - $this->open($this->sboxPath . "civicrm/admin/uf/group?reset=1"); - $this->waitForPageToLoad($this->getTimeoutMsec()); + $this->openCiviPage("admin/uf/group", "reset=1"); $this->click("link=Reserved Profiles"); $this->click("xpath=//div[@id='reserved-profiles']/div/div/table/tbody//tr/td[1][text()='On Behalf Of Organization']/../td[5]/span/a[text()='Fields']"); @@ -1430,7 +1405,7 @@ class WebTest_Contribute_OnBehalfOfOrganization extends CiviSeleniumTestCase { function _testOrganizationWithImageUpload($pageId, $cid, $pageTitle) { //Open Live Contribution Page - $this->open($this->sboxPath . "civicrm/contribute/transact?reset=1&id=" . $pageId); + $this->openCiviPage("contribute/transact", "reset=1&id=$pageId"); $firstName = 'Ma' . substr(sha1(rand()), 0, 4); $lastName = 'An' . substr(sha1(rand()), 0, 7); diff --git a/tests/phpunit/WebTest/Contribute/OnlineContributionTest.php b/tests/phpunit/WebTest/Contribute/OnlineContributionTest.php index b8f5fa61dc..63b9d64148 100644 --- a/tests/phpunit/WebTest/Contribute/OnlineContributionTest.php +++ b/tests/phpunit/WebTest/Contribute/OnlineContributionTest.php @@ -80,9 +80,7 @@ class WebTest_Contribute_OnlineContributionTest extends CiviSeleniumTestCase { $this->webtestLogout(); //Open Live Contribution Page - $this->open($this->sboxPath . "civicrm/contribute/transact?reset=1&id=" . $pageId); - $this->waitForElementPresent("_qf_Main_upload-bottom"); - + $this->openCiviPage("contribute/transact", "reset=1&id=$pageId", "_qf_Main_upload-bottom"); $firstName = 'Ma' . substr(sha1(rand()), 0, 4); $lastName = 'An' . substr(sha1(rand()), 0, 7); diff --git a/tests/phpunit/WebTest/Contribute/OnlineMultiplePaymentProcessorTest.php b/tests/phpunit/WebTest/Contribute/OnlineMultiplePaymentProcessorTest.php index 3b9ddd9367..b6ab916c1c 100644 --- a/tests/phpunit/WebTest/Contribute/OnlineMultiplePaymentProcessorTest.php +++ b/tests/phpunit/WebTest/Contribute/OnlineMultiplePaymentProcessorTest.php @@ -63,8 +63,7 @@ class WebTest_Contribute_OnlineMultiplePaymentProcessorTest extends CiviSelenium $allowOtherAmmount = TRUE ); - $this->open($this->sboxPath . "civicrm/contribute/transact?reset=1&action=preview&id=$pageId"); - $this->waitForPageToLoad($this->getTimeoutMsec()); + $this->openCiviPage("contribute/transact", "reset=1&action=preview&id=$pageId"); $this->assertTrue($this->isTextPresent($donationPageTitle)); $firstName = 'Ma' . substr(sha1(rand()), 0, 4); @@ -152,10 +151,7 @@ class WebTest_Contribute_OnlineMultiplePaymentProcessorTest extends CiviSelenium $allowOtherAmmount = TRUE ); - - - $this->open($this->sboxPath . "civicrm/contribute/transact?reset=1&action=preview&id=$pageId"); - $this->waitForPageToLoad($this->getTimeoutMsec()); + $this->openCiviPage("contribute/transact", "reset=1&action=preview&id=$pageId"); $this->assertTrue($this->isTextPresent($donationPageTitle)); $firstName = 'Ma' . substr(sha1(rand()), 0, 4); diff --git a/tests/phpunit/WebTest/Contribute/OnlineRecurContributionTest.php b/tests/phpunit/WebTest/Contribute/OnlineRecurContributionTest.php index 5bef9daf1b..146a4ac72f 100644 --- a/tests/phpunit/WebTest/Contribute/OnlineRecurContributionTest.php +++ b/tests/phpunit/WebTest/Contribute/OnlineRecurContributionTest.php @@ -90,8 +90,7 @@ class WebTest_Contribute_OnlineRecurContributionTest extends CiviSeleniumTestCas // logout $this->webtestLogout(); - $this->open($this->sboxPath . "civicrm/contribute/transact?reset=1&action=preview&id=" . $pageId); - $this->waitForElementPresent("_qf_Main_upload-bottom"); + $this->openCiviPage("contribute/transact", "reset=1&action=preview&id=$pageId", "_qf_Main_upload-bottom"); // helper AddContributionPage sets Minimum Other Amout = $rand / 2 so must contribute more than that $this->click("xpath=//div[@class='crm-section other_amount-section']//div[2]/input"); diff --git a/tests/phpunit/WebTest/Contribute/PCPAddTest.php b/tests/phpunit/WebTest/Contribute/PCPAddTest.php index ae81fca4e4..45be1e4502 100755 --- a/tests/phpunit/WebTest/Contribute/PCPAddTest.php +++ b/tests/phpunit/WebTest/Contribute/PCPAddTest.php @@ -174,9 +174,8 @@ class WebTest_Contribute_PCPAddTest extends CiviSeleniumTestCase { $this->click("_qf_Confirm_next-bottom"); $this->waitForElementPresent("thankyou_footer"); - //login to check contribution - // Log in using webtestLogin() method + //login to check contribution $this->webtestLogin(); //Find Contribution diff --git a/tests/phpunit/WebTest/Contribute/UpdateContributionTest.php b/tests/phpunit/WebTest/Contribute/UpdateContributionTest.php index b50e8350e6..85959074f7 100644 --- a/tests/phpunit/WebTest/Contribute/UpdateContributionTest.php +++ b/tests/phpunit/WebTest/Contribute/UpdateContributionTest.php @@ -33,15 +33,6 @@ class WebTest_Contribute_UpdateContributionTest extends CiviSeleniumTestCase { } function testChangeContributionAmount() { - // This is the path where our testing install resides. - // The rest of URL is defined in CiviSeleniumTestCase base class, in - // class attributes. - $this->open($this->sboxPath); - // Logging in. Remember to wait for page to load. In most cases, - // you can rely on 30000 as the value that allows your test to pass, however, - // sometimes your test might fail because of this. In such cases, it's better to pick one element - // somewhere at the end of page and use waitForElementPresent on it - this assures you, that whole - // page contents loaded and you can continue your test execution. $this->webtestLogin(); $firstName = substr(sha1(rand()), 0, 7); $lastName = 'Contributor'; @@ -94,15 +85,6 @@ class WebTest_Contribute_UpdateContributionTest extends CiviSeleniumTestCase { } function testPayLater() { - // This is the path where our testing install resides. - // The rest of URL is defined in CiviSeleniumTestCase base class, in - // class attributes. - $this->open($this->sboxPath); - // Logging in. Remember to wait for page to load. In most cases, - // you can rely on 30000 as the value that allows your test to pass, however, - // sometimes your test might fail because of this. In such cases, it's better to pick one element - // somewhere at the end of page and use waitForElementPresent on it - this assures you, that whole - // page contents loaded and you can continue your test execution. $this->webtestLogin(); $firstName = substr(sha1(rand()), 0, 7); $lastName = 'Contributor'; @@ -132,15 +114,6 @@ class WebTest_Contribute_UpdateContributionTest extends CiviSeleniumTestCase { } function testChangePremium() { - // This is the path where our testing install resides. - // The rest of URL is defined in CiviSeleniumTestCase base class, in - // class attributes. - $this->open($this->sboxPath); - // Logging in. Remember to wait for page to load. In most cases, - // you can rely on 30000 as the value that allows your test to pass, however, - // sometimes your test might fail because of this. In such cases, it's better to pick one element - // somewhere at the end of page and use waitForElementPresent on it - this assures you, that whole - // page contents loaded and you can continue your test execution. $this->webtestLogin(); $firstName = substr(sha1(rand()), 0, 7); $lastName = 'Contributor'; @@ -165,7 +138,7 @@ class WebTest_Contribute_UpdateContributionTest extends CiviSeleniumTestCase { $sku = 'SKU'; $price = 300; $cost = 3.00; - $this->open($this->sboxPath . "civicrm/admin/contribute/managePremiums?action=add&reset=1"); + $this->openCiviPage("admin/contribute/managePremiums", "action=add&reset=1"); // add premium $this->addPremium($premiumName, $sku, $amount, $price, $cost, $financialType['name']); @@ -175,12 +148,11 @@ class WebTest_Contribute_UpdateContributionTest extends CiviSeleniumTestCase { $sku2 = 'SKU'; $price2 = 200; $cost2 = 2.00; - $this->open($this->sboxPath . "civicrm/admin/contribute/managePremiums?action=add&reset=1"); + $this->openCiviPage("admin/contribute/managePremiums", "action=add&reset=1"); $this->addPremium($premiumName2, $sku2, $amount2, $price2, $cost2, $financialType['name']); // add contribution with premium - $this->open($this->sboxPath . "civicrm/contribute/add?reset=1&action=add&context=standalone"); - $this->waitForPageToLoad($this->getTimeoutMsec()); + $this->openCiviPage("contribute/add", "reset=1&action=add&context=standalone"); // create new contact using dialog $this->webtestNewDialogContact($firstName, $lastName, $email); @@ -219,15 +191,6 @@ class WebTest_Contribute_UpdateContributionTest extends CiviSeleniumTestCase { } function testDeletePremium() { - // This is the path where our testing install resides. - // The rest of URL is defined in CiviSeleniumTestCase base class, in - // class attributes. - $this->open($this->sboxPath); - // Logging in. Remember to wait for page to load. In most cases, - // you can rely on 30000 as the value that allows your test to pass, however, - // sometimes your test might fail because of this. In such cases, it's better to pick one element - // somewhere at the end of page and use waitForElementPresent on it - this assures you, that whole - // page contents loaded and you can continue your test execution. $this->webtestLogin(); $firstName = substr(sha1(rand()), 0, 7); $lastName = 'Contributor'; @@ -252,18 +215,17 @@ class WebTest_Contribute_UpdateContributionTest extends CiviSeleniumTestCase { $sku = 'SKU'; $price = 300; $cost = 3.00; - $this->open($this->sboxPath . "civicrm/admin/contribute/managePremiums?action=add&reset=1"); + $this->openCiviPage("admin/contribute/managePremiums", "action=add&reset=1"); // add premium $this->addPremium($premiumName, $sku, $amount, $price, $cost, $financialType['name']); // add contribution with premium - $this->open($this->sboxPath . "civicrm/contribute/add?reset=1&action=add&context=standalone"); - $this->waitForPageToLoad($this->getTimeoutMsec()); + $this->openCiviPage("contribute/add", "reset=1&action=add&context=standalone"); // create new contact using dialog $this->webtestNewDialogContact($firstName, $lastName, $email); // select financial type - $this->select( "financial_type_id", "value=1" ); + $this->select("financial_type_id", "value=1"); // total amount $this->type("total_amount", "100"); // fill Premium information @@ -294,15 +256,6 @@ class WebTest_Contribute_UpdateContributionTest extends CiviSeleniumTestCase { } function testChangePaymentInstrument() { - // This is the path where our testing install resides. - // The rest of URL is defined in CiviSeleniumTestCase base class, in - // class attributes. - $this->open($this->sboxPath); - // Logging in. Remember to wait for page to load. In most cases, - // you can rely on 30000 as the value that allows your test to pass, however, - // sometimes your test might fail because of this. In such cases, it's better to pick one element - // somewhere at the end of page and use waitForElementPresent on it - this assures you, that whole - // page contents loaded and you can continue your test execution. $this->webtestLogin(); $firstName = substr(sha1(rand()), 0, 7); $lastName = 'Contributor'; @@ -328,15 +281,6 @@ class WebTest_Contribute_UpdateContributionTest extends CiviSeleniumTestCase { } function testRefundContribution() { - // This is the path where our testing install resides. - // The rest of URL is defined in CiviSeleniumTestCase base class, in - // class attributes. - $this->open($this->sboxPath); - // Logging in. Remember to wait for page to load. In most cases, - // you can rely on 30000 as the value that allows your test to pass, however, - // sometimes your test might fail because of this. In such cases, it's better to pick one element - // somewhere at the end of page and use waitForElementPresent on it - this assures you, that whole - // page contents loaded and you can continue your test execution. $this->webtestLogin(); $firstName = substr(sha1(rand()), 0, 7); $lastName = 'Contributor'; @@ -366,15 +310,6 @@ class WebTest_Contribute_UpdateContributionTest extends CiviSeleniumTestCase { } function testCancelPayLater() { - // This is the path where our testing install resides. - // The rest of URL is defined in CiviSeleniumTestCase base class, in - // class attributes. - $this->open($this->sboxPath); - // Logging in. Remember to wait for page to load. In most cases, - // you can rely on 30000 as the value that allows your test to pass, however, - // sometimes your test might fail because of this. In such cases, it's better to pick one element - // somewhere at the end of page and use waitForElementPresent on it - this assures you, that whole - // page contents loaded and you can continue your test execution. $this->webtestLogin(); $firstName = substr(sha1(rand()), 0, 7); $lastName = 'Contributor'; @@ -410,15 +345,6 @@ class WebTest_Contribute_UpdateContributionTest extends CiviSeleniumTestCase { } function testChangeFinancialType() { - // This is the path where our testing install resides. - // The rest of URL is defined in CiviSeleniumTestCase base class, in - // class attributes. - $this->open($this->sboxPath); - // Logging in. Remember to wait for page to load. In most cases, - // you can rely on 30000 as the value that allows your test to pass, however, - // sometimes your test might fail because of this. In such cases, it's better to pick one element - // somewhere at the end of page and use waitForElementPresent on it - this assures you, that whole - // page contents loaded and you can continue your test execution. $this->webtestLogin(); $firstName = substr(sha1(rand()), 0, 7); $lastName = 'Contributor'; diff --git a/tests/phpunit/WebTest/Contribute/VerifySSLContributionTest.php b/tests/phpunit/WebTest/Contribute/VerifySSLContributionTest.php index 1f91a81829..45735c2bc2 100644 --- a/tests/phpunit/WebTest/Contribute/VerifySSLContributionTest.php +++ b/tests/phpunit/WebTest/Contribute/VerifySSLContributionTest.php @@ -91,8 +91,7 @@ class WebTest_Contribute_VerifySSLContributionTest extends CiviSeleniumTestCase ); // enable verify ssl - $this->open($this->sboxPath . "civicrm/admin/setting/url?reset=1"); - $this->waitForPageToLoad($this->getTimeoutMsec()); + $this->openCiviPage("admin/setting/url", "reset=1"); $this->click("id=CIVICRM_QFID_1_verifySSL"); $this->click("id=_qf_Url_next-bottom"); $this->waitForPageToLoad($this->getTimeoutMsec()); diff --git a/tests/phpunit/WebTest/Event/AddEventTest.php b/tests/phpunit/WebTest/Event/AddEventTest.php index f3b5ec2ea3..485bb5b3ab 100644 --- a/tests/phpunit/WebTest/Event/AddEventTest.php +++ b/tests/phpunit/WebTest/Event/AddEventTest.php @@ -40,7 +40,7 @@ class WebTest_Event_AddEventTest extends CiviSeleniumTestCase { $processorName = "Webtest Dummy" . substr(sha1(rand()), 0, 7); $this->webtestAddPaymentProcessor($processorName); - $this->open($this->sboxPath . "civicrm/event/add?reset=1&action=add"); + $this->openCiviPage("event/add", "reset=1&action=add"); $eventTitle = 'My Conference - ' . substr(sha1(rand()), 0, 7); $eventDescription = "Here is a description for this conference."; @@ -78,7 +78,7 @@ class WebTest_Event_AddEventTest extends CiviSeleniumTestCase { $processorName = "Webtest Dummy" . substr(sha1(rand()), 0, 7); $this->webtestAddPaymentProcessor($processorName); - $this->open($this->sboxPath . "civicrm/event/add?reset=1&action=add"); + $this->openCiviPage("event/add", "reset=1&action=add"); $eventTitle = 'My Conference - ' . substr(sha1(rand()), 0, 7); $eventDescription = "Here is a description for this conference."; @@ -117,7 +117,7 @@ class WebTest_Event_AddEventTest extends CiviSeleniumTestCase { $processorName = "Webtest Dummy" . substr(sha1(rand()), 0, 7); $this->webtestAddPaymentProcessor($processorName); - $this->open($this->sboxPath . "civicrm/event/add?reset=1&action=add"); + $this->openCiviPage("event/add", "reset=1&action=add"); $eventTitle = 'My Conference - ' . substr(sha1(rand()), 0, 7); $eventDescription = "Here is a description for this conference."; @@ -150,8 +150,7 @@ class WebTest_Event_AddEventTest extends CiviSeleniumTestCase { sleep(3); //Assert quick config change and discount deletion - $this->open($this->sboxPath . "civicrm/admin/price?reset=1"); - $this->waitForPageToLoad($this->getTimeoutMsec()); + $this->openCiviPage("admin/price", "reset=1"); $this->assertStringsPresent($discount); } @@ -164,7 +163,7 @@ class WebTest_Event_AddEventTest extends CiviSeleniumTestCase { $processorName = "Webtest Dummy" . substr(sha1(rand()), 0, 7); $this->webtestAddPaymentProcessor($processorName); - $this->open($this->sboxPath . "civicrm/event/add?reset=1&action=add"); + $this->openCiviPage("event/add", "reset=1&action=add"); $eventTitle = 'My Conference - ' . substr(sha1(rand()), 0, 7); $eventDescription = "Here is a description for this conference."; @@ -199,11 +198,9 @@ class WebTest_Event_AddEventTest extends CiviSeleniumTestCase { $this->type("discounted_value_1_2", ""); $this->type("discounted_value_2_2", ""); $this->click("_qf_Fee_upload-bottom"); - sleep(3); + $this->waitForPageToLoad(); //Assertions - $this->open($this->sboxPath . "civicrm/admin/price?reset=1"); - $this->waitForPageToLoad($this->getTimeoutMsec()); - sleep(3); + $this->openCiviPage("admin/price", "reset=1"); $this->assertStringsPresent($discount[1]); } @@ -216,7 +213,7 @@ class WebTest_Event_AddEventTest extends CiviSeleniumTestCase { $processorName = "Webtest Dummy" . substr(sha1(rand()), 0, 7); $this->webtestAddPaymentProcessor($processorName); - $this->open($this->sboxPath . "civicrm/event/add?reset=1&action=add"); + $this->openCiviPage("event/add", "reset=1&action=add"); $eventTitle = 'My Conference - ' . substr(sha1(rand()), 0, 7); $eventDescription = "Here is a description for this conference."; @@ -247,7 +244,7 @@ class WebTest_Event_AddEventTest extends CiviSeleniumTestCase { // Log in using webtestLogin() method $this->webtestLogin(); - $this->open($this->sboxPath . "civicrm/event/add?reset=1&action=add"); + $this->openCiviPage("event/add", "reset=1&action=add"); $eventTitle = 'My Free Meeting - ' . substr(sha1(rand()), 0, 7); $eventDescription = "Here is a description for this free meeting."; @@ -283,7 +280,7 @@ class WebTest_Event_AddEventTest extends CiviSeleniumTestCase { // Log in using webtestLogin() method $this->webtestLogin(); - $this->open($this->sboxPath . "civicrm/event/add?reset=1&action=add"); + $this->openCiviPage("event/add", "reset=1&action=add"); $eventTitle = 'My Conference - ' . substr(sha1(rand()), 0, 7); $eventDescription = "Here is a description for this conference."; $this->_testAddEventInfo($eventTitle, $eventDescription); @@ -477,7 +474,7 @@ class WebTest_Event_AddEventTest extends CiviSeleniumTestCase { function _testVerifyEventInfo($eventTitle, $eventInfoStrings, $eventFees = NULL) { // verify event input on info page // start at Manage Events listing - $this->open($this->sboxPath . "civicrm/event/manage?reset=1"); + $this->openCiviPage("event/manage", "reset=1"); $this->click("link=$eventTitle"); // Look for Register button diff --git a/tests/phpunit/WebTest/Event/EventWaitListTest.php b/tests/phpunit/WebTest/Event/EventWaitListTest.php index d8c4aa9581..eeab2e8cd9 100644 --- a/tests/phpunit/WebTest/Event/EventWaitListTest.php +++ b/tests/phpunit/WebTest/Event/EventWaitListTest.php @@ -38,7 +38,7 @@ class WebTest_Event_EventWaitListTest extends CiviSeleniumTestCase { $processorName = "Webtest Dummy" . substr(sha1(rand()), 0, 7); $this->webtestAddPaymentProcessor($processorName); - $this->open($this->sboxPath . "civicrm/event/add?reset=1&action=add"); + $this->openCiviPage("event/add", "reset=1&action=add"); $eventTitle = 'My Conference - ' . substr(sha1(rand()), 0, 7); $eventDescription = "Here is a description for this conference."; @@ -153,7 +153,7 @@ class WebTest_Event_EventWaitListTest extends CiviSeleniumTestCase { function _testVerifyEventInfo($eventTitle, $eventInfoStrings) { // verify event input on info page // start at Manage Events listing - $this->open($this->sboxPath . "civicrm/event/manage?reset=1"); + $this->openCiviPage("event/manage", "reset=1"); $this->click("link=$eventTitle"); $this->waitForPageToLoad($this->getTimeoutMsec()); diff --git a/tests/phpunit/WebTest/Event/MultipleEventRegistrationbyCartTest.php b/tests/phpunit/WebTest/Event/MultipleEventRegistrationbyCartTest.php index 0993db33d2..840a91f222 100755 --- a/tests/phpunit/WebTest/Event/MultipleEventRegistrationbyCartTest.php +++ b/tests/phpunit/WebTest/Event/MultipleEventRegistrationbyCartTest.php @@ -37,8 +37,7 @@ class WebTest_Event_MultipleEventRegistrationbyCartTest extends CiviSeleniumTest $this->webtestLogin(); //Enable shopping cart style - $this->open($this->sboxPath . "civicrm/admin/setting/preferences/event?reset=1"); - $this->waitForPageToLoad($this->getTimeoutMsec()); + $this->openCiviPage("admin/setting/preferences/event", "reset=1"); $this->check("enable_cart"); $this->click("_qf_Event_next-top"); $this->waitForPageToLoad($this->getTimeoutMsec()); @@ -49,7 +48,7 @@ class WebTest_Event_MultipleEventRegistrationbyCartTest extends CiviSeleniumTest //event 1 - $this->open($this->sboxPath . "civicrm/event/add?reset=1&action=add"); + $this->openCiviPage("event/add", "reset=1&action=add"); $eventTitle1 = 'My Conference1 - ' . substr(sha1(rand()), 0, 7); $eventDescription1 = "Here is a description for this conference 1."; @@ -70,7 +69,7 @@ class WebTest_Event_MultipleEventRegistrationbyCartTest extends CiviSeleniumTest //event 2 - $this->open($this->sboxPath . "civicrm/event/add?reset=1&action=add"); + $this->openCiviPage("event/add", "reset=1&action=add"); $eventTitle2 = 'My Conference2 - ' . substr(sha1(rand()), 0, 7); $eventDescription2 = "Here is a description for this conference 2."; @@ -91,7 +90,7 @@ class WebTest_Event_MultipleEventRegistrationbyCartTest extends CiviSeleniumTest //event 3 - $this->open($this->sboxPath . "civicrm/event/add?reset=1&action=add"); + $this->openCiviPage("event/add", "reset=1&action=add"); $eventTitle3 = 'My Conference3 - ' . substr(sha1(rand()), 0, 7); $eventDescription3 = "Here is a description for this conference 3."; @@ -136,7 +135,7 @@ class WebTest_Event_MultipleEventRegistrationbyCartTest extends CiviSeleniumTest //event 1 - $this->open($this->sboxPath . "civicrm/event/add?reset=1&action=add"); + $this->openCiviPage("event/add", "reset=1&action=add"); $eventTitle1 = 'My Conference1 - ' . substr(sha1(rand()), 0, 7); $eventDescription1 = "Here is a description for this conference 1."; @@ -157,7 +156,7 @@ class WebTest_Event_MultipleEventRegistrationbyCartTest extends CiviSeleniumTest //event 2 - $this->open($this->sboxPath . "civicrm/event/add?reset=1&action=add"); + $this->openCiviPage("event/add", "reset=1&action=add"); $eventTitle2 = 'My Conference2 - ' . substr(sha1(rand()), 0, 7); $eventDescription2 = "Here is a description for this conference 2."; @@ -178,7 +177,7 @@ class WebTest_Event_MultipleEventRegistrationbyCartTest extends CiviSeleniumTest //event 3 - $this->open($this->sboxPath . "civicrm/event/add?reset=1&action=add"); + $this->openCiviPage("event/add", "reset=1&action=add"); $eventTitle3 = 'My Conference3 - ' . substr(sha1(rand()), 0, 7); $eventDescription3 = "Here is a description for this conference 3."; @@ -198,8 +197,7 @@ class WebTest_Event_MultipleEventRegistrationbyCartTest extends CiviSeleniumTest $registerUrl3 = $this->_testVerifyEventInfo($eventTitle3, $eventInfoStrings3); //Enable shopping cart style - $this->open($this->sboxPath . "civicrm/admin/setting/preferences/event?reset=1"); - $this->waitForPageToLoad($this->getTimeoutMsec()); + $this->openCiviPage("admin/setting/preferences/event", "reset=1"); $this->check("enable_cart"); $this->click("_qf_Event_next-top"); @@ -213,8 +211,8 @@ class WebTest_Event_MultipleEventRegistrationbyCartTest extends CiviSeleniumTest // Log in using webtestLogin() method $this->webtestLogin(); - $this->open($this->sboxPath."civicrm/dashboard"); - + $this->openCiviPage("dashboard", "reset=1"); + //three event names $events = array( 1 => $eventTitle1, 2 => $eventTitle2, @@ -334,7 +332,7 @@ class WebTest_Event_MultipleEventRegistrationbyCartTest extends CiviSeleniumTest function _AddEventToCart($eventTitle, $eventInfoStrings, $eventFees = NULL) { // verify event input on info page // start at Manage Events listing - $this->open($this->sboxPath . "civicrm/event/manage?reset=1"); + $this->openCiviPage("event/manage", "reset=1"); $this->click("link=$eventTitle"); $this->waitForPageToLoad($this->getTimeoutMsec()); @@ -348,7 +346,7 @@ class WebTest_Event_MultipleEventRegistrationbyCartTest extends CiviSeleniumTest function _testVerifyEventInfo($eventTitle, $eventInfoStrings, $eventFees = NULL) { // verify event input on info page // start at Manage Events listing - $this->open($this->sboxPath . "civicrm/event/manage?reset=1"); + $this->openCiviPage("event/manage", "reset=1"); $this->click("link=$eventTitle"); $this->waitForPageToLoad($this->getTimeoutMsec()); @@ -458,8 +456,7 @@ class WebTest_Event_MultipleEventRegistrationbyCartTest extends CiviSeleniumTest } //Disable shopping cart style - $this->open($this->sboxPath . "civicrm/admin/setting/preferences/event?reset=1"); - $this->waitForPageToLoad($this->getTimeoutMsec()); + $this->openCiviPage("admin/setting/preferences/event", "reset=1"); $this->click("enable_cart"); $this->click("_qf_Event_next-top"); } diff --git a/tests/phpunit/WebTest/Event/MultiprofileEventTest.php b/tests/phpunit/WebTest/Event/MultiprofileEventTest.php index 0c10b2666f..6cc9a3231e 100644 --- a/tests/phpunit/WebTest/Event/MultiprofileEventTest.php +++ b/tests/phpunit/WebTest/Event/MultiprofileEventTest.php @@ -52,7 +52,7 @@ class WebTest_Event_MultiprofileEventTest extends CiviSeleniumTestCase { $cfId = $this->_addEmailField(); // create custom group1 - $this->open($this->sboxPath . "civicrm/admin/custom/group?reset=1"); + $this->openCiviPage("admin/custom/group", "reset=1"); $this->click("newCustomDataGroup"); $this->waitForPageToLoad($this->getTimeoutMsec()); $this->type("title", $customGrp1); @@ -68,7 +68,7 @@ class WebTest_Event_MultiprofileEventTest extends CiviSeleniumTestCase { $profileId = $this->_testGetProfileId($customId); - $this->open($this->sboxPath . "civicrm/event/add?reset=1&action=add"); + $this->openCiviPage("event/add", "reset=1&action=add"); $eventTitle = 'My Conference - ' . substr(sha1(rand()), 0, 7); $eventDescription = "Here is a description for this conference."; @@ -87,7 +87,7 @@ class WebTest_Event_MultiprofileEventTest extends CiviSeleniumTestCase { $this->waitForPageToLoad($this->getTimeoutMsec()); // Find Main Participant - $this->open($this->sboxPath . "civicrm/event/search?reset=1"); + $this->openCiviPage("event/search", "reset=1"); $this->type("sort_name", $firstName); $this->click("_qf_Search_refresh"); $this->waitForPageToLoad($this->getTimeoutMsec()); @@ -104,7 +104,7 @@ class WebTest_Event_MultiprofileEventTest extends CiviSeleniumTestCase { $this->verifyText("xpath=//form[@id='ParticipantView']/div[2]/table/tbody/tr[6]/td[2]", preg_quote($status)); // Find additional Participant - $this->open($this->sboxPath . "civicrm/event/search?reset=1"); + $this->openCiviPage("event/search", "reset=1"); $this->type("sort_name", $participantfname); $this->click("_qf_Search_refresh"); $this->waitForPageToLoad($this->getTimeoutMsec()); @@ -124,24 +124,12 @@ class WebTest_Event_MultiprofileEventTest extends CiviSeleniumTestCase { if (isset($cfId)) { $this->_removeEmailField($cfId); } - - $this->open($this->sboxPath . "civicrm/admin/custom/group/field?action=delete&reset=1&gid=" . $customGrpId1 . "&id=" . $customId[0]); - $this->waitForPageToLoad($this->getTimeoutMsec()); - $this->click("_qf_DeleteField_next-bottom"); - $this->waitForPageToLoad($this->getTimeoutMsec()); - - $this->open($this->sboxPath . "civicrm/admin/custom/group/field?action=delete&reset=1&gid=" . $customGrpId1 . "&id=" . $customId[1]); - $this->waitForPageToLoad($this->getTimeoutMsec()); - $this->click("_qf_DeleteField_next-bottom"); - $this->waitForPageToLoad($this->getTimeoutMsec()); - - $this->open($this->sboxPath . "civicrm/admin/custom/group/field?action=delete&reset=1&gid=" . $customGrpId1 . "&id=" . $customId[2]); - $this->waitForPageToLoad($this->getTimeoutMsec()); - $this->click("_qf_DeleteField_next-bottom"); - $this->waitForPageToLoad($this->getTimeoutMsec()); - - $this->open($this->sboxPath . "civicrm/admin/custom/group?action=delete&reset=1&id=" . $customGrpId1); - $this->waitForPageToLoad($this->getTimeoutMsec()); + foreach ($customId as $cid) { + $this->openCiviPage("admin/custom/group/field", "action=delete&reset=1&gid={$customGrpId1}&id=$cid"); + $this->click("_qf_DeleteField_next-bottom"); + $this->waitForPageToLoad($this->getTimeoutMsec()); + } + $this->openCiviPage("admin/custom/group", "action=delete&reset=1&id=$customGrpId1"); $this->click("_qf_DeleteGroup_next-bottom"); $this->waitForPageToLoad($this->getTimeoutMsec()); } @@ -173,7 +161,7 @@ class WebTest_Event_MultiprofileEventTest extends CiviSeleniumTestCase { $cfId = $this->_addEmailField( ); // create custom group1 - $this->open($this->sboxPath . "civicrm/admin/custom/group?reset=1"); + $this->openCiviPage("admin/custom/group", "reset=1"); $this->click("newCustomDataGroup"); $this->waitForPageToLoad($this->getTimeoutMsec()); $this->type("title", $customGrp1); @@ -211,7 +199,7 @@ class WebTest_Event_MultiprofileEventTest extends CiviSeleniumTestCase { $this->webtestLogin(); // Find Main Participant - $this->open($this->sboxPath . "civicrm/event/search?reset=1"); + $this->openCiviPage("event/search", "reset=1"); $this->type("sort_name", $firstName); $this->click("_qf_Search_refresh"); $this->waitForPageToLoad($this->getTimeoutMsec()); @@ -228,7 +216,7 @@ class WebTest_Event_MultiprofileEventTest extends CiviSeleniumTestCase { $this->verifyText("xpath=//form[@id='ParticipantView']/div[2]/table/tbody/tr[6]/td[2]", preg_quote($status)); // Find additional Participant - $this->open($this->sboxPath . "civicrm/event/search?reset=1"); + $this->openCiviPage("event/search", "reset=1"); $this->type("sort_name", $participantfname); $this->click("_qf_Search_refresh"); $this->waitForPageToLoad($this->getTimeoutMsec()); @@ -274,7 +262,7 @@ class WebTest_Event_MultiprofileEventTest extends CiviSeleniumTestCase { $this->verifyText("xpath=//form[@id='ParticipantView']/div[2]/table/tbody/tr[6]/td[2]", preg_quote($status)); // Find additional Participant - $this->open($this->sboxPath . "civicrm/event/search?reset=1"); + $this->openCiviPage("event/search", "reset=1"); $this->type("sort_name", $participantfname2); $this->click("_qf_Search_refresh"); $this->waitForPageToLoad($this->getTimeoutMsec()); @@ -294,24 +282,12 @@ class WebTest_Event_MultiprofileEventTest extends CiviSeleniumTestCase { if (isset($cfId)) { $this->_removeEmailField($cfId); } - - $this->open($this->sboxPath . "civicrm/admin/custom/group/field?action=delete&reset=1&gid=" . $customGrpId1 . "&id=" . $customId[0]); - $this->waitForPageToLoad($this->getTimeoutMsec()); - $this->click("_qf_DeleteField_next-bottom"); - $this->waitForPageToLoad($this->getTimeoutMsec()); - - $this->open($this->sboxPath . "civicrm/admin/custom/group/field?action=delete&reset=1&gid=" . $customGrpId1 . "&id=" . $customId[1]); - $this->waitForPageToLoad($this->getTimeoutMsec()); - $this->click("_qf_DeleteField_next-bottom"); - $this->waitForPageToLoad($this->getTimeoutMsec()); - - $this->open($this->sboxPath . "civicrm/admin/custom/group/field?action=delete&reset=1&gid=" . $customGrpId1 . "&id=" . $customId[2]); - $this->waitForPageToLoad($this->getTimeoutMsec()); - $this->click("_qf_DeleteField_next-bottom"); - $this->waitForPageToLoad($this->getTimeoutMsec()); - - $this->open($this->sboxPath . "civicrm/admin/custom/group?action=delete&reset=1&id=" . $customGrpId1); - $this->waitForPageToLoad($this->getTimeoutMsec()); + foreach ($customId as $cid) { + $this->openCiviPage("admin/custom/group/field", "action=delete&reset=1&gid={$customGrpId1}&id=$cid"); + $this->click("_qf_DeleteField_next-bottom"); + $this->waitForPageToLoad($this->getTimeoutMsec()); + } + $this->openCiviPage("admin/custom/group", "action=delete&reset=1&id=$customGrpId1"); $this->click("_qf_DeleteGroup_next-bottom"); $this->waitForPageToLoad($this->getTimeoutMsec()); } @@ -326,8 +302,7 @@ class WebTest_Event_MultiprofileEventTest extends CiviSeleniumTestCase { $field3 = "Lname" . substr(sha1(rand()), 0, 7); // add custom fields for group 1 - $this->open($this->sboxPath . "civicrm/admin/custom/group/field/add?reset=1&action=add&gid=" . $customGrpId1); - $this->waitForPageToLoad($this->getTimeoutMsec()); + $this->openCiviPage("admin/custom/group/field/add", "reset=1&action=add&gid=$customGrpId1"); $this->type("label", $field1); $this->check("is_searchable"); $this->click("_qf_Field_next_new-bottom"); @@ -344,7 +319,7 @@ class WebTest_Event_MultiprofileEventTest extends CiviSeleniumTestCase { $this->waitForPageToLoad($this->getTimeoutMsec()); // get id of custom fields - $this->open($this->sboxPath . "civicrm/admin/custom/group/field?reset=1&action=browse&gid=" . $customGrpId1); + $this->openCiviPage("admin/custom/group/field", "reset=1&action=browse&gid=$customGrpId1"); $custom1 = explode('&id=', $this->getAttribute("xpath=//div[@id='field_page']//table/tbody//tr[1]/td[8]/span/a[text()='Edit Field']/@href")); $custom1 = $custom1[1]; array_push($customId, $custom1); @@ -359,7 +334,7 @@ class WebTest_Event_MultiprofileEventTest extends CiviSeleniumTestCase { } function _testRemoveProfile($eventPageId) { - $this->open($this->sboxPath . "civicrm/event/manage/settings?reset=1&action=update&id=" . $eventPageId); + $this->openCiviPage("event/manage/settings", "reset=1&action=update&id=$eventPageId"); // Go to Online Contribution tab $this->click("link=Online Registration"); @@ -458,8 +433,7 @@ class WebTest_Event_MultiprofileEventTest extends CiviSeleniumTestCase { // Add new profile. $profilename = "Profile_" . substr(sha1(rand()), 0, 7); - $this->open($this->sboxPath . 'civicrm/admin/uf/group?reset=1'); - $this->waitForPageToLoad($this->getTimeoutMsec()); + $this->openCiviPage("admin/uf/group", "reset=1"); $this->click('newCiviCRMProfile-top'); $this->waitForElementPresent('_qf_Group_next-top'); @@ -472,7 +446,7 @@ class WebTest_Event_MultiprofileEventTest extends CiviSeleniumTestCase { //Add field to profile_testCreateProfile foreach ($profilefield as $key => $value) { - $this->open($this->sboxPath . 'civicrm/admin/uf/group/field/add?reset=1&action=add&gid=' . $profileId); + $this->openCiviPage("admin/uf/group/field/add", "reset=1&action=add&gid=$profileId"); $this->waitForPageToLoad($this->getTimeoutMsec()); if (in_array($value, $locationfields)) { $this->select("field_name[0]", "value={$type}"); @@ -807,8 +781,7 @@ class WebTest_Event_MultiprofileEventTest extends CiviSeleniumTestCase { } function _removeEmailField($cfId) { - $this->open($this->sboxPath . "civicrm/admin/uf/group/field?action=delete&id={$cfId}"); - $this->waitForPageToLoad($this->getTimeoutMsec()); + $this->openCiviPage("admin/uf/group/field", "action=delete&id={$cfId}"); $this->click("_qf_Field_next-bottom"); $this->waitForPageToLoad($this->getTimeoutMsec()); } diff --git a/tests/phpunit/WebTest/Event/PCPAddTest.php b/tests/phpunit/WebTest/Event/PCPAddTest.php index 8949bdb3c4..5e83bb3805 100644 --- a/tests/phpunit/WebTest/Event/PCPAddTest.php +++ b/tests/phpunit/WebTest/Event/PCPAddTest.php @@ -114,7 +114,7 @@ class WebTest_Event_PCPAddTest extends CiviSeleniumTestCase { function _testAddEventForPCP($processorName, $campaignType, $contributionPageId = NULL, $firstName, $lastName, $middleName, $email) { - $this->open($this->sboxPath . "civicrm/event/add?reset=1&action=add"); + $this->openCiviPage("event/add", "reset=1&action=add"); $eventTitle = 'My Conference - ' . substr(sha1(rand()), 0, 7); $eventDescription = "Here is a description for this conference."; @@ -426,8 +426,7 @@ class WebTest_Event_PCPAddTest extends CiviSeleniumTestCase { function _testParticipantSearchEventName($eventName, $lastNameDonar, $firstNameDonar, $firstNameCreator, $lastNameCreator, $amount) { $sortName = $lastNameDonar . ', ' . $firstNameDonar; - $this->open($this->sboxPath . "civicrm/event/search?reset=1"); - $this->waitForPageToLoad($this->getTimeoutMsec()); + $this->openCiviPage("event/search", "reset=1"); $this->type("event_name", $eventName); $this->click("event_name"); @@ -459,8 +458,7 @@ class WebTest_Event_PCPAddTest extends CiviSeleniumTestCase { $displayName = "$firstName $lastName"; // visit contact search page - $this->open($this->sboxPath . "civicrm/contact/search?reset=1"); - $this->waitForPageToLoad($this->getTimeoutMsec()); + $this->openCiviPage("contact/search", "reset=1"); // fill name as first_name $this->type("css=.crm-basic-criteria-form-block input#sort_name", $pcpCreatorFirstName); diff --git a/tests/phpunit/WebTest/Event/ParticipantSearchTest.php b/tests/phpunit/WebTest/Event/ParticipantSearchTest.php index c3b3709dd3..7b2b3370cb 100644 --- a/tests/phpunit/WebTest/Event/ParticipantSearchTest.php +++ b/tests/phpunit/WebTest/Event/ParticipantSearchTest.php @@ -43,8 +43,7 @@ class WebTest_Event_ParticipantSearchTest extends CiviSeleniumTestCase { $this->webtestLogin(); // visit event search page - $this->open($this->sboxPath . "civicrm/event/search?reset=1"); - $this->waitForPageToLoad($this->getTimeoutMsec()); + $this->openCiviPage("event/search", "reset=1"); $stringsToCheck = array( 'Participant Name', @@ -64,12 +63,10 @@ class WebTest_Event_ParticipantSearchTest extends CiviSeleniumTestCase { } function testParticipantSearchForce() { - $this->webtestLogin(); // visit event search page - $this->open($this->sboxPath . "civicrm/event/search?reset=1&force=1"); - $this->waitForPageToLoad($this->getTimeoutMsec()); + $this->openCiviPage("event/search", "reset=1&force=1"); // assume generated DB // there are participants @@ -77,12 +74,10 @@ class WebTest_Event_ParticipantSearchTest extends CiviSeleniumTestCase { } function testParticipantSearchEmpty() { - $this->webtestLogin(); // visit event search page - $this->open($this->sboxPath . "civicrm/event/search?reset=1"); - $this->waitForPageToLoad($this->getTimeoutMsec()); + $this->openCiviPage("event/search", "reset=1"); $crypticName = "foobardoogoo_" . md5(time()); $this->type("sort_name", $crypticName); @@ -100,12 +95,10 @@ class WebTest_Event_ParticipantSearchTest extends CiviSeleniumTestCase { } function testParticipantSearchEventName() { - $this->webtestLogin(); // visit event search page - $this->open($this->sboxPath . "civicrm/event/search?reset=1"); - $this->waitForPageToLoad($this->getTimeoutMsec()); + $this->openCiviPage("event/search", "reset=1"); $eventName = "Fall Fundraiser Dinner"; $this->type("event_name", $eventName); @@ -128,8 +121,7 @@ class WebTest_Event_ParticipantSearchTest extends CiviSeleniumTestCase { $this->webtestLogin(); // visit event search page - $this->open($this->sboxPath . "civicrm/event/search?reset=1"); - $this->waitForPageToLoad($this->getTimeoutMsec()); + $this->openCiviPage("event/search", "reset=1"); $this->select('event_relative', "label=Choose Date Range"); $this->webtestFillDate('event_start_date_low', '-2 year'); @@ -154,8 +146,7 @@ class WebTest_Event_ParticipantSearchTest extends CiviSeleniumTestCase { $this->webtestLogin(); // visit event search page - $this->open($this->sboxPath . "civicrm/event/search?reset=1"); - $this->waitForPageToLoad($this->getTimeoutMsec()); + $this->openCiviPage("event/search", "reset=1"); $this->select('event_relative', "label=Choose Date Range"); $this->webtestFillDate('event_start_date_low', '-2 year'); @@ -186,8 +177,7 @@ class WebTest_Event_ParticipantSearchTest extends CiviSeleniumTestCase { $this->webtestLogin(); // visit event search page - $this->open($this->sboxPath . "civicrm/event/search?reset=1"); - $this->waitForPageToLoad($this->getTimeoutMsec()); + $this->openCiviPage("event/search", "reset=1"); $this->click("xpath=//div[@id='Food_Preference']/div[2]/table/tbody/tr/td[2]//label[contains(text(),'Chicken Combo')]"); @@ -215,8 +205,7 @@ class WebTest_Event_ParticipantSearchTest extends CiviSeleniumTestCase { $this->webtestLogin(); // visit event search page - $this->open($this->sboxPath . "civicrm/event/search?reset=1&force=1"); - $this->waitForPageToLoad($this->getTimeoutMsec()); + $this->openCiviPage("event/search", "reset=1&force=1"); // assume generated DB // there are participants @@ -243,8 +232,7 @@ class WebTest_Event_ParticipantSearchTest extends CiviSeleniumTestCase { $this->webtestLogin(); // visit event search page - $this->open($this->sboxPath . "civicrm/event/search?reset=1&force=1"); - $this->waitForPageToLoad($this->getTimeoutMsec()); + $this->openCiviPage("event/search", "reset=1&force=1"); // assume generated DB // there are participants diff --git a/tests/phpunit/WebTest/Event/TellAFriendTest.php b/tests/phpunit/WebTest/Event/TellAFriendTest.php index 740755cd9d..0a673bddaa 100644 --- a/tests/phpunit/WebTest/Event/TellAFriendTest.php +++ b/tests/phpunit/WebTest/Event/TellAFriendTest.php @@ -36,7 +36,7 @@ class WebTest_Event_TellAFriendTest extends CiviSeleniumTestCase { // Log in using webtestLogin() method $this->webtestLogin('admin'); - $this->open($this->sboxPath . "civicrm/event/add?reset=1&action=add"); + $this->openCiviPage("event/add", "reset=1&action=add"); $eventTitle = 'My Conference - ' . substr(sha1(rand()), 0, 7); $eventDescription = "Here is a description for this conference."; diff --git a/tests/phpunit/WebTest/Financial/FinancialAccountTest.php b/tests/phpunit/WebTest/Financial/FinancialAccountTest.php index 96091b7c76..99af6fbb28 100644 --- a/tests/phpunit/WebTest/Financial/FinancialAccountTest.php +++ b/tests/phpunit/WebTest/Financial/FinancialAccountTest.php @@ -28,12 +28,10 @@ require_once 'CiviTest/CiviSeleniumTestCase.php'; class WebTest_Financial_FinancialAccountTest extends CiviSeleniumTestCase { + /** + * Test To Add Financial Account class attributes. + */ function testFinancialAccount() { - // To Add Financial Account - // class attributes. - $this->open( $this->sboxPath ); - - // Log in using webtestLogin() method $this->webtestLogin(); // Add new Financial Account diff --git a/tests/phpunit/WebTest/Financial/FinancialBatchExport.php b/tests/phpunit/WebTest/Financial/FinancialBatchExport.php index 3886b2354a..bd4061aa50 100644 --- a/tests/phpunit/WebTest/Financial/FinancialBatchExport.php +++ b/tests/phpunit/WebTest/Financial/FinancialBatchExport.php @@ -33,11 +33,6 @@ class WebTest_Financial_FinancialBatchExport extends CiviSeleniumTestCase { } function testAddFinancialBatch() { - // This is the path where our testing install resides. - // The rest of URL is defined in CiviSeleniumTestCase base class, in - // class attributes. - $this->open($this->sboxPath); - // Log in using webtestLogin() method $this->webtestLogin('admin'); $this->openCiviPage("financial/batch", "reset=1&action=add", '_qf_FinancialBatch_next-botttom'); @@ -99,8 +94,7 @@ class WebTest_Financial_FinancialBatchExport extends CiviSeleniumTestCase { } function _testExportBatch($setTitle, $batchId, $exportFormat) { - $this->open($this->sboxPath . "civicrm/financial/batch?reset=1&action=export&id=$batchId"); - $this->waitForPageToLoad($this->getTimeoutMsec()); + $this->openCiviPage("financial/batch", "reset=1&action=export&id=$batchId"); if ($exportFormat == 'CSV') { $this->click("xpath=//form[@id='FinancialBatch']/div[2]/table[@class='form-layout']/tbody/tr/td/input[2]"); $this->click('_qf_FinancialBatch_next-botttom'); @@ -111,7 +105,7 @@ class WebTest_Financial_FinancialBatchExport extends CiviSeleniumTestCase { $this->click('_qf_FinancialBatch_next-botttom'); sleep(5); } - $this->open($this->sboxPath . "civicrm?reset=1"); + $this->openCiviPage("dashboard", "reset=1"); $this->waitForPageToLoad($this->getTimeoutMsec()); $this->click("xpath=//div[@id='recently-viewed']/ul/li[1]/a"); diff --git a/tests/phpunit/WebTest/Import/AddressParsingTest.php b/tests/phpunit/WebTest/Import/AddressParsingTest.php index d0adffab7c..d0ee407582 100644 --- a/tests/phpunit/WebTest/Import/AddressParsingTest.php +++ b/tests/phpunit/WebTest/Import/AddressParsingTest.php @@ -32,17 +32,14 @@ class WebTest_Import_AddressParsingTest extends ImportCiviSeleniumTestCase { parent::setUp(); } - /* - * Function to check for Valid Street Address - */ + /** + * Function to check for Valid Street Address + */ function testValidStreetAddressParsing() { - - // Logging in. $this->webtestLogin(); //Go to the URL of Address Setting to enable street address parsing option - $this->open($this->sboxPath . "civicrm/admin/setting/preferences/address?reset=1"); - $this->waitForPageToLoad($this->getTimeoutMsec()); + $this->openCiviPage("admin/setting/preferences/address", "reset=1"); //check the street address parsing is already enabled if (!$this->isChecked("address_options[13]")) { @@ -60,7 +57,7 @@ class WebTest_Import_AddressParsingTest extends ImportCiviSeleniumTestCase { $importedContactIds = $this->_getImportedContactIds($rows); //Go to the url of edit contact - $this->open($this->sboxPath . "civicrm/contact/add?reset=1&action=update&cid={$importedContactIds[1]}"); + $this->openCiviPage("contact/add", "reset=1&action=update&cid={$importedContactIds[1]}"); $this->click("addressBlock"); $this->click("//div[@id='addressBlockId']/div[1]"); $this->waitForElementPresent("address_1_street_address"); @@ -81,8 +78,7 @@ class WebTest_Import_AddressParsingTest extends ImportCiviSeleniumTestCase { } //Go to the URL of Address Setting to disable street address parsing option - $this->open($this->sboxPath . "civicrm/admin/setting/preferences/address?reset=1"); - $this->waitForPageToLoad($this->getTimeoutMsec()); + $this->openCiviPage("admin/setting/preferences/address", "reset=1"); //Disable street address parsing $this->click("address_options[13]"); @@ -94,13 +90,10 @@ class WebTest_Import_AddressParsingTest extends ImportCiviSeleniumTestCase { * Function to check for Invalid Street Address */ function testInvalidStreetAddressParsing() { - - // Logging in. $this->webtestLogin(); //Go to the URL of Address Setting to enable street address parsing option - $this->open($this->sboxPath . "civicrm/admin/setting/preferences/address?reset=1"); - $this->waitForPageToLoad($this->getTimeoutMsec()); + $this->openCiviPage("admin/setting/preferences/address", "reset=1"); //check the street address parsing is already enabled if (!$this->isChecked("address_options[13]")) { @@ -120,7 +113,7 @@ class WebTest_Import_AddressParsingTest extends ImportCiviSeleniumTestCase { $importedContactIds = $this->_getImportedContactIds($rows); //Go to the url of edit contact - $this->open($this->sboxPath . "civicrm/contact/add?reset=1&action=update&cid={$importedContactIds[1]}"); + $this->openCiviPage("contact/add", "reset=1&action=update&cid={$importedContactIds[1]}"); $this->click("addressBlock"); $this->click("//div[@id='addressBlockId']/div[1]"); $this->waitForElementPresent("address_1_street_address"); @@ -141,8 +134,7 @@ class WebTest_Import_AddressParsingTest extends ImportCiviSeleniumTestCase { } //Go to the URL of Address Setting to disable street address parsing option - $this->open($this->sboxPath . "civicrm/admin/setting/preferences/address?reset=1"); - $this->waitForPageToLoad($this->getTimeoutMsec()); + $this->openCiviPage("admin/setting/preferences/address", "reset=1"); //Disable street address parsing $this->click("address_options[13]"); @@ -150,17 +142,14 @@ class WebTest_Import_AddressParsingTest extends ImportCiviSeleniumTestCase { $this->waitForPageToLoad($this->getTimeoutMsec()); } - /* - * Function to check Street Address when Address Parsing is Disabled - */ + /** + * Function to check Street Address when Address Parsing is Disabled + */ function testStreetAddress() { - - // Logging in. $this->webtestLogin(); //Go to the URL of Address Setting to enable street address parsing option - $this->open($this->sboxPath . "civicrm/admin/setting/preferences/address?reset=1"); - $this->waitForPageToLoad($this->getTimeoutMsec()); + $this->openCiviPage("admin/setting/preferences/address", "reset=1"); //check the street address parsing is already disabled if ($this->isChecked("address_options[13]")) { @@ -178,7 +167,7 @@ class WebTest_Import_AddressParsingTest extends ImportCiviSeleniumTestCase { $importedContactIds = $this->_getImportedContactIds($rows); //Go to the url of edit contact - $this->open($this->sboxPath . "civicrm/contact/add?reset=1&action=update&cid={$importedContactIds[1]}"); + $this->openCiviPage("contact/add", "reset=1&action=update&cid={$importedContactIds[1]}"); $this->click("addressBlock"); $this->click("//div[@id='addressBlockId']/div[1]"); $this->waitForElementPresent("address_1_street_address"); diff --git a/tests/phpunit/WebTest/Import/ContactCustomDataTest.php b/tests/phpunit/WebTest/Import/ContactCustomDataTest.php index 2b0e919b54..75b5259fdd 100644 --- a/tests/phpunit/WebTest/Import/ContactCustomDataTest.php +++ b/tests/phpunit/WebTest/Import/ContactCustomDataTest.php @@ -41,8 +41,7 @@ class WebTest_Import_ContactCustomDataTest extends ImportCiviSeleniumTestCase { // Add New Strict Rule $newRuleTitle = 'IndividualStrict_' . substr(sha1(rand()), 0, 7); - $this->open($this->sboxPath . "civicrm/contact/deduperules?reset=1"); - $this->waitForPageToLoad($this->getTimeoutMsec()); + $this->openCiviPage("contact/deduperules", "reset=1"); $this->click("xpath=//div[@id='browseValues_Individual']/div[2]/a/span"); $this->waitForElementPresent('_qf_DedupeRules_next-bottom'); @@ -131,7 +130,7 @@ class WebTest_Import_ContactCustomDataTest extends ImportCiviSeleniumTestCase { function _addCustomData() { - $this->open($this->sboxPath . "civicrm/admin/custom/group?reset=1"); + $this->openCiviPage("admin/custom/group", "reset=1"); //add new custom data $this->click("//a[@id='newCustomDataGroup']/span"); diff --git a/tests/phpunit/WebTest/Import/ContactSubtypeTest.php b/tests/phpunit/WebTest/Import/ContactSubtypeTest.php index bdcd01608d..256c77d529 100644 --- a/tests/phpunit/WebTest/Import/ContactSubtypeTest.php +++ b/tests/phpunit/WebTest/Import/ContactSubtypeTest.php @@ -75,8 +75,7 @@ class WebTest_Import_ContactSubtypeTest extends ImportCiviSeleniumTestCase { // Visit contacts to check updated data. foreach ($updateRows as $updatedRow) { - $this->open($this->sboxPath . "civicrm/contact/view?reset=1&cid={$updatedRow['contact_id']}"); - $this->waitForPageToLoad($this->getTimeoutMsec()); + $this->openCiviPage("contact/view", "reset=1&cid={$updatedRow['contact_id']}"); $displayName = "{$updatedRow['first_name']} {$updatedRow['last_name']}"; $this->assertTrue($this->isTextPresent("$displayName"), "Contact did not update!"); } @@ -106,8 +105,7 @@ class WebTest_Import_ContactSubtypeTest extends ImportCiviSeleniumTestCase { // Visit contacts to check filled data. foreach ($fillRows as $cid => $fillRow) { - $this->open($this->sboxPath . "civicrm/contact/view?reset=1&cid={$fillRow['contact_id']}"); - $this->waitForPageToLoad($this->getTimeoutMsec()); + $this->openCiviPage("contact/view", "reset=1&cid={$fillRow['contact_id']}"); // Check old display name. $displayName = "{$updateRows[$cid]['first_name']} {$updateRows[$cid]['last_name']}"; @@ -159,8 +157,7 @@ class WebTest_Import_ContactSubtypeTest extends ImportCiviSeleniumTestCase { // Visit contacts to check updated data. foreach ($updateRows as $updatedRow) { $organizationName = $updatedRow['organization_name']; - $this->open($this->sboxPath . "civicrm/contact/view?reset=1&cid={$updatedRow['contact_id']}"); - $this->waitForPageToLoad($this->getTimeoutMsec()); + $this->openCiviPage("contact/view", "reset=1&cid={$updatedRow['contact_id']}"); $this->assertTrue($this->isTextPresent("$organizationName"), "Contact did not update!"); } @@ -186,8 +183,7 @@ class WebTest_Import_ContactSubtypeTest extends ImportCiviSeleniumTestCase { // Visit contacts to check filled data. foreach ($fillRows as $cid => $fillRow) { - $this->open($this->sboxPath . "civicrm/contact/view?reset=1&cid={$fillRow['contact_id']}"); - $this->waitForPageToLoad($this->getTimeoutMsec()); + $this->openCiviPage("contact/view", "reset=1&cid={$fillRow['contact_id']}"); // Check old Organization name. $organizationName = $updateRows[$cid]['organization_name']; @@ -241,8 +237,7 @@ class WebTest_Import_ContactSubtypeTest extends ImportCiviSeleniumTestCase { // Visit contacts to check updated data. foreach ($updateRows as $updatedRow) { $householdName = $updatedRow['household_name']; - $this->open($this->sboxPath . "civicrm/contact/view?reset=1&cid={$updatedRow['contact_id']}"); - $this->waitForPageToLoad($this->getTimeoutMsec()); + $this->openCiviPage("contact/view", "reset=1&cid={$updatedRow['contact_id']}"); $this->assertTrue($this->isTextPresent("$householdName"), "Contact did not update!"); } @@ -268,8 +263,7 @@ class WebTest_Import_ContactSubtypeTest extends ImportCiviSeleniumTestCase { // Visit contacts to check filled data. foreach ($fillRows as $cid => $fillRow) { - $this->open($this->sboxPath . "civicrm/contact/view?reset=1&cid={$fillRow['contact_id']}"); - $this->waitForPageToLoad($this->getTimeoutMsec()); + $this->openCiviPage("contact/view", "reset=1&cid={$fillRow['contact_id']}"); // Check old Household name. $householdName = $updateRows[$cid]['household_name']; @@ -287,7 +281,7 @@ class WebTest_Import_ContactSubtypeTest extends ImportCiviSeleniumTestCase { function _createHouseholdSubtype() { // Visit to create contact subtype - $this->open($this->sboxPath . "civicrm/admin/options/subtype?action=add&reset=1"); + $this->openCiviPage("admin/options/subtype", "action=add&reset=1"); // Create Household subtype $householdSubtype = substr(sha1(rand()), 0, 7); diff --git a/tests/phpunit/WebTest/Import/ContactTest.php b/tests/phpunit/WebTest/Import/ContactTest.php index d38bfcc15c..6bb7c8b1a0 100644 --- a/tests/phpunit/WebTest/Import/ContactTest.php +++ b/tests/phpunit/WebTest/Import/ContactTest.php @@ -79,8 +79,7 @@ class WebTest_Import_ContactTest extends ImportCiviSeleniumTestCase { // Visit contacts to check updated data. foreach ($updateRows as $updatedRow) { - $this->open($this->sboxPath . "civicrm/contact/view?reset=1&cid={$updatedRow['contact_id']}"); - $this->waitForPageToLoad($this->getTimeoutMsec()); + $this->openCiviPage("contact/view", "reset=1&cid={$updatedRow['contact_id']}"); $displayName = "{$updatedRow['first_name']} {$updatedRow['last_name']}"; $this->assertTrue($this->isTextPresent("$displayName"), "Contact did not update!"); @@ -111,8 +110,7 @@ class WebTest_Import_ContactTest extends ImportCiviSeleniumTestCase { // Visit contacts to check filled data. foreach ($fillRows as $cid => $fillRow) { - $this->open($this->sboxPath . "civicrm/contact/view?reset=1&cid={$fillRow['contact_id']}"); - $this->waitForPageToLoad($this->getTimeoutMsec()); + $this->openCiviPage("contact/view", "reset=1&cid={$fillRow['contact_id']}"); // Check old display name. $displayName = "{$updateRows[$cid]['first_name']} {$updateRows[$cid]['last_name']}"; @@ -168,8 +166,7 @@ class WebTest_Import_ContactTest extends ImportCiviSeleniumTestCase { // Visit contacts to check updated data. foreach ($updateRows as $updatedRow) { $organizationName = $updatedRow['organization_name']; - $this->open($this->sboxPath . "civicrm/contact/view?reset=1&cid={$updatedRow['contact_id']}"); - $this->waitForPageToLoad($this->getTimeoutMsec()); + $this->openCiviPage("contact/view", "reset=1&cid={$updatedRow['contact_id']}"); $this->assertTrue($this->isTextPresent("$organizationName"), "Contact did not update!"); } @@ -195,8 +192,7 @@ class WebTest_Import_ContactTest extends ImportCiviSeleniumTestCase { // Visit contacts to check filled data. foreach ($fillRows as $cid => $fillRow) { - $this->open($this->sboxPath . "civicrm/contact/view?reset=1&cid={$fillRow['contact_id']}"); - $this->waitForPageToLoad($this->getTimeoutMsec()); + $this->openCiviPage("contact/view", "reset=1&cid={$fillRow['contact_id']}"); // Check old Organization name. $organizationName = $updateRows[$cid]['organization_name']; @@ -251,8 +247,7 @@ class WebTest_Import_ContactTest extends ImportCiviSeleniumTestCase { // Visit contacts to check updated data. foreach ($updateRows as $updatedRow) { $householdName = $updatedRow['household_name']; - $this->open($this->sboxPath . "civicrm/contact/view?reset=1&cid={$updatedRow['contact_id']}"); - $this->waitForPageToLoad($this->getTimeoutMsec()); + $this->openCiviPage("contact/view", "reset=1&cid={$updatedRow['contact_id']}"); $this->assertTrue($this->isTextPresent("$householdName"), "Contact did not update!"); } @@ -278,8 +273,7 @@ class WebTest_Import_ContactTest extends ImportCiviSeleniumTestCase { // Visit contacts to check filled data. foreach ($fillRows as $cid => $fillRow) { - $this->open($this->sboxPath . "civicrm/contact/view?reset=1&cid={$fillRow['contact_id']}"); - $this->waitForPageToLoad($this->getTimeoutMsec()); + $this->openCiviPage("contact/view", "reset=1&cid={$fillRow['contact_id']}"); // Check old Household name. $householdName = $updateRows[$cid]['household_name']; diff --git a/tests/phpunit/WebTest/Import/CustomDataTest.php b/tests/phpunit/WebTest/Import/CustomDataTest.php index 9759c6e26e..17af6067d7 100644 --- a/tests/phpunit/WebTest/Import/CustomDataTest.php +++ b/tests/phpunit/WebTest/Import/CustomDataTest.php @@ -143,7 +143,7 @@ class WebTest_Import_CustomDataTest extends ImportCiviSeleniumTestCase { function _addCustomData($customGroupTitle, $id1, $id2) { - $this->open($this->sboxPath . "civicrm/admin/custom/group?reset=1"); + $this->openCiviPage("admin/custom/group", "reset=1"); //add new custom data $this->click("//a[@id='newCustomDataGroup']/span"); diff --git a/tests/phpunit/WebTest/Import/DuplicateMatchingTest.php b/tests/phpunit/WebTest/Import/DuplicateMatchingTest.php index 025a133b19..7349370c70 100644 --- a/tests/phpunit/WebTest/Import/DuplicateMatchingTest.php +++ b/tests/phpunit/WebTest/Import/DuplicateMatchingTest.php @@ -120,8 +120,7 @@ class WebTest_Import_DuplicateMatchingTest extends ImportCiviSeleniumTestCase { $this->importContacts($fillHeaders, $fillRows, 'Individual', 'Fill'); foreach ($importedContactIds as $cid) { - $this->open($this->sboxPath . "civicrm/contact/view?reset=1&cid={$cid}"); - $this->waitForPageToLoad($this->getTimeoutMsec()); + $this->openCiviPage("contact/view", "reset=1&cid={$cid}"); // Check old display name. $displayName = "{$updateRows[$cid]['first_name']} {$updateRows[$cid]['last_name']}"; @@ -218,8 +217,7 @@ class WebTest_Import_DuplicateMatchingTest extends ImportCiviSeleniumTestCase { $this->importContacts($fillHeaders, $fillRows, 'Organization', 'Fill'); foreach ($importedContactIds as $cid) { - $this->open($this->sboxPath . "civicrm/contact/view?reset=1&cid={$cid}"); - $this->waitForPageToLoad($this->getTimeoutMsec()); + $this->openCiviPage("contact/view", "reset=1&cid={$cid}"); // Check old Organization name. $organizationName = $updateRows[$cid]['organization_name']; @@ -315,8 +313,7 @@ class WebTest_Import_DuplicateMatchingTest extends ImportCiviSeleniumTestCase { $this->importContacts($fillHeaders, $fillRows, 'Household', 'Fill'); foreach ($importedContactIds as $cid) { - $this->open($this->sboxPath . "civicrm/contact/view?reset=1&cid={$cid}"); - $this->waitForPageToLoad($this->getTimeoutMsec()); + $this->openCiviPage("contact/view", "reset=1&cid={$cid}"); // Check old Household name. $householdName = $updateRows[$cid]['household_name']; diff --git a/tests/phpunit/WebTest/Import/GroupTest.php b/tests/phpunit/WebTest/Import/GroupTest.php index 694f02597d..ed85c5017d 100644 --- a/tests/phpunit/WebTest/Import/GroupTest.php +++ b/tests/phpunit/WebTest/Import/GroupTest.php @@ -59,7 +59,7 @@ class WebTest_Import_GroupTest extends ImportCiviSeleniumTestCase { $count = count($rows); // Direct URL To Search - $this->open($this->sboxPath . "/civicrm/contact/search?reset=1"); + $this->openCiviPage("contact/search", "reset=1"); // Select GroupName $this->select("group", "label={$groupName}"); @@ -81,7 +81,7 @@ class WebTest_Import_GroupTest extends ImportCiviSeleniumTestCase { $count += count($rows); // Direct URL To Search - $this->open($this->sboxPath . "/civicrm/contact/search?reset=1"); + $this->openCiviPage("contact/search", "reset=1"); // Select GroupName $this->select("group", "label={$groupName}"); diff --git a/tests/phpunit/WebTest/Import/ImportCiviSeleniumTestCase.php b/tests/phpunit/WebTest/Import/ImportCiviSeleniumTestCase.php index ae675f1b79..7b299df126 100644 --- a/tests/phpunit/WebTest/Import/ImportCiviSeleniumTestCase.php +++ b/tests/phpunit/WebTest/Import/ImportCiviSeleniumTestCase.php @@ -194,10 +194,7 @@ class ImportCiviSeleniumTestCase extends CiviSeleniumTestCase { ), $other = array(), $type = 'csv') { // Go to contact import page. - $this->open($this->sboxPath . "civicrm/import/contact?reset=1"); - - // check for upload field. - $this->waitForElementPresent("uploadFile"); + $this->openCiviPage("import/contact", "reset=1", "uploadFile"); $originalHeaders = $headers; $originalRows = $rows; @@ -543,9 +540,7 @@ class ImportCiviSeleniumTestCase extends CiviSeleniumTestCase { $searchName = $row['household_name']; } - $this->open($this->sboxPath . "civicrm/dashboard?reset=1"); - $this->waitForPageToLoad($this->getTimeoutMsec()); - + $this->openCiviPage("dashboard", "reset=1"); // Type search name in autocomplete. $this->click("css=input#sort_name_navigation"); diff --git a/tests/phpunit/WebTest/Import/TagTest.php b/tests/phpunit/WebTest/Import/TagTest.php index 95ff4b7910..1ffc7ad0ae 100644 --- a/tests/phpunit/WebTest/Import/TagTest.php +++ b/tests/phpunit/WebTest/Import/TagTest.php @@ -53,7 +53,7 @@ class WebTest_Import_TagTest extends ImportCiviSeleniumTestCase { $this->importContacts($headers, $rows, 'Individual', 'Skip', array(), $other); - $this->open($this->sboxPath . 'civicrm/contact/search?reset=1'); + $this->openCiviPage("contact/search", "reset=1"); $this->select('tag', "label={$tagName}"); // click to search $this->click('_qf_Basic_refresh'); @@ -73,8 +73,7 @@ class WebTest_Import_TagTest extends ImportCiviSeleniumTestCase { $this->importContacts($headers, $rows, 'Individual', 'Skip', array(), $other); - $this->open($this->sboxPath . 'civicrm/contact/search?reset=1'); - $this->waitForPageToLoad($this->getTimeoutMsec()); + $this->openCiviPage("contact/search", "reset=1"); $this->select('tag', "label={$tagName}"); // click to search diff --git a/tests/phpunit/WebTest/Member/DefaultMembershipPricesetTest.php b/tests/phpunit/WebTest/Member/DefaultMembershipPricesetTest.php index 801d787946..d575758744 100755 --- a/tests/phpunit/WebTest/Member/DefaultMembershipPricesetTest.php +++ b/tests/phpunit/WebTest/Member/DefaultMembershipPricesetTest.php @@ -212,7 +212,7 @@ class WebTest_Member_DefaultMembershipPricesetTest extends CiviSeleniumTestCase $memTypeId3 = $memTypeId3[1]; } - $this->open($this->sboxPath . "civicrm/admin/price/field?reset=1&action=add&sid={$sid}"); + $this->openCiviPage("admin/price/field", "reset=1&action=add&sid={$sid}"); foreach ($fields as $label => $type) { $validateStrings[] = $label; diff --git a/tests/phpunit/WebTest/Member/FixedMembershipTypeTest.php b/tests/phpunit/WebTest/Member/FixedMembershipTypeTest.php index 3ce04398b2..8ecfe93801 100644 --- a/tests/phpunit/WebTest/Member/FixedMembershipTypeTest.php +++ b/tests/phpunit/WebTest/Member/FixedMembershipTypeTest.php @@ -51,8 +51,7 @@ class WebTest_Member_FixedMembershipTypeTest extends CiviSeleniumTestCase { $this->assertTrue($this->isTextPresent("Organization $title has been created.")); - $this->open($this->sboxPath . "civicrm/admin/member/membershipType?reset=1&action=browse"); - $this->waitForPageToLoad($this->getTimeoutMsec()); + $this->openCiviPage("admin/member/membershipType", "reset=1&action=browse"); $this->click("link=Add Membership Type"); $this->waitForElementPresent('_qf_MembershipType_cancel-bottom'); @@ -82,7 +81,7 @@ class WebTest_Member_FixedMembershipTypeTest extends CiviSeleniumTestCase { $this->waitForElementPresent('link=Add Membership Type'); $this->assertTrue($this->isTextPresent("The membership type 'Membership Type $title' has been saved.")); - $this->open($this->sboxPath . "civicrm/contact/add?reset=1&ct=Individual"); + $this->openCiviPage("contact/add", "reset=1&ct=Individual"); $firstName = "John_" . substr(sha1(rand()), 0, 7); @@ -209,8 +208,7 @@ SELECT end_event_adjust_interval $this->assertTrue($this->isTextPresent("Organization $title has been created.")); - $this->open($this->sboxPath . "civicrm/admin/member/membershipType?reset=1&action=browse"); - $this->waitForPageToLoad($this->getTimeoutMsec()); + $this->openCiviPage("admin/member/membershipType", "reset=1&action=browse"); $this->click("link=Add Membership Type"); $this->waitForElementPresent('_qf_MembershipType_cancel-bottom'); @@ -240,7 +238,7 @@ SELECT end_event_adjust_interval $this->waitForElementPresent('link=Add Membership Type'); $this->assertTrue($this->isTextPresent("The membership type 'Membership Type $title' has been saved.")); - $this->open($this->sboxPath . "civicrm/contact/add?reset=1&ct=Individual"); + $this->openCiviPage("contact/add", "reset=1&ct=Individual"); $firstName = "John_" . substr(sha1(rand()), 0, 7); @@ -369,8 +367,7 @@ SELECT end_event_adjust_interval $this->assertTrue($this->isTextPresent("Organization $title has been created.")); - $this->open($this->sboxPath . "civicrm/admin/member/membershipType?reset=1&action=browse"); - $this->waitForPageToLoad($this->getTimeoutMsec()); + $this->openCiviPage("admin/member/membershipType", "reset=1&action=browse"); $this->click("link=Add Membership Type"); $this->waitForElementPresent('_qf_MembershipType_cancel-bottom'); @@ -398,7 +395,7 @@ SELECT end_event_adjust_interval $this->waitForElementPresent('link=Add Membership Type'); $this->assertTrue($this->isTextPresent("The membership type 'Membership Type $title' has been saved.")); - $this->open($this->sboxPath . "civicrm/contact/add?reset=1&ct=Individual"); + $this->openCiviPage("contact/add", "reset=1&ct=Individual"); $firstName = "John_" . substr(sha1(rand()), 0, 7); @@ -522,8 +519,7 @@ SELECT end_event_adjust_interval $this->assertTrue($this->isTextPresent("Organization $title has been created.")); - $this->open($this->sboxPath . "civicrm/admin/member/membershipType?reset=1&action=browse"); - $this->waitForPageToLoad($this->getTimeoutMsec()); + $this->openCiviPage("admin/member/membershipType", "reset=1&action=browse"); $this->click("link=Add Membership Type"); $this->waitForElementPresent('_qf_MembershipType_cancel-bottom'); @@ -552,7 +548,7 @@ SELECT end_event_adjust_interval $this->waitForElementPresent('link=Add Membership Type'); $this->assertTrue($this->isTextPresent("The membership type 'Membership Type $title' has been saved.")); - $this->open($this->sboxPath . "civicrm/contact/add?reset=1&ct=Individual"); + $this->openCiviPage("contact/add", "reset=1&ct=Individual"); $firstName = "John_" . substr(sha1(rand()), 0, 7); diff --git a/tests/phpunit/WebTest/Member/OnlineMembershipRenewTest.php b/tests/phpunit/WebTest/Member/OnlineMembershipRenewTest.php index 55fcd24784..aa2950a3e0 100644 --- a/tests/phpunit/WebTest/Member/OnlineMembershipRenewTest.php +++ b/tests/phpunit/WebTest/Member/OnlineMembershipRenewTest.php @@ -401,8 +401,7 @@ class WebTest_Member_OnlineMembershipRenewTest extends CiviSeleniumTestCase { $this->assertTrue($this->isTextPresent("Organization $title has been created.")); - $this->open($this->sboxPath . 'civicrm/admin/member/membershipType?reset=1&action=browse'); - $this->waitForPageToLoad($this->getTimeoutMsec()); + $this->openCiviPage("admin/member/membershipType", "reset=1&action=browse"); $this->click('link=Add Membership Type'); $this->waitForElementPresent('_qf_MembershipType_cancel-bottom'); @@ -476,7 +475,7 @@ class WebTest_Member_OnlineMembershipRenewTest extends CiviSeleniumTestCase { ); $hash = substr(sha1(rand()), 0, 7); - $this->open($this->sboxPath . "civicrm/admin/contribute/settings?reset=1&action=update&id=$pageId"); + $this->openCiviPage("admin/contribute/settings", "reset=1&action=update&id=$pageId"); $this->click('link=Title'); $this->waitForElementPresent('_qf_Settings_cancel-bottom'); @@ -500,8 +499,7 @@ class WebTest_Member_OnlineMembershipRenewTest extends CiviSeleniumTestCase { $this->webtestLogout(); //get Url for Live Contribution Page - $this->open($this->sboxPath . "civicrm/contribute/transact?reset=1&id=" . $pageId); - $this->waitForElementPresent('_qf_Main_upload-bottom'); + $this->openCiviPage("contribute/transact", "reset=1&id=$pageId", '_qf_Main_upload-bottom'); $this->click("xpath=//div[@class='crm-section membership_amount-section']/div[2]//span/label/span[2][contains(text(),'$membershipTypeTitle')]"); $firstName = 'Eia' . substr(sha1(rand()), 0, 4); $lastName = 'Ande' . substr(sha1(rand()), 0, 4); @@ -603,7 +601,7 @@ class WebTest_Member_OnlineMembershipRenewTest extends CiviSeleniumTestCase { //logout $this->webtestLogout(); - $this->open($this->sboxPath . "civicrm/contribute/transact?reset=1&id=" . $pageId); + $this->openCiviPage("contribute/transact", "reset=1&id=$pageId"); $this->click("xpath=//div[@class='crm-section membership_amount-section']/div[2]//span/label/span[2][contains(text(),'$membershipTypeTitle')]"); $this->type("email-5", $email); diff --git a/tests/phpunit/WebTest/Release/InstallScript.php b/tests/phpunit/WebTest/Release/InstallScript.php index 0ec08c2fe7..a475ef6c11 100644 --- a/tests/phpunit/WebTest/Release/InstallScript.php +++ b/tests/phpunit/WebTest/Release/InstallScript.php @@ -58,7 +58,7 @@ class WebTest_Release_InstallScript extends WebTest_Release_ReleaseTestCase { $this->waitForPageToLoad($this->getTimeoutMsec()); // $this->assertTrue($this->isTextPresent("this will take a few minutes")); $this->waitForTextPresent("CiviCRM has been successfully installed"); - $this->open($this->sboxPath . "civicrm/dashboard?reset=1"); + $this->openCiviPage("dashboard", "reset=1"); $this->assertTrue($this->isTextPresent("CiviCRM Home")); } } -- 2.25.1