<?php
/*
+--------------------------------------------------------------------+
- | CiviCRM version 4.4 |
+ | CiviCRM version 4.7 |
+--------------------------------------------------------------------+
- | Copyright CiviCRM LLC (c) 2004-2013 |
+ | Copyright CiviCRM LLC (c) 2004-2015 |
+--------------------------------------------------------------------+
| This file is a part of CiviCRM. |
| |
| 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';
+
+/**
+ * Class WebTest_Grant_CustomFieldsetTest
+ */
class WebTest_Grant_CustomFieldsetTest extends CiviSeleniumTestCase {
protected function setUp() {
parent::setUp();
}
- function testCustomFieldsetTest() {
+ public function testCustomFieldsetTest() {
// Log in as admin first to verify permissions for CiviGrant
$this->webtestLogin('admin');
// Add new Grant Type
$this->openCiviPage('admin/options/grant_type', 'reset=1');
- $this->click("css=#grant_type > div.action-link > #new > span");
- $this->waitForPageToLoad($this->getTimeoutMsec());
+ $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
$this->select('id=extends_0', 'label=Grants');
$this->addSelection('id=extends_1', "label=$grantType");
$this->click('id=collapse_display');
- $this->click('id=_qf_Group_next-bottom');
- $this->waitForElementPresent('_qf_Field_next-bottom');
+ $this->clickLink('id=_qf_Group_next-bottom');
$this->waitForText('crm-notification-container', "Your custom field set '$grantFieldSet' has been added.");
+ $this->waitForElementPresent('_qf_Field_done-bottom');
// Add field to fieldset
$grantField = 'GrantField' . $rand;
$this->type('id=label', $grantField);
$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->click('id=_qf_Field_done-bottom');
+ $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');
+ $contact = $this->createDialogContact();
+ $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
$this->webtestVerifyTabularData(array(
- 'Name' => "$firstName $lastName",
- 'Grant Status' => 'Approved',
- 'Grant Type' => $grantType,
- $grantField => '$ 99.99',
- )
+ 'Name' => $contact['display_name'],
+ 'Grant Status' => 'Approved',
+ 'Grant Type' => $grantType,
+ $grantField => '$ 99.99',
+ )
);
}
- function testAjaxCustomGroupLoad() {
+ public function testAjaxCustomGroupLoad() {
$this->webtestLogin();
// Enable CiviGrant module if necessary
$triggerElement = array('name' => 'grant_type_id', 'type' => 'select');
$customSets = array(
array('entity' => 'Grant', 'subEntity' => 'Emergency', 'triggerElement' => $triggerElement),
- array('entity' => 'Grant', 'subEntity' => 'Family Support', 'triggerElement' => $triggerElement)
+ array('entity' => 'Grant', 'subEntity' => 'Family Support', 'triggerElement' => $triggerElement),
);
$pageUrl = array('url' => 'grant/add', 'args' => 'reset=1&action=add&context=standalone');
$this->customFieldSetLoadOnTheFlyCheck($customSets, $pageUrl);
}
+
}