<?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_Report_RolePermissionReportTest extends CiviSeleniumTestCase {
}
function testRolePermissionReport() {
- // This is the path where our testing install resides.
- // The rest of URL is defined in CiviSeleniumTestCase base class, in
- // class attributes.
- $this->open($this->sboxPath);
-
- // Logging in. Remember to wait for page to load. In most cases,
- // you can rely on 30000 as the value that allows your test to pass, however,
- // sometimes your test might fail because of this. In such cases, it's better to pick one element
- // somewhere at the end of page and use waitForElementPresent on it - this assures you, that whole
- // page contents loaded and you can continue your test execution.
- $this->webtestLogin(TRUE);
+ $this->webtestLogin('admin');
//create new roles
$role1 = 'role1' . substr(sha1(rand()), 0, 7);
$user1 = $this->_testCreateUser($roleId1);
$user2 = $this->_testCreateUser($roleId2);
- $this->open($this->sboxPath . "user/logout");
- $this->waitForPageToLoad($this->getTimeoutMsec());
// let's give full CiviReport permissions.
$permissions = array(
$this->click("add");
$this->click("_qf_Summary_submit_save");
$this->waitForPageToLoad($this->getTimeoutMsec());
- $this->openCiviPage('logout', 'reset=1', NULL);
- $this->open($this->sboxPath);
- $this->waitForElementPresent('edit-submit');
- $this->type('edit-name', $user2);
- $this->type('edit-pass', 'Test12345');
- $this->click('edit-submit');
- $this->waitForPageToLoad($this->getTimeoutMsec());
+ $this->webtestLogin($user2, 'Test12345');
$this->openCiviPage('report/instance/1', 'reset=1');
$this->assertElementContainsText('crm-container', 'You do not have permission to access this report.');
$this->openCiviPage('report/list', 'reset=1');
- $this->openCiviPage('logout', 'reset=1', NULL);
//delete roles
- $this->webtestLogin(TRUE);
+ $this->webtestLogin('admin');
$this->open($this->sboxPath . "admin/people/permissions/roles");
$this->_roleDelete($role1);
$this->_roleDelete($role2);
*check for CRM-10148
*/
function testReservedReportPermission() {
- // This is the path where our testing install resides.
- // The rest of URL is defined in CiviSeleniumTestCase base class, in
- // class attributes.
- $this->open($this->sboxPath);
-
- // Logging in. Remember to wait for page to load. In most cases,
- // you can rely on 30000 as the value that allows your test to pass, however,
- // sometimes your test might fail because of this. In such cases, it's better to pick one element
- // somewhere at the end of page and use waitForElementPresent on it - this assures you, that whole
- // page contents loaded and you can continue your test execution.
- $this->webtestLogin(TRUE);
+ $this->webtestLogin('admin');
//create new role
$role = 'role' . substr(sha1(rand()), 0, 7);
);
$this->changePermissions($permissions);
- $this->openCiviPage('logout', 'reset=1', NULL);
- $this->open($this->sboxPath);
- $this->waitForElementPresent('edit-submit');
- $this->type('edit-name', $user);
- $this->type('edit-pass', 'Test12345');
- $this->click('edit-submit');
- $this->waitForPageToLoad($this->getTimeoutMsec());
+ $this->webtestLogin($user, 'Test12345');
$this->openCiviPage('report/instance/1', 'reset=1');
//check if the reserved report field is frozen
$this->assertTrue($this->isElementPresent("xpath=//div[@id='instanceForm']//table[3]/tbody//tr/td[2]/tt[text()='[ ]']"));
- $this->openCiviPage('logout', 'reset=1', NULL);
- $this->open($this->sboxPath);
- $this->webtestLogin(TRUE);
// let's give full CiviReport permissions.
$permissions = array(
"edit-{$roleId}-access-civireport",
$this->click("_qf_Summary_submit_save");
$this->waitForPageToLoad($this->getTimeoutMsec());
- $this->openCiviPage('logout', 'reset=1', NULL);
- $this->open($this->sboxPath);
- $this->waitForElementPresent('edit-submit');
- $this->type('edit-name', $user);
- $this->type('edit-pass', 'Test12345');
- $this->click('edit-submit');
- $this->waitForPageToLoad($this->getTimeoutMsec());
+ $this->webtestLogin($user, 'Test12345');
$this->openCiviPage('report/instance/1', 'reset=1');
//check if the report criteria and settings is accessible
$this->assertTrue($this->isElementPresent("xpath=//form[@id='Summary']//div[@id='instanceForm']/table//input[@id='title']"));
//login as admin and remove reserved permission
- $this->openCiviPage('logout', 'reset=1', NULL);
- $this->open($this->sboxPath);
- $this->webtestLogin(TRUE);
+ $this->webtestLogin('admin');
$this->open($this->sboxPath . "admin/people/permissions");
$this->waitForElementPresent("edit-submit");
$this->waitForPageToLoad($this->getTimeoutMsec());
//login as user and check for absence of report criteria and settings
- $this->openCiviPage('logout', 'reset=1', NULL);
- $this->open($this->sboxPath);
- $this->waitForElementPresent('edit-submit');
- $this->type('edit-name', $user);
- $this->type('edit-pass', 'Test12345');
- $this->click('edit-submit');
- $this->waitForPageToLoad($this->getTimeoutMsec());
+ $this->webtestLogin($user, 'Test12345');
$this->openCiviPage('report/instance/1', 'reset=1');
if ($this->isElementPresent("xpath=//form[@id='Summary']/div[2]/div/div/div")) {
$this->assertFalse($this->isElementPresent("xpath=//form[@id='Summary']//div[@id='instanceForm']//input[@id='title']"));
//login as admin and turn the is_reserved flag off for the instance
- $this->openCiviPage('logout', 'reset=1', NULL);
- $this->open($this->sboxPath);
- $this->webtestLogin(TRUE);
+ $this->webtestLogin('admin');
$this->openCiviPage('report/instance/1', 'reset=1');
$this->click("is_reserved");
$this->click("_qf_Summary_submit_save");
$this->waitForPageToLoad($this->getTimeoutMsec());
- $this->openCiviPage('logout', 'reset=1', NULL);
- $this->open($this->sboxPath);
- $this->waitForElementPresent('edit-submit');
- $this->type('edit-name', $user);
- $this->type('edit-pass', 'Test12345');
- $this->click('edit-submit');
- $this->waitForPageToLoad($this->getTimeoutMsec());
+ $this->webtestLogin($user, 'Test12345');
$this->openCiviPage('report/instance/1', 'reset=1');
$this->assertTrue($this->isElementPresent("xpath=//form[@id='Summary']//div[@id='id_default']//input[@id='fields_email']"));
$this->assertTrue($this->isElementPresent("xpath=//form[@id='Summary']//div[@id='instanceForm']//input[@id='title']"));
//login as admin and delete the role
- $this->openCiviPage('logout', 'reset=1', NULL);
- $this->open($this->sboxPath);
- $this->webtestLogin(TRUE);
+ $this->webtestLogin('admin');
$this->open($this->sboxPath . "admin/people/permissions/roles");
$this->_roleDelete($role);
}
function _testCreateUser($roleid) {
- // Go directly to the URL of the screen that will Create User Authentically.
$this->open($this->sboxPath . "admin/people/create");
$this->waitForElementPresent("edit-submit");
$this->waitForPageToLoad($this->getTimeoutMsec());
return $name;
}
-}
\ No newline at end of file
+}