_addContributionPage(TRUE); $this->_fillOutContributionPage(); // confirm contribution $this->assertFalse($this->isTextPresent("Your transaction has been processed successfully"), "Loaded thank you page"); $this->waitForElementPresent("_qf_Confirm_next-bottom"); $this->assertTrue($this->isTextPresent("Please verify the information below carefully"), "Should load confirmation page"); $this->click("_qf_Confirm_next-bottom"); $this->waitForPageToLoad($this->getTimeoutMsec()); // thank you page $this->assertTrue($this->isTextPresent("Your transaction has been processed successfully"), "Should load thank you page"); } function testWithoutConfirm() { $this->_addContributionPage(FALSE); $this->_fillOutContributionPage(); // thank you page $this->assertTrue($this->isTextPresent("Your transaction has been processed successfully"), "Didn't load thank you page after main page"); $this->assertFalse($this->isTextPresent("Your contribution will not be completed until"), "Loaded confirmation page"); } protected function _addContributionPage($isConfirmEnabled) { // log in $this->open($this->sboxPath); $this->webtestLogin(); // create new contribution page $hash = substr(sha1(rand()), 0, 7); $this->pageId = $this->webtestAddContributionPage( $hash, $rand = NULL, $pageTitle = "Test Confirm ($hash)", $processor = array("Dummy ($hash)" => 'Dummy'), $amountSection = TRUE, $payLater = FALSE, $onBehalf = FALSE, $pledges = FALSE, $recurring = FALSE, $membershipTypes = FALSE, $memPriceSetId = NULL, $friend = FALSE, $profilePreId = NULL, $profilePostId = NULL, $premiums = FALSE, $widget = FALSE, $pcp = FALSE, $isAddPaymentProcessor = TRUE, $isPcpApprovalNeeded = FALSE, $isSeparatePayment = FALSE, $honoreeSection = FALSE, $allowOtherAmmount = TRUE, $isConfirmEnabled = $isConfirmEnabled ); } protected function _fillOutContributionPage() { // load contribution page $this->open($this->sboxPath . "civicrm/contribute/transact?reset=1&id={$this->pageId}"); $this->waitForPageToLoad("3000"); $this->waitForElementPresent("_qf_Main_upload-bottom"); // fill out info $this->type("xpath=//div[@class='crm-section other_amount-section']//div[2]/input", "30"); $this->webtestAddCreditCardDetails(); list($firstName, $middleName, $lastName) = $this->webtestAddBillingDetails(); $this->type('email-5', "$lastName@example.com"); // submit contribution $this->click("_qf_Main_upload-bottom"); $this->waitForPageToLoad($this->getTimeoutMsec()); } }