-- applied patch and made some modifications
authorRavish Nair <ravish@ravish.(none)>
Wed, 6 Mar 2013 16:19:07 +0000 (21:49 +0530)
committerRavish Nair <ravish@ravish.(none)>
Wed, 6 Mar 2013 16:19:07 +0000 (21:49 +0530)
tests/phpunit/WebTest/Admin/MoveCustomDataTest.php
tests/phpunit/WebTest/Admin/RelationshipTypeAddTest.php
tests/phpunit/WebTest/Campaign/ActivityTest.php
tests/phpunit/WebTest/Campaign/CampaignDescriptionTest.php
tests/phpunit/WebTest/Campaign/MailingTest.php
tests/phpunit/WebTest/Campaign/MembershipTest.php
tests/phpunit/WebTest/Campaign/OfflineContributionTest.php

index cf553a6c098a5e8f0bbaa825d4bb8f402f1727ee..6fb88addc4cffb72e558a77e3db6e5b491bd1111 100644 (file)
@@ -108,8 +108,7 @@ class WebTest_Admin_MoveCustomDataTest extends CiviSeleniumTestCase {
     }
 
     //Go to the contacts page and check that the custom field is in the right group
-    $this->open($this->sboxPath . "/civicrm/contact/view?reset=1&cid=" . $cid_all);
-    $this->waitForPageToLoad($this->getTimeoutMsec());
+    $this->openCiviPage('contact/view',"reset=1&cid={$cid_all}");
 
     //load the names of the custom fieldsets
     $source      = $this->webtest_civicrm_api("CustomGroup", "get", array('id' => $from_group_id));
@@ -125,8 +124,7 @@ class WebTest_Admin_MoveCustomDataTest extends CiviSeleniumTestCase {
   //moves a field from one field to another
   function _moveCustomField($field_to_move, $from_group_id, $to_group_id) {
     //go to the move field page
-    $this->open($this->sboxPath . "civicrm/admin/custom/group/field/move?reset=1&fid=" . $field_to_move);
-    $this->waitForPageToLoad($this->getTimeoutMsec());
+    $this->openCiviPage('admin/custom/group/field/move', "reset=1&fid={$field_to_move}");
 
     //select the destination field set from select box
     $this->click("dst_group_id");
@@ -137,15 +135,14 @@ class WebTest_Admin_MoveCustomDataTest extends CiviSeleniumTestCase {
     $this->click("_qf_MoveField_next");
     $this->waitForPageToLoad($this->getTimeoutMsec());
 
-    //asser that the success text is present
-    $this->assertTrue($this->isTextPresent("has been moved"), "Move field success message not displayed");
+    //assert that the success text is present
+    $this->assertElementContainsText('crm-notification-container', "has been moved", "Move field success message not displayed");
 
     //assert that the custom field not on old data set page 
     $this->assertTrue(!$this->isElementPresent("CustomField-" . $field_to_move), "The moved custom field still displays on the old fieldset page");
 
     //go to the destination fieldset and make sure the field is present
-    $this->open($this->sboxPath . "civicrm/admin/custom/group/field?reset=1&action=browse&gid=" . $to_group_id);
-    $this->waitForPageToLoad($this->getTimeoutMsec());
+    $this->openCiviPage('admin/custom/group/field', "reset=1&action=browse&gid={$to_group_id}");
     $this->assertTrue($this->isElementPresent("CustomField-" . $field_to_move), "The moved custom field does not display on the new fieldset page");
   }
 
@@ -212,9 +209,7 @@ class WebTest_Admin_MoveCustomDataTest extends CiviSeleniumTestCase {
   //Creates a custom field group for a specific entity type and returns the custom group Id
   function _createCustomGroup($prefix = "custom", $entity = "Contact") {
     // 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 = $prefix . '_' . substr(sha1(rand()), 0, 7);
@@ -229,7 +224,7 @@ class WebTest_Admin_MoveCustomDataTest 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."), "Group title missing");
+    $this->assertElementContainsText('crm-notification-container', "Your custom field set '{$customGroupTitle}' has been added. You can add custom fields now.", "Group title missing");
 
     $url = $this->parseURL();
     $group_id = $url['queryString']['gid'];
@@ -311,8 +306,7 @@ class WebTest_Admin_MoveCustomDataTest extends CiviSeleniumTestCase {
     }
 
     //Go to the add custom field page for the given group id
-    $this->open($this->sboxPath . "civicrm/admin/custom/group/field/add?action=add&reset=1&gid=" . $group_id);
-    $this->waitForPageToLoad($this->getTimeoutMsec());
+    $this->openCiviPage('admin/custom/group/field/add', "action=add&reset=1&gid={$group_id}");
 
     //Do common setup for all field types
 
@@ -363,7 +357,7 @@ class WebTest_Admin_MoveCustomDataTest extends CiviSeleniumTestCase {
     $this->waitForPageToLoad($this->getTimeoutMsec());
 
     //Is custom field created?
-    $this->assertTrue($this->isTextPresent("Your custom field '$fieldLabel' has been saved."), "Field was not created successfully");
+    $this->assertElementContainsText('crm-notification-container', "Your custom field '$fieldLabel' has been saved.", "Field was not created successfully");    
 
     //get the custom id of the custom field that was just created
     $results = $this->webtest_civicrm_api("CustomField", "get", array('label' => $fieldLabel, 'custom_group_id' => $group_id));
@@ -389,8 +383,7 @@ class WebTest_Admin_MoveCustomDataTest extends CiviSeleniumTestCase {
   //randomly generates data for a specific custom field
   function _fillCustomDataForContact($contact_id, $group_id) {
     //edit the given contact
-    $this->open($this->sboxPath . "civicrm/contact/add?reset=1&action=update&cid=" . $contact_id);
-    $this->waitForPageToLoad($this->getTimeoutMsec());
+    $this->openCiviPage('contact/add', "reset=1&action=update&cid={$contact_id}");   
 
     $this->click("expand");
     $this->waitForElementPresent("address_1_street_address");
@@ -438,7 +431,7 @@ class WebTest_Admin_MoveCustomDataTest extends CiviSeleniumTestCase {
     $this->waitForPageToLoad($this->getTimeoutMsec());
 
     //assert success
-    $this->assertTrue($this->isTextPresent("has been updated"), "Contact Record could not be saved");
+    $this->assertElementContainsText('crm-notification-container', "has been updated", "Contact Record could not be saved");
   }
 }
 
index e3b08a6663f4337d6171834cf762355d567aa55a..cb26c6df133a995f55173508da8889817a13f207 100644 (file)
@@ -42,8 +42,7 @@ class WebTest_Admin_RelationshipTypeAddTest extends CiviSeleniumTestCase {
     $this->waitForPageToLoad($this->getTimeoutMsec());
 
     //jump directly to relationship type selector.
-    $this->open($this->sboxPath . 'civicrm/admin/reltype?reset=1&action=browse');
-    $this->waitForPageToLoad($this->getTimeoutMsec());
+    $this->openCiviPage('admin/reltype', 'reset=1&action=browse');
 
     //load the form to add new relationship type.
     $this->click('link=Add Relationship Type');
@@ -63,7 +62,7 @@ class WebTest_Admin_RelationshipTypeAddTest extends CiviSeleniumTestCase {
     $this->waitForPageToLoad($this->getTimeoutMsec());
 
     //does data saved.
-    $this->assertTrue($this->isTextPresent('The Relationship Type has been saved.'),
+    $this->assertElementContainsText('crm-notification-container', 'The Relationship Type has been saved.',
       "Status message didn't show up after saving!"
     );
 
@@ -75,7 +74,7 @@ class WebTest_Admin_RelationshipTypeAddTest extends CiviSeleniumTestCase {
       'Contact Type B' => 'Individual',
     );
     foreach ($data as $param => $val) {
-      $this->assertTrue($this->isTextPresent($val), "Could not able to save $param");
+      $this->assertElementContainsText('option11', $val, "Could not able to save $param");
     }
   }
 
@@ -89,8 +88,7 @@ class WebTest_Admin_RelationshipTypeAddTest extends CiviSeleniumTestCase {
     $this->waitForPageToLoad($this->getTimeoutMsec());
 
     //jump directly to relationship type selector.
-    $this->open($this->sboxPath . 'civicrm/admin/reltype?reset=1&action=browse');
-    $this->waitForPageToLoad($this->getTimeoutMsec());
+    $this->openCiviPage('admin/reltype', 'reset=1&action=browse');
 
     //validate form rules.
     $this->click('link=Add Relationship Type');
@@ -103,7 +101,7 @@ class WebTest_Admin_RelationshipTypeAddTest extends CiviSeleniumTestCase {
 
     $this->click('_qf_RelationshipType_next-bottom');
     $this->waitForPageToLoad($this->getTimeoutMsec());
-    $this->assertTrue($this->isTextPresent('Relationship Label-A to B is a required field.'),
+    $this->assertElementContainsText('crm-notification-container', 'Relationship Label-A to B is a required field.',
       'Required form rule for Label A - B seems to be broken.'
     );
 
@@ -118,16 +116,16 @@ class WebTest_Admin_RelationshipTypeAddTest extends CiviSeleniumTestCase {
     $this->click('_qf_RelationshipType_next-bottom');
     $this->waitForPageToLoad($this->getTimeoutMsec());
 
-    $this->open($this->sboxPath . 'civicrm/admin/reltype?reset=1&action=browse');
-    $this->waitForPageToLoad($this->getTimeoutMsec());
+    $this->openCiviPage('admin/reltype', 'reset=1&action=browse');
     $this->click('link=Add Relationship Type');
     $this->waitForPageToLoad($this->getTimeoutMsec());
 
     $this->type('label_a_b', $labelAB);
     $this->type('label_b_a', $labelBA);
     $this->click('_qf_RelationshipType_next-bottom');
+
     $this->waitForPageToLoad($this->getTimeoutMsec());
-    $this->assertTrue($this->isTextPresent('Label already exists in Database.'),
+    $this->assertElementContainsText('crm-notification-container', 'Label already exists in Database.',
       'Unique relationship type label form rule seems to be broken.'
     );
   }
index 81d9268b3d2dd62f4f462c766b4c94477413e483..d82f11450dc6b38706988949fa70e4da399206e2 100644 (file)
@@ -36,19 +36,7 @@ class WebTest_Campaign_ActivityTest extends CiviSeleniumTestCase {
     $this->webtestLogin(TRUE);
 
     // Enable CiviCampaign module if necessary
-    $this->open($this->sboxPath . "civicrm/admin/setting/component?reset=1");
-    $this->waitForPageToLoad($this->getTimeoutMsec());
-    $this->waitForElementPresent("_qf_Component_next-bottom");
-    $enabledComponents = $this->getSelectOptions("enableComponents-t");
-    if (!in_array("CiviCampaign", $enabledComponents)) {
-      $this->addSelection("enableComponents-f", "label=CiviCampaign");
-      $this->click("//option[@value='CiviCampaign']");
-      $this->click("add");
-      $this->click("_qf_Component_next-bottom");
-      $this->waitForPageToLoad($this->getTimeoutMsec());
-      sleep(1);
-      $this->assertTrue($this->isTextPresent("Changes Saved."));
-    }
+    $this->enableComponents(array('CiviCampaign'));
 
     // add the required Drupal permission
     $permissions = array('edit-2-administer-civicampaign');
@@ -87,11 +75,7 @@ class WebTest_Campaign_ActivityTest extends CiviSeleniumTestCase {
     $this->waitForPageToLoad($this->getTimeoutMsec());
 
     // Go directly to the URL of the screen that you will be testing
-    $this->open($this->sboxPath . "civicrm/campaign/add?reset=1");
-
-    // As mentioned before, waitForPageToLoad is not always reliable. Below, we're waiting for the submit
-    // button at the end of this page to show up, to make sure it's fully loaded.
-    $this->waitForElementPresent("_qf_Campaign_upload-bottom");
+    $this->openCiviPage('campaign/add', 'reset=1', '_qf_Campaign_upload-bottom');
 
     // Let's start filling the form with values.
     $campaignTitle = "Campaign " . $title;
@@ -118,7 +102,7 @@ class WebTest_Campaign_ActivityTest extends CiviSeleniumTestCase {
     $this->click("_qf_Campaign_upload-bottom");
     $this->waitForPageToLoad($this->getTimeoutMsec());
 
-    $this->assertTrue($this->isTextPresent("Campaign Campaign $title has been saved."),
+    $this->assertElementContainsText('crm-notification-container', "Campaign Campaign $title has been saved.", 
       "Status message didn't show up after saving campaign!"
     );
 
@@ -151,7 +135,7 @@ class WebTest_Campaign_ActivityTest extends CiviSeleniumTestCase {
     // Let's start filling the form with values.
 
     // ...and verifying if the page contains properly formatted display name for chosen contact.
-    $this->assertTrue($this->isTextPresent("Anderson, " . $firstName2), "Contact not found in line " . __LINE__);
+    $this->assertElementContainsText('css=tr.crm-activity-form-block-target_contact_id td ul li.token-input-token-facebook','Anderson, ' . $firstName2, 'Contact not found in line ' . __LINE__);
 
     // Now we're filling the "Assigned To" field.
     // Typing contact's name into the field (using typeKeys(), not type()!)...
@@ -169,7 +153,7 @@ class WebTest_Campaign_ActivityTest extends CiviSeleniumTestCase {
     $this->waitForElementPresent("css=tr.crm-activity-form-block-assignee_contact_id td ul li span.token-input-delete-token-facebook");
 
     // ...and verifying if the page contains properly formatted display name for chosen contact.
-    $this->assertTrue($this->isTextPresent("Summerson, " . $firstName1), "Contact not found in line " . __LINE__);
+    $this->assertElementContainsText('css=tr.crm-activity-form-block-assignee_contact_id td ul li.token-input-token-facebook', 'Summerson, ' . $firstName1, 'Contact not found in line ' . __LINE__);
 
     // Since we're here, let's check if screen help is being displayed properly
     // $this->assertTrue($this->isTextPresent("A copy of this activity will be emailed to each Assignee"));
@@ -217,7 +201,7 @@ class WebTest_Campaign_ActivityTest extends CiviSeleniumTestCase {
     $this->waitForPageToLoad($this->getTimeoutMsec());
 
     // Is status message correct?
-    $this->assertTrue($this->isTextPresent("Activity '$subject' has been saved."), "Status message didn't show up after saving!");
+    $this->assertElementContainsText('crm-notification-container', "Activity '$subject' has been saved.", "Status message didn't show up after saving!");
 
     $this->waitForElementPresent("xpath=//div[@id='Activities']//table/tbody/tr[1]/td[9]/span/a[text()='View']");
 
index f86e957fe2cd64c0c1bfbe14a77fd317975a51e3..aabc19efa9c13f2dae36259dd5eea229951d334c 100644 (file)
@@ -47,25 +47,10 @@ class WebTest_Campaign_CampaignDescriptionTest extends CiviSeleniumTestCase {
     $groupName = $this->WebtestAddGroup();
 
     // Enable CiviCampaign module if necessary
-    $this->open($this->sboxPath . "civicrm/admin/setting/component?reset=1");
-    $this->waitForPageToLoad($this->getTimeoutMsec());
-    $this->waitForElementPresent("_qf_Component_next-bottom");
-    $enabledComponents = $this->getSelectOptions("enableComponents-t");
-    if (!in_array("CiviCampaign", $enabledComponents)) {
-      $this->addSelection("enableComponents-f", "label=CiviCampaign");
-      $this->click("//option[@value='CiviCampaign']");
-      $this->click("add");
-      $this->click("_qf_Component_next-bottom");
-      $this->waitForPageToLoad($this->getTimeoutMsec());
-      $this->assertTrue($this->isTextPresent("Your changes have been saved."));
-    }
+    $this->enableComponents(array('CiviCampaign'));
 
     //Creating a new Campaign
-    $this->open($this->sboxPath . "civicrm/campaign/add?reset=1");
-
-    // As mentioned before, waitForPageToLoad is not always reliable. Below, we're waiting for the submit
-    // button at the end of this page to show up, to make sure it's fully loaded.
-    $this->waitForElementPresent("_qf_Campaign_upload-bottom");
+    $this->openCivipage('campaign/add', 'reset=1', '_qf_Campaign_upload-bottom');
 
     // Let's start filling the form with values.
     $campaignTitle = "Campaign $title";
@@ -93,7 +78,7 @@ class WebTest_Campaign_CampaignDescriptionTest extends CiviSeleniumTestCase {
     $this->click("_qf_Campaign_upload-bottom");
     $this->waitForPageToLoad($this->getTimeoutMsec());
 
-    $this->assertTrue($this->isTextPresent("Campaign Campaign $title has been saved."),
+    $this->assertElementContainsText('crm-notification-container', "Campaign Campaign $title has been saved.",
       "Status message didn't show up after saving campaign!"
     );
 
index 53b2ea97cea06e6848b95623f0353edf444e769b..7c971cbeb9f82a6c6b031dd408b71a3ccd454d0c 100644 (file)
@@ -42,18 +42,7 @@ class WebTest_Campaign_MailingTest extends CiviSeleniumTestCase {
     $this->webtestLogin(TRUE);
 
     // Enable CiviCampaign module if necessary
-    $this->open($this->sboxPath . "civicrm/admin/setting/component?reset=1");
-    $this->waitForPageToLoad($this->getTimeoutMsec());
-    $this->waitForElementPresent("_qf_Component_next-bottom");
-    $enabledComponents = $this->getSelectOptions("enableComponents-t");
-    if (!in_array("CiviCampaign", $enabledComponents)) {
-      $this->addSelection("enableComponents-f", "label=CiviCampaign");
-      $this->click("//option[@value='CiviCampaign']");
-      $this->click("add");
-      $this->click("_qf_Component_next-bottom");
-      $this->waitForPageToLoad($this->getTimeoutMsec());
-      $this->assertTrue($this->isTextPresent("Your changes have been saved."));
-    }
+    $this->enableComponents(array('CiviCampaign'));
 
     // add the required Drupal permission
     $permissions = array('edit-2-administer-civicampaign');
@@ -79,11 +68,7 @@ class WebTest_Campaign_MailingTest extends CiviSeleniumTestCase {
     $this->waitForPageToLoad($this->getTimeoutMsec());
 
     // Go directly to the URL of the screen that you will be testing
-    $this->open($this->sboxPath . "civicrm/campaign/add?reset=1");
-
-    // As mentioned before, waitForPageToLoad is not always reliable. Below, we're waiting for the submit
-    // button at the end of this page to show up, to make sure it's fully loaded.
-    $this->waitForElementPresent("_qf_Campaign_upload-bottom");
+    $this->openCiviPage('campaign/add', 'reset=1', '_qf_Campaign_upload-bottom');
 
     // Let's start filling the form with values.
 
@@ -111,7 +96,7 @@ class WebTest_Campaign_MailingTest extends CiviSeleniumTestCase {
     $this->click("_qf_Campaign_upload-bottom");
     $this->waitForPageToLoad($this->getTimeoutMsec());
 
-    $this->assertTrue($this->isTextPresent("Campaign Campaign $title has been saved."),
+    $this->assertElementContainsText('crm-notification-container', "Campaign Campaign $title has been saved.",
       "Status message didn't show up after saving campaign!"
     );
 
@@ -132,8 +117,7 @@ class WebTest_Campaign_MailingTest extends CiviSeleniumTestCase {
     $this->click("_qf_GroupContact_next");
 
     // configure default mail-box
-    $this->open($this->sboxPath . "civicrm/admin/mailSettings?action=update&id=1&reset=1");
-    $this->waitForElementPresent('_qf_MailSettings_cancel-bottom');
+    $this->openCiviPage('admin/mailSettings', 'action=update&id=1&reset=1', '_qf_MailSettings_cancel-bottom');
     $this->type('name', 'Test Domain');
     $this->type('domain', 'example.com');
     $this->select('protocol', 'value=1');
@@ -141,8 +125,7 @@ class WebTest_Campaign_MailingTest extends CiviSeleniumTestCase {
     $this->waitForPageToLoad($this->getTimeoutMsec());
 
     // Go directly to Schedule and Send Mailing form
-    $this->open($this->sboxPath . "civicrm/mailing/send?reset=1");
-    $this->waitForElementPresent("_qf_Group_cancel");
+    $this->openCiviPage('mailing/send', 'reset=1', '_qf_Group_cancel');
 
     //-------select recipients----------
 
@@ -169,7 +152,7 @@ class WebTest_Campaign_MailingTest extends CiviSeleniumTestCase {
     $this->assertChecked("open_tracking");
 
     // do check count for Recipient
-    $this->assertTrue($this->isTextPresent("Total Recipients: 2"));
+    $this->assertElementContainsText('crm-container', "Total Recipients: 2");
 
     // no need tracking for this test
 
@@ -197,7 +180,7 @@ class WebTest_Campaign_MailingTest extends CiviSeleniumTestCase {
     $this->select("footer_id", "label=Mailing Footer");
 
     // do check count for Recipient
-    $this->assertTrue($this->isTextPresent("Total Recipients: 2"));
+    $this->assertElementContainsText('crm-container', "Total Recipients: 2");
 
     // click next with nominal content
     $this->click("_qf_Upload_upload");
@@ -221,7 +204,7 @@ class WebTest_Campaign_MailingTest extends CiviSeleniumTestCase {
     ////////
 
     // do check count for Recipient
-    $this->assertTrue($this->isTextPresent("Total Recipients: 2"));
+    $this->assertElementContainsText('crm-container', "Total Recipients: 2");
 
     // click next
     $this->click("_qf_Test_next");
@@ -233,7 +216,7 @@ class WebTest_Campaign_MailingTest extends CiviSeleniumTestCase {
     $this->assertChecked("now");
 
     // do check count for Recipient
-    $this->assertTrue($this->isTextPresent("Total Recipients: 2"));
+    $this->assertElementContainsText('crm-container', "Total Recipients: 2");
 
     // finally schedule the mail by clicking submit
     $this->click("_qf_Schedule_next");
@@ -242,8 +225,8 @@ class WebTest_Campaign_MailingTest extends CiviSeleniumTestCase {
     //----------end New Mailing-------------
 
     //check redirected page to Scheduled and Sent Mailings and  verify for mailing name
-    $this->assertTrue($this->isTextPresent("Scheduled and Sent Mailings"));
-    $this->assertTrue($this->isTextPresent("Mailing $mailingName Webtest"));
+    $this->assertElementContainsText('page-title', "Scheduled and Sent Mailings");
+    $this->assertElementContainsText('Search', "Mailing $mailingName Webtest");
 
     //--------- mail delivery verification---------
 
@@ -254,24 +237,23 @@ class WebTest_Campaign_MailingTest extends CiviSeleniumTestCase {
     $this->waitForPageToLoad($this->getTimeoutMsec());
 
     // verify undelivered status message
-    $this->assertTrue($this->isTextPresent("Delivery has not yet begun for this mailing. If the scheduled delivery date and time is past, ask the system administrator or technical support contact for your site to verify that the automated mailer task ('cron job') is running - and how frequently."));
+    $this->assertElementContainsText('crm-container',"Delivery has not yet begun for this mailing. If the scheduled delivery date and time is past, ask the system administrator or technical support contact for your site to verify that the automated mailer task ('cron job') is running - and how frequently.");
 
     // do check for recipient group
-    $this->assertTrue($this->isTextPresent("Members of $groupName"));
+    $this->assertElementContainsText('crm-container', "Members of $groupName");
 
     // directly send schedule mailing -- not working right now
-    $this->open($this->sboxPath . "civicrm/mailing/queue?reset=1");
-    $this->waitForPageToLoad($this->getTimeoutMsec());
+    $this->openCiviPage('mailing/queue', 'reset=1');
 
     //click report link of created mailing
     $this->click("xpath=//table//tbody/tr[td[1]/text()='Mailing $mailingName Webtest']/descendant::a[text()='Report']");
     $this->waitForPageToLoad($this->getTimeoutMsec());
 
     // do check again for recipient group
-    $this->assertTrue($this->isTextPresent("Members of $groupName"));
+    $this->assertElementContainsText('crm-container', "Members of $groupName");
 
     // check for 100% delivery
-    $this->assertTrue($this->isTextPresent("2 (100.00%)"));
+    $this->assertElementContainsText('crm-container', "2 (100.00%)");
 
     // verify intended recipients
     $this->verifyText("xpath=//table//tr[td/a[text()='Intended Recipients']]/descendant::td[2]", preg_quote("2"));
@@ -296,10 +278,10 @@ class WebTest_Campaign_MailingTest extends CiviSeleniumTestCase {
     $this->waitForPageToLoad($this->getTimeoutMsec());
 
     // check for open page
-    $this->assertTrue($this->isTextPresent("Successful Deliveries"));
+    $this->assertElementContainsText('page-title', "Successful Deliveries");
 
     // verify email
-    $this->assertTrue($this->isTextPresent("mailino$firstName@mailson.co.in"));
+    $this->assertElementContainsText('mailing_event', "mailino$firstName@mailson.co.in");
     //------end delivery verification---------
   }
 }
index e53e54255e22026a3cc82d9c4ba692ec9c144b3b..deb0fe0f56bf934cfddc5752390213f27ab7fa5c 100644 (file)
@@ -78,29 +78,14 @@ class WebTest_Campaign_MembershipTest extends CiviSeleniumTestCase {
     $this->waitForPageToLoad($this->getTimeoutMsec());
 
     // Enable CiviCampaign module if necessary
-    $this->open($this->sboxPath . "civicrm/admin/setting/component?reset=1");
-    $this->waitForPageToLoad($this->getTimeoutMsec());
-    $this->waitForElementPresent("_qf_Component_next-bottom");
-    $enabledComponents = $this->getSelectOptions("enableComponents-t");
-    if (!in_array("CiviCampaign", $enabledComponents)) {
-      $this->addSelection("enableComponents-f", "label=CiviCampaign");
-      $this->click("//option[@value='CiviCampaign']");
-      $this->click("add");
-      $this->click("_qf_Component_next-bottom");
-      $this->waitForPageToLoad($this->getTimeoutMsec());
-      $this->assertTrue($this->isTextPresent("Changes Saved."));
-    }
+    $this->enableComponents(array('CiviCampaign'));
 
     // add the required Drupal permission
     $permissions = array('edit-2-administer-civicampaign');
     $this->changePermissions($permissions);
 
     // Go directly to the URL of the screen that you will be testing
-    $this->open($this->sboxPath . "civicrm/campaign/add?reset=1");
-
-    // As mentioned before, waitForPageToLoad is not always reliable. Below, we're waiting for the submit
-    // button at the end of this page to show up, to make sure it's fully loaded.
-    $this->waitForElementPresent("_qf_Campaign_upload-bottom");
+    $this->openCiviPage('campaign/add', 'reset=1', '_qf_Campaign_upload-bottom');
 
     // Let's start filling the form with values.
     $campaignTitle = "Campaign $title";
@@ -127,7 +112,7 @@ class WebTest_Campaign_MembershipTest extends CiviSeleniumTestCase {
     $this->click("_qf_Campaign_upload-bottom");
     $this->waitForPageToLoad($this->getTimeoutMsec());
 
-    $this->assertTrue($this->isTextPresent("Campaign Campaign $title has been saved."),
+    $this->assertElementContainsText('crm-notification-container', "Campaign Campaign $title has been saved.",
       "Status message didn't show up after saving campaign!"
     );
 
index b2396c9f1af62ea0843294403d3d8b2257cc3ab4..d62e7f5312795db7f4c8e796d7548821ebf344b2 100644 (file)
@@ -78,34 +78,21 @@ class WebTest_Campaign_OfflineContributionTest extends CiviSeleniumTestCase {
     $this->waitForPageToLoad($this->getTimeoutMsec());
 
     // Enable CiviCampaign module if necessary
-    $this->open($this->sboxPath . "civicrm/admin/setting/component?reset=1");
-    $this->waitForPageToLoad($this->getTimeoutMsec());
-    $this->waitForElementPresent("_qf_Component_next-bottom");
-    $enabledComponents = $this->getSelectOptions("enableComponents-t");
-    if (!in_array("CiviCampaign", $enabledComponents)) {
-      $this->addSelection("enableComponents-f", "label=CiviCampaign");
-      $this->click("//option[@value='CiviCampaign']");
-      $this->click("add");
-      $this->click("_qf_Component_next-bottom");
-      $this->waitForPageToLoad($this->getTimeoutMsec());
-      $this->assertTrue($this->isTextPresent("Changes Saved."));
-    }
+    $this->enableComponents(array('CiviCampaign'));
 
     // add the required Drupal permission
     $permissions = array('edit-2-administer-civicampaign');
     $this->changePermissions($permissions);
 
-    $this->open($this->sboxPath . 'civicrm/campaign?reset=1');
-    $this->waitForElementPresent("link=Add Campaign");
+    $this->openCiviPage('campaign', 'reset=1', "link=Add Campaign");
     if ($this->isTextPresent('No campaigns found.')) {
       // Go directly to the URL of the screen that you will be testing (Register Participant for Event-standalone).
-      $this->open($this->sboxPath . "civicrm/contribute/add?reset=1&action=add&context=standalone");
-      $this->waitForElementPresent("_qf_Contribution_cancel-bottom");
-      $this->assertTrue($this->isTextPresent('There are currently no active Campaigns.'));
+      $this->openCiviPage('contribute/add', 'reset=1&action=add&context=standalone', '_qf_Contribution_cancel-bottom');
+      $this->assertElementContainsText('crm-container', 'There are currently no active Campaigns.');
     }
 
     // Go directly to the URL of the screen that you will be testing
-    $this->open($this->sboxPath . "civicrm/campaign/add?reset=1");
+    $this->openCiviPage('campaign/add', 'reset=1');
 
     // As mentioned before, waitForPageToLoad is not always reliable. Below, we're waiting for the submit
     // button at the end of this page to show up, to make sure it's fully loaded.
@@ -135,7 +122,7 @@ class WebTest_Campaign_OfflineContributionTest extends CiviSeleniumTestCase {
     $this->click("_qf_Campaign_upload-bottom");
     $this->waitForPageToLoad($this->getTimeoutMsec());
 
-    $this->assertTrue($this->isTextPresent("Campaign $campaignTitle has been saved."),
+    $this->assertElementContainsText('crm-notification-container', "Campaign $campaignTitle has been saved.",
       "Status message didn't show up after saving campaign!"
     );
 
@@ -234,7 +221,7 @@ class WebTest_Campaign_OfflineContributionTest extends CiviSeleniumTestCase {
     $this->waitForPageToLoad($this->getTimeoutMsec());
 
     // Is status message correct?
-    $this->assertTrue($this->isTextPresent("The contribution record has been saved"));
+    $this->assertElementContainsText('crm-notification-container', "The contribution record has been saved");
 
     $this->waitForElementPresent("xpath=//div[@id='Contributions']//table/tbody/tr/td[8]/span/a[text()='View']");
 
@@ -247,8 +234,7 @@ class WebTest_Campaign_OfflineContributionTest extends CiviSeleniumTestCase {
 
     if ($past) {
       // when campaign component is disabled
-      $this->open($this->sboxPath . 'civicrm/admin/setting/component?reset=1');
-      $this->waitForElementPresent("_qf_Component_next-bottom");
+      $this->openCiviPage('admin/setting/component', 'reset=1', '_qf_Component_next-bottom');
       $this->addSelection("enableComponents-t", "label=CiviCampaign");
       $this->click("//option[@value='CiviCampaign']");
       $this->click("remove");
@@ -256,8 +242,7 @@ class WebTest_Campaign_OfflineContributionTest extends CiviSeleniumTestCase {
       $this->waitForPageToLoad($this->getTimeoutMsec());
       $this->assertTrue($this->isTextPresent("Changes Saved."));
 
-      $this->open($this->sboxPath . 'civicrm/contribute/search?reset=1');
-      $this->waitForElementPresent("_qf_Search_refresh");
+      $this->openCiviPage('contribute/search', 'reset=1', '_qf_Search_refresh');      
 
       $this->type('sort_name', $firstName);
       $this->click("_qf_Search_refresh");
@@ -270,11 +255,7 @@ class WebTest_Campaign_OfflineContributionTest extends CiviSeleniumTestCase {
 
   function pastCampaignsTest($groupName) {
     // Go directly to the URL of the screen that you will be testing
-    $this->open($this->sboxPath . "civicrm/campaign/add?reset=1");
-
-    // As mentioned before, waitForPageToLoad is not always reliable. Below, we're waiting for the submit
-    // button at the end of this page to show up, to make sure it's fully loaded.
-    $this->waitForElementPresent("_qf_Campaign_upload-bottom");
+    $this->openCiviPage('campaign/add', 'reset=1', '_qf_Campaign_upload-bottom');
 
     // Let's start filling the form with values.
     $pastTitle = substr(sha1(rand()), 0, 7);