1 @core @core_course @_cross_browser
2 Feature: Show/hide course sections
3 In order to delay sections availability
5 I need to show or hide sections
8 Given the following "users" exist:
9 | username | firstname | lastname | email |
10 | teacher1 | Teacher | 1 | teacher1@example.com |
11 | student1 | Student | 1 | student1@example.com |
12 And the following "courses" exist:
13 | fullname | shortname | format | hiddensections | enablecompletion | coursedisplay |
14 | Course 1 | C1 | topics | 0 | 1 | 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 | course | section | name | visible |
21 | forum | C1 | 1 | Test hidden forum 11 name | 0 |
22 | forum | C1 | 1 | Test hidden forum 12 name | 1 |
23 | forum | C1 | 2 | Test hidden forum 21 name | 0 |
24 | forum | C1 | 2 | Test hidden forum 22 name | 1 |
25 | forum | C1 | 3 | Test hidden forum 31 name | 0 |
26 | forum | C1 | 3 | Test hidden forum 32 name | 1 |
27 And I log in as "teacher1"
28 And I am on "Course 1" course homepage with editing mode on
31 Scenario: Show / hide section icon functions correctly
32 When I hide section "1"
33 Then section "1" should be hidden
34 And section "2" should be visible
35 And section "3" should be visible
36 And I hide section "2"
37 And section "2" should be hidden
38 And I show section "2"
39 And section "2" should be visible
40 And I hide section "3"
41 And I show section "3"
42 And I hide section "3"
43 And section "3" should be hidden
45 And section "1" should be hidden
46 And all activities in section "1" should be hidden
47 And section "2" should be visible
48 And section "3" should be hidden
49 And all activities in section "1" should be hidden
50 And I am on the "Course 1" course page logged in as student1
51 And section "1" should be hidden
52 And all activities in section "1" should be hidden
53 And section "2" should be visible
54 And section "3" should be hidden
55 And all activities in section "1" should be hidden
58 Scenario: Students can not navigate to hidden sections
59 Given I hide section "2"
60 And I navigate to "Settings" in current page administration
61 And I set the following fields to these values:
62 | Course layout | Show one section per page |
63 And I press "Save and display"
64 When I click on "Topic 1" "link" in the "region-main" "region"
65 Then I should see "Topic 2" in the "region-main" "region"
66 And I click on "Topic 2" "link" in the "region-main" "region"
67 And I should see "Topic 1" in the "region-main" "region"
68 And I should see "Topic 3" in the "region-main" "region"
69 And I am on the "Course 1" course page logged in as student1
70 And I click on "Topic 1" "link" in the "region-main" "region"
71 And I should not see "Topic 2" in the "region-main" "region"
72 And I should see "Topic 3" in the "region-main" "region"
73 And I click on "Topic 3" "link" in the "region-main" "region"
74 And I should not see "Topic 2" in the "region-main" "region"
75 And I should see "Topic 1" in the "region-main" "region"
78 Scenario: Students can not navigate to restricted sections
79 Given the following "activities" exist:
80 | activity | course | section | name | completion |
81 | label | C1 | 1 | Test label | 1 |
82 And I edit the section "2"
83 And I expand all fieldsets
84 And I click on "Add restriction..." "button"
85 And I click on "Activity completion" "button" in the "Add restriction..." "dialogue"
86 And I set the following fields to these values:
88 | Required completion status | must be marked complete |
89 And I press "Save changes"
90 When I click on "Topic 1" "link" in the "region-main" "region"
91 Then I should see "Topic 2" in the "region-main" "region"
92 And I click on "Topic 2" "link" in the "region-main" "region"
93 And I should see "Topic 1" in the "region-main" "region"
94 And I should see "Topic 3" in the "region-main" "region"
95 And I am on the "Course 1" course page logged in as student1
96 And I click on "Topic 1" "link" in the "region-main" "region"
97 And I should not see "Topic 2" in the "region-main" "region"
98 And I should see "Topic 3" in the "region-main" "region"
99 And I click on "Topic 3" "link" in the "region-main" "region"
100 And I should not see "Topic 2" in the "region-main" "region"
101 And I should see "Topic 1" in the "region-main" "region"