3 +--------------------------------------------------------------------+
4 | CiviCRM version 4.5 |
5 +--------------------------------------------------------------------+
6 | Copyright CiviCRM LLC (c) 2004-2014 |
7 +--------------------------------------------------------------------+
8 | This file is a part of CiviCRM. |
10 | CiviCRM is free software; you can copy, modify, and distribute it |
11 | under the terms of the GNU Affero General Public License |
12 | Version 3, 19 November 2007 and the CiviCRM Licensing Exception. |
14 | CiviCRM is distributed in the hope that it will be useful, but |
15 | WITHOUT ANY WARRANTY; without even the implied warranty of |
16 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. |
17 | See the GNU Affero General Public License for more details. |
19 | You should have received a copy of the GNU Affero General Public |
20 | License along with this program; if not, contact CiviCRM LLC |
21 | at info[AT]civicrm[DOT]org. If you have questions about the |
22 | GNU Affero General Public License or the licensing of CiviCRM, |
23 | see the CiviCRM license FAQ at http://civicrm.org/licensing |
24 +--------------------------------------------------------------------+
27 require_once 'CiviTest/CiviSeleniumTestCase.php';
30 * Class WebTest_Contribute_ConfirmOptionalTest
32 class WebTest_Contribute_ConfirmOptionalTest
extends CiviSeleniumTestCase
{
33 protected $pageId = 0;
35 protected function setUp() {
39 function testWithConfirm() {
40 $this->_addContributionPage(TRUE);
41 $this->_fillOutContributionPage();
43 // confirm contribution
44 $this->assertFalse($this->isTextPresent("Your transaction has been processed successfully"), "Loaded thank you page");
45 $this->waitForElementPresent("_qf_Confirm_next-bottom");
46 $this->assertTrue($this->isTextPresent("Please verify the information below carefully"), "Should load confirmation page");
47 $this->click("_qf_Confirm_next-bottom");
48 $this->waitForPageToLoad($this->getTimeoutMsec());
51 $this->assertTrue($this->isTextPresent("Your transaction has been processed successfully"), "Should load thank you page");
54 function testWithoutConfirm() {
55 $this->_addContributionPage(FALSE);
56 $this->_fillOutContributionPage();
59 $this->assertTrue($this->isTextPresent("Your transaction has been processed successfully"), "Didn't load thank you page after main page");
60 $this->assertFalse($this->isTextPresent("Your contribution will not be completed until"), "Loaded confirmation page");
64 * @param $isConfirmEnabled
66 protected function _addContributionPage($isConfirmEnabled) {
68 $this->webtestLogin();
70 // create new contribution page
71 $hash = substr(sha1(rand()), 0, 7);
72 $this->pageId
= $this->webtestAddContributionPage(
75 $pageTitle = "Test Confirm ($hash)",
76 $processor = array("Dummy ($hash)" => 'Dummy'),
77 $amountSection = TRUE,
82 $membershipTypes = FALSE,
83 $memPriceSetId = NULL,
86 $profilePostId = NULL,
90 $isAddPaymentProcessor = TRUE,
91 $isPcpApprovalNeeded = FALSE,
92 $isSeparatePayment = FALSE,
93 $honoreeSection = FALSE,
94 $allowOtherAmount = TRUE,
95 $isConfirmEnabled = $isConfirmEnabled
99 protected function _fillOutContributionPage() {
100 // load contribution page
101 $this->openCiviPage("contribute/transact", "reset=1&id={$this->pageId}", "_qf_Main_upload-bottom");
104 $this->type("xpath=//div[@class='crm-section other_amount-section']//div[2]/input", "30");
105 $this->webtestAddCreditCardDetails();
106 list($firstName, $middleName, $lastName) = $this->webtestAddBillingDetails();
107 $this->type('email-5', "$lastName@example.com");
109 // submit contribution
110 $this->click("_qf_Main_upload-bottom");
111 $this->waitForPageToLoad($this->getTimeoutMsec());