<?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_Member_SeperateMembershipPaymentTest
+ */
class WebTest_Member_SeperateMembershipPaymentTest extends CiviSeleniumTestCase {
protected function setUp() {
// a random 7-char string and an even number to make this pass unique
$hash = substr(sha1(rand()), 0, 7);
$rand = 2 * rand(2, 50);
- // 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();
$firstName1 = 'Ma_' . substr(sha1(rand()), 0, 7);
$lastName1 = 'An_' . substr(sha1(rand()), 0, 7);
$this->webtestAddContact($firstName1, $lastName1, TRUE);
- $this->assertElementContainsText('crm-notification-container', "$firstName1 $lastName1 has been created.");
- $url = explode('&cid=', $this->getLocation());
- $cid = $url[1];
+ $this->waitForText('crm-notification-container', "$firstName1 $lastName1 has been created.");
+ $cid = $this->urlArg('cid');
// create contribution page with randomized title and default params
$amountSection = TRUE;
FALSE
);
-
// create new membership types
$memTypeParams1 = $this->webtestAddMembershipType();
$memTypeTitle1 = $memTypeParams1['membership_type'];
- $memTypeId1 = explode('&id=', $this->getAttribute("xpath=//div[@id='membership_type']/div[2]/table/tbody//tr/td[text()='{$memTypeTitle1}']/../td[12]/span/a[3]@href"));
+ $memTypeId1 = explode('&id=', $this->getAttribute("xpath=//div[@id='membership_type']/div[1]/table/tbody//tr/td[text()='{$memTypeTitle1}']/../td[12]/span/a[3]@href"));
$memTypeId1 = $memTypeId1[1];
$memTypeParams2 = $this->webtestAddMembershipType();
$memTypeTitle2 = $memTypeParams2['membership_type'];
- $memTypeId2 = explode('&id=', $this->getAttribute("xpath=//div[@id='membership_type']/div[2]/table/tbody//tr/td[text()='{$memTypeTitle2}']/../td[12]/span/a[3]@href"));
+ $memTypeId2 = explode('&id=', $this->getAttribute("xpath=//div[@id='membership_type']/div[1]/table/tbody//tr/td[text()='{$memTypeTitle2}']/../td[12]/span/a[3]@href"));
$memTypeId2 = $memTypeId2[1];
// edit contribution page memberships tab to add two new membership types
$this->openCiviPage('admin/contribute/membership', "reset=1&action=update&id={$pageId}", "_qf_MembershipBlock_next-bottom");
$this->click("membership_type_$memTypeId1");
$this->click("membership_type_$memTypeId2");
- $this->click('_qf_MembershipBlock_next');
- $this->waitForPageToLoad($this->getTimeoutMsec());
- $this->waitForElementPresent('_qf_MembershipBlock_next-bottom');
+ $this->clickLink('_qf_MembershipBlock_next', '_qf_MembershipBlock_next-bottom');
$text = "'MembershipBlock' information has been saved.";
- $this->assertElementContainsText('crm-notification-container', $text, 'Missing text: ' . $text);
+ $this->waitForText('crm-notification-container', $text);
$this->_testOnlineMembershipSignup($pageId, $memTypeTitle1, $cid);
//Find Member
$this->openCiviPage('member/search', 'reset=1', 'member_end_date_high');
$this->type("sort_name", "$firstName1 $lastName1");
- $this->click("_qf_Search_refresh");
- $this->waitForPageToLoad($this->getTimeoutMsec());
- $this->waitForElementPresent("xpath=//div[@id='memberSearch']/table/tbody/tr");
+ $this->clickLink("_qf_Search_refresh", "xpath=//div[@id='memberSearch']/table/tbody/tr");
$this->click("xpath=//div[@id='memberSearch']/table/tbody/tr/td[11]/span/a[text()='View']");
$this->waitForElementPresent("_qf_MembershipView_cancel-bottom");
$this->webtestVerifyTabularData($verifyData);
// Click View action link on associated contribution record
- $this->waitForElementPresent("xpath=//form[@id='MembershipView']/div[2]/div/table[@class='selector']/tbody/tr[1]/td[8]/span/a[text()='View']");
- $this->click("xpath=//form[@id='MembershipView']/div[2]/div/table[@class='selector']/tbody/tr[1]/td[8]/span/a[text()='View']");
+ $this->waitForElementPresent("xpath=//form[@id='MembershipView']/div[2]/div/table[@class='selector row-highlight']/tbody/tr[1]/td[8]/span/a[text()='View']");
+ $this->click("xpath=//form[@id='MembershipView']/div[2]/div/table[@class='selector row-highlight']/tbody/tr[1]/td[8]/span/a[text()='View']");
$this->waitForElementPresent("_qf_ContributionView_cancel-bottom");
//View Contribution Record
$this->webtestVerifyTabularData($verifyData);
$this->click("_qf_ContributionView_cancel-bottom");
- $this->waitForPageToLoad($this->getTimeoutMsec());
+ $this->waitForElementPresent("xpath=//form[@id='MembershipView']/div[2]/div/table[@class='selector row-highlight']/tbody/tr[1]/td[8]/span/a[text()='View']");
}
+ /**
+ * @param $pageId
+ * @param $memTypeId
+ * @param null $cid
+ */
function _testOnlineMembershipSignup($pageId, $memTypeId, $cid = NULL) {
//Open Live Contribution Page
+ $args = array('reset' => 1, 'id' => $pageId);
if ($cid) {
- $contribUrl = array('url' => "contribute/transact", 'args' => "reset=1&id=$pageId&cid=$cid");
- }
- else {
- $contribUrl = array('url' => "contribute/transact", 'args' => "reset=1&id=$pageId");
+ $args['cid'] = $cid;
}
- $this->openCiviPage($contribUrl['url'], $contribUrl['args'], '_qf_Main_upload-bottom');
+ $this->openCiviPage("contribute/transact", $args, '_qf_Main_upload-bottom');
// Select membership type 1
$this->click("xpath=//div[@class='crm-section membership_amount-section']/div[2]//span/label/span[2][contains(text(),'$memTypeId')]");
$this->type("xpath=//div[@class='crm-section other_amount-section']//div[2]/input", 60);
- $this->click("_qf_Main_upload-bottom");
- $this->waitForElementPresent("_qf_Confirm_next-bottom");
- $this->click("_qf_Confirm_next-bottom");
- $this->waitForPageToLoad($this->getTimeoutMsec());
+ $this->clickLink("_qf_Main_upload-bottom", "_qf_Confirm_next-bottom");
+ $this->clickLink("_qf_Confirm_next-bottom", NULL);
}
-}
\ No newline at end of file
+}