From 33cf86bda4d522acd187361d0ff6591127df4310 Mon Sep 17 00:00:00 2001 From: Web Access Date: Tue, 25 Mar 2014 16:07:29 +0530 Subject: [PATCH] modification for select2 function --- .../phpunit/CiviTest/CiviSeleniumTestCase.php | 6 +++--- .../WebTest/Contact/AdvancedSearchTest.php | 18 +++++++++--------- .../WebTest/Event/AddParticipationTest.php | 10 +++++----- .../WebTest/Event/ParticipantSearchTest.php | 4 ++-- 4 files changed, 19 insertions(+), 19 deletions(-) diff --git a/tests/phpunit/CiviTest/CiviSeleniumTestCase.php b/tests/phpunit/CiviTest/CiviSeleniumTestCase.php index 5ef08991a9..e0c2d717e9 100644 --- a/tests/phpunit/CiviTest/CiviSeleniumTestCase.php +++ b/tests/phpunit/CiviTest/CiviSeleniumTestCase.php @@ -364,7 +364,7 @@ class CiviSeleniumTestCase extends PHPUnit_Extensions_SeleniumTestCase { /** */ - function webtestFillAutocomplete($sortName, $fieldName = 's2id_contact_id') { + function webtestFillAutocomplete($sortName, $fieldName = 'contact_id') { $this->select2($fieldName,$sortName); //$this->assertContains($sortName, $this->getValue($fieldName), "autocomplete expected $sortName but didn’t find it in " . $this->getValue($fieldName)); } @@ -372,7 +372,7 @@ class CiviSeleniumTestCase extends PHPUnit_Extensions_SeleniumTestCase { /** */ function webtestOrganisationAutocomplete($sortName) { - $this->clickAt("//*[@id='s2id_contact_id']/a"); + $this->clickAt("//*[@id='contact_id']/../div/a"); $this->waitForElementPresent("//*[@id='select2-drop']/div/input"); $this->keyDown("//*[@id='select2-drop']/div/input", " "); $this->type("//*[@id='select2-drop']/div/input", $sortName); @@ -1880,7 +1880,7 @@ class CiviSeleniumTestCase extends PHPUnit_Extensions_SeleniumTestCase { * function to type and select first occurance of autocomplete */ function select2($fieldName,$label) { - $this->clickAt("//*[@id='$fieldName']/a"); + $this->clickAt("//*[@id='$fieldName']/../div/a"); $this->waitForElementPresent("//*[@id='select2-drop']/div/input"); $this->keyDown("//*[@id='select2-drop']/div/input", " "); $this->type("//*[@id='select2-drop']/div/input", $label); diff --git a/tests/phpunit/WebTest/Contact/AdvancedSearchTest.php b/tests/phpunit/WebTest/Contact/AdvancedSearchTest.php index ea5109a33e..80e2b1ee33 100644 --- a/tests/phpunit/WebTest/Contact/AdvancedSearchTest.php +++ b/tests/phpunit/WebTest/Contact/AdvancedSearchTest.php @@ -297,7 +297,7 @@ class WebTest_Contact_AdvancedSearchTest extends CiviSeleniumTestCase { $this->click("xpath=//div[@id='activity']/table/tbody/tr[1]/td[1]/div[1]//div/label[text()=\"$labels\"]"); } // fill date range - $this->select2("s2id_activity_date_relative","Choose Date Range"); + $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"); @@ -310,12 +310,12 @@ class WebTest_Contact_AdvancedSearchTest extends CiviSeleniumTestCase { // function to fill demographic search details function addDemographicSearchDetail() { // fill birth date range - $this->select2("s2id_birth_date_relative","Choose Date Range"); + $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->select2("s2id_deceased_date_relative","Choose Date Range"); + $this->select("deceased_date_relative","value=0"); $this->webtestFillDate("deceased_date_low", "-1 month"); $this->webtestFillDate("deceased_date_high", "+1 month"); // fill gender (male) @@ -325,7 +325,7 @@ class WebTest_Contact_AdvancedSearchTest extends CiviSeleniumTestCase { //function to fill contribution search details function addContributionSearchDetail($firstName) { // fill contribution date range - $this->select2("s2id_contribution_date_relative","Choose Date Range"); + $this->select("contribution_date_relative","value=0"); $this->webtestFillDate("contribution_date_low", "-1 day"); $this->webtestFillDate("contribution_date_high", "+1 day"); // fill amount range @@ -341,7 +341,7 @@ class WebTest_Contact_AdvancedSearchTest extends CiviSeleniumTestCase { // fill financial type $this->select("financial_type_id", "Event Fee"); // fill currency type - $this->select2("s2id_contribution_currency_type", "USD"); + $this->select("contribution_currency_type", "USD"); } // function to fill participant search details @@ -372,15 +372,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->select2("s2id_member_join_date_relative","Choose Date Range"); + $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->select2("s2id_member_start_date_relative","Choose Date Range"); + $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->select2("s2id_member_end_date_relative","Choose Date Range"); + $this->select("member_end_date_relative","value=0"); $this->webtestFillDate("member_end_date_low", "-1 year"); $this->webtestFillDate("member_end_date_high", "+2 year"); } @@ -388,7 +388,7 @@ class WebTest_Contact_AdvancedSearchTest extends CiviSeleniumTestCase { // function to fill member search details function addPledgeSearchDetail($firstName) { // fill pledge schedule date range - $this->select2("s2id_pledge_payment_date_relative","Choose Date Range"); + $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 diff --git a/tests/phpunit/WebTest/Event/AddParticipationTest.php b/tests/phpunit/WebTest/Event/AddParticipationTest.php index fa875c5f29..207859ceeb 100644 --- a/tests/phpunit/WebTest/Event/AddParticipationTest.php +++ b/tests/phpunit/WebTest/Event/AddParticipationTest.php @@ -48,7 +48,7 @@ class WebTest_Event_AddParticipationTest extends CiviSeleniumTestCase { $this->webtestFillAutocomplete($firstName); // Select event. Based on label for now. - $this->select2('s2id_event_id', "Rain-forest Cup Youth Soccer Tournament"); + $this->select2('event_id', "Rain-forest Cup Youth Soccer Tournament"); // Select role $this->click('role_id[2]'); @@ -60,7 +60,7 @@ class WebTest_Event_AddParticipationTest extends CiviSeleniumTestCase { // May 5th, 2010 // Select participant status - $this->select2('s2id_status_id', 'Registered'); + $this->select('status_id', 'value=1'); // Setting registration source $this->type('source', 'Event StandaloneAddTest Webtest'); @@ -242,7 +242,7 @@ class WebTest_Event_AddParticipationTest extends CiviSeleniumTestCase { $this->webtestFillAutocomplete($firstName); // Select event. Based on label for now. - $this->select2('s2id_event_id', "Rain-forest Cup Youth Soccer Tournament"); + $this->select2('event_id', "Rain-forest Cup Youth Soccer Tournament"); // Select roles $this->click('role_id[2]'); @@ -260,7 +260,7 @@ class WebTest_Event_AddParticipationTest extends CiviSeleniumTestCase { // May 5th, 2010 // Select participant status - $this->select2('s2id_status_id', 'Registered'); + $this->select('status_id', 'value=1'); // Setting registration source $this->type('source', 'Event StandaloneAddTest Webtest'); @@ -407,7 +407,7 @@ class WebTest_Event_AddParticipationTest extends CiviSeleniumTestCase { $this->openCiviPage("participant/add", "reset=1&action=add&context=standalone", "_qf_Participant_upload-bottom"); // Select event. - $this->select2('s2id_event_id', "Rain-forest Cup Youth Soccer Tournament"); + $this->select2('event_id', "Rain-forest Cup Youth Soccer Tournament"); // Select role. $this->click('role_id[2]'); diff --git a/tests/phpunit/WebTest/Event/ParticipantSearchTest.php b/tests/phpunit/WebTest/Event/ParticipantSearchTest.php index 57138a9755..cc2ae52954 100644 --- a/tests/phpunit/WebTest/Event/ParticipantSearchTest.php +++ b/tests/phpunit/WebTest/Event/ParticipantSearchTest.php @@ -122,7 +122,7 @@ class WebTest_Event_ParticipantSearchTest extends CiviSeleniumTestCase { // visit event search page $this->openCiviPage("event/search", "reset=1"); - $this->select2('s2id_event_relative', "Choose Date Range"); + $this->select('event_relative', "label=Choose Date Range"); $this->webtestFillDate('event_start_date_low', '-2 year'); $this->webtestFillDate('event_end_date_high', '+1 year'); @@ -147,7 +147,7 @@ class WebTest_Event_ParticipantSearchTest extends CiviSeleniumTestCase { // visit event search page $this->openCiviPage("event/search", "reset=1"); - $this->select2('s2id_event_relative', "Choose Date Range"); + $this->select('event_relative', "label=Choose Date Range"); $this->webtestFillDate('event_start_date_low', '-2 year'); $this->webtestFillDate('event_end_date_high', '+1 year'); -- 2.25.1