| 1 | efrain | 1 | @core @core_course
 | 
        
           |  |  | 2 | Feature: Restrict activities availability
 | 
        
           |  |  | 3 |   In order to prevent the use of some activities
 | 
        
           |  |  | 4 |   As an admin
 | 
        
           |  |  | 5 |   I need to control which activities can be used in courses
 | 
        
           |  |  | 6 |   | 
        
           |  |  | 7 |   Background:
 | 
        
           |  |  | 8 |     Given the following "users" exist:
 | 
        
           |  |  | 9 |       | username | firstname | lastname | email |
 | 
        
           |  |  | 10 |       | teacher1 | Teacher | 1 | teacher1@example.com |
 | 
        
           |  |  | 11 |     And the following "courses" exist:
 | 
        
           |  |  | 12 |       | fullname | shortname | category | format |
 | 
        
           |  |  | 13 |       | Course 1 | C1 | 0 | topics |
 | 
        
           |  |  | 14 |     And the following "course enrolments" exist:
 | 
        
           |  |  | 15 |       | user | course | role |
 | 
        
           |  |  | 16 |       | teacher1 | C1 | editingteacher |
 | 
        
           |  |  | 17 |     And the following "activities" exist:
 | 
        
           |  |  | 18 |       | activity | course | name             |
 | 
        
           |  |  | 19 |       | assign   | C1     | Test assign name |
 | 
        
           |  |  | 20 |   | 
        
           |  |  | 21 |   Scenario: Activities can be added with the default permissions
 | 
        
           |  |  | 22 |     Given I log in as "teacher1"
 | 
        
           |  |  | 23 |     When I add a glossary activity to course "Course 1" section "1" and I fill the form with:
 | 
        
           |  |  | 24 |       | Name | Test glossary name |
 | 
        
           |  |  | 25 |       | Description | Test glossary description |
 | 
        
           |  |  | 26 |     Then I should see "Test glossary name"
 | 
        
           |  |  | 27 |     And I should see "Test assign name"
 | 
        
           |  |  | 28 |   | 
        
           |  |  | 29 |   @javascript @skip_chrome_zerosize
 | 
        
           |  |  | 30 |   Scenario: Activities can not be added when the admin restricts the permissions
 | 
        
           |  |  | 31 |     Given the following "role capability" exists:
 | 
        
           |  |  | 32 |       | role                 | editingteacher  |
 | 
        
           |  |  | 33 |       | mod/assign:addinstance | prohibit        |
 | 
        
           |  |  | 34 |     And I log in as "admin"
 | 
        
           |  |  | 35 |     And I am on the "Course 1" "permissions" page
 | 
        
           |  |  | 36 |     And I override the system permissions of "Teacher" role with:
 | 
        
           |  |  | 37 |       | mod/glossary:addinstance | Prohibit |
 | 
        
           |  |  | 38 |     And I log out
 | 
        
           |  |  | 39 |     And I log in as "teacher1"
 | 
        
           |  |  | 40 |     When I am on "Course 1" course homepage with editing mode on
 | 
        
           |  |  | 41 |     And I click on "Add an activity or resource" "button" in the "New section" "section"
 | 
        
           |  |  | 42 |     Then "Add a new Assignment" "link" should not exist in the "Add an activity or resource" "dialogue"
 | 
        
           |  |  | 43 |     Then "Add a new Glossary" "link" should not exist in the "Add an activity or resource" "dialogue"
 |