3 +--------------------------------------------------------------------+
4 | CiviCRM version 4.5 |
5 +--------------------------------------------------------------------+
6 | Copyright CiviCRM LLC (c) 2004-2014 |
7 +--------------------------------------------------------------------+
8 | This file is a part of CiviCRM. |
10 | CiviCRM is free software; you can copy, modify, and distribute it |
11 | under the terms of the GNU Affero General Public License |
12 | Version 3, 19 November 2007 and the CiviCRM Licensing Exception. |
14 | CiviCRM is distributed in the hope that it will be useful, but |
15 | WITHOUT ANY WARRANTY; without even the implied warranty of |
16 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. |
17 | See the GNU Affero General Public License for more details. |
19 | You should have received a copy of the GNU Affero General Public |
20 | License along with this program; if not, contact CiviCRM LLC |
21 | at info[AT]civicrm[DOT]org. If you have questions about the |
22 | GNU Affero General Public License or the licensing of CiviCRM, |
23 | see the CiviCRM license FAQ at http://civicrm.org/licensing |
24 +--------------------------------------------------------------------+
27 require_once 'CiviTest/CiviSeleniumTestCase.php';
28 class WebTest_Member_StandaloneAddTest
extends CiviSeleniumTestCase
{
30 protected function setUp() {
34 function testStandaloneMemberAdd() {
36 $this->webtestLogin();
39 $firstName = substr(sha1(rand()), 0, 7);
40 $this->webtestAddContact($firstName, "Memberson", "Memberson{$firstName}@memberson.name");
41 $contactName = "Memberson, $firstName";
43 // add membership type
44 $membershipTypes = $this->webtestAddMembershipType();
47 $this->openCiviPage("member/add", "reset=1&action=add&context=standalone", "_qf_Membership_upload");
50 $this->webtestFillAutocomplete($firstName);
52 // fill in Membership Organization
53 $this->select("membership_type_id[0]", "label={$membershipTypes['member_of_contact']}");
55 // select membership type
56 $this->select("membership_type_id[1]", "label={$membershipTypes['membership_type']}");
59 $this->type("source", "Membership StandaloneAddTest Webtest");
61 // Let Join Date stay default
64 $this->webtestFillDate('start_date');
66 // Let End Date be auto computed
68 // fill in Status Override?
69 // fill in Record Membership Payment?
71 $this->click("_qf_Membership_upload");
74 $this->waitForElementPresent("xpath=//div[@id='memberships']//table//tbody/tr[1]/td[9]/span/a[text()='View']");
75 $this->click("xpath=//div[@id='memberships']//table/tbody/tr[1]/td[9]/span/a[text()='View']");
76 $this->waitForElementPresent("_qf_MembershipView_cancel-bottom");
79 'Membership Type' => $membershipTypes['membership_type'],
81 'Source' => 'Membership StandaloneAddTest Webtest',
83 $this->webtestVerifyTabularData($expected);
86 function testStandaloneMemberOverrideAdd() {
88 $this->webtestLogin();
91 $firstName = substr(sha1(rand()), 0, 7);
92 $this->webtestAddContact($firstName, "Memberson", "Memberson{$firstName}@memberson.name");
93 $contactName = "Memberson, $firstName";
95 // add membership type
96 $membershipTypes = $this->webtestAddMembershipType();
99 $this->openCiviPage("member/add", "reset=1&action=add&context=standalone", "_qf_Membership_upload");
102 $this->webtestFillAutocomplete($firstName);
104 // fill in Membership Organization
105 $this->select("membership_type_id[0]", "label={$membershipTypes['member_of_contact']}");
107 // select membership type
108 $this->select("membership_type_id[1]", "label={$membershipTypes['membership_type']}");
111 $this->type("source", "Membership StandaloneAddTest Webtest");
113 // Let Join Date stay default
115 // fill in Start Date
116 $this->webtestFillDate('start_date');
118 // Let End Date be auto computed
120 // fill in Status Override?
121 $this->click("is_override", "value=1");
122 $this->waitForElementPresent("status_id");
123 $this->select("status_id", "value=3");
125 // fill in Record Membership Payment?
126 $this->click("record_contribution", "value=1");
127 $this->waitForElementPresent("contribution_status_id");
128 // let financial type be default
130 // let the amount be default
132 // select payment instrument type = Check and enter chk number
133 $this->select("payment_instrument_id", "value=4");
134 $this->waitForElementPresent("check_number");
135 $this->type("check_number", "check #12345");
136 $this->type("trxn_id", "P5476785" . rand(100, 10000));
138 // fill the payment status be default
139 $this->select("contribution_status_id", "value=2");
144 $this->click("_qf_Membership_upload");
145 $this->waitForPageToLoad($this->getTimeoutMsec());
148 $this->waitForTextPresent("Membership StandaloneAddTest Webtest");
150 // verify if Membership is created
151 $this->waitForElementPresent("xpath=//div[@id='memberships']//table//tbody/tr[1]/td[9]/span/a[text()='View']");
153 //click through to the Membership view screen
154 $this->click("xpath=//div[@id='memberships']//table//tbody/tr[1]/td[9]/span/a[text()='View']");
155 $this->waitForElementPresent("_qf_MembershipView_cancel-bottom");
158 'Membership Type' => $membershipTypes['membership_type'],
160 'Source' => 'Membership StandaloneAddTest Webtest',
162 $this->webtestVerifyTabularData($expected);
165 function testAjaxCustomGroupLoad() {
166 $this->webtestLogin();
167 $triggerElement = array('name' => 'membership_type_id_1', 'type' => 'select');
169 array('entity' => 'Membership', 'subEntity' => 'General', 'triggerElement' => $triggerElement),
170 array('entity' => 'Membership', 'subEntity' => 'Student', 'triggerElement' => $triggerElement)
173 $pageUrl = array('url' => 'member/add', 'args' => 'reset=1&action=add&context=standalone');
175 //case where we should fire certain
176 //ui actions which helps triggering possible
178 $this->customFieldSetLoadOnTheFlyCheck($customSets, $pageUrl,
179 function() use ($test) {
180 $test->select('membership_type_id_0', 'value=1');