Refactor ad-hoc url parsing to use the new urlArg() method
authorColeman Watts <coleman@civicrm.org>
Thu, 21 Mar 2013 00:02:06 +0000 (17:02 -0700)
committerColeman Watts <coleman@civicrm.org>
Thu, 21 Mar 2013 00:02:06 +0000 (17:02 -0700)
43 files changed:
tests/phpunit/WebTest/Admin/MoveCustomDataTest.php
tests/phpunit/WebTest/Campaign/SurveyUsageScenarioTest.php
tests/phpunit/WebTest/Case/CaseCustomFieldsTest.php
tests/phpunit/WebTest/Contact/AdvancedSearchedRelatedContactTest.php
tests/phpunit/WebTest/Contact/ContactReferenceFieldTest.php
tests/phpunit/WebTest/Contact/CreateCmsUserFromContactTest.php
tests/phpunit/WebTest/Contact/MultipleContactSubTypes.php
tests/phpunit/WebTest/Contact/ProfileChecksumTest.php
tests/phpunit/WebTest/Contact/SignatureTest.php
tests/phpunit/WebTest/Contact/TagSetSearchTest.php
tests/phpunit/WebTest/Contact/TaskActionAddToGroupTest.php
tests/phpunit/WebTest/Contact/UpdateProfileTest.php
tests/phpunit/WebTest/Contribute/AddPricesetTest.php
tests/phpunit/WebTest/Contribute/ContactContextAddTest.php
tests/phpunit/WebTest/Contribute/OfflineContributionTest.php
tests/phpunit/WebTest/Contribute/OfflineRecurContributionTest.php
tests/phpunit/WebTest/Contribute/OnBehalfOfOrganization.php
tests/phpunit/WebTest/Contribute/UpdateContributionTest.php
tests/phpunit/WebTest/Event/AddEventTest.php
tests/phpunit/WebTest/Event/AddPricesetTest.php
tests/phpunit/WebTest/Event/MultiprofileEventTest.php
tests/phpunit/WebTest/Event/PCPAddTest.php
tests/phpunit/WebTest/Event/PricesetMaxCountTest.php
tests/phpunit/WebTest/Financial/FinancialBatchExport.php
tests/phpunit/WebTest/Import/ActivityTest.php
tests/phpunit/WebTest/Import/AddressImportTest.php
tests/phpunit/WebTest/Import/ContactCustomDataTest.php
tests/phpunit/WebTest/Import/CustomDataTest.php
tests/phpunit/WebTest/Import/ImportCiviSeleniumTestCase.php
tests/phpunit/WebTest/Import/MatchExternalIdTest.php
tests/phpunit/WebTest/Import/ParticipantTest.php
tests/phpunit/WebTest/Mailing/MailingTest.php
tests/phpunit/WebTest/Mailing/SpoolTest.php
tests/phpunit/WebTest/Member/DefaultMembershipPricesetTest.php
tests/phpunit/WebTest/Member/InheritedMembershipTest.php
tests/phpunit/WebTest/Member/OfflineAutoRenewMembershipTest.php
tests/phpunit/WebTest/Member/OfflineMembershipAddPricesetTest.php
tests/phpunit/WebTest/Member/OnlineMembershipAddPricesetTest.php
tests/phpunit/WebTest/Member/OnlineMembershipRenewTest.php
tests/phpunit/WebTest/Member/SeperateMembershipPaymentTest.php
tests/phpunit/WebTest/Profile/MultiRecordProfileAddTest.php
tests/phpunit/WebTest/Profile/SearchTest.php
tests/phpunit/WebTest/Report/LoggingReportTest.php

index 3af6fa56f2c33cd891f2bf24ad92749d1779e2fe..4e0b46d95c46891316dd23599d615e4599cf2d38 100644 (file)
@@ -212,11 +212,7 @@ class WebTest_Admin_MoveCustomDataTest extends CiviSeleniumTestCase {
     //Is custom group created?
     $this->waitForText('crm-notification-container', "Your custom field set '{$customGroupTitle}' has been added. You can add custom fields now.");
 
-    $url = $this->parseURL();
-    $group_id = $url['queryString']['gid'];
-    $this->assertType('numeric', $group_id);
-
-    return $group_id;
+    return $this->urlArg('gid');
   }
 
   //Adds a new custom field to a specfied custom field group, using the given
index 72d2bc4e00dfa6c641f3b1e400ed00ba28817633..63c1e470b69736c1084c759dd976de179c185721 100644 (file)
@@ -244,8 +244,7 @@ class WebTest_Campaign_SurveyUsageScenarioTest extends CiviSeleniumTestCase {
     // add a contact to the group to test release respondents
     $firstName3 = substr(sha1(rand()), 0, 7);
     $this->webtestAddContact($firstName3, "James", "$firstName3.james@example.org");
-    $url       = $this->getLocation();
-    $id        = explode('cid=', $url);
+    $id = $this->urlArg('cid');
     $sortName3 = "James, $firstName3";
 
     // add contact to group
@@ -320,8 +319,7 @@ class WebTest_Campaign_SurveyUsageScenarioTest extends CiviSeleniumTestCase {
     // Adding contact
     $firstName1 = substr(sha1(rand()), 0, 7);
     $this->webtestAddContact($firstName1, "Smith", "$firstName1.smith@example.org");
-    $url1 = explode('cid=', $this->getLocation());
-    $id1 = $url1[1];
+    $id1 = $this->urlArg('cid');
 
     // add contact to group
     // visit group tab
@@ -335,8 +333,7 @@ class WebTest_Campaign_SurveyUsageScenarioTest extends CiviSeleniumTestCase {
 
     $firstName2 = substr(sha1(rand()), 0, 7);
     $this->webtestAddContact($firstName2, "John", "$firstName2.john@example.org");
-    $url2 = explode('cid=', $this->getLocation());
-    $id2 = $url2[1];
+    $id2 = $this->urlArg('cid');
 
     // add contact to group
     // visit group tab
index b4d20cad7be71b8779e9d9006ae958b29d223284..4ec08bf485d59dc808c532a6331ca96b17dbba31 100644 (file)
@@ -54,8 +54,7 @@ class WebTest_Case_CaseCustomFieldsTest extends CiviSeleniumTestCase {
     $this->waitForPageToLoad($this->getTimeoutMsec());
 
     // get custom group id
-    $elements = $this->parseURL();
-    $customGrpId1 = $elements['queryString']['gid'];
+    $customGrpId1 = $this->urlArg('gid');
 
     $customId = $this->_testGetCustomFieldId($customGrpId1);
     $cusId_1 = 'custom_' . $customId[0] . '_-1';
index a780e84285fcba0f4897a9051a636b623872362a..0136f7e31c04b8f25e9ab70b1e2e09cec378ab1b 100644 (file)
@@ -289,9 +289,7 @@ class WebTest_Contact_AdvancedSearchedRelatedContactTest extends CiviSeleniumTes
     $firstNameSoft = "John_".substr(sha1(rand()), 0, 5);
     $lastNameSoft  = "Doe_".substr(sha1(rand()), 0, 5);
     $this->webtestAddContact( $firstNameSoft, $lastNameSoft );
-    $url = $this->parseURL( );
-    $cid = $url['queryString']['cid'];
-    $this->assertType('numeric', $cid);
+    $cid = $this->urlArg('cid');
 
     //advance search for created contacts
     $this->openCiviPage('contact/search/advanced', 'reset=1', '_qf_Advanced_refresh');
index 9929cecf2a4d94bd8c3a2502e78f3b17d98a6c00..a089521fb4b762e1f411c7a4b4a49565fcd08748 100644 (file)
@@ -94,9 +94,7 @@ class WebTest_Contact_ContactReferenceFieldTest extends CiviSeleniumTestCase {
     //Is custom group created?
     $this->waitForText('crm-notification-container', "Your custom field set '{$customGroupTitle}' has been added. You can add custom fields now.");
 
-    $matches = array();
-    preg_match('/gid=([0-9]+)/', $this->getLocation(), $matches);
-    $customGroupId = $matches[1];
+    $customGroupId = $this->urlArg('gid');
 
     // Add contact reference fields
     $contactRefFieldLabel1 = 'contact_ref_' . substr(sha1(rand()), 0, 4);
@@ -138,18 +136,14 @@ class WebTest_Contact_ContactReferenceFieldTest extends CiviSeleniumTestCase {
     $this->click("xpath=//div[@id='field_page']//table/tbody/tr[1]/td[8]/span[1]/a[text()='Edit Field']");
     $this->waitForPageToLoad($this->getTimeoutMsec());
 
-    $matches = array();
-    preg_match('/&id=([0-9]+)/', $this->getLocation(), $matches);
-    $contactRefFieldID1 = $matches[1];
+    $contactRefFieldID1 = $this->urlArg('id');
 
     $this->openCiviPage('admin/custom/group/field', "reset=1&action=browse&gid={$customGroupId}");
 
     $this->click("xpath=//div[@id='field_page']//table/tbody/tr[2]/td[8]/span[1]/a[text()='Edit Field']");
     $this->waitForPageToLoad($this->getTimeoutMsec());
 
-    $matches = array();
-    preg_match('/&id=([0-9]+)/', $this->getLocation(), $matches);
-    $contactRefFieldID2 = $matches[1];
+    $contactRefFieldID2 = $this->urlArg('id');
 
     // Visit custom group preview page
     $this->openCiviPage('admin/custom/group', "action=preview&reset=1&id={$customGroupId}");
index 78b611f94ecb0dda4bd89f451f2ff6afdc589662..569d51be0ae2ad2127dd515a47bd890dd2a644b1 100644 (file)
@@ -212,9 +212,7 @@ class WebTest_Contact_CreateCmsUserFromContactTest extends CiviSeleniumTestCase
     $email = $this->webtestAddContact($firstName, $lastName, TRUE);
 
     // Get the contact id of the new contact
-    $contactUrl = $this->parseURL();
-    $cid = $contactUrl['queryString']['cid'];
-    $this->assertType('numeric', $cid);
+    $cid = $this->urlArg('cid');
 
     //got to the new cms user form
     $this->openCiviPage('contact/view/useradd', "reset=1&action=add&cid={$cid}");
index 0f727a945c0b5e18278bc7d101ce42aa3250922c..e1189771d20106bbef7c6ed810215ffecb8a9e13 100644 (file)
@@ -237,8 +237,7 @@ class WebTest_Contact_MultipleContactSubTypes extends CiviSeleniumTestCase {
 
     //Is custom group created?
     $this->assertTrue($this->isTextPresent("Your custom field set '{$customGroupTitle}' has been added."));
-    $url = explode('gid=', $this->getLocation());
-    $gid = $url[1];
+    $gid = $this->urlArg('gid');
 
     $fieldLabel = "custom_field_for_{$contactSubType}" . substr(sha1(rand()), 0, 4);
     $this->type('label', $fieldLabel);
index f1e33f6ad852653080522783cece9cd48641587f..85df61c8162f68d3a3afcf000464d816d4a7206d 100644 (file)
@@ -92,9 +92,7 @@ class WebTest_Contact_ProfileChecksumTest extends CiviSeleniumTestCase {
     $this->webtestAddContact($fields['first_name']['default_value'], $fields['last_name']['default_value'], $fields['email']['default_value']);
 
     // Get contact id from url.
-    $matches = array();
-    preg_match('/cid=([0-9]+)/', $this->getLocation(), $matches);
-    $contactId = $matches[1];
+    $contactId = $this->urlArg('cid');
 
     // Create profile for contact
     $profileName = "Profile_" . substr(sha1(rand()), 0, 7);
@@ -149,8 +147,7 @@ class WebTest_Contact_ProfileChecksumTest extends CiviSeleniumTestCase {
     $this->type('title', $profileName);
     $this->click('_qf_Group_next-top');
     $this->waitForPageToLoad($this->getTimeoutMsec());
-    $elements = $this->parseURL();
-    $profileId = $elements['queryString']['gid'];
+    $profileId = $this->urlArg('gid');
 
     // Add field to the profile.
     foreach ($fields as $key => $values) {
index f0704b70b2141bb59c500b27dfb2c2d1a999a56a..b0b1969489318433b2f2efed37109e5aa66b401c 100644 (file)
@@ -98,9 +98,7 @@ class WebTest_Contact_SignatureTest extends CiviSeleniumTestCase {
     $name = $this->getText("xpath=//div[@class='crm-summary-display_name']");
 
     // Get contact id from url.
-    $matches = array();
-    preg_match('/cid=([0-9]+)/', $this->getLocation(), $matches);
-    $contactId = $matches[1];
+    $contactId = $this->urlArg('cid');
 
     // Select Your Editor
     $this->_selectEditor('CKEditor');
index 3ea97bbb7cd109bf130ea4096c04c7a480c742e3..98f9ebc6eaa9ff5b1eb4f3458892f8653d4b1fa2 100644 (file)
@@ -163,15 +163,9 @@ class WebTest_Contact_TagSetSearchTest extends CiviSeleniumTestCase {
     // verify text
     $this->waitForElementPresent("xpath=//table//tbody/tr/td[1][text()= '$tagSetName']");
 
-    $this->click("xpath=//table//tbody/tr/td[1][text()= '$tagSetName']/following-sibling::td[7]/span/a[text()= 'Edit']");
+    $this->clickLink("xpath=//table//tbody/tr/td[1][text()= '$tagSetName']/following-sibling::td[7]/span/a[text()= 'Edit']");
 
-    $this->waitForPageToLoad($this->getTimeoutMsec());
-
-    // Get contact id from url.
-    $matches = array();
-    preg_match('/id=([0-9]+)/', $this->getLocation(), $matches);
-
-    return $matches[1];
+    return $this->urlArg('id');
   }
 }
 
index 7f744157fad7d11e934a8656ae76ad8d04fcf826..5577a4506c5234f3be56492e697aa9cb88c3cd36 100644 (file)
@@ -45,8 +45,7 @@ class WebTest_Contact_TaskActionAddToGroupTest extends CiviSeleniumTestCase {
       $this->webtestAddContact();
 
       // get cid of new contact
-      $queryParams = $this->parseURL();
-      $cids[] = $queryParams['queryString']['cid'];
+      $cids[] = $this->urlArg('cid');
 
       // update email of new contact
       $this->click("//ul[@id='actions']/li/a/span[text()='Edit']");
index 920d7f4977a5d9cc99c2727a14cc28503ba2db80..f3609bca88b85d56b0676393909ac2e9142ac002 100644 (file)
@@ -40,6 +40,7 @@ class WebTest_Contact_UpdateProfileTest extends CiviSeleniumTestCase {
     $locationUrl = $this->getLocation();
     $editUrl = str_replace('/view?', '/edit?', $locationUrl);
     $this->open($editUrl);
+    $this->waitForPageToLoad($this->getTimeoutMsec());
 
     // Modify profile field values
     // contact details section
index 7887c9883387b72cd7ee85ec8d4451e806259932..3b29dd659b5e31b1b1ce11491dc1c7edef374eab 100644 (file)
@@ -46,8 +46,7 @@ class WebTest_Contribute_AddPricesetTest extends CiviSeleniumTestCase {
 
     // Get the price set id ($sid) by retrieving and parsing the URL of the New Price Field form
     // which is where we are after adding Price Set.
-    $elements = $this->parseURL();
-    $sid = $elements['queryString']['sid'];
+    $sid = $this->urlArg('sid');
     $this->assertType('numeric', $sid);
 
     $validStrings = array();
@@ -244,8 +243,7 @@ class WebTest_Contribute_AddPricesetTest extends CiviSeleniumTestCase {
 
     // Get the price set id ($sid) by retrieving and parsing the URL of the New Price Field form
     // which is where we are after adding Price Set.
-    $elements = $this->parseURL();
-    $sid = $elements['queryString']['sid'];
+    $sid = $this->urlArg('sid');
     $this->assertType('numeric', $sid);
 
     $validStrings = array();
@@ -346,8 +344,7 @@ class WebTest_Contribute_AddPricesetTest extends CiviSeleniumTestCase {
 
     // Get the price set id ($sid) by retrieving and parsing the URL of the New Price Field form
     // which is where we are after adding Price Set.
-    $elements = $this->parseURL();
-    $sid = $elements['queryString']['sid'];
+    $sid = $this->urlArg('sid');
     $this->assertType('numeric', $sid);
 
     $validStrings = array();
@@ -469,8 +466,7 @@ class WebTest_Contribute_AddPricesetTest extends CiviSeleniumTestCase {
 
     // Get the price set id ($sid) by retrieving and parsing the URL of the New Price Field form
     // which is where we are after adding Price Set.
-    $elements = $this->parseURL();
-    $sid = $elements['queryString']['sid'];
+    $sid = $this->urlArg('sid');
     $this->assertType('numeric', $sid);
 
     $validStrings = array();
@@ -592,8 +588,7 @@ class WebTest_Contribute_AddPricesetTest extends CiviSeleniumTestCase {
 
     // Get the price set id ($sid) by retrieving and parsing the URL of the New Price Field form
     // which is where we are after adding Price Set.
-    $elements = $this->parseURL();
-    $sid = $elements['queryString']['sid'];
+    $sid = $this->urlArg('sid');
     $this->assertType('numeric', $sid);
 
     $validStrings = array();
index 46b1fbe7a55e461db95ca584e111d53a88905416..b187b2e503f319c83bddf28a4c3737aef57d0381 100644 (file)
@@ -72,7 +72,7 @@ class WebTest_Contribute_ContactContextAddTest extends CiviSeleniumTestCase {
       $isDefault
     );
 
-    $this->webtestAddContact( $firstName, "Anderson", true );
+    $this->webtestAddContact($firstName, "Anderson", true);
 
     // Get the contact id of the new contact
     $contactUrl = $this->parseURL();
index 406c39e29e125fa85b7849b6d3dfdf887a6da19d..0e177fb7c70f5afaef24381e3970a288e9d2aec7 100644 (file)
@@ -301,6 +301,7 @@ class WebTest_Contribute_OfflineContributionTest extends CiviSeleniumTestCase {
     $url = $this->getLocation();
     $url = str_replace('mode=live', 'mode=test', $url);
     $this->open($url);
+    $this->waitForPageToLoad($this->getTimeoutMsec());
 
     // start filling out contribution form
     $this->waitForElementPresent('payment_processor_id');
index e5ad0644492b5782afce175ecb54128598aea3ae..c00efef365975bff2bad94c7e9bc9f12a3a41a6f 100644 (file)
@@ -55,6 +55,7 @@ class WebTest_Contribute_OfflineRecurContributionTest extends CiviSeleniumTestCa
     $url = $this->getLocation();
     $url = str_replace('mode=live', 'mode=test', $url);
     $this->open($url);
+    $this->waitForPageToLoad($this->getTimeoutMsec());
 
     // start filling out contribution form
     $this->waitForElementPresent('payment_processor_id');
index a7a42b2fde81b0268ad6a3c01522f576175e4214..1e7a06897bbe0434814ae7e23589aeae9a502c83 100644 (file)
@@ -47,10 +47,7 @@ class WebTest_Contribute_OnBehalfOfOrganization extends CiviSeleniumTestCase {
 
     //adding contact for membership sign up
     $this->webtestAddContact($firstName, $lastName, $email);
-    $urlElements = $this->parseURL();
-    print_r($urlElements);
-    $cid = $urlElements['queryString']['cid'];
-    $this->assertType('numeric', $cid);
+    $cid = $this->urlArg('cid');
 
     // We need a payment processor
     $processorName = "Webtest Dummy" . substr(sha1(rand()), 0, 7);
@@ -452,10 +449,7 @@ class WebTest_Contribute_OnBehalfOfOrganization extends CiviSeleniumTestCase {
     $this->type("last_name", $lastName);
     $this->clickLink("_qf_Edit_next", "profilewrap4");
 
-    $urlElements = $this->parseURL();
-    print_r($urlElements);
-    $cid = $urlElements['queryString']['id'];
-    $this->assertType('numeric', $cid);
+    $cid = $this->urlArg('id');
     // 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!");
 
@@ -715,8 +709,7 @@ class WebTest_Contribute_OnBehalfOfOrganization extends CiviSeleniumTestCase {
 
     $this->waitForPageToLoad($this->getTimeoutMsec());
     $this->assertTrue($this->isTextPresent("Your custom field '$fieldTitle' has been saved."));
-    $url = explode('&id=', $this->getAttribute("xpath=//div[@id='field_page']/div[2]/table/tbody//tr/td[1][text()='$fieldTitle']/../td[8]/span/a@href"));
-    $fieldId = $url[1];
+    $fieldId = $this->urlArg('id', $this->getAttribute("xpath=//div[@id='field_page']/div[2]/table/tbody//tr/td[1][text()='$fieldTitle']/../td[8]/span/a@href"));
 
     // Enable CiviCampaign module if necessary
     $this->enableComponents("CiviCampaign");
@@ -961,8 +954,7 @@ class WebTest_Contribute_OnBehalfOfOrganization extends CiviSeleniumTestCase {
 
     $this->waitForPageToLoad($this->getTimeoutMsec());
     $this->assertTrue($this->isTextPresent("Your custom field '$fieldTitle' has been saved."));
-    $url = explode('&id=', $this->getAttribute("xpath=//div[@id='field_page']/div[2]/table/tbody//tr/td[1]/span[text()='$fieldTitle']/../td[8]/span/a@href"));
-    $fieldId = $url[1];
+    $fieldId = $this->urlArg('id', $this->getAttribute("xpath=//div[@id='field_page']/div[2]/table/tbody//tr/td[1]/span[text()='$fieldTitle']/../td[8]/span/a@href"));
 
     // Enable CiviCampaign module if necessary
     $this->enableComponents("CiviCampaign");
@@ -1119,8 +1111,7 @@ class WebTest_Contribute_OnBehalfOfOrganization extends CiviSeleniumTestCase {
     $this->click('_qf_MembershipType_upload-bottom');
     $this->waitForElementPresent('link=Add Membership Type');
     $this->assertTrue($this->isTextPresent("The membership type '$title1' has been saved."));
-    $typeUrl = explode('&id=', $this->getAttribute("xpath=//div[@id='membership_type']/div[2]/table/tbody//tr/td[1][text()='{$title1}']/../td[10]/span/a[3]@href"));
-    $typeId = $typeUrl[1];
+    $typeId = $this->urlArg('id', $this->getAttribute("xpath=//div[@id='membership_type']/div[2]/table/tbody//tr/td[1][text()='{$title1}']/../td[10]/span/a[3]@href"));
 
     // open contact
     $this->openCiviPage("contact/view/rel", "cid={$cid}&action=add&reset=1");
@@ -1288,8 +1279,7 @@ class WebTest_Contribute_OnBehalfOfOrganization extends CiviSeleniumTestCase {
     $this->type("last_name", $lastName);
     $this->clickLink("_qf_Edit_next", "profilewrap4");
 
-    $urlElements = $this->parseURL();
-    $cid = $urlElements['queryString']['id'];
+    $cid = $this->urlArg('id');
     $this->assertType('numeric', $cid);
     // 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!");
index 6818bf23339b47a8d38ba146cd41e475d393c9b4..5038e657cfa5ba075cce27695c893942af768e81 100644 (file)
@@ -97,8 +97,7 @@ class WebTest_Contribute_UpdateContributionTest extends CiviSeleniumTestCase {
    $this->_testOfflineContribution($firstName, $lastName, $email, $amount, "Pending");\r
    $this->click("xpath=//div[@id='Contributions']//table/tbody/tr[1]/td[8]/span/a[text()='Edit']");\r
    $this->waitForPageToLoad($this->getTimeoutMsec());\r
-   $elements = $this->parseURL();\r
-   $contId = $elements['queryString']['id'];\r
+   $contId = $this->urlArg('id');\r
    $this->select("contribution_status_id", "label=Completed");\r
    $this->click("_qf_Contribution_upload");\r
    $this->waitForPageToLoad($this->getTimeoutMsec());\r
@@ -178,8 +177,7 @@ class WebTest_Contribute_UpdateContributionTest extends CiviSeleniumTestCase {
    //click through to the Contribution edit screen\r
    $this->click("xpath=//div[@id='Contributions']//table/tbody/tr[1]/td[8]/span/a[text()='Edit']");\r
    $this->waitForElementPresent("_qf_Contribution_upload-bottom");\r
-   $elements = $this->parseURL();\r
-   $contId = $elements['queryString']['id'];\r
+   $contId = $this->urlArg('id');\r
    $this->waitForElementPresent("product_name_0");\r
    $this->select('product_name_0', "label=$premiumName2 ( $sku2 )");\r
    // Clicking save.\r
@@ -246,8 +244,7 @@ class WebTest_Contribute_UpdateContributionTest extends CiviSeleniumTestCase {
    //click through to the Contribution edit screen\r
    $this->click("xpath=//div[@id='Contributions']//table/tbody/tr[1]/td[8]/span/a[text()='Edit']");\r
    $this->waitForElementPresent("_qf_Contribution_upload-bottom");\r
-   $elements = $this->parseURL();\r
-   $contId = $elements['queryString']['id'];\r
+   $contId = $this->urlArg('id');\r
    $this->waitForElementPresent("product_name_0");\r
    $this->select('product_name_0', "value=0");\r
    // Clicking save.\r
@@ -273,8 +270,7 @@ class WebTest_Contribute_UpdateContributionTest extends CiviSeleniumTestCase {
    $this->_testOfflineContribution($firstName, $lastName, $email, $amount);\r
    $this->click("xpath=//div[@id='Contributions']//table/tbody/tr[1]/td[8]/span/a[text()='Edit']");\r
    $this->waitForPageToLoad($this->getTimeoutMsec());\r
-   $elements = $this->parseURL();\r
-   $contId = $elements['queryString']['id'];\r
+   $contId = $this->urlArg('id');\r
    //change payment processor to newly created value\r
    $this->select("payment_instrument_id", "label=$label");\r
    $this->click("_qf_Contribution_upload");\r
@@ -296,8 +292,7 @@ class WebTest_Contribute_UpdateContributionTest extends CiviSeleniumTestCase {
    $this->waitForPageToLoad($this->getTimeoutMsec());\r
    //Contribution status\r
    $this->select("contribution_status_id", "label=Refunded");\r
-   $elements = $this->parseURL();\r
-   $contId = $elements['queryString']['id'];\r
+   $contId = $this->urlArg('id');\r
    $this->click("_qf_Contribution_upload");\r
    $this->waitForPageToLoad($this->getTimeoutMsec());\r
 \r
@@ -325,8 +320,7 @@ class WebTest_Contribute_UpdateContributionTest extends CiviSeleniumTestCase {
    $this->waitForPageToLoad($this->getTimeoutMsec());\r
    //Contribution status\r
    $this->select("contribution_status_id", "label=Cancelled");\r
-   $elements = $this->parseURL();\r
-   $contId = $elements['queryString']['id'];\r
+   $contId = $this->urlArg('id');\r
    $this->click("_qf_Contribution_upload");\r
    $this->waitForPageToLoad($this->getTimeoutMsec());\r
 \r
@@ -360,8 +354,7 @@ class WebTest_Contribute_UpdateContributionTest extends CiviSeleniumTestCase {
    $this->waitForPageToLoad($this->getTimeoutMsec());\r
    //Contribution status\r
    $this->select("financial_type_id", "value=3");\r
-   $elements = $this->parseURL();\r
-   $contId = $elements['queryString']['id'];\r
+   $contId = $this->urlArg('id');\r
    $this->click("_qf_Contribution_upload");\r
    $this->waitForPageToLoad($this->getTimeoutMsec());\r
 \r
index 00108118baa9dfaf526640988fc5e7bd67f2865d..6ee243ad60b03b9382661f4e8e8cb07cc659cbf9 100644 (file)
@@ -497,8 +497,7 @@ class WebTest_Event_AddEventTest extends CiviSeleniumTestCase {
       $this->assertStringsPresent($eventFees);
 
     }
-    $elements = $this->parseURL();
-    return $elements['queryString']['id'];
+    return $this->urlArg('id');
   }
 
   function _testVerifyRegisterPage($registerStrings) {
index 12af2d58c0caf2b4d7559d1b67873af2f2b7fc88..2957905da60c4c2b0b1fd3cc083b45cd5b7c0e60 100644 (file)
@@ -43,8 +43,7 @@ class WebTest_Event_AddPricesetTest extends CiviSeleniumTestCase {
 
     // Get the price set id ($sid) by retrieving and parsing the URL of the New Price Field form
     // which is where we are after adding Price Set.
-    $elements = $this->parseURL();
-    $sid = $elements['queryString']['sid'];
+    $sid = $this->urlArg('sid');
     $this->assertType('numeric', $sid);
 
     $validStrings = array();
@@ -188,8 +187,7 @@ class WebTest_Event_AddPricesetTest extends CiviSeleniumTestCase {
 
     // Get the price set id ($sid) by retrieving and parsing the URL of the New Price Field form
     // which is where we are after adding Price Set.
-    $elements = $this->parseURL();
-    $sid = $elements['queryString']['sid'];
+    $sid = $this->urlArg('sid');
     $this->assertType('numeric', $sid);
 
     $validStrings = array();
@@ -346,8 +344,7 @@ class WebTest_Event_AddPricesetTest extends CiviSeleniumTestCase {
 
     // Get the price set id ($sid) by retrieving and parsing the URL of the New Price Field form
     // which is where we are after adding Price Set.
-    $elements = $this->parseURL();
-    $sid = $elements['queryString']['sid'];
+    $sid = $this->urlArg('sid');
     $this->assertType('numeric', $sid);
 
     $validStrings = array();
@@ -502,8 +499,7 @@ class WebTest_Event_AddPricesetTest extends CiviSeleniumTestCase {
 
     // Get the price set id ($sid) by retrieving and parsing the URL of the New Price Field form
     // which is where we are after adding Price Set.
-    $elements = $this->parseURL();
-    $sid = $elements['queryString']['sid'];
+    $sid = $this->urlArg('sid');
     $this->assertType('numeric', $sid);
 
     $validStrings = array();
index 7a1541d7454272c33d63f536aaf1a4e70dd5066f..f5419f965dbe72a7f6476671355a1a9ec9e4e3b4 100644 (file)
@@ -60,8 +60,7 @@ class WebTest_Event_MultiprofileEventTest extends CiviSeleniumTestCase {
     $this->waitForPageToLoad($this->getTimeoutMsec());
 
     // get custom group id
-    $elements = $this->parseURL();
-    $customGrpId1 = $elements['queryString']['gid'];
+    $customGrpId1 = $this->urlArg('gid');
 
     $customId = $this->_testGetCustomFieldId($customGrpId1);
 
@@ -161,8 +160,7 @@ class WebTest_Event_MultiprofileEventTest extends CiviSeleniumTestCase {
     $this->waitForPageToLoad($this->getTimeoutMsec());
 
     // get custom group id
-    $elements = $this->parseURL();
-    $customGrpId1 = $elements['queryString']['gid'];
+    $customGrpId1 = $this->urlArg('gid');
 
     $customId = $this->_testGetCustomFieldId($customGrpId1);
 
@@ -417,8 +415,7 @@ class WebTest_Event_MultiprofileEventTest extends CiviSeleniumTestCase {
     $this->type('title', $profilename);
     $this->click('_qf_Group_next-top');
     $this->waitForPageToLoad($this->getTimeoutMsec());
-    $elements = $this->parseURL();
-    $profileId = $elements['queryString']['gid'];
+    $profileId = $this->urlArg('gid');
 
     //Add field to profile_testCreateProfile
     foreach ($profilefield as $key => $value) {
@@ -581,12 +578,9 @@ class WebTest_Event_MultiprofileEventTest extends CiviSeleniumTestCase {
 
     // Wait for "saved" status msg
     $this->waitForPageToLoad($this->getTimeoutMsec());
-    $elements = $this->parseURL();
-    $eventPageId = $elements['queryString']['id'];
+    $this->waitForText('crm-notification-container', "'Registration' information has been saved.");
 
-    $this->waitForTextPresent("'Registration' information has been saved.");
-
-    return $eventPageId;
+    return $this->urlArg('id');
   }
 
   function _testEventRegistration($eventPageId, $customId, $firstName, $lastName,
index 793edfcf5f22e32091bd0e489bb3e7d7fb28652a..5c4299a708ff476350eab12bfb9212b5b9be1c95 100644 (file)
@@ -416,12 +416,10 @@ class WebTest_Event_PCPAddTest extends CiviSeleniumTestCase {
     $this->waitForElementPresent('_qf_Event_upload-bottom');
     $this->waitForPageToLoad($this->getTimeoutMsec());
     $text = "'Event' information has been saved.";
-    $this->assertTrue($this->isTextPresent($text), 'Missing text: ' . $text);
+    $this->waitForText('crm-notification-container', $text);
 
     // parse URL to grab the contribution page id
-    $elements = $this->parseURL();
-    $pageId = $elements['queryString']['id'];
-    return $pageId;
+    return $this->urlArg('id');
   }
 
   function _testParticipantSearchEventName($eventName, $lastNameDonar, $firstNameDonar, $firstNameCreator, $lastNameCreator, $amount) {
index 42201444cba25eeeaad7eee977073c3b261d4b1e..75cd6e456c19344dfef9573293f1b9207bd2ea82 100644 (file)
@@ -111,9 +111,7 @@ class WebTest_Event_PricesetMaxCountTest extends CiviSeleniumTestCase {
     // get text field Id.
     $this->click("xpath=//div[@id='field_page']//table/tbody/tr[1]/td[9]/span[1]/a[2]");
     $this->waitForPageToLoad($this->getTimeoutMsec());
-    $matches = array();
-    preg_match('/fid=([0-9]+)/', $this->getLocation(), $matches);
-    $textFieldId = $matches[1];
+    $textFieldId = $this->urlArg('fid');
 
     $this->open($pricesetLoc);
     $this->waitForPageToLoad($this->getTimeoutMsec());
@@ -122,17 +120,13 @@ class WebTest_Event_PricesetMaxCountTest extends CiviSeleniumTestCase {
     $this->click("xpath=//div[@id='field_page']//table/tbody/tr[2]/td[8]/a");
     $this->waitForPageToLoad($this->getTimeoutMsec());
     $selectFieldLoc = $this->getLocation();
-    $matches = array();
-    preg_match('/fid=([0-9]+)/', $this->getLocation(), $matches);
-    $selectFieldId = $matches[1];
+    $selectFieldId = $this->urlArg('fid');
 
     // get select field ids
     // get select field option1
     $this->click("xpath=//div[@id='field_page']//table/tbody/tr[1]/td[7]/span[1]/a[1]");
     $this->waitForPageToLoad($this->getTimeoutMsec());
-    $matches = array();
-    preg_match('/oid=([0-9]+)/', $this->getLocation(), $matches);
-    $selectFieldOp1 = $matches[1];
+    $selectFieldOp1 = $this->urlArg('oid');
 
     $this->open($selectFieldLoc);
     $this->waitForPageToLoad($this->getTimeoutMsec());
@@ -140,9 +134,7 @@ class WebTest_Event_PricesetMaxCountTest extends CiviSeleniumTestCase {
     // get select field option2
     $this->click("xpath=//div[@id='field_page']//table/tbody/tr[2]/td[7]/span[1]/a[1]");
     $this->waitForPageToLoad($this->getTimeoutMsec());
-    $matches = array();
-    preg_match('/oid=([0-9]+)/', $this->getLocation(), $matches);
-    $selectFieldOp2 = $matches[1];
+    $selectFieldOp2 = $this->urlArg('oid');
 
     // create event.
     $eventTitle = 'Meeting - ' . substr(sha1(rand()), 0, 7);
@@ -311,11 +303,8 @@ class WebTest_Event_PricesetMaxCountTest extends CiviSeleniumTestCase {
     $pricesetLoc = $this->getLocation();
 
     // get text field Id.
-    $this->click("xpath=//div[@id='field_page']//table/tbody/tr[1]/td[9]/span[1]/a[2]");
-    $this->waitForPageToLoad($this->getTimeoutMsec());
-    $matches = array();
-    preg_match('/fid=([0-9]+)/', $this->getLocation(), $matches);
-    $textFieldId = $matches[1];
+    $this->clickLink("xpath=//div[@id='field_page']//table/tbody/tr[1]/td[9]/span[1]/a[2]");
+    $textFieldId = $this->urlArg('fid');
 
     $this->open($pricesetLoc);
     $this->waitForPageToLoad($this->getTimeoutMsec());
@@ -324,17 +313,13 @@ class WebTest_Event_PricesetMaxCountTest extends CiviSeleniumTestCase {
     $this->click("xpath=//div[@id='field_page']//table/tbody/tr[2]/td[8]/a");
     $this->waitForPageToLoad($this->getTimeoutMsec());
     $selectFieldLoc = $this->getLocation();
-    $matches = array();
-    preg_match('/fid=([0-9]+)/', $this->getLocation(), $matches);
-    $selectFieldId = $matches[1];
+    $selectFieldId = $this->urlArg('fid');
 
     // get select field ids
     // get select field option1
     $this->click("xpath=//div[@id='field_page']//table/tbody/tr[1]/td[7]/span[1]/a[1]");
     $this->waitForPageToLoad($this->getTimeoutMsec());
-    $matches = array();
-    preg_match('/oid=([0-9]+)/', $this->getLocation(), $matches);
-    $selectFieldOp1 = $matches[1];
+    $selectFieldOp1 = $this->urlArg('oid');
 
     $this->open($selectFieldLoc);
     $this->waitForPageToLoad($this->getTimeoutMsec());
@@ -342,9 +327,7 @@ class WebTest_Event_PricesetMaxCountTest extends CiviSeleniumTestCase {
     // get select field option2
     $this->click("xpath=//div[@id='field_page']//table/tbody/tr[2]/td[7]/span[1]/a[1]");
     $this->waitForPageToLoad($this->getTimeoutMsec());
-    $matches = array();
-    preg_match('/oid=([0-9]+)/', $this->getLocation(), $matches);
-    $selectFieldOp2 = $matches[1];
+    $selectFieldOp2 = $this->urlArg('oid');
 
     // create event.
     $eventTitle = 'Meeting - ' . substr(sha1(rand()), 0, 7);
@@ -507,11 +490,8 @@ class WebTest_Event_PricesetMaxCountTest extends CiviSeleniumTestCase {
     $pricesetLoc = $this->getLocation();
 
     // get text field Id.
-    $this->click("xpath=//div[@id='field_page']//table/tbody/tr[1]/td[9]/span[1]/a[2]");
-    $this->waitForPageToLoad($this->getTimeoutMsec());
-    $matches = array();
-    preg_match('/fid=([0-9]+)/', $this->getLocation(), $matches);
-    $textFieldId = $matches[1];
+    $this->clickLink("xpath=//div[@id='field_page']//table/tbody/tr[1]/td[9]/span[1]/a[2]");
+    $textFieldId = $this->urlArg('fid');
 
     $this->open($pricesetLoc);
     $this->waitForPageToLoad($this->getTimeoutMsec());
@@ -520,17 +500,13 @@ class WebTest_Event_PricesetMaxCountTest extends CiviSeleniumTestCase {
     $this->click("xpath=//div[@id='field_page']//table/tbody/tr[2]/td[8]/a");
     $this->waitForPageToLoad($this->getTimeoutMsec());
     $selectFieldLoc = $this->getLocation();
-    $matches = array();
-    preg_match('/fid=([0-9]+)/', $this->getLocation(), $matches);
-    $selectFieldId = $matches[1];
+    $selectFieldId = $this->urlArg('fid');
 
     // get select field ids
     // get select field option1
     $this->click("xpath=//div[@id='field_page']//table/tbody/tr[1]/td[7]/span[1]/a[1]");
     $this->waitForPageToLoad($this->getTimeoutMsec());
-    $matches = array();
-    preg_match('/oid=([0-9]+)/', $this->getLocation(), $matches);
-    $selectFieldOp1 = $matches[1];
+    $selectFieldOp1 = $this->urlArg('oid');
 
     $this->open($selectFieldLoc);
     $this->waitForPageToLoad($this->getTimeoutMsec());
@@ -538,9 +514,7 @@ class WebTest_Event_PricesetMaxCountTest extends CiviSeleniumTestCase {
     // get select field option2
     $this->click("xpath=//div[@id='field_page']//table/tbody/tr[2]/td[7]/span[1]/a[1]");
     $this->waitForPageToLoad($this->getTimeoutMsec());
-    $matches = array();
-    preg_match('/oid=([0-9]+)/', $this->getLocation(), $matches);
-    $selectFieldOp2 = $matches[1];
+    $selectFieldOp2 = $this->urlArg('oid');
 
     // create event.
     $eventTitle = 'Meeting - ' . substr(sha1(rand()), 0, 7);
@@ -799,9 +773,7 @@ class WebTest_Event_PricesetMaxCountTest extends CiviSeleniumTestCase {
     // get text field Id.
     $this->click("xpath=//div[@id='field_page']//table/tbody/tr[1]/td[9]/span[1]/a[2]");
     $this->waitForPageToLoad($this->getTimeoutMsec());
-    $matches = array();
-    preg_match('/fid=([0-9]+)/', $this->getLocation(), $matches);
-    $textFieldId = $matches[1];
+    $textFieldId = $this->urlArg('fid');
 
     $this->open($pricesetLoc);
     $this->waitForPageToLoad($this->getTimeoutMsec());
@@ -810,17 +782,13 @@ class WebTest_Event_PricesetMaxCountTest extends CiviSeleniumTestCase {
     $this->click("xpath=//div[@id='field_page']//table/tbody/tr[2]/td[8]/a");
     $this->waitForPageToLoad($this->getTimeoutMsec());
     $selectFieldLoc = $this->getLocation();
-    $matches = array();
-    preg_match('/fid=([0-9]+)/', $this->getLocation(), $matches);
-    $selectFieldId = $matches[1];
+    $selectFieldId = $this->urlArg('fid');
 
     // get select field ids
     // get select field option1
     $this->click("xpath=//div[@id='field_page']//table/tbody/tr[1]/td[7]/span[1]/a[1]");
     $this->waitForPageToLoad($this->getTimeoutMsec());
-    $matches = array();
-    preg_match('/oid=([0-9]+)/', $this->getLocation(), $matches);
-    $selectFieldOp1 = $matches[1];
+    $selectFieldOp1 = $this->urlArg('oid');
 
     $this->open($selectFieldLoc);
     $this->waitForPageToLoad($this->getTimeoutMsec());
@@ -828,9 +796,7 @@ class WebTest_Event_PricesetMaxCountTest extends CiviSeleniumTestCase {
     // get select field option2
     $this->click("xpath=//div[@id='field_page']//table/tbody/tr[2]/td[7]/span[1]/a[1]");
     $this->waitForPageToLoad($this->getTimeoutMsec());
-    $matches = array();
-    preg_match('/oid=([0-9]+)/', $this->getLocation(), $matches);
-    $selectFieldOp2 = $matches[1];
+    $selectFieldOp2 = $this->urlArg('oid');
 
     // create event.
     $eventTitle = 'Meeting - ' . substr(sha1(rand()), 0, 7);
index d323a3d94ae09069bf2d3414c1d7449f05b12700..565f4197c47543dee58718b24c0c02c4f8b57f1e 100644 (file)
@@ -79,8 +79,7 @@ class WebTest_Financial_FinancialBatchExport extends CiviSeleniumTestCase {
     $this->waitForPageToLoad($this->getTimeoutMsec());\r
 \r
     // parse URL to grab the batch ID\r
-    $elements = $this->parseURL();\r
-    $batchId = $elements['queryString']['bid'];\r
+    $batchId = $this->urlArg('bid');\r
     return $batchId;\r
   }\r
 \r
index 333504cc478654c639c2026f44f694d08c33cd73..8ac0c9e7e038b1499a744ce0eaa20551d9298511 100644 (file)
@@ -51,14 +51,12 @@ class WebTest_Import_ActivityTest extends ImportCiviSeleniumTestCase {
     $firstName1 = substr(sha1(rand()), 0, 7);
     $email1 = 'mail_' . substr(sha1(rand()), 0, 7) . '@example.com';
     $this->webtestAddContact($firstName1, 'Anderson', $email1);
-    $url = explode('&cid=', $this->getLocation());
-    $id1 = $url[1];
+    $id1 = $this->urlArg('cid');
 
     $firstName2 = substr(sha1(rand()), 0, 7);
     $email2 = 'mail_' . substr(sha1(rand()), 0, 7) . '@example.com';
     $this->webtestAddContact($firstName2, 'Anderson', $email2);
-    $url = explode('&cid=', $this->getLocation());
-    $id2 = $url[1];
+    $id2 = $this->urlArg('cid');
 
     $headers = array(
       'target_contact_id' => 'Contact ID',
index 92d089649f2968b78657247f2db8a6b60012e684..645c2566de5e63fabfb48ab7c547a75b6302681a 100644 (file)
@@ -119,8 +119,7 @@ class WebTest_Import_AddressImportTest extends ImportCiviSeleniumTestCase {
 
     //Is custom group created?
     $this->waitForText('crm-notification-container', "Your custom field set '{$customGroupTitle}' has been added. You can add custom fields now.");
-    $url = explode('gid=', $this->getLocation());
-    $gid = $url[1];
+    $gid = $this->urlArg('gid');
 
     // create custom field "alphanumeric text"
     $customField = 'Custom field ' . substr(sha1(rand()), 0, 4);
index bfc8380b02453861504659264e792c38552c7b9c..6aa005e69ee99da4e5a7614f1dba9bd96813c6bb 100644 (file)
@@ -147,9 +147,8 @@ class WebTest_Import_ContactCustomDataTest extends ImportCiviSeleniumTestCase {
     $this->waitForElementPresent('_qf_Field_cancel-bottom');
 
     //Is custom group created?
-    $this->assertTrue($this->isTextPresent("Your custom field set '{$customGroupTitle}' has been added. You can add custom fields now."));
-    $url = explode('gid=', $this->getLocation());
-    $gid = $url[1];
+    $this->waitForText('crm-notification-container', $customGroupTitle);
+    $gid = $this->urlArg('gid');
 
     // create another custom field - Date
     $customField = 'Custom field ' . substr(sha1(rand()), 0, 4);
index 3c9e0dcec277ca91508fb8439fdabb4e60d0bd90..002c343edcde7b864c367d3c15262a57a339c1d1 100644 (file)
@@ -41,16 +41,12 @@ class WebTest_Import_CustomDataTest extends ImportCiviSeleniumTestCase {
     $firstName3 = 'Ma' . substr(sha1(rand()), 0, 4);
     $this->webtestAddContact($firstName3, "Anderson", TRUE);
     $sortName3 = "$firstName3 Anderson";
-    $this->waitForPageToLoad($this->getTimeoutMsec());
-    $url1 = explode('&cid=', $this->getLocation());
-    $id1 = $url1[1];
+    $id1 = $this->urlArg('cid');
 
     $firstName4 = 'Ma' . substr(sha1(rand()), 0, 4);
     $this->webtestAddContact($firstName4, "Anderson", TRUE);
     $sortName4 = "$firstName4 Anderson";
-    $this->waitForPageToLoad($this->getTimeoutMsec());
-    $url2 = explode('&cid=', $this->getLocation());
-    $id2 = $url2[1];
+    $id2 = $this->urlArg('cid');
 
     // Get sample import data.
     list($headers, $rows, $customDataVerify) = $this->_individualCustomCSVData($customGroupTitle, $firstName1, $firstName2,
index db33d6073f506750711cc73da9b4e07699cd2391..9bb20e0e28b6aec683ba2d3846bed99d807d5439 100644 (file)
@@ -553,13 +553,10 @@ class ImportCiviSeleniumTestCase extends CiviSeleniumTestCase {
       $this->waitForElementPresent("css=div.ac_results-inner li");
 
       // Visit contact summary page.
-      $this->click("css=div.ac_results-inner li");
-      $this->waitForPageToLoad($this->getTimeoutMsec());
+      $this->clickLink("css=div.ac_results-inner li");
 
       // Get contact id from url.
-      $matches = array();
-      preg_match('/cid=([0-9]+)/', $this->getLocation(), $matches);
-      $contactIds[] = $matches[1];
+      $contactIds[] = $this->urlArg('cid');
     }
 
     return $contactIds;
index 3f0d105f4e49a18e246b50cd6cb7604c6fcdab94..e5e07e39ef95cef0e0b584e8ddff43f54011413d 100644 (file)
@@ -343,13 +343,9 @@ class WebTest_Import_MatchExternalIdTest extends ImportCiviSeleniumTestCase {
     $this->type("xpath=//div[@class='crm-block crm-form-block crm-event-searchevent-form-block']/table/tbody/tr/td/input",$params['title']);
     $this->click("_qf_SearchEvent_refresh");
     $this->waitForPageToLoad($this->getTimeoutMsec());
-    $this->click("link=" . $params['title']);
+    $this->clickLink("link=" . $params['title']);
 
-    $this->waitForPageToLoad($this->getTimeoutMsec());
-
-    $matches = array();
-    preg_match('/id=([0-9]+)/', $this->getLocation(), $matches);
-    $params['event_id'] = $matches[1];
+    $params['event_id'] = $this->urlArg('id');
 
     return $params;
   }
index de21912baeafec018a0942aac530e69461817b27..47f31c22d170ca624e5530c99fb44566d25bd87f 100644 (file)
@@ -321,13 +321,9 @@ class WebTest_Import_ParticipantTest extends ImportCiviSeleniumTestCase {
     // verify event input on info page
     // start at Manage Events listing
     $this->openCiviPage('event/manage', 'reset=1');
-    $this->click("link=" . $params['title']);
+    $this->clickLink("link=" . $params['title']);
 
-    $this->waitForPageToLoad($this->getTimeoutMsec());
-
-    $matches = array();
-    preg_match('/id=([0-9]+)/', $this->getLocation(), $matches);
-    $params['event_id'] = $matches[1];
+    $params['event_id'] = $this->urlArg('id');;
 
     return $params;
   }
index 8e15984fc7723c8cb7303e55cd0613584843aaad..daea8e9c703ad3c735b180765dc1868d755d2e6e 100644 (file)
@@ -65,9 +65,7 @@ class WebTest_Mailing_MailingTest extends CiviSeleniumTestCase {
     $this->webtestAddContact($firstName, "Mailson", "mailino$firstName@mailson.co.in");
 
     // Get contact id from url.
-    $matches = array();
-    preg_match('/cid=([0-9]+)/', $this->getLocation(), $matches);
-    $contactId = $matches[1];
+    $contactId = $this->urlArg('cid');
 
     // go to group tab and add to mailing group
     $this->click("css=li#tab_group a");
@@ -330,9 +328,7 @@ class WebTest_Mailing_MailingTest extends CiviSeleniumTestCase {
     $this->webtestAddContact($firstName, "Mailson", "mailino$firstName@mailson.co.in");
 
     // Get contact id from url.
-    $matches = array();
-    preg_match('/cid=([0-9]+)/', $this->getLocation(), $matches);
-    $contactId = $matches[1];
+    $contactId = $this->urlArg('cid');
 
     // go to group tab and add to mailing group
     $this->click("css=li#tab_group a");
index cdec9a33f08d4fb735f17f202568b64a45bf05a7..a84bb422e3d1fe53a175df7b4d59408071ff7783 100644 (file)
@@ -47,9 +47,7 @@ class WebTest_Mailing_SpoolTest extends CiviSeleniumTestCase {
     $email = $this->webtestAddContact($fname, $lname, TRUE);
 
     // Get the contact id of the newly added contact
-    $urlElements = $this->parseURL();
-    $cid = $urlElements['queryString']['cid'];
-    $this->assertNotEmpty($cid, 'Could not find cid after adding contact');
+    $cid = $this->urlArg('cid');
 
     // Send an email to the added contact
     $this->openCiviPage("activity/email/add", "action=add&reset=1&cid={$cid}&selectedChild=activity&atype=3");
index 8f0fd40fadf03e583d79f6a895da3219f74b2724..bbc65ad9387bc007a7ff7cd5264135bc9293bf15 100755 (executable)
@@ -44,8 +44,7 @@ class WebTest_Member_DefaultMembershipPricesetTest extends CiviSeleniumTestCase
 
     // Get the price set id ($sid) by retrieving and parsing the URL of the New Price Field form
     // which is where we are after adding Price Set.
-    $elements = $this->parseURL();
-    $sid = $elements['queryString']['sid'];
+    $sid = $this->urlArg('sid');
     $this->assertType('numeric', $sid);
 
     $fields = array("National Membership $title" => 'Radio');
index 91f7cb39a26651920b674cd033a47c7c8c4e9095..eb04eda5953de4cf2936a1f5052bae97e2827a74 100644 (file)
@@ -187,9 +187,7 @@ class WebTest_Member_InheritedMembershipTest extends CiviSeleniumTestCase {
     $this->click("//li[@id='tab_rel']/a");
     $this->waitForElementPresent("xpath=//div[@id='current-relationships']//div//table/tbody//tr/td[9]/span/a[text()='Edit']");
     $this->click("xpath=//div[@id='current-relationships']//div//table/tbody//tr/td[9]/span/a[text()='Edit']");
-    $matches = array();
-    preg_match('/cid=([0-9]+)/', $this->getLocation(), $matches);
-    $id = $matches[1];
+    $id = $this->urlArg('cid');
 
     $this->waitForElementPresent('is_active');
     //disable relationship
index 7227dc2afbb5b7f2e3761a5ccd688d542a0dcf53..e72a555ae7e7a77b59cd13cce371b51810d4f153 100644 (file)
@@ -62,6 +62,7 @@ class WebTest_Member_OfflineAutoRenewMembershipTest extends CiviSeleniumTestCase
     $url = $this->getLocation();
     $url = str_replace('mode=live', 'mode=test', $url);
     $this->open($url);
+    $this->waitForPageToLoad($this->getTimeoutMsec());
 
     // start filling membership form
     $this->waitForElementPresent('payment_processor_id');
index 4a28ad2c5b1bf3829708ea656833e18cdc0bc8b1..ed939348ab49064e81e45cdc7e055a15f1644730 100644 (file)
@@ -44,8 +44,7 @@ class WebTest_Member_OfflineMembershipAddPricesetTest extends CiviSeleniumTestCa
 
     // Get the price set id ($sid) by retrieving and parsing the URL of the New Price Field form
     // which is where we are after adding Price Set.
-    $elements = $this->parseURL();
-    $sid = $elements['queryString']['sid'];
+    $sid = $this->urlArg('sid');
     $this->assertType('numeric', $sid);
 
     $fields = array(
@@ -94,8 +93,7 @@ class WebTest_Member_OfflineMembershipAddPricesetTest extends CiviSeleniumTestCa
 
     // Get the price set id ($sid) by retrieving and parsing the URL of the New Price Field form
     // which is where we are after adding Price Set.
-    $elements = $this->parseURL();
-    $sid = $elements['queryString']['sid'];
+    $sid = $this->urlArg('sid');
     $this->assertType('numeric', $sid);
 
     $fields = array("National Membership $title", "Radio");
index 675c5e54360a830acfe44374abbdcdac5baa6979..02176df8903a7b44495d8cfccb9602c4d9d9b129 100644 (file)
@@ -48,8 +48,7 @@ class WebTest_Member_OnlineMembershipAddPricesetTest extends CiviSeleniumTestCas
 
     // Get the price set id ($sid) by retrieving and parsing the URL of the New Price Field form
     // which is where we are after adding Price Set.
-    $elements = $this->parseURL();
-    $sid = $elements['queryString']['sid'];
+    $sid = $this->urlArg('sid');
     $this->assertType('numeric', $sid);
 
     $fields = array(
@@ -106,8 +105,7 @@ class WebTest_Member_OnlineMembershipAddPricesetTest extends CiviSeleniumTestCas
 
     // Get the price set id ($sid) by retrieving and parsing the URL of the New Price Field form
     // which is where we are after adding Price Set.
-    $elements = $this->parseURL();
-    $sid = $elements['queryString']['sid'];
+    $sid = $this->urlArg('sid');
     $this->assertType('numeric', $sid);
 
     $fields = array("National Membership $title", "Radio");
index 4f42e7614411c78bc9434b18753d2557819c3936..22f417dad65da51dd57629990956de20cba96354 100644 (file)
@@ -301,9 +301,7 @@ class WebTest_Member_OnlineMembershipRenewTest extends CiviSeleniumTestCase {
     $this->click('css=#memberSearch table tbody tr td span a.action-item-first');
     $this->waitForElementPresent("_qf_MembershipView_cancel-bottom");
 
-    $matches = array();
-    preg_match('/id=([0-9]+)/', $this->getLocation(), $matches);
-    $membershipCreatedId = $matches[1];
+    $membershipCreatedId = $this->urlArg('id');
 
     $memberSince = date('F jS, Y');
 
@@ -341,9 +339,7 @@ class WebTest_Member_OnlineMembershipRenewTest extends CiviSeleniumTestCase {
     $this->click('css=#memberSearch table tbody tr td span a.action-item-first');
     $this->waitForElementPresent("_qf_MembershipView_cancel-bottom");
 
-    $matches = array();
-    preg_match('/id=([0-9]+)/', $this->getLocation(), $matches);
-    $membershipRenewedId = $matches[1];
+    $membershipRenewedId = $this->urlArg('id');
 
     //View Membership Record
     $verifyMembershipData = array(
index 3960a2d76f4833b42bdce678b0e46f2378bd6114..32c963fcbe9ad754ea2d2e91e0442b9815e5bdb4 100644 (file)
@@ -42,8 +42,7 @@ class WebTest_Member_SeperateMembershipPaymentTest extends CiviSeleniumTestCase
     $lastName1 = 'An_' . substr(sha1(rand()), 0, 7);
     $this->webtestAddContact($firstName1, $lastName1, TRUE);
     $this->waitForText('crm-notification-container', "$firstName1 $lastName1 has been created.");
-    $url = explode('&cid=', $this->getLocation());
-    $cid = $url[1];
+    $cid = $this->urlArg('cid');
 
     // create contribution page with randomized title and default params
     $amountSection = TRUE;
index 0f9cc890990d222899fbd25df37cbcf859d447c0..a28b65c2366208a8b50a2c7d6991568b6f45acd3 100644 (file)
@@ -181,8 +181,7 @@ class WebTest_Profile_MultiRecordProfileAddTest extends CiviSeleniumTestCase {
     $this->click('link=Use (create mode)');
     $recordNew = $this->_addRecords('Create');
     $this->waitForPageToLoad($this->getTimeoutMsec());
-    $elements = $this->parseURL( );
-
+    $elements = $this->parseURL();
     $gid = $elements['queryString']['gid'];
     $id = $elements['queryString']['id'];
 
index e22c19317399c508536d86ddcfff94d80ef36778..3d8d355da7915ef5e1c951f6b5fe8c1460127488 100644 (file)
@@ -53,8 +53,7 @@ class WebTest_Profile_SearchTest extends CiviSeleniumTestCase {
     $this->waitForText('crm-notification-container', "Your CiviCRM Profile '{$profileTitle}' has been added. You can add fields to this profile now.");
 
     // Get profile id (gid) from URL
-    $elements = $this->parseURL();
-    $profileId = $elements['queryString']['gid'];
+    $profileId = $this->urlArg('gid');
 
     // Add Last Name field.
     $this->click('field_name[0]');
index 7cf44a57d064269beb1684188a69fff79d0017d8..1dabdea1c887b8efd4cbb9a82ad5c7c5bae8e065 100644 (file)
@@ -48,7 +48,7 @@ class WebTest_Report_LoggingReportTest extends CiviSeleniumTestCase {
     $lastName  = 'Anderson' . substr(sha1(rand()), 0, 7);
 
     $this->webtestAddContact($firstName, $lastName);
-    $cid = explode('&cid=', $this->getLocation());
+    $cid = $this->urlArg('cid');
 
     //add contact to group
     $this->waitForElementPresent("xpath=//li[@id='tab_group']/a");