Commit | Line | Data |
---|---|---|
6a488035 TO |
1 | <?php |
2 | /* | |
3 | +--------------------------------------------------------------------+ | |
39de6fd5 | 4 | | CiviCRM version 4.6 | |
6a488035 | 5 | +--------------------------------------------------------------------+ |
06a1bc01 | 6 | | Copyright CiviCRM LLC (c) 2004-2014 | |
6a488035 TO |
7 | +--------------------------------------------------------------------+ |
8 | | This file is a part of CiviCRM. | | |
9 | | | | |
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. | | |
13 | | | | |
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. | | |
18 | | | | |
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 | +--------------------------------------------------------------------+ | |
25 | */ | |
26 | ||
6a488035 | 27 | require_once 'CiviTest/CiviSeleniumTestCase.php'; |
e9479dcf EM |
28 | |
29 | /** | |
30 | * Class WebTest_Member_OfflineMembershipAddPricesetTest | |
31 | */ | |
6a488035 TO |
32 | class WebTest_Member_OfflineMembershipAddPricesetTest extends CiviSeleniumTestCase { |
33 | ||
34 | protected function setUp() { | |
35 | parent::setUp(); | |
36 | } | |
37 | ||
00be9182 | 38 | public function testAddPriceSet() { |
6a488035 TO |
39 | // Log in using webtestLogin() method |
40 | $this->webtestLogin(); | |
41 | ||
42 | $title = substr(sha1(rand()), 0, 7); | |
43 | $setTitle = "Membership Fees - $title"; | |
44 | $usedFor = 'Membership'; | |
45 | $contributionType = 'Donation'; | |
46 | $setHelp = 'Select your membership options.'; | |
47 | $this->_testAddSet($setTitle, $usedFor, $contributionType, $setHelp); | |
48 | ||
49 | // Get the price set id ($sid) by retrieving and parsing the URL of the New Price Field form | |
50 | // which is where we are after adding Price Set. | |
a471a3b6 | 51 | $sid = $this->urlArg('sid'); |
6a488035 TO |
52 | $this->assertType('numeric', $sid); |
53 | ||
54 | $fields = array( | |
55 | "National Membership $title" => 'Radio', | |
56 | "Local Chapter $title" => 'CheckBox', | |
57 | ); | |
58 | ||
59 | list($memTypeTitle1, $memTypeTitle2) = $this->_testAddPriceFields($fields, $validateStrings, FALSE, $title, $sid, $contributionType); | |
6a488035 TO |
60 | |
61 | // load the Price Set Preview and check for expected values | |
62 | $this->_testVerifyPriceSet($validateStrings, $sid); | |
63 | ||
64 | // Sign up for membership | |
65 | $firstName = 'John_' . substr(sha1(rand()), 0, 7); | |
66 | $lastName = 'Anderson_' . substr(sha1(rand()), 0, 7); | |
67 | $email = "{$firstName}.{$lastName}@example.com"; | |
68 | $contactParams = array( | |
69 | 'first_name' => $firstName, | |
70 | 'last_name' => $lastName, | |
71 | 'email-5' => $email, | |
72 | ); | |
73 | ||
74 | // Add a contact from the quick add block | |
75 | $this->webtestAddContact($firstName, $lastName, $email); | |
76 | ||
77 | $this->_testSignUpOrRenewMembership($sid, $contactParams, $memTypeTitle1, $memTypeTitle2); | |
78 | ||
79 | // Renew this membership | |
80 | $this->_testSignUpOrRenewMembership($sid, $contactParams, $memTypeTitle1, $memTypeTitle2, $renew = TRUE); | |
81 | } | |
82 | ||
6c6e6187 | 83 | public function testAddPriceSetWithMultipleTerms() { |
6a488035 TO |
84 | // Log in using webtestLogin() method |
85 | $this->webtestLogin(); | |
0ff7ff97 | 86 | |
6a488035 TO |
87 | $title = substr(sha1(rand()), 0, 7); |
88 | $setTitle = "Membership Fees - $title"; | |
89 | $usedFor = 'Membership'; | |
90 | $contributionType = 'Member Dues'; | |
91 | $setHelp = 'Select your membership options.'; | |
92 | $memTypeParams1 = $this->webtestAddMembershipType(); | |
93 | $memTypeTitle1 = $memTypeParams1['membership_type']; | |
343688b7 | 94 | $memTypeId1 = explode('&id=', $this->getAttribute("xpath=//div[@id='membership_type']/table/tbody//tr/td[text()='{$memTypeTitle1}']/../td[12]/span/a[3]@href")); |
6a488035 TO |
95 | $memTypeId1 = $memTypeId1[1]; |
96 | $this->_testAddSet($setTitle, $usedFor, $contributionType, $setHelp); | |
97 | ||
98 | // Get the price set id ($sid) by retrieving and parsing the URL of the New Price Field form | |
99 | // which is where we are after adding Price Set. | |
a471a3b6 | 100 | $sid = $this->urlArg('sid'); |
6a488035 TO |
101 | $this->assertType('numeric', $sid); |
102 | ||
103 | $fields = array("National Membership $title", "Radio"); | |
0ff7ff97 PJ |
104 | $this->openCiviPage("admin/price/field", "reset=1&action=add&sid={$sid}"); |
105 | ||
6a488035 TO |
106 | $validateStrings[] = $fields[0]; |
107 | $this->type('label', $fields[0]); | |
108 | $this->select('html_type', "value={$fields[1]}"); | |
109 | $options = array( | |
6c6e6187 TO |
110 | 1 => array( |
111 | 'label' => $memTypeTitle1."_1", | |
0ff7ff97 PJ |
112 | 'membership_type_id' => $memTypeId1, |
113 | 'amount' => 50.00, | |
114 | 'membership_num_terms' => 1, | |
115 | ), | |
116 | 2 => array( | |
117 | 'label' => $memTypeTitle1."_2", | |
118 | 'membership_type_id' => $memTypeId1, | |
119 | 'amount' => 90.00, | |
120 | 'membership_num_terms' => 2, | |
121 | ), | |
122 | 3 => array( | |
123 | 'label' => $memTypeTitle1."_3", | |
124 | 'membership_type_id' => $memTypeId1, | |
125 | 'amount' => 120.00, | |
126 | 'membership_num_terms' => 3, | |
127 | ), | |
128 | ); | |
6a488035 | 129 | $i = 2; |
22e263ad | 130 | foreach ($options as $index => $values){ |
6a488035 | 131 | $this->select("membership_type_id_{$index}", "value={$values['membership_type_id']}"); |
efb29358 CW |
132 | // Because it tends to cause problems, all uses of sleep() must be justified in comments |
133 | // Sleep should never be used for wait for anything to load from the server | |
134 | // Justification for this instance: FIXME | |
6a488035 | 135 | sleep(1); |
6c6e6187 TO |
136 | $this->type("xpath=//table[@id='optionField']/tbody/tr[$i]/td[4]/input", $values['membership_num_terms']); |
137 | $this->type("xpath=//table[@id='optionField']/tbody/tr[$i]/td[5]/input", $values['label']); | |
138 | $this->type("xpath=//table[@id='optionField']/tbody/tr[$i]/td[6]/input", $values['amount']); | |
22e263ad | 139 | if ($i > 3){ |
0ff7ff97 | 140 | $this->click('link=another choice'); |
6a488035 TO |
141 | } |
142 | $i++; | |
143 | } | |
144 | $this->waitForElementPresent( 'financial_type_id' ); | |
145 | $this->select("financial_type_id", "label={$contributionType}"); | |
146 | $this->waitForElementPresent('_qf_Field_next-bottom'); | |
147 | $this->click('_qf_Field_next-bottom'); | |
6c5f7368 | 148 | $this->waitForText('crm-notification-container', "Price Field '{$fields[0]}' has been saved."); |
0ff7ff97 | 149 | |
6a488035 TO |
150 | // load the Price Set Preview and check for expected values |
151 | $this->_testVerifyPriceSet($validateStrings, $sid); | |
152 | ||
153 | $firstName = 'John_' . substr(sha1(rand()), 0, 7); | |
154 | $lastName = 'Anderson_' . substr(sha1(rand()), 0, 7); | |
155 | $email = "{$firstName}.{$lastName}@example.com"; | |
156 | ||
157 | $contactParams = array( | |
158 | 'first_name' => $firstName, | |
159 | 'last_name' => $lastName, | |
160 | 'email-5' => $email, | |
161 | ); | |
162 | $this->webtestAddContact($firstName, $lastName, $email); | |
163 | //membership with number of terms as 3 | |
164 | $this->_testMultilpeTermsMembershipRegistration($sid, $contactParams, $memTypeTitle1, 3); | |
165 | //membership with number of terms as 2 | |
166 | $this->_testMultilpeTermsMembershipRegistration($sid, $contactParams, $memTypeTitle1, 2); | |
0ff7ff97 | 167 | |
6a488035 TO |
168 | } |
169 | ||
4cbe18b8 EM |
170 | /** |
171 | * @param $setTitle | |
172 | * @param $usedFor | |
173 | * @param null $contributionType | |
174 | * @param $setHelp | |
175 | */ | |
00be9182 | 176 | public function _testAddSet($setTitle, $usedFor, $contributionType = NULL, $setHelp) { |
0ff7ff97 | 177 | $this->openCiviPage('admin/price', 'reset=1&action=add', '_qf_Set_next-bottom'); |
6a488035 TO |
178 | |
179 | // Enter Priceset fields (Title, Used For ...) | |
180 | $this->type('title', $setTitle); | |
181 | if ($usedFor == 'Event') { | |
182 | $this->check('extends_1'); | |
183 | } | |
184 | elseif ($usedFor == 'Contribution') { | |
185 | $this->check('extends_2'); | |
186 | } | |
187 | elseif ($usedFor == 'Membership') { | |
188 | $this->click('extends_3'); | |
0ff7ff97 | 189 | $this->waitForElementPresent('financial_type_id'); |
73072f84 | 190 | $this->select("css=select.crm-form-select", "label={$contributionType}"); |
6a488035 | 191 | } |
6a488035 | 192 | $this->type('help_pre', $setHelp); |
6a488035 | 193 | $this->assertChecked('is_active', 'Verify that Is Active checkbox is set.'); |
6a488035 | 194 | |
0ff7ff97 | 195 | $this->click('_qf_Set_next-bottom'); |
343688b7 | 196 | $this->waitForElementPresent("xpath=//div[@id='crm-main-content-wrapper']//div[2]/a"); |
6c5f7368 | 197 | $this->waitForText('crm-notification-container', "Your Set '{$setTitle}' has been added. You can add fields to this set now."); |
6a488035 TO |
198 | } |
199 | ||
4cbe18b8 EM |
200 | /** |
201 | * @param $fields | |
202 | * @param $validateString | |
203 | * @param bool $dateSpecificFields | |
204 | * @param $title | |
100fef9d | 205 | * @param int $sid |
4cbe18b8 EM |
206 | * @param $contributionType |
207 | * | |
208 | * @return array | |
209 | */ | |
00be9182 | 210 | public function _testAddPriceFields(&$fields, &$validateString, $dateSpecificFields = FALSE, $title, $sid, $contributionType) { |
6a488035 TO |
211 | $memTypeParams1 = $this->webtestAddMembershipType(); |
212 | $memTypeTitle1 = $memTypeParams1['membership_type']; | |
213 | ||
c880a737 | 214 | $memTypeId1 = explode('&id=', $this->getAttribute("xpath=//div[@id='membership_type']/table/tbody//tr/td[text()='{$memTypeTitle1}']/../td[12]/span/a[3]@href")); |
6a488035 TO |
215 | $memTypeId1 = $memTypeId1[1]; |
216 | ||
217 | $memTypeParams2 = $this->webtestAddMembershipType(); | |
218 | $memTypeTitle2 = $memTypeParams2['membership_type']; | |
c880a737 | 219 | $memTypeId2 = explode('&id=', $this->getAttribute("xpath=//div[@id='membership_type']/table/tbody//tr/td[text()='{$memTypeTitle2}']/../td[12]/span/a[3]@href")); |
6a488035 TO |
220 | $memTypeId2 = $memTypeId2[1]; |
221 | ||
0ff7ff97 | 222 | $this->openCiviPage("admin/price/field", "reset=1&action=add&sid={$sid}"); |
6a488035 TO |
223 | |
224 | foreach ($fields as $label => $type) { | |
225 | $validateStrings[] = $label; | |
226 | ||
227 | $this->type('label', $label); | |
228 | $this->select('html_type', "value={$type}"); | |
229 | ||
230 | switch ($type) { | |
231 | case 'Radio': | |
232 | $options = array( | |
6c6e6187 TO |
233 | 1 => array( |
234 | 'label' => "$memTypeTitle1", | |
0ff7ff97 PJ |
235 | 'membership_type_id' => $memTypeId1, |
236 | 'amount' => 100.00, | |
6a488035 TO |
237 | ), |
238 | 2 => array( | |
239 | 'label' => "$memTypeTitle2", | |
240 | 'membership_type_id' => $memTypeId2, | |
241 | 'amount' => 50.00, | |
242 | ), | |
243 | ); | |
244 | $this->addMultipleChoiceOptions($options, $validateStrings); | |
245 | break; | |
246 | ||
247 | case 'CheckBox': | |
248 | $options = array( | |
6c6e6187 TO |
249 | 1 => array( |
250 | 'label' => "$memTypeTitle1", | |
0ff7ff97 PJ |
251 | 'membership_type_id' => $memTypeId1, |
252 | 'amount' => 100.00, | |
6a488035 TO |
253 | ), |
254 | 2 => array( | |
255 | 'label' => "$memTypeTitle2", | |
256 | 'membership_type_id' => $memTypeId2, | |
257 | 'amount' => 50.00, | |
258 | ), | |
259 | ); | |
260 | $this->addMultipleChoiceOptions($options, $validateStrings); | |
261 | break; | |
262 | ||
263 | default: | |
264 | break; | |
265 | } | |
266 | $this->select("financial_type_id", "label={$contributionType}"); | |
267 | $this->click('_qf_Field_next_new-bottom'); | |
268 | $this->waitForPageToLoad($this->getTimeoutMsec()); | |
6c5f7368 | 269 | $this->waitForText('crm-notification-container', "Price Field '{$label}' has been saved."); |
6a488035 TO |
270 | } |
271 | return array($memTypeTitle1, $memTypeTitle2); | |
272 | } | |
273 | ||
4cbe18b8 EM |
274 | /** |
275 | * @param $validateStrings | |
100fef9d | 276 | * @param int $sid |
4cbe18b8 | 277 | */ |
00be9182 | 278 | public function _testVerifyPriceSet($validateStrings, $sid) { |
6a488035 TO |
279 | // verify Price Set at Preview page |
280 | // start at Manage Price Sets listing | |
0ff7ff97 | 281 | $this->openCiviPage('admin/price', 'reset=1'); |
6a488035 TO |
282 | |
283 | // Use the price set id ($sid) to pick the correct row | |
73072f84 | 284 | $this->click("css=tr#price_set-{$sid} a[title='Preview Price Set']"); |
6a488035 | 285 | |
6a488035 TO |
286 | // Look for Register button |
287 | $this->waitForElementPresent('_qf_Preview_cancel-bottom'); | |
288 | ||
289 | // Check for expected price set field strings | |
290 | $this->assertStringsPresent($validateStrings); | |
291 | } | |
292 | ||
4cbe18b8 | 293 | /** |
100fef9d CW |
294 | * @param int $sid |
295 | * @param array $contactParams | |
4cbe18b8 EM |
296 | * @param $memTypeTitle1 |
297 | * @param $memTypeTitle2 | |
298 | * @param bool $renew | |
299 | */ | |
00be9182 | 300 | public function _testSignUpOrRenewMembership($sid, $contactParams, $memTypeTitle1, $memTypeTitle2, $renew = FALSE) { |
6a488035 TO |
301 | //build the membership dates. |
302 | require_once 'CRM/Core/Config.php'; | |
303 | require_once 'CRM/Utils/Array.php'; | |
304 | require_once 'CRM/Utils/Date.php'; | |
305 | $currentYear = date('Y'); | |
306 | $currentMonth = date('m'); | |
307 | $previousDay = date('d') - 1; | |
308 | $endYear = ($renew) ? $currentYear + 2 : $currentYear + 1; | |
309 | $joinDate = date('Y-m-d', mktime(0, 0, 0, $currentMonth, date('d'), $currentYear)); | |
310 | $startDate = date('Y-m-d', mktime(0, 0, 0, $currentMonth, date('d'), $currentYear)); | |
311 | $endDate = date('Y-m-d', mktime(0, 0, 0, $currentMonth, $previousDay, $endYear)); | |
312 | $configVars = new CRM_Core_Config_Variables(); | |
313 | foreach (array( | |
314 | 'joinDate', 'startDate', 'endDate') as $date) { | |
315 | $$date = CRM_Utils_Date::customFormat($$date, $configVars->dateformatFull); | |
316 | } | |
317 | ||
318 | if (!$renew) { | |
42daf119 | 319 | |
6a488035 TO |
320 | $this->click('css=li#tab_member a'); |
321 | $this->waitForElementPresent('link=Add Membership'); | |
322 | ||
323 | $this->click('link=Add Membership'); | |
324 | $this->waitForElementPresent('_qf_Membership_cancel-bottom'); | |
325 | ||
326 | $this->select('price_set_id', "value={$sid}"); | |
327 | $this->waitForElementPresent('pricesetTotal'); | |
328 | ||
329 | $this->click("xpath=//div[@id='priceset']/div[2]/div[2]/div/span/input"); | |
330 | $this->click("xpath=//div[@id='priceset']/div[3]/div[2]/div[2]/span/input"); | |
331 | ||
332 | $this->type('source', 'Offline membership Sign Up Test Text'); | |
333 | $this->click('_qf_Membership_upload-bottom'); | |
334 | } | |
335 | else { | |
73072f84 | 336 | $this->click("xpath=//div[@id='memberships']/div//table/tbody//tr/td[text()='{$memTypeTitle1}']/../td[9]/span[2][text()='more']/ul/li/a[text()='Renew']"); |
6a488035 | 337 | $this->waitForElementPresent('_qf_MembershipRenewal_cancel-bottom'); |
9fd4062a | 338 | $this->waitForAjaxContent(); |
6a488035 TO |
339 | $this->click('_qf_MembershipRenewal_upload-bottom'); |
340 | ||
341 | $this->waitForElementPresent("xpath=//div[@id='memberships']//table/tbody/tr"); | |
73072f84 | 342 | $this->click("xpath=//div[@id='memberships']/div//table/tbody//tr/td[text()='{$memTypeTitle2}']/../td[9]/span[2][text()='more']/ul/li/a[text()='Renew']"); |
6a488035 | 343 | $this->waitForElementPresent('_qf_MembershipRenewal_cancel-bottom'); |
9fd4062a | 344 | $this->waitForAjaxContent(); |
6a488035 TO |
345 | $this->click('_qf_MembershipRenewal_upload-bottom'); |
346 | } | |
c880a737 | 347 | $this->waitForElementPresent("xpath=//div[@id='memberships']//table/tbody//tr/td[text()='{$memTypeTitle1}']/../td[9]/span/a[text()='View']"); |
9fd4062a | 348 | $this->waitForAjaxContent(); |
6a488035 | 349 | $this->click("xpath=//div[@id='memberships']//table/tbody//tr/td[text()='{$memTypeTitle1}']/../td[9]/span/a[text()='View']"); |
9fd4062a | 350 | $this->waitForElementPresent("xpath=//div[@class='ui-dialog-buttonset']/button[3]"); |
0ff7ff97 | 351 | |
6a488035 TO |
352 | //View Membership Record |
353 | $verifyData = array( | |
354 | 'Membership Type' => "{$memTypeTitle1}", | |
355 | 'Status' => 'New', | |
356 | 'Member Since' => $joinDate, | |
357 | 'Start date' => $startDate, | |
358 | 'End date' => $endDate, | |
359 | ); | |
0ff7ff97 | 360 | $this->webtestVerifyTabularData($verifyData); |
6a488035 | 361 | |
9fd4062a | 362 | $this->click("xpath=//div[@class='ui-dialog-buttonset']/button[3]/span[2]"); |
c880a737 | 363 | $this->waitForElementPresent("xpath=//div[@id='memberships']//table/tbody//tr/td[text()='{$memTypeTitle2}']/../td[9]/span/a[text()='View']"); |
6a488035 | 364 | $this->click("xpath=//div[@id='memberships']//table/tbody//tr/td[text()='{$memTypeTitle2}']/../td[9]/span/a[text()='View']"); |
9fd4062a | 365 | $this->waitForElementPresent("xpath=//div[@class='ui-dialog-buttonset']/button[3]"); |
6a488035 TO |
366 | |
367 | //View Membership Record | |
368 | $verifyData = array( | |
369 | 'Membership Type' => "{$memTypeTitle2}", | |
370 | 'Status' => 'New', | |
371 | 'Member Since' => $joinDate, | |
372 | 'Start date' => $startDate, | |
373 | 'End date' => $endDate, | |
374 | ); | |
0ff7ff97 PJ |
375 | $this->webtestVerifyTabularData($verifyData); |
376 | ||
9fd4062a | 377 | $this->click("xpath=//div[@class='ui-dialog-buttonset']/button[3]/span[2]"); |
6a488035 TO |
378 | $this->waitForElementPresent("xpath=//div[@id='memberships']//table/tbody/tr"); |
379 | } | |
380 | ||
4cbe18b8 | 381 | /** |
100fef9d CW |
382 | * @param int $sid |
383 | * @param array $contactParams | |
4cbe18b8 EM |
384 | * @param $memTypeTitle1 |
385 | * @param $term | |
386 | */ | |
00be9182 | 387 | public function _testMultilpeTermsMembershipRegistration($sid, $contactParams, $memTypeTitle1, $term){ |
6a488035 TO |
388 | //build the membership dates. |
389 | require_once 'CRM/Core/Config.php'; | |
390 | require_once 'CRM/Utils/Array.php'; | |
391 | require_once 'CRM/Utils/Date.php'; | |
392 | $currentYear = date('Y'); | |
393 | $currentMonth = date('m'); | |
394 | $previousDay = date('d') - 1; | |
395 | $endYear = ($term == 3) ? $currentYear + 3 : (($term == 2) ? $currentYear + 2 : $currentYear + 1); | |
396 | $joinDate = date('Y-m-d', mktime(0, 0, 0, $currentMonth, date('d'), $currentYear)); | |
397 | $startDate = date('Y-m-d', mktime(0, 0, 0, $currentMonth, date('d'), $currentYear)); | |
398 | $endDate = date('Y-m-d', mktime(0, 0, 0, $currentMonth, $previousDay, $endYear)); | |
399 | $configVars = new CRM_Core_Config_Variables(); | |
400 | foreach (array( | |
401 | 'joinDate', 'startDate', 'endDate') as $date) { | |
402 | $$date = CRM_Utils_Date::customFormat($$date, $configVars->dateformatFull); | |
403 | } | |
0ff7ff97 | 404 | |
6a488035 TO |
405 | $this->click('css=li#tab_member a'); |
406 | $this->waitForElementPresent('link=Add Membership'); | |
0ff7ff97 | 407 | |
6a488035 TO |
408 | $this->click('link=Add Membership'); |
409 | $this->waitForElementPresent('_qf_Membership_cancel-bottom'); | |
0ff7ff97 | 410 | |
6a488035 TO |
411 | $this->select('price_set_id', "value={$sid}"); |
412 | $this->waitForElementPresent('pricesetTotal'); | |
0ff7ff97 | 413 | |
6a488035 TO |
414 | $i = ($term == 3) ? 3 : (($term == 2) ? 2 : 1 ); |
415 | $this->waitForElementPresent("xpath=//div[@id='priceset']/div[2]/div[2]/div[$i]/span/input"); | |
416 | $this->click("xpath=//div[@id='priceset']/div[2]/div[2]/div[$i]/span/input"); | |
417 | $amount = $this->getText("xpath=//div[@id='priceset']/div[2]/div[2]/div[$i]/span/label/span[@class='crm-price-amount-amount']"); | |
0ff7ff97 | 418 | |
6a488035 | 419 | $this->type('source', 'Offline membership Sign Up Test Text'); |
565761e7 | 420 | $this->waitForElementPresent('recordContribution'); |
6a488035 | 421 | $this->click('_qf_Membership_upload-bottom'); |
0ff7ff97 | 422 | |
343688b7 RK |
423 | $this->waitForElementPresent("xpath=//table[@class='display dataTable no-footer']/tbody//tr/td[4][text()='{$endDate}']/../td[9]/span[1]/a[1]"); |
424 | $this->click("xpath=//table[@class='display dataTable no-footer']/tbody//tr/td[4][text()='{$endDate}']/../td[9]/span[1]/a[1]"); | |
425 | $this->waitForElementPresent("xpath=//div[@class='ui-dialog-buttonset']/button[3]/span[2]"); | |
6a488035 TO |
426 | //View Membership Record |
427 | $verifyData = array( | |
428 | 'Membership Type' => "$memTypeTitle1", | |
429 | 'Status' => 'New', | |
430 | 'Member Since' => $joinDate, | |
431 | 'Start date' => $startDate, | |
432 | 'End date' => $endDate, | |
433 | ); | |
0ff7ff97 PJ |
434 | $this->webtestVerifyTabularData($verifyData); |
435 | ||
6a488035 | 436 | //check if the membership amount is correct |
343688b7 RK |
437 | $this->waitForElementPresent("xpath=//form[@id='MembershipView']/div[2]/div/div[@class='crm-accordion-wrapper']/div/table/tbody/tr/td/span[text()='{$amount}']"); |
438 | $this->assertTrue($this->isElementPresent("xpath=//form[@id='MembershipView']/div[2]/div/div[@class='crm-accordion-wrapper']/div/table/tbody/tr/td/span[text()='{$amount}']")); | |
6a488035 | 439 | $this->click("_qf_MembershipView_cancel-bottom"); |
6a488035 | 440 | } |
42daf119 | 441 | } |