X-Git-Url: https://vcs.fsf.org/?a=blobdiff_plain;f=tests%2Fphpunit%2FWebTest%2FContact%2FAdvancedSearchTest.php;h=3a470752fe1f3becc0385cad90222324589521b8;hb=c6e262c51134924a9cc023dcb0613238fd1d0451;hp=083bbe5de626b2fded129cf1e678f3f4ac0323c1;hpb=95ca1e4e775ce88e3f371abe8390a3526ba537e7;p=civicrm-core.git diff --git a/tests/phpunit/WebTest/Contact/AdvancedSearchTest.php b/tests/phpunit/WebTest/Contact/AdvancedSearchTest.php index 083bbe5de6..3a470752fe 100644 --- a/tests/phpunit/WebTest/Contact/AdvancedSearchTest.php +++ b/tests/phpunit/WebTest/Contact/AdvancedSearchTest.php @@ -1,7 +1,7 @@ webtestLogin(); $this->waitForPageToLoad($this->getTimeoutMsec()); @@ -107,6 +107,7 @@ class WebTest_Contact_AdvancedSearchTest extends CiviSeleniumTestCase { $this->select2("relationship_type_id", "Employee of"); $this->waitForElementPresent("xpath=//input[@id='related_contact_id'][@placeholder='- select organization -']"); $this->select2("related_contact_id", "Default", TRUE); + $this->waitForAjaxContent(); $this->webtestFillDate("start_date", "-1 day"); $this->webtestFillDate("end_date", "+1 day"); $this->clickAjaxLink('_qf_Relationship_upload-bottom', NULL); @@ -130,7 +131,10 @@ class WebTest_Contact_AdvancedSearchTest extends CiviSeleniumTestCase { 'CiviEvent' => array('participant_fee_amount_high', 'addParticipantSearchDetail'), 'CiviMember' => array('member_end_date_high', 'addMemberSearchDetail'), 'CiviPledge' => array('pledge_frequency_interval', 'addPledgeSearchDetail'), - 'relationship' => array("xpath=//div[@id='relationship']/table/tbody/tr//td/label[text()='Relationship Status']/../label[text()='All']", ''), + 'relationship' => array( + "xpath=//div[@id='relationship']/table/tbody/tr//td/label[text()='Relationship Status']/../label[text()='All']", + '' + ), ); foreach ($searchBlockValues as $block => $blockValues) { @@ -170,7 +174,7 @@ class WebTest_Contact_AdvancedSearchTest extends CiviSeleniumTestCase { /* * Check for CRM-9873 */ - function testActivitySearchByTypeTest() { + public function testActivitySearchByTypeTest() { $this->webtestLogin(); $this->openCiviPage('contact/search/advanced', 'reset=1'); $this->clickAjaxLink("activity", 'activity_subject'); @@ -186,7 +190,7 @@ class WebTest_Contact_AdvancedSearchTest extends CiviSeleniumTestCase { $cal = $count / $perPageRow; $mod = $count % $perPageRow; $j = 1; - for ($i=1; $i<=$cal; $i++) { + for ($i = 1; $i <= $cal; $i++) { $subTotal = $i * $perPageRow; $lastPageSub = $subTotal + 1; @@ -214,9 +218,10 @@ class WebTest_Contact_AdvancedSearchTest extends CiviSeleniumTestCase { /** * @param string $firstName */ - function submitSearch($firstName) { + public function submitSearch($firstName) { $this->clickLink("_qf_Advanced_refresh"); // verify unique name + $this->waitForAjaxContent(); $this->waitForText("xpath=//div[@class='crm-search-results']/table/tbody", preg_quote("adv$firstName, $firstName")); // should give 1 result only as we are searching with unique name $this->waitForText("xpath=//div[@id='search-status']/table/tbody/tr/td", preg_quote("1 Contact")); @@ -227,20 +232,28 @@ class WebTest_Contact_AdvancedSearchTest extends CiviSeleniumTestCase { /* * Check for CRM-14952 */ - function testStateSorting() { + public function testStateSorting() { $this->webtestLogin(); $this->openCiviPage('contact/search/advanced', 'reset=1', 'group'); $this->select2("group", "Newsletter", TRUE); $this->select2("group", "Summer", TRUE); $this->select2("group", "Advisory", TRUE); $this->clickAjaxLink("location", 'country'); - $this->select2("country", "United States", False); + $this->select2("country", "United States", FALSE); $this->waitForElementPresent('state_province'); - $this->multiselect2("state_province", array("Ohio", "New York", "New Mexico", "Connecticut", "Georgia", "New Jersey", "Texas")); + $this->multiselect2("state_province", array( + "Ohio", + "New York", + "New Mexico", + "Connecticut", + "Georgia", + "New Jersey", + "Texas" + )); $this->clickLink("_qf_Advanced_refresh", "xpath=//div[@class='crm-search-results']//table/tbody/tr[1]/td[6]"); $stateBeforeSort = $this->getText("xpath=//div[@class='crm-search-results']//table/tbody/tr[1]/td[6]"); - $this->click("xpath=//div[@class='crm-search-results']//table/thead/tr//th/a[contains(text(),'State')]"); + $this->clickAjaxLink("xpath=//div[@class='crm-search-results']//table/thead/tr//th/a[contains(text(),'State')]"); $this->waitForElementPresent("xpath=//div[@class='crm-search-results']//table/thead/tr//th/a[contains(text(),'State')]"); $this->assertElementNotContainsText("xpath=//div[@class='crm-search-results']//table/tbody/tr[1]/td[6]", $stateBeforeSort); } @@ -251,7 +264,7 @@ class WebTest_Contact_AdvancedSearchTest extends CiviSeleniumTestCase { * @param string $groupName * @param $tagName */ - function addBasicSearchDetail($firstName, $groupName, $tagName) { + public function addBasicSearchDetail($firstName, $groupName, $tagName) { // fill partial sort name $this->type("sort_name", "$firstName"); // select subtype @@ -276,7 +289,7 @@ class WebTest_Contact_AdvancedSearchTest extends CiviSeleniumTestCase { /** * @param $firstName */ - function addAddressSearchDetail($firstName) { + public function addAddressSearchDetail($firstName) { // select location type (home and main) $this->multiselect2('location_type', array('Home', 'Main')); // fill street address @@ -297,14 +310,14 @@ class WebTest_Contact_AdvancedSearchTest extends CiviSeleniumTestCase { /** * @param $firstName */ - function addActivitySearchDetail($firstName) { + public function addActivitySearchDetail($firstName) { // check activity types $checkActivityTypes = array("Contribution", "Event Registration", "Membership Signup"); foreach ($checkActivityTypes as $labels) { $this->click("xpath=//div[@id='activity']/table/tbody/tr[2]/td[1]/div[1]//div/label[text()=\"$labels\"]"); } // fill date range - $this->select("activity_date_relative","value=0"); + $this->select("activity_date_relative", "value=0"); $this->webtestFillDate("activity_date_low", "-1 day"); $this->webtestFillDate("activity_date_high", "+1 day"); $this->type("activity_subject", "Student - membership source$firstName - Status: New"); @@ -315,14 +328,14 @@ class WebTest_Contact_AdvancedSearchTest extends CiviSeleniumTestCase { } // function to fill demographic search details - function addDemographicSearchDetail() { + public function addDemographicSearchDetail() { // fill birth date range - $this->select("birth_date_relative","value=0"); + $this->select("birth_date_relative", "value=0"); $this->webtestFillDate("birth_date_low", "-3 year"); $this->webtestFillDate("birth_date_high", "now"); // fill deceased date range $this->click("xpath=//div[@id='demographics']/table/tbody//tr/td/label[text()='Deceased']/../label[text()='Yes']"); - $this->select("deceased_date_relative","value=0"); + $this->select("deceased_date_relative", "value=0"); $this->webtestFillDate("deceased_date_low", "-1 month"); $this->webtestFillDate("deceased_date_high", "+1 month"); // fill gender (male) @@ -333,9 +346,9 @@ class WebTest_Contact_AdvancedSearchTest extends CiviSeleniumTestCase { /** * @param $firstName */ - function addContributionSearchDetail($firstName) { + public function addContributionSearchDetail($firstName) { // fill contribution date range - $this->select("contribution_date_relative","value=0"); + $this->select("contribution_date_relative", "value=0"); $this->webtestFillDate("contribution_date_low", "-1 day"); $this->webtestFillDate("contribution_date_high", "+1 day"); // fill amount range @@ -348,14 +361,14 @@ class WebTest_Contact_AdvancedSearchTest extends CiviSeleniumTestCase { $this->type("contribution_check_number", "chqNo$firstName"); // fill transaction id $this->type("contribution_transaction_id", "trid$firstName"); - // fill financial type - $this->select("financial_type_id", "Event Fee"); + // fill financial type + $this->select("financial_type_id", "Event Fee"); // fill currency type $this->select("contribution_currency_type", "USD"); } // function to fill participant search details - function addParticipantSearchDetail() { + public function addParticipantSearchDetail() { // fill event name $this->select2("event_id", "Fall Fundraiser Dinner"); // fill event type @@ -375,7 +388,7 @@ class WebTest_Contact_AdvancedSearchTest extends CiviSeleniumTestCase { /** * @param $firstName */ - function addMemberSearchDetail($firstName) { + public function addMemberSearchDetail($firstName) { // check membership type (Student) $this->click("xpath=//div[@id='memberForm']/table/tbody/tr[1]/td[1]/div[1]//div/label[text()='Student']"); // check membership status (completed) @@ -385,15 +398,15 @@ class WebTest_Contact_AdvancedSearchTest extends CiviSeleniumTestCase { // check to search primary member $this->click("xpath=//div[@id='memberForm']/table/tbody/tr[2]/td[2]/p/input"); // add join date range - $this->select("member_join_date_relative","value=0"); + $this->select("member_join_date_relative", "value=0"); $this->webtestFillDate("member_join_date_low", "-1 day"); $this->webtestFillDate("member_join_date_high", "+1 day"); // add start date range - $this->select("member_start_date_relative","value=0"); + $this->select("member_start_date_relative", "value=0"); $this->webtestFillDate("member_start_date_low", "-1 day"); $this->webtestFillDate("member_start_date_high", "+1 day"); // add end date range - $this->select("member_end_date_relative","value=0"); + $this->select("member_end_date_relative", "value=0"); $this->webtestFillDate("member_end_date_low", "-1 year"); $this->webtestFillDate("member_end_date_high", "+2 year"); } @@ -402,9 +415,9 @@ class WebTest_Contact_AdvancedSearchTest extends CiviSeleniumTestCase { /** * @param $firstName */ - function addPledgeSearchDetail($firstName) { + public function addPledgeSearchDetail($firstName) { // fill pledge schedule date range - $this->select("pledge_payment_date_relative","value=0"); + $this->select("pledge_payment_date_relative", "value=0"); $this->webtestFillDate("pledge_payment_date_low", "-1 day"); $this->webtestFillDate("pledge_payment_date_high", "+1 day"); // fill Pledge payment status @@ -430,7 +443,7 @@ class WebTest_Contact_AdvancedSearchTest extends CiviSeleniumTestCase { /** * @param null $firstName */ - function createDetailContact($firstName = NULL) { + public function createDetailContact($firstName = NULL) { if (!$firstName) { $firstName = substr(sha1(rand()), 0, 7); } @@ -500,4 +513,3 @@ class WebTest_Contact_AdvancedSearchTest extends CiviSeleniumTestCase { $this->assertElementContainsText('css=.crm-summary-display_name', "$firstName adv$firstName"); } } -