3 +--------------------------------------------------------------------+
4 | CiviCRM version 4.3 |
5 +--------------------------------------------------------------------+
6 | Copyright CiviCRM LLC (c) 2004-2013 |
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 +--------------------------------------------------------------------+
28 require_once 'CiviTest/CiviSeleniumTestCase.php';
29 class WebTest_Member_OnlineMembershipRenewTest
extends CiviSeleniumTestCase
{
31 protected function setUp() {
35 function testOnlineMembershipRenew() {
36 // a random 7-char string and an even number to make this pass unique
37 $hash = substr(sha1(rand()), 0, 7);
38 $rand = 2 * rand(2, 50);
40 // Log in using webtestLogin() method
41 $this->webtestLogin();
43 // We need a payment processor
44 $processorName = "Webtest Dummy" . substr(sha1(rand()), 0, 7);
45 $this->webtestAddPaymentProcessor($processorName);
47 $this->openCiviPage("admin/contribute/amount", "reset=1&action=update&id=2", "_qf_Amount_next");
48 // this contribution page for membership signup
49 // select newly created processor
50 $xpath = "xpath=//label[text() = '{$processorName}']/preceding-sibling::input[1]";
51 $this->assertTrue($this->isTextPresent($processorName));
55 $this->waitForElementPresent("_qf_Amount_next");
56 $this->click('_qf_Amount_next');
57 $this->waitForPageToLoad();
59 // go to Membership block
60 $this->click('css=#tab_membership a');
61 $this->waitForElementPresent("member_is_active");
62 $this->check("member_is_active");
64 $this->waitForElementPresent("new_title");
65 if ($this->isElementPresent("member_price_set_id")) {
66 $this->waitForElementPresent("member_price_set_id");
67 $this->select("member_price_set_id", "label=- none -");
70 $this->waitForElementPresent("membership_type-block");
71 $this->check("xpath=//tr[@id='membership_type-block']/td[2]/table/tbody/tr/td/label[text()='General']/../input[2]");
72 $this->check("xpath=//tr[@id='membership_type-block']/td[2]/table/tbody/tr/td/label[text()='Student']/../input[2]");
73 $this->click("_qf_MembershipBlock_next-bottom");
74 $this->waitForTextPresent("'MembershipBlock' information has been saved");
77 $this->click('css=#tab_custom a');
80 $this->waitForElementPresent('custom_pre_id');
81 $this->select('custom_pre_id', 'value=1');
84 $this->click('_qf_Custom_upload_done');
85 $this->waitForPageToLoad();
87 $firstName = 'Ma' . substr(sha1(rand()), 0, 4);
88 $lastName = 'An' . substr(sha1(rand()), 0, 7);
89 $email = $firstName . "@example.com";
92 $this->webtestLogout();
94 //Go to online membership signup page
95 $this->openCiviPage("contribute/transact", "reset=1&id=2", "_qf_Main_upload-bottom");
97 $this->click("xpath=//div[@class='crm-section membership_amount-section']/div[2]//span/label/span[2][contains(text(),'Student')]");
99 //Type first name and last name and email
100 $this->type("first_name", $firstName);
101 $this->type("last_name", $lastName);
102 $this->type("email-5", $email);
105 $this->select("credit_card_type", "value=Visa");
106 $this->select("credit_card_type", "label=Visa");
107 $this->type("credit_card_number", "4111111111111111");
108 $this->type("cvv2", "000");
109 $this->select("credit_card_exp_date[M]", "value=1");
110 $this->select("credit_card_exp_date[Y]", "value=2020");
113 $this->type("billing_first_name", $firstName . "billing");
114 $this->type("billing_last_name", $lastName . "billing");
115 $this->type("billing_street_address-5", "15 Main St.");
116 $this->type(" billing_city-5", "San Jose");
117 $this->select("billing_country_id-5", "value=1228");
118 $this->select("billing_state_province_id-5", "value=1004");
119 $this->type("billing_postal_code-5", "94129");
121 $this->click("_qf_Main_upload-bottom");
123 $this->waitForPageToLoad($this->getTimeoutMsec());
124 $this->waitForElementPresent("_qf_Confirm_next-bottom");
126 $this->click("_qf_Confirm_next-bottom");
127 $this->waitForPageToLoad($this->getTimeoutMsec());
129 // Log in using webtestLogin() method
130 $this->webtestLogin();
132 $this->openCiviPage("member/search", "reset=1", "member_end_date_high");
134 $this->type("sort_name", "$firstName $lastName");
135 $this->click("_qf_Search_refresh");
136 $this->waitForPageToLoad($this->getTimeoutMsec());
138 $this->waitForElementPresent('css=#memberSearch table tbody tr td span a.action-item-first');
139 $this->click('css=#memberSearch table tbody tr td span a.action-item-first');
140 $this->waitForElementPresent("_qf_MembershipView_cancel-bottom");
142 //View Membership Record
143 $verifyMembershipData = array(
144 'Member' => $firstName . ' ' . $lastName,
145 'Membership Type' => 'Student',
147 'Source' => 'Online Contribution: Member Signup and Renewal',
149 foreach ($verifyMembershipData as $label => $value) {
150 $this->verifyText("xpath=//form[@id='MembershipView']//table/tbody/tr/td[text()='{$label}']/following-sibling::td",
156 $this->webtestLogout();
158 $this->openCiviPage("contribute/transact", "reset=1&id=2", "_qf_Main_upload-bottom");
160 $this->click("xpath=//div[@class='crm-section membership_amount-section']/div[2]//span/label/span[2][contains(text(),'Student')]");
162 //Type first name and last name and email
163 $this->type("first_name", $firstName);
164 $this->type("last_name", $lastName);
165 $this->type("email-5", $email);
168 $this->select("credit_card_type", "value=Visa");
169 $this->select("credit_card_type", "label=Visa");
170 $this->type("credit_card_number", "4111111111111111");
171 $this->type("cvv2", "000");
172 $this->select("credit_card_exp_date[M]", "value=1");
173 $this->select("credit_card_exp_date[Y]", "value=2020");
176 $this->type("billing_first_name", $firstName . "billing");
177 $this->type("billing_last_name", $lastName . "billing");
178 $this->type("billing_street_address-5", "15 Main St.");
179 $this->type(" billing_city-5", "San Jose");
180 $this->select("billing_country_id-5", "value=1228");
181 $this->select("billing_state_province_id-5", "value=1004");
182 $this->type("billing_postal_code-5", "94129");
184 $this->click("_qf_Main_upload-bottom");
186 $this->waitForPageToLoad($this->getTimeoutMsec());
187 $this->waitForElementPresent("_qf_Confirm_next-bottom");
188 $this->click("_qf_Confirm_next-bottom");
189 $this->waitForPageToLoad($this->getTimeoutMsec());
191 $this->webtestLogin();
193 $this->openCiviPage("member/search", "reset=1", "member_end_date_high");
195 $this->type("sort_name", "$firstName $lastName");
196 $this->click("_qf_Search_refresh");
197 $this->waitForPageToLoad($this->getTimeoutMsec());
199 $this->waitForElementPresent('css=#memberSearch table tbody tr td span a.action-item-first');
200 $this->click('css=#memberSearch table tbody tr td span a.action-item-first');
201 $this->waitForElementPresent("_qf_MembershipView_cancel-bottom");
203 //View Membership Record
204 $verifyMembershipData = array(
205 'Member' => $firstName . ' ' . $lastName,
206 'Membership Type' => 'Student',
208 'Source' => 'Online Contribution: Member Signup and Renewal',
210 foreach ($verifyMembershipData as $label => $value) {
211 $this->verifyText("xpath=//form[@id='MembershipView']//table/tbody/tr/td[text()='{$label}']/following-sibling::td",
217 function testOnlineMembershipRenewChangeType() {
218 // a random 7-char string and an even number to make this pass unique
219 $hash = substr(sha1(rand()), 0, 7);
220 $rand = 2 * rand(2, 50);
222 // Log in using webtestLogin() method
223 $this->webtestLogin();
225 // We need a payment processor
226 $processorName = "Webtest Dummy" . substr(sha1(rand()), 0, 7);
227 $this->webtestAddPaymentProcessor($processorName);
229 $this->openCiviPage("admin/contribute/amount", "reset=1&action=update&id=2", '_qf_Amount_next');
231 //this contribution page for membership signup
232 $xpath = "xpath=//label[text() = '{$processorName}']/preceding-sibling::input[1]";
233 $this->assertTrue($this->isTextPresent($processorName));
234 $this->check($xpath);
237 $this->waitForElementPresent('_qf_Amount_next');
238 $this->click('_qf_Amount_next');
239 $this->waitForPageToLoad();
241 // go to Membership block
242 $this->click('css=#tab_membership a');
243 $this->waitForElementPresent("member_is_active");
244 $this->check("member_is_active");
246 $this->waitForElementPresent("new_title");
247 if ($this->isElementPresent("member_price_set_id")) {
248 $this->waitForElementPresent("member_price_set_id");
249 $this->select("member_price_set_id", "label=- none -");
252 $this->waitForElementPresent("membership_type-block");
253 $this->check("xpath=//tr[@id='membership_type-block']/td[2]/table/tbody/tr/td/label[text()='General']/../input[2]");
254 $this->check("xpath=//tr[@id='membership_type-block']/td[2]/table/tbody/tr/td/label[text()='Student']/../input[2]");
255 $this->click("_qf_MembershipBlock_next-bottom");
256 $this->waitForTextPresent("'MembershipBlock' information has been saved");
259 $this->click('css=#tab_custom a');
262 $this->waitForElementPresent('custom_pre_id');
263 $this->select('custom_pre_id', 'value=1');
266 $this->click('_qf_Custom_upload_done');
267 $this->waitForPageToLoad();
269 $firstName = 'Ma' . substr(sha1(rand()), 0, 4);
270 $lastName = 'An' . substr(sha1(rand()), 0, 7);
272 //Go to online membership signup page
273 $this->openCiviPage("contribute/transact", "reset=1&id=2", "_qf_Main_upload-bottom");
274 $this->click("xpath=//div[@class='crm-section membership_amount-section']/div[2]//span/label/span[2][contains(text(),'General')]");
275 //Type first name and last name
276 $this->type("first_name", $firstName);
277 $this->type("last_name", $lastName);
280 $this->select("credit_card_type", "value=Visa");
281 $this->select("credit_card_type", "label=Visa");
282 $this->type("credit_card_number", "4111111111111111");
283 $this->type("cvv2", "000");
284 $this->select("credit_card_exp_date[M]", "value=1");
285 $this->select("credit_card_exp_date[Y]", "value=2020");
288 $this->type("billing_first_name", $firstName . "billing");
289 $this->type("billing_last_name", $lastName . "billing");
290 $this->type("billing_street_address-5", "15 Main St.");
291 $this->type(" billing_city-5", "San Jose");
292 $this->select("billing_country_id-5", "value=1228");
293 $this->select("billing_state_province_id-5", "value=1004");
294 $this->type("billing_postal_code-5", "94129");
296 $this->click("_qf_Main_upload-bottom");
298 $this->waitForPageToLoad($this->getTimeoutMsec());
299 $this->waitForElementPresent("_qf_Confirm_next-bottom");
301 $this->click("_qf_Confirm_next-bottom");
302 $this->waitForPageToLoad($this->getTimeoutMsec());
305 $this->openCiviPage("member/search", "reset=1", "member_end_date_high");
307 $this->type("sort_name", "$firstName $lastName");
308 $this->click("_qf_Search_refresh");
309 $this->waitForPageToLoad($this->getTimeoutMsec());
311 $this->waitForElementPresent('css=#memberSearch table tbody tr td span a.action-item-first');
312 $this->click('css=#memberSearch table tbody tr td span a.action-item-first');
313 $this->waitForElementPresent("_qf_MembershipView_cancel-bottom");
316 preg_match('/id=([0-9]+)/', $this->getLocation(), $matches);
317 $membershipCreatedId = $matches[1];
319 $memberSince = date('F jS, Y');
321 //View Membership Record
322 $verifyMembershipData = array(
323 'Member' => $firstName . ' ' . $lastName,
324 'Membership Type' => 'General',
326 'Source' => 'Online Contribution: Member Signup and Renewal',
328 foreach ($verifyMembershipData as $label => $value) {
329 $this->verifyText("xpath=//form[@id='MembershipView']//table/tbody/tr/td[text()='{$label}']/following-sibling::td",
333 $this->openCiviPage("contribute/transact", "reset=1&id=2", "_qf_Main_upload-bottom");
334 $this->click("xpath=//div[@class='crm-section membership_amount-section']/div[2]//span/label/span[2][contains(text(),'Student')]");
337 $this->select("credit_card_type", "value=Visa");
338 $this->select("credit_card_type", "label=Visa");
339 $this->type("credit_card_number", "4111111111111111");
340 $this->type("cvv2", "000");
341 $this->select("credit_card_exp_date[M]", "value=1");
342 $this->select("credit_card_exp_date[Y]", "value=2020");
343 $this->click("_qf_Main_upload-bottom");
345 $this->waitForPageToLoad($this->getTimeoutMsec());
346 $this->waitForElementPresent("_qf_Confirm_next-bottom");
347 $this->click("_qf_Confirm_next-bottom");
348 $this->waitForPageToLoad($this->getTimeoutMsec());
351 $this->openCiviPage("member/search", "reset=1", "member_end_date_high");
353 $this->type("sort_name", "$firstName $lastName");
354 $this->click("_qf_Search_refresh");
355 $this->waitForPageToLoad($this->getTimeoutMsec());
357 $this->waitForElementPresent('css=#memberSearch table tbody tr td span a.action-item-first');
358 $this->click('css=#memberSearch table tbody tr td span a.action-item-first');
359 $this->waitForElementPresent("_qf_MembershipView_cancel-bottom");
362 preg_match('/id=([0-9]+)/', $this->getLocation(), $matches);
363 $membershipRenewedId = $matches[1];
365 //View Membership Record
366 $verifyMembershipData = array(
367 'Member' => $firstName . ' ' . $lastName,
368 'Membership Type' => 'Student',
370 'Source' => 'Online Contribution: Member Signup and Renewal',
371 'Member Since' => $memberSince,
373 foreach ($verifyMembershipData as $label => $value) {
374 $this->verifyText("xpath=//form[@id='MembershipView']//table/tbody/tr/td[text()='{$label}']/following-sibling::td",
378 $this->assertEquals($membershipCreatedId, $membershipRenewedId);
381 function testUpdateInheritedMembershipOnBehalfOfRenewal() {
383 $this->webtestLogin('admin');
385 $this->enableComponents('CiviMember');
387 //check for online contribution and profile listings permissions
388 $permissions = array("edit-1-make-online-contributions", "edit-1-profile-listings-and-forms");
389 $this->changePermissions($permissions);
391 // Log in as normal user
392 $this->webtestLogin();
394 $this->openCiviPage("contact/add", "reset=1&ct=Organization", '_qf_Contact_cancel');
396 $title = substr(sha1(rand()), 0, 7);
397 $this->type('organization_name', "Organization $title");
398 $this->type('email_1_email', "$title@org.com");
399 $this->click('_qf_Contact_upload_view');
400 $this->waitForPageToLoad($this->getTimeoutMsec());
402 $this->assertTrue($this->isTextPresent("Organization $title has been created."));
404 $this->openCiviPage("admin/member/membershipType", "reset=1&action=browse");
406 $this->click('link=Add Membership Type');
407 $this->waitForElementPresent('_qf_MembershipType_cancel-bottom');
409 $membershipTypeTitle = "Membership Type $title";
410 $this->type('name', "Membership Type $title");
412 $this->type('member_of_contact', $title);
413 $this->click('member_of_contact');
414 $this->waitForElementPresent("css=div.ac_results-inner li");
415 $this->click("css=div.ac_results-inner li");
417 $this->type('minimum_fee', '100');
418 $this->select( 'financial_type_id', 'value=2' );
419 $this->type('duration_interval', 1);
420 $this->select('duration_unit', 'label=year');
421 $this->select('period_type', 'label=rolling');
423 $this->removeSelection('relationship_type_id', 'label=- select -');
424 $this->addSelection('relationship_type_id', 'label=Employer of');
426 $this->click('_qf_MembershipType_upload-bottom');
427 $this->waitForElementPresent('link=Add Membership Type');
428 $this->assertTrue($this->isTextPresent("The membership type 'Membership Type $title' has been saved."));
430 $url = $this->getAttribute("xpath=//div[@id='membership_type']//div[@class='dataTables_wrapper']//table/tbody//tr/td[1][text()='{$membershipTypeTitle}']/../td[12]/span/a[3][text()='Delete']/@href");
433 preg_match('/id=([0-9]+)/', $url, $matches);
434 $membershipTypeId = $matches[1];
436 // We need a payment processor
437 $processorName = "Webtest Dummy" . substr(sha1(rand()), 0, 7);
439 // create contribution page with randomized title and default params
440 $hash = substr(sha1(rand()), 0, 7);
441 $rand = 2 * rand(2, 50);
442 $amountSection = FALSE;
447 $memberships = FALSE;
448 $memPriceSetId = NULL;
451 $profilePostId = NULL;
456 $contributionTitle = "Title $hash";
457 $pageId = $this->webtestAddContributionPage($hash,
460 array($processorName => 'Dummy'),
477 $hash = substr(sha1(rand()), 0, 7);
478 $this->openCiviPage("admin/contribute/settings", "reset=1&action=update&id=$pageId");
480 $this->click('link=Title');
481 $this->waitForElementPresent('_qf_Settings_cancel-bottom');
482 $this->click('is_organization');
483 $this->select('onbehalf_profile_id', "value=9");
484 $this->type('for_organization', "On behalf $hash");
485 $this->click('_qf_Settings_next-bottom');
486 $this->waitForPageToLoad($this->getTimeoutMsec());
488 $this->click('link=Memberships');
489 $this->waitForElementPresent('_qf_MembershipBlock_cancel-bottom');
490 $this->click('member_is_active');
491 $this->type('new_title', "Title - New Membership $hash");
492 $this->type('renewal_title', "Title - Renewals $hash");
493 $this->click("membership_type_{$membershipTypeId}");
494 $this->click('is_required');
495 $this->click('_qf_MembershipBlock_next-bottom');
496 $this->waitForPageToLoad($this->getTimeoutMsec());
499 $this->webtestLogout();
501 //get Url for Live Contribution Page
502 $this->openCiviPage("contribute/transact", "reset=1&id=$pageId", '_qf_Main_upload-bottom');
503 $this->click("xpath=//div[@class='crm-section membership_amount-section']/div[2]//span/label/span[2][contains(text(),'$membershipTypeTitle')]");
504 $firstName = 'Eia' . substr(sha1(rand()), 0, 4);
505 $lastName = 'Ande' . substr(sha1(rand()), 0, 4);
506 $name = $firstName . ' ' . $lastName;
507 $organisationName = 'TestOrg' . substr(sha1(rand()), 0, 7);
509 $email = $firstName . '@example.com';
510 $this->type('email-5', $email);
511 $this->click('is_for_organization');
512 $this->type('onbehalf_organization_name', $organisationName);
513 $this->type('onbehalf_phone-3-1', '2222-222222');
514 $this->type('onbehalf_email-3', $organisationName . '@example.com');
515 $this->type('onbehalf_street_address-3', '54A Excelsior Ave. Apt 1C');
516 $this->type('onbehalf_city-3', 'Driftwood');
517 $this->type('onbehalf_postal_code-3', '75653');
518 $this->select('onbehalf_country-3', "value=1228");
519 $this->select('onbehalf_state_province-3', "value=1061");
521 $this->type('first_name', $firstName);
522 $this->type('last_name', $lastName);
525 $this->select("credit_card_type", "value=Visa");
526 $this->select("credit_card_type", "label=Visa");
527 $this->type("credit_card_number", "4111111111111111");
528 $this->type("cvv2", "000");
529 $this->select("credit_card_exp_date[M]", "value=1");
530 $this->select("credit_card_exp_date[Y]", "value=2020");
533 $this->type("billing_first_name", $firstName . "billing");
534 $this->type("billing_last_name", $lastName . "billing");
535 $this->type("billing_street_address-5", "15 Main St.");
536 $this->type(" billing_city-5", "San Jose");
537 $this->select("billing_country_id-5", "value=1228");
538 $this->select("billing_state_province_id-5", "value=1004");
539 $this->type("billing_postal_code-5", "94129");
540 $this->click("_qf_Main_upload-bottom");
541 $this->waitForPageToLoad($this->getTimeoutMsec());
542 $this->waitForElementPresent("_qf_Confirm_next-bottom");
544 $this->click("_qf_Confirm_next-bottom");
545 $this->waitForPageToLoad($this->getTimeoutMsec());
548 // Log in using webtestLogin() method
549 $this->webtestLogin();
552 $endDate = date('F jS, Y', strtotime(" +1 year -1 day"));
553 $this->openCiviPage("member/search", "reset=1", "member_end_date_high");
555 $this->type("sort_name", "$organisationName");
556 $this->click("_qf_Search_refresh");
557 $this->waitForPageToLoad($this->getTimeoutMsec());
559 $this->waitForElementPresent('css=#memberSearch table tbody tr td span a.action-item-first');
560 $this->click('css=#memberSearch table tbody tr td span a.action-item-first');
561 $this->waitForElementPresent("_qf_MembershipView_cancel-bottom");
563 //View Membership Record
564 $verifyMembershipData = array(
565 'Member' => $organisationName,
566 'Membership Type' => $membershipTypeTitle,
568 'End date' => $endDate,
571 foreach ($verifyMembershipData as $label => $value) {
572 $this->verifyText("xpath=//form[@id='MembershipView']//table/tbody/tr/td[text()='{$label}']/following-sibling::td",
577 $this->openCiviPage("member/search", "reset=1", "member_end_date_high");
579 $this->type("sort_name", "$lastName, $firstName");
580 $this->click("_qf_Search_refresh");
581 $this->waitForPageToLoad($this->getTimeoutMsec());
583 $this->waitForElementPresent('css=#memberSearch table tbody tr td span a.action-item-first');
584 $this->click('css=#memberSearch table tbody tr td span a.action-item-first');
585 $this->waitForElementPresent("_qf_MembershipView_cancel-bottom");
587 //View Membership Record
588 $verifyMembershipData = array(
590 'Membership Type' => $membershipTypeTitle,
592 'End date' => $endDate,
595 foreach ($verifyMembershipData as $label => $value) {
596 $this->verifyText("xpath=//form[@id='MembershipView']//table/tbody/tr/td[text()='{$label}']/following-sibling::td",
602 $this->webtestLogout();
604 $this->openCiviPage("contribute/transact", "reset=1&id=$pageId");
606 $this->click("xpath=//div[@class='crm-section membership_amount-section']/div[2]//span/label/span[2][contains(text(),'$membershipTypeTitle')]");
607 $this->type("email-5", $email);
608 $this->click('is_for_organization');
609 $this->type('onbehalf_organization_name', $organisationName);
610 $this->type('onbehalf_phone-3-1', '2222-222222');
611 $this->type('onbehalf_email-3', $organisationName . '@example.com');
612 $this->type('onbehalf_street_address-3', '22A Excelsior Ave. Unit 1h');
613 $this->type('onbehalf_city-3', 'Driftwood');
614 $this->type('onbehalf_postal_code-3', '75653');
615 $this->select('onbehalf_country-3', "value=1228");
616 $this->select('onbehalf_state_province-3', "value=1061");
618 $this->type('first_name', $firstName);
619 $this->type('last_name', $lastName);
622 $this->select("credit_card_type", "value=Visa");
623 $this->select("credit_card_type", "label=Visa");
624 $this->type("credit_card_number", "4111111111111111");
625 $this->type("cvv2", "000");
626 $this->select("credit_card_exp_date[M]", "value=1");
627 $this->select("credit_card_exp_date[Y]", "value=2020");
630 $this->type("billing_first_name", $firstName . "billing");
631 $this->type("billing_last_name", $lastName . "billing");
632 $this->type("billing_street_address-5", "15 Main St.");
633 $this->type(" billing_city-5", "San Jose");
634 $this->select("billing_country_id-5", "value=1228");
635 $this->select("billing_state_province_id-5", "value=1004");
636 $this->type("billing_postal_code-5", "94129");
638 $this->click("_qf_Main_upload-bottom");
640 $this->waitForPageToLoad($this->getTimeoutMsec());
641 $this->waitForElementPresent("_qf_Confirm_next-bottom");
643 $this->click("_qf_Confirm_next-bottom");
644 $this->waitForPageToLoad($this->getTimeoutMsec());
646 // Log in using webtestLogin() method
647 $this->webtestLogin();
650 $endDate = date('F jS, Y', strtotime(" +2 year -1 day"));
651 $this->openCiviPage("member/search", "reset=1", "member_end_date_high");
653 $this->type("sort_name", "$organisationName");
654 $this->click("_qf_Search_refresh");
655 $this->waitForPageToLoad($this->getTimeoutMsec());
657 $this->waitForElementPresent('css=#memberSearch table tbody tr td span a.action-item-first');
658 $this->click('css=#memberSearch table tbody tr td span a.action-item-first');
659 $this->waitForElementPresent("_qf_MembershipView_cancel-bottom");
661 //View Membership Record
662 $verifyMembershipData = array(
663 'Member' => $organisationName,
664 'Membership Type' => $membershipTypeTitle,
665 'End date' => $endDate,
668 foreach ($verifyMembershipData as $label => $value) {
669 $this->verifyText("xpath=//form[@id='MembershipView']//table/tbody/tr/td[text()='{$label}']/following-sibling::td",
674 $this->openCiviPage("member/search", "reset=1", "member_end_date_high");
676 $this->type("sort_name", "$lastName, $firstName");
677 $this->click("_qf_Search_refresh");
678 $this->waitForPageToLoad($this->getTimeoutMsec());
680 $this->waitForElementPresent('css=#memberSearch table tbody tr td span a.action-item-first');
681 $this->click('css=#memberSearch table tbody tr td span a.action-item-first');
682 $this->waitForElementPresent("_qf_MembershipView_cancel-bottom");
684 //View Membership Record
685 $verifyMembershipData = array(
687 'Membership Type' => $membershipTypeTitle,
688 'End date' => $endDate,
691 foreach ($verifyMembershipData as $label => $value) {
692 $this->verifyText("xpath=//form[@id='MembershipView']//table/tbody/tr/td[text()='{$label}']/following-sibling::td",