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';
30 * Class WebTest_Member_StandaloneAddTest
32 class WebTest_Member_StandaloneAddTest
extends CiviSeleniumTestCase
{
34 protected function setUp() {
38 function testStandaloneMemberAdd() {
40 $this->webtestLogin();
43 $firstName = substr(sha1(rand()), 0, 7);
44 $this->webtestAddContact($firstName, "Memberson", "Memberson{$firstName}@memberson.name");
45 $contactName = "Memberson, $firstName";
47 // add membership type
48 $membershipTypes = $this->webtestAddMembershipType();
51 $this->openCiviPage("member/add", "reset=1&action=add&context=standalone", "_qf_Membership_upload");
54 $this->webtestFillAutocomplete($firstName);
56 // fill in Membership Organization
57 $this->select("membership_type_id[0]", "label={$membershipTypes['member_of_contact']}");
59 // select membership type
60 $this->select("membership_type_id[1]", "label={$membershipTypes['membership_type']}");
63 $this->type("source", "Membership StandaloneAddTest Webtest");
65 // Let Join Date stay default
68 $this->webtestFillDate('start_date');
70 // Let End Date be auto computed
72 // fill in Status Override?
73 // fill in Record Membership Payment?
74 $this->click("send_receipt");
75 $this->assertTrue($this->isChecked("send_receipt"), 'Send Confirmation and Receipt checkbox should be checked.');
76 $this->click("_qf_Membership_upload");
79 $this->waitForElementPresent("xpath=//div[@id='memberships']//table//tbody/tr[1]/td[9]/span/a[text()='View']");
80 $this->click("xpath=//div[@id='memberships']//table/tbody/tr[1]/td[9]/span/a[text()='View']");
81 $this->waitForElementPresent("_qf_MembershipView_cancel-bottom");
84 'Membership Type' => $membershipTypes['membership_type'],
86 'Source' => 'Membership StandaloneAddTest Webtest',
88 $this->webtestVerifyTabularData($expected);
91 function testStandaloneMemberOverrideAdd() {
93 $this->webtestLogin();
96 $firstName = substr(sha1(rand()), 0, 7);
97 $this->webtestAddContact($firstName, "Memberson", "Memberson{$firstName}@memberson.name");
98 $contactName = "Memberson, $firstName";
100 // add membership type
101 $membershipTypes = $this->webtestAddMembershipType();
104 $this->openCiviPage("member/add", "reset=1&action=add&context=standalone", "_qf_Membership_upload");
107 $this->webtestFillAutocomplete($firstName);
109 // fill in Membership Organization
110 $this->select("membership_type_id[0]", "label={$membershipTypes['member_of_contact']}");
112 // select membership type
113 $this->select("membership_type_id[1]", "label={$membershipTypes['membership_type']}");
116 $this->type("source", "Membership StandaloneAddTest Webtest");
118 // Let Join Date stay default
120 // fill in Start Date
121 $this->webtestFillDate('start_date');
123 // Let End Date be auto computed
125 // fill in Status Override?
126 $this->click("is_override", "value=1");
127 $this->waitForElementPresent("status_id");
128 $this->select("status_id", "value=3");
130 // fill in Record Membership Payment?
131 $this->click("record_contribution", "value=1");
132 $this->waitForElementPresent("contribution_status_id");
133 // let financial type be default
135 // let the amount be default
137 // select payment instrument type = Check and enter chk number
138 $this->select("payment_instrument_id", "value=4");
139 $this->waitForElementPresent("check_number");
140 $this->type("check_number", "check #12345");
141 $this->type("trxn_id", "P5476785" . rand(100, 10000));
143 // fill the payment status be default
144 $this->select("contribution_status_id", "value=2");
149 $this->click("_qf_Membership_upload");
150 $this->waitForPageToLoad($this->getTimeoutMsec());
153 $this->waitForTextPresent("Membership StandaloneAddTest Webtest");
155 // verify if Membership is created
156 $this->waitForElementPresent("xpath=//div[@id='memberships']//table//tbody/tr[1]/td[9]/span/a[text()='View']");
158 //click through to the Membership view screen
159 $this->click("xpath=//div[@id='memberships']//table//tbody/tr[1]/td[9]/span/a[text()='View']");
160 $this->waitForElementPresent("_qf_MembershipView_cancel-bottom");
163 'Membership Type' => $membershipTypes['membership_type'],
165 'Source' => 'Membership StandaloneAddTest Webtest',
167 $this->webtestVerifyTabularData($expected);
170 function testAjaxCustomGroupLoad() {
171 $this->webtestLogin();
172 $triggerElement = array('name' => 'membership_type_id_1', 'type' => 'select');
174 array('entity' => 'Membership', 'subEntity' => 'General', 'triggerElement' => $triggerElement),
175 array('entity' => 'Membership', 'subEntity' => 'Student', 'triggerElement' => $triggerElement)
178 $pageUrl = array('url' => 'member/add', 'args' => 'reset=1&action=add&context=standalone');
180 //case where we should fire certain
181 //ui actions which helps triggering possible
183 $this->customFieldSetLoadOnTheFlyCheck($customSets, $pageUrl,
184 function() use ($test) {
185 $test->select('membership_type_id_0', 'value=1');