<?php
/*
+--------------------------------------------------------------------+
- | CiviCRM version 4.3 |
+ | CiviCRM version 4.5 |
+--------------------------------------------------------------------+
- | Copyright CiviCRM LLC (c) 2004-2013 |
+ | Copyright CiviCRM LLC (c) 2004-2014 |
+--------------------------------------------------------------------+
| This file is a part of CiviCRM. |
| |
+--------------------------------------------------------------------+
*/
-
require_once 'CiviTest/CiviSeleniumTestCase.php';
class WebTest_Contribute_OnBehalfOfOrganization extends CiviSeleniumTestCase {
protected $pageno = '';
//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);
$this->waitForElementPresent("_qf_Edit_next");
$this->type("first_name", $firstName);
$this->type("last_name", $lastName);
- $this->click("_qf_Edit_next");
- $this->waitForPageToLoad($this->getTimeoutMsec());
- $this->waitForElementPresent("profilewrap4");
+ $this->clickLink("_qf_Edit_next", "profilewrap4");
// Is status message correct?
$this->assertTextPresent("Thank you. Your information has been saved.", "Save successful status message didn't show up after saving profile to update testUserName!");
$this->waitForElementPresent('_qf_Membership_cancel-bottom');
$this->click('_qf_Membership_upload-bottom');
-
$this->waitForPageToLoad($this->getTimeoutMsec());
$this->click("css=li#tab_rel a");
$this->waitForElementPresent("_qf_Edit_next");
$this->type("first_name", $firstName);
$this->type("last_name", $lastName);
- $this->click("_qf_Edit_next");
- $this->waitForPageToLoad($this->getTimeoutMsec());
- $this->waitForElementPresent("profilewrap4");
+ $this->clickLink("_qf_Edit_next", "profilewrap4");
- $urlElements = $this->parseURL();
- print_r($urlElements);
- $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!");
-
//add org fields to profile
$this->openCiviPage("admin/uf/group", "reset=1");
$this->click("link=Reserved Profiles");
$this->click('_qf_Field_next-bottom');
$this->waitForPageToLoad($this->getTimeoutMsec());
-
//create organisation
$orgName = "Org WebAccess ". substr(sha1(rand()), 0, 7);
$orgEmail = "org". substr(sha1(rand()), 0, 7) . "@web.com";
$this->_testOrganization($pageId, $cid, $pageTitle);
}
-
+ /**
+ * @param $pageId
+ * @param $cid
+ * @param $pageTitle
+ */
function _testOrganization($pageId, $cid, $pageTitle) {
//Open Live Contribution Page
$this->openCiviPage("contribute/transact", "reset=1&id=$pageId", "_qf_Main_upload-bottom");
$this->select("onbehalf_state_province-3", "label=Alabama");
$this->waitForElementPresent("_qf_Main_upload-bottom");
- $this->click("_qf_Main_upload-bottom");
-
- $this->waitForPageToLoad($this->getTimeoutMsec());
-
- $this->waitForElementPresent("_qf_Confirm_next-bottom");
+ $this->clickLink("_qf_Main_upload-bottom", "_qf_Confirm_next-bottom");
$this->click("_qf_Confirm_next-bottom");
$this->waitForPageToLoad($this->getTimeoutMsec());
}
+ /**
+ * @param $pageId
+ * @param $cid
+ * @param $pageTitle
+ */
function _testAnomoyousOganization($pageId, $cid, $pageTitle) {
//Open Live Contribution Page
$this->openCiviPage("contribute/transact", "reset=1&id=$pageId", "_qf_Main_upload-bottom");
$this->click("onbehalf_state_province-3");
$this->select("onbehalf_state_province-3", "label=Alabama");
-
// Credit Card Info
$this->select("credit_card_type", "value=Visa");
$this->type("credit_card_number", "4111111111111111");
$this->select("billing_country_id-5", "value=1228");
$this->select("billing_state_province_id-5", "value=1004");
$this->type("billing_postal_code-5", "94129");
- $this->click("_qf_Main_upload-bottom");
-
- $this->waitForPageToLoad($this->getTimeoutMsec());
- $this->waitForElementPresent("_qf_Confirm_next-bottom");
+ $this->clickLink("_qf_Main_upload-bottom", "_qf_Confirm_next-bottom");
$this->click("_qf_Confirm_next-bottom");
$this->waitForPageToLoad($this->getTimeoutMsec());
//Find Contribution
$this->openCiviPage("contribute/search", "reset=1");
$this->type("sort_name", $orgName);
- $this->click("_qf_Search_refresh");
-
- $this->waitForPageToLoad($this->getTimeoutMsec());
-
- $this->waitForElementPresent("xpath=//div[@id='contributionSearch']//table//tbody/tr[1]/td[11]/span/a[text()='View']");
- $this->click("xpath=//div[@id='contributionSearch']//table//tbody/tr[1]/td[11]/span/a[text()='View']");
- $this->waitForPageToLoad($this->getTimeoutMsec());
- $this->waitForElementPresent("_qf_ContributionView_cancel-bottom");
+ $this->clickLink("_qf_Search_refresh", "xpath=//div[@id='contributionSearch']//table//tbody/tr[1]/td[11]/span/a[text()='View']");
+ $this->clickLink("xpath=//div[@id='contributionSearch']//table//tbody/tr[1]/td[11]/span/a[text()='View']", "_qf_ContributionView_cancel-bottom");
// verify contrb created
$expected = array(
}
}
+ /**
+ * @param $pageId
+ * @param $cid
+ * @param $pageTitle
+ */
function _testUserWithOneRelationship($pageId, $cid, $pageTitle) {
$this->webtestLogin('admin');
$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");
$this->select("billing_state_province_id-5", "value=1004");
$this->type("billing_postal_code-5", "94129");
- $this->click("_qf_Main_upload-bottom");
- $this->waitForPageToLoad($this->getTimeoutMsec());
- $this->waitForElementPresent("_qf_Confirm_next-bottom");
+ $this->clickLink("_qf_Main_upload-bottom", "_qf_Confirm_next-bottom");
$this->click("_qf_Confirm_next-bottom");
$this->waitForPageToLoad($this->getTimeoutMsec());
//Find Contribution
$this->openCiviPage("contribute/search", "reset=1");
$this->type("sort_name", $orgName1);
- $this->click("_qf_Search_refresh");
- $this->waitForPageToLoad($this->getTimeoutMsec());
- $this->waitForElementPresent("xpath=//div[@id='contributionSearch']//table//tbody/tr[1]/td[11]/span/a[text()='View']");
- $this->click("xpath=//div[@id='contributionSearch']//table//tbody/tr[1]/td[11]/span/a[text()='View']");
- $this->waitForPageToLoad($this->getTimeoutMsec());
- $this->waitForElementPresent("_qf_ContributionView_cancel-bottom");
+ $this->clickLink("_qf_Search_refresh", "xpath=//div[@id='contributionSearch']//table//tbody/tr[1]/td[11]/span/a[text()='View']");
+ $this->clickLink("xpath=//div[@id='contributionSearch']//table//tbody/tr[1]/td[11]/span/a[text()='View']", "_qf_ContributionView_cancel-bottom");
// verify contrb created
$expected = array(
$this->verifyText("xpath=id( 'ContributionView' )/div[2]/table[1]/tbody/tr[$value]/td[2]", preg_quote($label));
}
-
$this->openCiviPage("admin/uf/group", "reset=1");
$this->click("link=Reserved Profiles");
$this->assertTrue($this->isTextPresent('Selected Profile Field has been deleted.'), "Status message didn't show up after saving!");
}
+ /**
+ * @param $pageId
+ * @param $cid
+ * @param $pageTitle
+ */
function _testUserWithMoreThanOneRelationship($pageId, $cid, $pageTitle) {
$this->webtestLogin('admin');
$this->waitForPageToLoad($this->getTimeoutMsec());
$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");
$this->select('field_name[0]', 'value=Membership');
$this->select('field_name[1]', 'label=Campaign');
$this->click('field_name[1]');
- $this->click('_qf_Field_next_new-bottom');
- $this->waitForPageToLoad($this->getTimeoutMsec());
- $this->waitForElementPresent('_qf_Field_cancel-bottom');
+ $this->clickLink('_qf_Field_next_new-bottom', '_qf_Field_cancel-bottom');
$this->select('field_name[0]', 'value=Membership');
$this->select('field_name[1]', "label=$fieldTitle :: $groupTitle");
$this->click("_qf_Contact_upload_view-bottom");
$this->waitForPageToLoad($this->getTimeoutMsec());
-
// create Membership type
$title1 = "Membership Type" . substr(sha1(rand()), 0, 7);
$this->openCiviPage("admin/member/membershipType", "reset=1&action=browse");
$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");
$this->waitForPageToLoad($this->getTimeoutMsec());
//Open Live Membership Page
- $this->open($this->sboxPath . "civicrm/contribute/transact?reset=1&id=" . $pageId . "&cid=" . $cid);
- $this->waitForElementPresent("_qf_Main_upload-bottom");
+ $this->openCiviPage('contribute/transact', "reset=1&id=$pageId&cid=$cid", "_qf_Main_upload-bottom");
$this->click('CIVICRM_QFID_amount_other_radio_4');
$this->type('amount_other', 60);
$this->click('onbehalf_organization_name');
$this->select("credit_card_exp_date[M]", "value=1");
$this->select("credit_card_exp_date[Y]", "value=2020");
- $this->click("_qf_Main_upload-bottom");
- $this->waitForPageToLoad($this->getTimeoutMsec());
- $this->waitForElementPresent("_qf_Confirm_next-bottom");
+ $this->clickLink("_qf_Main_upload-bottom", "_qf_Confirm_next-bottom");
$this->click("_qf_Confirm_next-bottom");
$this->waitForPageToLoad($this->getTimeoutMsec());
//Find Membership for organization
$this->openCiviPage("member/search", "reset=1");
$this->type("sort_name", $orgName1);
- $this->click("_qf_Search_refresh");
- $this->waitForPageToLoad($this->getTimeoutMsec());
- $this->waitForElementPresent("xpath=//div[@id='memberSearch']//table//tbody/tr[1]/td[11]/span/a[text()='View']");
- $this->click("xpath=//div[@id='memberSearch']//table//tbody/tr[1]/td[11]/span/a[text()='View']");
- $this->waitForPageToLoad($this->getTimeoutMsec());
- $this->waitForElementPresent("_qf_MembershipView_cancel-bottom");
+ $this->clickLink("_qf_Search_refresh", "xpath=//div[@id='memberSearch']//table//tbody/tr[1]/td[11]/span/a[text()='View']");
+ $this->clickLink("xpath=//div[@id='memberSearch']//table//tbody/tr[1]/td[11]/span/a[text()='View']", "_qf_MembershipView_cancel-bottom");
//verify contrb created
$expected = array(
);
}
-
function testOnBehalfOfOrganizationWithImage() {
$this->webtestLogin();
$this->waitForElementPresent("_qf_Edit_next");
$this->type("first_name", $firstName);
$this->type("last_name", $lastName);
- $this->click("_qf_Edit_next");
- $this->waitForPageToLoad($this->getTimeoutMsec());
- $this->waitForElementPresent("profilewrap4");
+ $this->clickLink("_qf_Edit_next", "profilewrap4");
- $urlElements = $this->parseURL();
- $cid = $urlElements['queryString']['id'];
+ $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!");
$this->waitForPageToLoad($this->getTimeoutMsec());
$this->click('_qf_Field_next-bottom');
$this->waitForPageToLoad($this->getTimeoutMsec());
- $this->assertElementContainsText('crm-notification-container', "Selected Profile Field has been deleted.");
+ $this->waitForText('crm-notification-container', "Selected Profile Field has been deleted.");
}
+ /**
+ * @param $pageId
+ * @param $cid
+ * @param $pageTitle
+ */
function _testOrganizationWithImageUpload($pageId, $cid, $pageTitle) {
//Open Live Contribution Page
- $this->openCiviPage("contribute/transact", "reset=1&id=$pageId");
+ $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);
$this->select("billing_country_id-5", "value=1228");
$this->select("billing_state_province_id-5", "value=1004");
$this->type("billing_postal_code-5", "94129");
- $this->click("_qf_Main_upload-bottom");
-
- $this->waitForPageToLoad($this->getTimeoutMsec());
- $this->waitForElementPresent("_qf_Confirm_next-bottom");
+ $this->clickLink("_qf_Main_upload-bottom", "_qf_Confirm_next-bottom");
$this->click("_qf_Confirm_next-bottom");
$this->waitForPageToLoad($this->getTimeoutMsec());