open($this->sboxPath); $this->webtestLogin(); // We need a payment processor $processorName = 'Webtest AuthNet' . substr(sha1(rand()), 0, 7); $this->webtestAddPaymentProcessor($processorName, 'AuthNet'); // create a new contact for whom recurring contribution is to be created $firstName = 'Jane' . substr(sha1(rand()), 0, 7); $middleName = 'Middle'; $lastName = 'Recuroff_' . substr(sha1(rand()), 0, 7); $this->webtestAddContact($firstName, $lastName, "{$firstName}@example.com"); $contactName = "$firstName $lastName"; $this->click('css=li#tab_contribute a'); $this->waitForElementPresent('link=Submit Credit Card Contribution'); $this->click('link=Submit Credit Card Contribution'); $this->waitForPageToLoad($this->getTimeoutMsec()); // since we don't have live credentials we will switch to test mode $url = $this->getLocation(); $url = str_replace('mode=live', 'mode=test', $url); $this->open($url); // start filling out contribution form $this->waitForElementPresent('payment_processor_id'); $this->select('payment_processor_id', "label={$processorName}"); $this->click('financial_type_id'); $this->select('financial_type_id', 'label=Donation'); $this->type('total_amount', '10'); // recurring contribution fields $this->click('is_recur'); $this->type('frequency_interval', '1'); $this->select('frequency_unit', 'label=month(s)'); $this->type('installments', '12'); $this->click('is_email_receipt'); $this->waitForElementPresent('credit_card_type'); // enter credit card info on form $this->webtestAddCreditCardDetails(); // billing address $this->webtestAddBillingDetails($firstName, $middleName, $lastName); $this->click('_qf_Contribution_upload-bottom'); $this->waitForPageToLoad($this->getTimeoutMsec()); // Use Find Contributions to make sure test recurring contribution exists $this->open($this->sboxPath . 'civicrm/contribute/search?reset=1'); $this->waitForElementPresent('contribution_currency_type'); $this->type('sort_name', "$lastName, $firstName"); $this->click('contribution_test'); $this->click('_qf_Search_refresh'); $this->waitForElementPresent('css=#contributionSearch table tbody tr td span a.action-item-first'); $this->click('css=#contributionSearch table tbody tr td span a.action-item-first'); $this->waitForElementPresent('_qf_ContributionView_cancel-bottom'); // View Recurring Contribution Record $verifyData = array( 'From' => "$contactName", 'Financial Type' => 'Donation (test)', 'Total Amount' => 'Installments: 12, Interval: 1 month(s)', 'Contribution Status' => 'Pending : Incomplete Transaction', 'Paid By' => 'Credit Card', ); foreach ($verifyData as $label => $value) { $this->verifyText("xpath=//form[@id='ContributionView']//table/tbody/tr/td[text()='{$label}']/following-sibling::td", preg_quote($value) ); } } }