1441 |
ariadna |
1 |
@mod @mod_subsection
|
|
|
2 |
Feature: Courses should not lose subsection contents when mod_subsection is disabled
|
|
|
3 |
In order to disable subsections
|
|
|
4 |
As an admin
|
|
|
5 |
Courses needs to be usable with mod_subsection disabled
|
|
|
6 |
|
|
|
7 |
Background:
|
|
|
8 |
Given the following "users" exist:
|
|
|
9 |
| username | firstname | lastname |
|
|
|
10 |
| teacher1 | Teacher | 1 |
|
|
|
11 |
| student1 | Student | 1 |
|
|
|
12 |
And the following "courses" exist:
|
|
|
13 |
| fullname | shortname | category | numsections | initsections |
|
|
|
14 |
| Course 1 | C1 | 0 | 2 | 1 |
|
|
|
15 |
And the following "course enrolments" exist:
|
|
|
16 |
| user | course | role |
|
|
|
17 |
| teacher1 | C1 | editingteacher |
|
|
|
18 |
| student1 | C1 | student |
|
|
|
19 |
And the following "activities" exist:
|
|
|
20 |
| activity | name | course | idnumber | section |
|
|
|
21 |
| forum | Activity Sample | C1 | forum1 | 1 |
|
|
|
22 |
| subsection | Subsection1 | C1 | Subsection1 | 1 |
|
|
|
23 |
| data | Subactivity | C1 | data1 | 3 |
|
|
|
24 |
And I disable "subsection" "mod" plugin
|
|
|
25 |
|
|
|
26 |
Scenario: Teachers should see subsections as orphaned
|
|
|
27 |
When I log in as "teacher1"
|
|
|
28 |
And I am on "Course 1" course homepage with editing mode on
|
|
|
29 |
And I should see "Activity Sample" in the "Section 1" "section"
|
|
|
30 |
And I should not see "Subsection1" in the "Section 1" "section"
|
|
|
31 |
And I should see "Subsection1" in the "page-content" "region"
|
|
|
32 |
Then I should see "Subactivity" in the "Subsection1" "section"
|
|
|
33 |
And "Section 2" "section" should appear before "Subsection1" "section"
|
|
|
34 |
And "Edit settings" "link" should not exist in the "Subsection1" "core_courseformat > Section actions menu"
|
|
|
35 |
And "Duplicate" "link" should not exist in the "Subsection1" "core_courseformat > Section actions menu"
|
|
|
36 |
And "Hide" "link" should not exist in the "Subsection1" "core_courseformat > Section actions menu"
|
|
|
37 |
And "Move" "link" should not exist in the "Subsection1" "core_courseformat > Section actions menu"
|
|
|
38 |
And "View" "link" should exist in the "Subsection1" "core_courseformat > Section actions menu"
|
|
|
39 |
And "Delete" "link" should exist in the "Subsection1" "core_courseformat > Section actions menu"
|
|
|
40 |
And "Permalink" "link" should not exist in the "Subsection1" "core_courseformat > Section actions menu"
|
|
|
41 |
And I should see "This section and its content are not part of the course structure" in the "Subsection1" "section"
|
|
|
42 |
|
|
|
43 |
Scenario: Students should not see orphaned subsections
|
|
|
44 |
When I log in as "student1"
|
|
|
45 |
And I am on "Course 1" course homepage
|
|
|
46 |
Then I should see "Activity Sample" in the "page-content" "region"
|
|
|
47 |
And I should not see "Subsection1" in the "page-content" "region"
|
|
|
48 |
And I should not see "Subactivity" in the "page-content" "region"
|
|
|
49 |
|
|
|
50 |
Scenario: Enabling again subsections should show the course as before
|
|
|
51 |
Given I log in as "teacher1"
|
|
|
52 |
And I am on "Course 1" course homepage
|
|
|
53 |
And I should see "Activity Sample" in the "Section 1" "section"
|
|
|
54 |
And I should not see "Subsection1" in the "Section 1" "section"
|
|
|
55 |
And I should see "Subsection1" in the "page-content" "region"
|
|
|
56 |
And I should see "Subactivity" in the "Subsection1" "section"
|
|
|
57 |
And "Section 2" "section" should appear before "Subsection1" "section"
|
|
|
58 |
And I should see "This section and its content are not part of the course structure"
|
|
|
59 |
When I enable "subsection" "mod" plugin
|
|
|
60 |
And I am on "Course 1" course homepage with editing mode on
|
|
|
61 |
Then I should see "Activity Sample" in the "Section 1" "section"
|
|
|
62 |
And I should see "Subsection1" in the "Section 1" "section"
|
|
|
63 |
And I should see "Subactivity" in the "Subsection1" "section"
|
|
|
64 |
And "Subsection1" "section" should appear before "Section 2" "section"
|
|
|
65 |
And "Edit settings" "link" should exist in the "Subsection1" "core_courseformat > Section actions menu"
|
|
|
66 |
And "Duplicate" "link" should not exist in the "Subsection1" "core_courseformat > Section actions menu"
|
|
|
67 |
And "Hide" "link" should exist in the "Subsection1" "core_courseformat > Section actions menu"
|
|
|
68 |
And "Move" "link" should exist in the "Subsection1" "core_courseformat > Section actions menu"
|
|
|
69 |
And "View" "link" should exist in the "Subsection1" "core_courseformat > Section actions menu"
|
|
|
70 |
And "Delete" "link" should exist in the "Subsection1" "core_courseformat > Section actions menu"
|
|
|
71 |
And I should not see "This section and its content are not part of the course structure"
|
|
|
72 |
|
|
|
73 |
@javascript
|
|
|
74 |
Scenario: Deleting the subsections with mod_subsection disabled should not break the course
|
|
|
75 |
Given I log in as "teacher1"
|
|
|
76 |
And I am on "Course 1" course homepage with editing mode on
|
|
|
77 |
# Perform teacher actions instead of fast steps to validate delete
|
|
|
78 |
# an orphaned subsection does not break the course.
|
|
|
79 |
And I click on "Edit" "icon" in the "Subsection1" "core_courseformat > Section actions menu"
|
|
|
80 |
When I choose "Delete" in the open action menu
|
|
|
81 |
And I click on "Delete" "button" in the "Delete section?" "dialogue"
|
|
|
82 |
Then I enable "subsection" "mod" plugin
|
|
|
83 |
And I am on "Course 1" course homepage
|
|
|
84 |
And I should see "Activity Sample" in the "Section 1" "section"
|
|
|
85 |
And I should see "Subsection1" in the "page-content" "region"
|
|
|
86 |
And I should not see "Subactivity" in the "page-content" "region"
|
|
|
87 |
|
|
|
88 |
@javascript
|
|
|
89 |
Scenario: Access restrictions are restored when a subsection is deleted while mod_subsection is disabled
|
|
|
90 |
Given I enable "subsection" "mod" plugin
|
|
|
91 |
And the following "groups" exist:
|
|
|
92 |
| course | name | idnumber |
|
|
|
93 |
| C1 | G1 | GI1 |
|
|
|
94 |
And the following "group members" exist:
|
|
|
95 |
| user | group |
|
|
|
96 |
| student1 | GI1 |
|
|
|
97 |
And the following "groupings" exist:
|
|
|
98 |
| name | course | idnumber |
|
|
|
99 |
| GX1 | C1 | GXI1 |
|
|
|
100 |
And the following "grouping groups" exist:
|
|
|
101 |
| grouping | group |
|
|
|
102 |
| GXI1 | GI1 |
|
|
|
103 |
And I log in as "teacher1"
|
|
|
104 |
And I am on the "C1 > Subsection1" "course > section settings" page
|
|
|
105 |
And I set the following fields to these values:
|
|
|
106 |
| Access restrictions | Grouping: GX1 |
|
|
|
107 |
And I press "Save changes"
|
|
|
108 |
And I should see "Not available unless: You belong to a group in GX1"
|
|
|
109 |
And I disable "subsection" "mod" plugin
|
|
|
110 |
When I am on "Course 1" course homepage with editing mode on
|
|
|
111 |
And I should see "This section and its content are not part of the course structure" in the "Subsection1" "section"
|
|
|
112 |
And I should see "Not available unless: You belong to a group in GX1"
|
|
|
113 |
And I should not see "Edit restrictions"
|
|
|
114 |
And I am on the "C1 > Subsection1" "course > section" page
|
|
|
115 |
And I click on "Edit" "icon" in the "[data-region='header-actions-container']" "css_element"
|
|
|
116 |
And I choose "Delete" in the open action menu
|
|
|
117 |
And I click on "Delete" "button" in the "Delete section?" "dialogue"
|
|
|
118 |
And I enable "subsection" "mod" plugin
|
|
|
119 |
Then I am on "Course 1" course homepage
|
|
|
120 |
And I should see "Not available unless: You belong to a group in GX1"
|
|
|
121 |
And I should see "Edit restrictions"
|
|
|
122 |
|
|
|
123 |
@javascript
|
|
|
124 |
Scenario: Visibility is restored when a subsection is deleted while mod_subsection is disabled
|
|
|
125 |
Given I enable "subsection" "mod" plugin
|
|
|
126 |
And the following "activities" exist:
|
|
|
127 |
| activity | name | course | idnumber | section | visible |
|
|
|
128 |
| subsection | Subsection2 | C1 | Subsection2 | 1 | 0 |
|
|
|
129 |
And I log in as "teacher1"
|
|
|
130 |
And I disable "subsection" "mod" plugin
|
|
|
131 |
When I am on the "C1 > Subsection2" "course > section" page
|
|
|
132 |
And I turn editing mode on
|
|
|
133 |
And I click on "Edit" "icon" in the "[data-region='header-actions-container']" "css_element"
|
|
|
134 |
And I choose "Delete" in the open action menu
|
|
|
135 |
And I click on "Delete" "button" in the "Delete section?" "dialogue"
|
|
|
136 |
And I enable "subsection" "mod" plugin
|
|
|
137 |
Then I am on "Course 1" course homepage
|
|
|
138 |
And I should see "Hidden from students"
|
|
|
139 |
|
|
|
140 |
@javascript
|
|
|
141 |
Scenario: Orphaned sections should appear after any other section
|
|
|
142 |
Given I log in as "teacher1"
|
|
|
143 |
When I am on "Course 1" course homepage with editing mode on
|
|
|
144 |
And I click on "Add section" "link" in the "course-addsection" "region"
|
|
|
145 |
Then I should see "New section"
|
|
|
146 |
And "Section 2" "section" should appear before "New section" "section"
|
|
|
147 |
And "New section" "section" should appear before "Subsection1" "section"
|