From 76e86fd8640221a1225320edafd0ebc2c8192643 Mon Sep 17 00:00:00 2001 From: Coleman Watts Date: Wed, 20 Mar 2013 14:25:35 -0700 Subject: [PATCH] whitespace cleanup --- .../phpunit/CiviTest/CiviSeleniumTestCase.php | 8 +- .../WebTest/ACL/AssignUsersToRolesTest.php | 1 - .../Activity/ContactContextAddTest.php | 2 - tests/phpunit/WebTest/Activity/IcalTest.php | 27 ++-- .../WebTest/Activity/StandaloneAddTest.php | 1 - tests/phpunit/WebTest/Admin/CustomAddTest.php | 1 - .../Admin/Form/ScheduleReminderTest.php | 1 - .../Admin/Form/Setting/LocalizationTest.php | 2 - .../WebTest/Admin/MoveCustomDataTest.php | 13 +- .../WebTest/Admin/RelationshipTypeAddTest.php | 1 - .../phpunit/WebTest/Campaign/ActivityTest.php | 7 +- .../Campaign/CampaignDescriptionTest.php | 3 - .../phpunit/WebTest/Campaign/MailingTest.php | 2 - .../WebTest/Campaign/MembershipTest.php | 4 +- .../Campaign/OfflineContributionTest.php | 3 +- .../Campaign/OfflineEventRegistrationTest.php | 3 +- .../Campaign/OnlineContributionTest.php | 1 - .../Campaign/OnlineEventRegistrationTest.php | 1 - .../Campaign/PetitionUsageScenarioTest.php | 5 +- tests/phpunit/WebTest/Campaign/PledgeTest.php | 1 - .../Campaign/SurveyUsageScenarioTest.php | 17 +-- .../WebTest/Case/ActivityToCaseTest.php | 4 +- tests/phpunit/WebTest/Case/AddCaseTest.php | 9 +- .../WebTest/Case/CaseCustomFieldsTest.php | 2 - .../WebTest/Case/CaseDashboardTest.php | 1 - .../WebTest/Contact/AddCmsUserTest.php | 1 - .../AddContactsToEventAdvancedSearchTest.php | 3 - tests/phpunit/WebTest/Contact/AddTest.php | 7 +- .../WebTest/Contact/AddViaProfileTest.php | 2 - .../WebTest/Contact/AddressParsingTest.php | 2 - .../WebTest/Contact/AdvanceSearchPaneTest.php | 4 +- .../AdvanceSearchPrivacyOptionsTest.php | 24 ++-- .../WebTest/Contact/AdvancedSearchTest.php | 2 - .../AdvancedSearchedRelatedContactTest.php | 11 +- .../Contact/ContactReferenceFieldTest.php | 4 - .../WebTest/Contact/ContactTagTest.php | 2 - .../Contact/CreateCmsUserFromContactTest.php | 10 -- .../WebTest/Contact/CustomDataAddTest.php | 3 - .../DeceasedContactsAdvancedSearchTest.php | 3 +- .../WebTest/Contact/DupeContactTest.php | 3 - .../phpunit/WebTest/Contact/GroupAddTest.php | 1 - .../WebTest/Contact/InlineFieldsEditTest.php | 1 - .../WebTest/Contact/MergeContactsTest.php | 3 - .../Contact/MultipleContactSubTypes.php | 3 - .../phpunit/WebTest/Contact/PrevNextTest.php | 2 - .../Contact/PrivacyOptionSearchTest.php | 3 +- .../WebTest/Contact/ProfileChecksumTest.php | 1 - .../WebTest/Contact/RelationshipAddTest.php | 2 - .../WebTest/Contact/SearchBuilderTest.php | 18 +-- tests/phpunit/WebTest/Contact/SearchTest.php | 2 - .../Contact/SearchbyDateFilterTest.php | 13 +- .../phpunit/WebTest/Contact/SignatureTest.php | 1 - tests/phpunit/WebTest/Contact/TagAddTest.php | 2 - .../WebTest/Contact/TagSetSearchTest.php | 4 - .../Contact/TaskActionAddToGroupTest.php | 2 - .../Contact/TaskActionSendMassMailing.php | 2 - .../WebTest/Contact/TaskActionSendSMS.php | 2 - .../WebTest/Contact/UpdateProfileTest.php | 2 - .../WebTest/Contribute/AddBatchesTest.php | 40 +++--- .../WebTest/Contribute/AddPricesetTest.php | 60 ++++---- .../Contribute/ConfirmOptionalTest.php | 1 - .../Contribute/ContactContextAddTest.php | 38 ++--- .../Contribute/ContributionPageAddTest.php | 2 - .../Contribute/OfflineContributionTest.php | 73 +++++----- .../OfflineRecurContributionTest.php | 3 +- .../Contribute/OnBehalfOfOrganization.php | 9 -- .../Contribute/OnlineContributionTest.php | 7 +- .../OnlineMultiplePaymentProcessorTest.php | 10 +- .../OnlineRecurContributionTest.php | 1 - .../phpunit/WebTest/Contribute/PCPAddTest.php | 6 +- .../WebTest/Contribute/StandaloneAddTest.php | 14 +- .../UpdateBatchPendingContributionTest.php | 9 +- .../Contribute/UpdateContributionTest.php | 18 ++- .../UpdatePendingContributionTest.php | 4 +- .../Contribute/VerifySSLContributionTest.php | 1 - tests/phpunit/WebTest/Event/AddEventTest.php | 53 ++++--- .../WebTest/Event/AddParticipationTest.php | 20 ++- .../phpunit/WebTest/Event/AddPricesetTest.php | 57 ++++---- .../WebTest/Event/ChangeParticipantStatus.php | 1 - .../WebTest/Event/EventListingTest.php | 1 - .../WebTest/Event/EventWaitListTest.php | 1 - .../MultipleEventRegistrationbyCartTest.php | 133 +++++++++--------- .../WebTest/Event/MultiprofileEventTest.php | 17 +-- tests/phpunit/WebTest/Event/PCPAddTest.php | 2 +- .../WebTest/Event/ParticipantCountTest.php | 1 - .../WebTest/Event/ParticipantSearchTest.php | 2 - .../WebTest/Event/PricesetMaxCountTest.php | 12 +- .../phpunit/WebTest/Event/TellAFriendTest.php | 1 - tests/phpunit/WebTest/Export/ContactTest.php | 11 +- .../Export/ExportCiviSeleniumTestCase.php | 1 - .../Financial/FinancialAccountTest.php | 25 ++-- .../Financial/FinancialAccountTypeTest.php | 49 ++++--- .../WebTest/Generic/CheckActivityTest.php | 2 - .../WebTest/Generic/CheckDashboardTest.php | 2 - .../phpunit/WebTest/Generic/CheckFindTest.php | 2 - .../Generic/GeneralClickAroundTest.php | 2 - .../WebTest/Grant/ContactContextAddTest.php | 2 - .../WebTest/Grant/CustomFieldsetTest.php | 1 - .../WebTest/Grant/StandaloneAddTest.php | 1 - tests/phpunit/WebTest/Import/ActivityTest.php | 1 - .../WebTest/Import/AddressImportTest.php | 34 +++-- .../WebTest/Import/AddressParsingTest.php | 2 - .../WebTest/Import/ContactCustomDataTest.php | 2 - .../WebTest/Import/ContactSubtypeTest.php | 3 - tests/phpunit/WebTest/Import/ContactTest.php | 1 - .../WebTest/Import/ContributionTest.php | 3 +- .../phpunit/WebTest/Import/CustomDataTest.php | 3 +- .../phpunit/WebTest/Import/DateFormatTest.php | 1 - .../WebTest/Import/DuplicateMatchingTest.php | 2 - tests/phpunit/WebTest/Import/GroupTest.php | 1 - .../Import/ImportCiviSeleniumTestCase.php | 19 ++- .../WebTest/Import/MatchExternalIdTest.php | 1 - tests/phpunit/WebTest/Import/MemberTest.php | 1 - .../Import/MultipleRelationshipTest.php | 4 +- .../WebTest/Import/ParticipantTest.php | 3 +- .../WebTest/Import/SavedMappingTest.php | 2 - tests/phpunit/WebTest/Import/TagTest.php | 2 - .../Mailing/AddMessageTemplateTest.php | 1 - .../Mailing/AddNewMailingComponentTest.php | 1 - tests/phpunit/WebTest/Mailing/MailingTest.php | 7 +- tests/phpunit/WebTest/Mailing/SpoolTest.php | 45 +++--- .../Member/BatchUpdateViaProfileTest.php | 3 +- .../WebTest/Member/ContactContextAddTest.php | 2 - .../Member/DefaultMembershipPricesetTest.php | 1 - .../Member/FixedMembershipTypeTest.php | 32 +++-- .../Member/OfflineAutoRenewMembershipTest.php | 1 - .../OfflineMembershipAddPricesetTest.php | 2 - .../Member/OfflineMembershipRenewTest.php | 1 - .../OnlineAutoRenewMembershipGCTest.php | 19 +-- .../Member/OnlineAutoRenewMembershipTest.php | 9 +- .../OnlineMembershipAddPricesetTest.php | 17 +-- .../Member/OnlineMembershipCreateTest.php | 15 +- .../Member/OnlineMembershipRenewTest.php | 29 ++-- .../Member/SeperateMembershipPaymentTest.php | 2 - .../WebTest/Member/StandaloneAddTest.php | 2 - .../Member/UpdateMembershipScriptTest.php | 1 - .../WebTest/Pledge/ContactContextAddTest.php | 1 - .../ContactContextPledgePaymentAddTest.php | 3 +- .../Pledge/StandaloneAddDeleteTest.php | 20 +-- .../WebTest/Pledge/StandaloneAddTest.php | 1 - .../WebTest/Profile/BatchUpdateTest.php | 1 - tests/phpunit/WebTest/Profile/DedupeTest.php | 1 - .../Profile/MultiRecordProfileAddTest.php | 1 - .../WebTest/Profile/ProfileAddTest.php | 1 - .../Profile/ProfileGroupSubscriptionTest.php | 6 +- tests/phpunit/WebTest/Profile/SearchTest.php | 5 +- .../phpunit/WebTest/Release/InstallScript.php | 1 - .../WebTest/Release/ReleaseTestCase.php | 2 - .../phpunit/WebTest/Release/UpgradeScript.php | 1 - tests/phpunit/WebTest/Report/AddTest.php | 11 +- .../WebTest/Report/DonarReportTest.php | 3 +- .../WebTest/Report/LoggingReportTest.php | 1 - .../Report/RolePermissionReportTest.php | 1 - 153 files changed, 560 insertions(+), 735 deletions(-) diff --git a/tests/phpunit/CiviTest/CiviSeleniumTestCase.php b/tests/phpunit/CiviTest/CiviSeleniumTestCase.php index 642ecaf513..0d17dd40bd 100644 --- a/tests/phpunit/CiviTest/CiviSeleniumTestCase.php +++ b/tests/phpunit/CiviTest/CiviSeleniumTestCase.php @@ -25,7 +25,6 @@ +--------------------------------------------------------------------+ */ - require_once 'PHPUnit/Extensions/SeleniumTestCase.php'; /** @@ -360,7 +359,6 @@ class CiviSeleniumTestCase extends PHPUnit_Extensions_SeleniumTestCase { //$this->assertContains($sortName, $this->getValue('contact_1'), "autocomplete expected $sortName but didn’t find it in " . $this->getValue('contact_1')); } - /* * 1. By default, when no strtotime arg is specified, sets date to "now + 1 month" * 2. Does not set time. For setting both date and time use webtestFillDateTime() method. @@ -1035,7 +1033,6 @@ class CiviSeleniumTestCase extends PHPUnit_Extensions_SeleniumTestCase { $this->assertTrue($this->isTextPresent($text), 'Missing text: ' . $text); } - if ($widget) { // fill in step 8 (Widget Settings) $this->click('link=Widgets'); @@ -1311,7 +1308,7 @@ class CiviSeleniumTestCase extends PHPUnit_Extensions_SeleniumTestCase { // click through to the Activity view screen $this->click("xpath=//div[@id='Activities']//table/tbody/tr[2]/td[9]/span/a[text()='View']"); $this->waitForElementPresent('_qf_Activity_cancel-bottom'); - + // parse URL to grab the activity id // pass id back to any other tests that call this class return $this->urlArg('id'); @@ -1487,7 +1484,6 @@ class CiviSeleniumTestCase extends PHPUnit_Extensions_SeleniumTestCase { $this->waitForPageToLoad($this->getTimeoutMsec()); } - /** * Edit Financial Account */ @@ -1525,7 +1521,6 @@ class CiviSeleniumTestCase extends PHPUnit_Extensions_SeleniumTestCase { $this->type('accounting_code', $accountingCode); } - // Autofill Edit Organization if ($firstName) { $this->webtestOrganisationAutocomplete($firstName); @@ -1576,7 +1571,6 @@ class CiviSeleniumTestCase extends PHPUnit_Extensions_SeleniumTestCase { $this->waitForPageToLoad($this->getTimeoutMsec()); } - /** * Delete Financial Account */ diff --git a/tests/phpunit/WebTest/ACL/AssignUsersToRolesTest.php b/tests/phpunit/WebTest/ACL/AssignUsersToRolesTest.php index f87490fc68..fa456256e4 100755 --- a/tests/phpunit/WebTest/ACL/AssignUsersToRolesTest.php +++ b/tests/phpunit/WebTest/ACL/AssignUsersToRolesTest.php @@ -24,7 +24,6 @@ +--------------------------------------------------------------------+ */ - require_once 'CiviTest/CiviSeleniumTestCase.php'; class WebTest_ACL_AssignUsersToRolesTest extends CiviSeleniumTestCase { diff --git a/tests/phpunit/WebTest/Activity/ContactContextAddTest.php b/tests/phpunit/WebTest/Activity/ContactContextAddTest.php index 1650d6f364..301fea6434 100644 --- a/tests/phpunit/WebTest/Activity/ContactContextAddTest.php +++ b/tests/phpunit/WebTest/Activity/ContactContextAddTest.php @@ -24,7 +24,6 @@ +--------------------------------------------------------------------+ */ - require_once 'CiviTest/CiviSeleniumTestCase.php'; class WebTest_Activity_ContactContextAddTest extends CiviSeleniumTestCase { @@ -55,7 +54,6 @@ class WebTest_Activity_ContactContextAddTest extends CiviSeleniumTestCase { // button at the end of this page to show up, to make sure it's fully loaded. $this->waitForElementPresent("_qf_Activity_upload"); - // ...and verifying if the page contains properly formatted display name for chosen contact. $this->assertElementContainsText('css=tr.crm-activity-form-block-target_contact_id td ul li.token-input-token-facebook', 'Anderson, ' . $firstName2, 'Contact not found in line ' . __LINE__); diff --git a/tests/phpunit/WebTest/Activity/IcalTest.php b/tests/phpunit/WebTest/Activity/IcalTest.php index 9611d972b3..32a35a2d92 100644 --- a/tests/phpunit/WebTest/Activity/IcalTest.php +++ b/tests/phpunit/WebTest/Activity/IcalTest.php @@ -24,7 +24,6 @@ +--------------------------------------------------------------------+ */ - require_once 'CiviTest/CiviSeleniumTestCase.php'; require_once 'CiviTest/CiviMailUtils.php'; require_once 'ezc/Base/src/ezc_bootstrap.php'; @@ -35,7 +34,6 @@ class WebTest_Activity_IcalTest extends CiviSeleniumTestCase { // This variable is a bit awkward, but the ezc callback function needed to walk through the email parts needs to be static, so use this variable to "report back" on whether we found what we're looking for or not. private static $foundIt = false; - protected function setUp() { parent::setUp(); } @@ -89,28 +87,27 @@ class WebTest_Activity_IcalTest extends CiviSeleniumTestCase { $this->assertElementContainsText('crm-notification-container', "Activity '$subject' has been saved.", "Status message didn't show up after saving!"); // check the resulting email - $mail = $mailer->getMostRecentEmail( 'ezc' ); - $this->assertNotNull( $mail, ts('Assignee email not generated or problem locating it.') ); - $this->assertEquals( $mail->subject, "$subject" ); - $context = new ezcMailPartWalkContext( array( get_class($this), 'mailWalkCallback' ) ); - $mail->walkParts( $context, $mail ); + $mail = $mailer->getMostRecentEmail('ezc'); + $this->assertNotNull($mail, ts('Assignee email not generated or problem locating it.')); + $this->assertEquals($mail->subject, "$subject"); + $context = new ezcMailPartWalkContext(array(get_class($this), 'mailWalkCallback')); + $mail->walkParts($context, $mail); $mailer->stop(); - $this->assertTrue( self::$foundIt, ts('Generated email does not contain an ical attachment.') ); + $this->assertTrue(self::$foundIt, ts('Generated email does not contain an ical attachment.')); } - public static function mailWalkCallback( $context, $mailPart ) { - // echo "Class: " . get_class($mailPart) . "\n"; + public static function mailWalkCallback($context, $mailPart) { + $disp = $mailPart->contentDisposition; - if ( $disp ) { - if ( $disp->disposition == 'attachment' ) { - if ( $mailPart instanceof ezcMailText ) { - if ( $mailPart->subType == 'calendar' ) { + if ($disp) { + if ($disp->disposition == 'attachment') { + if ($mailPart instanceof ezcMailText) { + if ($mailPart->subType == 'calendar') { // For now we just check for existence. self::$foundIt = true; - // echo $mailPart->generateBody() . "\n"; } } } diff --git a/tests/phpunit/WebTest/Activity/StandaloneAddTest.php b/tests/phpunit/WebTest/Activity/StandaloneAddTest.php index 2c9a8d4a2f..f07517ca50 100644 --- a/tests/phpunit/WebTest/Activity/StandaloneAddTest.php +++ b/tests/phpunit/WebTest/Activity/StandaloneAddTest.php @@ -24,7 +24,6 @@ +--------------------------------------------------------------------+ */ - require_once 'CiviTest/CiviSeleniumTestCase.php'; class WebTest_Activity_StandaloneAddTest extends CiviSeleniumTestCase { diff --git a/tests/phpunit/WebTest/Admin/CustomAddTest.php b/tests/phpunit/WebTest/Admin/CustomAddTest.php index 8d42e37bd6..80cb670156 100644 --- a/tests/phpunit/WebTest/Admin/CustomAddTest.php +++ b/tests/phpunit/WebTest/Admin/CustomAddTest.php @@ -24,7 +24,6 @@ +--------------------------------------------------------------------+ */ - require_once 'CiviTest/CiviSeleniumTestCase.php'; class WebTest_Admin_CustomAddTest extends CiviSeleniumTestCase { diff --git a/tests/phpunit/WebTest/Admin/Form/ScheduleReminderTest.php b/tests/phpunit/WebTest/Admin/Form/ScheduleReminderTest.php index 67446ab69e..94e1a6e807 100644 --- a/tests/phpunit/WebTest/Admin/Form/ScheduleReminderTest.php +++ b/tests/phpunit/WebTest/Admin/Form/ScheduleReminderTest.php @@ -24,7 +24,6 @@ +--------------------------------------------------------------------+ */ - require_once 'CiviTest/CiviSeleniumTestCase.php'; class WebTest_Admin_Form_ScheduleReminderTest extends CiviSeleniumTestCase { diff --git a/tests/phpunit/WebTest/Admin/Form/Setting/LocalizationTest.php b/tests/phpunit/WebTest/Admin/Form/Setting/LocalizationTest.php index 7df29c6ce8..915f48b38c 100644 --- a/tests/phpunit/WebTest/Admin/Form/Setting/LocalizationTest.php +++ b/tests/phpunit/WebTest/Admin/Form/Setting/LocalizationTest.php @@ -24,7 +24,6 @@ +--------------------------------------------------------------------+ */ - require_once 'CiviTest/CiviSeleniumTestCase.php'; class WebTest_Admin_Form_Setting_LocalizationTest extends CiviSeleniumTestCase { @@ -57,4 +56,3 @@ class WebTest_Admin_Form_Setting_LocalizationTest extends CiviSeleniumTestCase { } } - diff --git a/tests/phpunit/WebTest/Admin/MoveCustomDataTest.php b/tests/phpunit/WebTest/Admin/MoveCustomDataTest.php index aade985eab..c4772b1d7b 100644 --- a/tests/phpunit/WebTest/Admin/MoveCustomDataTest.php +++ b/tests/phpunit/WebTest/Admin/MoveCustomDataTest.php @@ -24,7 +24,6 @@ +--------------------------------------------------------------------+ */ - require_once 'CiviTest/CiviSeleniumTestCase.php'; class WebTest_Admin_MoveCustomDataTest extends CiviSeleniumTestCase { @@ -57,7 +56,6 @@ class WebTest_Admin_MoveCustomDataTest extends CiviSeleniumTestCase { $pre_move_values[$cid_to_missing]['source'] = $this->_loadDataFromApi($cid_to_missing, $from_group_id); $pre_move_values[$cid_to_missing]['destination'] = $this->_loadDataFromApi($cid_to_missing, $to_group_id); - //ok, so after all that setup, we are now good to actually move a field //first, pick a random field from the source group to move @@ -76,7 +74,6 @@ class WebTest_Admin_MoveCustomDataTest extends CiviSeleniumTestCase { $post_move_values[$cid_to_missing]['source'] = $this->_loadDataFromApi($cid_to_missing, $from_group_id); $post_move_values[$cid_to_missing]['destination'] = $this->_loadDataFromApi($cid_to_missing, $to_group_id); - //Make sure that only the appropriate values have changed foreach (array( $cid_all, $cid_from_missing, $cid_to_missing) as $cid) { @@ -128,7 +125,8 @@ class WebTest_Admin_MoveCustomDataTest extends CiviSeleniumTestCase { //assert that the success text is present $this->assertElementContainsText('crm-notification-container', "has been moved", "Move field success message not displayed"); - //assert that the custom field not on old data set page + //assert that the custom field not on old data set page + $this->assertTrue(!$this->isElementPresent("CustomField-" . $field_to_move), "The moved custom field still displays on the old fieldset page"); //go to the destination fieldset and make sure the field is present @@ -165,7 +163,6 @@ class WebTest_Admin_MoveCustomDataTest extends CiviSeleniumTestCase { } } - $params = array('contact_id' => $contact_id); foreach ($field_ids[$group_id] as $id) { $params['return.custom_' . $id] = 1; @@ -184,7 +181,6 @@ class WebTest_Admin_MoveCustomDataTest extends CiviSeleniumTestCase { return $results; } - //creates a new custom group and fields in that group, and returns the group Id function _buildCustomFieldset($prefix) { $group_id = $this->_createCustomGroup($prefix); @@ -347,7 +343,7 @@ class WebTest_Admin_MoveCustomDataTest extends CiviSeleniumTestCase { $this->waitForPageToLoad($this->getTimeoutMsec()); //Is custom field created? - $this->assertElementContainsText('crm-notification-container', "Your custom field '$fieldLabel' has been saved.", "Field was not created successfully"); + $this->assertElementContainsText('crm-notification-container', "Your custom field '$fieldLabel' has been saved.", "Field was not created successfully"); //get the custom id of the custom field that was just created $results = $this->webtest_civicrm_api("CustomField", "get", array('label' => $fieldLabel, 'custom_group_id' => $group_id)); @@ -373,7 +369,7 @@ class WebTest_Admin_MoveCustomDataTest extends CiviSeleniumTestCase { //randomly generates data for a specific custom field function _fillCustomDataForContact($contact_id, $group_id) { //edit the given contact - $this->openCiviPage('contact/add', "reset=1&action=update&cid={$contact_id}"); + $this->openCiviPage('contact/add', "reset=1&action=update&cid={$contact_id}"); $this->click("expand"); $this->waitForElementPresent("address_1_street_address"); @@ -425,4 +421,3 @@ class WebTest_Admin_MoveCustomDataTest extends CiviSeleniumTestCase { } } - diff --git a/tests/phpunit/WebTest/Admin/RelationshipTypeAddTest.php b/tests/phpunit/WebTest/Admin/RelationshipTypeAddTest.php index d31cbb1c46..a6e265333b 100644 --- a/tests/phpunit/WebTest/Admin/RelationshipTypeAddTest.php +++ b/tests/phpunit/WebTest/Admin/RelationshipTypeAddTest.php @@ -24,7 +24,6 @@ +--------------------------------------------------------------------+ */ - require_once 'CiviTest/CiviSeleniumTestCase.php'; class WebTest_Admin_RelationshipTypeAddTest extends CiviSeleniumTestCase { diff --git a/tests/phpunit/WebTest/Campaign/ActivityTest.php b/tests/phpunit/WebTest/Campaign/ActivityTest.php index 4e6aceb7f0..ac48a1c0b2 100644 --- a/tests/phpunit/WebTest/Campaign/ActivityTest.php +++ b/tests/phpunit/WebTest/Campaign/ActivityTest.php @@ -24,7 +24,6 @@ +--------------------------------------------------------------------+ */ - require_once 'CiviTest/CiviSeleniumTestCase.php'; class WebTest_Campaign_ActivityTest extends CiviSeleniumTestCase { @@ -103,7 +102,8 @@ class WebTest_Campaign_ActivityTest extends CiviSeleniumTestCase { $this->click("_qf_Campaign_upload-bottom"); $this->waitForPageToLoad($this->getTimeoutMsec()); - $this->assertElementContainsText('crm-notification-container', "Campaign Campaign $title has been saved.", + $this->assertElementContainsText('crm-notification-container', "Campaign Campaign $title has been saved.", + "Status message didn't show up after saving campaign!" ); @@ -132,7 +132,6 @@ class WebTest_Campaign_ActivityTest extends CiviSeleniumTestCase { // button at the end of this page to show up, to make sure it's fully loaded. $this->waitForElementPresent("_qf_Activity_upload"); - // ...and verifying if the page contains properly formatted display name for chosen contact. $this->assertElementContainsText('css=tr.crm-activity-form-block-target_contact_id td ul li.token-input-token-facebook','Anderson, ' . $firstName2, 'Contact not found in line ' . __LINE__); @@ -207,7 +206,7 @@ class WebTest_Campaign_ActivityTest extends CiviSeleniumTestCase { // click through to the Activity view screen $this->click("xpath=//div[@id='Activities']//table/tbody//tr/td[2][text()='This is subject of test activity being added through activity tab of contact summary screen.']/../td[9]/span/a[text()='View']"); $this->waitForElementPresent('_qf_Activity_cancel-bottom'); - + // verify Activity created $this->verifyText("xpath=id( 'Activity' )/div[2]/table[1]/tbody/tr[5]/td[2]", preg_quote($campaignTitle)); } diff --git a/tests/phpunit/WebTest/Campaign/CampaignDescriptionTest.php b/tests/phpunit/WebTest/Campaign/CampaignDescriptionTest.php index 1e1a354cb6..a712596381 100644 --- a/tests/phpunit/WebTest/Campaign/CampaignDescriptionTest.php +++ b/tests/phpunit/WebTest/Campaign/CampaignDescriptionTest.php @@ -24,7 +24,6 @@ +--------------------------------------------------------------------+ */ - require_once 'CiviTest/CiviSeleniumTestCase.php'; class WebTest_Campaign_CampaignDescriptionTest extends CiviSeleniumTestCase { @@ -38,7 +37,6 @@ class WebTest_Campaign_CampaignDescriptionTest extends CiviSeleniumTestCase { function testCreateCampaign() { - $this->webtestLogin(); // Create new group @@ -88,4 +86,3 @@ class WebTest_Campaign_CampaignDescriptionTest extends CiviSeleniumTestCase { } } - diff --git a/tests/phpunit/WebTest/Campaign/MailingTest.php b/tests/phpunit/WebTest/Campaign/MailingTest.php index edb2a915b8..0a7955ed41 100644 --- a/tests/phpunit/WebTest/Campaign/MailingTest.php +++ b/tests/phpunit/WebTest/Campaign/MailingTest.php @@ -24,7 +24,6 @@ +--------------------------------------------------------------------+ */ - require_once 'CiviTest/CiviSeleniumTestCase.php'; class WebTest_Campaign_MailingTest extends CiviSeleniumTestCase { @@ -68,7 +67,6 @@ class WebTest_Campaign_MailingTest extends CiviSeleniumTestCase { $this->openCiviPage('campaign/add', 'reset=1', '_qf_Campaign_upload-bottom'); - $campaignTitle = "Campaign $title"; $this->type("title", $campaignTitle); diff --git a/tests/phpunit/WebTest/Campaign/MembershipTest.php b/tests/phpunit/WebTest/Campaign/MembershipTest.php index f209567819..f62db6bd2d 100644 --- a/tests/phpunit/WebTest/Campaign/MembershipTest.php +++ b/tests/phpunit/WebTest/Campaign/MembershipTest.php @@ -24,7 +24,6 @@ +--------------------------------------------------------------------+ */ - require_once 'CiviTest/CiviSeleniumTestCase.php'; class WebTest_Campaign_MembershipTest extends CiviSeleniumTestCase { @@ -113,7 +112,7 @@ class WebTest_Campaign_MembershipTest extends CiviSeleniumTestCase { function memberAddTest($campaignTitle, $id) { //Add new memebershipType $memTypeParams = $this->webtestAddMembershipType(); - + // Adding Adding contact with randomized first name for test testContactContextActivityAdd // We're using Quick Add block on the main page for this. $firstName = substr(sha1(rand()), 0, 7); @@ -143,7 +142,6 @@ class WebTest_Campaign_MembershipTest extends CiviSeleniumTestCase { $this->click("campaign_id"); $this->select("campaign_id", "value=$id"); - // Let Join Date stay default // fill in Start Date $this->webtestFillDate('start_date'); diff --git a/tests/phpunit/WebTest/Campaign/OfflineContributionTest.php b/tests/phpunit/WebTest/Campaign/OfflineContributionTest.php index 4b9e1461fd..702b04d408 100644 --- a/tests/phpunit/WebTest/Campaign/OfflineContributionTest.php +++ b/tests/phpunit/WebTest/Campaign/OfflineContributionTest.php @@ -24,7 +24,6 @@ +--------------------------------------------------------------------+ */ - require_once 'CiviTest/CiviSeleniumTestCase.php'; class WebTest_Campaign_OfflineContributionTest extends CiviSeleniumTestCase { @@ -231,7 +230,7 @@ class WebTest_Campaign_OfflineContributionTest extends CiviSeleniumTestCase { $this->waitForPageToLoad($this->getTimeoutMsec()); $this->assertTrue($this->isTextPresent("Changes Saved.")); - $this->openCiviPage('contribute/search', 'reset=1', '_qf_Search_refresh'); + $this->openCiviPage('contribute/search', 'reset=1', '_qf_Search_refresh'); $this->type('sort_name', $firstName); $this->click("_qf_Search_refresh"); diff --git a/tests/phpunit/WebTest/Campaign/OfflineEventRegistrationTest.php b/tests/phpunit/WebTest/Campaign/OfflineEventRegistrationTest.php index 5b88d128fc..6ddae484ca 100644 --- a/tests/phpunit/WebTest/Campaign/OfflineEventRegistrationTest.php +++ b/tests/phpunit/WebTest/Campaign/OfflineEventRegistrationTest.php @@ -24,7 +24,6 @@ +--------------------------------------------------------------------+ */ - require_once 'CiviTest/CiviSeleniumTestCase.php'; class WebTest_Campaign_OfflineEventRegistrationTest extends CiviSeleniumTestCase { @@ -167,7 +166,7 @@ class WebTest_Campaign_OfflineEventRegistrationTest extends CiviSeleniumTestCase // Select an event fee $this->waitForElementPresent('priceset'); $this->click("xpath=//div[@id='priceset']//input[1][@class='form-radio']"); - + // Select 'Record Payment' $this->click("record_contribution"); diff --git a/tests/phpunit/WebTest/Campaign/OnlineContributionTest.php b/tests/phpunit/WebTest/Campaign/OnlineContributionTest.php index c485c4f144..686a02ff4a 100644 --- a/tests/phpunit/WebTest/Campaign/OnlineContributionTest.php +++ b/tests/phpunit/WebTest/Campaign/OnlineContributionTest.php @@ -24,7 +24,6 @@ +--------------------------------------------------------------------+ */ - require_once 'CiviTest/CiviSeleniumTestCase.php'; class WebTest_Campaign_OnlineContributionTest extends CiviSeleniumTestCase { diff --git a/tests/phpunit/WebTest/Campaign/OnlineEventRegistrationTest.php b/tests/phpunit/WebTest/Campaign/OnlineEventRegistrationTest.php index 3aed99ea4a..90fa187aab 100644 --- a/tests/phpunit/WebTest/Campaign/OnlineEventRegistrationTest.php +++ b/tests/phpunit/WebTest/Campaign/OnlineEventRegistrationTest.php @@ -24,7 +24,6 @@ +--------------------------------------------------------------------+ */ - require_once 'CiviTest/CiviSeleniumTestCase.php'; class WebTest_Campaign_OnlineEventRegistrationTest extends CiviSeleniumTestCase { diff --git a/tests/phpunit/WebTest/Campaign/PetitionUsageScenarioTest.php b/tests/phpunit/WebTest/Campaign/PetitionUsageScenarioTest.php index 5be5d26d0f..459377b12f 100644 --- a/tests/phpunit/WebTest/Campaign/PetitionUsageScenarioTest.php +++ b/tests/phpunit/WebTest/Campaign/PetitionUsageScenarioTest.php @@ -24,7 +24,6 @@ +--------------------------------------------------------------------+ */ - require_once 'CiviTest/CiviSeleniumTestCase.php'; class WebTest_Campaign_PetitionUsageScenarioTest extends CiviSeleniumTestCase { @@ -183,7 +182,7 @@ class WebTest_Campaign_PetitionUsageScenarioTest extends CiviSeleniumTestCase { foreach ($expected as $column => $value) { $this->verifyText("xpath=//table[@class='selector']/tbody/tr[2]/td[$column]", preg_quote($value)); } - + // ONCE MORE, NO EMAIL VERIFICATION AND CUSTOM THANK-YOU $this->openCiviPage("petition/add", "reset=1", "_qf_Petition_next-bottom"); @@ -246,7 +245,7 @@ class WebTest_Campaign_PetitionUsageScenarioTest extends CiviSeleniumTestCase { // click Sign the petition. $this->click("_qf_Signature_next-bottom"); $this->waitForElementPresent("thankyou_text"); - + // check that thank-you page has appropriate title and message $this->assertTrue($this->isTextPresent("Awesome $title donation")); $this->assertTrue($this->isTextPresent("Thank you for your kind contribution to support $title")); diff --git a/tests/phpunit/WebTest/Campaign/PledgeTest.php b/tests/phpunit/WebTest/Campaign/PledgeTest.php index d02719dca7..4addf350bd 100644 --- a/tests/phpunit/WebTest/Campaign/PledgeTest.php +++ b/tests/phpunit/WebTest/Campaign/PledgeTest.php @@ -24,7 +24,6 @@ +--------------------------------------------------------------------+ */ - require_once 'CiviTest/CiviSeleniumTestCase.php'; class WebTest_Campaign_PledgeTest extends CiviSeleniumTestCase { diff --git a/tests/phpunit/WebTest/Campaign/SurveyUsageScenarioTest.php b/tests/phpunit/WebTest/Campaign/SurveyUsageScenarioTest.php index 7e51c9936a..e640d8fa54 100644 --- a/tests/phpunit/WebTest/Campaign/SurveyUsageScenarioTest.php +++ b/tests/phpunit/WebTest/Campaign/SurveyUsageScenarioTest.php @@ -24,7 +24,6 @@ +--------------------------------------------------------------------+ */ - require_once 'CiviTest/CiviSeleniumTestCase.php'; class WebTest_Campaign_SurveyUsageScenarioTest extends CiviSeleniumTestCase { @@ -180,11 +179,12 @@ class WebTest_Campaign_SurveyUsageScenarioTest extends CiviSeleniumTestCase { $this->click("_qf_Main_upload-bottom"); $this->waitForElementPresent("_qf_Questions_upload_next-bottom"); - + // Select the profile for the survey $this->select("//form[@id='Questions']/div[2]/table/tbody/tr[1]/td[2]/div/div/span/select", "label=New Individual"); - // select the question created for the survey + // select the question created for the survey + $this->select("//form[@id='Questions']/div[2]/table/tbody/tr[2]/td[2]/div/div/span/select", "label=Profile $title"); $this->click("_qf_Questions_upload_next-bottom"); @@ -410,7 +410,7 @@ class WebTest_Campaign_SurveyUsageScenarioTest extends CiviSeleniumTestCase { $this->check('is_searchable'); $this->check('in_selector'); $this->clickLink('_qf_Field_next_new-bottom', '_qf_Field_cancel-bottom'); - + // Custom Data Fields $this->select('field_name[0]', "value=Contact"); $this->select('field_name[1]', "label=$field1 :: $customGroup"); @@ -445,11 +445,12 @@ class WebTest_Campaign_SurveyUsageScenarioTest extends CiviSeleniumTestCase { $this->click("_qf_Main_upload-bottom"); $this->waitForElementPresent("_qf_Questions_upload_next-bottom"); - + //Select the profile for the survey $this->select("//form[@id='Questions']/div[2]/table/tbody/tr[1]/td[2]/div/div/span/select", "label=New Individual"); - // select the question created for the survey + // select the question created for the survey + $this->select("//form[@id='Questions']/div[2]/table/tbody/tr[2]/td[2]/div/div/span/select", "label=$surveyProfile"); $this->click("_qf_Questions_upload_next-bottom"); @@ -504,7 +505,7 @@ class WebTest_Campaign_SurveyUsageScenarioTest extends CiviSeleniumTestCase { $this->assertTrue($this->isTextPresent("Is equal to Reserved")); // commenting out the print assertion as print dialog which appears breaks the webtest - // as it is OS-related and cannot be handled through webtest + // as it is OS-related and cannot be handled through webtest // $this->click('_qf_SurveyDetails_submit_print'); // $this->waitForPageToLoad($this->getTimeoutMsec()); @@ -557,7 +558,7 @@ class WebTest_Campaign_SurveyUsageScenarioTest extends CiviSeleniumTestCase { $this->assertTrue($this->isTextPresent("Is equal to Interviewed")); // commenting out the print assertion as print dialog which appears breaks the webtest - // as it is OS-related and cannot be handled through webtest + // as it is OS-related and cannot be handled through webtest // $this->click('_qf_SurveyDetails_submit_print'); // $this->waitForPageToLoad($this->getTimeoutMsec()); diff --git a/tests/phpunit/WebTest/Case/ActivityToCaseTest.php b/tests/phpunit/WebTest/Case/ActivityToCaseTest.php index 0901c74418..6b0f1599ab 100644 --- a/tests/phpunit/WebTest/Case/ActivityToCaseTest.php +++ b/tests/phpunit/WebTest/Case/ActivityToCaseTest.php @@ -24,7 +24,6 @@ +--------------------------------------------------------------------+ */ - require_once 'CiviTest/CiviSeleniumTestCase.php'; class WebTest_Case_ActivityToCaseTest extends CiviSeleniumTestCase { @@ -72,7 +71,7 @@ class WebTest_Case_ActivityToCaseTest extends CiviSeleniumTestCase { // Using helper webtestFillDate function. $this->webtestFillDate('start_date', 'now'); $today = date('F jS, Y', strtotime('now')); - // echo 'Today is ' . $today; + $this->type('duration', "20"); $this->clickLink('_qf_Case_upload-bottom', '_qf_CaseView_cancel-bottom'); @@ -106,7 +105,6 @@ class WebTest_Case_ActivityToCaseTest extends CiviSeleniumTestCase { // button at the end of this page to show up, to make sure it's fully loaded. $this->waitForElementPresent("_qf_Activity_upload-bottom"); - // ...and verifying if the page contains properly formatted display name for chosen contact. $this->assertElementContainsText('css=tr.crm-activity-form-block-target_contact_id td ul li.token-input-token-facebook', 'Anderson, ' . $firstName2, "Contact not found in line " . __LINE__); diff --git a/tests/phpunit/WebTest/Case/AddCaseTest.php b/tests/phpunit/WebTest/Case/AddCaseTest.php index 4e6ad2ae1c..8b8746e3a4 100644 --- a/tests/phpunit/WebTest/Case/AddCaseTest.php +++ b/tests/phpunit/WebTest/Case/AddCaseTest.php @@ -24,7 +24,6 @@ +--------------------------------------------------------------------+ */ - require_once 'CiviTest/CiviSeleniumTestCase.php'; class WebTest_Case_AddCaseTest extends CiviSeleniumTestCase { @@ -94,7 +93,7 @@ class WebTest_Case_AddCaseTest extends CiviSeleniumTestCase { // Using helper webtestFillDate function. $this->webtestFillDate('start_date', 'now'); $today = date('F jS, Y', strtotime('now')); - // echo 'Today is ' . $today; + $this->type("duration", "20"); $this->clickLink("_qf_Case_upload-bottom", "_qf_CaseView_cancel-bottom"); @@ -128,14 +127,14 @@ class WebTest_Case_AddCaseTest extends CiviSeleniumTestCase { ); $this->_testVerifyOpenCaseActivity($subject, $openCaseData); - + //change the case status to Resolved to get the end date $this->click("xpath=//form[@id='CaseView']/div[2]/table/tbody/tr/td[4]/a"); $this->waitForElementPresent("_qf_Activity_cancel-bottom"); $this->select("case_status_id","value=2"); $this->click("_qf_Activity_upload-top"); $this->waitForPageToLoad($this->getTimeoutMsec()); - + $this->_testSearchbyDate($firstName, $lastName, "this.quarter"); $this->_testSearchbyDate($firstName, $lastName, "0"); $this->_testSearchbyDate($firstName, $lastName, "this.year"); @@ -206,7 +205,7 @@ class WebTest_Case_AddCaseTest extends CiviSeleniumTestCase { $this->waitForPageToLoad($this->getTimeoutMsec()); $this->assertElementContainsText('Search', "$lastName, $firstName"); } - + //Advanced Search $this->openCiviPage('contact/search/advanced', 'reset=1', '_qf_Advanced_refresh'); $this->click("CiviCase"); diff --git a/tests/phpunit/WebTest/Case/CaseCustomFieldsTest.php b/tests/phpunit/WebTest/Case/CaseCustomFieldsTest.php index baa52f8eb5..b4d20cad7b 100644 --- a/tests/phpunit/WebTest/Case/CaseCustomFieldsTest.php +++ b/tests/phpunit/WebTest/Case/CaseCustomFieldsTest.php @@ -24,7 +24,6 @@ +--------------------------------------------------------------------+ */ - require_once 'CiviTest/CiviSeleniumTestCase.php'; class WebTest_Case_CaseCustomFieldsTest extends CiviSeleniumTestCase { @@ -122,7 +121,6 @@ class WebTest_Case_CaseCustomFieldsTest extends CiviSeleniumTestCase { $this->webtestFillDate('start_date', 'now'); $today = date('F jS, Y', strtotime('now')); - // echo 'Today is ' . $today; $this->type("duration", "20"); $this->type("{$cusId_1}", $custFname); $this->type("{$cusId_2}", $custMname); diff --git a/tests/phpunit/WebTest/Case/CaseDashboardTest.php b/tests/phpunit/WebTest/Case/CaseDashboardTest.php index f7d704aca0..cc0d3800c3 100644 --- a/tests/phpunit/WebTest/Case/CaseDashboardTest.php +++ b/tests/phpunit/WebTest/Case/CaseDashboardTest.php @@ -24,7 +24,6 @@ +--------------------------------------------------------------------+ */ - require_once 'CiviTest/CiviSeleniumTestCase.php'; class WebTest_Case_CaseDashboardTest extends CiviSeleniumTestCase { diff --git a/tests/phpunit/WebTest/Contact/AddCmsUserTest.php b/tests/phpunit/WebTest/Contact/AddCmsUserTest.php index 25d080a6f0..fef67fe104 100644 --- a/tests/phpunit/WebTest/Contact/AddCmsUserTest.php +++ b/tests/phpunit/WebTest/Contact/AddCmsUserTest.php @@ -24,7 +24,6 @@ +--------------------------------------------------------------------+ */ - require_once 'CiviTest/CiviSeleniumTestCase.php'; class WebTest_Contact_AddCmsUserTest extends CiviSeleniumTestCase { diff --git a/tests/phpunit/WebTest/Contact/AddContactsToEventAdvancedSearchTest.php b/tests/phpunit/WebTest/Contact/AddContactsToEventAdvancedSearchTest.php index 12639f6be6..98ad677f3b 100644 --- a/tests/phpunit/WebTest/Contact/AddContactsToEventAdvancedSearchTest.php +++ b/tests/phpunit/WebTest/Contact/AddContactsToEventAdvancedSearchTest.php @@ -24,7 +24,6 @@ +--------------------------------------------------------------------+ */ - require_once 'CiviTest/CiviSeleniumTestCase.php'; class WebTest_Contact_AddContactsToEventAdvancedSearchTest extends CiviSeleniumTestCase { @@ -36,7 +35,6 @@ class WebTest_Contact_AddContactsToEventAdvancedSearchTest extends CiviSeleniumT $this->webtestLogin(); $this->waitForPageToLoad($this->getTimeoutMsec()); - // Advanced Search $this->openCiviPage('contact/search/advanced', 'reset=1', '_qf_Advanced_refresh'); $this->click('_qf_Advanced_refresh'); @@ -62,7 +60,6 @@ class WebTest_Contact_AddContactsToEventAdvancedSearchTest extends CiviSeleniumT $this->assertElementContainsText('css=tr.crm-participant-form-block-source span.description', 'Source for this registration (if applicable).'); - // Clicking save. $this->click('_qf_Participant_upload-bottom'); $this->waitForPageToLoad($this->getTimeoutMsec()); diff --git a/tests/phpunit/WebTest/Contact/AddTest.php b/tests/phpunit/WebTest/Contact/AddTest.php index f37cc787d5..5116b0afc3 100644 --- a/tests/phpunit/WebTest/Contact/AddTest.php +++ b/tests/phpunit/WebTest/Contact/AddTest.php @@ -24,7 +24,6 @@ +--------------------------------------------------------------------+ */ - require_once 'CiviTest/CiviSeleniumTestCase.php'; class WebTest_Contact_AddTest extends CiviSeleniumTestCase { @@ -101,7 +100,8 @@ class WebTest_Contact_AddTest extends CiviSeleniumTestCase { $this->click("address_1_country_id"); $this->select("address_1_country_id", "value=" . $this->webtestGetValidCountryID()); - if($this->assertElementContainsText('address_1', "Latitude")) { + if($this->assertElementContainsText('address_1', "Latitude")) { + $this->type("address_1_geo_code_1", "1234"); $this->type("address_1_geo_code_2", "5678"); } @@ -196,7 +196,6 @@ class WebTest_Contact_AddTest extends CiviSeleniumTestCase { $this->type("phone_1_phone", "444-4444"); $this->select("phone_1_phone_type_id", "value=" . $this->webtestGetFirstValueForOptionGroup('phone_type')); - //fill in IM $this->assertElementContainsText('im_1_provider_id', "Yahoo MSN AIM GTalk Jabber Skype"); $this->type("im_1_name", "testSkype"); @@ -255,7 +254,6 @@ class WebTest_Contact_AddTest extends CiviSeleniumTestCase { $this->waitForElementPresent("preferred_language"); $this->select("preferred_language", "value=fr_FR"); - //Notes section $this->click("notesBlock"); $this->waitForElementPresent("subject"); @@ -491,4 +489,3 @@ class WebTest_Contact_AddTest extends CiviSeleniumTestCase { } } - diff --git a/tests/phpunit/WebTest/Contact/AddViaProfileTest.php b/tests/phpunit/WebTest/Contact/AddViaProfileTest.php index 1f633efedd..3171a25190 100644 --- a/tests/phpunit/WebTest/Contact/AddViaProfileTest.php +++ b/tests/phpunit/WebTest/Contact/AddViaProfileTest.php @@ -24,7 +24,6 @@ +--------------------------------------------------------------------+ */ - require_once 'CiviTest/CiviSeleniumTestCase.php'; class WebTest_Contact_AddViaProfileTest extends CiviSeleniumTestCase { @@ -62,4 +61,3 @@ class WebTest_Contact_AddViaProfileTest extends CiviSeleniumTestCase { } } - diff --git a/tests/phpunit/WebTest/Contact/AddressParsingTest.php b/tests/phpunit/WebTest/Contact/AddressParsingTest.php index 4ecb860ee4..ea85860274 100644 --- a/tests/phpunit/WebTest/Contact/AddressParsingTest.php +++ b/tests/phpunit/WebTest/Contact/AddressParsingTest.php @@ -24,7 +24,6 @@ +--------------------------------------------------------------------+ */ - require_once 'CiviTest/CiviSeleniumTestCase.php'; class WebTest_Contact_AddressParsingTest extends CiviSeleniumTestCase { @@ -161,4 +160,3 @@ class WebTest_Contact_AddressParsingTest extends CiviSeleniumTestCase { } } - diff --git a/tests/phpunit/WebTest/Contact/AdvanceSearchPaneTest.php b/tests/phpunit/WebTest/Contact/AdvanceSearchPaneTest.php index 092afb3a3f..3e2453b7db 100644 --- a/tests/phpunit/WebTest/Contact/AdvanceSearchPaneTest.php +++ b/tests/phpunit/WebTest/Contact/AdvanceSearchPaneTest.php @@ -24,7 +24,6 @@ +--------------------------------------------------------------------+ */ - require_once 'CiviTest/CiviSeleniumTestCase.php'; class WebTest_Contact_AdvanceSearchPaneTest extends CiviSeleniumTestCase { @@ -316,7 +315,8 @@ class WebTest_Contact_AdvanceSearchPaneTest extends CiviSeleniumTestCase { 'locator' => 'contribution_amount_high', 'values' => array('1000'), ), - 'Financial Type' => + 'Financial Type' => + array( 'type' => 'select', 'locator' => 'financial_type_id', diff --git a/tests/phpunit/WebTest/Contact/AdvanceSearchPrivacyOptionsTest.php b/tests/phpunit/WebTest/Contact/AdvanceSearchPrivacyOptionsTest.php index 3aad14ce40..4d4b14722b 100644 --- a/tests/phpunit/WebTest/Contact/AdvanceSearchPrivacyOptionsTest.php +++ b/tests/phpunit/WebTest/Contact/AdvanceSearchPrivacyOptionsTest.php @@ -24,7 +24,6 @@ +--------------------------------------------------------------------+ */ - require_once 'CiviTest/CiviSeleniumTestCase.php'; class WebTest_Contact_AdvanceSearchPrivacyOptionsTest extends CiviSeleniumTestCase { @@ -78,7 +77,6 @@ class WebTest_Contact_AdvanceSearchPrivacyOptionsTest extends CiviSeleniumTestCa $this->click('_qf_Advanced_refresh'); $this->waitForPageToLoad($this->getTimeoutMsec()); - if (!$this->_searchSortNameCriteria($contactsReffOptions['dn_phone_mail']['first_name'], $contactsReffOptions['dn_phone_mail']['last_name']) && $this->_searchSortNameCriteria($contactsReffOptions['dn_trade_sms']['first_name'], $contactsReffOptions['dn_trade_sms']['last_name'])) { $assertCheck = TRUE; } @@ -113,7 +111,7 @@ class WebTest_Contact_AdvanceSearchPrivacyOptionsTest extends CiviSeleniumTestCa $this->_addPrivacyCriteria('include', $privacyOptions['dn_trade_sms'], 'AND', $allPrivacyOptions); $this->click('_qf_Advanced_refresh'); $this->waitForPageToLoad($this->getTimeoutMsec()); - + if (!$this->_searchSortNameCriteria($contactsReffOptions['dn_phone_mail']['first_name'], $contactsReffOptions['dn_phone_mail']['last_name']) && !$this->_searchSortNameCriteria($contactsReffOptions['dn_phone_email']['first_name'], $contactsReffOptions['dn_phone_email']['last_name']) && $this->_searchSortNameCriteria($contactsReffOptions['dn_trade_sms']['first_name'], $contactsReffOptions['dn_trade_sms']['last_name'])) { $assertCheck = TRUE; } @@ -129,13 +127,13 @@ class WebTest_Contact_AdvanceSearchPrivacyOptionsTest extends CiviSeleniumTestCa $this->select('privacy_operator', "{$privacyOperator}"); foreach ($privacyOptions as $privacyOption) { $privacyOptionVal = $this->getOptionVal($privacyOption); - + if (!$this->isElementPresent("xpath=//ul[@id='crmasmList4']//li//span[text()='{$privacyOptionVal}']")) { $this->select('crmasmSelect4', "value={$privacyOption}"); $this->waitForElementPresent("xpath=//ul[@id='crmasmList4']//li//span[text()='{$privacyOptionVal}']"); } } - + foreach ($allPrivacyOptions as $allPrivacyOption) { if (!in_array($allPrivacyOption, $privacyOptions)) { $privacyOptionVal = $this->getOptionVal($allPrivacyOption); @@ -145,17 +143,19 @@ class WebTest_Contact_AdvanceSearchPrivacyOptionsTest extends CiviSeleniumTestCa } } } - + function _searchSortNameCriteria($firstName, $lastName) { //type in the criteria - $this->type("sort_name", "{$lastName}, {$firstName}"); - $this->click("_qf_Advanced_refresh"); + $this->type("sort_name", "{$lastName}, {$firstName}"); + + $this->click("_qf_Advanced_refresh"); + $this->waitForPageToLoad($this->getTimeoutMsec()); - + //return its presence return $this->isElementPresent("xpath=//div[@class='crm-search-results']/table/tbody/tr/td[3]/a[text()='{$lastName}, {$firstName}']"); } - + function getOptionVal($privacyOption) { if ($privacyOption == 'do_not_phone') { $privacyOptionVal = 'Do not phone'; @@ -178,7 +178,7 @@ class WebTest_Contact_AdvanceSearchPrivacyOptionsTest extends CiviSeleniumTestCa function _addIndividual($firstName, $lastName, $options) { $this->openCiviPage('contact/add', 'reset=1&ct=Individual'); - + //fill in first name $this->type("first_name", $firstName); @@ -195,7 +195,7 @@ class WebTest_Contact_AdvanceSearchPrivacyOptionsTest extends CiviSeleniumTestCa //Select preferred method for Privacy $this->click("privacy_{$option}"); } - + // Clicking save. $this->click("_qf_Contact_upload_view"); $this->waitForPageToLoad($this->getTimeoutMsec()); diff --git a/tests/phpunit/WebTest/Contact/AdvancedSearchTest.php b/tests/phpunit/WebTest/Contact/AdvancedSearchTest.php index 369cdf97c2..b1e05f5398 100644 --- a/tests/phpunit/WebTest/Contact/AdvancedSearchTest.php +++ b/tests/phpunit/WebTest/Contact/AdvancedSearchTest.php @@ -24,7 +24,6 @@ +--------------------------------------------------------------------+ */ - require_once 'CiviTest/CiviSeleniumTestCase.php'; class WebTest_Contact_AdvancedSearchTest extends CiviSeleniumTestCase { @@ -393,7 +392,6 @@ class WebTest_Contact_AdvancedSearchTest extends CiviSeleniumTestCase { $this->webtestFillDate("member_end_date_high", "+2 year"); } - // function to fill member search details function addPledgeSearchDetail($firstName) { // fill pledge schedule date range diff --git a/tests/phpunit/WebTest/Contact/AdvancedSearchedRelatedContactTest.php b/tests/phpunit/WebTest/Contact/AdvancedSearchedRelatedContactTest.php index 674ac270bd..50e58ffcbf 100644 --- a/tests/phpunit/WebTest/Contact/AdvancedSearchedRelatedContactTest.php +++ b/tests/phpunit/WebTest/Contact/AdvancedSearchedRelatedContactTest.php @@ -24,7 +24,6 @@ +--------------------------------------------------------------------+ */ - require_once 'CiviTest/CiviSeleniumTestCase.php'; class WebTest_Contact_AdvancedSearchedRelatedContactTest extends CiviSeleniumTestCase { @@ -234,7 +233,7 @@ class WebTest_Contact_AdvancedSearchedRelatedContactTest extends CiviSeleniumTes $this->select('relationship_type_id', "label={$relType}"); //fill in the individual - $this->webtestFillAutocomplete($relatedName); + $this->webtestFillAutocomplete($relatedName); $this->waitForElementPresent("quick-save"); @@ -282,8 +281,7 @@ class WebTest_Contact_AdvancedSearchedRelatedContactTest extends CiviSeleniumTes function testAdvanceSearchForLog() { $this->webtestLogin(); - - + $Pdate = date('F jS, Y h:i:s A', mktime( 0, 0, 0, date( 'm' ), date( 'd' ) - 1, date( 'Y' )) ); $Ndate = date('F jS, Y h:i:s A', mktime( 0, 0, 0, date( 'm' ), date( 'd' ) + 1, date( 'Y' )) ); @@ -294,7 +292,6 @@ class WebTest_Contact_AdvancedSearchedRelatedContactTest extends CiviSeleniumTes $url = $this->parseURL( ); $cid = $url['queryString']['cid']; $this->assertType('numeric', $cid); - //advance search for created contacts $this->openCiviPage('contact/search/advanced', 'reset=1', '_qf_Advanced_refresh'); @@ -309,10 +306,8 @@ class WebTest_Contact_AdvancedSearchedRelatedContactTest extends CiviSeleniumTes $this->assertTrue(True, 'greater than or equal to "{$Pdate}" AND less than or equal to "{$Ndate}"'); $value = "$lastNameSoft, $firstNameSoft"; $this->verifyText("xpath= id('rowid{$cid}')/td[3]/a", preg_quote($value)); - -} - +} } diff --git a/tests/phpunit/WebTest/Contact/ContactReferenceFieldTest.php b/tests/phpunit/WebTest/Contact/ContactReferenceFieldTest.php index 0068db6bc0..fb219d8851 100644 --- a/tests/phpunit/WebTest/Contact/ContactReferenceFieldTest.php +++ b/tests/phpunit/WebTest/Contact/ContactReferenceFieldTest.php @@ -24,7 +24,6 @@ +--------------------------------------------------------------------+ */ - require_once 'CiviTest/CiviSeleniumTestCase.php'; class WebTest_Contact_ContactReferenceFieldTest extends CiviSeleniumTestCase { @@ -35,7 +34,6 @@ class WebTest_Contact_ContactReferenceFieldTest extends CiviSeleniumTestCase { function testContactReferenceField() { $this->webtestLogin(); - /* add new group */ $this->openCiviPage('group/add', 'reset=1', '_qf_Edit_upload'); @@ -144,7 +142,6 @@ class WebTest_Contact_ContactReferenceFieldTest extends CiviSeleniumTestCase { preg_match('/&id=([0-9]+)/', $this->getLocation(), $matches); $contactRefFieldID1 = $matches[1]; - $this->openCiviPage('admin/custom/group/field', "reset=1&action=browse&gid={$customGroupId}"); $this->click("xpath=//div[@id='field_page']//table/tbody/tr[2]/td[8]/span[1]/a[text()='Edit Field']"); @@ -164,7 +161,6 @@ class WebTest_Contact_ContactReferenceFieldTest extends CiviSeleniumTestCase { $this->assertElementContainsText("css=div.ac_results-inner li", "{$contact1}@example.com"); $this->assertElementNotContainsText("css=div.ac_results-inner ul li", "{$contact2}@example.com"); - $this->openCiviPage('admin/custom/group', "action=preview&reset=1&id={$customGroupId}"); $this->type("custom_{$contactRefFieldID2}_-1", $org1); diff --git a/tests/phpunit/WebTest/Contact/ContactTagTest.php b/tests/phpunit/WebTest/Contact/ContactTagTest.php index 2493acfd0f..0da7371294 100644 --- a/tests/phpunit/WebTest/Contact/ContactTagTest.php +++ b/tests/phpunit/WebTest/Contact/ContactTagTest.php @@ -24,7 +24,6 @@ +--------------------------------------------------------------------+ */ - require_once 'CiviTest/CiviSeleniumTestCase.php'; class WebTest_Contact_ContactTagTest extends CiviSeleniumTestCase { @@ -153,4 +152,3 @@ class WebTest_Contact_ContactTagTest extends CiviSeleniumTestCase { } } - diff --git a/tests/phpunit/WebTest/Contact/CreateCmsUserFromContactTest.php b/tests/phpunit/WebTest/Contact/CreateCmsUserFromContactTest.php index 418be7e74b..78b611f94e 100644 --- a/tests/phpunit/WebTest/Contact/CreateCmsUserFromContactTest.php +++ b/tests/phpunit/WebTest/Contact/CreateCmsUserFromContactTest.php @@ -24,10 +24,8 @@ +--------------------------------------------------------------------+ */ - require_once 'CiviTest/CiviSeleniumTestCase.php'; - //Tests for the ability to add a CMS user from a contact's record //See http://issues.civicrm.org/jira/browse/CRM-8723 class WebTest_Contact_CreateCmsUserFromContactTest extends CiviSeleniumTestCase { @@ -36,8 +34,6 @@ class WebTest_Contact_CreateCmsUserFromContactTest extends CiviSeleniumTestCase parent::setUp(); } - - //Test that option to create a cms user is present on a contact who does not //have a cms account already( in this case, a new contact ) function testCreateContactLinkPresent() { @@ -102,7 +98,6 @@ class WebTest_Contact_CreateCmsUserFromContactTest extends CiviSeleniumTestCase $this->assertElementContainsText("msgbox", "This username is currently available", "Available username is indicated as being taken"); } - //Test form submission when the username is taken function testTakenUsernameSubmission() { @@ -113,7 +108,6 @@ class WebTest_Contact_CreateCmsUserFromContactTest extends CiviSeleniumTestCase list($cid, $firstName, $lastName, $email) = $this->_createUserAndGotoForm(); $password = 'abc123'; - //submit the form with the bad username $username = $this->settings->adminUsername; $this->_fillCMSUserForm($username, $password, $password); @@ -138,7 +132,6 @@ class WebTest_Contact_CreateCmsUserFromContactTest extends CiviSeleniumTestCase list($cid, $firstName, $lastName, $email) = $this->_createUserAndGotoForm(); $password = 'abc123'; - //submit with mismatch passwords $username = $this->settings->adminUsername; $this->_fillCMSUserForm($username, $password, $password . "mismatch"); @@ -162,7 +155,6 @@ class WebTest_Contact_CreateCmsUserFromContactTest extends CiviSeleniumTestCase list($cid, $firstName, $lastName, $email) = $this->_createUserAndGotoForm(); $password = 'abc123'; - //submit with mismatch passwords $username = $this->settings->adminUsername; $this->click("_qf_Useradd_next-bottom"); @@ -177,7 +169,6 @@ class WebTest_Contact_CreateCmsUserFromContactTest extends CiviSeleniumTestCase //the civicrm message should say password is required $this->assertElementContainsText("css=#crm-notification-container", "Password is required", "The CiviCRM messae does not indicate that the password is required"); - //check that no user was created; $results = $this->webtest_civicrm_api("UFMatch", "get", array('contact_id' => $cid)); $this->assertTrue($results['count'] == 0); @@ -193,7 +184,6 @@ class WebTest_Contact_CreateCmsUserFromContactTest extends CiviSeleniumTestCase list($cid, $firstName, $lastName, $email) = $this->_createUserAndGotoForm(); $password = 'abc123'; - //submit with matching passwords $this->_fillCMSUserForm($firstName, $password, $password); $this->click("_qf_Useradd_next-bottom"); diff --git a/tests/phpunit/WebTest/Contact/CustomDataAddTest.php b/tests/phpunit/WebTest/Contact/CustomDataAddTest.php index 00017bb649..7403bf6be9 100644 --- a/tests/phpunit/WebTest/Contact/CustomDataAddTest.php +++ b/tests/phpunit/WebTest/Contact/CustomDataAddTest.php @@ -24,7 +24,6 @@ +--------------------------------------------------------------------+ */ - require_once 'CiviTest/CiviSeleniumTestCase.php'; class WebTest_Contact_CustomDataAddTest extends CiviSeleniumTestCase { @@ -70,7 +69,6 @@ class WebTest_Contact_CustomDataAddTest extends CiviSeleniumTestCase { $this->type("option_label_3", $checkboxOptionLabel3); $this->type("option_value_3", "3"); - //enter options per line $this->type("options_per_line", "2"); @@ -345,4 +343,3 @@ class WebTest_Contact_CustomDataAddTest extends CiviSeleniumTestCase { } - diff --git a/tests/phpunit/WebTest/Contact/DeceasedContactsAdvancedSearchTest.php b/tests/phpunit/WebTest/Contact/DeceasedContactsAdvancedSearchTest.php index 49d8f39c4b..5e43f93162 100644 --- a/tests/phpunit/WebTest/Contact/DeceasedContactsAdvancedSearchTest.php +++ b/tests/phpunit/WebTest/Contact/DeceasedContactsAdvancedSearchTest.php @@ -24,7 +24,6 @@ +--------------------------------------------------------------------+ */ - require_once 'CiviTest/CiviSeleniumTestCase.php'; class WebTest_Contact_DeceasedContactsAdvancedSearchTest extends CiviSeleniumTestCase { @@ -66,7 +65,7 @@ class WebTest_Contact_DeceasedContactsAdvancedSearchTest extends CiviSeleniumTes $this->assertElementContainsText('search-status', '2 Contacts'); $this->click("toggleSelect"); $this->waitForTextPresent('2 Selected records only'); - + $this->select('task', 'label=Remove Contacts from Group'); $this->click("xpath=//div[@id='search-status']/table/tbody/tr[3]/td/ul/input[2]"); $this->waitForElementPresent('_qf_RemoveFromGroup_back-bottom'); diff --git a/tests/phpunit/WebTest/Contact/DupeContactTest.php b/tests/phpunit/WebTest/Contact/DupeContactTest.php index b4d8fd8d40..40c5627d1a 100644 --- a/tests/phpunit/WebTest/Contact/DupeContactTest.php +++ b/tests/phpunit/WebTest/Contact/DupeContactTest.php @@ -24,7 +24,6 @@ +--------------------------------------------------------------------+ */ - require_once 'CiviTest/CiviSeleniumTestCase.php'; class WebTest_Contact_DupeContactTest extends CiviSeleniumTestCase { @@ -69,7 +68,6 @@ class WebTest_Contact_DupeContactTest extends CiviSeleniumTestCase { //contact details section - //fill in first name $this->type("first_name", "$firstName"); @@ -87,4 +85,3 @@ class WebTest_Contact_DupeContactTest extends CiviSeleniumTestCase { } } - diff --git a/tests/phpunit/WebTest/Contact/GroupAddTest.php b/tests/phpunit/WebTest/Contact/GroupAddTest.php index 6b8e438ba9..d65a98c267 100644 --- a/tests/phpunit/WebTest/Contact/GroupAddTest.php +++ b/tests/phpunit/WebTest/Contact/GroupAddTest.php @@ -24,7 +24,6 @@ +--------------------------------------------------------------------+ */ - require_once 'CiviTest/CiviSeleniumTestCase.php'; class WebTest_Contact_GroupAddTest extends CiviSeleniumTestCase { diff --git a/tests/phpunit/WebTest/Contact/InlineFieldsEditTest.php b/tests/phpunit/WebTest/Contact/InlineFieldsEditTest.php index f4d4a4297b..3784109498 100644 --- a/tests/phpunit/WebTest/Contact/InlineFieldsEditTest.php +++ b/tests/phpunit/WebTest/Contact/InlineFieldsEditTest.php @@ -24,7 +24,6 @@ +--------------------------------------------------------------------+ */ - require_once 'CiviTest/CiviSeleniumTestCase.php'; class WebTest_Contact_InlineFieldsEditTest extends CiviSeleniumTestCase { diff --git a/tests/phpunit/WebTest/Contact/MergeContactsTest.php b/tests/phpunit/WebTest/Contact/MergeContactsTest.php index eaf9642713..9ba0fb64a7 100644 --- a/tests/phpunit/WebTest/Contact/MergeContactsTest.php +++ b/tests/phpunit/WebTest/Contact/MergeContactsTest.php @@ -24,7 +24,6 @@ +--------------------------------------------------------------------+ */ - require_once 'CiviTest/CiviSeleniumTestCase.php'; class WebTest_Contact_MergeContactsTest extends CiviSeleniumTestCase { @@ -211,7 +210,6 @@ class WebTest_Contact_MergeContactsTest extends CiviSeleniumTestCase { // button at the end of this page to show up, to make sure it's fully loaded. $this->waitForElementPresent("_qf_Activity_upload"); - // ...and verifying if the page contains properly formatted display name for chosen contact. $this->assertTrue($this->isTextPresent("Anderson, " . $withContact), "Contact not found in line " . __LINE__); @@ -268,7 +266,6 @@ class WebTest_Contact_MergeContactsTest extends CiviSeleniumTestCase { $this->assertTrue($this->isTextPresent("Activity '$subject' has been saved."), "Status message didn't show up after saving!"); } - function testMergeTest() { $this->webtestLogin(); diff --git a/tests/phpunit/WebTest/Contact/MultipleContactSubTypes.php b/tests/phpunit/WebTest/Contact/MultipleContactSubTypes.php index d34f88b2d1..60f471f88e 100644 --- a/tests/phpunit/WebTest/Contact/MultipleContactSubTypes.php +++ b/tests/phpunit/WebTest/Contact/MultipleContactSubTypes.php @@ -24,7 +24,6 @@ +--------------------------------------------------------------------+ */ - require_once 'CiviTest/CiviSeleniumTestCase.php'; class WebTest_Contact_MultipleContactSubTypes extends CiviSeleniumTestCase { @@ -250,5 +249,3 @@ class WebTest_Contact_MultipleContactSubTypes extends CiviSeleniumTestCase { } } - - diff --git a/tests/phpunit/WebTest/Contact/PrevNextTest.php b/tests/phpunit/WebTest/Contact/PrevNextTest.php index cd3e0ca7aa..cc4fef680e 100644 --- a/tests/phpunit/WebTest/Contact/PrevNextTest.php +++ b/tests/phpunit/WebTest/Contact/PrevNextTest.php @@ -24,7 +24,6 @@ +--------------------------------------------------------------------+ */ - require_once 'CiviTest/CiviSeleniumTestCase.php'; class WebTest_Contact_PrevNextTest extends CiviSeleniumTestCase { @@ -35,7 +34,6 @@ class WebTest_Contact_PrevNextTest extends CiviSeleniumTestCase { function testPrevNext() { $this->webtestLogin(); - /* add new group */ $this->openCiviPage('group/add', 'reset=1', '_qf_Edit_upload'); diff --git a/tests/phpunit/WebTest/Contact/PrivacyOptionSearchTest.php b/tests/phpunit/WebTest/Contact/PrivacyOptionSearchTest.php index f46b81cebb..e2905e09a5 100644 --- a/tests/phpunit/WebTest/Contact/PrivacyOptionSearchTest.php +++ b/tests/phpunit/WebTest/Contact/PrivacyOptionSearchTest.php @@ -24,7 +24,6 @@ +--------------------------------------------------------------------+ */ - require_once 'CiviTest/CiviSeleniumTestCase.php'; class WebTest_Contact_PrivacyOptionSearchTest extends CiviSeleniumTestCase { @@ -60,7 +59,7 @@ class WebTest_Contact_PrivacyOptionSearchTest extends CiviSeleniumTestCase { $this->type('last_name', $lname1); $email1 = $fname1 . '@example.org'; $this->type('email_1_email', $email1); - + //click 'Communication Preferences' Panel $this->click("commPrefs"); $this->waitForElementPresent("preferred_mail_format"); diff --git a/tests/phpunit/WebTest/Contact/ProfileChecksumTest.php b/tests/phpunit/WebTest/Contact/ProfileChecksumTest.php index 23910827af..f1e33f6ad8 100644 --- a/tests/phpunit/WebTest/Contact/ProfileChecksumTest.php +++ b/tests/phpunit/WebTest/Contact/ProfileChecksumTest.php @@ -24,7 +24,6 @@ +--------------------------------------------------------------------+ */ - require_once 'CiviTest/CiviSeleniumTestCase.php'; class WebTest_Contact_ProfileChecksumTest extends CiviSeleniumTestCase { diff --git a/tests/phpunit/WebTest/Contact/RelationshipAddTest.php b/tests/phpunit/WebTest/Contact/RelationshipAddTest.php index 09a0b8bb23..6f63cc55d6 100644 --- a/tests/phpunit/WebTest/Contact/RelationshipAddTest.php +++ b/tests/phpunit/WebTest/Contact/RelationshipAddTest.php @@ -24,7 +24,6 @@ +--------------------------------------------------------------------+ */ - require_once 'CiviTest/CiviSeleniumTestCase.php'; class WebTest_Contact_RelationshipAddTest extends CiviSeleniumTestCase { @@ -355,4 +354,3 @@ class WebTest_Contact_RelationshipAddTest extends CiviSeleniumTestCase { } } - diff --git a/tests/phpunit/WebTest/Contact/SearchBuilderTest.php b/tests/phpunit/WebTest/Contact/SearchBuilderTest.php index 0802fc1ef4..ef0a10b46f 100644 --- a/tests/phpunit/WebTest/Contact/SearchBuilderTest.php +++ b/tests/phpunit/WebTest/Contact/SearchBuilderTest.php @@ -24,7 +24,6 @@ +--------------------------------------------------------------------+ */ - require_once 'CiviTest/CiviSeleniumTestCase.php'; class WebTest_Contact_SearchBuilderTest extends CiviSeleniumTestCase { @@ -32,7 +31,6 @@ class WebTest_Contact_SearchBuilderTest extends CiviSeleniumTestCase { parent::setUp(); } - function testSearchBuilderOptions() { $this->webtestLogin(); @@ -248,10 +246,12 @@ class WebTest_Contact_SearchBuilderTest extends CiviSeleniumTestCase { $this->waitForElementPresent("css=#crm_search_value_{$set}_{$row} select option + option"); foreach ($value as $val) { if ($op != 'IN') { - $select = 'select'; + $select = 'select'; + } else { - $select = 'addSelection'; + $select = 'addSelection'; + } $this->$select("css=#crm_search_value_{$set}_{$row} select", "label=$val"); } @@ -352,7 +352,7 @@ class WebTest_Contact_SearchBuilderTest extends CiviSeleniumTestCase { // somewhere at the end of page and use waitForElementPresent on it - this assures you, that whole // page contents loaded and you can continue your test execution. $this->webtestLogin(); - + // add financial type $financialTypeName1 = 'Financial Type' . substr(sha1(rand()), 0, 5);; $financialTypeName2 = 'Financial Type' . substr(sha1(rand()), 0, 5);; @@ -389,19 +389,19 @@ class WebTest_Contact_SearchBuilderTest extends CiviSeleniumTestCase { $this->clickLink('_qf_Contribution_upload_new', '_qf_Contribution_upload_new'); } $this->openCiviPage("contact/search/builder", "reset=1", "_qf_Builder_refresh"); - + $this->enterValues(1, 1, 'Contribution', 'Financial Type', NULL, '=', array($financialTypeName1)); $this->click('_qf_Builder_refresh'); $this->waitForPageToLoad($this->getTimeoutMsec()); - + $this->assertTrue($this->isTextPresent('3 Contacts'), 'Missing text: ' . '3 Contacts'); - + $this->click("xpath=//div[@class='crm-accordion-header crm-master-accordion-header']"); $this->enterValues(1, 1, 'Contribution', 'Financial Type', NULL, '=', array($financialTypeName2)); $this->click('_qf_Builder_refresh'); $this->waitForPageToLoad($this->getTimeoutMsec()); $this->assertTrue($this->isTextPresent('3 Contacts'), 'Missing text: ' . '3 Contacts'); - + $this->click("xpath=//div[@class='crm-accordion-header crm-master-accordion-header']"); $this->enterValues(1, 1, 'Contribution', 'Financial Type', NULL, 'IN', array($financialTypeName1, $financialTypeName2)); $this->click('_qf_Builder_refresh'); diff --git a/tests/phpunit/WebTest/Contact/SearchTest.php b/tests/phpunit/WebTest/Contact/SearchTest.php index 61fad92512..638aae67be 100644 --- a/tests/phpunit/WebTest/Contact/SearchTest.php +++ b/tests/phpunit/WebTest/Contact/SearchTest.php @@ -24,7 +24,6 @@ +--------------------------------------------------------------------+ */ - require_once 'CiviTest/CiviSeleniumTestCase.php'; class WebTest_Contact_SearchTest extends CiviSeleniumTestCase { @@ -188,7 +187,6 @@ class WebTest_Contact_SearchTest extends CiviSeleniumTestCase { $childGroupName = 'Childgroup_' . substr(sha1(rand()), 0, 7); $this->WebtestAddGroup($childGroupName, $parentGroupName); - // Adding Parent group contact $firstName = substr(sha1(rand()), 0, 7); $this->webtestAddContact($firstName, "Smith", "$firstName.smith@example.org"); diff --git a/tests/phpunit/WebTest/Contact/SearchbyDateFilterTest.php b/tests/phpunit/WebTest/Contact/SearchbyDateFilterTest.php index 691b6aea4e..82e57abf88 100644 --- a/tests/phpunit/WebTest/Contact/SearchbyDateFilterTest.php +++ b/tests/phpunit/WebTest/Contact/SearchbyDateFilterTest.php @@ -24,7 +24,6 @@ +--------------------------------------------------------------------+ */ - require_once 'CiviTest/CiviSeleniumTestCase.php'; class WebTest_Contact_SearchbyDateFilterTest extends CiviSeleniumTestCase { @@ -55,7 +54,7 @@ class WebTest_Contact_SearchbyDateFilterTest extends CiviSeleniumTestCase { // check the opened panes. $this->_checkOpenedPanes(array($pane)); } - + } function testIndividualSearchPage(){ @@ -71,7 +70,8 @@ class WebTest_Contact_SearchbyDateFilterTest extends CiviSeleniumTestCase { $this->select("contribution_date_relative","value=earlier.quarter"); $this->click("_qf_Search_refresh"); $this->waitForPageToLoad(2 * $this->getTimeoutMsec()); - $this->select("contribution_date_relative","value=ending.year"); + $this->select("contribution_date_relative","value=ending.year"); + $this->click("_qf_Search_refresh"); $this->waitForPageToLoad(2 * $this->getTimeoutMsec()); @@ -279,7 +279,7 @@ class WebTest_Contact_SearchbyDateFilterTest extends CiviSeleniumTestCase { ), ), ), - + 'contribution' => array( 'headerLocator' => 'div#CiviContribute', @@ -323,7 +323,7 @@ class WebTest_Contact_SearchbyDateFilterTest extends CiviSeleniumTestCase { 'locator' => 'member_join_date_relative', 'values' => array('Previous Year'), ), - + ), ), 'event' => @@ -341,8 +341,7 @@ class WebTest_Contact_SearchbyDateFilterTest extends CiviSeleniumTestCase { ), ), ), - - + ); } diff --git a/tests/phpunit/WebTest/Contact/SignatureTest.php b/tests/phpunit/WebTest/Contact/SignatureTest.php index a4943857a4..4abf33fb59 100644 --- a/tests/phpunit/WebTest/Contact/SignatureTest.php +++ b/tests/phpunit/WebTest/Contact/SignatureTest.php @@ -24,7 +24,6 @@ +--------------------------------------------------------------------+ */ - require_once 'CiviTest/CiviSeleniumTestCase.php'; class WebTest_Contact_SignatureTest extends CiviSeleniumTestCase { diff --git a/tests/phpunit/WebTest/Contact/TagAddTest.php b/tests/phpunit/WebTest/Contact/TagAddTest.php index f43ecdfb17..3cb853cb57 100644 --- a/tests/phpunit/WebTest/Contact/TagAddTest.php +++ b/tests/phpunit/WebTest/Contact/TagAddTest.php @@ -24,7 +24,6 @@ +--------------------------------------------------------------------+ */ - require_once 'CiviTest/CiviSeleniumTestCase.php'; class WebTest_Contact_TagAddTest extends CiviSeleniumTestCase { @@ -109,4 +108,3 @@ class WebTest_Contact_TagAddTest extends CiviSeleniumTestCase { } } - diff --git a/tests/phpunit/WebTest/Contact/TagSetSearchTest.php b/tests/phpunit/WebTest/Contact/TagSetSearchTest.php index 8ce1be0502..f02bf56b7b 100644 --- a/tests/phpunit/WebTest/Contact/TagSetSearchTest.php +++ b/tests/phpunit/WebTest/Contact/TagSetSearchTest.php @@ -24,7 +24,6 @@ +--------------------------------------------------------------------+ */ - require_once 'CiviTest/CiviSeleniumTestCase.php'; class WebTest_Contact_TagSetSearchTest extends CiviSeleniumTestCase { @@ -35,7 +34,6 @@ class WebTest_Contact_TagSetSearchTest extends CiviSeleniumTestCase { function testTagSetSearch() { $this->webtestLogin(); - $tagSet1 = $this->_testAddTagSet(); $tagSet2 = $this->_testAddTagSet(); @@ -70,7 +68,6 @@ class WebTest_Contact_TagSetSearchTest extends CiviSeleniumTestCase { $this->mouseDownAt("css=li.token-input-dropdown-item2-facebook"); $this->waitForTextPresent($tag2); - // Individual 2 $contact2 = substr(sha1(rand()), 0, 7); $this->webtestAddContact($contact2, "Anderson", "{$contact2}@example.com"); @@ -89,7 +86,6 @@ class WebTest_Contact_TagSetSearchTest extends CiviSeleniumTestCase { $this->mouseDownAt("css=li.token-input-dropdown-item2-facebook"); $this->waitForTextPresent($tag1); - // Go to Advance search. $this->openCiviPage('contact/search/advanced', 'reset=1'); diff --git a/tests/phpunit/WebTest/Contact/TaskActionAddToGroupTest.php b/tests/phpunit/WebTest/Contact/TaskActionAddToGroupTest.php index 7f678fb3de..372f9e56d8 100644 --- a/tests/phpunit/WebTest/Contact/TaskActionAddToGroupTest.php +++ b/tests/phpunit/WebTest/Contact/TaskActionAddToGroupTest.php @@ -24,7 +24,6 @@ +--------------------------------------------------------------------+ */ - require_once 'CiviTest/CiviSeleniumTestCase.php'; class WebTest_Contact_TaskActionAddToGroupTest extends CiviSeleniumTestCase { @@ -143,4 +142,3 @@ class WebTest_Contact_TaskActionAddToGroupTest extends CiviSeleniumTestCase { } } - diff --git a/tests/phpunit/WebTest/Contact/TaskActionSendMassMailing.php b/tests/phpunit/WebTest/Contact/TaskActionSendMassMailing.php index 2362f4887d..4baf6715fd 100644 --- a/tests/phpunit/WebTest/Contact/TaskActionSendMassMailing.php +++ b/tests/phpunit/WebTest/Contact/TaskActionSendMassMailing.php @@ -24,7 +24,6 @@ +--------------------------------------------------------------------+ */ - require_once 'CiviTest/CiviSeleniumTestCase.php'; class WebTest_Contact_TaskActionSendMassMailing extends CiviSeleniumTestCase { @@ -131,4 +130,3 @@ class WebTest_Contact_TaskActionSendMassMailing extends CiviSeleniumTestCase { } } - diff --git a/tests/phpunit/WebTest/Contact/TaskActionSendSMS.php b/tests/phpunit/WebTest/Contact/TaskActionSendSMS.php index 8e1a36074c..6881b08a4d 100644 --- a/tests/phpunit/WebTest/Contact/TaskActionSendSMS.php +++ b/tests/phpunit/WebTest/Contact/TaskActionSendSMS.php @@ -24,7 +24,6 @@ +--------------------------------------------------------------------+ */ - require_once 'CiviTest/CiviSeleniumTestCase.php'; class WebTest_Contact_TaskActionSendSMS extends CiviSeleniumTestCase { @@ -116,4 +115,3 @@ class WebTest_Contact_TaskActionSendSMS extends CiviSeleniumTestCase { } } - diff --git a/tests/phpunit/WebTest/Contact/UpdateProfileTest.php b/tests/phpunit/WebTest/Contact/UpdateProfileTest.php index 1ff31e6ca7..920d7f4977 100644 --- a/tests/phpunit/WebTest/Contact/UpdateProfileTest.php +++ b/tests/phpunit/WebTest/Contact/UpdateProfileTest.php @@ -24,7 +24,6 @@ +--------------------------------------------------------------------+ */ - require_once 'CiviTest/CiviSeleniumTestCase.php'; class WebTest_Contact_UpdateProfileTest extends CiviSeleniumTestCase { @@ -76,4 +75,3 @@ class WebTest_Contact_UpdateProfileTest extends CiviSeleniumTestCase { } } - diff --git a/tests/phpunit/WebTest/Contribute/AddBatchesTest.php b/tests/phpunit/WebTest/Contribute/AddBatchesTest.php index b56f1edb36..43ee26ff6c 100644 --- a/tests/phpunit/WebTest/Contribute/AddBatchesTest.php +++ b/tests/phpunit/WebTest/Contribute/AddBatchesTest.php @@ -24,7 +24,6 @@ +--------------------------------------------------------------------+ */ - require_once 'CiviTest/CiviSeleniumTestCase.php'; class WebTest_Contribute_AddBatchesTest extends CiviSeleniumTestCase { @@ -53,15 +52,17 @@ class WebTest_Contribute_AddBatchesTest extends CiviSeleniumTestCase { 'first_name' => 'Ma'.substr(sha1(rand()), 0, 7), 'last_name' => 'An'.substr(sha1(rand()), 0, 7), 'financial_type' => 'Donation', - 'amount' => 100, + 'amount' => 100, + ); $this->_fillData($data[$i], $i, "Contribution"); - } + } + $this->click("_qf_Entry_cancel"); $this->waitForPageToLoad($this->getTimeoutMsec()); $this->_verifyData($data, "Contribution"); } - + function testBatchAddMembership() { $this->webtestLogin(); $itemCount = 5; @@ -80,7 +81,7 @@ class WebTest_Contribute_AddBatchesTest extends CiviSeleniumTestCase { $this->type("total", 500); $this->click("_qf_Batch_next"); $this->waitForPageToLoad($this->getTimeoutMsec()); - + // Add Contact Details $data = array(); for ($i=1; $i<=$itemCount; $i++ ) { @@ -88,22 +89,22 @@ class WebTest_Contribute_AddBatchesTest extends CiviSeleniumTestCase { 'first_name' => 'Ma'.substr(sha1(rand()), 0, 7), 'last_name' => 'An'.substr(sha1(rand()), 0, 7), 'membership_type' => 'Default Organization', - 'amount' => 100, + 'amount' => 100, + 'financial_type' => 'Member Dues', ); $this->_fillData($data[$i], $i, "Membership"); } $this->click("_qf_Entry_cancel"); - $this->waitForPageToLoad($this->getTimeoutMsec()); + $this->waitForPageToLoad($this->getTimeoutMsec()); + $this->_verifyData($data, "Membership"); } - - 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}"); - + if ($type == "Contribution") { $this->select("field_{$row}_financial_type", $data['financial_type']); $this->type("field_{$row}_total_amount", $data['amount']); @@ -114,7 +115,7 @@ class WebTest_Contribute_AddBatchesTest extends CiviSeleniumTestCase { $this->click("field[{$row}][send_receipt]"); $this->click("field_{$row}_invoice_id"); $this->type("field_{$row}_invoice_id", substr(sha1(rand()), 0, 10)); - + } elseif ($type == "Membership") { $this->select("field[{$row}][membership_type][0]", $data['membership_type']); $this->webtestFillDate("field_{$row}_join_date", "now"); @@ -122,7 +123,8 @@ class WebTest_Contribute_AddBatchesTest extends CiviSeleniumTestCase { $this->webtestFillDate("field_{$row}_membership_end_date", "+1 month"); $this->type("field_{$row}_membership_source", substr(sha1(rand()), 0, 10)); $this->click("field[{$row}][send_receipt]"); - $this->select("field_{$row}_financial_type", $data['financial_type']); + $this->select("field_{$row}_financial_type", $data['financial_type']); + $this->webtestFillDateTime("field_{$row}_receive_date", "+1 week"); $this->select("field_{$row}_payment_instrument", "Check"); $this->type("field_{$row}_check_number", rand()); @@ -141,12 +143,13 @@ class WebTest_Contribute_AddBatchesTest extends CiviSeleniumTestCase { 'Financial Type' => $data['financial_type'], 'Total Amount' => $data['amount'], 'Contribution Status' => 'Completed', - ); + ); + $this->webtestVerifyTabularData($expected); } elseif ($type == "Membership") { $this->openCiviPage("member/search", "reset=1", "member_join_date_low"); - + // select contact $this->type("sort_name", "{$data['first_name']} {$data['last_name']}"); $this->clickLink("_qf_Search_refresh", "xpath=//div[@id='memberSearch']//table//tbody/tr[1]/td[11]/span/a[text()='View']"); @@ -168,11 +171,12 @@ class WebTest_Contribute_AddBatchesTest extends CiviSeleniumTestCase { 'Financial Type' => $data['financial_type'], 'Total Amount' => $data['amount'], 'Contribution Status' => 'Completed', - ); + ); + $this->webtestVerifyTabularData($expected); } } - + function _verifyData($data, $type) { $this->waitForElementPresent("xpath=//div[@id='crm-batch-selector_wrapper']//table//tbody/tr[1]/td[7]/span/a[text()='Enter records']"); $this->clickLink("xpath=//div[@id='crm-batch-selector_wrapper']//table//tbody/tr[1]/td[7]/span/a[text()='Enter records']", "_qf_Entry_upload"); @@ -197,11 +201,11 @@ class WebTest_Contribute_AddBatchesTest extends CiviSeleniumTestCase { $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; diff --git a/tests/phpunit/WebTest/Contribute/AddPricesetTest.php b/tests/phpunit/WebTest/Contribute/AddPricesetTest.php index 8a171f0790..7887c98833 100644 --- a/tests/phpunit/WebTest/Contribute/AddPricesetTest.php +++ b/tests/phpunit/WebTest/Contribute/AddPricesetTest.php @@ -24,20 +24,19 @@ +--------------------------------------------------------------------+ */ - require_once 'CiviTest/CiviSeleniumTestCase.php'; class WebTest_Contribute_AddPricesetTest extends CiviSeleniumTestCase { protected function setUp() { parent::setUp(); } - + function testAddPriceSet() { // Log in using webtestLogin() method $this->webtestLogin(); //add financial type of account type expense - + $financialType = $this->_testAddFinancialType(); $setTitle = 'Conference Fees - ' . substr(sha1(rand()), 0, 7); @@ -91,7 +90,7 @@ class WebTest_Contribute_AddPricesetTest extends CiviSeleniumTestCase { $validateStrings[] = $financialType; foreach ($fields as $label => $type) { $validateStrings[] = $label; - + $this->type('label', $label); $this->select('html_type', "value={$type}"); @@ -106,7 +105,7 @@ class WebTest_Contribute_AddPricesetTest extends CiviSeleniumTestCase { $this->check('is_required'); } break; - + case 'Select': $options = array( 1 => array('label' => 'Chicken', @@ -122,7 +121,7 @@ class WebTest_Contribute_AddPricesetTest extends CiviSeleniumTestCase { $this->webtestFillDateTime('expire_on', '-1 week'); } break; - + case 'Radio': $options = array( 1 => array('label' => 'Yes', @@ -139,7 +138,7 @@ class WebTest_Contribute_AddPricesetTest extends CiviSeleniumTestCase { $this->webtestFillDateTime('active_on', '-1 week'); } break; - + case 'CheckBox': $options = array( 1 => array('label' => 'First Night', @@ -155,7 +154,7 @@ class WebTest_Contribute_AddPricesetTest extends CiviSeleniumTestCase { $this->webtestFillDateTime('expire_on', '+1 week'); } break; - + default: break; } @@ -163,7 +162,7 @@ class WebTest_Contribute_AddPricesetTest extends CiviSeleniumTestCase { $this->clickLink('_qf_Field_next_new-bottom', '_qf_Field_next-bottom'); } } - + function _testAddFinancialType() { // Add new Financial Account $orgName = 'Alberta '.substr(sha1(rand()), 0, 7); @@ -176,12 +175,12 @@ class WebTest_Contribute_AddPricesetTest extends CiviSeleniumTestCase { $isTax = TRUE; $taxRate = 9; $isDefault = FALSE; - + //Add new organisation if($orgName) { $this->webtestAddOrganization($orgName); } - + $this->_testAddFinancialAccount($financialAccountTitle, $financialAccountDescription, $accountingCode, @@ -194,7 +193,7 @@ class WebTest_Contribute_AddPricesetTest extends CiviSeleniumTestCase { $isDefault ); $this->waitForElementPresent("xpath=//table/tbody//tr/td[1][text()='{$financialAccountTitle}']/../td[9]/span/a[text()='Edit']"); - + //Add new Financial Type $financialType['name'] = 'FinancialType '.substr(sha1(rand()), 0, 4); $financialType['is_deductible'] = TRUE; @@ -202,7 +201,8 @@ class WebTest_Contribute_AddPricesetTest extends CiviSeleniumTestCase { $this->addeditFinancialType($financialType); $accountRelationship = "Income Account is"; - $expected[] = array('financial_account' => $financialAccountTitle, + $expected[] = array('financial_account' => $financialAccountTitle, + 'account_relationship' => $accountRelationship ); @@ -218,7 +218,7 @@ class WebTest_Contribute_AddPricesetTest extends CiviSeleniumTestCase { $this->assertTrue($this->isTextPresent($text), 'Missing text: ' . $text); return $financialType['name']; } - + function _testVerifyPriceSet($validateStrings, $sid) { // verify Price Set at Preview page // start at Manage Price Sets listing @@ -236,12 +236,12 @@ class WebTest_Contribute_AddPricesetTest extends CiviSeleniumTestCase { //add financial type of account type expense $financialType = $this->_testAddFinancialType(); - + $setTitle = 'Conference Fees - ' . substr(sha1(rand()), 0, 7); $usedFor = 'Contribution'; $setHelp = 'Select your conference options.'; $this->_testAddSet($setTitle, $usedFor, $setHelp, $financialType); - + // Get the price set id ($sid) by retrieving and parsing the URL of the New Price Field form // which is where we are after adding Price Set. $elements = $this->parseURL(); @@ -261,7 +261,6 @@ class WebTest_Contribute_AddPricesetTest extends CiviSeleniumTestCase { $this->_testVerifyPriceSet($validateStrings, $sid); $this->openCiviPage("contribute/add", "reset=1&action=add&context=standalone", '_qf_Contribution_upload'); - // create new contact using dialog $firstName = substr(sha1(rand()), 0, 7); $this->webtestNewDialogContact($firstName, 'Contributor', $firstName . '@example.com'); @@ -358,9 +357,9 @@ class WebTest_Contribute_AddPricesetTest extends CiviSeleniumTestCase { 'Pre-conference Meetup?' => 'Radio', 'Evening Sessions' => 'CheckBox', ); - + $this->_testAddPriceFields($fields, $validateStrings, $financialType); - + // load the Price Set Preview and check for expected values $this->_testVerifyPriceSet($validateStrings, $sid); @@ -462,7 +461,7 @@ class WebTest_Contribute_AddPricesetTest extends CiviSeleniumTestCase { //add financial type of account type expense $financialType= $this->_testAddFinancialType(); - + $setTitle = 'Conference Fees - ' . substr(sha1(rand()), 0, 7); $usedFor = 'Contribution'; $setHelp = 'Select your conference options.'; @@ -576,7 +575,7 @@ class WebTest_Contribute_AddPricesetTest extends CiviSeleniumTestCase { function testContributeOfflineforSoftcreditwithApi() { // Log in using webtestLogin() method $this->webtestLogin(); - + //create a contact and return the contact id $firstNameSoft = "John_".substr(sha1(rand()), 0, 5); $lastNameSoft = "Doe_".substr(sha1(rand()), 0, 5); @@ -584,7 +583,7 @@ class WebTest_Contribute_AddPricesetTest extends CiviSeleniumTestCase { $url = $this->parseURL(); $cid = $url['queryString']['cid']; $this->assertType('numeric', $cid); - + $setTitle = 'Conference Fees - ' . substr(sha1(rand()), 0, 7); $usedFor = 'Contribution'; $setHelp = 'Select your conference options.'; @@ -611,7 +610,6 @@ class WebTest_Contribute_AddPricesetTest extends CiviSeleniumTestCase { $this->openCiviPage("contribute/add", "reset=1&action=add&context=standalone", '_qf_Contribution_upload'); - // create new contact using dialog $firstName = substr(sha1(rand()), 0, 7); $this->webtestNewDialogContact($firstName, 'Contributor', $firstName . '@example.com'); @@ -636,7 +634,7 @@ class WebTest_Contribute_AddPricesetTest extends CiviSeleniumTestCase { $this->type('check_number', '1041'); $this->type('trxn_id', 'P20901X1' . rand(100, 10000)); - + $this->type('soft_credit_to', "$lastNameSoft, $firstNameSoft"); $this->click('soft_credit_to'); $this->waitForElementPresent("css=div.ac_results-inner li"); @@ -668,7 +666,7 @@ class WebTest_Contribute_AddPricesetTest extends CiviSeleniumTestCase { 'Soft Credit To' => "$firstNameSoft $lastNameSoft", ); $this->webtestVerifyTabularData($expected); - + $exp = array( 2 => '$ 525.00', 3 => '$ 50.00', @@ -687,28 +685,28 @@ class WebTest_Contribute_AddPricesetTest extends CiviSeleniumTestCase { $this->typeKeys("css=input#sort_name_navigation", "$lastNameSoft, $firstNameSoft"); // wait for result list $this->waitForElementPresent("css=div.ac_results-inner li"); - + // visit contact summary page $this->click("css=div.ac_results-inner li"); $this->waitForPageToLoad($this->getTimeoutMsec()); $this->click( 'css=li#tab_contribute a' ); $this->waitForElementPresent('link=Record Contribution (Check, Cash, EFT ...)'); - + $id = explode('id=', $this->getAttribute("xpath=id('rowid')/td[7]/a[text()='View']@href")); $id = substr($id[1], 0, strpos($id[1], '&')); $this->click("xpath=id('rowid')/td[7]/a"); $this->waitForElementPresent('_qf_ContributionView_cancel-bottom'); - + $this->webtestVerifyTabularData($expected); - + $params = array('contribution_id' => $id, 'version' => 3, ); - + // Retrieve contribution from the DB via api and verify DB values against view contribution page require_once 'api/api.php'; $fields = $this->webtest_civicrm_api('contribution','get',$params ); - + $params['id'] = $params['contact_id'] = $fields['values'][$fields['id']]['soft_credit_to']; $softCreditContact = CRM_Contact_BAO_Contact::retrieve($params, $defaults, TRUE); diff --git a/tests/phpunit/WebTest/Contribute/ConfirmOptionalTest.php b/tests/phpunit/WebTest/Contribute/ConfirmOptionalTest.php index 22bf8e3b88..4b8ff8acb1 100644 --- a/tests/phpunit/WebTest/Contribute/ConfirmOptionalTest.php +++ b/tests/phpunit/WebTest/Contribute/ConfirmOptionalTest.php @@ -24,7 +24,6 @@ +--------------------------------------------------------------------+ */ - require_once 'CiviTest/CiviSeleniumTestCase.php'; class WebTest_Contribute_ConfirmOptionalTest extends CiviSeleniumTestCase { protected $pageId = 0; diff --git a/tests/phpunit/WebTest/Contribute/ContactContextAddTest.php b/tests/phpunit/WebTest/Contribute/ContactContextAddTest.php index 6869140ced..2ad020aecd 100644 --- a/tests/phpunit/WebTest/Contribute/ContactContextAddTest.php +++ b/tests/phpunit/WebTest/Contribute/ContactContextAddTest.php @@ -24,7 +24,6 @@ +--------------------------------------------------------------------+ */ - require_once 'CiviTest/CiviSeleniumTestCase.php'; class WebTest_Contribute_ContactContextAddTest extends CiviSeleniumTestCase { @@ -32,15 +31,16 @@ class WebTest_Contribute_ContactContextAddTest extends CiviSeleniumTestCase { parent::setUp(); } - function testContactContextAdd() { + function testContactContextAdd() { + // Log in using webtestLogin() method $this->webtestLogin(); - + // Create a contact to be used as soft creditor $softCreditFname = substr(sha1(rand()), 0, 7); $softCreditLname = substr(sha1(rand()), 0, 7); $this->webtestAddContact($softCreditFname, $softCreditLname, FALSE); - + // Adding contact with randomized first name (so we can then select that contact when creating contribution.) // We're using Quick Add block on the main page for this. $firstName = substr(sha1(rand()), 0, 7); @@ -55,7 +55,7 @@ class WebTest_Contribute_ContactContextAddTest extends CiviSeleniumTestCase { $isTax = TRUE; $taxRate = 9.99999999; $isDefault = FALSE; - + //Add new organisation if($orgName) { $this->webtestAddOrganization($orgName); @@ -73,39 +73,39 @@ class WebTest_Contribute_ContactContextAddTest extends CiviSeleniumTestCase { ); $this->webtestAddContact( $firstName, "Anderson", true ); - + // Get the contact id of the new contact $contactUrl = $this->parseURL(); $cid = $contactUrl['queryString']['cid']; $this->assertType('numeric', $cid); - + // go to contribution tab and add contribution. $this->click("css=li#tab_contribute a"); - + // wait for Record Contribution elenment. $this->waitForElementPresent("link=Record Contribution (Check, Cash, EFT ...)"); $this->click("link=Record Contribution (Check, Cash, EFT ...)"); - + $this->waitForElementPresent("_qf_Contribution_cancel-bottom"); // fill financial type. $this->select("financial_type_id", "Donation"); - + // fill in Received Date $this->webtestFillDate('receive_date'); - + // source $this->type("source", "Mailer 1"); - + // total amount $this->type("total_amount", "100"); - + // select payment instrument type = Check and enter chk number $this->select("payment_instrument_id", "value=4"); $this->waitForElementPresent("check_number"); $this->type("check_number", "check #1041"); - + $this->type("trxn_id", "P20901X1" . rand(100, 10000)); - + // soft credit $this->click("soft_credit_to"); $this->type("soft_credit_to", $softCreditFname); @@ -120,7 +120,7 @@ class WebTest_Contribute_ContactContextAddTest extends CiviSeleniumTestCase { //Additional Detail section $this->click("AdditionalDetail"); $this->waitForElementPresent("thankyou_date"); - + $this->type("note", "Test note for {$firstName}."); $this->type("fee_amount", "0"); $this->type("net_amount", "0"); @@ -148,9 +148,9 @@ class WebTest_Contribute_ContactContextAddTest extends CiviSeleniumTestCase { $this->clickLink("_qf_Contribution_upload-bottom", 'civicrm-footer'); // Is status message correct? $this->assertElementContainsText('crm-notification-container', "The contribution record has been saved"); - + $this->waitForElementPresent("xpath=//div[@id='Contributions']//table/tbody/tr/td[8]/span/a[text()='View']"); - + // click through to the Contribution view screen $this->click("xpath=//div[@id='Contributions']//table/tbody/tr/td[8]/span/a[text()='View']"); $this->waitForElementPresent('_qf_ContributionView_cancel-bottom'); @@ -175,7 +175,7 @@ class WebTest_Contribute_ContactContextAddTest extends CiviSeleniumTestCase { $viewUrl = $this->parseURL(); $id = $viewUrl['queryString']['id']; $this->assertType('numeric', $id); - + $searchParams = array('id' => $id); $compareParams = array( 'contact_id' => $cid, diff --git a/tests/phpunit/WebTest/Contribute/ContributionPageAddTest.php b/tests/phpunit/WebTest/Contribute/ContributionPageAddTest.php index e615587309..4cf0a2f63a 100644 --- a/tests/phpunit/WebTest/Contribute/ContributionPageAddTest.php +++ b/tests/phpunit/WebTest/Contribute/ContributionPageAddTest.php @@ -24,7 +24,6 @@ +--------------------------------------------------------------------+ */ - require_once 'CiviTest/CiviSeleniumTestCase.php'; class WebTest_Contribute_ContributionPageAddTest extends CiviSeleniumTestCase { function testContributionPageAdd() { @@ -198,7 +197,6 @@ class WebTest_Contribute_ContributionPageAddTest extends CiviSeleniumTestCase { $this->webtestVerifyTabularData($expected); $this->click('_qf_ContributionView_cancel-bottom'); - //Find Member $this->openCiviPage("member/search", "reset=1", 'member_source'); $this->type('sort_name', "$firstName $lastName"); diff --git a/tests/phpunit/WebTest/Contribute/OfflineContributionTest.php b/tests/phpunit/WebTest/Contribute/OfflineContributionTest.php index 36d2381a10..406c39e29e 100644 --- a/tests/phpunit/WebTest/Contribute/OfflineContributionTest.php +++ b/tests/phpunit/WebTest/Contribute/OfflineContributionTest.php @@ -27,18 +27,16 @@ require_once 'CiviTest/CiviSeleniumTestCase.php'; - - class WebTest_Contribute_OfflineContributionTest extends CiviSeleniumTestCase { protected $captureScreenshotOnFailure = TRUE; protected $screenshotPath = '/var/www/api.dev.civicrm.org/public/sc'; protected $screenshotUrl = 'http://api.dev.civicrm.org/sc/'; - + protected function setUp() { parent::setUp(); } - + function testStandaloneContributeAdd() { $this->webtestLogin(); @@ -46,11 +44,11 @@ class WebTest_Contribute_OfflineContributionTest extends CiviSeleniumTestCase { $softCreditFname = substr(sha1(rand()), 0, 7); $softCreditLname = substr(sha1(rand()), 0, 7); $this->webtestAddContact( $softCreditFname, $softCreditLname, false ); - + //financial account for check $this->openCiviPage("admin/options/payment_instrument", "group=payment_instrument&reset=1"); $financialAccount = $this->getText("xpath=//div[@id='payment_instrument']/div[2]/table/tbody//tr/td[1][text()='Check']/../td[3]"); - + // Add new Financial Account $orgName = 'Alberta '.substr(sha1(rand()), 0, 7); $financialAccountTitle = 'Financial Account '.substr(sha1(rand()), 0, 4); @@ -62,12 +60,12 @@ class WebTest_Contribute_OfflineContributionTest extends CiviSeleniumTestCase { $isTax = TRUE; $taxRate = 9; $isDefault = FALSE; - + //Add new organisation if($orgName) { $this->webtestAddOrganization($orgName); } - + $this->_testAddFinancialAccount($financialAccountTitle, $financialAccountDescription, $accountingCode, @@ -83,7 +81,7 @@ class WebTest_Contribute_OfflineContributionTest extends CiviSeleniumTestCase { $firstName = 'John'.substr(sha1(rand()), 0, 7); $lastName = 'Dsouza'.substr(sha1(rand()), 0, 7); $this->webtestAddContact($firstName, $lastName); - + $this->waitForElementPresent("css=li#tab_contribute a"); $this->click("css=li#tab_contribute a"); $this->waitForElementPresent("link=Record Contribution (Check, Cash, EFT ...)"); @@ -92,13 +90,13 @@ class WebTest_Contribute_OfflineContributionTest extends CiviSeleniumTestCase { // select financial type $this->select("financial_type_id", "value=1"); - + // fill in Received Date $this->webtestFillDate('receive_date'); - + // source $this->type("source", "Mailer 1"); - + // total amount $this->type("total_amount", "100"); @@ -108,11 +106,12 @@ class WebTest_Contribute_OfflineContributionTest extends CiviSeleniumTestCase { $this->type("check_number", "check #1041"); $this->type("trxn_id", "P20901X1" . rand(100, 10000)); - + // soft credit $this->click("soft_credit_to"); $this->type("soft_credit_to", $softCreditFname); - $this->typeKeys("soft_credit_to", $softCreditFname); + $this->typeKeys("soft_credit_to", $softCreditFname); + $this->waitForElementPresent("css=div.ac_results-inner li"); $this->click("css=div.ac_results-inner li"); @@ -129,7 +128,7 @@ class WebTest_Contribute_OfflineContributionTest extends CiviSeleniumTestCase { $this->type("net_amount", "0"); $this->type("invoice_id", time()); $this->webtestFillDate('thankyou_date'); - + //Honoree section $this->click("Honoree"); $this->waitForElementPresent("honor_email"); @@ -153,15 +152,16 @@ class WebTest_Contribute_OfflineContributionTest extends CiviSeleniumTestCase { // Is status message correct? $this->assertTrue($this->isTextPresent("The contribution record has been saved."), "Status message didn't show up after saving!"); - + // verify if Membership is created $this->waitForElementPresent( "xpath=//div[@id='Contributions']//table//tbody/tr[1]/td[8]/span/a[text()='View']" ); - + //click through to the Membership view screen $this->click( "xpath=//div[@id='Contributions']//table/tbody/tr[1]/td[8]/span/a[text()='View']" ); $this->waitForElementPresent("_qf_ContributionView_cancel-bottom"); - - $expected = array('Financial Type' => 'Donation', + + $expected = array('Financial Type' => 'Donation', + 'Total Amount' => '100.00', 'Contribution Status' => 'Completed', 'Paid By' => 'Check', @@ -183,7 +183,8 @@ class WebTest_Contribute_OfflineContributionTest extends CiviSeleniumTestCase { $this->waitForElementPresent("link=Record Contribution (Check, Cash, EFT ...)"); // verify soft credit details - $expected = array( 3 => 'Donation', + $expected = array( 3 => 'Donation', + 2 => '100.00', 5 => 'Completed', 1 => "{$firstName} {$lastName}" @@ -192,18 +193,18 @@ class WebTest_Contribute_OfflineContributionTest extends CiviSeleniumTestCase { $this->verifyText("xpath=id('Search')/div[2]/table[2]/tbody/tr[2]/td[$value]", preg_quote($label)); } } - + function testDeductibleAmount() { $this->webtestLogin(); //add authorize .net payment processor $processorName = 'Webtest AuthNet' . substr(sha1(rand()), 0, 7); $this->webtestAddPaymentProcessor($processorName, 'AuthNet'); - + $this->openCiviPage("admin/contribute/managePremiums", "action=add&reset=1"); $premiumName = 'test Premium' . substr(sha1(rand()), 0, 7); $this->addPremium($premiumName, 'SKU', 3, 12, NULL, NULL); - + $firstName = 'John'.substr(sha1(rand()), 0, 7); $lastName = 'Dsouza'.substr(sha1(rand()), 0, 7); $this->webtestAddContact($firstName, $lastName); @@ -215,7 +216,7 @@ class WebTest_Contribute_OfflineContributionTest extends CiviSeleniumTestCase { 'non_deductible_amount' => 15 ); $this->_doOfflineContribution($scenario1, $firstName, $lastName, $processorName); - + $checkScenario1 = array( 'From' => "{$firstName} {$lastName}", 'Financial Type' => 'Campaign Contribution', @@ -223,7 +224,7 @@ class WebTest_Contribute_OfflineContributionTest extends CiviSeleniumTestCase { 'Non-deductible Amount' => 15 ); $this->_verifyAmounts($checkScenario1); - + //scenario 2 : is_deductible = TRUE and premium is set and premium is greater than total amount $scenario2 = array( 'financial_type' => 'Donation', @@ -231,7 +232,7 @@ class WebTest_Contribute_OfflineContributionTest extends CiviSeleniumTestCase { 'premium' => "{$premiumName} ( SKU )" ); $this->_doOfflineContribution($scenario2, $firstName, $lastName, $processorName); - + $checkScenario2 = array( 'From' => "{$firstName} {$lastName}", 'Financial Type' => 'Donation', @@ -239,7 +240,7 @@ class WebTest_Contribute_OfflineContributionTest extends CiviSeleniumTestCase { 'Non-deductible Amount' => 10 ); $this->_verifyAmounts($checkScenario2); - + //scenario 3 : is_deductible = TRUE and premium is set and premium is less than total amount $scenario3 = array( 'financial_type' => 'Donation', @@ -247,7 +248,7 @@ class WebTest_Contribute_OfflineContributionTest extends CiviSeleniumTestCase { 'premium' => "{$premiumName} ( SKU )" ); $this->_doOfflineContribution($scenario3, $firstName, $lastName, $processorName); - + $checkScenario3 = array( 'From' => "{$firstName} {$lastName}", 'Financial Type' => 'Donation', @@ -255,14 +256,14 @@ class WebTest_Contribute_OfflineContributionTest extends CiviSeleniumTestCase { 'Non-deductible Amount' => 12 ); $this->_verifyAmounts($checkScenario3); - + //scenario 4 : is_deductible = TRUE and premium is not set $scenario4 = array( 'financial_type' => 'Donation', 'total_amount' => 123, ); $this->_doOfflineContribution($scenario4, $firstName, $lastName, $processorName); - + $checkScenario4 = array( 'From' => "{$firstName} {$lastName}", 'Financial Type' => 'Donation', @@ -277,7 +278,7 @@ class WebTest_Contribute_OfflineContributionTest extends CiviSeleniumTestCase { 'total_amount' => 555, ); $this->_doOfflineContribution($scenario5, $firstName, $lastName, $processorName); - + $checkScenario5 = array( 'From' => "{$firstName} {$lastName}", 'Financial Type' => 'Campaign Contribution', @@ -286,10 +287,10 @@ class WebTest_Contribute_OfflineContributionTest extends CiviSeleniumTestCase { ); $this->_verifyAmounts($checkScenario5); } - + //common function for doing offline contribution function _doOfflineContribution($params, $firstName, $lastName, $processorName) { - + $this->waitForElementPresent("css=li#tab_contribute a"); $this->click("css=li#tab_contribute a"); $this->waitForElementPresent("link=Submit Credit Card Contribution"); @@ -316,7 +317,7 @@ class WebTest_Contribute_OfflineContributionTest extends CiviSeleniumTestCase { // billing address $this->webtestAddBillingDetails($firstName, NULL, $lastName); - + if ($nonDeductibleAmt = CRM_Utils_Array::value('non_deductible_amount', $params)) { $this->click("AdditionalDetail"); $this->waitForElementPresent("thankyou_date"); @@ -337,12 +338,12 @@ class WebTest_Contribute_OfflineContributionTest extends CiviSeleniumTestCase { // Is status message correct? $this->assertTrue($this->isTextPresent("The contribution record has been processed."), "Status message didn't show up after saving!"); } - + //common function for verifing total_amount, and non_deductible_amount function _verifyAmounts($verifyData) { $this->waitForElementPresent( "xpath=//div[@id='Contributions']//table//tbody/tr[1]/td[8]/span/a[text()='View']" ); $this->click( "xpath=//div[@id='Contributions']//table/tbody/tr[1]/td[8]/span/a[text()='View']" ); - $this->waitForPageToLoad($this->getTimeoutMsec()); + $this->waitForPageToLoad($this->getTimeoutMsec()); foreach ($verifyData as $label => $value) { $this->verifyText("xpath=//form[@id='ContributionView']//table/tbody/tr/td[text()='{$label}']/following-sibling::td", diff --git a/tests/phpunit/WebTest/Contribute/OfflineRecurContributionTest.php b/tests/phpunit/WebTest/Contribute/OfflineRecurContributionTest.php index d86e6439a4..e5ad064449 100644 --- a/tests/phpunit/WebTest/Contribute/OfflineRecurContributionTest.php +++ b/tests/phpunit/WebTest/Contribute/OfflineRecurContributionTest.php @@ -24,7 +24,6 @@ +--------------------------------------------------------------------+ */ - require_once 'CiviTest/CiviSeleniumTestCase.php'; class WebTest_Contribute_OfflineRecurContributionTest extends CiviSeleniumTestCase { @@ -102,7 +101,7 @@ class WebTest_Contribute_OfflineRecurContributionTest extends CiviSeleniumTestCa '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) diff --git a/tests/phpunit/WebTest/Contribute/OnBehalfOfOrganization.php b/tests/phpunit/WebTest/Contribute/OnBehalfOfOrganization.php index 7859f78fe7..05f2a0e8c6 100644 --- a/tests/phpunit/WebTest/Contribute/OnBehalfOfOrganization.php +++ b/tests/phpunit/WebTest/Contribute/OnBehalfOfOrganization.php @@ -24,7 +24,6 @@ +--------------------------------------------------------------------+ */ - require_once 'CiviTest/CiviSeleniumTestCase.php'; class WebTest_Contribute_OnBehalfOfOrganization extends CiviSeleniumTestCase { protected $pageno = ''; @@ -291,7 +290,6 @@ class WebTest_Contribute_OnBehalfOfOrganization extends CiviSeleniumTestCase { $this->waitForElementPresent('_qf_Membership_cancel-bottom'); $this->click('_qf_Membership_upload-bottom'); - $this->waitForPageToLoad($this->getTimeoutMsec()); $this->click("css=li#tab_rel a"); @@ -461,7 +459,6 @@ class WebTest_Contribute_OnBehalfOfOrganization extends CiviSeleniumTestCase { // Is status message correct? $this->assertTextPresent("Thank you. Your information has been saved.", "Save successful status message didn't show up after saving profile to update testUserName!"); - //add org fields to profile $this->openCiviPage("admin/uf/group", "reset=1"); $this->click("link=Reserved Profiles"); @@ -484,7 +481,6 @@ class WebTest_Contribute_OnBehalfOfOrganization extends CiviSeleniumTestCase { $this->click('_qf_Field_next-bottom'); $this->waitForPageToLoad($this->getTimeoutMsec()); - //create organisation $orgName = "Org WebAccess ". substr(sha1(rand()), 0, 7); $orgEmail = "org". substr(sha1(rand()), 0, 7) . "@web.com"; @@ -564,7 +560,6 @@ class WebTest_Contribute_OnBehalfOfOrganization extends CiviSeleniumTestCase { $this->_testOrganization($pageId, $cid, $pageTitle); } - function _testOrganization($pageId, $cid, $pageTitle) { //Open Live Contribution Page $this->openCiviPage("contribute/transact", "reset=1&id=$pageId", "_qf_Main_upload-bottom"); @@ -619,7 +614,6 @@ class WebTest_Contribute_OnBehalfOfOrganization extends CiviSeleniumTestCase { $this->click("onbehalf_state_province-3"); $this->select("onbehalf_state_province-3", "label=Alabama"); - // Credit Card Info $this->select("credit_card_type", "value=Visa"); $this->type("credit_card_number", "4111111111111111"); @@ -883,7 +877,6 @@ class WebTest_Contribute_OnBehalfOfOrganization extends CiviSeleniumTestCase { $this->verifyText("xpath=id( 'ContributionView' )/div[2]/table[1]/tbody/tr[$value]/td[2]", preg_quote($label)); } - $this->openCiviPage("admin/uf/group", "reset=1"); $this->click("link=Reserved Profiles"); @@ -1096,7 +1089,6 @@ class WebTest_Contribute_OnBehalfOfOrganization extends CiviSeleniumTestCase { $this->click("_qf_Contact_upload_view-bottom"); $this->waitForPageToLoad($this->getTimeoutMsec()); - // create Membership type $title1 = "Membership Type" . substr(sha1(rand()), 0, 7); $this->openCiviPage("admin/member/membershipType", "reset=1&action=browse"); @@ -1283,7 +1275,6 @@ class WebTest_Contribute_OnBehalfOfOrganization extends CiviSeleniumTestCase { ); } - function testOnBehalfOfOrganizationWithImage() { $this->webtestLogin(); diff --git a/tests/phpunit/WebTest/Contribute/OnlineContributionTest.php b/tests/phpunit/WebTest/Contribute/OnlineContributionTest.php index fa13a747e4..5d38797a06 100644 --- a/tests/phpunit/WebTest/Contribute/OnlineContributionTest.php +++ b/tests/phpunit/WebTest/Contribute/OnlineContributionTest.php @@ -24,7 +24,6 @@ +--------------------------------------------------------------------+ */ - require_once 'CiviTest/CiviSeleniumTestCase.php'; class WebTest_Contribute_OnlineContributionTest extends CiviSeleniumTestCase { @@ -88,7 +87,7 @@ class WebTest_Contribute_OnlineContributionTest extends CiviSeleniumTestCase { $honorLastName = 'Hon' . substr(sha1(rand()), 0, 7); $honorEmail = $honorFirstName . "@example.com"; $honorSortName = $honorLastName . ', ' . $honorFirstName; - $honorDisplayName = 'Ms. ' . $honorFirstName . ' ' . $honorLastName; + $honorDisplayName = 'Ms. ' . $honorFirstName . ' ' . $honorLastName; $this->type("email-5", $firstName . "@example.com"); @@ -113,7 +112,7 @@ class WebTest_Contribute_OnlineContributionTest extends CiviSeleniumTestCase { $this->type("honor_first_name", $honorFirstName); $this->type("honor_last_name", $honorLastName); $this->type("honor_email", $honorEmail); - + //Credit Card Info $this->select("credit_card_type", "value=Visa"); $this->type("credit_card_number", "4111111111111111"); @@ -170,7 +169,7 @@ class WebTest_Contribute_OnlineContributionTest extends CiviSeleniumTestCase { // Is contact present? $this->assertTrue($this->isTextPresent("$honorDisplayName"), "Honoree contact not found."); - + } } diff --git a/tests/phpunit/WebTest/Contribute/OnlineMultiplePaymentProcessorTest.php b/tests/phpunit/WebTest/Contribute/OnlineMultiplePaymentProcessorTest.php index b14fddf333..0cb667213d 100644 --- a/tests/phpunit/WebTest/Contribute/OnlineMultiplePaymentProcessorTest.php +++ b/tests/phpunit/WebTest/Contribute/OnlineMultiplePaymentProcessorTest.php @@ -24,7 +24,6 @@ +--------------------------------------------------------------------+ */ - require_once 'CiviTest/CiviSeleniumTestCase.php'; class WebTest_Contribute_OnlineMultiplePaymentProcessorTest extends CiviSeleniumTestCase { protected function setUp() { @@ -108,9 +107,9 @@ class WebTest_Contribute_OnlineMultiplePaymentProcessorTest extends CiviSelenium $this->click("_qf_Confirm_next-bottom"); $this->waitForPageToLoad($this->getTimeoutMsec()); - + //login to check contribution - + } function testOnlineMultiplePaymentProcessorWithPayLater() { @@ -118,7 +117,6 @@ class WebTest_Contribute_OnlineMultiplePaymentProcessorTest extends CiviSelenium // Log in using webtestLogin() method $this->webtestLogin(); - $proProcessorName = "Pro " . substr(sha1(rand()), 0, 7); $standardProcessorName = "Standard " . substr(sha1(rand()), 0, 7); $donationPageTitle = "Donation" . substr(sha1(rand()), 0, 7); @@ -152,7 +150,7 @@ class WebTest_Contribute_OnlineMultiplePaymentProcessorTest extends CiviSelenium $firstName = 'Ma' . substr(sha1(rand()), 0, 4); $lastName = 'An' . substr(sha1(rand()), 0, 7); - + $this->type("email-5", $firstName . "@example.com"); $this->type("first_name", $firstName); @@ -173,7 +171,7 @@ class WebTest_Contribute_OnlineMultiplePaymentProcessorTest extends CiviSelenium $this->click($xpath); $this->clickLink("_qf_Main_upload-bottom", "_qf_Confirm_next-bottom"); - + $payLaterInstructionsText = "Pay later instructions $hash"; $this->assertTrue($this->isTextPresent($payLaterInstructionsText)); diff --git a/tests/phpunit/WebTest/Contribute/OnlineRecurContributionTest.php b/tests/phpunit/WebTest/Contribute/OnlineRecurContributionTest.php index 146a4ac72f..36ceb4e041 100644 --- a/tests/phpunit/WebTest/Contribute/OnlineRecurContributionTest.php +++ b/tests/phpunit/WebTest/Contribute/OnlineRecurContributionTest.php @@ -24,7 +24,6 @@ +--------------------------------------------------------------------+ */ - require_once 'CiviTest/CiviSeleniumTestCase.php'; class WebTest_Contribute_OnlineRecurContributionTest extends CiviSeleniumTestCase { diff --git a/tests/phpunit/WebTest/Contribute/PCPAddTest.php b/tests/phpunit/WebTest/Contribute/PCPAddTest.php index ec854e7b61..d505306d62 100755 --- a/tests/phpunit/WebTest/Contribute/PCPAddTest.php +++ b/tests/phpunit/WebTest/Contribute/PCPAddTest.php @@ -124,8 +124,10 @@ class WebTest_Contribute_PCPAddTest extends CiviSeleniumTestCase { $this->type("email-Primary", $email); if ($this->isElementPresent("cms_pass")) { $pass = 'myBigPassword'; - $this->type("cms_pass", $pass); - $this->type("cms_confirm_pass", $pass); + $this->type("cms_pass", $pass); + + $this->type("cms_confirm_pass", $pass); + } $this->click("_qf_PCPAccount_next-bottom"); diff --git a/tests/phpunit/WebTest/Contribute/StandaloneAddTest.php b/tests/phpunit/WebTest/Contribute/StandaloneAddTest.php index 5ca27b9175..e7e5a57102 100644 --- a/tests/phpunit/WebTest/Contribute/StandaloneAddTest.php +++ b/tests/phpunit/WebTest/Contribute/StandaloneAddTest.php @@ -24,7 +24,6 @@ +--------------------------------------------------------------------+ */ - require_once 'CiviTest/CiviSeleniumTestCase.php'; class WebTest_Contribute_StandaloneAddTest extends CiviSeleniumTestCase { @@ -51,12 +50,12 @@ class WebTest_Contribute_StandaloneAddTest extends CiviSeleniumTestCase { $isTax = TRUE; $taxRate = 9.9999999; $isDefault = FALSE; - + //Add new organisation if($orgName) { $this->webtestAddOrganization($orgName); } - + $this->_testAddFinancialAccount($financialAccountTitle, $financialAccountDescription, $accountingCode, @@ -71,14 +70,13 @@ class WebTest_Contribute_StandaloneAddTest extends CiviSeleniumTestCase { $this->openCiviPage("contribute/add", "reset=1&context=standalone", "_qf_Contribution_upload"); - // create new contact using dialog $firstName = substr(sha1(rand()), 0, 7); $this->webtestNewDialogContact($firstName, "Contributor", $firstName . "@example.com"); - + // select financial type $this->select("financial_type_id", "value=1"); - + // fill in Received Date $this->webtestFillDate('receive_date'); @@ -92,7 +90,7 @@ class WebTest_Contribute_StandaloneAddTest extends CiviSeleniumTestCase { $this->select("payment_instrument_id", "value=4"); $this->waitForElementPresent("check_number"); $this->type("check_number", "check #1041"); - + $this->type("trxn_id", "P20901X1" . rand(100, 10000)); // soft credit @@ -162,7 +160,7 @@ class WebTest_Contribute_StandaloneAddTest extends CiviSeleniumTestCase { // go to soft creditor contact view page $this->click("xpath=id('ContributionView')/div[2]/table[1]/tbody//tr/td[1][text()='Soft Credit To']/../td[2]/a[text()='{$softCreditFname} {$softCreditLname}']"); - + // go to contribution tab $this->waitForElementPresent("css=li#tab_contribute a"); $this->click("css=li#tab_contribute a"); diff --git a/tests/phpunit/WebTest/Contribute/UpdateBatchPendingContributionTest.php b/tests/phpunit/WebTest/Contribute/UpdateBatchPendingContributionTest.php index 1035301ead..275afa3dd4 100644 --- a/tests/phpunit/WebTest/Contribute/UpdateBatchPendingContributionTest.php +++ b/tests/phpunit/WebTest/Contribute/UpdateBatchPendingContributionTest.php @@ -24,7 +24,6 @@ +--------------------------------------------------------------------+ */ - require_once 'CiviTest/CiviSeleniumTestCase.php'; class WebTest_Contribute_UpdateBatchPendingContributionTest extends CiviSeleniumTestCase { @@ -67,7 +66,8 @@ class WebTest_Contribute_UpdateBatchPendingContributionTest extends CiviSelenium $expected = array( 'Received Into' => "Deposit Bank Account", 'Contribution Status' => "Completed", - ); + ); + $this->webtestVerifyTabularData($expected); } @@ -128,7 +128,8 @@ class WebTest_Contribute_UpdateBatchPendingContributionTest extends CiviSelenium $expected = array( 'Received Into' => "Deposit Bank Account", 'Contribution Status' => "Completed", - ); + ); + $this->webtestVerifyTabularData($expected); } @@ -145,7 +146,6 @@ class WebTest_Contribute_UpdateBatchPendingContributionTest extends CiviSelenium // Select role $this->click('role_id[2]'); - // Select participant status $this->select('status_id', 'value=1'); @@ -197,7 +197,6 @@ class WebTest_Contribute_UpdateBatchPendingContributionTest extends CiviSelenium $this->openCiviPage("contribute/add", "reset=1&context=standalone", "_qf_Contribution_upload"); - // create new contact using dialog $this->webtestNewDialogContact($firstName, "Contributor", $email); diff --git a/tests/phpunit/WebTest/Contribute/UpdateContributionTest.php b/tests/phpunit/WebTest/Contribute/UpdateContributionTest.php index 6bd71189d9..6818bf2333 100644 --- a/tests/phpunit/WebTest/Contribute/UpdateContributionTest.php +++ b/tests/phpunit/WebTest/Contribute/UpdateContributionTest.php @@ -66,15 +66,18 @@ class WebTest_Contribute_UpdateContributionTest extends CiviSeleniumTestCase { //For LineItem $lineItemSearchParams = array('entity_id' => $contriIDOff); $lineItemCompareParams = array('line_total' => '90.00'); - + + $this->assertDBCompareValues('CRM_Contribute_DAO_Contribution', $searchParams, $compareParams); $this->assertDBCompareValues('CRM_Price_DAO_LineItem', $lineItemSearchParams, $lineItemCompareParams); - + + $total = $this->_getTotalContributedAmount($contriIDOff); $compare = array('total_amount' => $total); $this->assertDBCompareValues('CRM_Contribute_DAO_Contribution', $searchParams, $compare); - + + $amount = $this->_getFinancialItemAmount($contriIDOff); $compare = array('total_amount' => $amount); $this->assertDBCompareValues('CRM_Contribute_DAO_Contribution', $searchParams, $compare); @@ -110,7 +113,8 @@ class WebTest_Contribute_UpdateContributionTest extends CiviSeleniumTestCase { $this->assertDBCompareValues("CRM_Financial_DAO_FinancialItem", $search, $compare); $status = $this->_getPremiumActualCost($contId, 'Accounts Receivable', 'Payment Processor Account', NULL, "'civicrm_contribution'", "ft.status_id as status"); - $this->assertEquals($status, '1', "Verify Completed Status"); + $this->assertEquals($status, '1', "Verify Completed Status"); + } function testChangePremium() { @@ -462,9 +466,11 @@ class WebTest_Contribute_UpdateContributionTest extends CiviSeleniumTestCase { // select payment instrument type $this->select("payment_instrument_id", "label=Credit Card"); - + + $this->type("trxn_id", "P20901X1" . rand(100, 10000)); - + + //Custom Data //$this->click('CIVICRM_QFID_3_6'); diff --git a/tests/phpunit/WebTest/Contribute/UpdatePendingContributionTest.php b/tests/phpunit/WebTest/Contribute/UpdatePendingContributionTest.php index eb9400a3ba..64cba7dd0c 100644 --- a/tests/phpunit/WebTest/Contribute/UpdatePendingContributionTest.php +++ b/tests/phpunit/WebTest/Contribute/UpdatePendingContributionTest.php @@ -24,7 +24,6 @@ +--------------------------------------------------------------------+ */ - require_once 'CiviTest/CiviSeleniumTestCase.php'; class WebTest_Contribute_UpdatePendingContributionTest extends CiviSeleniumTestCase { @@ -81,7 +80,6 @@ class WebTest_Contribute_UpdatePendingContributionTest extends CiviSeleniumTestC $this->openCiviPage("contribute/add", "reset=1&context=standalone", "_qf_Contribution_upload"); - // create new contact using dialog $this->webtestNewDialogContact($firstName, "Contributor", $email); @@ -241,7 +239,7 @@ class WebTest_Contribute_UpdatePendingContributionTest extends CiviSeleniumTestC $this->type("first_name", $firstName); $this->type("last_name", $lastName); - + $this->click("xpath=//div[@class='crm-section other_amount-section']//div[2]/input"); $this->type("xpath=//div[@class='crm-section other_amount-section']//div[2]/input", 100); $this->click("xpath=//div[@class='crm-section payment_processor-section']/div[2]//label[text()='Pay later label {$hash}']"); diff --git a/tests/phpunit/WebTest/Contribute/VerifySSLContributionTest.php b/tests/phpunit/WebTest/Contribute/VerifySSLContributionTest.php index a2c360bcb4..c85180ad5e 100644 --- a/tests/phpunit/WebTest/Contribute/VerifySSLContributionTest.php +++ b/tests/phpunit/WebTest/Contribute/VerifySSLContributionTest.php @@ -24,7 +24,6 @@ +--------------------------------------------------------------------+ */ - require_once 'CiviTest/CiviSeleniumTestCase.php'; class WebTest_Contribute_VerifySSLContributionTest extends CiviSeleniumTestCase { diff --git a/tests/phpunit/WebTest/Event/AddEventTest.php b/tests/phpunit/WebTest/Event/AddEventTest.php index 8a07f2cfd1..49e5af62fd 100644 --- a/tests/phpunit/WebTest/Event/AddEventTest.php +++ b/tests/phpunit/WebTest/Event/AddEventTest.php @@ -24,7 +24,6 @@ +--------------------------------------------------------------------+ */ - require_once 'CiviTest/CiviSeleniumTestCase.php'; class WebTest_Event_AddEventTest extends CiviSeleniumTestCase { @@ -96,7 +95,8 @@ class WebTest_Event_AddEventTest extends CiviSeleniumTestCase { $multipleRegistrations = TRUE; $this->_testAddOnlineRegistration($registerIntro, $multipleRegistrations); - $discountFees = array("225.00", "300.00"); + $discountFees = array("225.00", "300.00"); + $eventInfoStrings = array($eventTitle, $eventDescription, $streetAddress); $this->_testVerifyEventInfo($eventTitle, $eventInfoStrings, $discountFees); @@ -134,7 +134,8 @@ class WebTest_Event_AddEventTest extends CiviSeleniumTestCase { $multipleRegistrations = TRUE; $this->_testAddOnlineRegistration($registerIntro, $multipleRegistrations); - $discountFees = array("225.00", "300.00"); + $discountFees = array("225.00", "300.00"); + $eventInfoStrings = array($eventTitle, $eventDescription, $streetAddress); $id = $this->_testVerifyEventInfo($eventTitle, $eventInfoStrings, $discountFees); @@ -154,7 +155,7 @@ class WebTest_Event_AddEventTest extends CiviSeleniumTestCase { // Sleep should never be used for wait for anything to load from the server // Justification for this instance: FIXME sleep(3); - + //Assert quick config change and discount deletion $this->openCiviPage("admin/price", "reset=1"); $this->assertStringsPresent($discount); @@ -186,7 +187,8 @@ class WebTest_Event_AddEventTest extends CiviSeleniumTestCase { $multipleRegistrations = TRUE; $this->_testAddOnlineRegistration($registerIntro, $multipleRegistrations); - $discountFees = array("225.00", "300.00"); + $discountFees = array("225.00", "300.00"); + $eventInfoStrings = array($eventTitle, $eventDescription, $streetAddress); $id = $this->_testVerifyEventInfo($eventTitle, $eventInfoStrings, $discountFees); @@ -251,16 +253,18 @@ class WebTest_Event_AddEventTest extends CiviSeleniumTestCase { $this->webtestLogin(); $this->openCiviPage("event/add", "reset=1&action=add"); - + $eventTitle = 'My Free Meeting - ' . substr(sha1(rand()), 0, 7); $eventDescription = "Here is a description for this free meeting."; // Select "Free Meeting with Online Registration" template (id = 5). $templateID = 5; - $eventTypeID = 4; + $eventTypeID = 4; + $this->_testAddEventInfoFromTemplate($eventTitle, $eventDescription, $templateID, $eventTypeID); - - $streetAddress = "100 Main Street"; - $this->_testAddLocation($streetAddress); + + $streetAddress = "100 Main Street"; + + $this->_testAddLocation($streetAddress); // Go to Fees tab and check that Paid Event is false (No) $this->click("link=Fees"); @@ -338,17 +342,18 @@ class WebTest_Event_AddEventTest extends CiviSeleniumTestCase { $this->waitForElementPresent("_qf_EventInfo_upload-bottom"); // Select event template. Use option value, not label - since labels can be translated and test would fail - $this->select("template_id", "value={$templateID}"); + $this->select("template_id", "value={$templateID}"); // Wait for event type to be filled in (since page reloads) $this->waitForPageToLoad($this->getTimeoutMsec()); - $this->verifySelectedValue("event_type_id", $eventTypeID); + $this->verifySelectedValue("event_type_id", $eventTypeID); // Attendee role s/b selected now. $this->verifySelectedValue("default_role_id", "1"); - + // Enter Event Title, Summary and Description - $this->type("title", $eventTitle); + $this->type("title", $eventTitle); + $this->type("summary", "This is a great conference. Sign up now!"); // Type description in ckEditor (fieldname, text to type, editor) @@ -361,7 +366,8 @@ class WebTest_Event_AddEventTest extends CiviSeleniumTestCase { $this->type("max_participants", "50"); $this->click("is_map"); - $this->click("_qf_EventInfo_upload-bottom"); + $this->click("_qf_EventInfo_upload-bottom"); + } function _testAddLocation($streetAddress) { @@ -422,7 +428,8 @@ class WebTest_Event_AddEventTest extends CiviSeleniumTestCase { $this->type("discount_name_1", $discount1); $this->webtestFillDate("discount_start_date_1", "-3 week"); $this->webtestFillDate("discount_end_date_1", "-2 week"); - $this->clickLink("_qf_Fee_submit", "discounted_value_1_1"); + $this->clickLink("_qf_Fee_submit", "discounted_value_1_1"); + $this->type("discounted_value_1_1","225.00"); $this->type("discounted_value_2_1","300.00"); @@ -441,7 +448,7 @@ class WebTest_Event_AddEventTest extends CiviSeleniumTestCase { $this->click("xpath=//fieldset[@id='discount']/fieldset/table/tbody/tr[2]/td[3]/input"); } $this->click("_qf_Fee_upload-bottom"); - + // Wait for "saved" status msg $this->waitForPageToLoad($this->getTimeoutMsec()); $this->assertElementContainsText("crm-notification-container", "'Fee' information has been saved"); @@ -461,10 +468,11 @@ class WebTest_Event_AddEventTest extends CiviSeleniumTestCase { } $this->fillRichTextField("intro_text", $registerIntro); - + // enable confirmation email $this->click("CIVICRM_QFID_1_is_email_confirm"); - $this->type("confirm_from_name", "Jane Doe"); + $this->type("confirm_from_name", "Jane Doe"); + $this->type("confirm_from_email", "jane.doe@example.org"); $this->click("_qf_Registration_upload-bottom"); @@ -483,10 +491,11 @@ class WebTest_Event_AddEventTest extends CiviSeleniumTestCase { // Check for correct event info strings $this->assertStringsPresent($eventInfoStrings); - + // Optionally verify event fees (especially for discounts) if ($eventFees) { - $this->assertStringsPresent($eventFees); + $this->assertStringsPresent($eventFees); + } $elements = $this->parseURL(); return $elements['queryString']['id']; @@ -508,7 +517,7 @@ class WebTest_Event_AddEventTest extends CiviSeleniumTestCase { $this->select("additional_participants", "value=" . $numberRegistrations); $this->type("email-Primary", "smith" . substr(sha1(rand()), 0, 7) . "@example.org"); - + $this->select("credit_card_type", "value=Visa"); $this->type("credit_card_number", "4111111111111111"); $this->type("cvv2", "000"); diff --git a/tests/phpunit/WebTest/Event/AddParticipationTest.php b/tests/phpunit/WebTest/Event/AddParticipationTest.php index fd24855fac..cd96620877 100644 --- a/tests/phpunit/WebTest/Event/AddParticipationTest.php +++ b/tests/phpunit/WebTest/Event/AddParticipationTest.php @@ -24,7 +24,6 @@ +--------------------------------------------------------------------+ */ - require_once 'CiviTest/CiviSeleniumTestCase.php'; class WebTest_Event_AddParticipationTest extends CiviSeleniumTestCase { @@ -97,7 +96,6 @@ class WebTest_Event_AddParticipationTest extends CiviSeleniumTestCase { $this->click("xpath=//div[@id='Events']//table//tbody/tr[1]/td[8]/span/a[text()='View']"); $this->waitForElementPresent('_qf_ParticipantView_cancel-bottom'); - $this->webtestVerifyTabularData( array( 'Event' => 'Rain-forest Cup Youth Soccer Tournament', @@ -180,7 +178,6 @@ class WebTest_Event_AddParticipationTest extends CiviSeleniumTestCase { $this->type('option_label_3', $checkboxOptionLabel3); $this->type('option_value_3', '3'); - //enter options per line $this->type('options_per_line', '2'); @@ -327,10 +324,11 @@ class WebTest_Event_AddParticipationTest extends CiviSeleniumTestCase { ); } - function testEventAddMultipleParticipants() { + function testEventAddMultipleParticipants() { + // Log in using webtestLogin() method $this->webtestLogin(); - + $processorId = $this->webtestAddPaymentProcessor('dummy' . substr(sha1(rand()), 0, 7)); $rand = substr(sha1(rand()), 0, 7); $firstName = 'First' . $rand; @@ -339,19 +337,19 @@ class WebTest_Event_AddParticipationTest extends CiviSeleniumTestCase { $lastName2 = 'Last' . $rand; $this->openCiviPage("participant/add", "reset=1&action=add&context=standalone&mode=test&eid=3"); - + $this->assertTrue($this->isTextPresent("Register New Participant"), "Page title 'Register New Participant' missing"); $this->assertTrue($this->isTextPresent("A TEST transaction will be submitted"), "test mode status 'A TEST transaction will be submitted' missing"); $this->_fillParticipantDetails($firstName, $lastName, $processorId); $this->click('_qf_Participant_upload_new-bottom'); $this->waitForPageToLoad($this->getTimeoutMsec()); - + $this->assertTrue($this->isTextPresent("Register New Participant"), "Page title 'Register New Participant' missing"); $this->assertTrue($this->isTextPresent("A TEST transaction will be submitted"), "test mode status 'A TEST transaction will be submitted' missing"); $this->_fillParticipantDetails($firstName, $lastName2, $processorId); $this->click('_qf_Participant_upload_new-bottom'); $this->waitForPageToLoad($this->getTimeoutMsec()); - + //searching the paricipants $this->openCiviPage("event/search", "reset=1"); $this->type('sort_name', $firstName); @@ -363,11 +361,11 @@ class WebTest_Event_AddParticipationTest extends CiviSeleniumTestCase { $this->check('participant_test'); $this->click("_qf_Search_refresh"); $this->waitForElementPresent("participantSearch"); - + //verifying the registered participants $names = array( "{$lastName}, {$firstName}", "{$lastName2}, {$firstName}" ); $status = "Registered (test)"; - + foreach($names as $name) { $this->verifyText("xpath=//div[@id='participantSearch']//table//tbody//tr/td[@class='crm-participant-sort_name']/a[text()='{$name}']/../../td[9]", preg_quote($status)); $this->verifyText("xpath=//div[@id='participantSearch']//table//tbody//tr/td[@class='crm-participant-sort_name']/a[text()='{$name}']/../../td[4]/a", preg_quote($eventName)); @@ -377,7 +375,7 @@ class WebTest_Event_AddParticipationTest extends CiviSeleniumTestCase { function _fillParticipantDetails($firstName, $lastName, $processorId) { $this->select("id=profiles_1", "label=New Individual"); $this->waitForElementPresent('_qf_Edit_next'); - + $this->type("id=first_name", $firstName); $this->type("id=last_name", $lastName); $this->click("id=_qf_Edit_next"); diff --git a/tests/phpunit/WebTest/Event/AddPricesetTest.php b/tests/phpunit/WebTest/Event/AddPricesetTest.php index 8f9044eb06..12af2d58c0 100644 --- a/tests/phpunit/WebTest/Event/AddPricesetTest.php +++ b/tests/phpunit/WebTest/Event/AddPricesetTest.php @@ -24,7 +24,6 @@ +--------------------------------------------------------------------+ */ - require_once 'CiviTest/CiviSeleniumTestCase.php'; class WebTest_Event_AddPricesetTest extends CiviSeleniumTestCase { @@ -75,7 +74,8 @@ class WebTest_Event_AddPricesetTest extends CiviSeleniumTestCase { $this->check('extends[2]'); } - $this->select("css=select.form-select", "label={$financialType}"); + $this->select("css=select.form-select", "label={$financialType}"); + $this->type('help_pre', $setHelp); $this->assertChecked('is_active', 'Verify that Is Active checkbox is set.'); @@ -124,7 +124,8 @@ class WebTest_Event_AddPricesetTest extends CiviSeleniumTestCase { $options = array( 1 => array('label' => 'Yes', 'amount' => '50.00', - 'financial_type_id' => 'Donation' + 'financial_type_id' => 'Donation' + ), 2 => array( 'label' => 'No', @@ -475,23 +476,25 @@ class WebTest_Event_AddPricesetTest extends CiviSeleniumTestCase { } /** - * Function to test to regiter participant for event with + * Function to test to regiter participant for event with + * multiple price fields in price-set - * CRM-11986 + * CRM-11986 + * */ function testEventWithPriceSet() { - + // Log in using webtestLogin() method $this->webtestLogin(); - + // Adding contact with randomized first name (so we can then select that contact when creating event registration) // We're using Quick Add block on the main page for this. $firstName = substr(sha1(rand()), 0, 7); $this->webtestAddContact($firstName, 'Anderson', TRUE); $contactName = "Anderson, $firstName"; $displayName = "$firstName Anderson"; - + $setTitle = 'Conference Fees - ' . substr(sha1(rand()), 0, 7); $usedFor = 'Event'; $setHelp = 'Select your conference options.'; @@ -510,7 +513,7 @@ class WebTest_Event_AddPricesetTest extends CiviSeleniumTestCase { 'Evening Sessions' => 'CheckBox', ); $this->_testAddPriceFields($fields, $validateStrings); - + // load the Price Set Preview and check for expected values $this->_testVerifyPriceSet($validateStrings, $sid); @@ -521,17 +524,17 @@ class WebTest_Event_AddPricesetTest extends CiviSeleniumTestCase { $eventDescription = 'Here is a description for this conference.'; $this->select('event_type_id', 'value=1'); - + // Attendee role s/b selected now. $this->select('default_role_id', 'value=1'); - + // Enter Event Title, Summary and Description $this->type('title', $eventTitle); $this->type('summary', 'This is a great conference. Sign up now!'); - + // Type description in ckEditor (fieldname, text to type, editor) $this->fillRichTextField('description', $eventDescription); - + // Choose Start and End dates. // Using helper webtestFillDate function. $this->webtestFillDateTime("start_date", "+1 week"); @@ -550,7 +553,7 @@ class WebTest_Event_AddPricesetTest extends CiviSeleniumTestCase { $this->click('CIVICRM_QFID_1_is_monetary'); $this->select('financial_type_id','label=Event Fee'); $this->select('price_set_id', 'label=' . $setTitle); - + $this->click('_qf_Fee_upload-bottom'); $this->waitForPageToLoad($this->getTimeoutMsec()); @@ -561,19 +564,19 @@ class WebTest_Event_AddPricesetTest extends CiviSeleniumTestCase { $this->select('event_id', "label=regexp:$eventTitle"); // Select role $this->click('role_id[2]'); - + // Choose Registration Date. // Using helper webtestFillDate function. $this->webtestFillDate('register_date', 'now'); $today = date('F jS, Y', strtotime('now')); // May 5th, 2010 - + // Select participant status $this->select('status_id', 'value=1'); // Setting registration source $this->type('source', 'Event StandaloneAddTest Webtest'); - + // Select an event fee $this->waitForElementPresent('priceset'); $this->type("//div[@id='priceset']//div[@class='crm-section Full_Conference-section']/div[2]/input", '5'); @@ -581,24 +584,24 @@ class WebTest_Event_AddPricesetTest extends CiviSeleniumTestCase { $this->click("xpath=//div[@id='priceset']//div[@class='crm-section Pre_conference_Meetup_-section']/div[2]/div[1]/span/input"); $this->click("xpath=//div[@id='priceset']//div[@class='crm-section Evening_Sessions-section']/div[2]/div[1]/span/input"); $this->click("xpath=//div[@id='priceset']//div[@class='crm-section Evening_Sessions-section']/div[2]/div[2]/span/input"); - + // Select payment method = Check and enter chk number $this->select('payment_instrument_id', 'value=4'); $this->waitForElementPresent('check_number'); - $this->type('check_number', '1044'); - + $this->type('check_number', '1044'); + // Clicking save. $this->click('_qf_Participant_upload-bottom'); $this->waitForPageToLoad($this->getTimeoutMsec()); - + // Is status message correct? $this->assertElementContainsText("css=#crm-notification-container", "Event registration for $displayName has been added", "Status message didn't show up after saving!"); - + $this->waitForElementPresent("xpath=//div[@id='Events']//table//tbody/tr[1]/td[8]/span/a[text()='View']"); //click through to the participant view screen $this->click("xpath=//div[@id='Events']//table//tbody/tr[1]/td[8]/span/a[text()='View']"); $this->waitForElementPresent('_qf_ParticipantView_cancel-bottom'); - + $this->webtestVerifyTabularData( array( 'Event' => $eventTitle, @@ -651,10 +654,12 @@ class WebTest_Event_AddPricesetTest extends CiviSeleniumTestCase { ) ); } - + function _checkLineItems($expectedLineItems) { - foreach ($expectedLineItems as $lineKey => $lineValue) { - foreach ($lineValue as $key => $value) { + foreach ($expectedLineItems as $lineKey => $lineValue) { + + foreach ($lineValue as $key => $value) { + $this->verifyText("xpath=//table/tbody/tr/td[text()='Event Fees']/following-sibling::td/table/tbody/tr[$lineKey]/td[$key]", preg_quote($value)); } } diff --git a/tests/phpunit/WebTest/Event/ChangeParticipantStatus.php b/tests/phpunit/WebTest/Event/ChangeParticipantStatus.php index 77f5c1e0cd..eb84a7c135 100644 --- a/tests/phpunit/WebTest/Event/ChangeParticipantStatus.php +++ b/tests/phpunit/WebTest/Event/ChangeParticipantStatus.php @@ -24,7 +24,6 @@ +--------------------------------------------------------------------+ */ - require_once 'CiviTest/CiviSeleniumTestCase.php'; class WebTest_Event_ChangeParticipantStatus extends CiviSeleniumTestCase { diff --git a/tests/phpunit/WebTest/Event/EventListingTest.php b/tests/phpunit/WebTest/Event/EventListingTest.php index b5a0ffce8c..c0dd9b2c0f 100644 --- a/tests/phpunit/WebTest/Event/EventListingTest.php +++ b/tests/phpunit/WebTest/Event/EventListingTest.php @@ -155,4 +155,3 @@ class WebTest_Event_EventListingTest extends CiviSeleniumTestCase { } } - diff --git a/tests/phpunit/WebTest/Event/EventWaitListTest.php b/tests/phpunit/WebTest/Event/EventWaitListTest.php index 760b350119..44d45846f2 100644 --- a/tests/phpunit/WebTest/Event/EventWaitListTest.php +++ b/tests/phpunit/WebTest/Event/EventWaitListTest.php @@ -22,7 +22,6 @@ +--------------------------------------------------------------------+ */ - require_once 'CiviTest/CiviSeleniumTestCase.php'; class WebTest_Event_EventWaitListTest extends CiviSeleniumTestCase { diff --git a/tests/phpunit/WebTest/Event/MultipleEventRegistrationbyCartTest.php b/tests/phpunit/WebTest/Event/MultipleEventRegistrationbyCartTest.php index 239a09301f..b11a6d471c 100755 --- a/tests/phpunit/WebTest/Event/MultipleEventRegistrationbyCartTest.php +++ b/tests/phpunit/WebTest/Event/MultipleEventRegistrationbyCartTest.php @@ -24,175 +24,176 @@ +--------------------------------------------------------------------+ */ - require_once 'CiviTest/CiviSeleniumTestCase.php'; class WebTest_Event_MultipleEventRegistrationbyCartTest extends CiviSeleniumTestCase { - + protected function setUp() { parent::setUp(); } - - function testAuthenticatedMultipleEvent(){ + + function testAuthenticatedMultipleEvent(){ + // Log in using webtestLogin() method $this->webtestLogin(); - + //Enable shopping cart style $this->openCiviPage("admin/setting/preferences/event", "reset=1"); $this->check("enable_cart"); $this->click("_qf_Event_next-top"); $this->waitForPageToLoad($this->getTimeoutMsec()); - + // We need a payment processor $processorName = "Webtest Dummy" . substr(sha1(rand()), 0, 7); $this->webtestAddPaymentProcessor($processorName); - + //event 1 $this->openCiviPage("event/add", "reset=1&action=add"); - + $eventTitle1 = 'My Conference1 - ' . substr(sha1(rand()), 0, 7); $eventDescription1 = "Here is a description for this conference 1."; $this->_testAddEventInfo($eventTitle1, $eventDescription1); - + $streetAddress1 = "100 Main Street"; $this->_testAddLocation($streetAddress1); - + $this->_testAddFees(FALSE, FALSE, $processorName); - + // intro text for registration page $registerIntro = "Fill in all the fields below and click Continue."; $multipleRegistrations = TRUE; $this->_testAddOnlineRegistration($registerIntro, $multipleRegistrations); - + $eventInfoStrings1 = array($eventTitle1, $eventDescription1, $streetAddress1); $this->_AddEventToCart($eventTitle1, $eventInfoStrings1); - + //event 2 $this->openCiviPage("event/add", "reset=1&action=add"); - + $eventTitle2 = 'My Conference2 - ' . substr(sha1(rand()), 0, 7); $eventDescription2 = "Here is a description for this conference 2."; $this->_testAddEventInfo($eventTitle2, $eventDescription2); - + $streetAddress2 = "101 Main Street"; $this->_testAddLocation($streetAddress2); - + $this->_testAddFees(FALSE, FALSE, $processorName); - + // intro text for registration page $registerIntro = "Fill in all the fields below and click Continue."; $multipleRegistrations = TRUE; $this->_testAddOnlineRegistration($registerIntro, $multipleRegistrations); - + $eventInfoStrings2 = array($eventTitle2, $eventDescription2, $streetAddress2); $this->_AddEventToCart($eventTitle2, $eventInfoStrings2); - + //event 3 $this->openCiviPage("event/add", "reset=1&action=add"); - + $eventTitle3 = 'My Conference3 - ' . substr(sha1(rand()), 0, 7); $eventDescription3 = "Here is a description for this conference 3."; $this->_testAddEventInfo($eventTitle3, $eventDescription3); - + $streetAddress3 = "102 Main Street"; $this->_testAddLocation($streetAddress3); - + $this->_testAddFees(FALSE, FALSE, $processorName); - + // intro text for registration page $registerIntro = "Fill in all the fields below and click Continue."; $multipleRegistrations = TRUE; $this->_testAddOnlineRegistration($registerIntro, $multipleRegistrations); - + $eventInfoStrings3 = array($eventTitle3, $eventDescription3, $streetAddress3); $this->_AddEventToCart($eventTitle3, $eventInfoStrings3); - + //Checkout $value = $this->_testCheckOut(); - + //three event names $events = array( 1 => $eventTitle1, 2 => $eventTitle2, 3 => $eventTitle3, ); - //check the existence of the contacts who were registered and the one who did the contribution + //check the existence of the contacts who were registered and the one who did the contribution + $this->_checkContributionsandEventRegistration($value[0],$value[1],$events); } - + function testAnonymousMultipleEvent(){ // This is the path where our testing install resides. // The rest of URL is defined in CiviSeleniumTestCase base class, in // class attributes. - + // Log in using webtestLogin() method $this->webtestLogin(); - + // We need a payment processor $processorName = "Webtest Dummy" . substr(sha1(rand()), 0, 7); $this->webtestAddPaymentProcessor($processorName); - + //event 1 $this->openCiviPage("event/add", "reset=1&action=add"); - + $eventTitle1 = 'My Conference1 - ' . substr(sha1(rand()), 0, 7); $eventDescription1 = "Here is a description for this conference 1."; $this->_testAddEventInfo($eventTitle1, $eventDescription1); - + $streetAddress1 = "100 Main Street"; $this->_testAddLocation($streetAddress1); - + $this->_testAddFees(FALSE, FALSE, $processorName); - + // intro text for registration page $registerIntro = "Fill in all the fields below and click Continue."; $multipleRegistrations = TRUE; $this->_testAddOnlineRegistration($registerIntro, $multipleRegistrations); - + $eventInfoStrings1 = array($eventTitle1, $eventDescription1, $streetAddress1); $registerUrl1 = $this->_testVerifyEventInfo($eventTitle1, $eventInfoStrings1); //event 2 $this->openCiviPage("event/add", "reset=1&action=add"); - + $eventTitle2 = 'My Conference2 - ' . substr(sha1(rand()), 0, 7); $eventDescription2 = "Here is a description for this conference 2."; $this->_testAddEventInfo($eventTitle2, $eventDescription2); - + $streetAddress2 = "101 Main Street"; $this->_testAddLocation($streetAddress2); - + $this->_testAddFees(FALSE, FALSE, $processorName); - + // intro text for registration page $registerIntro = "Fill in all the fields below and click Continue."; $multipleRegistrations = TRUE; $this->_testAddOnlineRegistration($registerIntro, $multipleRegistrations); - + $eventInfoStrings2 = array($eventTitle2, $eventDescription2, $streetAddress2); $registerUrl2 = $this->_testVerifyEventInfo($eventTitle2, $eventInfoStrings2); //event 3 $this->openCiviPage("event/add", "reset=1&action=add"); - + $eventTitle3 = 'My Conference3 - ' . substr(sha1(rand()), 0, 7); $eventDescription3 = "Here is a description for this conference 3."; $this->_testAddEventInfo($eventTitle3, $eventDescription3); - + $streetAddress3 = "102 Main Street"; $this->_testAddLocation($streetAddress3); - + $this->_testAddFees(FALSE, FALSE, $processorName); - + // intro text for registration page $registerIntro = "Fill in all the fields below and click Continue."; $multipleRegistrations = TRUE; $this->_testAddOnlineRegistration($registerIntro, $multipleRegistrations); - + $eventInfoStrings3 = array($eventTitle3, $eventDescription3, $streetAddress3); $registerUrl3 = $this->_testVerifyEventInfo($eventTitle3, $eventInfoStrings3); @@ -218,10 +219,11 @@ class WebTest_Event_MultipleEventRegistrationbyCartTest extends CiviSeleniumTest 2 => $eventTitle2, 3 => $eventTitle3, ); - //check the existence of the contacts who were registered and the one who did the contribution + //check the existence of the contacts who were registered and the one who did the contribution + $this->_checkContributionsandEventRegistration($value[0],$value[1],$events); } - + function _testAddEventInfo($eventTitle, $eventDescription) { $this->waitForElementPresent("_qf_EventInfo_upload-bottom"); @@ -251,7 +253,7 @@ class WebTest_Event_MultipleEventRegistrationbyCartTest extends CiviSeleniumTest // Wait for Location tab form to load $this->waitForPageToLoad($this->getTimeoutMsec()); $this->waitForElementPresent("_qf_Location_upload-bottom"); - + $this->type("address_1_street_address", $streetAddress); $this->type("address_1_city", "San Francisco"); $this->type("address_1_postal_code", "94117"); @@ -336,20 +338,21 @@ class WebTest_Event_MultipleEventRegistrationbyCartTest extends CiviSeleniumTest $this->waitForPageToLoad($this->getTimeoutMsec()); $this->assertTrue($this->isTextPresent("$eventTitle has been added to your cart")); } - + function _testVerifyEventInfo($eventTitle, $eventInfoStrings, $eventFees = NULL) { // verify event input on info page // start at Manage Events listing $this->openCiviPage("event/manage", "reset=1"); $this->click("link=$eventTitle"); $this->waitForPageToLoad($this->getTimeoutMsec()); - + // Check for correct event info strings $this->assertStringsPresent($eventInfoStrings); - + // Optionally verify event fees (especially for discounts) if ($eventFees) { - $this->assertStringsPresent($eventFees); + $this->assertStringsPresent($eventFees); + } return $this->getLocation(); } @@ -368,12 +371,12 @@ class WebTest_Event_MultipleEventRegistrationbyCartTest extends CiviSeleniumTest function _testCheckOut(){ //View the Cart $this->click("xpath=//div[@id='messages']/div/div/a[text()='View your cart.']"); - + //Click on Checkout $this->waitForElementPresent("xpath=//a[@class='button crm-check-out-button']/span"); $this->click("xpath=//a[@class='button crm-check-out-button']/span"); $this->waitForPageToLoad($this->getTimeoutMsec()); - + $firstName = "AB".substr(sha1(rand()), 0, 7); $lastName = "XY".substr(sha1(rand()), 0, 7); for( $i = 1; $i <= 3; $i++ ){ @@ -396,10 +399,10 @@ class WebTest_Event_MultipleEventRegistrationbyCartTest extends CiviSeleniumTest $this->select("billing_state_province_id-5", "value=1004"); $this->type("billing_postal_code-5", "94129"); $this->type("billing_contact_email", "{$firstName}.{$lastName}@example.com"); - + $this->click("_qf_Payment_next-bottom"); $this->waitForPageToLoad($this->getTimeoutMsec()); - + $this->assertTrue($this->isTextPresent("This is your receipt of payment made for the following event registration.")); return array($firstName, $lastName); } @@ -409,14 +412,14 @@ class WebTest_Event_MultipleEventRegistrationbyCartTest extends CiviSeleniumTest $this->click('sort_name_navigation'); $this->type('css=input#sort_name_navigation',"{$firstName}.{$lastName}@home.com" ); $this->typeKeys('css=input#sort_name_navigation', "{$firstName}.{$lastName}@home.com"); - + // Wait for result list. $this->waitForElementPresent("css=div.ac_results-inner li"); - + // Visit contact summary page. $this->click("css=div.ac_results-inner li"); $this->waitForPageToLoad($this->getTimeoutMsec()); - + //click on Events Tab $this->click("xpath=//li[@id='tab_participant']/a"); //check if the participant is registered for all the three events @@ -428,19 +431,19 @@ class WebTest_Event_MultipleEventRegistrationbyCartTest extends CiviSeleniumTest $this->waitForElementPresent("xpath=//table[@class='selector']/tbody/tr[$i]/td[6][text()='Registered']"); $this->assertTrue($this->isElementPresent("xpath=//table[@class='selector']/tbody/tr[$i]/td[6][text()='Registered']")); } - + //Type the billing email in autocomplete. $this->click('sort_name_navigation'); $this->type('css=input#sort_name_navigation',"{$firstName}.{$lastName}@example.com" ); $this->typeKeys('css=input#sort_name_navigation', "{$firstName}.{$lastName}@example.com"); - + // Wait for result list. $this->waitForElementPresent("css=div.ac_results-inner li"); - + // Visit contact summary page. $this->click("css=div.ac_results-inner li"); $this->waitForPageToLoad($this->getTimeoutMsec()); - + //click on Contributions Tab $this->click("xpath=//li[@id='tab_contribute']/a"); //check for the three contributions @@ -448,7 +451,7 @@ class WebTest_Event_MultipleEventRegistrationbyCartTest extends CiviSeleniumTest $this->waitForElementPresent("xpath=//table[@class='selector']/tbody/tr/td[3][contains(text(),'$value')]"); $this->assertTrue($this->isElementPresent("xpath=//table[@class='selector']/tbody/tr/td[3][contains(text(),'$value')]")); } - + //Disable shopping cart style $this->openCiviPage("admin/setting/preferences/event", "reset=1"); $this->click("enable_cart"); diff --git a/tests/phpunit/WebTest/Event/MultiprofileEventTest.php b/tests/phpunit/WebTest/Event/MultiprofileEventTest.php index 919c6cc2c4..7a1541d745 100644 --- a/tests/phpunit/WebTest/Event/MultiprofileEventTest.php +++ b/tests/phpunit/WebTest/Event/MultiprofileEventTest.php @@ -24,7 +24,6 @@ +--------------------------------------------------------------------+ */ - require_once 'CiviTest/CiviSeleniumTestCase.php'; class WebTest_Event_MultiprofileEventTest extends CiviSeleniumTestCase { @@ -50,7 +49,7 @@ class WebTest_Event_MultiprofileEventTest extends CiviSeleniumTestCase { //add email to name and address profile $cfId = $this->_addEmailField(); - + // create custom group1 $this->openCiviPage("admin/custom/group", "reset=1"); $this->click("newCustomDataGroup"); @@ -151,7 +150,7 @@ class WebTest_Event_MultiprofileEventTest extends CiviSeleniumTestCase { //add email field to name and address profile $cfId = $this->_addEmailField( ); - + // create custom group1 $this->openCiviPage("admin/custom/group", "reset=1"); $this->click("newCustomDataGroup"); @@ -255,7 +254,8 @@ class WebTest_Event_MultiprofileEventTest extends CiviSeleniumTestCase { $this->verifyText("xpath=//form[@id='ParticipantView']/div[2]/table/tbody/tr[6]/td[2]", preg_quote($status)); // delete all custom data - if (isset($cfId)) { + if (isset($cfId)) { + $this->_removeEmailField($cfId); } foreach ($customId as $cid) { @@ -732,7 +732,7 @@ class WebTest_Event_MultiprofileEventTest extends CiviSeleniumTestCase { $this->clickLink("_qf_Participant_1_next-Array", "_qf_Confirm_next-bottom"); $this->click("_qf_Confirm_next-bottom"); } - + function _addEmailField( ){ //add email field in name and address profile $this->openCiviPage('admin/uf/group/field/add', 'reset=1&action=add&gid=1', "_qf_Field_next-bottom"); @@ -741,7 +741,7 @@ class WebTest_Event_MultiprofileEventTest extends CiviSeleniumTestCase { $this->select("field_name[2]", "value=0"); $this->click('_qf_Field_next-bottom'); $this->waitForPageToLoad($this->getTimeoutMsec()); - + $cfId = ""; //check wheather webtest has created the field if (!$this->isTextPresent("The selected field was not added. It already exists in this profile")) { @@ -751,8 +751,9 @@ class WebTest_Event_MultiprofileEventTest extends CiviSeleniumTestCase { } return $cfId; } - - function _removeEmailField($cfId) { + + function _removeEmailField($cfId) { + $this->openCiviPage("admin/uf/group/field", "action=delete&id={$cfId}"); $this->click("_qf_Field_next-bottom"); $this->waitForPageToLoad($this->getTimeoutMsec()); diff --git a/tests/phpunit/WebTest/Event/PCPAddTest.php b/tests/phpunit/WebTest/Event/PCPAddTest.php index 340e8486c3..793edfcf5f 100644 --- a/tests/phpunit/WebTest/Event/PCPAddTest.php +++ b/tests/phpunit/WebTest/Event/PCPAddTest.php @@ -350,7 +350,7 @@ class WebTest_Event_PCPAddTest extends CiviSeleniumTestCase { $firstNameDonar = 'Andrew' . substr(sha1(rand()), 0, 7); $lastNameDonar = 'Roger' . substr(sha1(rand()), 0, 7); $middleNameDonar = 'Nicholas' . substr(sha1(rand()), 0, 7); - + $this->type("{$emailElement}", $firstNameDonar . "@example.com"); $this->webtestAddCreditCardDetails(); $this->webtestAddBillingDetails($firstNameDonar, $middleNameDonar, $lastNameDonar); diff --git a/tests/phpunit/WebTest/Event/ParticipantCountTest.php b/tests/phpunit/WebTest/Event/ParticipantCountTest.php index 475b7f8587..19bd5ec839 100644 --- a/tests/phpunit/WebTest/Event/ParticipantCountTest.php +++ b/tests/phpunit/WebTest/Event/ParticipantCountTest.php @@ -24,7 +24,6 @@ +--------------------------------------------------------------------+ */ - require_once 'CiviTest/CiviSeleniumTestCase.php'; class WebTest_Event_ParticipantCountTest extends CiviSeleniumTestCase { diff --git a/tests/phpunit/WebTest/Event/ParticipantSearchTest.php b/tests/phpunit/WebTest/Event/ParticipantSearchTest.php index 7b2b3370cb..ac88fd5a42 100644 --- a/tests/phpunit/WebTest/Event/ParticipantSearchTest.php +++ b/tests/phpunit/WebTest/Event/ParticipantSearchTest.php @@ -24,7 +24,6 @@ +--------------------------------------------------------------------+ */ - require_once 'CiviTest/CiviSeleniumTestCase.php'; class WebTest_Event_ParticipantSearchTest extends CiviSeleniumTestCase { @@ -156,7 +155,6 @@ class WebTest_Event_ParticipantSearchTest extends CiviSeleniumTestCase { $this->type("event_type", $eventTypeName); $this->type("event_type_id", 3); - $this->click("_qf_Search_refresh"); $this->waitForPageToLoad($this->getTimeoutMsec()); diff --git a/tests/phpunit/WebTest/Event/PricesetMaxCountTest.php b/tests/phpunit/WebTest/Event/PricesetMaxCountTest.php index fbf33a8749..42201444cb 100644 --- a/tests/phpunit/WebTest/Event/PricesetMaxCountTest.php +++ b/tests/phpunit/WebTest/Event/PricesetMaxCountTest.php @@ -24,7 +24,6 @@ +--------------------------------------------------------------------+ */ - require_once 'CiviTest/CiviSeleniumTestCase.php'; class WebTest_Event_PricesetMaxCountTest extends CiviSeleniumTestCase { @@ -639,7 +638,6 @@ class WebTest_Event_PricesetMaxCountTest extends CiviSeleniumTestCase { $this->_checkConfirmationAndRegister(); - // 2'st registration // Register Participant 1 // visit event info page @@ -930,7 +928,6 @@ class WebTest_Event_PricesetMaxCountTest extends CiviSeleniumTestCase { $this->_checkConfirmationAndRegister(); - // 2'st registration // Register Participant 1 // visit event info page @@ -1051,7 +1048,8 @@ class WebTest_Event_PricesetMaxCountTest extends CiviSeleniumTestCase { if (isset($field['financial_type_id'])) { $this->waitForElementPresent('financial_type_id'); $this->select('financial_type_id', "value={$field['financial_type_id']}"); - } + } + } else { $this->_testAddMultipleChoiceOptions($field['options'], $field['type']); @@ -1087,11 +1085,11 @@ class WebTest_Event_PricesetMaxCountTest extends CiviSeleniumTestCase { $this->waitForElementPresent("option_max_value_{$oIndex}"); $this->type("option_max_value_{$oIndex}", $oValue['max_count']); } - + if (!empty($oValue['financial_type_id'])) { $this->select( "option_financial_type_id_{$oIndex}", "value={$oValue['financial_type_id']}" ); } - + $this->click('link=another choice'); } @@ -1136,7 +1134,7 @@ class WebTest_Event_PricesetMaxCountTest extends CiviSeleniumTestCase { $processorName = $params['payment_processor']; $this->click("xpath=//tr[@class='crm-event-manage-fee-form-block-payment_processor']/td[2]/label[text()='$processorName']"); $this->select('financial_type_id', 'value=4'); - + if (array_key_exists('price_set', $params)) { $this->select('price_set_id', 'label=' . $params['price_set']); } diff --git a/tests/phpunit/WebTest/Event/TellAFriendTest.php b/tests/phpunit/WebTest/Event/TellAFriendTest.php index 9c63f8ceed..7e6b96563b 100644 --- a/tests/phpunit/WebTest/Event/TellAFriendTest.php +++ b/tests/phpunit/WebTest/Event/TellAFriendTest.php @@ -24,7 +24,6 @@ +--------------------------------------------------------------------+ */ - require_once 'CiviTest/CiviSeleniumTestCase.php'; class WebTest_Event_TellAFriendTest extends CiviSeleniumTestCase { diff --git a/tests/phpunit/WebTest/Export/ContactTest.php b/tests/phpunit/WebTest/Export/ContactTest.php index f8df1770c6..6f17c4f2f3 100644 --- a/tests/phpunit/WebTest/Export/ContactTest.php +++ b/tests/phpunit/WebTest/Export/ContactTest.php @@ -24,7 +24,6 @@ +--------------------------------------------------------------------+ */ - require_once 'WebTest/Export/ExportCiviSeleniumTestCase.php'; class WebTest_Export_ContactTest extends ExportCiviSeleniumTestCase { @@ -97,10 +96,10 @@ class WebTest_Export_ContactTest extends ExportCiviSeleniumTestCase { // Is contact present in search result? $this->assertElementContainsText('css=div.crm-search-results', $sortName, "Contact did not found in search result!"); - + // Is contact present in search result? $this->assertElementContainsText('css=div.crm-search-results', $childSortName, "Contact did not found in search result!"); - + // select to export all the contasct from search result. $this->click("CIVICRM_QFID_ts_all_4"); @@ -248,13 +247,13 @@ class WebTest_Export_ContactTest extends ExportCiviSeleniumTestCase { // Is contact present in search result? $this->assertElementContainsText('css=div.crm-search-results', $sortName1, "Contact did not found in search result!"); - + // Is contact present in search result? $this->assertElementContainsText('css=div.crm-search-results', $sortName2, "Contact did not found in search result!"); - + // Is contact present in search result? $this->assertElementContainsText('css=div.crm-search-results', $houseHold, "Contact did not found in search result!"); - + // select to export all the contasct from search result. $this->click("CIVICRM_QFID_ts_all_4"); diff --git a/tests/phpunit/WebTest/Export/ExportCiviSeleniumTestCase.php b/tests/phpunit/WebTest/Export/ExportCiviSeleniumTestCase.php index a9bc270cf2..3a1a29a5b3 100644 --- a/tests/phpunit/WebTest/Export/ExportCiviSeleniumTestCase.php +++ b/tests/phpunit/WebTest/Export/ExportCiviSeleniumTestCase.php @@ -24,7 +24,6 @@ +--------------------------------------------------------------------+ */ - require_once 'CiviTest/CiviSeleniumTestCase.php'; class ExportCiviSeleniumTestCase extends CiviSeleniumTestCase { diff --git a/tests/phpunit/WebTest/Financial/FinancialAccountTest.php b/tests/phpunit/WebTest/Financial/FinancialAccountTest.php index e8891f6794..07b74b5fbb 100644 --- a/tests/phpunit/WebTest/Financial/FinancialAccountTest.php +++ b/tests/phpunit/WebTest/Financial/FinancialAccountTest.php @@ -33,7 +33,7 @@ class WebTest_Financial_FinancialAccountTest extends CiviSeleniumTestCase { */ function testFinancialAccount() { $this->webtestLogin(); - + // Add new Financial Account $orgName = 'Alberta '.substr(sha1(rand()), 0, 7); $financialAccountTitle = 'Financial Account '.substr(sha1(rand()), 0, 4); @@ -45,12 +45,12 @@ class WebTest_Financial_FinancialAccountTest extends CiviSeleniumTestCase { $isTax = TRUE; $taxRate = 9.99999999; $isDefault = FALSE; - + //Add new organisation if($orgName) { $this->webtestAddOrganization($orgName); } - + $this->_testAddFinancialAccount($financialAccountTitle, $financialAccountDescription, $accountingCode, @@ -62,9 +62,9 @@ class WebTest_Financial_FinancialAccountTest extends CiviSeleniumTestCase { $taxRate, $isDefault ); - + $this->waitForElementPresent("xpath=//table/tbody//tr/td[1][text()='{$financialAccountTitle}']/../td[9]/span/a[text()='Edit']"); - + $this->clickLink("xpath=//table/tbody//tr/td[1][text()='{$financialAccountTitle}']/../td[9]/span/a[text()='Edit']", '_qf_FinancialAccount_cancel-botttom'); //Varify Data after Adding new Financial Account $verifyData = array('name' => $financialAccountTitle, @@ -76,23 +76,23 @@ class WebTest_Financial_FinancialAccountTest extends CiviSeleniumTestCase { 'is_deductible' => 'off', 'is_default' => 'off' ); - + $this->_assertFinancialAccount($verifyData); $verifySelectFieldData = array('financial_account_type_id' => $financialAccountType); $this->_assertSelectVerify($verifySelectFieldData); $this->click('_qf_FinancialAccount_cancel-botttom'); - + //Edit Financial Account $editfinancialAccount = $financialAccountTitle; $financialAccountTitle .= ' Edited'; $orgNameEdit = FALSE; $financialAccountType = 'Revenue'; - + if ($orgNameEdit) { $orgNameEdit = 'NGO '.substr(sha1(rand()), 0, 7); $this->webtestAddOrganization($orgNameEdit); } - + $this->_testEditFinancialAccount($editfinancialAccount, $financialAccountTitle, $financialAccountDescription, @@ -104,13 +104,14 @@ class WebTest_Financial_FinancialAccountTest extends CiviSeleniumTestCase { $isTax, $taxRate, $isDefault - ); + ); + if($orgNameEdit) { $orgName = $orgNameEdit; } $this->waitForElementPresent("xpath=//table/tbody//tr/td[1][text()='{$financialAccountTitle}']/../td[9]/span/a[text()='Edit']"); $this->clickLink("xpath=//table/tbody//tr/td[1][text()='{$financialAccountTitle}']/../td[9]/span/a[text()='Edit']", '_qf_FinancialAccount_cancel-botttom'); - + $verifyData = array( 'name' => $financialAccountTitle, 'description' => $financialAccountDescription, 'accounting_code' => $accountingCode, @@ -125,7 +126,7 @@ class WebTest_Financial_FinancialAccountTest extends CiviSeleniumTestCase { $this->_assertSelectVerify($verifySelectFieldData); $this->click('_qf_FinancialAccount_cancel-botttom'); $this->waitForElementPresent("xpath=//table/tbody//tr/td[1][text()='{$financialAccountTitle}']/../td[9]/span/a[text()='Delete']"); - + //Delete Financial Account $this->_testDeleteFinancialAccount($financialAccountTitle); } diff --git a/tests/phpunit/WebTest/Financial/FinancialAccountTypeTest.php b/tests/phpunit/WebTest/Financial/FinancialAccountTypeTest.php index 20221e7765..76a55d9853 100644 --- a/tests/phpunit/WebTest/Financial/FinancialAccountTypeTest.php +++ b/tests/phpunit/WebTest/Financial/FinancialAccountTypeTest.php @@ -30,12 +30,13 @@ require_once 'CiviTest/CiviSeleniumTestCase.php'; class WebTest_Financial_FinancialAccountTypeTest extends CiviSeleniumTestCase { function testFinancialAccount() { - // To Add Financial Account + // To Add Financial Account + // class attributes. - + // Log in using webtestLogin() method $this->webtestLogin(); - + // Add new Financial Account $orgName = 'Alberta '.substr(sha1(rand()), 0, 7); $financialAccountTitle = 'Financial Account '.substr(sha1(rand()), 0, 4); @@ -47,13 +48,14 @@ class WebTest_Financial_FinancialAccountTypeTest extends CiviSeleniumTestCase { $isTax = TRUE; $taxRate = 5.20; $isDefault = FALSE; - + //Add new organisation if ($orgName) { $this->webtestAddOrganization($orgName); } - - $this->_testAddFinancialAccount( + + $this->_testAddFinancialAccount( + $financialAccountTitle, $financialAccountDescription, $accountingCode, @@ -65,13 +67,14 @@ class WebTest_Financial_FinancialAccountTypeTest extends CiviSeleniumTestCase { $taxRate, $isDefault ); - + $this->waitForElementPresent("xpath=//table/tbody//tr/td[1][text()='{$financialAccountTitle}']/../td[9]/span/a[text()='Edit']"); - + $this->clickLink("xpath=//table/tbody//tr/td[1][text()='{$financialAccountTitle}']/../td[9]/span/a[text()='Edit']", '_qf_FinancialAccount_cancel-botttom'); - + //Varify Data after Adding new Financial Account - $verifyData = array( + $verifyData = array( + 'name' => $financialAccountTitle, 'description' => $financialAccountDescription, 'accounting_code' => $accountingCode, @@ -81,7 +84,7 @@ class WebTest_Financial_FinancialAccountTypeTest extends CiviSeleniumTestCase { 'is_deductible' => 'off', 'is_default' => 'off', ); - + $this->_assertFinancialAccount($verifyData); $verifySelectFieldData = array( 'financial_account_type_id' => $financialAccountType, @@ -96,11 +99,14 @@ class WebTest_Financial_FinancialAccountTypeTest extends CiviSeleniumTestCase { $financialType['is_reserved'] = false; $this->addeditFinancialType($financialType); $accountRelationship = "Income Account is"; - $expected[] = array( - 'financial_account' => $financialAccountTitle, - 'account_relationship' => $accountRelationship + $expected[] = array( + + 'financial_account' => $financialAccountTitle, + + 'account_relationship' => $accountRelationship + ); - + $this->select('account_relationship', "label={$accountRelationship}"); $this->select('financial_account_id', "label={$financialAccountTitle}"); $this->click('_qf_FinancialTypeAccount_next_new'); @@ -112,9 +118,12 @@ class WebTest_Financial_FinancialAccountTypeTest extends CiviSeleniumTestCase { $this->assertElementContainsText('crm-notification-container', $text, 'Missing text: ' . $text); $this->assertTrue($this->isTextPresent($text), 'Missing text: ' . $text); $accountRelationship = 'Expense Account is'; - $expected[] = array( - 'financial_account' => 'Banking Fees', - 'account_relationship' => $accountRelationship + $expected[] = array( + + 'financial_account' => 'Banking Fees', + + 'account_relationship' => $accountRelationship + ); $this->select('account_relationship', "label={$accountRelationship}"); @@ -124,7 +133,7 @@ class WebTest_Financial_FinancialAccountTypeTest extends CiviSeleniumTestCase { $text = 'The financial type Account has been saved.'; $this->assertElementContainsText('crm-notification-container', $text, 'Missing text: ' . $text); $this->assertTrue($this->isTextPresent($text), 'Missing text: ' . $text); - + foreach ($expected as $value => $label) { $this->verifyText("xpath=id('ltype')/div/table/tbody/tr/td[1][text()='$label[financial_account]']/../td[2]", preg_quote($label['account_relationship'])); } @@ -148,7 +157,7 @@ class WebTest_Financial_FinancialAccountTypeTest extends CiviSeleniumTestCase { $this->click('_qf_FinancialTypeAccount_next-botttom'); $this->waitForPageToLoad($this->getTimeoutMsec()); $this->assertElementContainsText('crm-notification-container', 'Selected financial type account has been deleted.', 'Missing text: ' . 'Selected financial type account has been deleted.'); - + //edit financial type $financialType['oldname'] = $financialType['name']; $financialType['name'] = 'Edited FinancialType '.substr(sha1(rand()), 0, 4); diff --git a/tests/phpunit/WebTest/Generic/CheckActivityTest.php b/tests/phpunit/WebTest/Generic/CheckActivityTest.php index 9dbab8923a..a53b716aa5 100644 --- a/tests/phpunit/WebTest/Generic/CheckActivityTest.php +++ b/tests/phpunit/WebTest/Generic/CheckActivityTest.php @@ -24,7 +24,6 @@ +--------------------------------------------------------------------+ */ - require_once 'CiviTest/CiviSeleniumTestCase.php'; class WebTest_Generic_CheckActivityTest extends CiviSeleniumTestCase { @@ -81,4 +80,3 @@ class WebTest_Generic_CheckActivityTest extends CiviSeleniumTestCase { } } - diff --git a/tests/phpunit/WebTest/Generic/CheckDashboardTest.php b/tests/phpunit/WebTest/Generic/CheckDashboardTest.php index 081669ebb9..22bc41c8a5 100644 --- a/tests/phpunit/WebTest/Generic/CheckDashboardTest.php +++ b/tests/phpunit/WebTest/Generic/CheckDashboardTest.php @@ -25,7 +25,6 @@ +--------------------------------------------------------------------+ */ - require_once 'CiviTest/CiviSeleniumTestCase.php'; class WebTest_Generic_CheckDashboardTest extends CiviSeleniumTestCase { @@ -157,4 +156,3 @@ class WebTest_Generic_CheckDashboardTest extends CiviSeleniumTestCase { } } - diff --git a/tests/phpunit/WebTest/Generic/CheckFindTest.php b/tests/phpunit/WebTest/Generic/CheckFindTest.php index aac06455a9..e621a721c9 100644 --- a/tests/phpunit/WebTest/Generic/CheckFindTest.php +++ b/tests/phpunit/WebTest/Generic/CheckFindTest.php @@ -24,7 +24,6 @@ +--------------------------------------------------------------------+ */ - require_once 'CiviTest/CiviSeleniumTestCase.php'; class WebTest_Generic_CheckFindTest extends CiviSeleniumTestCase { @@ -42,4 +41,3 @@ class WebTest_Generic_CheckFindTest extends CiviSeleniumTestCase { } } - diff --git a/tests/phpunit/WebTest/Generic/GeneralClickAroundTest.php b/tests/phpunit/WebTest/Generic/GeneralClickAroundTest.php index 9592101b32..534f692230 100644 --- a/tests/phpunit/WebTest/Generic/GeneralClickAroundTest.php +++ b/tests/phpunit/WebTest/Generic/GeneralClickAroundTest.php @@ -24,7 +24,6 @@ +--------------------------------------------------------------------+ */ - require_once 'CiviTest/CiviSeleniumTestCase.php'; class WebTest_Generic_GeneralClickAroundTest extends CiviSeleniumTestCase { @@ -203,7 +202,6 @@ class WebTest_Generic_GeneralClickAroundTest extends CiviSeleniumTestCase { $this->click("css=ul#civicrm-menu li.crm-New_Mailing a"); $this->waitForPageToLoad($this->getTimeoutMsec()); - $this->assertTextPresent("New Mailing"); $this->assertElementPresent("name"); $this->assertElementPresent("includeGroups-f"); diff --git a/tests/phpunit/WebTest/Grant/ContactContextAddTest.php b/tests/phpunit/WebTest/Grant/ContactContextAddTest.php index 7022adec4d..25fa5a6bd7 100644 --- a/tests/phpunit/WebTest/Grant/ContactContextAddTest.php +++ b/tests/phpunit/WebTest/Grant/ContactContextAddTest.php @@ -24,7 +24,6 @@ +--------------------------------------------------------------------+ */ - require_once 'CiviTest/CiviSeleniumTestCase.php'; class WebTest_Grant_ContactContextAddTest extends CiviSeleniumTestCase { @@ -71,7 +70,6 @@ class WebTest_Grant_ContactContextAddTest extends CiviSeleniumTestCase { // check contact name on Grant form $this->assertElementContainsText('page-title', "$firstName $lastName"); - // select grant Status $this->select('status_id', 'value=1'); diff --git a/tests/phpunit/WebTest/Grant/CustomFieldsetTest.php b/tests/phpunit/WebTest/Grant/CustomFieldsetTest.php index 04f860fc0c..9e30f38f42 100644 --- a/tests/phpunit/WebTest/Grant/CustomFieldsetTest.php +++ b/tests/phpunit/WebTest/Grant/CustomFieldsetTest.php @@ -24,7 +24,6 @@ +--------------------------------------------------------------------+ */ - require_once 'CiviTest/CiviSeleniumTestCase.php'; class WebTest_Grant_CustomFieldsetTest extends CiviSeleniumTestCase { diff --git a/tests/phpunit/WebTest/Grant/StandaloneAddTest.php b/tests/phpunit/WebTest/Grant/StandaloneAddTest.php index dc88af9913..e8c658fa04 100644 --- a/tests/phpunit/WebTest/Grant/StandaloneAddTest.php +++ b/tests/phpunit/WebTest/Grant/StandaloneAddTest.php @@ -24,7 +24,6 @@ +--------------------------------------------------------------------+ */ - require_once 'CiviTest/CiviSeleniumTestCase.php'; class WebTest_Grant_StandaloneAddTest extends CiviSeleniumTestCase { diff --git a/tests/phpunit/WebTest/Import/ActivityTest.php b/tests/phpunit/WebTest/Import/ActivityTest.php index 48ca8121e3..333504cc47 100644 --- a/tests/phpunit/WebTest/Import/ActivityTest.php +++ b/tests/phpunit/WebTest/Import/ActivityTest.php @@ -24,7 +24,6 @@ +--------------------------------------------------------------------+ */ - require_once 'WebTest/Import/ImportCiviSeleniumTestCase.php'; class WebTest_Import_ActivityTest extends ImportCiviSeleniumTestCase { diff --git a/tests/phpunit/WebTest/Import/AddressImportTest.php b/tests/phpunit/WebTest/Import/AddressImportTest.php index ba4378ef20..1489cff4cf 100644 --- a/tests/phpunit/WebTest/Import/AddressImportTest.php +++ b/tests/phpunit/WebTest/Import/AddressImportTest.php @@ -24,7 +24,6 @@ +--------------------------------------------------------------------+ */ - require_once 'WebTest/Import/ImportCiviSeleniumTestCase.php'; class WebTest_Import_AddressImportTest extends ImportCiviSeleniumTestCase { @@ -38,7 +37,7 @@ class WebTest_Import_AddressImportTest extends ImportCiviSeleniumTestCase { $firstName1 = 'Ma_' . substr(sha1(rand()), 0, 7); // Add a custom group and custom field $customDataParams = $this->_addCustomData(); - + // Get sample import data. list($headers, $rows) = $this->_individualCustomCSVData($customDataParams, $firstName1); @@ -51,23 +50,22 @@ class WebTest_Import_AddressImportTest extends ImportCiviSeleniumTestCase { // Wait for result list. $this->waitForElementPresent("css=div.ac_results-inner li"); - + // Visit contact summary page. $this->click("css=div.ac_results-inner li"); $this->waitForPageToLoad($this->getTimeoutMsec()); - + foreach($customDataParams['customFields'] as $key => $value){ $this->assertTrue($this->isElementPresent("xpath=//div[@class='crm-summary-row']/div[@class='crm-label'][contains(text(), '$key')]")); $this->assertElementContainsText('address-block-1', "$value"); } } - /* * Helper function to provide data for custom data import. */ function _individualCustomCSVData($customDataParams, $firstName1) { - + $headers = array( 'first_name' => 'First Name', 'last_name' => 'Last Name', @@ -80,8 +78,9 @@ class WebTest_Import_AddressImportTest extends ImportCiviSeleniumTestCase { foreach( $customDataParams['headers'] as $key =>$value){ $headers[$key] = $value; } - - $rows = array( 0 => + + $rows = array( 0 => + array( 'first_name' => $firstName1, 'last_name' => 'Anderson', @@ -97,7 +96,7 @@ class WebTest_Import_AddressImportTest extends ImportCiviSeleniumTestCase { } return array($headers, $rows); } - + function _addCustomData() { $this->openCiviPage('admin/custom/group', 'reset=1'); @@ -130,7 +129,7 @@ class WebTest_Import_AddressImportTest extends ImportCiviSeleniumTestCase { // clicking save $this->click('_qf_Field_next-bottom'); $this->waitForElementPresent('newCustomField'); - + $this->assertElementContainsText('crm-notification-container',"Your custom field '{$customField}' has been saved."); $customFieldId = explode('&id=', $this->getAttribute("xpath=//div[@id='field_page']//table/tbody//tr/td/span[text()='$customField']/../../td[8]/span/a@href")); $customFieldId = $customFieldId[1]; @@ -149,7 +148,6 @@ class WebTest_Import_AddressImportTest extends ImportCiviSeleniumTestCase { $customFieldId1 = explode('&id=', $this->getAttribute("xpath=//div[@id='field_page']//table/tbody//tr/td/span[text()='$customField1']/../../td[8]/span/a@href")); $customFieldId1 = $customFieldId1[1]; - // create custom field - Number $this->click("newCustomField"); $this->waitForPageToLoad($this->getTimeoutMsec()); @@ -169,7 +167,7 @@ class WebTest_Import_AddressImportTest extends ImportCiviSeleniumTestCase { $this->waitForPageToLoad($this->getTimeoutMsec()); $customField3 = 'Customfield_alp_select' . substr(sha1(rand()), 0, 4); $customFieldId3 = $this->_createMultipleValueCustomField($customField3,'Select'); - + // create custom field - "alphanumeric radio" $this->click("newCustomField"); $this->waitForPageToLoad($this->getTimeoutMsec()); @@ -187,7 +185,7 @@ class WebTest_Import_AddressImportTest extends ImportCiviSeleniumTestCase { $this->waitForPageToLoad($this->getTimeoutMsec()); $customField6 = 'Customfield_alp_multiselect' . substr(sha1(rand()), 0, 4); $customFieldId6 = $this->_createMultipleValueCustomField($customField6,'Multi-Select'); - + // create custom field - "alphanumeric advmultiselect" $this->click("newCustomField"); $this->waitForPageToLoad($this->getTimeoutMsec()); @@ -199,7 +197,7 @@ class WebTest_Import_AddressImportTest extends ImportCiviSeleniumTestCase { $this->waitForPageToLoad($this->getTimeoutMsec()); $customField8 = 'Customfield_alp_autocompleteselect' . substr(sha1(rand()), 0, 4); $customFieldId8 = $this->_createMultipleValueCustomField($customField8,'Autocomplete-Select'); - + // create custom field - Money $this->click("newCustomField"); $this->waitForPageToLoad($this->getTimeoutMsec()); @@ -229,7 +227,8 @@ class WebTest_Import_AddressImportTest extends ImportCiviSeleniumTestCase { $customFieldId10 = explode('&id=', $this->getAttribute("xpath=//div[@id='field_page']//table/tbody//tr/td/span[text()='$customField10']/../../td[8]/span/a@href")); $customFieldId10 = $customFieldId10[1]; - return array('headers' => + return array('headers' => + array("custom_{$customFieldId}" => "$customField :: $customGroupTitle", "custom_{$customFieldId3}" => "$customField3 :: $customGroupTitle", "custom_{$customFieldId4}" => "$customField4 :: $customGroupTitle", @@ -271,7 +270,7 @@ class WebTest_Import_AddressImportTest extends ImportCiviSeleniumTestCase { ), ); } - + function _createMultipleValueCustomField( $customFieldName, $type ){ $this->type('label', $customFieldName); $this->select("data_type[0]","value=0"); @@ -280,7 +279,7 @@ class WebTest_Import_AddressImportTest extends ImportCiviSeleniumTestCase { $this->type("option_value_1","label1"); $this->type("option_label_2","label2"); $this->type("option_value_2","label2"); - + // clicking save $this->click('_qf_Field_next-bottom'); $this->waitForElementPresent('newCustomField'); @@ -290,6 +289,5 @@ class WebTest_Import_AddressImportTest extends ImportCiviSeleniumTestCase { return $customFieldId; } - } diff --git a/tests/phpunit/WebTest/Import/AddressParsingTest.php b/tests/phpunit/WebTest/Import/AddressParsingTest.php index d0ee407582..b657c66f69 100644 --- a/tests/phpunit/WebTest/Import/AddressParsingTest.php +++ b/tests/phpunit/WebTest/Import/AddressParsingTest.php @@ -24,7 +24,6 @@ +--------------------------------------------------------------------+ */ - require_once 'WebTest/Import/ImportCiviSeleniumTestCase.php'; class WebTest_Import_AddressParsingTest extends ImportCiviSeleniumTestCase { @@ -275,4 +274,3 @@ class WebTest_Import_AddressParsingTest extends ImportCiviSeleniumTestCase { } } - diff --git a/tests/phpunit/WebTest/Import/ContactCustomDataTest.php b/tests/phpunit/WebTest/Import/ContactCustomDataTest.php index 75b5259fdd..bfc8380b02 100644 --- a/tests/phpunit/WebTest/Import/ContactCustomDataTest.php +++ b/tests/phpunit/WebTest/Import/ContactCustomDataTest.php @@ -24,7 +24,6 @@ +--------------------------------------------------------------------+ */ - require_once 'WebTest/Import/ImportCiviSeleniumTestCase.php'; class WebTest_Import_ContactCustomDataTest extends ImportCiviSeleniumTestCase { @@ -103,7 +102,6 @@ class WebTest_Import_ContactCustomDataTest extends ImportCiviSeleniumTestCase { $this->assertTrue($this->isTextPresent('This is a test field')); } - /* * Helper function to provide data for custom data import. */ diff --git a/tests/phpunit/WebTest/Import/ContactSubtypeTest.php b/tests/phpunit/WebTest/Import/ContactSubtypeTest.php index 256c77d529..72210cd018 100644 --- a/tests/phpunit/WebTest/Import/ContactSubtypeTest.php +++ b/tests/phpunit/WebTest/Import/ContactSubtypeTest.php @@ -24,7 +24,6 @@ +--------------------------------------------------------------------+ */ - require_once 'WebTest/Import/ImportCiviSeleniumTestCase.php'; class WebTest_Import_ContactSubtypeTest extends ImportCiviSeleniumTestCase { @@ -118,7 +117,6 @@ class WebTest_Import_ContactSubtypeTest extends ImportCiviSeleniumTestCase { $this->importContacts($headers, $rows, 'Individual', 'No Duplicate Checking', array(), $other); } - /* * Test contact import for Organization Subtype. */ @@ -195,7 +193,6 @@ class WebTest_Import_ContactSubtypeTest extends ImportCiviSeleniumTestCase { $this->importContacts($headers, $rows, 'Organization', 'No Duplicate Checking', array(), $other); } - /* * Test contact import for Household Subtype. */ diff --git a/tests/phpunit/WebTest/Import/ContactTest.php b/tests/phpunit/WebTest/Import/ContactTest.php index 6bb7c8b1a0..a5204271c4 100644 --- a/tests/phpunit/WebTest/Import/ContactTest.php +++ b/tests/phpunit/WebTest/Import/ContactTest.php @@ -24,7 +24,6 @@ +--------------------------------------------------------------------+ */ - require_once 'WebTest/Import/ImportCiviSeleniumTestCase.php'; class WebTest_Import_ContactTest extends ImportCiviSeleniumTestCase { diff --git a/tests/phpunit/WebTest/Import/ContributionTest.php b/tests/phpunit/WebTest/Import/ContributionTest.php index d8e6cd9803..1fce208b66 100644 --- a/tests/phpunit/WebTest/Import/ContributionTest.php +++ b/tests/phpunit/WebTest/Import/ContributionTest.php @@ -24,7 +24,6 @@ +--------------------------------------------------------------------+ */ - require_once 'WebTest/Import/ImportCiviSeleniumTestCase.php'; class WebTest_Import_ContributionTest extends ImportCiviSeleniumTestCase { @@ -84,7 +83,7 @@ class WebTest_Import_ContributionTest extends ImportCiviSeleniumTestCase { $firstName2 = substr(sha1(rand()), 0, 7); $email2 = 'mail_' . substr(sha1(rand()), 0, 7) . '@example.com'; $this->webtestAddContact($firstName2, 'Anderson', $email2); - + $headers = array( 'email' => 'Email', 'fee_amount' => 'Fee Amount', diff --git a/tests/phpunit/WebTest/Import/CustomDataTest.php b/tests/phpunit/WebTest/Import/CustomDataTest.php index 17af6067d7..3c9e0dcec2 100644 --- a/tests/phpunit/WebTest/Import/CustomDataTest.php +++ b/tests/phpunit/WebTest/Import/CustomDataTest.php @@ -24,7 +24,6 @@ +--------------------------------------------------------------------+ */ - require_once 'WebTest/Import/ImportCiviSeleniumTestCase.php'; class WebTest_Import_CustomDataTest extends ImportCiviSeleniumTestCase { @@ -196,7 +195,7 @@ class WebTest_Import_CustomDataTest extends ImportCiviSeleniumTestCase { $this->waitForElementPresent('newCustomField'); $this->assertTrue($this->isTextPresent("Your custom field '{$dateFieldLabel}' has been saved.")); - + $dateFieldId = explode('&id=', $this->getAttribute("xpath=//div[@id='field_page']//table/tbody//tr/td/span[text()='$dateFieldLabel']/../../td[8]/span/a@href")); $dateFieldId = $dateFieldId[1]; diff --git a/tests/phpunit/WebTest/Import/DateFormatTest.php b/tests/phpunit/WebTest/Import/DateFormatTest.php index 55729ebfa9..557658f4ba 100644 --- a/tests/phpunit/WebTest/Import/DateFormatTest.php +++ b/tests/phpunit/WebTest/Import/DateFormatTest.php @@ -24,7 +24,6 @@ +--------------------------------------------------------------------+ */ - require_once 'WebTest/Import/ImportCiviSeleniumTestCase.php'; class WebTest_Import_DateFormatTest extends ImportCiviSeleniumTestCase { diff --git a/tests/phpunit/WebTest/Import/DuplicateMatchingTest.php b/tests/phpunit/WebTest/Import/DuplicateMatchingTest.php index 7349370c70..7e3acb9537 100644 --- a/tests/phpunit/WebTest/Import/DuplicateMatchingTest.php +++ b/tests/phpunit/WebTest/Import/DuplicateMatchingTest.php @@ -24,7 +24,6 @@ +--------------------------------------------------------------------+ */ - require_once 'WebTest/Import/ImportCiviSeleniumTestCase.php'; class WebTest_Import_DuplicateMatchingTest extends ImportCiviSeleniumTestCase { @@ -176,7 +175,6 @@ class WebTest_Import_DuplicateMatchingTest extends ImportCiviSeleniumTestCase { // Get imported contact Ids $importedContactIds = $this->_getImportedContactIds($rows, 'Organization'); - // Build update mode import headers $updateHeaders = array( 'email' => 'Email', diff --git a/tests/phpunit/WebTest/Import/GroupTest.php b/tests/phpunit/WebTest/Import/GroupTest.php index ed85c5017d..175e00394b 100644 --- a/tests/phpunit/WebTest/Import/GroupTest.php +++ b/tests/phpunit/WebTest/Import/GroupTest.php @@ -24,7 +24,6 @@ +--------------------------------------------------------------------+ */ - require_once 'WebTest/Import/ImportCiviSeleniumTestCase.php'; class WebTest_Import_GroupTest extends ImportCiviSeleniumTestCase { protected $captureScreenshotOnFailure = TRUE; diff --git a/tests/phpunit/WebTest/Import/ImportCiviSeleniumTestCase.php b/tests/phpunit/WebTest/Import/ImportCiviSeleniumTestCase.php index 284cd69443..db33d6073f 100644 --- a/tests/phpunit/WebTest/Import/ImportCiviSeleniumTestCase.php +++ b/tests/phpunit/WebTest/Import/ImportCiviSeleniumTestCase.php @@ -24,7 +24,6 @@ +--------------------------------------------------------------------+ */ - require_once 'CiviTest/CiviSeleniumTestCase.php'; require_once 'CRM/Utils/Array.php'; class ImportCiviSeleniumTestCase extends CiviSeleniumTestCase { @@ -39,7 +38,8 @@ class ImportCiviSeleniumTestCase extends CiviSeleniumTestCase { * @params string $mode import mode * @params array $fieldMapper select mapper fields while import * @params array $other other parameters - * useMappingName : to reuse mapping + * useMappingName : to reuse mapping + * dateFormat : date format of data * checkMapperHeaders : to override default check mapper headers * saveMapping : save current mapping? @@ -168,7 +168,8 @@ class ImportCiviSeleniumTestCase extends CiviSeleniumTestCase { * @params string $mode import mode * @params array $fieldMapper select mapper fields while import * @params array $other other parameters - * contactSubtype : import for selected Contact Subtype + * contactSubtype : import for selected Contact Subtype + * useMappingName : to reuse mapping * dateFormat : date format of data * checkMapperHeaders : to override default check mapper headers @@ -183,7 +184,8 @@ class ImportCiviSeleniumTestCase extends CiviSeleniumTestCase { * callbackImportSummary : function to override default import summary assertions * * @params string $type import type (csv/sql) - * @todo:currently only supports csv, need to work on sql import + * @todo:currently only supports csv, need to work on sql import + */ function importContacts($headers, $rows, $contactType = 'Individual', $mode = 'Skip', $fieldMapper = array( ), $other = array(), $type = 'csv') { @@ -429,7 +431,8 @@ class ImportCiviSeleniumTestCase extends CiviSeleniumTestCase { * * @params string $component component name * - * @return string import url + * @return string import url + */ function _getImportComponentUrl($component) { @@ -448,7 +451,8 @@ class ImportCiviSeleniumTestCase extends CiviSeleniumTestCase { * * @params string $component component name * - * @return string import url + * @return string import url + */ function _getImportComponentContactType($component, $contactType) { $importComponentMode = array( @@ -516,7 +520,8 @@ class ImportCiviSeleniumTestCase extends CiviSeleniumTestCase { * Helper function to get imported contact ids. * * @params array $rows fields rows - * @params string $contactType contact type + * @params string $contactType contact type + * * @return array $contactIds imported contact ids */ diff --git a/tests/phpunit/WebTest/Import/MatchExternalIdTest.php b/tests/phpunit/WebTest/Import/MatchExternalIdTest.php index d4b636aebf..a462daef32 100644 --- a/tests/phpunit/WebTest/Import/MatchExternalIdTest.php +++ b/tests/phpunit/WebTest/Import/MatchExternalIdTest.php @@ -24,7 +24,6 @@ +--------------------------------------------------------------------+ */ - require_once 'WebTest/Import/ImportCiviSeleniumTestCase.php'; class WebTest_Import_MatchExternalIdTest extends ImportCiviSeleniumTestCase { diff --git a/tests/phpunit/WebTest/Import/MemberTest.php b/tests/phpunit/WebTest/Import/MemberTest.php index 61fb200ff5..eacd1ec4cf 100644 --- a/tests/phpunit/WebTest/Import/MemberTest.php +++ b/tests/phpunit/WebTest/Import/MemberTest.php @@ -24,7 +24,6 @@ +--------------------------------------------------------------------+ */ - require_once 'WebTest/Import/ImportCiviSeleniumTestCase.php'; class WebTest_Import_MemberTest extends ImportCiviSeleniumTestCase { diff --git a/tests/phpunit/WebTest/Import/MultipleRelationshipTest.php b/tests/phpunit/WebTest/Import/MultipleRelationshipTest.php index efd884947c..daf84b4755 100644 --- a/tests/phpunit/WebTest/Import/MultipleRelationshipTest.php +++ b/tests/phpunit/WebTest/Import/MultipleRelationshipTest.php @@ -24,7 +24,6 @@ +--------------------------------------------------------------------+ */ - require_once 'WebTest/Import/ImportCiviSeleniumTestCase.php'; class WebTest_Import_MultipleRelationshipTest extends ImportCiviSeleniumTestCase { @@ -51,7 +50,8 @@ class WebTest_Import_MultipleRelationshipTest extends ImportCiviSeleniumTestCase /* * Helper function to provide data for multiple relationship import - * for Individuals. + * for Individuals. + */ function _individualRelationshipCSVData() { diff --git a/tests/phpunit/WebTest/Import/ParticipantTest.php b/tests/phpunit/WebTest/Import/ParticipantTest.php index d330e9ddec..de21912bae 100644 --- a/tests/phpunit/WebTest/Import/ParticipantTest.php +++ b/tests/phpunit/WebTest/Import/ParticipantTest.php @@ -24,7 +24,6 @@ +--------------------------------------------------------------------+ */ - require_once 'WebTest/Import/ImportCiviSeleniumTestCase.php'; class WebTest_Import_ParticipantTest extends ImportCiviSeleniumTestCase { @@ -41,7 +40,7 @@ class WebTest_Import_ParticipantTest extends ImportCiviSeleniumTestCase { // Get sample import data. list($headers, $rows) = $this->_participantIndividualCSVData(); - + // Create and import csv from provided data and check imported data. $fieldMapper = array( 'mapper[0][0]' => 'email', diff --git a/tests/phpunit/WebTest/Import/SavedMappingTest.php b/tests/phpunit/WebTest/Import/SavedMappingTest.php index 063ce78d3f..12f4405854 100644 --- a/tests/phpunit/WebTest/Import/SavedMappingTest.php +++ b/tests/phpunit/WebTest/Import/SavedMappingTest.php @@ -24,7 +24,6 @@ +--------------------------------------------------------------------+ */ - require_once 'WebTest/Import/ImportCiviSeleniumTestCase.php'; class WebTest_Import_SavedMapping extends ImportCiviSeleniumTestCase { @@ -137,4 +136,3 @@ class WebTest_Import_SavedMapping extends ImportCiviSeleniumTestCase { } } - diff --git a/tests/phpunit/WebTest/Import/TagTest.php b/tests/phpunit/WebTest/Import/TagTest.php index 1ffc7ad0ae..f0d8f4f921 100644 --- a/tests/phpunit/WebTest/Import/TagTest.php +++ b/tests/phpunit/WebTest/Import/TagTest.php @@ -24,11 +24,9 @@ +--------------------------------------------------------------------+ */ - require_once 'WebTest/Import/ImportCiviSeleniumTestCase.php'; class WebTest_Import_TagTest extends ImportCiviSeleniumTestCase { - protected function setUp() { parent::setUp(); } diff --git a/tests/phpunit/WebTest/Mailing/AddMessageTemplateTest.php b/tests/phpunit/WebTest/Mailing/AddMessageTemplateTest.php index e907ebf102..30db0e4f6c 100644 --- a/tests/phpunit/WebTest/Mailing/AddMessageTemplateTest.php +++ b/tests/phpunit/WebTest/Mailing/AddMessageTemplateTest.php @@ -24,7 +24,6 @@ +--------------------------------------------------------------------+ */ - require_once 'CiviTest/CiviSeleniumTestCase.php'; class WebTest_Mailing_AddMessageTemplateTest extends CiviSeleniumTestCase { diff --git a/tests/phpunit/WebTest/Mailing/AddNewMailingComponentTest.php b/tests/phpunit/WebTest/Mailing/AddNewMailingComponentTest.php index fc1f545a9b..5de23b0fff 100644 --- a/tests/phpunit/WebTest/Mailing/AddNewMailingComponentTest.php +++ b/tests/phpunit/WebTest/Mailing/AddNewMailingComponentTest.php @@ -24,7 +24,6 @@ +--------------------------------------------------------------------+ */ - require_once 'CiviTest/CiviSeleniumTestCase.php'; class WebTest_Mailing_AddNewMailingComponentTest extends CiviSeleniumTestCase { diff --git a/tests/phpunit/WebTest/Mailing/MailingTest.php b/tests/phpunit/WebTest/Mailing/MailingTest.php index a10584d1dc..c3edaa3fa1 100644 --- a/tests/phpunit/WebTest/Mailing/MailingTest.php +++ b/tests/phpunit/WebTest/Mailing/MailingTest.php @@ -24,7 +24,6 @@ +--------------------------------------------------------------------+ */ - require_once 'CiviTest/CiviSeleniumTestCase.php'; class WebTest_Mailing_MailingTest extends CiviSeleniumTestCase { @@ -297,7 +296,7 @@ class WebTest_Mailing_MailingTest extends CiviSeleniumTestCase { // //------ end unsubscribe ------- } - + function testAdvanceSearchAndReportCheck() { $this->webtestLogin(); @@ -381,7 +380,7 @@ class WebTest_Mailing_MailingTest extends CiviSeleniumTestCase { // fill subject for mailing $this->type("subject", "Test subject {$mailingName} for Webtest"); - + // check for default option enabled $this->assertChecked("CIVICRM_QFID_1_upload_type"); @@ -444,7 +443,7 @@ class WebTest_Mailing_MailingTest extends CiviSeleniumTestCase { $this->verifyText("xpath=//table//tr[td/a[text()='Successful Deliveries']]/descendant::td[2]", preg_quote("1 (100.00%)")); $summaryInfoLinks = array('Intended Recipients', 'Successful Deliveries', 'Tracked Opens', 'Click-throughs', 'Forwards', 'Replies', 'Bounces', 'Unsubscribe Requests','Opt-out Requests'); - + //check for report and adv search links foreach($summaryInfoLinks as $value) { $this->assertTrue($this->isElementPresent("xpath=//fieldset/legend[text()='Delivery Summary']/../table//tr[td/a[text()='{$value}']]/descendant::td[3]/span/a[1][text()='Report']"), "Report link missing for {$value}"); diff --git a/tests/phpunit/WebTest/Mailing/SpoolTest.php b/tests/phpunit/WebTest/Mailing/SpoolTest.php index 5e5aeafb3e..cdec9a33f0 100644 --- a/tests/phpunit/WebTest/Mailing/SpoolTest.php +++ b/tests/phpunit/WebTest/Mailing/SpoolTest.php @@ -24,7 +24,6 @@ +--------------------------------------------------------------------+ */ - require_once 'CiviTest/CiviSeleniumTestCase.php'; require_once 'CiviTest/CiviMailUtils.php'; require_once 'ezc/Base/src/ezc_bootstrap.php'; @@ -40,7 +39,7 @@ class WebTest_Mailing_SpoolTest extends CiviSeleniumTestCase { $this->webtestLogin(); // Start spooling mail - $mut = new CiviMailUtils( $this, true ); + $mut = new CiviMailUtils($this, true); // Add a contact $fname = substr(sha1(rand()), 0, 6); @@ -50,47 +49,45 @@ class WebTest_Mailing_SpoolTest extends CiviSeleniumTestCase { // Get the contact id of the newly added contact $urlElements = $this->parseURL(); $cid = $urlElements['queryString']['cid']; - $this->assertNotEmpty( $cid, 'Could not find cid after adding contact' ); + $this->assertNotEmpty($cid, 'Could not find cid after adding contact'); // Send an email to the added contact $this->openCiviPage("activity/email/add", "action=add&reset=1&cid={$cid}&selectedChild=activity&atype=3"); - $this->type( 'subject', 'test spool' ); - $this->fillRichTextField( 'html_message', 'Unit tests keep children safe.' ); - $this->click( "_qf_Email_upload" ); + $this->type('subject', 'test spool'); + $this->fillRichTextField('html_message', 'Unit tests keep children safe.'); + $this->click("_qf_Email_upload"); // Retrieve an ezc mail object version of the email - $msg = $mut->getMostRecentEmail( 'ezc' ); - // print_r($msg); + $msg = $mut->getMostRecentEmail('ezc'); - $this->assertNotEmpty( $msg, 'Mail message empty or not found.' ); - $this->assertEquals( $msg->subject, 'test spool' ); - $this->assertContains( $email, implode(';', $msg->to), 'Recipient incorrect.' ); // should really walk through the 'to' array, but this is legal according to the docs + $this->assertNotEmpty($msg, 'Mail message empty or not found.'); + $this->assertEquals($msg->subject, 'test spool'); + // should really walk through the 'to' array, but this is legal according to the docs + $this->assertContains($email, implode(';', $msg->to), 'Recipient incorrect.'); - $context = new ezcMailPartWalkContext( array( get_class($this), 'mailWalkCallback' ) ); - $msg->walkParts( $context, $msg ); + $context = new ezcMailPartWalkContext(array(get_class($this), 'mailWalkCallback')); + $msg->walkParts($context, $msg); /* * Now try a regular activity with cc to assignee */ $this->WebtestAddActivity(); - $msg = $mut->getMostRecentEmail( 'raw' ); -// echo $msg; - $this->assertNotEmpty( $msg, 'Mail message empty or not found.' ); - $this->assertContains( 'Subject: This is subject of test activity', $msg, 'Subject of email is wrong.' ); + $msg = $mut->getMostRecentEmail('raw'); + $this->assertNotEmpty($msg, 'Mail message empty or not found.'); + $this->assertContains('Subject: This is subject of test activity', $msg, 'Subject of email is wrong.'); $mut->stop(); } - public static function mailWalkCallback( $context, $mailPart ) { -// print_r($mailPart); - if ( $mailPart instanceof ezcMailText ) { - self::assertEquals( $mailPart->subType, 'html' ); - self::assertContains( 'Unit tests keep children safe', $mailPart->generateBody() ); + public static function mailWalkCallback($context, $mailPart) { + if ($mailPart instanceof ezcMailText) { + self::assertEquals($mailPart->subType, 'html'); + self::assertContains('Unit tests keep children safe', $mailPart->generateBody()); } $disp = $mailPart->contentDisposition; - if ( $disp ) { -// print_r($disp); + if ($disp) { + } } } diff --git a/tests/phpunit/WebTest/Member/BatchUpdateViaProfileTest.php b/tests/phpunit/WebTest/Member/BatchUpdateViaProfileTest.php index 17b98ece2c..33dc8ab485 100644 --- a/tests/phpunit/WebTest/Member/BatchUpdateViaProfileTest.php +++ b/tests/phpunit/WebTest/Member/BatchUpdateViaProfileTest.php @@ -24,7 +24,6 @@ +--------------------------------------------------------------------+ */ - require_once 'CiviTest/CiviSeleniumTestCase.php'; class WebTest_Member_BatchUpdateViaProfileTest extends CiviSeleniumTestCase { @@ -224,7 +223,7 @@ class WebTest_Member_BatchUpdateViaProfileTest extends CiviSeleniumTestCase { $customGroupTitle = 'Custom_' . substr(sha1(rand()), 0, 4); $this->openCiviPage('admin/custom/group', 'reset=1'); - + //add new custom data $this->click("//a[@id='newCustomDataGroup']/span"); $this->waitForPageToLoad($this->getTimeoutMsec()); diff --git a/tests/phpunit/WebTest/Member/ContactContextAddTest.php b/tests/phpunit/WebTest/Member/ContactContextAddTest.php index 88d714891b..e8cebc0b46 100644 --- a/tests/phpunit/WebTest/Member/ContactContextAddTest.php +++ b/tests/phpunit/WebTest/Member/ContactContextAddTest.php @@ -24,7 +24,6 @@ +--------------------------------------------------------------------+ */ - require_once 'CiviTest/CiviSeleniumTestCase.php'; class WebTest_Member_ContactContextAddTest extends CiviSeleniumTestCase { @@ -237,4 +236,3 @@ class WebTest_Member_ContactContextAddTest extends CiviSeleniumTestCase { } } - diff --git a/tests/phpunit/WebTest/Member/DefaultMembershipPricesetTest.php b/tests/phpunit/WebTest/Member/DefaultMembershipPricesetTest.php index 1bc3dd55c9..8f0fd40fad 100755 --- a/tests/phpunit/WebTest/Member/DefaultMembershipPricesetTest.php +++ b/tests/phpunit/WebTest/Member/DefaultMembershipPricesetTest.php @@ -24,7 +24,6 @@ +--------------------------------------------------------------------+ */ - require_once 'CiviTest/CiviSeleniumTestCase.php'; class WebTest_Member_DefaultMembershipPricesetTest extends CiviSeleniumTestCase { diff --git a/tests/phpunit/WebTest/Member/FixedMembershipTypeTest.php b/tests/phpunit/WebTest/Member/FixedMembershipTypeTest.php index 8ecfe93801..808e758d79 100644 --- a/tests/phpunit/WebTest/Member/FixedMembershipTypeTest.php +++ b/tests/phpunit/WebTest/Member/FixedMembershipTypeTest.php @@ -24,7 +24,6 @@ +--------------------------------------------------------------------+ */ - require_once 'CiviTest/CiviSeleniumTestCase.php'; class WebTest_Member_FixedMembershipTypeTest extends CiviSeleniumTestCase { @@ -37,7 +36,6 @@ class WebTest_Member_FixedMembershipTypeTest extends CiviSeleniumTestCase { // Rollover Date < Start Date // Join Date > Rollover Date and Join Date < Start Date - // Log in using webtestLogin() method $this->webtestLogin(); @@ -144,8 +142,10 @@ class WebTest_Member_FixedMembershipTypeTest extends CiviSeleniumTestCase { } $query = " -SELECT end_event_adjust_interval - FROM civicrm_membership_status +SELECT end_event_adjust_interval + + FROM civicrm_membership_status + WHERE start_event = 'join_date' AND name = 'New'"; $endInterval = CRM_Core_DAO::singleValueQuery($query); @@ -194,7 +194,6 @@ SELECT end_event_adjust_interval // Scenario 2 // Rollover Date < Join Date - // Log in using webtestLogin() method $this->webtestLogin(); @@ -302,8 +301,10 @@ SELECT end_event_adjust_interval } $query = " -SELECT end_event_adjust_interval - FROM civicrm_membership_status +SELECT end_event_adjust_interval + + FROM civicrm_membership_status + WHERE start_event = 'join_date' AND name = 'New'"; $endInterval = CRM_Core_DAO::singleValueQuery($query); @@ -353,7 +354,6 @@ SELECT end_event_adjust_interval // Standard Fixed scenario - Jan 1 Fixed Period Start and October 31 rollover // Join Date is later than Rollover Date - // Log in using webtestLogin() method $this->webtestLogin(); @@ -430,7 +430,6 @@ SELECT end_event_adjust_interval $this->waitForTextPresent("Membership Type {$title}"); $this->select('membership_type_id[1]', "label=Membership Type {$title}"); - $sourceText = "Membership ContactAddTest with Fixed Membership Type Scenario 3"; // fill in Source $this->type('source', $sourceText); @@ -454,8 +453,10 @@ SELECT end_event_adjust_interval } $query = " -SELECT end_event_adjust_interval - FROM civicrm_membership_status +SELECT end_event_adjust_interval + + FROM civicrm_membership_status + WHERE start_event = 'join_date' AND name = 'New'"; $endInterval = CRM_Core_DAO::singleValueQuery($query); @@ -505,7 +506,6 @@ SELECT end_event_adjust_interval // Standard Fixed scenario - Jan 1 Fixed Period Start and October 31 rollover // Join Date is earlier than Rollover Date - // Log in using webtestLogin() method $this->webtestLogin(); @@ -529,7 +529,7 @@ SELECT end_event_adjust_interval $this->click('member_of_contact'); $this->waitForElementPresent("css=div.ac_results-inner li"); $this->click("css=div.ac_results-inner li"); - + $this->type('minimum_fee', '100'); $this->select( 'financial_type_id', 'value=2' ); $this->type('duration_interval', 1); @@ -607,8 +607,10 @@ SELECT end_event_adjust_interval } $query = " -SELECT end_event_adjust_interval - FROM civicrm_membership_status +SELECT end_event_adjust_interval + + FROM civicrm_membership_status + WHERE start_event = 'join_date' AND name = 'New'"; $endInterval = CRM_Core_DAO::singleValueQuery($query); diff --git a/tests/phpunit/WebTest/Member/OfflineAutoRenewMembershipTest.php b/tests/phpunit/WebTest/Member/OfflineAutoRenewMembershipTest.php index 8fc3386c20..7227dc2afb 100644 --- a/tests/phpunit/WebTest/Member/OfflineAutoRenewMembershipTest.php +++ b/tests/phpunit/WebTest/Member/OfflineAutoRenewMembershipTest.php @@ -24,7 +24,6 @@ +--------------------------------------------------------------------+ */ - require_once 'CiviTest/CiviSeleniumTestCase.php'; class WebTest_Member_OfflineAutoRenewMembershipTest extends CiviSeleniumTestCase { diff --git a/tests/phpunit/WebTest/Member/OfflineMembershipAddPricesetTest.php b/tests/phpunit/WebTest/Member/OfflineMembershipAddPricesetTest.php index 98b9ad0eae..68d6dc11bf 100644 --- a/tests/phpunit/WebTest/Member/OfflineMembershipAddPricesetTest.php +++ b/tests/phpunit/WebTest/Member/OfflineMembershipAddPricesetTest.php @@ -24,7 +24,6 @@ +--------------------------------------------------------------------+ */ - require_once 'CiviTest/CiviSeleniumTestCase.php'; class WebTest_Member_OfflineMembershipAddPricesetTest extends CiviSeleniumTestCase { @@ -166,7 +165,6 @@ class WebTest_Member_OfflineMembershipAddPricesetTest extends CiviSeleniumTestCa } - function _testAddSet($setTitle, $usedFor, $contributionType = NULL, $setHelp) { $this->openCiviPage('admin/price', 'reset=1&action=add', '_qf_Set_next-bottom'); diff --git a/tests/phpunit/WebTest/Member/OfflineMembershipRenewTest.php b/tests/phpunit/WebTest/Member/OfflineMembershipRenewTest.php index b21eac48b4..215339d8b7 100644 --- a/tests/phpunit/WebTest/Member/OfflineMembershipRenewTest.php +++ b/tests/phpunit/WebTest/Member/OfflineMembershipRenewTest.php @@ -24,7 +24,6 @@ +--------------------------------------------------------------------+ */ - require_once 'CiviTest/CiviSeleniumTestCase.php'; class WebTest_Member_OfflineMembershipRenewTest extends CiviSeleniumTestCase { diff --git a/tests/phpunit/WebTest/Member/OnlineAutoRenewMembershipGCTest.php b/tests/phpunit/WebTest/Member/OnlineAutoRenewMembershipGCTest.php index 8ec979063b..24d9245a26 100644 --- a/tests/phpunit/WebTest/Member/OnlineAutoRenewMembershipGCTest.php +++ b/tests/phpunit/WebTest/Member/OnlineAutoRenewMembershipGCTest.php @@ -24,7 +24,6 @@ +--------------------------------------------------------------------+ */ - require_once 'CiviTest/CiviSeleniumTestCase.php'; class WebTest_Member_OnlineAutoRenewMembershipGCTest extends CiviSeleniumTestCase { @@ -57,7 +56,8 @@ class WebTest_Member_OnlineAutoRenewMembershipGCTest extends CiviSeleniumTestCas // Justification for this instance: FIXME sleep(5); - // FIXME: By this time pending records has already been created. Formatting for external page (google checkout in this case) + // FIXME: By this time pending records has already been created. Formatting for external page (google checkout in this case) + // has changed a bit. No point in adding test for external page as we 'll test with fake transactions. } @@ -89,7 +89,8 @@ class WebTest_Member_OnlineAutoRenewMembershipGCTest extends CiviSeleniumTestCas // Justification for this instance: FIXME sleep(5); - // FIXME: By this time pending records has already been created. Formatting for external page (google checkout in this case) + // FIXME: By this time pending records has already been created. Formatting for external page (google checkout in this case) + // has changed a bit. No point in adding test for external page as we 'll test with fake transactions. } @@ -106,22 +107,22 @@ class WebTest_Member_OnlineAutoRenewMembershipGCTest extends CiviSeleniumTestCas $this->webtestAddPaymentProcessor($processorName, 'Google_Checkout'); // -- start updating membership types - $this->openCiviPage('admin/member/membershipType/add', 'action=update&id=1&reset=1'); - + $this->openCiviPage('admin/member/membershipType/add', 'action=update&id=1&reset=1'); + $this->waitForElementPresent("xpath=//div[@id='membership_type_form']//table/tbody/tr[6]/td/label[contains(text(), 'Auto-renew Option')]/../../td[2]/label[contains(text(), 'Give option, but not required')]"); $this->click("xpath=//div[@id='membership_type_form']//table/tbody/tr[6]/td/label[contains(text(), 'Auto-renew Option')]/../../td[2]/label[contains(text(), 'Give option, but not required')]"); - + $this->type("duration_interval", "1"); $this->select("duration_unit", "label=year"); //wait for the auto-complete member_of_contact to populate $this->waitForValue('member_of_contact', '::'); - + $this->click("_qf_MembershipType_upload-bottom"); $this->waitForPageToLoad($this->getTimeoutMsec()); - $this->openCiviPage('admin/member/membershipType/add', 'action=update&id=2&reset=1'); - + $this->openCiviPage('admin/member/membershipType/add', 'action=update&id=2&reset=1'); + $this->waitForElementPresent("xpath=//div[@id='membership_type_form']//table/tbody/tr[6]/td/label[contains(text(), 'Auto-renew Option')]/../../td[2]/label[contains(text(), 'Give option, but not required')]"); $this->click("xpath=//div[@id='membership_type_form']//table/tbody/tr[6]/td/label[contains(text(), 'Auto-renew Option')]/../../td[2]/label[contains(text(), 'Give option, but not required')]"); diff --git a/tests/phpunit/WebTest/Member/OnlineAutoRenewMembershipTest.php b/tests/phpunit/WebTest/Member/OnlineAutoRenewMembershipTest.php index 328613dcff..32afc6a5ee 100644 --- a/tests/phpunit/WebTest/Member/OnlineAutoRenewMembershipTest.php +++ b/tests/phpunit/WebTest/Member/OnlineAutoRenewMembershipTest.php @@ -24,7 +24,6 @@ +--------------------------------------------------------------------+ */ - require_once 'CiviTest/CiviSeleniumTestCase.php'; class WebTest_Member_OnlineAutoRenewMembershipTest extends CiviSeleniumTestCase { @@ -38,7 +37,7 @@ class WebTest_Member_OnlineAutoRenewMembershipTest extends CiviSeleniumTestCase //now do the test membership signup. $this->openCiviPage('contribute/transact', "reset=1&action=preview&id={$pageId}", "_qf_Main_upload-bottom"); - + $this->click("xpath=//div[@class='crm-section membership_amount-section']/div[2]//span/label/span[2][contains(text(),'Student')]"); $this->click("auto_renew"); @@ -70,7 +69,7 @@ class WebTest_Member_OnlineAutoRenewMembershipTest extends CiviSeleniumTestCase //now do the test membership signup. $this->openCiviPage('contribute/transact', "reset=1&action=preview&id={$pageId}", "_qf_Main_upload-bottom"); - + $this->click("xpath=//div[@class='crm-section membership_amount-section']/div[2]//span/label/span[2][contains(text(),'Student')]"); $this->click("auto_renew"); @@ -100,7 +99,7 @@ class WebTest_Member_OnlineAutoRenewMembershipTest extends CiviSeleniumTestCase //now do the test membership signup. $this->openCiviPage('contribute/transact', "reset=1&action=preview&id={$pageId}", "_qf_Main_upload-bottom"); - + $this->click("xpath=//div[@class='crm-section membership_amount-section']/div[2]//span/label/span[2][contains(text(),'Student')]"); $this->click("auto_renew"); @@ -141,7 +140,7 @@ class WebTest_Member_OnlineAutoRenewMembershipTest extends CiviSeleniumTestCase $this->type("duration_interval", "1"); $this->select("duration_unit", "label=year"); - + // wait for the auto-complete member_of_contact to populate $this->waitForValue('member_of_contact', '::'); diff --git a/tests/phpunit/WebTest/Member/OnlineMembershipAddPricesetTest.php b/tests/phpunit/WebTest/Member/OnlineMembershipAddPricesetTest.php index 9dfcf65509..91985d7dc1 100644 --- a/tests/phpunit/WebTest/Member/OnlineMembershipAddPricesetTest.php +++ b/tests/phpunit/WebTest/Member/OnlineMembershipAddPricesetTest.php @@ -24,7 +24,6 @@ +--------------------------------------------------------------------+ */ - require_once 'CiviTest/CiviSeleniumTestCase.php'; class WebTest_Member_OnlineMembershipAddPricesetTest extends CiviSeleniumTestCase { @@ -113,7 +112,7 @@ class WebTest_Member_OnlineMembershipAddPricesetTest extends CiviSeleniumTestCas $fields = array("National Membership $title", "Radio"); $this->openCiviPage('admin/price/field', "reset=1&action=add&sid={$sid}"); - + $validateStrings[] = $fields[0]; $this->type('label', $fields[0]); $this->select('html_type', "value={$fields[1]}"); @@ -135,7 +134,7 @@ class WebTest_Member_OnlineMembershipAddPricesetTest extends CiviSeleniumTestCas 'amount' => 120.00, 'membership_num_terms' => 3, ), - + ); $i = 2; foreach($options as $index => $values){ @@ -148,7 +147,8 @@ class WebTest_Member_OnlineMembershipAddPricesetTest extends CiviSeleniumTestCas $this->type("xpath=//table[@id='optionField']/tbody/tr[$i]/td[5]/input",$values['label']); $this->type("xpath=//table[@id='optionField']/tbody/tr[$i]/td[6]/input",$values['amount']); if($i > 3){ - $this->click('link=another choice'); + $this->click('link=another choice'); + } $i++; } @@ -158,7 +158,7 @@ class WebTest_Member_OnlineMembershipAddPricesetTest extends CiviSeleniumTestCas $this->click('_qf_Field_next-bottom'); $this->waitForPageToLoad($this->getTimeoutMsec()); $this->assertElementContainsText('crm-notification-container', "Price Field '{$fields[0]}' has been saved."); - + // load the Price Set Preview and check for expected values $this->_testVerifyPriceSet($validateStrings, $sid); @@ -383,7 +383,7 @@ class WebTest_Member_OnlineMembershipAddPricesetTest extends CiviSeleniumTestCas ); } } - + function _testMultilpeTermsMembershipRegistration($pageId, $contactParams, $memTypeTitle1, $term, $renew = FALSE){ if($renew){ $this->openCiviPage('member/search', 'reset=1', 'member_end_date_high'); @@ -394,7 +394,7 @@ class WebTest_Member_OnlineMembershipAddPricesetTest extends CiviSeleniumTestCas $year = CRM_Utils_Date::processDate($this->getText("xpath=//form[@id='MembershipView']//table/tbody/tr/td[text()='End date']/following-sibling::td")); $prevYear = substr($year, 0, 4); } - + $this->webtestLogout(); $this->openCiviPage('contribute/transact', "reset=1&id=$pageId", '_qf_Main_upload-bottom'); @@ -404,7 +404,8 @@ class WebTest_Member_OnlineMembershipAddPricesetTest extends CiviSeleniumTestCas $currentMonth = date('m'); $previousDay = date('d') - 1; $endYear = ($term == 3) ? $currentYear + 3 : (($term == 2) ? $currentYear + 2 : $currentYear + 1); - $endYear = ($renew) ? $endYear + ($prevYear - $currentYear) : $endYear; + $endYear = ($renew) ? $endYear + ($prevYear - $currentYear) : $endYear; + $joinDate = date('Y-m-d', mktime(0, 0, 0, $currentMonth, date('d'), $currentYear)); $startDate = date('Y-m-d', mktime(0, 0, 0, $currentMonth, date('d'), $currentYear)); $endDate = date('Y-m-d', mktime(0, 0, 0, $currentMonth, $previousDay, $endYear)); diff --git a/tests/phpunit/WebTest/Member/OnlineMembershipCreateTest.php b/tests/phpunit/WebTest/Member/OnlineMembershipCreateTest.php index 0cc25d9735..04033dfdb9 100644 --- a/tests/phpunit/WebTest/Member/OnlineMembershipCreateTest.php +++ b/tests/phpunit/WebTest/Member/OnlineMembershipCreateTest.php @@ -24,7 +24,6 @@ +--------------------------------------------------------------------+ */ - require_once 'CiviTest/CiviSeleniumTestCase.php'; class WebTest_Member_OnlineMembershipCreateTest extends CiviSeleniumTestCase { @@ -88,7 +87,6 @@ class WebTest_Member_OnlineMembershipCreateTest extends CiviSeleniumTestCase { FALSE ); - // create two new membership types $memTypeParams1 = $this->webtestAddMembershipType(); $memTypeTitle1 = $memTypeParams1['membership_type']; @@ -107,7 +105,7 @@ class WebTest_Member_OnlineMembershipCreateTest extends CiviSeleniumTestCase { $this->clickLink('_qf_MembershipBlock_next', '_qf_MembershipBlock_next-bottom'); $text = "'MembershipBlock' information has been saved."; $this->assertElementContainsText('crm-notification-container', $text, 'Missing text: ' . $text); - + //logout $this->webtestLogout(); @@ -137,7 +135,8 @@ class WebTest_Member_OnlineMembershipCreateTest extends CiviSeleniumTestCase { if ($payLater) { $verifyData['Status'] = 'Pending'; } - else { + else { + $verifyData['Status'] = 'New'; } $this->webtestVerifyTabularData($verifyData); @@ -185,9 +184,11 @@ class WebTest_Member_OnlineMembershipCreateTest extends CiviSeleniumTestCase { $this->waitForElementPresent("xpath=//div[@class='crm-section membership_amount-section']/div[2]//span/label"); if ($memTypeId != 'No thank you') { $this->click("xpath=//div[@class='crm-section membership_amount-section']/div[2]//span/label/span[2][contains(text(),'$memTypeId')]"); - } + } + else { - $this->click("xpath=//div[@class='crm-section membership_amount-section']/div[2]//span/label[contains(text(),'$memTypeId')]"); + $this->click("xpath=//div[@class='crm-section membership_amount-section']/div[2]//span/label[contains(text(),'$memTypeId')]"); + } if (!$otherAmount) { $this->click("xpath=//div[@class='crm-section contribution_amount-section']/div[2]//span/label[text()='No thank you']"); @@ -232,7 +233,7 @@ class WebTest_Member_OnlineMembershipCreateTest extends CiviSeleniumTestCase { $this->click("_qf_Confirm_next-bottom"); $this->waitForPageToLoad($this->getTimeoutMsec()); } - + function testOnlineMembershipCreateWithContribution() { //login with admin credentials & make sure we do have required permissions. $permissions = array("edit-1-make-online-contributions", "edit-1-profile-listings-and-forms"); diff --git a/tests/phpunit/WebTest/Member/OnlineMembershipRenewTest.php b/tests/phpunit/WebTest/Member/OnlineMembershipRenewTest.php index 8319032d76..4f42e76144 100644 --- a/tests/phpunit/WebTest/Member/OnlineMembershipRenewTest.php +++ b/tests/phpunit/WebTest/Member/OnlineMembershipRenewTest.php @@ -24,7 +24,6 @@ +--------------------------------------------------------------------+ */ - require_once 'CiviTest/CiviSeleniumTestCase.php'; class WebTest_Member_OnlineMembershipRenewTest extends CiviSeleniumTestCase { @@ -62,19 +61,21 @@ class WebTest_Member_OnlineMembershipRenewTest extends CiviSeleniumTestCase { $this->click('css=#tab_membership a'); $this->waitForElementPresent("member_is_active"); $this->check("member_is_active"); - - $this->waitForElementPresent("new_title"); + + $this->waitForElementPresent("new_title"); + if ($this->isElementPresent("member_price_set_id")) { - $this->waitForElementPresent("member_price_set_id"); + $this->waitForElementPresent("member_price_set_id"); + $this->select("member_price_set_id", "label=- none -"); } - + $this->waitForElementPresent("membership_type-block"); $this->check("xpath=//tr[@id='membership_type-block']/td[2]/table/tbody/tr/td/label[text()='General']/../input[2]"); $this->check("xpath=//tr[@id='membership_type-block']/td[2]/table/tbody/tr/td/label[text()='Student']/../input[2]"); $this->click("_qf_MembershipBlock_next-bottom"); $this->waitForTextPresent("'MembershipBlock' information has been saved"); - + // go to Profiles $this->click('css=#tab_custom a'); @@ -95,7 +96,7 @@ class WebTest_Member_OnlineMembershipRenewTest extends CiviSeleniumTestCase { //Go to online membership signup page $this->openCiviPage("contribute/transact", "reset=1&id=2", "_qf_Main_upload-bottom"); - + $this->click("xpath=//div[@class='crm-section membership_amount-section']/div[2]//span/label/span[2][contains(text(),'Student')]"); //Type first name and last name and email @@ -235,19 +236,20 @@ class WebTest_Member_OnlineMembershipRenewTest extends CiviSeleniumTestCase { $this->click('css=#tab_membership a'); $this->waitForElementPresent("member_is_active"); $this->check("member_is_active"); - + $this->waitForElementPresent("new_title"); if ($this->isElementPresent("member_price_set_id")) { - $this->waitForElementPresent("member_price_set_id"); + $this->waitForElementPresent("member_price_set_id"); + $this->select("member_price_set_id", "label=- none -"); } - + $this->waitForElementPresent("membership_type-block"); $this->check("xpath=//tr[@id='membership_type-block']/td[2]/table/tbody/tr/td/label[text()='General']/../input[2]"); $this->check("xpath=//tr[@id='membership_type-block']/td[2]/table/tbody/tr/td/label[text()='Student']/../input[2]"); $this->click("_qf_MembershipBlock_next-bottom"); $this->waitForTextPresent("'MembershipBlock' information has been saved"); - + // go to Profiles $this->click('css=#tab_custom a'); @@ -362,7 +364,7 @@ class WebTest_Member_OnlineMembershipRenewTest extends CiviSeleniumTestCase { function testUpdateInheritedMembershipOnBehalfOfRenewal() { // Log in as admin $this->webtestLogin('admin'); - + $this->enableComponents('CiviMember'); //check for online contribution and profile listings permissions @@ -389,7 +391,7 @@ class WebTest_Member_OnlineMembershipRenewTest extends CiviSeleniumTestCase { $membershipTypeTitle = "Membership Type $title"; $this->type('name', "Membership Type $title"); - + $this->type('member_of_contact', $title); $this->click('member_of_contact'); $this->waitForElementPresent("css=div.ac_results-inner li"); @@ -523,7 +525,6 @@ class WebTest_Member_OnlineMembershipRenewTest extends CiviSeleniumTestCase { $this->click("_qf_Confirm_next-bottom"); $this->waitForPageToLoad($this->getTimeoutMsec()); - // Log in using webtestLogin() method $this->webtestLogin(); diff --git a/tests/phpunit/WebTest/Member/SeperateMembershipPaymentTest.php b/tests/phpunit/WebTest/Member/SeperateMembershipPaymentTest.php index 81e1173ee0..c50d944bd3 100644 --- a/tests/phpunit/WebTest/Member/SeperateMembershipPaymentTest.php +++ b/tests/phpunit/WebTest/Member/SeperateMembershipPaymentTest.php @@ -24,7 +24,6 @@ +--------------------------------------------------------------------+ */ - require_once 'CiviTest/CiviSeleniumTestCase.php'; class WebTest_Member_SeperateMembershipPaymentTest extends CiviSeleniumTestCase { @@ -87,7 +86,6 @@ class WebTest_Member_SeperateMembershipPaymentTest extends CiviSeleniumTestCase FALSE ); - // create new membership types $memTypeParams1 = $this->webtestAddMembershipType(); $memTypeTitle1 = $memTypeParams1['membership_type']; diff --git a/tests/phpunit/WebTest/Member/StandaloneAddTest.php b/tests/phpunit/WebTest/Member/StandaloneAddTest.php index eb399f5025..0e16c2b451 100644 --- a/tests/phpunit/WebTest/Member/StandaloneAddTest.php +++ b/tests/phpunit/WebTest/Member/StandaloneAddTest.php @@ -24,7 +24,6 @@ +--------------------------------------------------------------------+ */ - require_once 'CiviTest/CiviSeleniumTestCase.php'; class WebTest_Member_StandaloneAddTest extends CiviSeleniumTestCase { @@ -164,4 +163,3 @@ class WebTest_Member_StandaloneAddTest extends CiviSeleniumTestCase { } } - diff --git a/tests/phpunit/WebTest/Member/UpdateMembershipScriptTest.php b/tests/phpunit/WebTest/Member/UpdateMembershipScriptTest.php index 0c9b03d197..48fa5ca90d 100644 --- a/tests/phpunit/WebTest/Member/UpdateMembershipScriptTest.php +++ b/tests/phpunit/WebTest/Member/UpdateMembershipScriptTest.php @@ -24,7 +24,6 @@ +--------------------------------------------------------------------+ */ - require_once 'CiviTest/CiviSeleniumTestCase.php'; class WebTest_Member_UpdateMembershipScriptTest extends CiviSeleniumTestCase { diff --git a/tests/phpunit/WebTest/Pledge/ContactContextAddTest.php b/tests/phpunit/WebTest/Pledge/ContactContextAddTest.php index 9c777138a5..05cbb4663e 100644 --- a/tests/phpunit/WebTest/Pledge/ContactContextAddTest.php +++ b/tests/phpunit/WebTest/Pledge/ContactContextAddTest.php @@ -24,7 +24,6 @@ +--------------------------------------------------------------------+ */ - require_once 'CiviTest/CiviSeleniumTestCase.php'; class WebTest_Pledge_ContactContextAddTest extends CiviSeleniumTestCase { diff --git a/tests/phpunit/WebTest/Pledge/ContactContextPledgePaymentAddTest.php b/tests/phpunit/WebTest/Pledge/ContactContextPledgePaymentAddTest.php index d0df48f102..b422067387 100644 --- a/tests/phpunit/WebTest/Pledge/ContactContextPledgePaymentAddTest.php +++ b/tests/phpunit/WebTest/Pledge/ContactContextPledgePaymentAddTest.php @@ -24,7 +24,6 @@ +--------------------------------------------------------------------+ */ - require_once 'CiviTest/CiviSeleniumTestCase.php'; class WebTest_Pledge_ContactContextPledgePaymentAddTest extends CiviSeleniumTestCase { @@ -39,7 +38,7 @@ class WebTest_Pledge_ContactContextPledgePaymentAddTest extends CiviSeleniumTest $this->click("add"); $this->click("_qf_Localization_next-bottom"); $this->waitForPageToLoad($this->getTimeoutMsec()); - + // create unique name $name = substr(sha1(rand()), 0, 7); $firstName = 'Adam' . $name; diff --git a/tests/phpunit/WebTest/Pledge/StandaloneAddDeleteTest.php b/tests/phpunit/WebTest/Pledge/StandaloneAddDeleteTest.php index c94640d8d7..acb45eb0f1 100644 --- a/tests/phpunit/WebTest/Pledge/StandaloneAddDeleteTest.php +++ b/tests/phpunit/WebTest/Pledge/StandaloneAddDeleteTest.php @@ -24,7 +24,6 @@ +--------------------------------------------------------------------+ */ - require_once 'CiviTest/CiviSeleniumTestCase.php'; class WebTest_Pledge_StandaloneAddDeleteTest extends CiviSeleniumTestCase { @@ -78,10 +77,11 @@ class WebTest_Pledge_StandaloneAddDeleteTest extends CiviSeleniumTestCase { $this->waitForElementPresent("xpath=//form[@id='Contribution']//div[2]/table/tbody/tr[3]/td[2]/a"); $this->click("xpath=//form[@id='Contribution']//div[2]/table/tbody/tr[3]/td[2]/a"); $this->type('total_amount', '300.00'); - $this->click('_qf_Contribution_upload-bottom'); + $this->click('_qf_Contribution_upload-bottom'); + $this->waitForPageToLoad("30000"); $this->assertElementContainsText('crm-notification-container', "The contribution record has been saved."); - + $this->waitForElementPresent("xpath=//div[@id='Pledges']//table//tbody/tr[1]/td[10]/span/a[text()='View']"); $this->click("xpath=//div[@id='Pledges']//table//tbody/tr[1]/td[1]/span/a"); $this->waitForElementPresent("xpath=//div[@id='Pledges']//table/tbody/tr[2]/td[2]/table/tbody/tr[3]/td[8]/a[text()='Record Payment (Check, Cash, EFT ...)']"); @@ -92,18 +92,19 @@ class WebTest_Pledge_StandaloneAddDeleteTest extends CiviSeleniumTestCase { $this->click('_qf_Contribution_upload-bottom'); $this->waitForPageToLoad("30000"); $this->assertElementContainsText('crm-notification-container', "The contribution record has been saved."); - + $this->waitForElementPresent("xpath=//div[@id='Pledges']//table//tbody/tr[1]/td[10]/span/a[text()='View']"); $this->click("xpath=//div[@id='Pledges']//table//tbody/tr[1]/td[1]/span/a"); $this->waitForElementPresent("xpath=//div[@id='Pledges']//table/tbody/tr[2]/td[2]/table/tbody/tr[4]/td[8]/a[text()='Record Payment (Check, Cash, EFT ...)']"); $this->click("xpath=//div[@id='Pledges']//table/tbody/tr[2]/td[2]/table/tbody/tr[4]/td[8]/a"); $this->waitForElementPresent("xpath=//form[@id='Contribution']//div[2]/table/tbody/tr[3]/td[2]/a"); - $this->click("xpath=//form[@id='Contribution']//div[2]/table/tbody/tr[3]/td[2]/a"); + $this->click("xpath=//form[@id='Contribution']//div[2]/table/tbody/tr[3]/td[2]/a"); + $this->type('total_amount', '170.00'); $this->click('_qf_Contribution_upload-bottom'); $this->waitForPageToLoad("30000"); $this->assertElementContainsText('crm-notification-container', "The contribution record has been saved."); - + // delete the contribution associated with the 2nd payment $this->waitForElementPresent("xpath=//div[@id='Pledges']//table//tbody/tr[1]/td[10]/span/a[text()='View']"); $this->click("xpath=//div[@id='Pledges']//table//tbody/tr[1]/td[1]/span/a"); @@ -117,16 +118,17 @@ class WebTest_Pledge_StandaloneAddDeleteTest extends CiviSeleniumTestCase { $this->click("ui-id-3"); $this->waitForElementPresent("xpath=//div[@id='Pledges']//table//tbody/tr[1]/td[10]/span/a[text()='View']"); $this->click("xpath=//div[@id='Pledges']//table//tbody/tr[1]/td[1]/span/a"); - $this->waitForElementPresent("xpath=//div[@id='Pledges']//table/tbody/tr[2]/td[2]/table/tbody/tr[3]/td[7]"); + $this->waitForElementPresent("xpath=//div[@id='Pledges']//table/tbody/tr[2]/td[2]/table/tbody/tr[3]/td[7]"); + $this->verifyText("xpath=//div[@id='Pledges']//table/tbody/tr[2]/td[2]/table/tbody/tr[3]/td[7]","Pending"); $this->waitForElementPresent("xpath=//div[@id='Pledges']//table/tbody/tr[2]/td[2]/table/tbody/tr[3]/td"); - + // verify that payment owed amount is correct (250.00) $this->verifyText("xpath=//div[@id='Pledges']//table/tbody/tr[2]/td[2]/table/tbody/tr[3]/td","250.00"); // verify that Total Paid and Balance sums are correct $this->verifyText("xpath=//div[@id='Pledges']//table//tbody/tr[1]/td[3]","470.00"); $this->verifyText("xpath=//div[@id='Pledges']//table//tbody/tr[1]/td[4]","1,930.00"); - + } } diff --git a/tests/phpunit/WebTest/Pledge/StandaloneAddTest.php b/tests/phpunit/WebTest/Pledge/StandaloneAddTest.php index 152b25bb83..7fd52c2d1d 100644 --- a/tests/phpunit/WebTest/Pledge/StandaloneAddTest.php +++ b/tests/phpunit/WebTest/Pledge/StandaloneAddTest.php @@ -24,7 +24,6 @@ +--------------------------------------------------------------------+ */ - require_once 'CiviTest/CiviSeleniumTestCase.php'; class WebTest_Pledge_StandaloneAddTest extends CiviSeleniumTestCase { diff --git a/tests/phpunit/WebTest/Profile/BatchUpdateTest.php b/tests/phpunit/WebTest/Profile/BatchUpdateTest.php index 2fc8851ef7..e152e53a7e 100644 --- a/tests/phpunit/WebTest/Profile/BatchUpdateTest.php +++ b/tests/phpunit/WebTest/Profile/BatchUpdateTest.php @@ -24,7 +24,6 @@ +--------------------------------------------------------------------+ */ - require_once 'CiviTest/CiviSeleniumTestCase.php'; class WebTest_Profile_BatchUpdateTest extends CiviSeleniumTestCase { diff --git a/tests/phpunit/WebTest/Profile/DedupeTest.php b/tests/phpunit/WebTest/Profile/DedupeTest.php index e446906cf7..aa1308d303 100644 --- a/tests/phpunit/WebTest/Profile/DedupeTest.php +++ b/tests/phpunit/WebTest/Profile/DedupeTest.php @@ -24,7 +24,6 @@ +--------------------------------------------------------------------+ */ - require_once 'CiviTest/CiviSeleniumTestCase.php'; class WebTest_Profile_DedupeTest extends CiviSeleniumTestCase { diff --git a/tests/phpunit/WebTest/Profile/MultiRecordProfileAddTest.php b/tests/phpunit/WebTest/Profile/MultiRecordProfileAddTest.php index db6a4a3d5d..c7e1de430e 100644 --- a/tests/phpunit/WebTest/Profile/MultiRecordProfileAddTest.php +++ b/tests/phpunit/WebTest/Profile/MultiRecordProfileAddTest.php @@ -24,7 +24,6 @@ +--------------------------------------------------------------------+ */ - require_once 'CiviTest/CiviSeleniumTestCase.php'; class WebTest_Profile_MultiRecordProfileAddTest extends CiviSeleniumTestCase { diff --git a/tests/phpunit/WebTest/Profile/ProfileAddTest.php b/tests/phpunit/WebTest/Profile/ProfileAddTest.php index 04f34a00ba..c565b62b62 100644 --- a/tests/phpunit/WebTest/Profile/ProfileAddTest.php +++ b/tests/phpunit/WebTest/Profile/ProfileAddTest.php @@ -24,7 +24,6 @@ +--------------------------------------------------------------------+ */ - require_once 'CiviTest/CiviSeleniumTestCase.php'; class WebTest_Profile_ProfileAddTest extends CiviSeleniumTestCase { diff --git a/tests/phpunit/WebTest/Profile/ProfileGroupSubscriptionTest.php b/tests/phpunit/WebTest/Profile/ProfileGroupSubscriptionTest.php index 6f22496e88..efd3027693 100644 --- a/tests/phpunit/WebTest/Profile/ProfileGroupSubscriptionTest.php +++ b/tests/phpunit/WebTest/Profile/ProfileGroupSubscriptionTest.php @@ -24,7 +24,6 @@ +--------------------------------------------------------------------+ */ - require_once 'CiviTest/CiviSeleniumTestCase.php'; class WebTest_Profile_ProfileGroupSubscriptionTest extends CiviSeleniumTestCase { @@ -37,7 +36,7 @@ class WebTest_Profile_ProfileGroupSubscriptionTest extends CiviSeleniumTestCase // Add new profile. $this->openCiviPage('admin/uf/group', 'reset=1'); - + $this->click('newCiviCRMProfile-top'); $this->waitForElementPresent('_qf_Group_next-bottom'); @@ -111,7 +110,7 @@ class WebTest_Profile_ProfileGroupSubscriptionTest extends CiviSeleniumTestCase // check advisory group ( may be we should create a separate group to test this) $this->click("group_3"); - + $this->click('_qf_Edit_next'); $this->waitForPageToLoad($this->getTimeoutMsec()); @@ -138,4 +137,3 @@ class WebTest_Profile_ProfileGroupSubscriptionTest extends CiviSeleniumTestCase } } - diff --git a/tests/phpunit/WebTest/Profile/SearchTest.php b/tests/phpunit/WebTest/Profile/SearchTest.php index cc2047bf10..7c11c7dfc7 100644 --- a/tests/phpunit/WebTest/Profile/SearchTest.php +++ b/tests/phpunit/WebTest/Profile/SearchTest.php @@ -24,7 +24,6 @@ +--------------------------------------------------------------------+ */ - require_once 'CiviTest/CiviSeleniumTestCase.php'; class WebTest_Profile_SearchTest extends CiviSeleniumTestCase { @@ -37,7 +36,7 @@ class WebTest_Profile_SearchTest extends CiviSeleniumTestCase { // Add new profile. $this->openCiviPage('admin/uf/group', 'reset=1'); - + $this->click('newCiviCRMProfile-bottom'); $this->waitForElementPresent('_qf_Group_next-bottom'); @@ -89,7 +88,7 @@ class WebTest_Profile_SearchTest extends CiviSeleniumTestCase { $this->waitForPageToLoad($this->getTimeoutMsec()); //check for field add $this->assertElementContainsText('crm-notification-container', "Your CiviCRM Profile Field 'Email' has been saved to '$profileTitle'."); - $this->assertElementContainsText('crm-notification-container', 'You can add another profile field.'); + $this->assertElementContainsText('crm-notification-container', 'You can add another profile field.'); // Add Sample Custom Field. $this->click('field_name[0]'); diff --git a/tests/phpunit/WebTest/Release/InstallScript.php b/tests/phpunit/WebTest/Release/InstallScript.php index a475ef6c11..119f165e93 100644 --- a/tests/phpunit/WebTest/Release/InstallScript.php +++ b/tests/phpunit/WebTest/Release/InstallScript.php @@ -24,7 +24,6 @@ +--------------------------------------------------------------------+ */ - require_once 'ReleaseTestCase.php'; // name of the class doesn't end with Test on purpose - this way this diff --git a/tests/phpunit/WebTest/Release/ReleaseTestCase.php b/tests/phpunit/WebTest/Release/ReleaseTestCase.php index de027acb64..0bfdb7218d 100644 --- a/tests/phpunit/WebTest/Release/ReleaseTestCase.php +++ b/tests/phpunit/WebTest/Release/ReleaseTestCase.php @@ -24,7 +24,6 @@ +--------------------------------------------------------------------+ */ - require_once 'CiviTest/CiviSeleniumTestCase.php'; // name of the class doesn't end with Test on purpose - this way this @@ -55,7 +54,6 @@ class WebTest_Release_ReleaseTestCase extends CiviSeleniumTestCase { $this->settings = new ReleaseTestSettings(); } - protected function setUp() { parent::setUp(); } diff --git a/tests/phpunit/WebTest/Release/UpgradeScript.php b/tests/phpunit/WebTest/Release/UpgradeScript.php index eb3eda3e55..5cc314bff7 100644 --- a/tests/phpunit/WebTest/Release/UpgradeScript.php +++ b/tests/phpunit/WebTest/Release/UpgradeScript.php @@ -24,7 +24,6 @@ +--------------------------------------------------------------------+ */ - require_once 'ReleaseTestCase.php'; // name of the class doesn't end with Test on purpose - this way this diff --git a/tests/phpunit/WebTest/Report/AddTest.php b/tests/phpunit/WebTest/Report/AddTest.php index b811b6ce56..bb7b106448 100644 --- a/tests/phpunit/WebTest/Report/AddTest.php +++ b/tests/phpunit/WebTest/Report/AddTest.php @@ -24,7 +24,6 @@ +--------------------------------------------------------------------+ */ - require_once 'CiviTest/CiviSeleniumTestCase.php'; class WebTest_Report_AddTest extends CiviSeleniumTestCase { @@ -59,13 +58,13 @@ class WebTest_Report_AddTest extends CiviSeleniumTestCase { // Is filter statistics present? $this->assertElementContainsText("xpath=//tr/th[@class='statistics'][text()='Contact Name']/../td", "Contains $firstName", "Statistics did not found!"); - + // Is Contact Name present in result? $this->assertElementContainsText('css=td.crm-report-civicrm_contact_sort_name', $displayName, "Contact Name did not found!"); // Is email Id present on result? $this->assertElementContainsText('css=td.crm-report-civicrm_email_email', $emailId, "Email did not found!"); - + // check criteria $this->click("css=div.crm-report_criteria-accordion div.crm-accordion-header"); $this->waitForElementPresent("sort_name_value"); @@ -119,7 +118,7 @@ class WebTest_Report_AddTest extends CiviSeleniumTestCase { // Open report list $this->openCiviPage('report/list', 'reset=1'); - + // Is report is resent in list? $this->assertElementContainsText('css=table.report-layout', $reportName); @@ -127,10 +126,9 @@ class WebTest_Report_AddTest extends CiviSeleniumTestCase { $this->click("link=$reportName"); $this->waitForPageToLoad($this->getTimeoutMsec()); - // Is filter statistics present? $this->assertElementContainsText("xpath=//tr/th[@class='statistics'][text()='Contact Name']/../td", "Contains $firstName", "Statistics did not found!"); - + // Is Contact Name present in result? $this->assertElementContainsText('css=td.crm-report-civicrm_contact_sort_name', $displayName, "Contact Name did not found!"); @@ -180,4 +178,3 @@ class WebTest_Report_AddTest extends CiviSeleniumTestCase { } } - diff --git a/tests/phpunit/WebTest/Report/DonarReportTest.php b/tests/phpunit/WebTest/Report/DonarReportTest.php index abb4a22475..759e7f7ffc 100644 --- a/tests/phpunit/WebTest/Report/DonarReportTest.php +++ b/tests/phpunit/WebTest/Report/DonarReportTest.php @@ -24,7 +24,6 @@ +--------------------------------------------------------------------+ */ - require_once 'CiviTest/CiviSeleniumTestCase.php'; class WebTest_Report_DonarReportTest extends CiviSeleniumTestCase { @@ -37,7 +36,7 @@ class WebTest_Report_DonarReportTest extends CiviSeleniumTestCase { // now create new donar detail report instance $this->openCiviPage('report/contribute/detail', 'reset=1', '_qf_Detail_submit'); - + // preview result $this->click("_qf_Detail_submit"); $this->waitForPageToLoad($this->getTimeoutMsec()); diff --git a/tests/phpunit/WebTest/Report/LoggingReportTest.php b/tests/phpunit/WebTest/Report/LoggingReportTest.php index c764f8c9ac..7cf44a57d0 100644 --- a/tests/phpunit/WebTest/Report/LoggingReportTest.php +++ b/tests/phpunit/WebTest/Report/LoggingReportTest.php @@ -24,7 +24,6 @@ +--------------------------------------------------------------------+ */ - require_once 'CiviTest/CiviSeleniumTestCase.php'; class WebTest_Report_LoggingReportTest extends CiviSeleniumTestCase { diff --git a/tests/phpunit/WebTest/Report/RolePermissionReportTest.php b/tests/phpunit/WebTest/Report/RolePermissionReportTest.php index d9243ad149..8601d50866 100644 --- a/tests/phpunit/WebTest/Report/RolePermissionReportTest.php +++ b/tests/phpunit/WebTest/Report/RolePermissionReportTest.php @@ -24,7 +24,6 @@ +--------------------------------------------------------------------+ */ - require_once 'CiviTest/CiviSeleniumTestCase.php'; class WebTest_Report_RolePermissionReportTest extends CiviSeleniumTestCase { -- 2.25.1