From c05d072a3e59270df4abdf1575434af830fd5799 Mon Sep 17 00:00:00 2001 From: atif-shaikh Date: Thu, 14 Aug 2014 20:18:51 +0530 Subject: [PATCH] CRM-15099 - Webtest for Gift Membership https://issues.civicrm.org/jira/browse/CRM-15099 --- .../WebTest/Member/StandaloneAddTest.php | 68 +++++++++++++++++++ 1 file changed, 68 insertions(+) diff --git a/tests/phpunit/WebTest/Member/StandaloneAddTest.php b/tests/phpunit/WebTest/Member/StandaloneAddTest.php index 8123794d5e..bd51f8c4a7 100644 --- a/tests/phpunit/WebTest/Member/StandaloneAddTest.php +++ b/tests/phpunit/WebTest/Member/StandaloneAddTest.php @@ -88,6 +88,74 @@ class WebTest_Member_StandaloneAddTest extends CiviSeleniumTestCase { $this->webtestVerifyTabularData($expected); } + function testStandaloneGiftMembership() { + + $this->webtestLogin(); + + // create contact + $firstName = substr(sha1(rand()), 0, 7); + $this->webtestAddContact($firstName, "Memberson", "Memberson{$firstName}@memberson.name"); + $contactName = "Memberson, $firstName"; + + $giftMemberfirstName = substr(sha1(rand()), 0, 7); + $this->webtestAddContact($giftMemberfirstName, "Memberson", "Memberson{$giftMemberfirstName}@memberson.name"); + $giftMembercontactName = "Memberson, $giftMemberfirstName"; + + // add membership type + $membershipTypes = $this->webtestAddMembershipType(); + + // now add membership + $this->openCiviPage("member/add", "reset=1&action=add&context=standalone", "_qf_Membership_upload"); + + // select contact + $this->webtestFillAutocomplete($firstName); + + // fill in Membership Organization + $this->select("membership_type_id[0]", "label={$membershipTypes['member_of_contact']}"); + + // select membership type + $this->select("membership_type_id[1]", "label={$membershipTypes['membership_type']}"); + + // fill in Source + $this->type("source", "Membership StandaloneAddTest Webtest"); + + // fill in Start Date + $this->webtestFillDate('start_date'); + + // add softcredit details + $totalAmount = 100; + $financialType = 'Donation'; + $this->clickLink('is_different_contribution_contact','total_amount',FALSE); + + $this->select('soft_credit_type_id', 'Gift'); + $this->select2('soft_credit_contact_id', $giftMembercontactName); + $this->select('financial_type_id','Donation'); + $this->type('total_amount', $totalAmount); + $this->select('payment_instrument_id', 'Check'); + $this->select('contribution_status_id', 'Completed'); + + $this->click("_qf_Membership_upload"); + + //View Membership + $this->waitForElementPresent("xpath=//div[@id='memberships']//table//tbody/tr[1]/td[9]/span/a[text()='View']"); + $this->click("xpath=//div[@id='memberships']//table/tbody/tr[1]/td[9]/span/a[text()='View']"); + $this->waitForElementPresent("_qf_MembershipView_cancel-bottom"); + + // verify soft credit data + $expected = array( + '1' => $giftMemberfirstName.' Memberson', + '2' => $totalAmount, + '3' => 'Gift', + '4' => 'Donation', + '6' => 'Completed', + ); + + foreach($expected as $key => $value) { + $this->verifyText("xpath=//div[@class='crm-accordion-wrapper']//table/tbody//tr/td[$key]", $value); + } + + } + function testStandaloneMemberOverrideAdd() { $this->webtestLogin(); -- 2.25.1