mirror of
https://github.com/silverstripe/silverstripe-framework
synced 2024-10-22 12:05:37 +00:00
Merge pull request #2832 from mateusz/behat-permissions
Behat permissions
This commit is contained in:
commit
0e9868adfe
@ -124,6 +124,22 @@ class CmsUiContext extends BehatContext {
|
|||||||
return $table_element;
|
return $table_element;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Finds the first visible GridField table.
|
||||||
|
*/
|
||||||
|
protected function getFirstGridFieldTable() {
|
||||||
|
$page = $this->getSession()->getPage();
|
||||||
|
$tableElements = $page->findAll('css', '.ss-gridfield-table');
|
||||||
|
assertNotNull($tableElements, 'Table elements not found');
|
||||||
|
|
||||||
|
// Return first found table.
|
||||||
|
foreach($tableElements as $table) {
|
||||||
|
if($table->isVisible()) return $table;
|
||||||
|
}
|
||||||
|
|
||||||
|
assertNotNull(null, 'First visible table element not found');
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @Given /^I should see a "([^"]*)" button in CMS Content Toolbar$/
|
* @Given /^I should see a "([^"]*)" button in CMS Content Toolbar$/
|
||||||
*/
|
*/
|
||||||
@ -233,6 +249,20 @@ class CmsUiContext extends BehatContext {
|
|||||||
$element->click();
|
$element->click();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Clicks on a row in the first found visible GridField table.
|
||||||
|
* Example: I click on "New Zealand" in the table
|
||||||
|
*
|
||||||
|
* @Given /^I click on "([^"]*)" in the table$/
|
||||||
|
*/
|
||||||
|
public function iClickOnInTheFirstTable($text) {
|
||||||
|
$table_element = $this->getFirstGridFieldTable();
|
||||||
|
|
||||||
|
$element = $table_element->find('xpath', sprintf('//*[count(*)=0 and contains(.,"%s")]', $text));
|
||||||
|
assertNotNull($element, sprintf('Element containing `%s` not found', $text));
|
||||||
|
$element->click();
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @Then /^I can see the preview panel$/
|
* @Then /^I can see the preview panel$/
|
||||||
*/
|
*/
|
||||||
|
85
tests/behat/features/security-permissions.feature
Normal file
85
tests/behat/features/security-permissions.feature
Normal file
@ -0,0 +1,85 @@
|
|||||||
|
@javascript
|
||||||
|
Feature: Manage Security Permissions for Groups
|
||||||
|
As a site administrator
|
||||||
|
I want to control my user's security permissions in an intuitive way
|
||||||
|
So that I can easily control access to the CMS
|
||||||
|
|
||||||
|
Background:
|
||||||
|
Given a "group" "test group"
|
||||||
|
And a "member" "ADMIN" belonging to "ADMIN Group" with "Email"="admin@test.com"
|
||||||
|
And the "group" "ADMIN group" has permissions "Full administrative rights"
|
||||||
|
And I am logged in with "ADMIN" permissions
|
||||||
|
And I go to "/admin/security"
|
||||||
|
And I click the "Groups" CMS tab
|
||||||
|
And I click on "test group" in the table
|
||||||
|
And I click the "Permissions" CMS tab
|
||||||
|
|
||||||
|
Scenario: I can see sub-permissions being properly set and restored when using "Access to all CMS sections"
|
||||||
|
When I check "Access to all CMS sections"
|
||||||
|
Then the "Access to 'Security' section" checkbox should be checked
|
||||||
|
And the "Access to 'Security' section" field should be disabled
|
||||||
|
|
||||||
|
When I uncheck "Access to all CMS sections"
|
||||||
|
Then the "Access to 'Security' section" checkbox should not be checked
|
||||||
|
And the "Access to 'Security' section" field should be enabled
|
||||||
|
|
||||||
|
When I check "Access to 'Security' section"
|
||||||
|
And I check "Access to all CMS sections"
|
||||||
|
When I uncheck "Access to all CMS sections"
|
||||||
|
Then the "Access to 'Security' section" checkbox should be checked
|
||||||
|
|
||||||
|
# Save so the driver can reset without having to deal with the popup alert.
|
||||||
|
Then I press the "Save" button
|
||||||
|
|
||||||
|
Scenario: I can see sub-permissions being properly set and restored when using "Full administrative rights"
|
||||||
|
When I check "Access to 'Security' section"
|
||||||
|
And I check "Full administrative rights"
|
||||||
|
Then the "Access to all CMS sections" checkbox should be checked
|
||||||
|
And the "Access to all CMS sections" field should be disabled
|
||||||
|
And the "Access to 'Security' section" checkbox should be checked
|
||||||
|
And the "Access to 'Security' section" field should be disabled
|
||||||
|
|
||||||
|
And I uncheck "Full administrative rights"
|
||||||
|
Then the "Access to all CMS sections" checkbox should not be checked
|
||||||
|
And the "Access to all CMS sections" field should be enabled
|
||||||
|
And the "Access to 'Security' section" checkbox should be checked
|
||||||
|
And the "Access to 'Security' section" field should be enabled
|
||||||
|
|
||||||
|
# Save so the driver can reset without having to deal with the popup alert.
|
||||||
|
Then I press the "Save" button
|
||||||
|
|
||||||
|
Scenario: I can see sub-permissions being handled properly between reloads when using "Full administrative rights"
|
||||||
|
When I check "Full administrative rights"
|
||||||
|
And I press the "Save" button
|
||||||
|
And I click the "Permissions" CMS tab
|
||||||
|
Then the "Full administrative rights" checkbox should be checked
|
||||||
|
And the "Access to 'Security' section" checkbox should be checked
|
||||||
|
And the "Access to 'Security' section" field should be disabled
|
||||||
|
|
||||||
|
When I uncheck "Full administrative rights"
|
||||||
|
Then the "Access to 'Security' section" checkbox should not be checked
|
||||||
|
And the "Access to 'Security' section" field should be enabled
|
||||||
|
|
||||||
|
When I press the "Save" button
|
||||||
|
And I click the "Permissions" CMS tab
|
||||||
|
Then the "Full administrative rights" checkbox should not be checked
|
||||||
|
And the "Access to 'Security' section" checkbox should not be checked
|
||||||
|
And the "Access to 'Security' section" field should be enabled
|
||||||
|
|
||||||
|
Scenario: I can see sub-permissions being handled properly between reloads when using "Access to all CMS sections"
|
||||||
|
When I check "Access to all CMS sections"
|
||||||
|
And I press the "Save" button
|
||||||
|
And I click the "Permissions" CMS tab
|
||||||
|
Then the "Access to all CMS sections" checkbox should be checked
|
||||||
|
And the "Access to 'Security' section" checkbox should be checked
|
||||||
|
And the "Access to 'Security' section" field should be disabled
|
||||||
|
|
||||||
|
When I uncheck "Access to all CMS sections"
|
||||||
|
Then the "Access to 'Security' section" checkbox should not be checked
|
||||||
|
And the "Access to 'Security' section" field should be enabled
|
||||||
|
|
||||||
|
When I press the "Save" button
|
||||||
|
And I click the "Permissions" CMS tab
|
||||||
|
Then the "Access to all CMS sections" checkbox should not be checked
|
||||||
|
And the "Access to 'Security' section" checkbox should not be checked
|
||||||
|
And the "Access to 'Security' section" field should be enabled
|
Loading…
x
Reference in New Issue
Block a user