Change messages to wait instead of assert
[civicrm-core.git] / tests / phpunit / WebTest / Contact / AddTest.php
index 7828ecc157f05f6da5fdb7b2e83d7d98c4ba9da6..254e6f5327efc6b0a8712dd8b957d61836e6ab25 100644 (file)
@@ -24,7 +24,6 @@
  +--------------------------------------------------------------------+
 */
 
-
 require_once 'CiviTest/CiviSeleniumTestCase.php';
 class WebTest_Contact_AddTest extends CiviSeleniumTestCase {
 
@@ -35,7 +34,6 @@ class WebTest_Contact_AddTest extends CiviSeleniumTestCase {
   function testIndividualAdd() {
     $this->webtestLogin();
 
-    // Go directly to the URL of the screen that you will be testing (New Individual).
     $this->WebtestAddGroup();
 
     // go to display preferences to enable Open ID field
@@ -102,7 +100,8 @@ class WebTest_Contact_AddTest extends CiviSeleniumTestCase {
     $this->click("address_1_country_id");
     $this->select("address_1_country_id", "value=" . $this->webtestGetValidCountryID());
 
-    if($this->assertElementContainsText('address_1', "Latitude")) {    
+    if($this->assertElementContainsText('address_1', "Latitude")) {
+
       $this->type("address_1_geo_code_1", "1234");
       $this->type("address_1_geo_code_2", "5678");
     }
@@ -165,7 +164,7 @@ class WebTest_Contact_AddTest extends CiviSeleniumTestCase {
     $this->click("_qf_Contact_upload_view");
 
     $this->waitForPageToLoad($this->getTimeoutMsec());
-    $this->assertElementContainsText('crm-notification-container', "Contact Saved");
+    $this->waitForText('crm-notification-container', "Contact Saved");
   }
 
   function testHouseholdAdd() {
@@ -177,7 +176,6 @@ class WebTest_Contact_AddTest extends CiviSeleniumTestCase {
     $this->click("_qf_Display_next-bottom");
     $this->waitForPageToLoad($this->getTimeoutMsec());
 
-    // Go directly to the URL of the screen that you will be testing (New Household).
     $this->openCiviPage('contact/add', "reset=1&ct=Household");
 
     //contact details section
@@ -198,7 +196,6 @@ class WebTest_Contact_AddTest extends CiviSeleniumTestCase {
     $this->type("phone_1_phone", "444-4444");
     $this->select("phone_1_phone_type_id", "value=" . $this->webtestGetFirstValueForOptionGroup('phone_type'));
 
-
     //fill in IM
     $this->assertElementContainsText('im_1_provider_id', "Yahoo MSN AIM GTalk Jabber Skype");
     $this->type("im_1_name", "testSkype");
@@ -257,7 +254,6 @@ class WebTest_Contact_AddTest extends CiviSeleniumTestCase {
     $this->waitForElementPresent("preferred_language");
     $this->select("preferred_language", "value=fr_FR");
 
-
     //Notes section
     $this->click("notesBlock");
     $this->waitForElementPresent("subject");
@@ -272,7 +268,7 @@ class WebTest_Contact_AddTest extends CiviSeleniumTestCase {
     $this->click("_qf_Contact_upload_view");
     $this->waitForPageToLoad($this->getTimeoutMsec());
 
-    $this->assertElementContainsText('crm-notification-container', "Contact Saved");
+    $this->waitForText('crm-notification-container', "Contact Saved");
   }
 
   function testOrganizationAdd() {
@@ -283,7 +279,7 @@ class WebTest_Contact_AddTest extends CiviSeleniumTestCase {
     $this->check("xpath=//ul[@id='contactEditBlocks']//li/span[2]/label[text()='Open ID']/../input");
     $this->click("_qf_Display_next-bottom");
     $this->waitForPageToLoad($this->getTimeoutMsec());
-    // Go directly to the URL of the screen that you will be testing (New Organization).
+
     $this->openCiviPage('contact/add', 'reset=1&ct=Organization');
 
     //contact details section
@@ -371,13 +367,12 @@ class WebTest_Contact_AddTest extends CiviSeleniumTestCase {
     $this->click("_qf_Contact_upload_view");
     $this->waitForPageToLoad($this->getTimeoutMsec());
 
-    $this->assertElementContainsText('crm-notification-container', "Contact Saved");
+    $this->waitForText('crm-notification-container', "Contact Saved");
   }
 
   function testIndividualAddWithSharedAddress() {
     $this->webtestLogin();
 
-    // Go directly to the URL of the screen that you will be testing (New Individual).
     $this->openCiviPage('contact/add', "reset=1&ct=Individual");
 
     //contact details section
@@ -433,9 +428,7 @@ class WebTest_Contact_AddTest extends CiviSeleniumTestCase {
     $this->click("_qf_Edit_next");
 
     // Is new contact created?
-    $this->assertElementContainsText('crm-notification-container', "$currentEmployer has been created.",
-      "Status message didn't show up after saving!"
-    );
+    $this->waitForText('crm-notification-container', "$currentEmployer has been created.");
 
     //make sure shared address is selected
     $this->waitForElementPresent('selected_shared_address-1');
@@ -465,9 +458,7 @@ class WebTest_Contact_AddTest extends CiviSeleniumTestCase {
     $this->click("_qf_Edit_next");
 
     // Is new contact created?
-    $this->assertElementContainsText('crm-notification-container', "$sharedHousehold has been created.",
-      "Status message didn't show up after saving!"
-    );
+    $this->waitForText('crm-notification-container', "$sharedHousehold has been created.");
 
     //make sure shared address is selected
     $this->waitForElementPresent('selected_shared_address-2');
@@ -476,7 +467,7 @@ class WebTest_Contact_AddTest extends CiviSeleniumTestCase {
     $this->click("_qf_Contact_upload_view");
     $this->waitForPageToLoad($this->getTimeoutMsec());
     $name = $this->getText("xpath=//div[@class='crm-summary-display_name']");
-    $this->assertElementContainsText('crm-notification-container',  "$name has been created.");
+    $this->waitForText('crm-notification-container',  "$name has been created.");
 
     //make sure current employer is set
     $this->verifyText("xpath=id('contactinfo-block')/div/div/div[2]/div", 'Employer');
@@ -494,4 +485,3 @@ class WebTest_Contact_AddTest extends CiviSeleniumTestCase {
   }
 }
 
-