Webtest 4.5.0
authorJitendra Purohit <jitendra.purohit@webaccessglobal.com>
Tue, 2 Sep 2014 13:21:54 +0000 (18:51 +0530)
committerJitendra Purohit <jitendra.purohit@webaccessglobal.com>
Tue, 2 Sep 2014 13:21:54 +0000 (18:51 +0530)
tests/phpunit/WebTest/Contact/CustomDataAddTest.php
tests/phpunit/WebTest/Contact/DeceasedContactsAdvancedSearchTest.php
tests/phpunit/WebTest/Contact/SearchBuilderTest.php
tests/phpunit/WebTest/Contact/SearchTest.php
tests/phpunit/WebTest/Grant/CustomFieldsetTest.php
tests/phpunit/WebTest/Import/AddressImportTest.php

index 4be2436a798dda53d8c7e1578361fb46603b34cf..81cc43e5ee82889703f1cbafdf2ca0734dc1da14 100644 (file)
@@ -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');
index bfa6736e3f758390f89a2975e3cee7870518fd3a..60381a5364931a54bffd09b41f637633775ede44 100644 (file)
@@ -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');
   }
 
index d6abae116eb14bc8ca942ea603dc292c9ab01120..e6009b1096fbd743db2f9d3fff9303d34f8124fd 100644 (file)
@@ -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);
       }
index 57e282a6ab4552f8ba34226b7c46590a19e78f1d..fa51272095540c91b1c36494bb21e248c7162266 100644 (file)
@@ -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");
index 72bc65069d001e3bf5ca8bdc571f07f9ef86b0df..d76c5f3a19217044c77c514af55582bc438c5863 100644 (file)
@@ -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
index 10b3f31702d8c93f3e38bbe2f8d4c4f9d29b4edf..099a608f85f4864cadb12b4729fb7443f3be214a 100644 (file)
@@ -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']");