From 648f9d79303323c9cd1bbc290c899209efc440c9 Mon Sep 17 00:00:00 2001 From: kurund Date: Tue, 13 Aug 2013 03:09:39 +0530 Subject: [PATCH] fixes for WebTest_Contribute_AddBatchesTest::testBatchAddContribution --- .../phpunit/CiviTest/CiviSeleniumTestCase.php | 10 ++++-- .../WebTest/Contribute/AddBatchesTest.php | 35 ++----------------- 2 files changed, 10 insertions(+), 35 deletions(-) diff --git a/tests/phpunit/CiviTest/CiviSeleniumTestCase.php b/tests/phpunit/CiviTest/CiviSeleniumTestCase.php index 6a78696c7c..d49ce50b8a 100644 --- a/tests/phpunit/CiviTest/CiviSeleniumTestCase.php +++ b/tests/phpunit/CiviTest/CiviSeleniumTestCase.php @@ -496,14 +496,20 @@ class CiviSeleniumTestCase extends PHPUnit_Extensions_SeleniumTestCase { /** */ - function webtestNewDialogContact($fname = 'Anthony', $lname = 'Anderson', $email = 'anthony@anderson.biz', $type = 4, $selectId = 'profiles_1', $row = 1) { + function webtestNewDialogContact($fname = 'Anthony', $lname = 'Anderson', $email = 'anthony@anderson.biz', + $type = 4, $selectId = 'profiles_1', $row = 1, $prefix = '') { // 4 - Individual profile // 5 - Organization profile // 6 - Household profile $this->select($selectId, "value={$type}"); // create new contact using dialog - $this->waitForElementPresent("css=div#contact-dialog-{$row}"); + if (!$prefix) { + $this->waitForElementPresent("css=div#contact-dialog-{$row}"); + } + else { + $this->waitForElementPresent("css=div#contact-dialog-{$prefix}_{$row}"); + } $this->waitForElementPresent('_qf_Edit_next'); switch ($type) { diff --git a/tests/phpunit/WebTest/Contribute/AddBatchesTest.php b/tests/phpunit/WebTest/Contribute/AddBatchesTest.php index 43ee26ff6c..d94f8aec6f 100644 --- a/tests/phpunit/WebTest/Contribute/AddBatchesTest.php +++ b/tests/phpunit/WebTest/Contribute/AddBatchesTest.php @@ -90,7 +90,6 @@ class WebTest_Contribute_AddBatchesTest extends CiviSeleniumTestCase { 'last_name' => 'An'.substr(sha1(rand()), 0, 7), 'membership_type' => 'Default Organization', 'amount' => 100, - 'financial_type' => 'Member Dues', ); $this->_fillData($data[$i], $i, "Membership"); @@ -103,7 +102,8 @@ class WebTest_Contribute_AddBatchesTest extends CiviSeleniumTestCase { function _fillData($data, $row, $type) { $email = $data['first_name'] . '@example.com'; - $this->webtestNewDialogContact($data['first_name'], $data['last_name'], $email, 4, "primary_profiles_{$row}", "primary_{$row}"); + $this->webtestNewDialogContact($data['first_name'], $data['last_name'], $email, 4, + "primary_profiles_{$row}", $row, 'primary'); if ($type == "Contribution") { $this->select("field_{$row}_financial_type", $data['financial_type']); @@ -186,35 +186,4 @@ class WebTest_Contribute_AddBatchesTest extends CiviSeleniumTestCase { $this->_checkResult($value, $type); } } - - function webtestNewDialogContact($fname = 'Anthony', $lname = 'Anderson', $email = 'anthony@anderson.biz', $type = 4, $row) { - // 4 - Individual profile - // 5 - Organization profile - // 6 - Household profile - $this->select("{$row}", "value={$type}"); - // create new contact using dialog - // $this->waitForElementPresent('#first_name'); - $this->waitForElementPresent('_qf_Edit_next'); - - switch ($type) { - case 4: - $this->type('first_name', $fname); - $this->type('last_name', $lname); - break; - - case 5: - $this->type('organization_name', $fname); - break; - - case 6: - $this->type('household_name', $fname); - break; - } - - $this->type('email-Primary', $email); - $this->click('_qf_Edit_next'); - - // Is new contact created? - $this->assertTrue($this->isTextPresent("{$lname}, {$fname} has been created."), "Status message didn't show up after saving!"); - } } -- 2.25.1