MDL-68661 core_lang: Roll back addresourceoractivity
[moodle.git] / course / tests / behat / restrict_available_activities.feature
CommitLineData
550d842e 1@core @core_course
4b528dae
DM
2Feature: Restrict activities availability
3 In order to prevent the use of some activities
5d7b6307 4 As an admin
4b528dae
DM
5 I need to control which activities can be used in courses
6
7 Background:
759b323e 8 Given the following "users" exist:
4b528dae 9 | username | firstname | lastname | email |
0fe86bbd 10 | teacher1 | Teacher | 1 | teacher1@example.com |
759b323e 11 And the following "courses" exist:
4b528dae
DM
12 | fullname | shortname | category | format |
13 | Course 1 | C1 | 0 | topics |
759b323e 14 And the following "course enrolments" exist:
4b528dae
DM
15 | user | course | role |
16 | teacher1 | C1 | editingteacher |
17
18 @javascript
19 Scenario: Activities can be added with the default permissions
20 Given I log in as "teacher1"
fdeeaff9 21 And I am on "Course 1" course homepage with editing mode on
4d40089d 22 When I add a "Glossary" to section "1" and I fill the form with:
4b528dae
DM
23 | Name | Test glossary name |
24 | Description | Test glossary description |
4d40089d 25 And I add a "Chat" to section "1" and I fill the form with:
4b528dae
DM
26 | Name of this chat room | Test chat name |
27 | Description | Test chat description |
28 Then I should see "Test glossary name"
29 And I should see "Test chat name"
30
4b528dae
DM
31 Scenario: Activities can not be added when the admin restricts the permissions
32 Given I log in as "admin"
33 And I set the following system permissions of "Teacher" role:
34 | mod/chat:addinstance | Prohibit |
fdeeaff9 35 And I am on "Course 1" course homepage
e5287f9b 36 And I navigate to "Users > Permissions" in current page administration
4b528dae
DM
37 And I override the system permissions of "Teacher" role with:
38 | mod/glossary:addinstance | Prohibit |
39 And I log out
40 And I log in as "teacher1"
fdeeaff9 41 When I am on "Course 1" course homepage with editing mode on
7f864552 42 Then the "Add a resource to section 'Topic 1'" select box should not contain "Chat"
4b528dae 43 Then the "Add an activity to section 'Topic 1'" select box should not contain "Glossary"