3 +--------------------------------------------------------------------+
4 | CiviCRM version 4.5 |
5 +--------------------------------------------------------------------+
6 | Copyright CiviCRM LLC (c) 2004-2014 |
7 +--------------------------------------------------------------------+
8 | This file is a part of CiviCRM. |
10 | CiviCRM is free software; you can copy, modify, and distribute it |
11 | under the terms of the GNU Affero General Public License |
12 | Version 3, 19 November 2007 and the CiviCRM Licensing Exception. |
14 | CiviCRM is distributed in the hope that it will be useful, but |
15 | WITHOUT ANY WARRANTY; without even the implied warranty of |
16 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. |
17 | See the GNU Affero General Public License for more details. |
19 | You should have received a copy of the GNU Affero General Public |
20 | License along with this program; if not, contact CiviCRM LLC |
21 | at info[AT]civicrm[DOT]org. If you have questions about the |
22 | GNU Affero General Public License or the licensing of CiviCRM, |
23 | see the CiviCRM license FAQ at http://civicrm.org/licensing |
24 +--------------------------------------------------------------------+
27 require_once 'CiviTest/CiviSeleniumTestCase.php';
28 class WebTest_Grant_StandaloneAddTest
extends CiviSeleniumTestCase
{
30 protected function setUp() {
34 function testStandaloneGrantAdd() {
35 // Log in as admin first to verify permissions for CiviGrant
36 $this->webtestLogin('admin');
38 // Enable CiviGrant module if necessary
39 $this->enableComponents("CiviGrant");
41 // let's give full CiviGrant permissions to demo user (registered user).
42 $permission = array('edit-2-access-civigrant', 'edit-2-edit-grants', 'edit-2-delete-in-civigrant');
43 $this->changePermissions($permission);
45 // Log in as normal user
46 $this->webtestLogin();
48 $this->openCiviPage('grant/add', 'reset=1&context=standalone', '_qf_Grant_upload');
50 // create new contact using dialog
51 $firstName = substr(sha1(rand()), 0, 7);
52 $this->webtestNewDialogContact($firstName, "Grantor", $firstName . "@example.com");
54 // select grant Status
55 $this->select("status_id", "value=1");
58 $this->select("grant_type_id", "value=1");
61 $this->type("amount_total", "100");
64 $this->type("amount_requested", "100");
67 $this->type("amount_granted", "90");
69 // fill in application received Date
70 $this->webtestFillDate('application_received_date');
72 // fill in decision Date
73 $this->webtestFillDate('decision_date');
75 // fill in money transfered date
76 $this->webtestFillDate('money_transfer_date');
78 // fill in grant due Date
79 $this->webtestFillDate('grant_due_date');
81 // check grant report recieved.
82 $this->check("grant_report_received");
85 $this->type("note", "Grant Note");
88 $this->clickLink("_qf_Grant_upload", "xpath=//div[@id='Grants']//table//tbody/tr[1]/td[8]/span/a[text()='View']");
90 //click through to the Grant view screen
91 $this->click("xpath=//div[@id='Grants']//table/tbody/tr[1]/td[8]/span/a[text()='View']");
93 $this->waitForElementPresent("_qf_GrantView_cancel-bottom");
96 'Grant Status' => 'Submitted',
97 'Grant Type' => 'Emergency',
98 'Amount Requested' => '$ 100.00',
99 'Amount Granted' => '$ 90.00',
100 'Notes' => 'Grant Note',
103 $this->webtestVerifyTabularData($expected);