Webtest fixes
[civicrm-core.git] / tests / phpunit / WebTest / Contact / SearchBuilderTest.php
CommitLineData
6a488035
TO
1<?php
2/*
3 +--------------------------------------------------------------------+
232624b1 4 | CiviCRM version 4.4 |
6a488035
TO
5 +--------------------------------------------------------------------+
6 | Copyright CiviCRM LLC (c) 2004-2013 |
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
TO
27require_once 'CiviTest/CiviSeleniumTestCase.php';
28class WebTest_Contact_SearchBuilderTest extends CiviSeleniumTestCase {
29
30 protected function setUp() {
31 parent::setUp();
32 }
33
6a488035 34 function testSearchBuilderOptions() {
6a488035
TO
35 $this->webtestLogin();
36
37 $groupName = $this->WebtestAddGroup();
38
39 // Open the search builder
40 $this->openCiviPage('contact/search/builder', 'reset=1');
41
42 $this->enterValues(1, 1, 'Contacts', 'Group(s)', NULL, '=', array($groupName));
43 $this->enterValues(1, 2, 'Contacts', 'Country', NULL, '=', array('United States'));
44 $this->enterValues(1, 3, 'Individual', 'Gender', NULL, '=', array('Male'));
45 $this->click('_qf_Builder_refresh');
46 $this->waitForPageToLoad();
47
48 // We should get no results. But check the options are all still set
49 $this->waitForTextPresent('No matches found');
50 foreach (array($groupName, 'United States', 'Male') as $i => $label) {
51 $this->waitForElementPresent("//span[@id='crm_search_value_1_$i']/select/option[2]");
52 $this->assertSelectedLabel("//span[@id='crm_search_value_1_$i']/select", $label);
53 }
54 }
55
56 function testSearchBuilderRLIKE() {
57 $this->webtestLogin();
58
59 // Adding contact
60 // We're using Quick Add block on the main page for this.
61 $firstName = substr(sha1(rand()), 0, 7);
62 $this->createDetailContact($firstName);
63
64 $sortName = "adv$firstName, $firstName";
65 $displayName = "$firstName adv$firstName";
66
67 $this->_searchBuilder("Postal Code", "100[0-9]", $sortName, "RLIKE");
68 }
69
70 // function to create contact with details (contact details, address, Constituent information ...)
71 function createDetailContact($firstName = NULL) {
72
73 if (!$firstName) {
74 $firstName = substr(sha1(rand()), 0, 7);
75 }
76
77 // create contact type Individual with subtype
78 // with most of values to required to search
79 $Subtype = "Student";
80 $this->openCiviPage('contact/add', array('reset' => 1, 'ct' => 'Individual'), '_qf_Contact_cancel');
81
82 // --- fill few values in Contact Detail block
83 $this->type("first_name", "$firstName");
84 $this->type("middle_name", "mid$firstName");
85 $this->type("last_name", "adv$firstName");
e6e201a5 86 $this->select("contact_sub_type", "label=$Subtype");
6a488035
TO
87 $this->type("email_1_email", "$firstName@advsearch.co.in");
88 $this->type("phone_1_phone", "123456789");
89 $this->type("external_identifier", "extid$firstName");
90
91 // --- fill few values in address
92 $this->click("//form[@id='Contact']/div[2]/div[4]/div[1]");
93 $this->waitForElementPresent("address_1_geo_code_2");
94 $this->type("address_1_street_address", "street 1 $firstName");
95 $this->type("address_1_supplemental_address_1", "street supplement 1 $firstName");
96 $this->type("address_1_supplemental_address_2", "street supplement 2 $firstName");
97 $this->type("address_1_city", "city$firstName");
98 $this->type("address_1_postal_code", "100100");
99 $this->select("address_1_country_id", "United States");
100 $this->select("address_1_state_province_id", "Alaska");
101
102 // save contact
103 $this->click("_qf_Contact_upload_view");
104 $this->waitForPageToLoad($this->getTimeoutMsec());
105 $this->assertTrue($this->isTextPresent("$firstName adv$firstName"));
106 }
107
13c415cc 108 function testSearchBuilderContacts() {
6a488035
TO
109 $this->webtestLogin();
110
111 //Individual
112 $firstName = substr(sha1(rand()), 0, 7);
113 $streetName = "street $firstName";
114 $sortName = "adv$firstName, $firstName";
115 $this->_createContact('Individual', $firstName, "$firstName@advsearch.co.in", $streetName);
116 // search using search builder and advanced search
117 $this->_searchBuilder('Street Address', $streetName, $sortName, '=', '1');
118 $this->_advancedSearch($streetName, $sortName, 'Individual', '1', 'street_address');
119
120 //Organization
13c415cc 121 $orgName = substr(sha1(rand()), 0, 7) . "org";
122 $orgEmail = "ab" . rand() . "@{$orgName}.com";
123 $this->_createContact('Organization', $orgName, $orgEmail, "street $orgName");
6a488035 124 // search using search builder and advanced search
13c415cc 125 $this->_searchBuilder('Email', $orgEmail, $orgName, '=', '1');
126 $this->_advancedSearch($orgEmail, $orgName, 'Organization', '1', 'email');
6a488035
TO
127
128 //Household
13c415cc 129 $householdName = "household" . substr(sha1(rand()), 0, 7);
130 $householdEmail = "h1" . rand() . "@{$householdName}.com";
131 $this->_createContact('Household', $householdName, $householdEmail, "street $householdName");
6a488035 132 // search using search builder and advanced search
13c415cc 133 $this->_searchBuilder('Email', $householdEmail, $householdName, '=', '1');
134 $this->_advancedSearch($householdEmail, $householdName, 'Household', '1', 'email');
6a488035 135
289c8051 136 $this->openCiviPage("contact/add", "reset=1&ct=Individual");
6a488035
TO
137
138 // searching contacts whose email is not set
13c415cc 139 $firstName1 = "00a1" . substr(sha1(rand()), 0, 7);
6a488035
TO
140 $this->type("first_name", $firstName1);
141 $this->type("last_name", "01adv$firstName1");
142 // save contact
143 $this->click("_qf_Contact_upload_view");
144 $this->waitForPageToLoad($this->getTimeoutMsec());
289c8051 145 $this->openCiviPage("contact/add", "reset=1&ct=Individual");
6a488035 146
13c415cc 147 $firstName2 = "00a2" . substr(sha1(rand()), 0, 7);
6a488035
TO
148 $this->type("first_name", $firstName2);
149 $this->type("last_name", "02adv$firstName2");
150 // save contact
151 $this->click("_qf_Contact_upload_view");
152 $this->waitForPageToLoad($this->getTimeoutMsec());
289c8051 153 $this->openCiviPage("contact/add", "reset=1&ct=Individual");
6a488035 154
13c415cc 155 $firstName3 = "00a3" . substr(sha1(rand()), 0, 7);
6a488035
TO
156 $this->type("first_name", $firstName3);
157 $this->type("last_name", "03adv$firstName3");
158 // save contact
159 $this->click("_qf_Contact_upload_view");
160 $this->waitForPageToLoad($this->getTimeoutMsec());
13c415cc 161 $this->_searchBuilder('Email', NULL, NULL, 'IS NULL');
6a488035
TO
162 $this->click("xpath=//div[@class='crm-search-results']/div[4]/a[2]");
163 $this->waitForPageToLoad($this->getTimeoutMsec());
13c415cc 164 $names = array(
165 1 => $firstName1,
166 2 => $firstName2,
167 3 => $firstName3,
168 );
169 foreach ($names as $key => $value) {
6a488035
TO
170 $this->assertTrue($this->isTextPresent($value));
171 }
172 //searching contacts whose phone field is empty
13c415cc 173 $this->_searchBuilder('Phone', NULL, NULL, 'IS EMPTY');
174 foreach ($names as $key => $value) {
6a488035
TO
175 $this->assertTrue($this->isTextPresent($value));
176 }
177 //searching contacts whose phone field is not empty
13c415cc 178 $this->_searchBuilder('Phone', NULL, $firstName, 'IS NOT EMPTY');
6a488035
TO
179 $this->click("xpath=//div[@class='crm-search-results']/div[4]/a[2]");
180 $this->waitForPageToLoad($this->getTimeoutMsec());
181 $this->assertTrue($this->isTextPresent($firstName));
182
13c415cc 183 $firstName4 = "AB" . substr(sha1(rand()), 0, 7);
6a488035 184 $postalCode = rand();
13c415cc 185 $this->_createContact('Individual', $firstName4, "$firstName4@advsearch.co.in", NULL, $postalCode);
186 $firstName5 = "CD" . substr(sha1(rand()), 0, 7);
187 $this->_createContact('Individual', $firstName5, "$firstName5@advsearch.co.in", NULL, $postalCode);
188 $firstName6 = "EF" . substr(sha1(rand()), 0, 7);
189 $this->_createContact('Organization', $firstName6, "$firstName6@advsearch.co.in", NULL, $postalCode);
190 $firstName7 = "GH" . substr(sha1(rand()), 0, 7);
191 $this->_createContact('Household', $firstName7, "$firstName7@advsearch.co.in", NULL, $postalCode);
6a488035
TO
192
193 // check if the resultset of search builder and advanced search match for the postal code
13c415cc 194 $this->_searchBuilder('Postal Code', $postalCode, NULL, 'LIKE', '4');
195 $this->_advancedSearch($postalCode, NULL, NULL, '4', 'postal_code');
6a488035 196
13c415cc 197 $firstName8 = "abcc" . substr(sha1(rand()), 0, 7);
198 $this->_createContact('Individual', $firstName8, "$firstName8@advsearch.co.in", NULL);
6a488035
TO
199 $this->_searchBuilder('Note(s): Body and Subject', "this is notes by $firstName8", $firstName8, 'LIKE');
200 $this->_searchBuilder('Note(s): Subject only', "this is subject by $firstName8", $firstName8, 'LIKE');
201 $this->_searchBuilder('Note(s): Body only', "this is notes by $firstName8", $firstName8, 'LIKE');
13c415cc 202 $this->_advancedSearch("this is notes by $firstName8", $firstName8, NULL, NULL, 'note_body', 'notes');
203 $this->_advancedSearch("this is subject by $firstName8", $firstName8, NULL, NULL, 'note_subject', 'notes');
204 $this->_advancedSearch("this is notes by $firstName8", $firstName8, NULL, NULL, 'note_both', 'notes');
4121e1c2 205 $this->_advancedSearch("this is notes by $firstName8", $firstName8, NULL, NULL, 'note_both', 'notes');
6a488035
TO
206 }
207
208 function _searchBuilder($field, $fieldValue = NULL, $name = NULL, $op = '=', $count = NULL) {
209 // search builder using contacts(not using contactType)
289c8051 210 $this->openCiviPage("contact/search/builder", "reset=1");
6a488035
TO
211 $this->enterValues(1, 1, 'Contacts', $field, NULL, $op, "$fieldValue");
212 $this->click("id=_qf_Builder_refresh");
213 $this->waitForPageToLoad($this->getTimeoutMsec());
214 if (($op == '=' || $op == 'LIKE') && $fieldValue) {
215 $this->assertElementContainsText('css=.crm-search-results > table.row-highlight', "$fieldValue");
216 }
217 if ($name) {
218 $this->assertElementContainsText('css=.crm-search-results > table.row-highlight', "$name");
219 }
220 if ($count) {
221 $this->assertElementContainsText('search-status', "$count Contact");
222 }
223 }
224
225 /**
226 * Enter form values in a Search Builder row
227 */
228 function enterValues($set, $row, $entity, $field, $loc, $op, $value = '') {
229 if ($set > 1 && $row == 1) {
230 $this->click('addBlock');
231 }
232 if ($row > 1) {
233 $this->click("addMore_{$set}");
234 }
235 // In the DOM rows are 0 indexed and sets are 1 indexed, so normalizing
236 $row--;
237
238 $this->waitForElementPresent("mapper_{$set}_{$row}_0");
239 $this->select("mapper_{$set}_{$row}_0", "label=$entity");
240 $this->select("mapper_{$set}_{$row}_1", "label=$field");
241 if ($loc) {
242 $this->select("mapper_{$set}_{$row}_2", "label=$loc");
243 }
de02cccc 244 $this->select("operator_{$set}_{$row}", "value=$op");
6a488035
TO
245 if (is_array($value)) {
246 $this->waitForElementPresent("css=#crm_search_value_{$set}_{$row} select option + option");
247 foreach ($value as $val) {
289c8051 248 if ($op != 'IN') {
76e86fd8
CW
249 $select = 'select';
250
289c8051
PN
251 }
252 else {
76e86fd8
CW
253 $select = 'addSelection';
254
289c8051
PN
255 }
256 $this->$select("css=#crm_search_value_{$set}_{$row} select", "label=$val");
6a488035
TO
257 }
258 }
259 elseif ($value && substr($value, 0, 5) == 'date:') {
260 $this->webtestFillDate("value_{$set}_{$row}", trim(substr($value, 5)));
261 }
262 elseif ($value) {
263 $this->type("value_{$set}_{$row}", $value);
264 }
265 }
266
13c415cc 267 function _advancedSearch($fieldValue = NULL, $name = NULL, $contactType = NULL, $count = NULL, $field) {
6a488035 268 //advanced search by selecting the contactType
289c8051 269 $this->openCiviPage("contact/search/advanced", "reset=1");
13c415cc 270 if (isset($contactType)) {
c1d1bf14 271 $this->select("id=contact_type", "value=$contactType");
6a488035
TO
272 }
273 if (substr($field, 0, 5) == 'note_') {
274 $this->click("notes");
275 $this->waitForElementPresent("xpath=//div[@id='notes-search']/table/tbody/tr/td[2]/input[3]");
276 if ($field == 'note_body') {
277 $this->click("CIVICRM_QFID_2_note_option");
278 }
279 elseif ($field == 'note_subject') {
280 $this->click("CIVICRM_QFID_3_note_option");
281 }
282 else {
283 $this->click("CIVICRM_QFID_6_note_option");
284 }
13c415cc 285 $this->type("note", $fieldValue);
6a488035
TO
286 }
287 else {
288 $this->click("location");
289 $this->waitForElementPresent("xpath=//div[@id='location']/table/tbody/tr[2]/td/table/tbody/tr[4]/td[2]/select");
290 if ($contactType == 'Individual') {
13c415cc 291 $this->type("$field", $fieldValue);
6a488035
TO
292 }
293 else {
13c415cc 294 $this->type("$field", $fieldValue);
6a488035
TO
295 }
296 }
297 $this->click("_qf_Advanced_refresh");
298 $this->waitForPageToLoad($this->getTimeoutMsec());
299
300 //the search result should be same as the one that we got in search builder
301 if ($fieldValue) {
302 $this->assertElementContainsText('Advanced', "$fieldValue");
303 }
304 if ($name) {
305 $this->assertElementContainsText('css=.crm-search-results > table.row-highlight', "$name");
306 }
307 if ($count) {
308 $this->assertElementContainsText('search-status', "$count Contact");
309 }
310 }
311
13c415cc 312 function _createContact($contactType, $name, $email, $streetName = NULL, $postalCode = NULL) {
6a488035
TO
313 $this->openCiviPage('contact/add', array('reset' => 1, 'ct' => $contactType), '_qf_Contact_cancel');
314
13c415cc 315 if ($contactType == 'Individual') {
6a488035
TO
316 $this->type("first_name", "$name");
317 $this->type("last_name", "adv$name");
318 $name = "$name adv$name";
13c415cc 319 }
320 elseif ($contactType == 'Organization') {
321 $this->type("organization_name", $name);
322 }
323 else {
324 $this->type("household_name", $name);
6a488035
TO
325 }
326 $this->click("//form[@id='Contact']/div[2]/div[4]/div[1]");
327 $this->waitForElementPresent("address_1_geo_code_2");
13c415cc 328 $this->type("email_1_email", $email);
329 $this->type("phone_1_phone", "9876543210");
6a488035
TO
330 $this->type("address_1_street_address", $streetName);
331 $this->select("address_1_country_id", "United States");
332 $this->select("address_1_state_province_id", "Alaska");
13c415cc 333 $this->type("address_1_postal_code", $postalCode);
6a488035
TO
334
335 $this->click("//form[@id='Contact']/div[2]/div[6]/div[1]");
336 $this->waitForElementPresent("note");
337 $this->type("subject", "this is subject by $name");
338 $this->type("note", "this is notes by $name");
339
340 // save contact
341 $this->click("_qf_Contact_upload_view");
342 $this->waitForPageToLoad($this->getTimeoutMsec());
343 $this->assertTrue($this->isTextPresent("$name has been created."));
344 }
289c8051
PN
345
346 /*
347 * Webtest for CRM-12148
348 *
349 */
350 function testSearchBuilderfinancialType() {
351 // Logging in. Remember to wait for page to load. In most cases,
352 // you can rely on 30000 as the value that allows your test to pass, however,
353 // sometimes your test might fail because of this. In such cases, it's better to pick one element
354 // somewhere at the end of page and use waitForElementPresent on it - this assures you, that whole
355 // page contents loaded and you can continue your test execution.
356 $this->webtestLogin();
76e86fd8 357
289c8051
PN
358 // add financial type
359 $financialTypeName1 = 'Financial Type' . substr(sha1(rand()), 0, 5);;
360 $financialTypeName2 = 'Financial Type' . substr(sha1(rand()), 0, 5);;
361 $financialType = array(
362 'name' => $financialTypeName1,
363 'is_reserved' => FALSE,
364 'is_deductible' => FALSE,
365 );
366 $this->addeditFinancialType($financialType);
289c8051
PN
367 $financialType['name'] = $financialTypeName2;
368 $this->addeditFinancialType($financialType);
289c8051
PN
369 //create 6 contribution
370 $this->openCiviPage("contribute/add", "reset=1&action=add&context=standalone", "_qf_Contribution_upload");
371 for ($i = 1; $i <= 6; $i++) {
372 if ($i % 2 == 0) {
373 $financialType = $financialTypeName1;
374 }
375 else {
376 $financialType = $financialTypeName2;
377 }
378 // create new contact using dialog
379 $firstName = substr(sha1(rand()), 0, 7);
380 $this->webtestNewDialogContact($firstName, 'Contributor', $firstName . '@example.com');
381 $this->select('financial_type_id', $financialType);
382 $this->type('total_amount', 100 * $i);
225a8648 383 $this->clickLink('_qf_Contribution_upload_new', '_qf_Contribution_upload_new');
289c8051
PN
384 }
385 $this->openCiviPage("contact/search/builder", "reset=1", "_qf_Builder_refresh");
76e86fd8 386
289c8051
PN
387 $this->enterValues(1, 1, 'Contribution', 'Financial Type', NULL, '=', array($financialTypeName1));
388 $this->click('_qf_Builder_refresh');
389 $this->waitForPageToLoad($this->getTimeoutMsec());
76e86fd8 390
289c8051 391 $this->assertTrue($this->isTextPresent('3 Contacts'), 'Missing text: ' . '3 Contacts');
76e86fd8 392
289c8051
PN
393 $this->click("xpath=//div[@class='crm-accordion-header crm-master-accordion-header']");
394 $this->enterValues(1, 1, 'Contribution', 'Financial Type', NULL, '=', array($financialTypeName2));
395 $this->click('_qf_Builder_refresh');
396 $this->waitForPageToLoad($this->getTimeoutMsec());
397 $this->assertTrue($this->isTextPresent('3 Contacts'), 'Missing text: ' . '3 Contacts');
76e86fd8 398
289c8051 399 $this->click("xpath=//div[@class='crm-accordion-header crm-master-accordion-header']");
13c415cc 400 $this->enterValues(1, 1, 'Contribution', 'Financial Type', NULL, 'IN', array(
401 $financialTypeName1,
402 $financialTypeName2
403 ));
289c8051
PN
404 $this->click('_qf_Builder_refresh');
405 $this->waitForPageToLoad($this->getTimeoutMsec());
406 $this->assertTrue($this->isTextPresent('6 Contacts'), 'Missing text: ' . '6 Contacts');
407 }
3c53f77e
DL
408
409 /*
410 * Webtest for CRM-12588
411 *
412 */
413 function testSearchBuilderMembershipType() {
414 $this->webtestLogin();
415
416 // create first contact
417 $firstName1 = substr(sha1(rand()), 0, 7);
418 $this->webtestAddContact($firstName1, "Memberson", "Memberson{$firstName1}@memberson.name");
419 $contactName1 = "Memberson, $firstName1";
420
421 // create Second contact
422 $firstName2 = substr(sha1(rand()), 0, 7);
423 $this->webtestAddContact($firstName2, "Memberson", "Memberson{$firstName2}@memberson.name");
424 $contactName2 = "Memberson, $firstName2";
425
426 // add membership type
427 $membershipTypes = $this->webtestAddMembershipType();
428
429 // now add membership
430 $this->openCiviPage("member/add", "reset=1&action=add&context=standalone", "_qf_Membership_upload");
431
432 // select contact
433 $this->webtestFillAutocomplete($firstName1);
434
435 // fill in Membership Organization
436 $this->select("membership_type_id[0]", "label={$membershipTypes['member_of_contact']}");
437
438 // select membership type
439 $this->select("membership_type_id[1]", "label={$membershipTypes['membership_type']}");
440
441 // fill in Source
442 $this->type("source", "Membership StandaloneAddTest Webtest");
443
444 // fill in Start Date
445 $this->webtestFillDate('start_date');
446
447 // Clicking save.
448 $this->clickLink("_qf_Membership_upload");
449
450 // page was loaded
451 $this->waitForTextPresent("Membership StandaloneAddTest Webtest");
452
453 // now add membership for second contact
454 $this->openCiviPage("member/add", "reset=1&action=add&context=standalone", "_qf_Membership_upload");
455 $this->webtestFillAutocomplete($firstName2);
456 $this->select("membership_type_id[0]", "label={$membershipTypes['member_of_contact']}");
457 $this->select("membership_type_id[1]", "label={$membershipTypes['membership_type']}");
458 $this->type("source", "Membership StandaloneAddTest Webtest");
459 $this->webtestFillDate('start_date');
460
461 // fill in Status Override?
462 $this->click("is_override");
463 $this->waitForElementPresent("status_id");
464 $this->select("status_id", "label=Grace");
465
466 // Clicking save.
467 $this->clickLink("_qf_Membership_upload");
468 $this->waitForTextPresent("Membership StandaloneAddTest Webtest");
469
470 // Open the search builder
471 $this->openCiviPage('contact/search/builder', 'reset=1');
472 $this->enterValues(1, 1, 'Membership', 'Membership Type', NULL, '=', array($membershipTypes['membership_type']));
473
474 $this->clickLink('_qf_Builder_refresh');
475 $this->waitForText('search-status', "2 Contacts");
476
477 $this->click("xpath=//div[@class='crm-accordion-header crm-master-accordion-header']");
478 $this->enterValues(1, 2, 'Membership', 'Membership Status', NULL, '=', array('New'));
479 $this->clickLink('_qf_Builder_refresh');
480 $this->waitForText('search-status', "1 Contact");
481
02667514 482 $this->enterValues(1, 2, 'Membership', 'Membership Status', NULL, '=', array('Grace'));
3c53f77e
DL
483 $this->clickLink('_qf_Builder_refresh');
484 $this->waitForText('search-status', "1 Contact");
485
486 $this->click("xpath=//div[@class='crm-accordion-header crm-master-accordion-header']");
487 $this->click("xpath=//div[@id='map-field']/div[1]/table/tbody/tr[2]/td/a");
13c415cc 488 $this->enterValues(1, 2, 'Membership', 'Membership Status', NULL, 'IN', array('New', 'Grace'));
3c53f77e
DL
489 $this->clickLink('_qf_Builder_refresh');
490 $this->waitForText('search-status', "2 Contacts");
491
492 $this->click("xpath=//div[@class='crm-accordion-header crm-master-accordion-header']");
493 $this->click("xpath=//div[@id='map-field']/div[1]/table/tbody/tr[2]/td/a");
13c415cc 494 $this->enterValues(1, 2, 'Membership', 'Membership Status', NULL, 'IN', array('Current', 'Expired'));
3c53f77e
DL
495 $this->clickLink('_qf_Builder_refresh');
496 $this->waitForText("xpath=//form[@id='Builder']/div[3]/div/div", "No matches found for");
497
498 // Find Membership
499 $this->openCiviPage("member/search", "reset=1", "_qf_Search_refresh");
500 $this->click("xpath=//label[text()='{$membershipTypes['membership_type']}']");
501 $this->clickLink('_qf_Search_refresh');
502 $this->waitForText('search-status', "2 Results");
503
504 $this->click("xpath=//div[@class='crm-accordion-header crm-master-accordion-header']");
505 $this->click("xpath=//label[text()='New']");
506 $this->click("xpath=//label[text()='Grace']");
507 $this->clickLink('_qf_Search_refresh');
508 $this->waitForText('search-status', "2 Results");
509
510 $this->click("xpath=//div[@class='crm-accordion-header crm-master-accordion-header']");
511 $this->click("xpath=//label[text()='New']");
512 $this->clickLink('_qf_Search_refresh');
513 $this->waitForText('search-status', "1 Result");
514 }
515
6a488035 516}