1 |
efrain |
1 |
@core @core_courseformat @show_editor
|
|
|
2 |
Feature: Verify edit utils availability
|
|
|
3 |
In order to edit the course activities
|
|
|
4 |
As a student with capability 'moodle/course:manageactivities'
|
|
|
5 |
I need to be able to use the edit utils.
|
|
|
6 |
|
|
|
7 |
Background:
|
|
|
8 |
Given the following "course" exists:
|
|
|
9 |
| fullname | Course 1 |
|
|
|
10 |
| shortname | C1 |
|
|
|
11 |
| category | 0 |
|
|
|
12 |
| numsections | 3 |
|
|
|
13 |
| initsections | 1 |
|
|
|
14 |
And the following "activities" exist:
|
|
|
15 |
| activity | name | intro | course | idnumber | section |
|
|
|
16 |
| assign | Activity sample 1 | Test assignment description | C1 | sample1 | 1 |
|
|
|
17 |
And the following "users" exist:
|
|
|
18 |
| username | firstname | lastname | email |
|
|
|
19 |
| teacher1 | Teacher | 1 | teacher1@example.com |
|
|
|
20 |
| student1 | Student | 1 | student1@example.com |
|
|
|
21 |
| author1 | Author | 1 | author1@example.com |
|
|
|
22 |
And the following "roles" exist:
|
|
|
23 |
| shortname | name | archetype |
|
|
|
24 |
| author | Author | student |
|
|
|
25 |
And the following "permission overrides" exist:
|
|
|
26 |
| capability | permission | role | contextlevel | reference |
|
|
|
27 |
| moodle/course:manageactivities | Allow | author | Course | C1 |
|
|
|
28 |
And the following "course enrolments" exist:
|
|
|
29 |
| user | course | role |
|
|
|
30 |
| teacher1 | C1 | editingteacher |
|
|
|
31 |
| author1 | C1 | author |
|
|
|
32 |
| student1 | C1 | student |
|
|
|
33 |
|
|
|
34 |
@javascript
|
|
|
35 |
Scenario: Edit tools should be available to teachers.
|
|
|
36 |
Given I log in as "teacher1"
|
|
|
37 |
When I am on "Course 1" course homepage
|
|
|
38 |
And I turn editing mode on
|
|
|
39 |
Then I should see "Add an activity or resource"
|
|
|
40 |
And I open "Activity sample 1" actions menu
|
|
|
41 |
And I should see "Edit settings"
|
|
|
42 |
And ".section_action_menu" "css_element" should exist in the "Section 1" "section"
|
|
|
43 |
And I click on ".section_action_menu" "css_element" in the "Section 1" "section"
|
|
|
44 |
And I should see "Edit settings"
|
|
|
45 |
|
|
|
46 |
@javascript
|
|
|
47 |
Scenario: Edit mode should not be available to students.
|
|
|
48 |
Given I log in as "student1"
|
|
|
49 |
When I am on "Course 1" course homepage
|
|
|
50 |
Then I should not see "Edit mode"
|
|
|
51 |
|
|
|
52 |
@javascript
|
|
|
53 |
Scenario: Edit tools should be available to students with manageactivities capability but not allowed to add sections without course:update
|
|
|
54 |
Given I log in as "author1"
|
|
|
55 |
When I am on "Course 1" course homepage
|
|
|
56 |
And I turn editing mode on
|
|
|
57 |
Then I should see "Add an activity or resource"
|
|
|
58 |
But I should not see "Add section"
|
|
|
59 |
And I open "Activity sample 1" actions menu
|
|
|
60 |
And I should see "Edit settings"
|
|
|
61 |
And I open section "1" edit menu
|
|
|
62 |
And I should not see "Edit settings"
|
|
|
63 |
And I should see "View"
|
|
|
64 |
|
|
|
65 |
@javascript
|
|
|
66 |
Scenario: Section adding should be available to students if they also have the capability 'moodle/course:update'.
|
|
|
67 |
Given the following "permission overrides" exist:
|
|
|
68 |
| capability | permission | role | contextlevel | reference |
|
|
|
69 |
| moodle/course:update | Allow | author | Course | C1 |
|
|
|
70 |
And I log in as "author1"
|
|
|
71 |
When I am on "Course 1" course homepage
|
|
|
72 |
And I turn editing mode on
|
|
|
73 |
Then I should see "Add an activity or resource"
|
|
|
74 |
And I should see "Add section"
|
|
|
75 |
And I open "Activity sample 1" actions menu
|
|
|
76 |
And I should see "Edit settings"
|
|
|
77 |
And ".section_action_menu" "css_element" should exist in the "Section 1" "section"
|
|
|
78 |
And I click on ".section_action_menu" "css_element" in the "Section 1" "section"
|
|
|
79 |
And I should see "Edit settings"
|