From 60f44e0c1482a71ce8f3fa44372f60d0c749f420 Mon Sep 17 00:00:00 2001 From: Jitendra Purohit Date: Tue, 2 Sep 2014 18:51:54 +0530 Subject: [PATCH] Webtest 4.5.0 --- .../WebTest/Contact/CustomDataAddTest.php | 26 +++++++------ .../DeceasedContactsAdvancedSearchTest.php | 6 +-- .../WebTest/Contact/SearchBuilderTest.php | 10 ++--- tests/phpunit/WebTest/Contact/SearchTest.php | 7 ++-- .../WebTest/Grant/CustomFieldsetTest.php | 7 ++-- .../WebTest/Import/AddressImportTest.php | 38 ++++++++++--------- 6 files changed, 50 insertions(+), 44 deletions(-) diff --git a/tests/phpunit/WebTest/Contact/CustomDataAddTest.php b/tests/phpunit/WebTest/Contact/CustomDataAddTest.php index 4be2436a79..81cc43e5ee 100644 --- a/tests/phpunit/WebTest/Contact/CustomDataAddTest.php +++ b/tests/phpunit/WebTest/Contact/CustomDataAddTest.php @@ -50,10 +50,12 @@ class WebTest_Contact_CustomDataAddTest extends CiviSeleniumTestCase { $this->select("extends[0]", "value=Contact"); $this->click("//option[@value='Contact']"); $this->click("_qf_Group_next-bottom"); - $this->waitForElementPresent("_qf_Field_cancel-bottom"); + $this->waitForElementPresent('newCustomField'); //Is custom group created? $this->waitForText('crm-notification-container', "Your custom field set '{$customGroupTitle}' has been added. You can add custom fields now."); + $this->click('newCustomField'); + $this->waitForElementPresent("_qf_Field_cancel-bottom"); //add custom field - alphanumeric checkbox $checkboxFieldLabel = 'custom_field' . substr(sha1(rand()), 0, 4); @@ -86,14 +88,14 @@ class WebTest_Contact_CustomDataAddTest extends CiviSeleniumTestCase { $this->click("is_searchable"); //clicking save - $this->click("_qf_Field_next"); - $this->waitForPageToLoad($this->getTimeoutMsec()); + $this->click("_qf_Field_done"); //Is custom field created? $this->waitForText('crm-notification-container', "Custom field '$checkboxFieldLabel' has been saved."); + $this->waitForElementPresent('newCustomField'); //create another custom field - Integer Radio - $this->clickLink("//a[@id='newCustomField']/span", '_qf_Field_cancel', FALSE); + $this->clickLink("newCustomField", '_qf_Field_cancel', FALSE); $this->click("data_type[0]"); $this->select("data_type[0]", "value=1"); $this->click("//option[@value='1']"); @@ -127,7 +129,7 @@ class WebTest_Contact_CustomDataAddTest extends CiviSeleniumTestCase { $this->click("is_searchable"); //clicking save - $this->click("_qf_Field_next"); + $this->click("_qf_Field_done"); //Is custom field created $this->waitForText('crm-notification-container', "Custom field '$radioFieldLabel' has been saved."); @@ -172,10 +174,12 @@ class WebTest_Contact_CustomDataAddTest extends CiviSeleniumTestCase { $this->select("extends[0]", "value=Contact"); $this->click("//option[@value='Contact']"); $this->click("_qf_Group_next-bottom"); - $this->waitForElementPresent("_qf_Field_cancel-bottom"); + $this->waitForElementPresent('newCustomField'); //Is custom group created? $this->waitForText('crm-notification-container', "Your custom field set '{$customGroupTitle}' has been added. You can add custom fields now."); + $this->click('newCustomField'); + $this->waitForElementPresent("_qf_Field_cancel-bottom"); //add custom field - money text $moneyTextFieldLabel = 'money' . substr(sha1(rand()), 0, 4); @@ -198,8 +202,7 @@ class WebTest_Contact_CustomDataAddTest extends CiviSeleniumTestCase { $this->click("is_searchable"); //clicking save - $this->click("_qf_Field_next"); - $this->waitForPageToLoad($this->getTimeoutMsec()); + $this->click("_qf_Field_done"); //Is custom field created? $this->waitForText('crm-notification-container', "Custom field '$moneyTextFieldLabel' has been saved."); @@ -257,15 +260,16 @@ class WebTest_Contact_CustomDataAddTest extends CiviSeleniumTestCase { $this->select("id=extends_0", "label=Individual"); $this->click("id=collapse_display"); $this->click("id=_qf_Group_next-bottom"); - $this->waitForElementPresent('_qf_Field_next-bottom'); + $this->waitForElementPresent('newCustomField'); $this->waitForText('crm-notification-container', "Your custom field set '$customFieldSet' has been added."); + $this->click('newCustomField'); + $this->waitForElementPresent('_qf_Field_done-bottom'); // Add field to fieldset $customField = 'CustomField' . rand(); $this->type("id=label", $customField); $this->select("id=data_type_0", "value=0"); - $this->click("id=_qf_Field_next-bottom"); - $this->waitForPageToLoad($this->getTimeoutMsec()); + $this->click("id=_qf_Field_done-bottom"); $this->waitForText('crm-notification-container', "Custom field '$customField' has been saved."); $this->openCiviPage('contact/add', 'reset=1&ct=Individual'); diff --git a/tests/phpunit/WebTest/Contact/DeceasedContactsAdvancedSearchTest.php b/tests/phpunit/WebTest/Contact/DeceasedContactsAdvancedSearchTest.php index bfa6736e3f..60381a5364 100644 --- a/tests/phpunit/WebTest/Contact/DeceasedContactsAdvancedSearchTest.php +++ b/tests/phpunit/WebTest/Contact/DeceasedContactsAdvancedSearchTest.php @@ -65,13 +65,13 @@ class WebTest_Contact_DeceasedContactsAdvancedSearchTest extends CiviSeleniumTes $this->click('demographics'); $this->waitForElementPresent('CIVICRM_QFID_1_is_deceased'); $this->click('CIVICRM_QFID_1_is_deceased'); - $this->clickLink('_qf_Advanced_refresh', 'Go'); + $this->clickLink('_qf_Advanced_refresh'); $this->assertElementContainsText('search-status', '2 Contacts'); $this->click("toggleSelect"); $this->waitForTextPresent('2 Selected records only'); $this->select('task', 'label=Remove Contacts from Group'); - $this->click("Go"); + $this->waitForPageToLoad($this->getTimeoutMsec()); $this->waitForElementPresent('_qf_RemoveFromGroup_back-bottom'); $this->assertElementContainsText('crm-container', 'Number of selected contacts: 2'); $this->select('group_id', "label={$groupName}"); @@ -85,7 +85,7 @@ class WebTest_Contact_DeceasedContactsAdvancedSearchTest extends CiviSeleniumTes $this->click('_qf_Advanced_refresh'); // Check if non-deceased contacts are still present - $this->waitForElementPresent('Go'); + $this->waitForElementPresent('search-status'); $this->assertElementContainsText('search-status', '3 Contacts'); } diff --git a/tests/phpunit/WebTest/Contact/SearchBuilderTest.php b/tests/phpunit/WebTest/Contact/SearchBuilderTest.php index d6abae116e..e6009b1096 100644 --- a/tests/phpunit/WebTest/Contact/SearchBuilderTest.php +++ b/tests/phpunit/WebTest/Contact/SearchBuilderTest.php @@ -166,8 +166,8 @@ class WebTest_Contact_SearchBuilderTest extends CiviSeleniumTestCase { $this->click("_qf_Contact_upload_view"); $this->waitForPageToLoad($this->getTimeoutMsec()); $this->_searchBuilder('Email', NULL, NULL, 'IS NULL'); - $this->type("xpath=//*[@id='Builder-rows-per-page-select']", '100'); - $this->waitForElementPresent("xpath=//*[@id='Builder-rows-per-page-select']"); + $this->type('CRM_Contact_Form_Search_Builder-rows-per-page-select', '100'); + $this->waitForElementPresent('CRM_Contact_Form_Search_Builder-rows-per-page-select'); $names = array( 1 => $firstName1, 2 => $firstName2, @@ -183,8 +183,8 @@ class WebTest_Contact_SearchBuilderTest extends CiviSeleniumTestCase { } //searching contacts whose phone field is not empty $this->_searchBuilder('Phone', NULL, $firstName, 'IS NOT EMPTY'); - $this->type("xpath=//*[@id='Builder-rows-per-page-select']", '100'); - $this->waitForElementPresent("xpath=//*[@id='Builder-rows-per-page-select']"); + $this->type('CRM_Contact_Form_Search_Builder-rows-per-page-select', '100'); + $this->waitForElementPresent('CRM_Contact_Form_Search_Builder-rows-per-page-select'); $this->assertTrue($this->isTextPresent($firstName)); $firstName4 = "AB" . substr(sha1(rand()), 0, 7); @@ -307,7 +307,7 @@ class WebTest_Contact_SearchBuilderTest extends CiviSeleniumTestCase { } else { $this->click("location"); - $this->waitForElementPresent("xpath=//div[@id='location']/table/tbody/tr[2]/td/table/tbody/tr[4]/td[2]/select"); + $this->waitForElementPresent("$field"); if ($contactType == 'Individual') { $this->type("$field", $fieldValue); } diff --git a/tests/phpunit/WebTest/Contact/SearchTest.php b/tests/phpunit/WebTest/Contact/SearchTest.php index 57e282a6ab..fa51272095 100644 --- a/tests/phpunit/WebTest/Contact/SearchTest.php +++ b/tests/phpunit/WebTest/Contact/SearchTest.php @@ -54,10 +54,10 @@ class WebTest_Contact_SearchTest extends CiviSeleniumTestCase { $this->typeKeys("css=input#sort_name_navigation", $sortName); // wait for result list - $this->waitForElementPresent("xpath=//*[@id='ui-id-1']/li"); + $this->waitForElementPresent("xpath=//li[contains(text(), '$sortName :: $firstName.anderson@example.org')]"); // visit contact summary page - $this->click("xpath=//*[@id='ui-id-1']/li"); + $this->click("xpath=//li[contains(text(), '$sortName :: $firstName.anderson@example.org')]"); $this->waitForPageToLoad($this->getTimeoutMsec()); // Is contact present? @@ -125,7 +125,7 @@ class WebTest_Contact_SearchTest extends CiviSeleniumTestCase { $this->waitForElementPresent("css=div#tagtree"); // select tag - $this->click("xpath=//ul/li/label[text()=\"$tagName\"]"); + $this->click("xpath=//ul/li/span/label[text()=\"$tagName\"]"); $this->waitForElementPresent("css=.success"); // visit contact search page @@ -249,7 +249,6 @@ class WebTest_Contact_SearchTest extends CiviSeleniumTestCase { // Select the task action to export $this->click("task"); $this->select("task", "label=Export Contacts"); - $this->click("Go"); $this->waitForPageToLoad($this->getTimeoutMsec()); $this->click("_qf_Select_next-bottom"); diff --git a/tests/phpunit/WebTest/Grant/CustomFieldsetTest.php b/tests/phpunit/WebTest/Grant/CustomFieldsetTest.php index 72bc65069d..d76c5f3a19 100644 --- a/tests/phpunit/WebTest/Grant/CustomFieldsetTest.php +++ b/tests/phpunit/WebTest/Grant/CustomFieldsetTest.php @@ -71,15 +71,16 @@ class WebTest_Grant_CustomFieldsetTest extends CiviSeleniumTestCase { $this->addSelection('id=extends_1', "label=$grantType"); $this->click('id=collapse_display'); $this->click('id=_qf_Group_next-bottom'); - $this->waitForElementPresent('_qf_Field_next-bottom'); + $this->waitForElementPresent('newCustomField'); $this->waitForText('crm-notification-container', "Your custom field set '$grantFieldSet' has been added."); + $this->click('newCustomField'); + $this->waitForElementPresent('_qf_Field_done-bottom'); // Add field to fieldset $grantField = 'GrantField' . $rand; $this->type('id=label', $grantField); $this->select('id=data_type_0', 'label=Money'); - $this->click('id=_qf_Field_next-bottom'); - $this->waitForPageToLoad($this->getTimeoutMsec()); + $this->click('id=_qf_Field_done-bottom'); $this->waitForText('crm-notification-container', "Custom field '$grantField' has been saved."); // Create new Grant diff --git a/tests/phpunit/WebTest/Import/AddressImportTest.php b/tests/phpunit/WebTest/Import/AddressImportTest.php index 10b3f31702..099a608f85 100644 --- a/tests/phpunit/WebTest/Import/AddressImportTest.php +++ b/tests/phpunit/WebTest/Import/AddressImportTest.php @@ -128,33 +128,35 @@ class WebTest_Import_AddressImportTest extends ImportCiviSeleniumTestCase { $this->select('extends[0]', "value=Address"); $this->click("//option[@value='Address']"); $this->click('_qf_Group_next-bottom'); - $this->waitForElementPresent('_qf_Field_cancel-bottom'); + $this->waitForElementPresent('newCustomField'); //Is custom group created? $this->waitForText('crm-notification-container', "Your custom field set '{$customGroupTitle}' has been added. You can add custom fields now."); $gid = $this->urlArg('gid'); + $this->click('newCustomField'); + $this->waitForElementPresent('_qf_Field_cancel-bottom'); // create custom field "alphanumeric text" $customField = 'Custom field ' . substr(sha1(rand()), 0, 4); $this->type('label', $customField); // clicking save - $this->click('_qf_Field_next-bottom'); - $this->waitForElementPresent('newCustomField'); + $this->click('_qf_Field_done-bottom'); $this->waitForText('crm-notification-container',"Custom field '{$customField}' has been saved."); + $this->waitForElementPresent("xpath=//span[text()='$customField']"); $customFieldId = explode('&id=', $this->getAttribute("xpath=//div[@id='field_page']//table/tbody//tr/td/span[text()='$customField']/../../td[8]/span/a@href")); $customFieldId = $customFieldId[1]; // create custom field - Integer $this->click("newCustomField"); - $this->waitForElementPresent('_qf_Field_next-bottom'); + $this->waitForElementPresent('_qf_Field_done-bottom'); $customField1 = 'Customfield_int ' . substr(sha1(rand()), 0, 4); $this->type('label', $customField1); $this->select("data_type[0]","value=1"); // clicking save - $this->click('_qf_Field_next-bottom'); + $this->click('_qf_Field_done-bottom'); $this->waitForElementPresent('newCustomField'); $this->waitForText('crm-notification-container', "Custom field '{$customField1}' has been saved."); $this->waitForElementPresent("xpath=//div[@id='field_page']//table/tbody//tr/td/span[text()='$customField1']"); @@ -163,13 +165,13 @@ class WebTest_Import_AddressImportTest extends ImportCiviSeleniumTestCase { // create custom field - Number $this->click("newCustomField"); - $this->waitForElementPresent('_qf_Field_next-bottom'); + $this->waitForElementPresent('_qf_Field_done-bottom'); $customField2 = 'Customfield_Number ' . substr(sha1(rand()), 0, 4); $this->type('label', $customField2); $this->select("data_type[0]","value=2"); // clicking save - $this->click('_qf_Field_next-bottom'); + $this->click('_qf_Field_done-bottom'); $this->waitForElementPresent('newCustomField'); $this->waitForText('crm-notification-container', "Custom field '{$customField2}' has been saved."); $this->waitForElementPresent("xpath=//div[@id='field_page']//table/tbody//tr/td/span[text()='$customField2']"); @@ -178,49 +180,49 @@ class WebTest_Import_AddressImportTest extends ImportCiviSeleniumTestCase { // create custom field - "alphanumeric select" $this->click("newCustomField"); - $this->waitForElementPresent('_qf_Field_next-bottom'); + $this->waitForElementPresent('_qf_Field_done-bottom'); $customField3 = 'Customfield_alp_select' . substr(sha1(rand()), 0, 4); $customFieldId3 = $this->_createMultipleValueCustomField($customField3,'Select'); // create custom field - "alphanumeric radio" $this->click("newCustomField"); - $this->waitForElementPresent('_qf_Field_next-bottom'); + $this->waitForElementPresent('_qf_Field_done-bottom'); $customField4 = 'Customfield_alp_radio' . substr(sha1(rand()), 0, 4); $customFieldId4 = $this->_createMultipleValueCustomField($customField4,'Radio'); // create custom field - "alphanumeric checkbox" $this->click("newCustomField"); - $this->waitForElementPresent('_qf_Field_next-bottom'); + $this->waitForElementPresent('_qf_Field_done-bottom'); $customField5 = 'Customfield_alp_checkbox' . substr(sha1(rand()), 0, 4); $customFieldId5 = $this->_createMultipleValueCustomField($customField5,'CheckBox'); // create custom field - "alphanumeric multiselect" $this->click("newCustomField"); - $this->waitForElementPresent('_qf_Field_next-bottom'); + $this->waitForElementPresent('_qf_Field_done-bottom'); $customField6 = 'Customfield_alp_multiselect' . substr(sha1(rand()), 0, 4); $customFieldId6 = $this->_createMultipleValueCustomField($customField6,'Multi-Select'); // create custom field - "alphanumeric advmultiselect" $this->click("newCustomField"); - $this->waitForElementPresent('_qf_Field_next-bottom'); + $this->waitForElementPresent('_qf_Field_done-bottom'); $customField7 = 'Customfield_alp_advmultiselect' . substr(sha1(rand()), 0, 4); $customFieldId7 = $this->_createMultipleValueCustomField($customField7,'AdvMulti-Select'); // create custom field - "alphanumeric autocompleteselect" $this->click("newCustomField"); - $this->waitForElementPresent('_qf_Field_next-bottom'); + $this->waitForElementPresent('_qf_Field_done-bottom'); $customField8 = 'Customfield_alp_autocompleteselect' . substr(sha1(rand()), 0, 4); $customFieldId8 = $this->_createMultipleValueCustomField($customField8,'Autocomplete-Select'); // create custom field - Money $this->click("newCustomField"); - $this->waitForElementPresent('_qf_Field_next-bottom'); + $this->waitForElementPresent('_qf_Field_done-bottom'); $customField9 = 'Customfield_Money' . substr(sha1(rand()), 0, 4); $this->type('label', $customField9); $this->select("data_type[0]","value=3"); // clicking save - $this->click('_qf_Field_next-bottom'); + $this->click('_qf_Field_done-bottom'); $this->waitForElementPresent('newCustomField'); $this->waitForText('crm-notification-container', "Custom field '{$customField9}' has been saved."); $this->waitForElementPresent("xpath=//div[@id='field_page']//table/tbody//tr/td/span[text()='$customField9']"); @@ -229,14 +231,14 @@ class WebTest_Import_AddressImportTest extends ImportCiviSeleniumTestCase { // create custom field - Date $this->click("newCustomField"); - $this->waitForElementPresent('_qf_Field_next-bottom'); + $this->waitForElementPresent('_qf_Field_done-bottom'); $customField10 = 'Customfield_Date' . substr(sha1(rand()), 0, 4); $this->type('label', $customField10); $this->select("data_type[0]","value=5"); $this->select("date_format","value=yy-mm-dd"); // clicking save - $this->click('_qf_Field_next-bottom'); + $this->click('_qf_Field_done-bottom'); $this->waitForElementPresent('newCustomField'); $this->waitForText('crm-notification-container', "Custom field '{$customField10}' has been saved."); $this->waitForElementPresent("xpath=//div[@id='field_page']//table/tbody//tr/td/span[text()='$customField10']"); @@ -303,7 +305,7 @@ class WebTest_Import_AddressImportTest extends ImportCiviSeleniumTestCase { $this->type("option_value_2","label2"); // clicking save - $this->click('_qf_Field_next-bottom'); + $this->click('_qf_Field_done-bottom'); $this->waitForElementPresent('newCustomField'); $this->waitForText('crm-notification-container', "Custom field '{$customFieldName}' has been saved."); $this->waitForElementPresent("xpath=//div[@id='field_page']//table/tbody//tr/td/span[text()='$customFieldName']"); -- 2.25.1