Merge pull request #9664 from konadave/CRM-19853
[civicrm-core.git] / tests / phpunit / WebTest / Admin / CustomAddTestSameField.php
index c892cfe9fdfd7669ad4a912ddf3621c125bf1055..7739c2316c0ea37486acc09babb5656679f28048 100644 (file)
@@ -1,9 +1,9 @@
 <?php
 /*
  +--------------------------------------------------------------------+
- | CiviCRM version 4.5                                                |
+ | CiviCRM version 4.7                                                |
  +--------------------------------------------------------------------+
- | Copyright CiviCRM LLC (c) 2004-2014                                |
+ | Copyright CiviCRM LLC (c) 2004-2017                                |
  +--------------------------------------------------------------------+
  | This file is a part of CiviCRM.                                    |
  |                                                                    |
@@ -22,7 +22,7 @@
  | GNU Affero General Public License or the licensing of CiviCRM,     |
  | see the CiviCRM license FAQ at http://civicrm.org/licensing        |
  +--------------------------------------------------------------------+
-*/
+ */
 
 
 require_once 'CiviTest/CiviSeleniumTestCase.php';
@@ -36,7 +36,7 @@ class WebTest_Admin_CustomAddTestSameField extends CiviSeleniumTestCase {
     parent::setUp();
   }
 
-  function testCustomSameFieldAdd() {
+  public function testCustomSameFieldAdd() {
     $this->open($this->sboxPath);
     $this->webtestLogin();
 
@@ -44,7 +44,7 @@ class WebTest_Admin_CustomAddTestSameField extends CiviSeleniumTestCase {
     $this->_testCustomAdd();
   }
 
-  function _testCustomAdd() {
+  public function _testCustomAdd() {
     //CRM-7564 : Different gropus can contain same custom fields
     $this->open($this->sboxPath . "civicrm/admin/custom/group?action=add&reset=1");
     $this->waitForPageToLoad($this->getTimeoutMsec());
@@ -69,6 +69,7 @@ class WebTest_Admin_CustomAddTestSameField extends CiviSeleniumTestCase {
     $this->openCiviPage('admin/custom/group/field/add', "reset=1&action=add&gid=$gid");
     $textFieldLabel = 'test_text_field';
     $this->click("header");
+    $this->waitForElementPresent('label');
     $this->type("label", $textFieldLabel);
     $this->click("_qf_Field_next_new-bottom");
     $this->waitForPageToLoad($this->getTimeoutMsec());
@@ -80,6 +81,7 @@ class WebTest_Admin_CustomAddTestSameField extends CiviSeleniumTestCase {
     $this->click("//option[@value='CheckBox']");
 
     $checkboxFieldLabel = 'test_checkbox';
+    $this->waitForElementPresent('label');
     $this->type("label", $checkboxFieldLabel);
     $checkboxOptionLabel1 = 'check1';
     $this->type("option_label_1", $checkboxOptionLabel1);
@@ -117,6 +119,7 @@ class WebTest_Admin_CustomAddTestSameField extends CiviSeleniumTestCase {
     //add custom field - alphanumeric text
     $textFieldLabel = 'test_text_field';
     $this->click("header");
+    $this->waitForElementPresent('label');
     $this->type("label", $textFieldLabel);
     $this->clickLink("_qf_Field_next_new-bottom");
 
@@ -139,6 +142,7 @@ class WebTest_Admin_CustomAddTestSameField extends CiviSeleniumTestCase {
     $this->click("//option[@value='Radio']");
 
     $radioFieldLabel = 'test_radio';
+    $this->waitForElementPresent('label');
     $this->type("label", $radioFieldLabel);
     $radioOptionLabel1 = 'radio1';
     $this->type("option_label_1", $radioOptionLabel1);
@@ -166,5 +170,5 @@ class WebTest_Admin_CustomAddTestSameField extends CiviSeleniumTestCase {
     $this->waitForText('crm-notification-container', "Custom field '$radioFieldLabel' has been saved.");
 
   }
-}
 
+}