Merge remote-tracking branch 'upstream/4.4' into 4.4-master-2014-04-30-12-58-23
[civicrm-core.git] / tests / phpunit / WebTest / Grant / StandaloneAddTest.php
index fdc4692fd498c5dbfeafc108010dbac53e07d197..07ea8db79af71f6653cce28644aace3c3f2b11a1 100644 (file)
@@ -1,9 +1,9 @@
 <?php
 /*
  +--------------------------------------------------------------------+
- | CiviCRM version 4.3                                                |
+ | CiviCRM version 4.5                                                |
  +--------------------------------------------------------------------+
- | Copyright CiviCRM LLC (c) 2004-2013                                |
+ | Copyright CiviCRM LLC (c) 2004-2014                                |
  +--------------------------------------------------------------------+
  | This file is a part of CiviCRM.                                    |
  |                                                                    |
  +--------------------------------------------------------------------+
 */
 
-
 require_once 'CiviTest/CiviSeleniumTestCase.php';
 class WebTest_Grant_StandaloneAddTest extends CiviSeleniumTestCase {
 
-  protected $captureScreenshotOnFailure = TRUE;
-  protected $screenshotPath = '/tmp/';
-  protected $screenshotUrl = 'http://api.dev.civicrm.org/sc/';
-
   protected function setUp() {
     parent::setUp();
   }
 
   function testStandaloneGrantAdd() {
     // Log in as admin first to verify permissions for CiviGrant
-    $this->webtestLogin(TRUE);
+    $this->webtestLogin('admin');
 
     // Enable CiviGrant module if necessary
     $this->enableComponents("CiviGrant");
@@ -47,10 +42,10 @@ class WebTest_Grant_StandaloneAddTest extends CiviSeleniumTestCase {
     $permission = array('edit-2-access-civigrant', 'edit-2-edit-grants', 'edit-2-delete-in-civigrant');
     $this->changePermissions($permission);
 
-    // Go directly to the URL of the screen that you will be testing (New Contribution-standalone).
-    $this->openCiviPage('grant/add', 'reset=1&context=standalone', '_qf_Grant_upload');
+    // Log in as normal user
+    $this->webtestLogin();
 
-    // Let's start filling the form with values.
+    $this->openCiviPage('grant/add', 'reset=1&context=standalone', '_qf_Grant_upload');
 
     // create new contact using dialog
     $firstName = substr(sha1(rand()), 0, 7);
@@ -90,14 +85,10 @@ class WebTest_Grant_StandaloneAddTest extends CiviSeleniumTestCase {
     $this->type("note", "Grant Note");
 
     // Clicking save.
-    $this->click("_qf_Grant_upload");
-    $this->waitForPageToLoad($this->getTimeoutMsec());
-
-    // verify if Grant is created
-    $this->waitForElementPresent("xpath=//div[@id='Grants']//table//tbody/tr[1]/td[8]/span/a[text()='View']");
+    $this->clickLink("_qf_Grant_upload", "xpath=//div[@class='view-content']//table//tbody/tr[1]/td[8]/span/a[text()='View']", FALSE);
 
     //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");