mirror of
https://github.com/moodle/moodle.git
synced 2025-04-20 07:56:06 +02:00
MDL-66332 tool_capability: adding acceptance tests
This commit is contained in:
parent
e96bbb53af
commit
178be88e97
104
admin/tool/capability/tests/behat/show_capabilies.feature
Normal file
104
admin/tool/capability/tests/behat/show_capabilies.feature
Normal file
@ -0,0 +1,104 @@
|
||||
@tool @tool_capability
|
||||
Feature: show capabilities for selected roles
|
||||
In order to check roles capabilities
|
||||
As an admin
|
||||
I need to be able to customize capabilities report viewing only specific roles and capabilities
|
||||
|
||||
Background:
|
||||
Given the following "roles" exist:
|
||||
| shortname | name | archetype |
|
||||
| studenteq | Studenteq | student |
|
||||
| studentdf | Studentdf | student |
|
||||
And the following "permission overrides" exist:
|
||||
| capability | permission | role | contextlevel | reference |
|
||||
| moodle/course:changefullname | Allow | studentdf | System | |
|
||||
| moodle/course:changeshortname | Prohibit | studentdf | System | |
|
||||
| moodle/course:changeidnumber | Prevent | studentdf | System | |
|
||||
And I log in as "admin"
|
||||
And I navigate to "Users > Permissions > Capability overview" in site administration
|
||||
|
||||
Scenario: visualize capabilities table with a limited number of capabilities
|
||||
When I set the following fields to these values:
|
||||
| Capability: | moodle/course:changefullname, moodle/course:changeshortname |
|
||||
| Roles: | Studentdf |
|
||||
And I click on "Get the overview" "button"
|
||||
Then I should see "moodle/course:changefullname" in the "comparisontable" "table"
|
||||
And I should see "moodle/course:changeshortname" in the "comparisontable" "table"
|
||||
And I should not see "moodle/course:changecategory" in the "comparisontable" "table"
|
||||
|
||||
Scenario: visualize an allow capability
|
||||
When I set the following fields to these values:
|
||||
| Capability: | moodle/course:changefullname |
|
||||
| Roles: | Studentdf |
|
||||
And I click on "Get the overview" "button"
|
||||
Then I should see "Allow" in the "comparisontable" "table"
|
||||
And I should not see "Prevent" in the "comparisontable" "table"
|
||||
And I should not see "Prohibit" in the "comparisontable" "table"
|
||||
And I should not see "Not set" in the "comparisontable" "table"
|
||||
|
||||
Scenario: visualize a prohibit capability
|
||||
When I set the following fields to these values:
|
||||
| Capability: | moodle/course:changeshortname |
|
||||
| Roles: | Studentdf |
|
||||
And I click on "Get the overview" "button"
|
||||
Then I should not see "Allow" in the "comparisontable" "table"
|
||||
And I should not see "Prevent" in the "comparisontable" "table"
|
||||
And I should see "Prohibit" in the "comparisontable" "table"
|
||||
And I should not see "Not set" in the "comparisontable" "table"
|
||||
|
||||
Scenario: visualize a not set capability
|
||||
When I set the following fields to these values:
|
||||
| Capability: | moodle/course:changecategory |
|
||||
| Roles: | Studentdf |
|
||||
And I click on "Get the overview" "button"
|
||||
Then I should not see "Allow" in the "comparisontable" "table"
|
||||
And I should not see "Prevent" in the "comparisontable" "table"
|
||||
And I should not see "Prohibit" in the "comparisontable" "table"
|
||||
And I should see "Not set" in the "comparisontable" "table"
|
||||
|
||||
Scenario: visualize more than one role
|
||||
When I set the following fields to these values:
|
||||
| Capability: | moodle/course:changecategory |
|
||||
| Roles: | Student, Studentdf |
|
||||
And I click on "Get the overview" "button"
|
||||
Then I should see "Student" in the "comparisontable" "table"
|
||||
And I should see "Studentdf" in the "comparisontable" "table"
|
||||
And I should not see "Teacher" in the "comparisontable" "table"
|
||||
|
||||
Scenario: visualize all roles without selecting any role
|
||||
When I set the following fields to these values:
|
||||
| Capability: | moodle/course:changecategory |
|
||||
And I click on "Get the overview" "button"
|
||||
Then I should see "Student" in the "comparisontable" "table"
|
||||
And I should see "Studentdf" in the "comparisontable" "table"
|
||||
And I should see "Teacher" in the "comparisontable" "table"
|
||||
|
||||
Scenario: visualize all roles by selecting All option
|
||||
When I set the following fields to these values:
|
||||
| Capability: | moodle/course:changecategory |
|
||||
| Roles: | All |
|
||||
And I click on "Get the overview" "button"
|
||||
Then I should see "Student" in the "comparisontable" "table"
|
||||
And I should see "Studentdf" in the "comparisontable" "table"
|
||||
And I should see "Teacher" in the "comparisontable" "table"
|
||||
|
||||
@javascript
|
||||
Scenario: filter capability list using javascript
|
||||
Given I should see "moodle/site:config" in the "Capability" "field"
|
||||
And I should see "moodle/course:change" in the "Capability" "field"
|
||||
When I wait until the page is ready
|
||||
And I set the field "capabilitysearch" to "moodle/course:change"
|
||||
Then I should see "moodle/course:change" in the "Capability" "field"
|
||||
And I should not see "moodle/site:config" in the "Capability" "field"
|
||||
|
||||
@javascript
|
||||
Scenario: selecting capabilities using filters
|
||||
Given I should see "moodle/course:change" in the "Capability" "field"
|
||||
When I wait until the page is ready
|
||||
And I set the field "capabilitysearch" to "moodle/course:change"
|
||||
When I set the following fields to these values:
|
||||
| Capability: | moodle/course:changecategory |
|
||||
| Roles: | Student |
|
||||
And I set the field "capabilitysearch" to ""
|
||||
And I click on "Get the overview" "button"
|
||||
Then I should see "moodle/course:changecategory" in the "comparisontable" "table"
|
67
admin/tool/capability/tests/behat/show_differences.feature
Normal file
67
admin/tool/capability/tests/behat/show_differences.feature
Normal file
@ -0,0 +1,67 @@
|
||||
@tool @tool_capability
|
||||
Feature: show only differences between roles for selected capabilities
|
||||
In order to check roles capabilities
|
||||
As an admin
|
||||
I need to be able to filter capabilities report viewing only role differences
|
||||
|
||||
Background:
|
||||
Given the following "roles" exist:
|
||||
| shortname | name | archetype |
|
||||
| studenteq | Studenteq | student |
|
||||
| studentdf | Studentdf | student |
|
||||
And the following "permission overrides" exist:
|
||||
| capability | permission | role | contextlevel | reference |
|
||||
| moodle/course:changefullname | Allow | studentdf | System | |
|
||||
| moodle/course:changeshortname | Prohibit | studentdf | System | |
|
||||
And I log in as "admin"
|
||||
And I navigate to "Users > Permissions > Capability overview" in site administration
|
||||
|
||||
Scenario: Compare identical roles
|
||||
When I set the following fields to these values:
|
||||
| Capability: | moodle/course:changefullname, moodle/course:changeshortname, moodle/course:changeidnumber, moodle/course:changesummary |
|
||||
| Roles: | Student, Studenteq |
|
||||
And I set the field "Show differences only" to "1"
|
||||
And I click on "Get the overview" "button"
|
||||
Then I should see "There are no differences to show between selected roles in this context"
|
||||
|
||||
Scenario: Compare different roles
|
||||
When I set the following fields to these values:
|
||||
| Capability: | moodle/course:changefullname, moodle/course:changeshortname, moodle/course:changeidnumber, moodle/course:changesummary |
|
||||
| Roles: | Student, Studentdf |
|
||||
And I set the field "Show differences only" to "1"
|
||||
And I click on "Get the overview" "button"
|
||||
Then I should not see "There are no differences to show between selected roles in this context"
|
||||
And I should see "moodle/course:changefullname" in the "comparisontable" "table"
|
||||
And I should see "moodle/course:changeshortname" in the "comparisontable" "table"
|
||||
And I should not see "moodle/course:changesummary" in the "comparisontable" "table"
|
||||
|
||||
Scenario: Compare different roles but comparing capabilities that are equals on both
|
||||
When I set the following fields to these values:
|
||||
| Capability: | moodle/course:changeidnumber, moodle/course:changesummary |
|
||||
| Roles: | Student, Studentdf |
|
||||
And I set the field "Show differences only" to "1"
|
||||
And I click on "Get the overview" "button"
|
||||
Then I should see "There are no differences to show between selected roles in this context"
|
||||
|
||||
Scenario: Compare all roles without selecting specific role
|
||||
When I set the following fields to these values:
|
||||
| Capability: | moodle/course:changefullname, moodle/site:config |
|
||||
And I set the field "Show differences only" to "1"
|
||||
And I click on "Get the overview" "button"
|
||||
Then I should not see "moodle/site:config" in the "comparisontable" "table"
|
||||
And I should see "moodle/course:changefullname" in the "comparisontable" "table"
|
||||
|
||||
Scenario: Compare all roles without selecting specific role on not defined capability
|
||||
When I set the following fields to these values:
|
||||
| Capability: | moodle/site:config |
|
||||
And I set the field "Show differences only" to "1"
|
||||
And I click on "Get the overview" "button"
|
||||
Then I should see "There are no differences to show between selected roles in this context"
|
||||
|
||||
Scenario: Comparing only one role
|
||||
When I set the following fields to these values:
|
||||
| Capability: | moodle/course:changefullname, moodle/course:changeshortname, moodle/course:changeidnumber, moodle/course:changesummary |
|
||||
| Roles: | Student |
|
||||
And I set the field "Show differences only" to "1"
|
||||
And I click on "Get the overview" "button"
|
||||
Then I should see "There are no differences to show between selected roles in this context"
|
@ -76,7 +76,7 @@ SEARCH.prototype = {
|
||||
this.button = this.form.all('input[type=submit]');
|
||||
this.lastsearch = this.form.one('input[name=search]');
|
||||
|
||||
var div = Y.Node.create('<div id="capabilitysearchui"></div>'),
|
||||
var div = Y.Node.create('<div id="capabilitysearchui" data-fieldtype="text"></div>'),
|
||||
label = Y.Node.create('<label for="capabilitysearch">' + this.get('strsearch') + '</label>');
|
||||
this.input = Y.Node.create('<input type="text" id="capabilitysearch" />');
|
||||
|
||||
|
@ -1 +1 @@
|
||||
YUI.add("moodle-tool_capability-search",function(e,t){var n=function(){n.superclass.constructor.apply(this,arguments)};n.prototype={form:null,select:null,selectoptions:{},input:null,button:null,lastsearch:null,initializer:function(){this.form=e.one("#capability-overview-form"),this.select=this.form.one("select[data-search=capability]"),this.select.setStyle("minWidth",this.select.get("offsetWidth")),this.select.get("options").each(function(e){var t=e.get("value");this.selectoptions[t]=e},this),this.button=this.form.all("input[type=submit]"),this.lastsearch=this.form.one("input[name=search]");var t=e.Node.create('<div id="capabilitysearchui"></div>'),n=e.Node.create('<label for="capabilitysearch">'+this.get("strsearch")+"</label>");this.input=e.Node.create('<input type="text" id="capabilitysearch" />'),t.append(n).append(this.input),this.select.insert(t,"before"),this.input.on("keyup",this.typed,this),this.select.on("change",this.validate,this),this.lastsearch&&(this.input.set("value",this.lastsearch.get("value")),this.typed(),this.select.one("option[selected]")&&this.select.set("scrollTop",this.select.one("option[selected]").get("getX"))),this.validate()},validate:function(){this.button.set("disabled",this.select.get("value")==="")},typed:function(){var e=this.input.get("value"),t=0,n=null,r;this.lastsearch&&this.lastsearch.set("value",e),this.select.all("option").remove();for(r in this.selectoptions)r.indexOf(e)>=0&&(t++,n=this.selectoptions[r],this.select.append(this.selectoptions[r]));t===0?this.input.addClass("error"):(this.input.removeClass("error"),t===1&&n.set("selected",!0)),this.validate()}},e.extend(n,e.Base,n.prototype,{NAME:"tool_capability-search",ATTRS:{strsearch:{}}}),M.tool_capability=M.tool_capability||{},M.tool_capability.init_capability_search=function(e){new n(e)}},"@VERSION@",{requires:["base","node"]});
|
||||
YUI.add("moodle-tool_capability-search",function(e,t){var n=function(){n.superclass.constructor.apply(this,arguments)};n.prototype={form:null,select:null,selectoptions:{},input:null,button:null,lastsearch:null,initializer:function(){this.form=e.one("#capability-overview-form"),this.select=this.form.one("select[data-search=capability]"),this.select.setStyle("minWidth",this.select.get("offsetWidth")),this.select.get("options").each(function(e){var t=e.get("value");this.selectoptions[t]=e},this),this.button=this.form.all("input[type=submit]"),this.lastsearch=this.form.one("input[name=search]");var t=e.Node.create('<div id="capabilitysearchui" data-fieldtype="text"></div>'),n=e.Node.create('<label for="capabilitysearch">'+this.get("strsearch")+"</label>");this.input=e.Node.create('<input type="text" id="capabilitysearch" />'),t.append(n).append(this.input),this.select.insert(t,"before"),this.input.on("keyup",this.typed,this),this.select.on("change",this.validate,this),this.lastsearch&&(this.input.set("value",this.lastsearch.get("value")),this.typed(),this.select.one("option[selected]")&&this.select.set("scrollTop",this.select.one("option[selected]").get("getX"))),this.validate()},validate:function(){this.button.set("disabled",this.select.get("value")==="")},typed:function(){var e=this.input.get("value"),t=0,n=null,r;this.lastsearch&&this.lastsearch.set("value",e),this.select.all("option").remove();for(r in this.selectoptions)r.indexOf(e)>=0&&(t++,n=this.selectoptions[r],this.select.append(this.selectoptions[r]));t===0?this.input.addClass("error"):(this.input.removeClass("error"),t===1&&n.set("selected",!0)),this.validate()}},e.extend(n,e.Base,n.prototype,{NAME:"tool_capability-search",ATTRS:{strsearch:{}}}),M.tool_capability=M.tool_capability||{},M.tool_capability.init_capability_search=function(e){new n(e)}},"@VERSION@",{requires:["base","node"]});
|
||||
|
@ -76,7 +76,7 @@ SEARCH.prototype = {
|
||||
this.button = this.form.all('input[type=submit]');
|
||||
this.lastsearch = this.form.one('input[name=search]');
|
||||
|
||||
var div = Y.Node.create('<div id="capabilitysearchui"></div>'),
|
||||
var div = Y.Node.create('<div id="capabilitysearchui" data-fieldtype="text"></div>'),
|
||||
label = Y.Node.create('<label for="capabilitysearch">' + this.get('strsearch') + '</label>');
|
||||
this.input = Y.Node.create('<input type="text" id="capabilitysearch" />');
|
||||
|
||||
|
@ -74,7 +74,7 @@ SEARCH.prototype = {
|
||||
this.button = this.form.all('input[type=submit]');
|
||||
this.lastsearch = this.form.one('input[name=search]');
|
||||
|
||||
var div = Y.Node.create('<div id="capabilitysearchui"></div>'),
|
||||
var div = Y.Node.create('<div id="capabilitysearchui" data-fieldtype="text"></div>'),
|
||||
label = Y.Node.create('<label for="capabilitysearch">' + this.get('strsearch') + '</label>');
|
||||
this.input = Y.Node.create('<input type="text" id="capabilitysearch" />');
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user