);
list($memTypeTitle1, $memTypeTitle2) = $this->_testAddPriceFields($fields, $validateStrings, FALSE, $title, $sid, $contributionType);
- //var_dump($validateStrings);
// load the Price Set Preview and check for expected values
$this->_testVerifyPriceSet($validateStrings, $sid);
// The rest of URL is defined in CiviSeleniumTestCase base class, in
// class attributes.
$this->open($this->sboxPath);
-
+
// Log in using webtestLogin() method
$this->webtestLogin();
-
+
$title = substr(sha1(rand()), 0, 7);
$setTitle = "Membership Fees - $title";
$usedFor = 'Membership';
$this->assertType('numeric', $sid);
$fields = array("National Membership $title", "Radio");
- $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}");
+
$validateStrings[] = $fields[0];
$this->type('label', $fields[0]);
$this->select('html_type', "value={$fields[1]}");
$options = array(
- 1 => array('label' => $memTypeTitle1."_1",
- 'membership_type_id' => $memTypeId1,
- 'amount' => 50.00,
- 'membership_num_terms' => 1,
- ),
- 2 => array(
- 'label' => $memTypeTitle1."_2",
- 'membership_type_id' => $memTypeId1,
- 'amount' => 90.00,
- 'membership_num_terms' => 2,
- ),
- 3 => array(
- 'label' => $memTypeTitle1."_3",
- 'membership_type_id' => $memTypeId1,
- 'amount' => 120.00,
- 'membership_num_terms' => 3,
- ),
-
- );
+ 1 => array('label' => $memTypeTitle1."_1",
+ 'membership_type_id' => $memTypeId1,
+ 'amount' => 50.00,
+ 'membership_num_terms' => 1,
+ ),
+ 2 => array(
+ 'label' => $memTypeTitle1."_2",
+ 'membership_type_id' => $memTypeId1,
+ 'amount' => 90.00,
+ 'membership_num_terms' => 2,
+ ),
+ 3 => array(
+ 'label' => $memTypeTitle1."_3",
+ 'membership_type_id' => $memTypeId1,
+ 'amount' => 120.00,
+ 'membership_num_terms' => 3,
+ ),
+ );
$i = 2;
foreach($options as $index => $values){
$this->select("membership_type_id_{$index}", "value={$values['membership_type_id']}");
$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');
+ $this->click('link=another choice');
}
$i++;
}
$this->click('_qf_Field_next-bottom');
$this->waitForPageToLoad($this->getTimeoutMsec());
$this->assertTrue($this->isTextPresent("Price Field '{$fields[0]}' has been saved."));
-
+
// load the Price Set Preview and check for expected values
$this->_testVerifyPriceSet($validateStrings, $sid);
$this->_testMultilpeTermsMembershipRegistration($sid, $contactParams, $memTypeTitle1, 3);
//membership with number of terms as 2
$this->_testMultilpeTermsMembershipRegistration($sid, $contactParams, $memTypeTitle1, 2);
-
+
}
function _testAddSet($setTitle, $usedFor, $contributionType = NULL, $setHelp) {
- $this->open($this->sboxPath . 'civicrm/admin/price?reset=1&action=add');
- $this->waitForPageToLoad($this->getTimeoutMsec());
- $this->waitForElementPresent('_qf_Set_next-bottom');
+ $this->openCiviPage('admin/price', 'reset=1&action=add', '_qf_Set_next-bottom');
// Enter Priceset fields (Title, Used For ...)
$this->type('title', $setTitle);
}
elseif ($usedFor == 'Membership') {
$this->click('extends_3');
- $this->waitForElementPresent( 'financial_type_id' );
+ $this->waitForElementPresent('financial_type_id');
$this->select("css=select.form-select", "label={$contributionType}");
}
-
$this->type('help_pre', $setHelp);
-
$this->assertChecked('is_active', 'Verify that Is Active checkbox is set.');
- $this->click('_qf_Set_next-bottom');
- $this->waitForPageToLoad($this->getTimeoutMsec());
+ $this->click('_qf_Set_next-bottom');
$this->waitForElementPresent('_qf_Field_next-bottom');
- $this->assertTrue($this->isTextPresent("Your Set '{$setTitle}' has been added. You can add fields to this set now."));
+ $this->assertElementContainsText('crm-notification-container', "Your Set '{$setTitle}' has been added. You can add fields to this set now.");
}
function _testAddPriceFields(&$fields, &$validateString, $dateSpecificFields = FALSE, $title, $sid, $contributionType) {
$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 = $memTypeId2[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;
case 'Radio':
$options = array(
1 => array('label' => "$memTypeTitle1",
- 'membership_type_id' => $memTypeId1,
- 'amount' => 100.00,
+ 'membership_type_id' => $memTypeId1,
+ 'amount' => 100.00,
),
2 => array(
'label' => "$memTypeTitle2",
case 'CheckBox':
$options = array(
1 => array('label' => "$memTypeTitle1",
- 'membership_type_id' => $memTypeId1,
- 'amount' => 100.00,
+ 'membership_type_id' => $memTypeId1,
+ 'amount' => 100.00,
),
2 => array(
'label' => "$memTypeTitle2",
$this->select("financial_type_id", "label={$contributionType}");
$this->click('_qf_Field_next_new-bottom');
$this->waitForPageToLoad($this->getTimeoutMsec());
- $this->waitForElementPresent('_qf_Field_next-bottom');
- $this->assertTrue($this->isTextPresent("Price Field '{$label}' has been saved."));
+ $this->assertElementContainsText('crm-notification-container', "Price Field '{$label}' has been saved.");
}
return array($memTypeTitle1, $memTypeTitle2);
}
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='Preview Price Set']");
- $this->waitForPageToLoad($this->getTimeoutMsec());
// Look for Register button
$this->waitForElementPresent('_qf_Preview_cancel-bottom');
$this->waitForElementPresent("xpath=//div[@id='memberships']//table/tbody/tr");
$this->click("xpath=//div[@id='memberships']//table/tbody//tr/td[text()='{$memTypeTitle1}']/../td[9]/span/a[text()='View']");
$this->waitForElementPresent("_qf_MembershipView_cancel-bottom");
+
//View Membership Record
$verifyData = array(
'Membership Type' => "{$memTypeTitle1}",
'Start date' => $startDate,
'End date' => $endDate,
);
- foreach ($verifyData as $label => $value) {
- $this->verifyText("xpath=//form[@id='MembershipView']//table/tbody/tr/td[text()='{$label}']/following-sibling::td",
- preg_quote($value)
- );
- }
+ $this->webtestVerifyTabularData($verifyData);
$this->click('_qf_MembershipView_cancel-bottom');
$this->waitForElementPresent("xpath=//div[@id='memberships']//table/tbody/tr");
'Start date' => $startDate,
'End date' => $endDate,
);
- foreach ($verifyData as $label => $value) {
- $this->verifyText("xpath=//form[@id='MembershipView']//table/tbody/tr/td[text()='{$label}']/following-sibling::td",
- preg_quote($value)
- );
- }
+ $this->webtestVerifyTabularData($verifyData);
+
$this->click("_qf_MembershipView_cancel-bottom");
$this->waitForElementPresent("xpath=//div[@id='memberships']//table/tbody/tr");
}
'joinDate', 'startDate', 'endDate') as $date) {
$$date = CRM_Utils_Date::customFormat($$date, $configVars->dateformatFull);
}
-
+
// Go directly to the URL of the screen that you will be testing (Activity Tab).
$this->click('css=li#tab_member a');
$this->waitForElementPresent('link=Add Membership');
-
+
$this->click('link=Add Membership');
$this->waitForElementPresent('_qf_Membership_cancel-bottom');
-
+
$this->select('price_set_id', "value={$sid}");
$this->waitForElementPresent('pricesetTotal');
-
+
$i = ($term == 3) ? 3 : (($term == 2) ? 2 : 1 );
$this->waitForElementPresent("xpath=//div[@id='priceset']/div[2]/div[2]/div[$i]/span/input");
$this->click("xpath=//div[@id='priceset']/div[2]/div[2]/div[$i]/span/input");
$amount = $this->getText("xpath=//div[@id='priceset']/div[2]/div[2]/div[$i]/span/label/span[@class='crm-price-amount-amount']");
-
+
$this->type('source', 'Offline membership Sign Up Test Text');
$this->click('_qf_Membership_upload-bottom');
-
+
$this->waitForElementPresent("xpath=//div[@id='memberships']//table/tbody/tr");
$this->click("xpath=//div[@id='memberships']//table/tbody//tr/td[text()='{$endDate}']/../td[9]/span/a[text()='View']");
$this->waitForElementPresent("_qf_MembershipView_cancel-bottom");
'Start date' => $startDate,
'End date' => $endDate,
);
- foreach ($verifyData as $label => $value) {
- $this->verifyText("xpath=//form[@id='MembershipView']//table/tbody/tr/td[text()='{$label}']/following-sibling::td",
- preg_quote($value)
- );
- }
+ $this->webtestVerifyTabularData($verifyData);
+
//check if the membership amount is correct
$this->assertTrue($this->isElementPresent("xpath=//form[@id='MembershipView']/div[2]/div/table[2]/tbody/tr/td/span[text()='{$amount}']"));
$this->click("_qf_MembershipView_cancel-bottom");
$this->waitForPageToLoad($this->getTimeoutMsec());
}
-}
-
+}
\ No newline at end of file