}
function testOnlineMembershipCreate() {
- //login with admin credentials & make sure we do have required permissions.
- $this->webtestLogin(TRUE);
-
//check for online contribution and profile listings permissions
$permissions = array("edit-1-make-online-contributions", "edit-1-profile-listings-and-forms");
$this->changePermissions($permissions);
- // now logout and login with admin credentials
- $this->openCiviPage("logout", "reset=1");
+ // Log in as normal user
+ $this->webtestLogin();
// 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);
- // Log in using webtestLogin() method
- $this->webtestLogin();
-
// We need a payment processor
$processorName = "Webtest Dummy" . substr(sha1(rand()), 0, 7);
// create contribution page with randomized title and default params
-
- $amountSection = TRUE;
- $payLater = TRUE;
+ $amountSection = TRUE;
+ $payLater = TRUE;
$allowOtherAmmount = FALSE;
- $onBehalf = FALSE;
- $pledges = FALSE;
- $recurring = FALSE;
- $memberships = TRUE;
- $memPriceSetId = NULL;
- $friend = TRUE;
- $profilePreId = 1;
- $profilePostId = NULL;
- $premiums = TRUE;
- $widget = FALSE;
- $pcp = TRUE;
+ $onBehalf = FALSE;
+ $pledges = FALSE;
+ $recurring = FALSE;
+ $memberships = TRUE;
+ $memPriceSetId = NULL;
+ $friend = TRUE;
+ $profilePreId = 1;
+ $profilePostId = NULL;
+ $premiums = TRUE;
+ $widget = FALSE;
+ $pcp = TRUE;
$isSeparatePayment = TRUE;
$contributionTitle = "Title $hash";
- $pageId = $this->webtestAddContributionPage($hash,
+ $pageId = $this->webtestAddContributionPage($hash,
$rand,
$contributionTitle,
array($processorName => 'Dummy'),
// create two 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 = $memTypeId1[1];
+ $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 = $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 = $memTypeId2[1];
+ $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 = $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->waitForPageToLoad($this->getTimeoutMsec());
$this->waitForElementPresent('_qf_MembershipBlock_next-bottom');
$text = "'MembershipBlock' information has been saved.";
- $this->assertTrue($this->isTextPresent($text), 'Missing text: ' . $text);
-
+ $this->assertElementContainsText('crm-notification-container', $text, 'Missing text: ' . $text);
+
//logout
- $this->openCiviPage("logout", "reset=1");
+ $this->webtestLogout();
// signup for membership 1
$firstName = 'Ma' . substr(sha1(rand()), 0, 4);
else {
$verifyData['Status'] = 'New';
}
- 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);
// 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']");
else {
$verifyData['Contribution Status'] = 'Completed';
}
- foreach ($verifyData as $label => $value) {
- $this->verifyText("xpath=//form[@id='ContributionView']//table/tbody/tr/td[text()='{$label}']/following-sibling::td",
- preg_quote($value)
- );
- }
+ $this->webtestVerifyTabularData($verifyData);
// CRM-8141 signup for membership 2 with same anonymous user info (should create 2 separate membership records because membership orgs are different)
//logout
- $this->openCiviPage("logout", "reset=1");
+ $this->webtestLogout();
$this->_testOnlineMembershipSignup($pageId, $memTypeTitle2, $firstName, $lastName, $payLater, $hash);
$this->click("_qf_Search_refresh");
$this->waitForPageToLoad($this->getTimeoutMsec());
- $this->assertTrue($this->isTextPresent('2 Results'), 'Missing text: ' . '2 Results');
+ $this->assertElementContainsText('search-status', '2 Results', 'Missing text: ' . '2 Results');
}
function _testOnlineMembershipSignup($pageId, $memTypeId, $firstName, $lastName, $payLater, $hash, $otherAmount = FALSE) {
$this->type("billing_postal_code-5", "94129");
}
$this->click("_qf_Main_upload-bottom");
-
- $this->waitForPageToLoad($this->getTimeoutMsec());
$this->waitForElementPresent("_qf_Confirm_next-bottom");
$this->click("_qf_Confirm_next-bottom");
function testOnlineMembershipCreateWithContribution() {
//login with admin credentials & make sure we do have required permissions.
- $this->webtestLogin(TRUE);
-
+ $permissions = array("edit-1-make-online-contributions", "edit-1-profile-listings-and-forms");
+ $this->changePermissions($permissions);
+
$hash = substr(sha1(rand()), 0, 7);
$rand = 2 * rand(2, 50);
// We need a payment processor
$processorName = "Webtest Dummy" . substr(sha1(rand()), 0, 7);
- $amountSection = TRUE;
- $payLater = TRUE;
+ $amountSection = TRUE;
+ $payLater = TRUE;
$allowOtherAmmount = TRUE;
- $onBehalf = FALSE;
- $pledges = FALSE;
- $recurring = FALSE;
- $memberships = TRUE;
- $memPriceSetId = NULL;
- $friend = FALSE;
- $profilePreId = 1;
- $profilePostId = NULL;
- $premiums = FALSE;
- $widget = FALSE;
- $pcp = FALSE;
+ $onBehalf = FALSE;
+ $pledges = FALSE;
+ $recurring = FALSE;
+ $memberships = TRUE;
+ $memPriceSetId = NULL;
+ $friend = FALSE;
+ $profilePreId = 1;
+ $profilePostId = NULL;
+ $premiums = FALSE;
+ $widget = FALSE;
+ $pcp = FALSE;
$isSeparatePayment = FALSE;
$membershipsRequired = FALSE;
- $fixedAmount = FALSE;
+ $fixedAmount = FALSE;
$contributionTitle = "Title $hash";
- $pageId = $this->webtestAddContributionPage($hash,
+ $pageId = $this->webtestAddContributionPage($hash,
$rand,
$contributionTitle,
array($processorName => 'Dummy'),
TRUE,
'Donation',
$fixedAmount,
- $membershipsRequired
+ $membershipsRequired
);
$firstName = 'Ma' . substr(sha1(rand()), 0, 4);
$lastName = 'An' . substr(sha1(rand()), 0, 7);
-
+
//logout
- $this->openCiviPage("logout", "reset=1");
-
+ $this->webtestLogout();
+
$this->_testOnlineMembershipSignup($pageId, 'No thank you', $firstName, $lastName, FALSE, $hash, 50);
-
+
// Log in using webtestLogin() method
- $this->webtestLogin();
+ $this->webtestLogin();
//Find Contribution
$this->openCiviPage("contribute/search","reset=1", "contribution_date_low");
$this->type("sort_name", "$firstName $lastName");
$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->webtestVerifyTabularData($expected);
}
}
-