*/
require_once 'CiviTest/CiviSeleniumTestCase.php';
+
+/**
+ * Class WebTest_Member_OnlineMembershipAddPricesetTest
+ */
class WebTest_Member_OnlineMembershipAddPricesetTest extends CiviSeleniumTestCase {
protected function setUp() {
$this->_testVerifyPriceSet($validateStrings, $sid);
$contributionPageTitle = "Contribution Page $title";
- $paymentProcessor = "Webtest Dummy $title";
- $pageId = $this->webtestAddContributionPage(NULL, NULL, $contributionPageTitle, array($paymentProcessor => 'Dummy'),
+ $pageId = $this->webtestAddContributionPage(NULL, NULL, $contributionPageTitle, array('Test Processor' => 'Dummy'),
TRUE, FALSE, FALSE, FALSE, FALSE, TRUE, $sid, FALSE, 1, NULL
);
$setHelp = 'Select your membership options.';
$memTypeParams1 = $this->webtestAddMembershipType();
$memTypeTitle1 = $memTypeParams1['membership_type'];
- $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 = explode('&id=', $this->getAttribute("xpath=//div[@id='membership_type']/table/tbody//tr/td[1][text()='{$memTypeTitle1}']/../td[12]/span/a[3]@href"));
$memTypeId1 = $memTypeId1[1];
$this->_testAddSet($setTitle, $usedFor, $contributionType, $setHelp);
$i = 2;
foreach($options as $index => $values){
$this->select("membership_type_id_{$index}", "value={$values['membership_type_id']}");
- // Because it tends to cause problems, all uses of sleep() must be justified in comments
- // Sleep should never be used for wait for anything to load from the server
- // Justification for this instance: FIXME
- sleep(1);
+
+ $this->waitForElementPresent("xpath=//table[@id='optionField']/tbody/tr[$i]/td[4]/input");
$this->type("xpath=//table[@id='optionField']/tbody/tr[$i]/td[4]/input",$values['membership_num_terms']);
$this->type("xpath=//table[@id='optionField']/tbody/tr[$i]/td[5]/input",$values['label']);
$this->type("xpath=//table[@id='optionField']/tbody/tr[$i]/td[6]/input",$values['amount']);
if($i > 3){
$this->click('link=another choice');
-
}
$i++;
}
$this->waitForElementPresent( 'financial_type_id' );
$this->select("financial_type_id", "label={$contributionType}");
$this->waitForElementPresent('_qf_Field_next-bottom');
- $this->click('_qf_Field_next-bottom');
- $this->waitForPageToLoad($this->getTimeoutMsec());
+ $this->clickLink('_qf_Field_next-bottom');
$this->waitForText('crm-notification-container', "Price Field '{$fields[0]}' has been saved.");
// load the Price Set Preview and check for expected values
$this->_testVerifyPriceSet($validateStrings, $sid);
$contributionPageTitle = "Contribution Page $title";
- $paymentProcessor = "Webtest Dummy $title";
- $pageId = $this->webtestAddContributionPage(NULL, NULL, $contributionPageTitle, array($paymentProcessor => 'Dummy'),
+ $pageId = $this->webtestAddContributionPage(NULL, NULL, $contributionPageTitle, array('Test Processor' => 'Dummy'),
TRUE, FALSE, FALSE, FALSE, FALSE, TRUE, $sid, FALSE, 1, NULL
);
}
+ /**
+ * @param $setTitle
+ * @param $usedFor
+ * @param null $contributionType
+ * @param $setHelp
+ */
function _testAddSet($setTitle, $usedFor, $contributionType = NULL, $setHelp) {
$this->openCiviPage('admin/price', 'reset=1&action=add', '_qf_Set_next-bottom');
$this->type('help_pre', $setHelp);
$this->assertChecked('is_active', 'Verify that Is Active checkbox is set.');
- $this->clickLink('_qf_Set_next-bottom', '_qf_Field_next-bottom');
+ $this->waitForElementPresent('_qf_Set_next-bottom');
+ $this->click('_qf_Set_next-bottom');
$this->waitForText('crm-notification-container', "Your Set '{$setTitle}' has been added. You can add fields to this set now.");
}
+ /**
+ * @param $fields
+ * @param $validateString
+ * @param bool $dateSpecificFields
+ * @param $title
+ * @param int $sid
+ * @param $contributionType
+ *
+ * @return array
+ */
function _testAddPriceFields(&$fields, &$validateString, $dateSpecificFields = FALSE, $title, $sid, $contributionType) {
$memTypeParams1 = $this->webtestAddMembershipType();
$memTypeTitle1 = $memTypeParams1['membership_type'];
- $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 = explode('&id=', $this->getAttribute("xpath=//div[@id='membership_type']/table/tbody//tr/td[1][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[1]/table/tbody//tr/td[text()='{$memTypeTitle2}']/../td[12]/span/a[3]@href"));
+ $memTypeId2 = explode('&id=', $this->getAttribute("xpath=//div[@id='membership_type']/table/tbody//tr/td[1][text()='{$memTypeTitle2}']/../td[12]/span/a[3]@href"));
$memTypeId2 = $memTypeId2[1];
$this->openCiviPage('admin/price/field', "reset=1&action=add&sid={$sid}");
return array($memTypeTitle1, $memTypeTitle2);
}
+ /**
+ * @param $validateStrings
+ * @param int $sid
+ */
function _testVerifyPriceSet($validateStrings, $sid) {
// verify Price Set at Preview page
// start at Manage Price Sets listing
$this->assertStringsPresent($validateStrings);
}
+ /**
+ * @param int $pageId
+ * @param array $contactParams
+ * @param $memTypeTitle1
+ * @param $memTypeTitle2
+ * @param bool $renew
+ */
function _testSignUpOrRenewMembership($pageId, $contactParams, $memTypeTitle1, $memTypeTitle2, $renew = FALSE) {
$this->webtestLogout();
}
}
+ /**
+ * @param int $pageId
+ * @param array $contactParams
+ * @param $memTypeTitle1
+ * @param $term
+ * @param bool $renew
+ */
function _testMultilpeTermsMembershipRegistration($pageId, $contactParams, $memTypeTitle1, $term, $renew = FALSE){
if($renew){
$this->openCiviPage('member/search', 'reset=1', 'member_end_date_high');
);
}
//check if the membership amount is correct
- $this->waitForElementPresent("xpath=//form[@id='MembershipView']/div[2]/div/table[2]/tbody/tr/td/span[text()='{$amount}']");
- $this->assertTrue($this->isElementPresent("xpath=//form[@id='MembershipView']/div[2]/div/table[2]/tbody/tr/td/span[text()='{$amount}']"));
+ $this->waitForElementPresent("xpath=//form[@id='MembershipView']/div[2]/div/div[2]/div[2]/table/tbody/tr/td[1]/span[text()='{$amount}']");
+ $this->assertTrue($this->isElementPresent("xpath=//form[@id='MembershipView']/div[2]/div/div[2]/div[2]/table/tbody/tr/td[1]/span[text()='{$amount}']"));
}
}