-- more webtest improvements
authorRavish Nair <ravish@ravish.(none)>
Mon, 11 Mar 2013 14:00:16 +0000 (19:30 +0530)
committerRavish Nair <ravish@ravish.(none)>
Mon, 11 Mar 2013 14:00:16 +0000 (19:30 +0530)
tests/phpunit/WebTest/Contact/AdvanceSearchPaneTest.php
tests/phpunit/WebTest/Contact/AdvanceSearchPrivacyOptionsTest.php
tests/phpunit/WebTest/Contact/ContactReferenceFieldTest.php
tests/phpunit/WebTest/Contact/CreateCmsUserFromContactTest.php
tests/phpunit/WebTest/Contact/CustomDataAddTest.php
tests/phpunit/WebTest/Contact/DeceasedContactsAdvancedSearchTest.php
tests/phpunit/WebTest/Contact/DupeContactTest.php
tests/phpunit/WebTest/Contact/GroupAddTest.php
tests/phpunit/WebTest/Contact/PrevNextTest.php
tests/phpunit/WebTest/Contact/TagSetSearchTest.php

index c5843cf9b1911efa25b05912d40c84bbb09b5fcc..64aa4b6a427bacf3db517a3f12e4a986c0849fb1 100644 (file)
@@ -54,8 +54,7 @@ class WebTest_Contact_AdvanceSearchPaneTest extends CiviSeleniumTestCase {
     // Test Individual panes.
     foreach (array_keys($allpanes) as $pane) {
       // Go to the Advance Search
-      $this->open($this->sboxPath . 'civicrm/contact/search/advanced?reset=1');
-      $this->waitForPageToLoad($this->getTimeoutMsec());
+      $this->openCiviPage('contact/search/advanced', 'reset=1');
 
       // Select some fields from pane.
       $this->_selectPaneFields($pane);
@@ -89,8 +88,7 @@ class WebTest_Contact_AdvanceSearchPaneTest extends CiviSeleniumTestCase {
     $allpanes = $this->_advanceSearchPanes();
 
     // Go to the Advance Search
-    $this->open($this->sboxPath . 'civicrm/contact/search/advanced?reset=1');
-    $this->waitForPageToLoad($this->getTimeoutMsec());
+    $this->openCiviPage('contact/search/advanced', 'reset=1');
 
     // Select some fields from all default panes.
     foreach (array_keys($allpanes) as $pane) {
index a66fe49d41dcd8022d6cfa4ae3ac7b42b84553d7..d54aeaf5133ad96ca3025855a75c10e6ed48b725 100644 (file)
@@ -64,8 +64,7 @@ class WebTest_Contact_AdvanceSearchPrivacyOptionsTest extends CiviSeleniumTestCa
     $this->_addIndividual($contactsReffOptions['dn_trade_sms']['first_name'], $contactsReffOptions['dn_trade_sms']['last_name'], $privacyOptions['dn_trade_sms']);
 
     //advance search for created contacts
-    $this->open($this->sboxPath . "civicrm/contact/search/advanced?reset=1");
-    $this->waitForElementPresent('_qf_Advanced_refresh');
+    $this->openCiviPage('contact/search/advanced', 'reset=1', '_qf_Advanced_refresh');
     $allPrivacyOptions = array(
       'do_not_phone',
       'do_not_mail',
@@ -188,7 +187,7 @@ class WebTest_Contact_AdvanceSearchPrivacyOptionsTest extends CiviSeleniumTestCa
 
   function _addIndividual($firstName, $lastName, $options) {
 
-    $this->open($this->sboxPath . "civicrm/contact/add?reset=1&ct=Individual");
+    $this->openCiviPage('contact/add', 'reset=1&ct=Individual');
   
     //fill in first name
     $this->type("first_name", $firstName);
@@ -210,7 +209,7 @@ class WebTest_Contact_AdvanceSearchPrivacyOptionsTest extends CiviSeleniumTestCa
     // Clicking save.
     $this->click("_qf_Contact_upload_view");
     $this->waitForPageToLoad($this->getTimeoutMsec());
-    $this->assertTrue($this->isTextPresent("{$firstName} {$lastName} has been created."));
+    $this->assertElementContainsText('crm-notification-container', "{$firstName} {$lastName} has been created.");
 
   }
 }
index dfea728c159bf2ae0533546ac866f9559e0a5cbe..13be0a19dc5266b52f7accbf6f482f2b5e0470c4 100644 (file)
@@ -48,8 +48,7 @@ class WebTest_Contact_ContactReferenceFieldTest extends CiviSeleniumTestCase {
 
     /* add new group */
 
-    $this->open($this->sboxPath . "civicrm/group/add?&reset=1");
-    $this->waitForElementPresent("_qf_Edit_upload");
+    $this->openCiviPage('group/add', 'reset=1', '_qf_Edit_upload');
 
     $groupName = 'group_' . substr(sha1(rand()), 0, 7);
     $this->type("title", $groupName);
@@ -90,9 +89,7 @@ class WebTest_Contact_ContactReferenceFieldTest extends CiviSeleniumTestCase {
 
     // Add Custom group //
     // Go directly to the URL of the screen that you will be testing (New Custom Group).
-    $this->open($this->sboxPath . "civicrm/admin/custom/group?action=add&reset=1");
-
-    $this->waitForPageToLoad($this->getTimeoutMsec());
+    $this->openCiviPage('admin/custom/group', 'action=add&reset=1');
 
     //fill custom group title
     $customGroupTitle = 'custom_' . substr(sha1(rand()), 0, 7);
@@ -107,7 +104,7 @@ class WebTest_Contact_ContactReferenceFieldTest extends CiviSeleniumTestCase {
     $this->waitForElementPresent("_qf_Field_cancel-bottom");
 
     //Is custom group created?
-    $this->assertTrue($this->isTextPresent("Your custom field set '{$customGroupTitle}' has been added. You can add custom fields now."));
+    $this->assertElementContainsText('crm-notification-container', "Your custom field set '{$customGroupTitle}' has been added. You can add custom fields now.");
 
     $matches = array();
     preg_match('/gid=([0-9]+)/', $this->getLocation(), $matches);
@@ -127,7 +124,7 @@ class WebTest_Contact_ContactReferenceFieldTest extends CiviSeleniumTestCase {
     $this->waitForPageToLoad($this->getTimeoutMsec());
 
     //Is custom field created?
-    $this->assertTrue($this->isTextPresent("Your custom field '$contactRefFieldLabel1' has been saved."));
+    $this->assertElementContainsText('crm-notification-container', "Your custom field '$contactRefFieldLabel1' has been saved.");
 
     //add custom field - alphanumeric checkbox
     $contactRefFieldLabel2 = 'contact_ref_' . substr(sha1(rand()), 0, 4);
@@ -146,10 +143,9 @@ class WebTest_Contact_ContactReferenceFieldTest extends CiviSeleniumTestCase {
     $this->waitForPageToLoad($this->getTimeoutMsec());
 
     //Is custom field created?
-    $this->assertTrue($this->isTextPresent("Your custom field '$contactRefFieldLabel2' has been saved."));
+    $this->assertElementContainsText('crm-notification-container', "Your custom field '$contactRefFieldLabel2' has been saved.");
 
-    $this->open($this->sboxPath . "civicrm/admin/custom/group/field?reset=1&action=browse&gid={$customGroupId}");
-    $this->waitForPageToLoad($this->getTimeoutMsec());
+    $this->openCiviPage('admin/custom/group/field', "reset=1&action=browse&gid={$customGroupId}");
 
     $this->click("xpath=//div[@id='field_page']//table/tbody/tr[1]/td[8]/span[1]/a[text()='Edit Field']");
     $this->waitForPageToLoad($this->getTimeoutMsec());
@@ -159,8 +155,7 @@ class WebTest_Contact_ContactReferenceFieldTest extends CiviSeleniumTestCase {
     $contactRefFieldID1 = $matches[1];
 
 
-    $this->open($this->sboxPath . "civicrm/admin/custom/group/field?reset=1&action=browse&gid={$customGroupId}");
-    $this->waitForPageToLoad($this->getTimeoutMsec());
+    $this->openCiviPage('admin/custom/group/field', "reset=1&action=browse&gid={$customGroupId}");
 
     $this->click("xpath=//div[@id='field_page']//table/tbody/tr[2]/td[8]/span[1]/a[text()='Edit Field']");
     $this->waitForPageToLoad($this->getTimeoutMsec());
@@ -170,25 +165,23 @@ class WebTest_Contact_ContactReferenceFieldTest extends CiviSeleniumTestCase {
     $contactRefFieldID2 = $matches[1];
 
     // Visit custom group preview page
-    $this->open($this->sboxPath . "civicrm/admin/custom/group?action=preview&reset=1&id={$customGroupId}");
-    $this->waitForPageToLoad($this->getTimeoutMsec());
+    $this->openCiviPage('admin/custom/group', "action=preview&reset=1&id={$customGroupId}");
 
     $this->type("custom_{$contactRefFieldID1}_-1", "Anderson");
     $this->fireEvent("custom_{$contactRefFieldID1}_-1", "focus");
     $this->click("custom_{$contactRefFieldID1}_-1");
     $this->waitForElementPresent("css=div.ac_results-inner li");
-    $this->assertTrue($this->isTextPresent("{$contact1}@example.com"));
-    $this->assertTrue(!($this->isTextPresent("{$contact2}@example.com")));
+    $this->assertElementContainsText("css=div.ac_results-inner li", "{$contact1}@example.com");
+    $this->assertElementNotContainsText("css=div.ac_results-inner ul li", "{$contact2}@example.com");
 
 
-    $this->open($this->sboxPath . "civicrm/admin/custom/group?action=preview&reset=1&id={$customGroupId}");
-    $this->waitForPageToLoad($this->getTimeoutMsec());
+    $this->openCiviPage('admin/custom/group', "action=preview&reset=1&id={$customGroupId}");
 
     $this->type("custom_{$contactRefFieldID2}_-1", $org1);
     $this->fireEvent("custom_{$contactRefFieldID2}_-1", "focus");
     $this->click("custom_{$contactRefFieldID2}_-1");
     $this->waitForElementPresent("css=div.ac_results-inner li");
-    $this->assertTrue($this->isTextPresent("{$org1}@example.com"));
+    $this->assertElementContainsText("css=div.ac_results-inner li", "{$org1}@example.com");
   }
 }
 
index 3bbf86f7dd3f4dba855463c7eaf66c2b583a2b9b..6006d9c83bc43c9d0db53cdd1ac8e165c17e0225 100644 (file)
@@ -234,8 +234,7 @@ class WebTest_Contact_CreateCmsUserFromContactTest extends CiviSeleniumTestCase
     $this->assertType('numeric', $cid);
 
     //got to the new cms user form
-    $this->open($this->sboxPath . "civicrm/contact/view/useradd?reset=1&action=add&cid=" . $cid);
-    $this->waitForPageToLoad($this->getTimeoutMsec());
+    $this->openCiviPage('contact/view/useradd', "reset=1&action=add&cid={$cid}");
 
     return array($cid, $firstName, $lastName, $email);
   }
index 3049b94df77da2c94d453ebbc8ffb72e1275040f..64898cba59c8ddef3ab4b7a8d705000ec2bf1d2f 100644 (file)
@@ -46,9 +46,7 @@ class WebTest_Contact_CustomDataAddTest extends CiviSeleniumTestCase {
     $this->webtestLogin();
 
     // Go directly to the URL of the screen that you will be testing (New Custom Group).
-    $this->open($this->sboxPath . "civicrm/admin/custom/group?action=add&reset=1");
-
-    $this->waitForPageToLoad($this->getTimeoutMsec());
+    $this->openCiviPage('admin/custom/group', 'action=add&reset=1');
 
     //fill custom group title
     $customGroupTitle = 'custom_' . substr(sha1(rand()), 0, 7);
@@ -63,7 +61,7 @@ class WebTest_Contact_CustomDataAddTest extends CiviSeleniumTestCase {
     $this->waitForElementPresent("_qf_Field_cancel-bottom");
 
     //Is custom group created?
-    $this->assertTrue($this->isTextPresent("Your custom field set '{$customGroupTitle}' has been added. You can add custom fields now."));
+    $this->assertElementContainsText('crm-notification-container', "Your custom field set '{$customGroupTitle}' has been added. You can add custom fields now.");
 
     //add custom field - alphanumeric checkbox
     $checkboxFieldLabel = 'custom_field' . substr(sha1(rand()), 0, 4);
@@ -101,7 +99,7 @@ class WebTest_Contact_CustomDataAddTest extends CiviSeleniumTestCase {
     $this->waitForPageToLoad($this->getTimeoutMsec());
 
     //Is custom field created?
-    $this->assertTrue($this->isTextPresent("Your custom field '$checkboxFieldLabel' has been saved."));
+    $this->assertElementContainsText('crm-notification-container', "Your custom field '$checkboxFieldLabel' has been saved.");
 
     //create another custom field - Integer Radio
     $this->click("//a[@id='newCustomField']/span");
@@ -143,7 +141,7 @@ class WebTest_Contact_CustomDataAddTest extends CiviSeleniumTestCase {
     $this->waitForPageToLoad($this->getTimeoutMsec());
 
     //Is custom field created
-    $this->assertTrue($this->isTextPresent("Your custom field '$radioFieldLabel' has been saved."));
+    $this->assertElementContainsText('crm-notification-container', "Your custom field '$radioFieldLabel' has been saved.");
 
     // Go to the URL to create an Individual contact.
     $this->openCiviPage("contact/add", "reset=1&ct=Individual");
@@ -178,9 +176,7 @@ class WebTest_Contact_CustomDataAddTest extends CiviSeleniumTestCase {
     $this->waitForPageToLoad($this->getTimeoutMsec());
 
     // Go directly to the URL of the screen that you will be testing (New Custom Group).
-    $this->open($this->sboxPath . "civicrm/admin/custom/group?action=add&reset=1");
-
-    $this->waitForPageToLoad($this->getTimeoutMsec());
+    $this->openCiviPage('admin/custom/group', 'action=add&reset=1');
 
     //fill custom group title
     $customGroupTitle = 'custom_' . substr(sha1(rand()), 0, 7);
@@ -196,7 +192,7 @@ class WebTest_Contact_CustomDataAddTest extends CiviSeleniumTestCase {
     $this->waitForElementPresent("_qf_Field_cancel-bottom");
 
     //Is custom group created?
-    $this->assertTrue($this->isTextPresent("Your custom field set '{$customGroupTitle}' has been added. You can add custom fields now."));
+    $this->assertElementContainsText('crm-notification-container', "Your custom field set '{$customGroupTitle}' has been added. You can add custom fields now.");
 
     //add custom field - money text
     $moneyTextFieldLabel = 'money' . substr(sha1(rand()), 0, 4);
@@ -223,11 +219,10 @@ class WebTest_Contact_CustomDataAddTest extends CiviSeleniumTestCase {
     $this->waitForPageToLoad($this->getTimeoutMsec());
 
     //Is custom field created?
-    $this->assertTrue($this->isTextPresent("Your custom field '$moneyTextFieldLabel' has been saved."));
+    $this->assertElementContainsText('crm-notification-container', "Your custom field '$moneyTextFieldLabel' has been saved.");
 
     //Get the customFieldsetID
-    $this->open($this->sboxPath . "civicrm/admin/custom/group?reset=1");
-    $this->waitForPageToLoad($this->getTimeoutMsec());
+    $this->openCiviPage('admin/custom/group', 'reset=1');
     $customFieldsetId = explode('&gid=', $this->getAttribute("xpath=//div[@id='custom_group']//table/tbody//tr/td/span[text()='$customGroupTitle']/../../td[7]/span/a@href"));
     $customFieldsetId =  $customFieldsetId[1];
 
@@ -272,19 +267,17 @@ class WebTest_Contact_CustomDataAddTest extends CiviSeleniumTestCase {
     $this->webtestLogin();
 
     //enable logging
-    $this->open($this->sboxPath . "civicrm/admin/setting/misc?reset=1");
+    $this->openCiviPage('admin/setting/misc', 'reset=1');
     $this->click("CIVICRM_QFID_1_logging");
-    $this->waitForPageToLoad($this->getTimeoutMsec());
     $this->click("_qf_Miscellaneous_next-top");
     // adding sleep here since enabling logging takes lot of time
     // increased the time since we now also add a lot of triggers and create tables
     // the first time around
-    sleep(60);
-    $this->waitForTextPresent("Your changes have been saved");
+    sleep(40);
+    $this->waitForTextPresent("Changes Saved");
 
     // Create new Custom Field Set
-    $this->open($this->sboxPath . 'civicrm/admin/custom/group?reset=1');
-    $this->waitForPageToLoad($this->getTimeoutMsec());
+    $this->openCiviPage('admin/custom/group', 'reset=1');
     $this->click("css=#newCustomDataGroup > span");
     $this->waitForElementPresent('_qf_Group_next-bottom');
     $customFieldSet = 'Fieldset' . rand();
@@ -293,7 +286,7 @@ class WebTest_Contact_CustomDataAddTest extends CiviSeleniumTestCase {
     $this->click("id=collapse_display");
     $this->click("id=_qf_Group_next-bottom");
     $this->waitForElementPresent('_qf_Field_next-bottom');
-    $this->assertTrue($this->isTextPresent("Your custom field set '$customFieldSet' has been added."));
+    $this->assertElementContainsText('crm-notification-container', "Your custom field set '$customFieldSet' has been added.");
 
     // Add field to fieldset
     $customField = 'CustomField' . rand();
@@ -301,10 +294,10 @@ class WebTest_Contact_CustomDataAddTest extends CiviSeleniumTestCase {
     $this->select("id=data_type_0", "value=0");
     $this->click("id=_qf_Field_next-bottom");
     $this->waitForPageToLoad($this->getTimeoutMsec());
-    $this->assertTrue($this->isTextPresent("Your custom field '$customField' has been saved."));
+    $this->assertElementContainsText('crm-notification-container', "Your custom field '$customField' has been saved.");
 
     // Go directly to the URL of the screen that you will be testing (New Individual).
-    $this->open($this->sboxPath . "civicrm/contact/add?reset=1&ct=Individual");
+    $this->openCiviPage('contact/add', 'reset=1&ct=Individual');
 
     //contact details section
     //fill in first name
@@ -340,7 +333,7 @@ class WebTest_Contact_CustomDataAddTest extends CiviSeleniumTestCase {
     $this->click("address_1_country_id");
     $this->select("address_1_country_id", "value=1228");
 
-    if ($this->isTextPresent("Latitude")) {
+    if ($this->assertElementContainsText("address_1", "Latitude")) {
       $this->type("address_1_geo_code_1", "1234");
       $this->type("address_1_geo_code_2", "5678");
     }
@@ -349,7 +342,7 @@ class WebTest_Contact_CustomDataAddTest extends CiviSeleniumTestCase {
     $this->click("_qf_Contact_upload_view");
     $this->waitForPageToLoad($this->getTimeoutMsec());
 
-    $this->assertTrue($this->isTextPresent("{$firstName} {$lastName} has been created."));
+    $this->assertElementContainsText('crm-notification-container', "{$firstName} {$lastName} has been created.");
 
     //Update the custom field
     $this->click("css=a.edit.button");
@@ -370,11 +363,11 @@ class WebTest_Contact_CustomDataAddTest extends CiviSeleniumTestCase {
     $this->assertTrue($this->isElementPresent("xpath=//form[@id='LoggingDetail']/div[2]/table/tbody/tr/td[3][contains(text(), '$value1')]"));
 
     //disable logging
-    $this->open($this->sboxPath . "civicrm/admin/setting/misc?reset=1");
+    $this->openCiviPage('admin/setting/misc', 'reset=1');
     $this->click("CIVICRM_QFID_0_logging");
     $this->click("_qf_Miscellaneous_next-top");
     //adding sleep here since disabling logging takes lot of time
-    sleep(40);
+    sleep(20);
     $this->waitForTextPresent("Changes Saved");
   }
 
index f90943adbac174ae8d80670dc09e896a90d3f178..5198729f113056cc8d909bc86653e1f0a76deae4 100644 (file)
@@ -65,8 +65,7 @@ class WebTest_Contact_DeceasedContactsAdvancedSearchTest extends CiviSeleniumTes
     }
 
     // Advanced Search
-    $this->open($this->sboxPath . 'civicrm/contact/search/advanced?reset=1');
-    $this->waitForElementPresent('_qf_Advanced_refresh');
+    $this->openCiviPage('contact/search/advanced', 'reset=1', '_qf_Advanced_refresh');
 
     // Select the group and check deceased contacts
     $this->select('crmasmSelect1', "label={$groupName}");
@@ -78,28 +77,27 @@ class WebTest_Contact_DeceasedContactsAdvancedSearchTest extends CiviSeleniumTes
 
     // Remove contacts from group
     $this->waitForElementPresent('Go');
-    $this->assertTrue($this->isTextPresent('2 Contacts'));
+    $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("xpath=//div[@id='search-status']/table/tbody/tr[3]/td/ul/input[2]");
     $this->waitForElementPresent('_qf_RemoveFromGroup_back-bottom');
-    $this->assertTrue($this->isTextPresent('Number of selected contacts: 2'));
+    $this->assertElementContainsText('crm-container', 'Number of selected contacts: 2');
     $this->select('group_id', "label={$groupName}");
     $this->click('_qf_RemoveFromGroup_next-bottom');
     $this->waitForPageToLoad($this->getTimeoutMsec());
-    $this->assertTrue($this->isTextPresent("2 contacts removed from '{$groupName}'"));
+    $this->assertElementContainsText('crm-notification-container', "2 contacts removed from '{$groupName}'");
 
     // Search for the contacts who are not deceased
-    $this->open($this->sboxPath . 'civicrm/contact/search/advanced?reset=1');
-    $this->waitForElementPresent('_qf_Advanced_refresh');
+    $this->openCiviPage('contact/search/advanced', 'reset=1', '_qf_Advanced_refresh');
     $this->select('crmasmSelect1', "label={$groupName}");
     $this->click('_qf_Advanced_refresh');
 
     // Check if non-deceased contacts are still present
     $this->waitForElementPresent('Go');
-    $this->assertTrue($this->isTextPresent('3 Contacts'));
+    $this->assertElementContainsText('search-status', '3 Contacts');
   }
 
   function _testAddContact($firstName, $lastName, $email, $groupName, $deceased = FALSE) {
index ffe0dcb43af8702401098efd3d47b37cb92ec66a..5f45ae0eedef0b760f04155450b50887dfe1d04a 100644 (file)
@@ -46,8 +46,7 @@ class WebTest_Contact_DupeContactTest extends CiviSeleniumTestCase {
     $this->webtestLogin();
 
     // Go directly to the URL of New Individual.
-    $this->open($this->sboxPath . "civicrm/contact/add?reset=1&ct=Individual");
-    $this->waitForPageToLoad($this->getTimeoutMsec());
+    $this->openCiviPage('contact/add', 'reset=1&ct=Individual');
 
     $firstName = substr(sha1(rand()), 0, 7);
     $lastName1 = substr(sha1(rand()), 0, 7);
@@ -78,8 +77,7 @@ class WebTest_Contact_DupeContactTest extends CiviSeleniumTestCase {
     $this->assertElementContainsText('crm-notification-container', "Contact Saved");
 
     // Go directly to the URL of New Individual.
-    $this->open($this->sboxPath . "civicrm/contact/add?reset=1&ct=Individual");
-    $this->waitForPageToLoad($this->getTimeoutMsec());
+    $this->openCiviPage('contact/add' , 'reset=1&ct=Individual');
 
     //contact details section
 
@@ -97,7 +95,7 @@ class WebTest_Contact_DupeContactTest extends CiviSeleniumTestCase {
     $this->click("_qf_Contact_upload_view");
     $this->waitForPageToLoad($this->getTimeoutMsec());
 
-    $this->isTextPresent("Please correct the following errors in the form fields below: One matching contact was found. You can View or Edit the existing contact, or Merge this contact with an existing contact.");
+    $this->assertElementContainsText("css=.notify-content", "Please correct the following errors in the form fields below: One matching contact was found. You can View or Edit the existing contact.");
   }
 }
 
index c5e8aa80e13c06c9f3fc605ffea0ffc4358d28f3..f1ab6cbee88f2d2709963f0731358dfaae1e4ff8 100644 (file)
@@ -66,10 +66,9 @@ class WebTest_Contact_GroupAddTest extends CiviSeleniumTestCase {
     $this->waitForPageToLoad($this->getTimeoutMsec());
 
     // Is status message correct?
-    $this->assertTrue($this->isTextPresent("The Group '{$params['name']}' has been saved."));
+    $this->assertElementContainsText('crm-notification-container', "The Group '{$params['name']}' has been saved.");
 
-    $this->open($this->sboxPath . "civicrm/group?reset=1");
-    $this->waitForPageToLoad($this->getTimeoutMsec());
+    $this->openCiviPage('group', 'reset=1');
     $this->type('title', $params['name']);
     $this->click('_qf_Search_refresh');
     $this->waitForElementPresent("xpath=//table[@id='crm-group-selector']/tbody/tr/td[3]/a");
@@ -78,9 +77,8 @@ class WebTest_Contact_GroupAddTest extends CiviSeleniumTestCase {
     $this->waitForElementPresent("xpath=//form[@id='Edit']/div[2]/div/table[2]/tbody/tr/td[2]/select");
 
     //assert created by in the edit page
-    $this->assertTrue($this->isElementPresent("xpath=//form[@id='Edit']/div[2]/div/table/tbody/tr[2]/td[1][text()='Created By']/following-sibling::td[text()='{$createdBy}']"));
-    $this->open($this->sboxPath . "civicrm/group?reset=1");
-    $this->waitForPageToLoad($this->getTimeoutMsec());
+    $this->assertTrue($this->isElementPresent("xpath=//form[@id='Edit']/div[2]/div/table/tbody/tr[2]/td[contains(text(),'Created By')]/following-sibling::td[contains(text(),'{$createdBy}')]"));
+    $this->openCiviPage('group', 'reset=1');
 
     //search groups using created by
     $this->type('created_by', $createdBy);
@@ -93,7 +91,7 @@ class WebTest_Contact_GroupAddTest extends CiviSeleniumTestCase {
     $this->waitForPageToLoad($this->getTimeoutMsec());
     $name = explode(',', $createdBy);
     $displayName = isset($name[1]) ? "{$name[1]} {$name[0]}" : "{$name[0]}";
-    $this->assertTrue($this->isTextPresent($displayName));
+    $this->assertElementContainsText("css=div.crm-summary-display_name",$displayName);
   }
 
   function testGroupReserved() {
@@ -158,7 +156,7 @@ class WebTest_Contact_GroupAddTest extends CiviSeleniumTestCase {
     $this->changePermissions($permissions);
     
     // Now logout as admin, login as regular user and verify that Group settings, delete and disable links are not available
-    $this->open($this->sboxPath . "civicrm/logout?reset=1");
+    $this->openCiviPage('logout', 'reset=1', NULL);
     $this->open($this->sboxPath);
     $this->waitForElementPresent('edit-submit');
     $this->type('edit-name', $user);
@@ -166,15 +164,15 @@ class WebTest_Contact_GroupAddTest extends CiviSeleniumTestCase {
     $this->click('edit-submit');
     $this->waitForPageToLoad($this->getTimeoutMsec());
     
-    $this->open($this->sboxPath . "civicrm/group?&reset=1");
+    $this->openCiviPage('group', 'reset=1');
     $this->type('title', $params['name']);
     $this->click('_qf_Search_refresh');
     $this->waitForTextPresent("Adding new reserved group.");
     // Settings link should NOT be included in selector after search returns with only the reserved group.
-    $this->assertFalse($this->isTextPresent("Settings"));
+    $this->assertElementNotContainsText("css=td.crm-group-group_links", "Settings");
 
     //login as admin and delete the role
-    $this->open($this->sboxPath . "civicrm/logout?reset=1");
+    $this->openCiviPage('logout', 'reset=1', NULL);
     $this->open($this->sboxPath);
     $this->webtestLogin(TRUE);
     $this->open($this->sboxPath . "admin/people/permissions/roles");
index 2a46853aa6c174a199d41ba0bb2cfc2231d7e8d1..2dd2e2236715ea4691ed9ecb58f084adafd45617 100644 (file)
@@ -48,8 +48,7 @@ class WebTest_Contact_PrevNextTest extends CiviSeleniumTestCase {
 
     /* add new group */
 
-    $this->open($this->sboxPath . "civicrm/group/add?&reset=1");
-    $this->waitForElementPresent("_qf_Edit_upload");
+    $this->openCiviPage('group/add', 'reset=1', '_qf_Edit_upload');
 
     $groupName = 'group_' . substr(sha1(rand()), 0, 7);
     $this->type("title", $groupName);
@@ -103,41 +102,40 @@ class WebTest_Contact_PrevNextTest extends CiviSeleniumTestCase {
     $this->assertElementContainsText('crm-notification-container', "Added to Group");
 
     // Search contacts
-    $this->open($this->sboxPath . "civicrm/contact/search?reset=1");
-    $this->waitForElementPresent("_qf_Basic_refresh");
+    $this->openCiviPage('contact/search', 'reset=1', '_qf_Basic_refresh');
 
     $this->select('group', "label={$groupName}");
     $this->click("_qf_Basic_refresh");
     $this->waitForPageToLoad(2 * $this->getTimeoutMsec());
-    $this->assertTrue($this->isTextPresent("3 Contacts"));
+    $this->assertElementContainsText('search-status', "3 Contacts");
 
     $this->click("xpath=//div[@class='crm-search-results']//table/tbody/tr[1]/td[3]/a");
     $this->waitForPageToLoad($this->getTimeoutMsec());
 
-    $this->assertTrue($this->isTextPresent("{$contact1} AAA"));
-    $this->assertTrue($this->isTextPresent("Next"));
+    $this->assertElementContainsText('css=div.crm-summary-display_name', "{$contact1} AAA");
+    $this->assertElementContainsText('css=li.crm-next-action a span', "Next");
 
     $this->click("xpath=//ul[@id='actions']/li[@class='crm-next-action']/a");
     $this->waitForPageToLoad($this->getTimeoutMsec());
-    $this->assertTrue($this->isTextPresent("{$contact2} BBB"));
-    $this->assertTrue($this->isTextPresent("Next"));
-    $this->assertTrue($this->isTextPresent("Previous"));
+    $this->assertElementContainsText('css=div.crm-summary-display_name', "{$contact2} BBB");
+    $this->assertElementContainsText('css=li.crm-next-action a span', "Next");
+    $this->assertElementContainsText('css=li.crm-previous-action a span', "Previous");
 
     $this->click("xpath=//ul[@id='actions']/li[@class='crm-next-action']/a");
     $this->waitForPageToLoad($this->getTimeoutMsec());
-    $this->assertTrue($this->isTextPresent("{$contact3} CCC"));
-    $this->assertTrue($this->isTextPresent("Previous"));
+    $this->assertElementContainsText('css=div.crm-summary-display_name', "{$contact3} CCC");
+    $this->assertElementContainsText('css=li.crm-previous-action a span', "Previous");
 
     $this->click("xpath=//ul[@id='actions']/li[@class='crm-previous-action']/a");
     $this->waitForPageToLoad($this->getTimeoutMsec());
-    $this->assertTrue($this->isTextPresent("{$contact2} BBB"));
-    $this->assertTrue($this->isTextPresent("Next"));
-    $this->assertTrue($this->isTextPresent("Previous"));
+    $this->assertElementContainsText('css=div.crm-summary-display_name', "{$contact2} BBB");
+    $this->assertElementContainsText('css=li.crm-next-action a span', "Next");
+    $this->assertElementContainsText('css=li.crm-previous-action a span', "Previous");
 
     $this->click("xpath=//ul[@id='actions']/li[@class='crm-previous-action']/a");
     $this->waitForPageToLoad($this->getTimeoutMsec());
-    $this->assertTrue($this->isTextPresent("{$contact1} AAA"));
-    $this->assertTrue($this->isTextPresent("Next"));
+    $this->assertElementContainsText('css=div.crm-summary-display_name', "{$contact1} AAA");
+    $this->assertElementContainsText('css=li.crm-next-action a span', "Next");
   }
 }
 
index 32d60765ea081ac85a741dfbbd179555938687c3..1be7af45a9b18d2f9d6a2e2aca619cf3bb0e0876 100644 (file)
@@ -92,8 +92,7 @@ class WebTest_Contact_TagSetSearchTest extends CiviSeleniumTestCase {
 
 
     // Go to Advance search.
-    $this->open($this->sboxPath . "civicrm/contact/search/advanced?reset=1");
-    $this->waitForPageToLoad($this->getTimeoutMsec());
+    $this->openCiviPage('contact/search/advanced', 'reset=1');
 
     // Check both the tagset.
     $this->assertTrue($this->isElementPresent("token-input-contact_taglist_{$tagSet1}"));
@@ -131,15 +130,14 @@ class WebTest_Contact_TagSetSearchTest extends CiviSeleniumTestCase {
     $this->waitForPageToLoad(2 * $this->getTimeoutMsec());
 
     // Check result.
-    $this->assertTrue($this->isTextPresent("2 Contacts"));
-    $this->assertTrue($this->isTextPresent("Anderson, $contact1"));
-    $this->assertTrue($this->isTextPresent("Anderson, $contact2"));
+    $this->assertElementContainsText('search-status', "2 Contacts");
+    $this->assertElementContainsText('css=.crm-search-results table.selector', "Anderson, $contact1");
+    $this->assertElementContainsText('css=.crm-search-results table.selector', "Anderson, $contact2");
   }
 
   function _testAddTagSet() {
     // Go to add tag set url.
-    $this->open($this->sboxPath . "civicrm/admin/tag?action=add&reset=1&tagset=1");
-    $this->waitForPageToLoad($this->getTimeoutMsec());
+    $this->openCiviPage('admin/tag', 'action=add&reset=1&tagset=1');
 
     // take a tagset name
     $tagSetName = 'tagset_' . substr(sha1(rand()), 0, 7);
@@ -161,7 +159,7 @@ class WebTest_Contact_TagSetSearchTest extends CiviSeleniumTestCase {
     $this->waitForPageToLoad($this->getTimeoutMsec());
 
     // Is status message correct?
-    $this->assertTrue($this->isTextPresent("The tag '$tagSetName' has been saved."));
+    $this->assertElementContainsText('crm-notification-container', "The tag '$tagSetName' has been saved.");
 
     // sort by ID desc
     $this->click("xpath=//table//tr/th[text()=\"ID\"]");