From 280dc0fea70488c4b5d0e9c189722ee2fba1698a Mon Sep 17 00:00:00 2001 From: jitendrapurohit Date: Mon, 6 Oct 2014 16:07:13 +0530 Subject: [PATCH] Webtest Fix --- tests/phpunit/WebTest/Admin/MoveCustomDataTest.php | 9 ++++++--- tests/phpunit/WebTest/Contact/AdvancedSearchTest.php | 4 ++-- 2 files changed, 8 insertions(+), 5 deletions(-) diff --git a/tests/phpunit/WebTest/Admin/MoveCustomDataTest.php b/tests/phpunit/WebTest/Admin/MoveCustomDataTest.php index 9da2ee188d..f5169ca198 100644 --- a/tests/phpunit/WebTest/Admin/MoveCustomDataTest.php +++ b/tests/phpunit/WebTest/Admin/MoveCustomDataTest.php @@ -129,7 +129,6 @@ class WebTest_Admin_MoveCustomDataTest extends CiviSeleniumTestCase { //click the save button $this->click("_qf_MoveField_next"); - $this->waitForPageToLoad($this->getTimeoutMsec()); //assert that the success text is present $this->waitForText('crm-notification-container', "has been moved"); @@ -377,13 +376,14 @@ class WebTest_Admin_MoveCustomDataTest extends CiviSeleniumTestCase { } //clicking save - $this->click("_qf_Field_next"); + $this->click("_qf_Field_done-bottom"); $this->waitForPageToLoad($this->getTimeoutMsec()); //Is custom field created? $this->waitForText('crm-notification-container', "Custom field '$fieldLabel' has been saved."); //get the custom id of the custom field that was just created + CRM_Utils_System::flushCache(); $results = $this->webtest_civicrm_api("CustomField", "get", array('label' => $fieldLabel, 'custom_group_id' => $group_id)); //While there _technically_ could be two fields with the same name, its highly unlikely //so assert that exactly one result is return @@ -445,7 +445,10 @@ class WebTest_Admin_MoveCustomDataTest extends CiviSeleniumTestCase { //fill a value in for each field foreach ($fields as $field_id => $field) { //if there is an option group id, we grab the labels and select on randomly - if (isset($field['option_group_id'])) { + if ($field['data_type'] == 'Date') { + $this->webtestFillDate("custom_" . $field['id'] . "_" . $table_pk, "+1 week"); + } + elseif (isset($field['option_group_id'])) { $options = $this->webtest_civicrm_api("OptionValue", "get", array('option_group_id' => $field['option_group_id'])); $options = $options['values']; $pick_me = $options[array_rand($options)]['label']; diff --git a/tests/phpunit/WebTest/Contact/AdvancedSearchTest.php b/tests/phpunit/WebTest/Contact/AdvancedSearchTest.php index e559d044ae..873c144aa9 100644 --- a/tests/phpunit/WebTest/Contact/AdvancedSearchTest.php +++ b/tests/phpunit/WebTest/Contact/AdvancedSearchTest.php @@ -236,10 +236,10 @@ class WebTest_Contact_AdvancedSearchTest extends CiviSeleniumTestCase { $this->select2("country", "United States", False); $this->clickLink("_qf_Advanced_refresh"); - $stateBeforeSort = $this->getText("xpath=//div[@class='crm-search-results']//table/tbody/tr[1]/td[6]"); + $stateBeforeSort = $this->getText("xpath=//div[@class='crm-search-results']//table/tbody/tr[2]/td[6]"); $this->click("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); + $this->assertElementNotContainsText("xpath=//div[@class='crm-search-results']//table/tbody/tr[2]/td[6]", $stateBeforeSort); $this->clickAjaxLink("xpath=//form[@id='Advanced']//div//div[contains(text(),'Edit Search Criteria')]/../div", 'group'); $this->select2("group", "Summer", TRUE); $this->waitForElementPresent('state_province'); -- 2.25.1