Change messages to wait instead of assert
[civicrm-core.git] / tests / phpunit / WebTest / Contact / AddTest.php
index f37cc787d5ca96f799bc6ac14276c0daf0986cfc..254e6f5327efc6b0a8712dd8b957d61836e6ab25 100644 (file)
@@ -24,7 +24,6 @@
  +--------------------------------------------------------------------+
 */
 
-
 require_once 'CiviTest/CiviSeleniumTestCase.php';
 class WebTest_Contact_AddTest extends CiviSeleniumTestCase {
 
@@ -101,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");
     }
@@ -164,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() {
@@ -196,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");
@@ -255,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");
@@ -270,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() {
@@ -369,7 +367,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 testIndividualAddWithSharedAddress() {
@@ -430,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');
@@ -462,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');
@@ -473,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');
@@ -491,4 +485,3 @@ class WebTest_Contact_AddTest extends CiviSeleniumTestCase {
   }
 }
 
-