From: jitendrapurohit Date: Mon, 2 Mar 2015 13:13:04 +0000 (+0530) Subject: webtest fixes 4.6 X-Git-Url: https://vcs.fsf.org/?a=commitdiff_plain;h=1b1cbb042798cd081d723fe63c5cc4b1f7f02a4e;p=civicrm-core.git webtest fixes 4.6 --- diff --git a/tests/phpunit/WebTest/Contact/AdvancedSearchTest.php b/tests/phpunit/WebTest/Contact/AdvancedSearchTest.php index bc13161b1e..2df1dacd67 100644 --- a/tests/phpunit/WebTest/Contact/AdvancedSearchTest.php +++ b/tests/phpunit/WebTest/Contact/AdvancedSearchTest.php @@ -126,7 +126,7 @@ class WebTest_Contact_AdvancedSearchTest extends CiviSeleniumTestCase { 'location' => array('state_province', 'addAddressSearchDetail'), 'demographics' => array('civicrm_gender_Transgender_3', 'addDemographicSearchDetail'), 'notes' => array('note', ''), - 'activity' => array('activity_status[5]', 'addActivitySearchDetail'), + 'activity' => array('activity_type_id', 'addActivitySearchDetail'), 'CiviContribute' => array('contribution_currency_type', 'addContributionSearchDetail'), 'CiviEvent' => array('participant_fee_amount_high', 'addParticipantSearchDetail'), 'CiviMember' => array('member_end_date_high', 'addMemberSearchDetail'), @@ -178,7 +178,7 @@ class WebTest_Contact_AdvancedSearchTest extends CiviSeleniumTestCase { $this->webtestLogin(); $this->openCiviPage('contact/search/advanced', 'reset=1'); $this->clickAjaxLink("activity", 'activity_subject'); - $this->check("xpath=//div[@id='Activity']//div/label[text()='Tell a Friend']/../input"); + $this->multiselect2("activity_type_id", array('Tell a Friend')); $this->clickLink("_qf_Advanced_refresh"); $count = explode(" ", trim($this->getText("xpath=//div[@id='search-status']/table/tbody/tr/td"))); $count = $count[0]; @@ -311,20 +311,16 @@ class WebTest_Contact_AdvancedSearchTest extends CiviSeleniumTestCase { * @param $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\"]"); - } + // select activity types + $activityTypes = array("Contribution", "Event Registration", "Membership Signup"); + $this->multiselect2('activity_type_id', $activityTypes); // fill 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"); // fill activity status - - $this->click("xpath=//div[@id='activity']/table/tbody//tr/td[2]/label[text()='Activity Status']/../label[text()='Scheduled']"); - $this->click("xpath=//div[@id='activity']/table/tbody//tr/td[2]/label[text()='Activity Status']/../label[text()='Completed']"); + $this->multiselect2('status_id', array('Scheduled', 'Completed')); } /** @@ -357,16 +353,16 @@ class WebTest_Contact_AdvancedSearchTest extends CiviSeleniumTestCase { $this->type("contribution_amount_low", "1"); $this->type("contribution_amount_high", "200"); // check for completed - $this->check("contribution_status_id[1]"); + $this->multiselect2("contribution_status_id", array('Completed')); // enter check number - $this->select("contribution_payment_instrument_id", "Check"); + $this->select2("payment_instrument_id", "Check"); $this->type("contribution_check_number", "chqNo$firstName"); // fill transaction id - $this->type("contribution_transaction_id", "trid$firstName"); + $this->type("contribution_trxn_id", "trid$firstName"); // fill financial type $this->select("financial_type_id", "Event Fee"); // fill currency type - $this->select("contribution_currency_type", "USD"); + $this->select2("contribution_currency_type", "USD"); } /** diff --git a/tests/phpunit/WebTest/Contact/SearchbyDateFilterTest.php b/tests/phpunit/WebTest/Contact/SearchbyDateFilterTest.php index 324064c3cd..d079088697 100644 --- a/tests/phpunit/WebTest/Contact/SearchbyDateFilterTest.php +++ b/tests/phpunit/WebTest/Contact/SearchbyDateFilterTest.php @@ -250,7 +250,7 @@ class WebTest_Contact_SearchbyDateFilterTest extends CiviSeleniumTestCase { ), 'demographics' => array( 'headerLocator' => 'div#demographics', - 'bodyLocator' => 'input#birth_date_low_display', + 'bodyLocator' => 'input#birth_date_low', 'title' => 'Demographics', 'fields' => array( 'Deceased Dates' => array( diff --git a/tests/phpunit/WebTest/Mailing/AddNewMailingComponentTest.php b/tests/phpunit/WebTest/Mailing/AddNewMailingComponentTest.php index b6fcad983f..0f3185474f 100644 --- a/tests/phpunit/WebTest/Mailing/AddNewMailingComponentTest.php +++ b/tests/phpunit/WebTest/Mailing/AddNewMailingComponentTest.php @@ -69,7 +69,7 @@ class WebTest_Mailing_AddNewMailingComponentTest extends CiviSeleniumTestCase { $this->waitForText('crm-notification-container', "The mailing component '$componentName' has been saved."); // Verify text. - $this->assertTrue($this->isElementPresent("xpath=//table/tbody//tr/td[text()='{$componentName}']/../td[2][text()='Header']/../td[3][text()='{$subject}']/../td[4][text()='{$txtMsg}']/../td[5][text()='{$htmlMsg}']"), "The row doesn't consists of proper component details"); + $this->assertTrue($this->isElementPresent("xpath=//table/tbody//tr/td/div[text()='{$componentName}']/../../td[2][text()='Header']/../td[3][text()='{$subject}']/../td[4][text()='{$txtMsg}']/../td[5][text()='{$htmlMsg}']"), "The row doesn't consists of proper component details"); } public function testFooterAdd() { @@ -106,7 +106,7 @@ class WebTest_Mailing_AddNewMailingComponentTest extends CiviSeleniumTestCase { $this->waitForText('crm-notification-container', "The mailing component '$componentName' has been saved."); // Verify text. - $this->assertTrue($this->isElementPresent("xpath=//table/tbody//tr/td[text()='{$componentName}']/../td[2][text()='Footer']/../td[3][text()='{$subject}']/../td[4][text()='{$txtMsg}']/../td[5][text()='{$htmlMsg}']"), "The row doesn't consists of proper component details"); + $this->assertTrue($this->isElementPresent("xpath=//table/tbody//tr/td/div[text()='{$componentName}']/../../td[2][text()='Footer']/../td[3][text()='{$subject}']/../td[4][text()='{$txtMsg}']/../td[5][text()='{$htmlMsg}']"), "The row doesn't consists of proper component details"); } public function testAutomatedAdd() { @@ -143,7 +143,7 @@ class WebTest_Mailing_AddNewMailingComponentTest extends CiviSeleniumTestCase { $this->waitForText('crm-notification-container', "The mailing component '$componentName' has been saved."); // Verify text - $this->assertTrue($this->isElementPresent("xpath=//table/tbody//tr/td[text()='{$componentName}']/../td[2][text()='Reply']/../td[3][text()='{$subject}']/../td[4][text()='{$txtMsg}']/../td[5][text()='{$htmlMsg}']"), "The row doesn't consists of proper component details"); + $this->assertTrue($this->isElementPresent("xpath=//table/tbody//tr/td/div[text()='{$componentName}']/../../td[2][text()='Reply']/../td[3][text()='{$subject}']/../td[4][text()='{$txtMsg}']/../td[5][text()='{$htmlMsg}']"), "The row doesn't consists of proper component details"); } } diff --git a/tests/phpunit/WebTest/Profile/SearchTest.php b/tests/phpunit/WebTest/Profile/SearchTest.php index b2ce780111..860b7b54f9 100644 --- a/tests/phpunit/WebTest/Profile/SearchTest.php +++ b/tests/phpunit/WebTest/Profile/SearchTest.php @@ -58,7 +58,7 @@ class WebTest_Profile_SearchTest extends CiviSeleniumTestCase { //click on save $this->click('_qf_Group_next-bottom'); $this->waitForPageToLoad($this->getTimeoutMsec()); - $this->waitForElementPresent("xpath=//a/span[text()='Add Field']"); + $this->waitForElementPresent("_qf_Field_next-bottom"); //check for profile create $this->waitForText('crm-notification-container', "Your CiviCRM Profile '{$profileTitle}' has been added. You can add fields to this profile now."); @@ -160,7 +160,7 @@ class WebTest_Profile_SearchTest extends CiviSeleniumTestCase { $this->click('in_selector'); // click on save - $this->clickLink('_qf_Field_next-bottom', "xpath=//div[@id='field_page']/div[1]/a[4]/span[text()='Use (create mode)']", FALSE); + $this->clickLink('_qf_Field_next-bottom', "xpath=//div[@id='field_page']/div[1]/a[4]/span[text()=' Use (create mode)']", FALSE); $uselink = explode('?', $this->getAttribute("xpath=//*[@id='field_page']/div[1]/a[4]@href")); $this->openCiviPage('profile/create', "$uselink[1]", '_qf_Edit_next');