Proyectos de Subversion Moodle

Rev

| Ultima modificación | Ver Log |

Rev Autor Línea Nro. Línea
1 efrain 1
@tool @tool_behat
2
Feature: Edit capabilities
3
  In order to extend and restrict moodle features
4
  As an admin or a teacher
5
  I need to allow/deny the existing capabilities at different levels
6
 
7
  Background:
8
    Given the following "users" exist:
9
      | username | firstname | lastname  |
10
      | teacher1 | Teacher   | 1         |
11
      | tutor    | Teaching  | Assistant |
12
      | student  | Student   | One       |
13
    And the following "courses" exist:
14
      | fullname | shortname |
15
      | Course 1 | C1        |
16
    And the following "course enrolments" exist:
17
      | user     | course | role           |
18
      | teacher1 | C1     | editingteacher |
19
      | tutor    | C1     | teacher        |
20
      | student  | C1     | student        |
21
 
22
  Scenario: Default system capabilities modification
23
    Given I log in as "admin"
24
    And I navigate to "Users > Permissions > Define roles" in site administration
25
    And I click on "Edit Teacher role" "link"
26
    And I fill the capabilities form with the following permissions:
27
      | capability | permission |
28
      | block/mnet_hosts:myaddinstance | Allow |
29
      | moodle/site:messageanyuser | Inherit |
30
      | moodle/grade:managesharedforms | Prevent |
31
      | moodle/course:request | Prohibit |
32
    And I press "Save changes"
33
    When I follow "Edit Teacher role"
34
    Then "block/mnet_hosts:myaddinstance" capability has "Allow" permission
35
    And "moodle/site:messageanyuser" capability has "Not set" permission
36
    And "moodle/grade:managesharedforms" capability has "Prevent" permission
37
    And "moodle/course:request" capability has "Prohibit" permission
38
 
39
  Scenario: Course capabilities overrides
40
    Given I log in as "teacher1"
41
    And I am on the "Course 1" "permissions" page
42
    And I override the system permissions of "Student" role with:
43
      | mod/forum:deleteanypost | Prohibit |
44
      | mod/forum:editanypost | Prevent |
45
      | mod/forum:addquestion | Allow |
46
    When I set the field "Advanced role override" to "Student (3)"
47
    # There are two select elements and go buttons and we want to press the second one.
48
    And I click on "//div[@class='advancedoverride']/div/form/noscript/input" "xpath_element"
49
    Then "mod/forum:deleteanypost" capability has "Prohibit" permission
50
    And "mod/forum:editanypost" capability has "Prevent" permission
51
    And "mod/forum:addquestion" capability has "Allow" permission
52
 
53
  Scenario: Module capabilities overrides
54
    Given the following "activity" exists:
55
      | activity | forum                |
56
      | course   | C1                   |
57
      | idnumber | 00001                |
58
      | name     | I'm the name         |
59
    And I am on the "I'm the name" "forum activity" page logged in as teacher1
60
    And I navigate to "Permissions" in current page administration
61
    And I override the system permissions of "Student" role with:
62
      | mod/forum:deleteanypost | Prohibit |
63
      | mod/forum:editanypost | Prevent |
64
      | mod/forum:addquestion | Allow |
65
    When I set the field "Advanced role override" to "Student (3)"
66
    And I click on "//div[@class='advancedoverride']/div/form/noscript/input" "xpath_element"
67
    Then "mod/forum:deleteanypost" capability has "Prohibit" permission
68
    And "mod/forum:editanypost" capability has "Prevent" permission
69
    And "mod/forum:addquestion" capability has "Allow" permission
70
 
71
  @javascript
72
  Scenario: Edit permissions escapes role names correctly
73
    When I am on the "Course 1" "renameroles" page logged in as "admin"
74
    And I set the following fields to these values:
75
      | Your word for 'Teacher'             | Teacher >= editing  |
76
      | Your word for 'Non-editing teacher' | Teacher < "editing" |
77
      | Your word for 'Student'             | Studier & 'learner' |
78
    And I press "Save"
79
    And I navigate to course participants
80
    Then I should see "Teacher >= editing (Teacher)" in the "Teacher 1" "table_row"
81
    And I should see "Teacher < \"editing\" (Non-editing teacher)" in the "Teaching Assistant" "table_row"
82
    And I should see "Studier & 'learner' (Student)" in the "Student One" "table_row"
83
    And I am on the "C1" "permissions" page
84
    And I should see "Teacher >= editing (Teacher)" in the "mod/forum:replypost" "table_row"
85
    And I should see "Teacher < \"editing\" (Non-editing teacher)" in the "mod/forum:replypost" "table_row"
86
    And I should see "Studier & 'learner' (Student)" in the "mod/forum:replypost" "table_row"
87
    And I follow "Prohibit"
88
    And "Teacher >= editing (Teacher)" "button" in the "Prohibit role" "dialogue" should be visible
89
    And "Teacher < \"editing\" (Non-editing teacher)" "button" in the "Prohibit role" "dialogue" should be visible
90
    And "Studier & 'learner' (Student)" "button" in the "Prohibit role" "dialogue" should be visible