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 +--------------------------------------------------------------------+
28 require_once 'CiviTest/CiviSeleniumTestCase.php';
31 * Class WebTest_Contribute_UpdateContributionTest
33 class WebTest_Contribute_UpdateContributionTest
extends CiviSeleniumTestCase
{
35 protected function setUp() {
39 function testChangeContributionAmount() {
40 $this->webtestLogin();
41 $firstName = substr(sha1(rand()), 0, 7);
42 $lastName = 'Contributor';
43 $email = $firstName . "@example.com";
45 //Offline Pay Later Contribution
46 $this->_testOfflineContribution($firstName, $lastName, $email, $amount, "Pending");
48 $this->openCiviPage("contribute/search", "reset=1", "contribution_date_low");
50 $this->type("sort_name", "$lastName, $firstName");
51 $this->click("_qf_Search_refresh");
53 $this->waitForElementPresent("xpath=//*[@id='Search']//div[@id='contributionSearch']");
54 $contriIDOff = explode('&', $this->getAttribute("xpath=//div[@id='contributionSearch']//table[@class='selector row-highlight']/tbody/tr[1]/td[11]/span/a[1]@href"));
55 if (!empty($contriIDOff)) {
56 $contriIDOff = substr($contriIDOff[1], (strrpos($contriIDOff[1], '=') +
1));
59 $this->clickLink("xpath=//tr[@id='rowid{$contriIDOff}']/td[11]/span/a[2]", "total_amount", FALSE);
60 $this->type("total_amount", "90");
61 $this->clickLink('_qf_Contribution_upload','',FALSE);
63 // Is status message correct?
64 $this->waitForText('crm-notification-container', "The contribution record has been saved.");
67 $searchParams = array('id' => $contriIDOff);
68 $compareParams = array('total_amount' => '90.00');
70 $lineItemSearchParams = array('entity_id' => $contriIDOff);
71 $lineItemCompareParams = array('line_total' => '90.00');
73 $this->assertDBCompareValues('CRM_Contribute_DAO_Contribution', $searchParams, $compareParams);
74 $this->assertDBCompareValues('CRM_Price_DAO_LineItem', $lineItemSearchParams, $lineItemCompareParams);
76 $total = $this->_getTotalContributedAmount($contriIDOff);
77 $compare = array('total_amount' => $total);
78 $this->assertDBCompareValues('CRM_Contribute_DAO_Contribution', $searchParams, $compare);
80 $amount = $this->_getFinancialItemAmount($contriIDOff);
81 $compare = array('total_amount' => $amount);
82 $this->assertDBCompareValues('CRM_Contribute_DAO_Contribution', $searchParams, $compare);
84 $financialTrxnAmount = $this->_getFinancialTrxnAmount($contriIDOff);
85 $compare = array('total_amount' => $financialTrxnAmount);
86 $this->assertDBCompareValues('CRM_Contribute_DAO_Contribution', $searchParams, $compare);
89 function testPayLater() {
90 $this->webtestLogin();
91 $firstName = substr(sha1(rand()), 0, 7);
92 $lastName = 'Contributor';
93 $email = $firstName . "@example.com";
95 //Offline Pay Later Contribution
96 $this->_testOfflineContribution($firstName, $lastName, $email, $amount, "Pending");
97 $this->waitForElementPresent("xpath=//div[@class='view-content']//table[@class='selector row-highlight']/tbody/tr[1]/td[8]/span/a[text()='Edit']");
98 $contId = explode('&id=', $this->getAttribute("xpath=//div[@class='view-content']//table[@class='selector row-highlight']/tbody/tr[1]/td[8]/span/a[text()='Edit']@href"));
99 $contId = explode('&', $contId[1]);
100 $contId = $contId[0];
101 $this->clickLink("xpath=//div[@class='view-content']//table[@class='selector row-highlight']/tbody/tr[1]/td[8]/span/a[text()='Edit']", '_qf_Contribution_cancel-bottom', FALSE);
102 $this->select("contribution_status_id", "label=Completed");
103 $this->clickLink("_qf_Contribution_upload", "xpath=//div[@class='view-content']//table[@class='selector row-highlight']/tbody/tr[1]/td[8]/span/a[text()='Edit']", FALSE);
104 $this->waitForText('crm-notification-container', "The contribution record has been saved.");
107 $search = array('id' => $contId);
108 $compare = array('contribution_status_id' => 1);
109 $this->assertDBCompareValues('CRM_Contribute_DAO_Contribution', $search, $compare);
111 $lineItem = key(CRM_Price_BAO_LineItem
::getLineItems($contId, 'contribution'));
112 $search = array( 'entity_id' => $lineItem );
113 $compare = array( 'status_id' => 1 );
114 $this->assertDBCompareValues("CRM_Financial_DAO_FinancialItem", $search, $compare);
116 $status = $this->_getPremiumActualCost($contId, 'Accounts Receivable', 'Payment Processor Account', NULL, "'civicrm_contribution'", "ft.status_id as status");
117 $this->assertEquals($status, '1', "Verify Completed Status");
120 function testChangePremium() {
121 $this->webtestLogin();
122 $firstName = substr(sha1(rand()), 0, 7);
123 $lastName = 'Contributor';
124 $email = $firstName . "@example.com";
126 $to = 'Premiums inventory';
127 $financialType = array(
128 'name' => 'Test Financial'.substr(sha1(rand()), 0, 7),
130 'is_deductible' => 1,
132 $this->addeditFinancialType($financialType);
133 $this->waitForElementPresent("xpath=//div[@id='ltype']/div/table/tbody//tr/td[text()='".$financialType['name']."']/../td[7]/span/a[text()='Accounts']");
134 $this->click("xpath=//div[@id='ltype']/div/table/tbody//tr/td[text()='".$financialType['name']."']/../td[7]/span/a[text()='Accounts']");
135 $this->waitForElementPresent("xpath=//a[@id='newfinancialTypeAccount']");
136 $this->clickLink("xpath=//a[@id='newfinancialTypeAccount']", "_qf_FinancialTypeAccount_cancel-botttom", FALSE);
137 $this->select("account_relationship", "label=Premiums Inventory Account is");
138 $this->select("financial_account_id", "label=$to");
139 $this->clickLink("_qf_FinancialTypeAccount_next-botttom", "xpath=//a[@id='newfinancialTypeAccount']", FALSE);
141 $premiumName = 'Premium'.substr(sha1(rand()), 0, 7);
146 $this->openCiviPage("admin/contribute/managePremiums", "action=add&reset=1");
148 $this->addPremium($premiumName, $sku, $amount, $price, $cost, $financialType['name']);
151 $premiumName2 = 'Premium'.substr(sha1(rand()), 0, 7);
156 $this->openCiviPage("admin/contribute/managePremiums", "action=add&reset=1");
157 $this->addPremium($premiumName2, $sku2, $amount2, $price2, $cost2, $financialType['name']);
159 // add contribution with premium
160 $this->openCiviPage("contribute/add", "reset=1&action=add&context=standalone");
162 // create new contact using dialog
163 $this->webtestNewDialogContact($firstName, $lastName, $email);
164 // select financial type
165 $this->select( "financial_type_id", "value=1" );
167 $this->type("total_amount", "100");
168 // fill Premium information
169 $this->clickLink("xpath=//div[@id='Premium']", "product_name_0", FALSE);
170 $this->select('product_name_0', "label=$premiumName ( $sku )");
172 $this->clickLink("_qf_Contribution_upload");
173 // Is status message correct?
174 $this->waitForText('crm-notification-container', "The contribution record has been saved.");
175 // verify if Membership is created
176 $this->waitForElementPresent("xpath=//div[@class='view-content']//table[@class='selector row-highlight']//tbody/tr[1]/td[8]/span/a[text()='View']");
177 //click through to the Contribution edit screen
178 $contId = explode('&id=', $this->getAttribute("xpath=//div[@class='view-content']//table[@class='selector row-highlight']/tbody/tr[1]/td[8]/span/a[text()='Edit']@href"));
179 $contId = explode('&', $contId[1]);
180 $contId = $contId[0];
181 $this->clickLink("xpath=//div[@class='view-content']//table[@class='selector row-highlight']/tbody/tr[1]/td[8]/span/a[text()='Edit']", "_qf_Contribution_upload-bottom", FALSE);
182 $this->waitForElementPresent("product_name_0");
183 $this->select('product_name_0', "label=$premiumName2 ( $sku2 )");
185 $this->clickLink("_qf_Contribution_upload", "xpath=//div[@class='view-content']//table[@class='selector row-highlight']//tbody/tr[1]/td[8]/span/a[text()='View']", FALSE);
188 $actualAmount = $this->_getPremiumActualCost($contId, $to, $from, $cost2, "'civicrm_contribution'");
189 $this->assertEquals($actualAmount, $cost2, "Verify actual cost for changed premium");
191 $deletedAmount = $this->_getPremiumActualCost($contId, $from, $to, $cost, "'civicrm_contribution'");
192 $this->assertEquals($deletedAmount, $cost, "Verify actual cost for deleted premium");
195 function testDeletePremium() {
196 $this->webtestLogin();
197 $firstName = substr(sha1(rand()), 0, 7);
198 $lastName = 'Contributor';
199 $email = $firstName . "@example.com";
201 $to = 'Premiums inventory';
202 $financialType = array(
203 'name' => 'Test Financial' . substr(sha1(rand()), 0, 7),
205 'is_deductible' => 1,
207 $this->addeditFinancialType($financialType);
208 $this->waitForElementPresent("xpath=//div[@id='ltype']/div/table/tbody//tr/td[text()='".$financialType['name']."']/../td[7]/span/a[text()='Accounts']");
209 $this->click("xpath=//div[@id='ltype']/div/table/tbody//tr/td[text()='".$financialType['name']."']/../td[7]/span/a[text()='Accounts']");
210 $this->waitForElementPresent("xpath=//a[@id='newfinancialTypeAccount']");
211 $this->clickLink("xpath=//a[@id='newfinancialTypeAccount']", "_qf_FinancialTypeAccount_cancel-botttom", FALSE);
213 $this->select("account_relationship", "label=Premiums Inventory Account is");
214 $this->select("financial_account_id", "label=$to");
215 $this->clickLink("_qf_FinancialTypeAccount_next-botttom", "xpath=//a[@id='newfinancialTypeAccount']", FALSE);
216 $premiumName = 'Premium' . substr(sha1(rand()), 0, 7);
221 $this->openCiviPage("admin/contribute/managePremiums", "action=add&reset=1");
223 $this->addPremium($premiumName, $sku, $amount, $price, $cost, $financialType['name']);
225 // add contribution with premium
226 $this->openCiviPage("contribute/add", "reset=1&action=add&context=standalone");
228 // create new contact using dialog
229 $this->webtestNewDialogContact($firstName, $lastName, $email);
230 // select financial type
231 $this->select("financial_type_id", "value=1");
233 $this->type("total_amount", "100");
234 // fill Premium information
235 $this->click("xpath=//div[@id='Premium']");
236 $this->waitForElementPresent("product_name_0");
237 $this->select('product_name_0', "label=$premiumName ( $sku )");
239 $this->clickLink("_qf_Contribution_upload");
240 // Is status message correct?
241 $this->waitForText('crm-notification-container', "The contribution record has been saved.");
242 // verify if Membership is created
243 $this->waitForElementPresent("xpath=//div[@class='view-content']//table[@class='selector row-highlight']//tbody/tr[1]/td[8]/span/a[text()='View']");
244 //click through to the Contribution edit screen
245 $contId = explode('&id=', $this->getAttribute("xpath=//div[@class='view-content']//table[@class='selector row-highlight']/tbody/tr[1]/td[8]/span/a[text()='Edit']@href"));
246 $contId = explode('&', $contId[1]);
247 $contId = $contId[0];
248 $this->clickLink("xpath=//div[@class='view-content']//table[@class='selector row-highlight']/tbody/tr[1]/td[8]/span/a[text()='Edit']", "_qf_Contribution_upload-bottom", FALSE);
249 $this->waitForElementPresent("product_name_0");
250 $this->select('product_name_0', "value=0");
252 $this->clickLink("_qf_Contribution_upload", "xpath=//div[@class='view-content']//table[@class='selector row-highlight']//tbody/tr[1]/td[8]/span/a[text()='View']", FALSE);
255 $actualAmount = $this->_getPremiumActualCost($contId, $from, $to, NULL, "'civicrm_contribution'");
256 $this->assertEquals($actualAmount, $cost, "Verify actual cost for deleted premium");
259 function testChangePaymentInstrument() {
260 $this->webtestLogin();
261 $firstName = substr(sha1(rand()), 0, 7);
262 $lastName = 'Contributor';
263 $email = $firstName . "@example.com";
264 $label = 'TEST'.substr(sha1(rand()), 0, 7);
266 $financialAccount = CRM_Contribute_PseudoConstant
::financialAccount();
267 $to = array_search('Accounts Receivable', $financialAccount);
268 $from = array_search('Deposit Bank Account', $financialAccount);
269 $this->addPaymentInstrument($label, $to);
270 $this->_testOfflineContribution($firstName, $lastName, $email, $amount);
271 $this->waitForElementPresent("xpath=//div[@class='view-content']//table[@class='selector row-highlight']/tbody/tr[1]/td[8]/span/a[text()='Edit']");
272 $this->clickLink("xpath=//div[@class='view-content']//table[@class='selector row-highlight']/tbody/tr[1]/td[8]/span/a[text()='Edit']", '_qf_Contribution_cancel-bottom', FALSE);
273 $contId = explode('&id=', $this->getAttribute("xpath=//div[@class='view-content']//table[@class='selector row-highlight']/tbody/tr[1]/td[8]/span/a[text()='Edit']@href"));
274 $contId = explode('&', $contId[1]);
275 $contId = $contId[0];
276 //change payment processor to newly created value
277 $this->select("payment_instrument_id", "label=$label");
278 $this->clickLink("_qf_Contribution_upload", "xpath=//div[@class='view-content']//table[@class='selector row-highlight']/tbody/tr[1]/td[8]/span/a[text()='Edit']", FALSE);
280 $totalAmount = $this->_getPremiumActualCost($contId, 'Payment Processor Account', 'Accounts Receivable');
281 $this->assertEquals($totalAmount, $amount, "Verify amount for newly inserted values");
284 function testRefundContribution() {
285 $this->webtestLogin();
286 $firstName = substr(sha1(rand()), 0, 7);
287 $lastName = 'Contributor';
288 $email = $firstName . "@example.com";
289 $label = 'TEST'.substr(sha1(rand()), 0, 7);
291 $this->_testOfflineContribution($firstName, $lastName, $email, $amount);
292 $this->waitForElementPresent("xpath=//div[@class='view-content']//table[@class='selector row-highlight']/tbody/tr[1]/td[8]/span/a[text()='Edit']");
293 $this->clickLink("xpath=//div[@class='view-content']//table[@class='selector row-highlight']/tbody/tr[1]/td[8]/span/a[text()='Edit']", '_qf_Contribution_cancel-bottom', FALSE);
294 //Contribution status
295 $this->select("contribution_status_id", "label=Refunded");
296 $contId = explode('&id=', $this->getAttribute("xpath=//div[@class='view-content']//table[@class='selector row-highlight']/tbody/tr[1]/td[8]/span/a[text()='Edit']@href"));
297 $contId = explode('&', $contId[1]);
298 $contId = $contId[0];
299 $this->clickLink("_qf_Contribution_upload", "xpath=//div[@class='view-content']//table[@class='selector row-highlight']/tbody/tr[1]/td[8]/span/a[text()='Edit']", FALSE);
302 $lineItem = key(CRM_Price_BAO_LineItem
::getLineItems($contId, 'contribution'));
303 $search = array('entity_id' => $lineItem);
305 'amount' => '100.00',
308 $this->assertDBCompareValues("CRM_Financial_DAO_FinancialItem", $search, $compare);
309 $amount = $this->_getPremiumActualCost($contId, NULL, 'Payment Processor Account', -100.00, "'civicrm_contribution'");
310 $this->assertEquals($amount, '-100.00', 'Verify Financial Trxn Amount.');
313 function testCancelPayLater() {
314 $this->webtestLogin();
315 $firstName = substr(sha1(rand()), 0, 7);
316 $lastName = 'Contributor';
317 $email = $firstName . "@example.com";
318 $label = 'TEST'.substr(sha1(rand()), 0, 7);
320 $this->_testOfflineContribution($firstName, $lastName, $email, $amount, "Pending");
321 $this->waitForElementPresent("xpath=//div[@class='view-content']//table[@class='selector row-highlight']/tbody/tr[1]/td[8]/span/a[text()='Edit']");
322 $this->clickLink("xpath=//div[@class='view-content']//table[@class='selector row-highlight']/tbody/tr[1]/td[8]/span/a[text()='Edit']", '_qf_Contribution_cancel-bottom', FALSE);
323 //Contribution status
324 $this->select("contribution_status_id", "label=Cancelled");
325 $contId = explode('&id=', $this->getAttribute("xpath=//div[@class='view-content']//table[@class='selector row-highlight']/tbody/tr[1]/td[8]/span/a[text()='Edit']@href"));
326 $contId = explode('&', $contId[1]);
327 $contId = $contId[0];
328 $this->clickLink("_qf_Contribution_upload", "xpath=//div[@class='view-content']//table[@class='selector row-highlight']/tbody/tr[1]/td[8]/span/a[text()='Edit']", FALSE);
329 $this->waitForText('crm-notification-container', "The contribution record has been saved.");
332 $search = array('id' => $contId);
333 $compare = array('contribution_status_id' => 3);
334 $this->assertDBCompareValues('CRM_Contribute_DAO_Contribution', $search, $compare);
335 $lineItem = key(CRM_Price_BAO_LineItem
::getLineItems($contId, 'contribution'));
337 'amount' => '-100.00',
338 'entity_id' => $lineItem,
341 $items = CRM_Financial_BAO_FinancialItem
::retrieve($itemParams, $defaults);
342 $this->assertEquals($items->amount
, $itemParams['amount'], 'Verify Amount for financial Item');
343 $totalAmount = $this->_getPremiumActualCost($items->id
, 'Accounts Receivable', NULL, "-100.00", "'civicrm_financial_item'");
344 $this->assertEquals($totalAmount, "-$amount", 'Verify Amount for Financial Trxn');
345 $totalAmount = $this->_getPremiumActualCost($contId, 'Accounts Receivable', NULL, "-100.00", "'civicrm_contribution'");
346 $this->assertEquals($totalAmount, "-$amount", 'Verify Amount for Financial Trxn');
349 function testChangeFinancialType() {
350 $this->webtestLogin();
351 $firstName = substr(sha1(rand()), 0, 7);
352 $lastName = 'Contributor';
353 $email = $firstName . "@example.com";
354 $label = 'TEST'.substr(sha1(rand()), 0, 7);
356 $this->_testOfflineContribution($firstName, $lastName, $email, $amount);
357 $this->waitForElementPresent("xpath=//div[@class='view-content']//table[@class='selector row-highlight']/tbody/tr[1]/td[8]/span/a[text()='Edit']");
358 $this->clickLink("xpath=//div[@class='view-content']//table[@class='selector row-highlight']/tbody/tr[1]/td[8]/span/a[text()='Edit']", '_qf_Contribution_cancel-bottom', FALSE);
359 //Contribution status
360 $this->select("financial_type_id", "value=3");
361 $contId = explode('&id=', $this->getAttribute("xpath=//div[@class='view-content']//table[@class='selector row-highlight']/tbody/tr[1]/td[8]/span/a[text()='Edit']@href"));
362 $contId = explode('&', $contId[1]);
363 $contId = $contId[0];
364 $this->clickLink("_qf_Contribution_upload", "xpath=//div[@class='view-content']//table[@class='selector row-highlight']/tbody/tr[1]/td[8]/span/a[text()='Edit']", FALSE);
365 $this->waitForText('crm-notification-container', "The contribution record has been saved.");
368 $search = array( 'id' => $contId );
369 $compare = array( 'financial_type_id' => 3 );
370 $this->assertDBCompareValues('CRM_Contribute_DAO_Contribution', $search, $compare);
372 $lineItem = key(CRM_Price_BAO_LineItem
::getLineItems($contId, 'contribution'));
374 'amount' => '-100.00',
375 'entity_id' => $lineItem,
377 $item1 = $item2 = array();
378 CRM_Financial_BAO_FinancialItem
::retrieve($itemParams, $item1);
379 $this->assertEquals($item1['amount'], "-100.00", "Verify Amount for New Financial Item");
380 $itemParams['amount'] = '100.00';
381 CRM_Financial_BAO_FinancialItem
::retrieve($itemParams, $item2);
382 $this->assertEquals($item2['amount'], "100.00", "Verify Amount for New Financial Item");
384 $cValue1 = $this->_getPremiumActualCost($contId, NULL, NULL, "-100.00", "'civicrm_contribution'");
385 $fValue1 = $this->_getPremiumActualCost($item1['id'], NULL, NULL, "-100.00", "'civicrm_financial_item'");
386 $this->assertEquals($cValue1, "-100.00", "Verify Amount");
387 $this->assertEquals($fValue1, "-100.00", "Verify Amount");
388 $cValue2 = $this->_getPremiumActualCost($contId, NULL, NULL, "100.00", "'civicrm_contribution'");
389 $fValue2 = $this->_getPremiumActualCost($item2['id'], NULL, NULL, "100.00", "'civicrm_financial_item'");
390 $this->assertEquals($cValue2, "100.00", "Verify Amount");
391 $this->assertEquals($fValue2, "100.00", "Verify Amount");
399 * @param null $entityTable
400 * @param string $select
402 * @return null|string
403 */function _getPremiumActualCost($entityId, $from = NULL, $to = NULL, $cost = NULL, $entityTable = NULL, $select = "ft.total_amount AS amount") {
404 $financialAccount = CRM_Contribute_PseudoConstant
::financialAccount();
407 FROM civicrm_financial_trxn ft
408 INNER JOIN civicrm_entity_financial_trxn eft ON eft.financial_trxn_id = ft.id AND eft.entity_id = {$entityId}";
410 $query .= " AND eft.entity_table = {$entityTable}";
413 $to = array_search($to, $financialAccount);
414 $query .= " AND ft.to_financial_account_id = {$to}";
417 $from = array_search($from, $financialAccount);
418 $query .= " AND ft.from_financial_account_id = {$from}";
421 $query .= " AND eft.amount = {$cost}";
423 $result = CRM_Core_DAO
::singleValueQuery($query);
430 * @return null|string
431 */function _getFinancialTrxnAmount($contId) {
433 SUM( ft.total_amount ) AS total
434 FROM civicrm_financial_trxn AS ft
435 LEFT JOIN civicrm_entity_financial_trxn AS ceft ON ft.id = ceft.financial_trxn_id
436 WHERE ceft.entity_table = 'civicrm_contribution'
437 AND ceft.entity_id = {$contId}";
438 $result = CRM_Core_DAO
::singleValueQuery($query);
445 * @return null|string
446 */function _getFinancialItemAmount($contId) {
447 $lineItem = key(CRM_Price_BAO_LineItem
::getLineItems($contId, 'contribution'));
450 FROM civicrm_financial_item
451 WHERE entity_table = 'civicrm_line_item'
452 AND entity_id = {$lineItem}";
453 $result = CRM_Core_DAO
::singleValueQuery($query);
460 * @return null|string
461 */function _getTotalContributedAmount($contId) {
464 FROM civicrm_entity_financial_trxn
465 WHERE entity_table = 'civicrm_contribution'
466 AND entity_id = {$contId}";
467 $result = CRM_Core_DAO
::singleValueQuery($query);
476 * @param string $status
478 function _testOfflineContribution($firstName, $lastName, $email, $amount, $status="Completed") {
480 $this->openCiviPage("contribute/add", "reset=1&context=standalone", "_qf_Contribution_upload");
482 // create new contact using dialog
483 $this->webtestNewDialogContact($firstName, $lastName, $email);
485 // select financial type
486 $this->select( "financial_type_id", "value=1" );
488 //Contribution status
489 $this->select("contribution_status_id", "label=$status");
492 $this->type("total_amount", $amount);
494 // select payment instrument type
495 $this->select("payment_instrument_id", "label=Credit Card");
498 $this->type("trxn_id", "P20901X1" . rand(100, 10000));
502 //$this->click('CIVICRM_QFID_3_6');
505 $this->clickLink("_qf_Contribution_upload");
507 // Is status message correct?
508 $this->waitForText('crm-notification-container', "The contribution record has been saved.");
510 $this->waitForElementPresent("xpath=//div[@class='view-content']//table[@class='selector row-highlight']//tbody/tr[1]/td[8]/span/a[text()='View']");
511 // verify if Membership is created
513 //click through to the Membership view screen
514 $this->click("xpath=//table[@class='selector row-highlight']/tbody/tr[1]/td[8]/span/a[text()='View']");
517 'Financial Type' => 'Donation',
518 'Total Amount' => '100.00',
519 'Contribution Status' => $status,
521 $this->webtestVerifyTabularData($expected);
522 $this->click("_qf_ContributionView_cancel-bottom");