Merge pull request #3225 from JSProffitt/jcronfix
[civicrm-core.git] / tests / phpunit / WebTest / Grant / CustomFieldsetTest.php
index a0c5ebef4abec5c144ea44b64bf8f0fc1ce4251b..832843f04f3aebea82e8ff098103f9dbc6b7725f 100644 (file)
@@ -1,9 +1,9 @@
 <?php
 /*
  +--------------------------------------------------------------------+
- | CiviCRM version 4.4                                                |
+ | CiviCRM version 4.5                                                |
  +--------------------------------------------------------------------+
- | Copyright CiviCRM LLC (c) 2004-2013                                |
+ | Copyright CiviCRM LLC (c) 2004-2014                                |
  +--------------------------------------------------------------------+
  | This file is a part of CiviCRM.                                    |
  |                                                                    |
@@ -49,13 +49,12 @@ class WebTest_Grant_CustomFieldsetTest extends CiviSeleniumTestCase {
     $rand = substr(sha1(rand()), 0, 7);
 
     // Add new Grant Type
-    $this->openCiviPage('admin/options/grant_type', 'group=grant_type&reset=1');
-    $this->click("css=#grant_type > div.action-link > #new > span");
-    $this->waitForPageToLoad($this->getTimeoutMsec());
+    $this->openCiviPage('admin/options/grant_type', 'reset=1');
+    $this->click("xpath=//*[@id='crm-main-content-wrapper']/div[2]/div[1]/a");
+    $this->waitForElementPresent('_qf_Options_cancel-bottom');
     $grantType = 'GrantType' . $rand;
     $this->type('id=label', $grantType);
     $this->click('id=_qf_Options_next-top');
-    $this->waitForPageToLoad($this->getTimeoutMsec());
     $this->waitForText('crm-notification-container', "The Grant Type '$grantType' has been saved.");
 
     // Create new Custom Field Set that extends the grant type
@@ -77,27 +76,23 @@ class WebTest_Grant_CustomFieldsetTest extends CiviSeleniumTestCase {
     $this->select('id=data_type_0', 'label=Money');
     $this->click('id=_qf_Field_next-bottom');
     $this->waitForPageToLoad($this->getTimeoutMsec());
-    $this->waitForText('crm-notification-container', "Your custom field '$grantField' has been saved.");
+    $this->waitForText('crm-notification-container', "Custom field '$grantField' has been saved.");
 
     // Create new Grant
     $this->openCiviPage('grant/add', 'reset=1&action=add&context=standalone', '_qf_Grant_upload-bottom');
-    $this->select('id=profiles_1', 'label=New Individual');
-    $this->waitForElementPresent('_qf_Edit_next');
     $firstName = 'First' . $rand;
     $lastName = 'Last' . $rand;
-    $this->type('id=first_name', $firstName);
-    $this->type('id=last_name', $lastName);
-    $this->click('id=_qf_Edit_next');
-    $this->select('id=status_id', 'label=Approved');
+    $this->webtestNewDialogContact($firstName, $lastName);
+    $this->select('id=status_id', 'label=Approved for Payment');
     $this->select('id=grant_type_id', "label=$grantType");
     $this->waitForTextPresent($grantField);
-    $this->assertElementContainsText($grantFieldSet, $grantField);
+    $this->assertElementContainsText("xpath=//div[@id='customData']/div[@class='custom-group custom-group-$grantFieldSet crm-accordion-wrapper ']", $grantField);
     $this->type('id=amount_total', '100.00');
-    $this->type("css=div#$grantFieldSet input.form-text", '99.99');
-    $this->clickLink('id=_qf_Grant_upload-bottom', "xpath=//div[@id='Grants']//table/tbody/tr[1]/td[8]/span/a[text()='View']");
+    $this->type("xpath=//div[@id='customData']/div[@class='custom-group custom-group-$grantFieldSet crm-accordion-wrapper ']/div[@class='crm-accordion-body']/table/tbody/tr/td[2]/input[@class='crm-form-text']", '99.99');
+    $this->clickLink('id=_qf_Grant_upload-bottom', "xpath=//div[@class='view-content']//table/tbody/tr[1]/td[8]/span/a[text()='View']");
 
     // Click through to the Grant view screen
-    $this->click("xpath=//div[@id='Grants']//table/tbody/tr[1]/td[8]/span/a[text()='View']");
+    $this->click("xpath=//div[@class='view-content']//table/tbody/tr[1]/td[8]/span/a[text()='View']");
     $this->waitForElementPresent('_qf_GrantView_cancel-bottom');
 
     // verify tabular data for grant view