1 |
efrain |
1 |
@core @core_course @_cross_browser
|
|
|
2 |
Feature: Show/hide course sections
|
|
|
3 |
In order to delay sections availability
|
|
|
4 |
As a teacher
|
|
|
5 |
I need to show or hide sections
|
|
|
6 |
|
|
|
7 |
Background:
|
|
|
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 "course" exists:
|
|
|
13 |
| fullname | Course 1 |
|
|
|
14 |
| shortname | C1 |
|
|
|
15 |
| format | topics |
|
|
|
16 |
| hiddensections | 0 |
|
|
|
17 |
| enablecompletion | 1 |
|
|
|
18 |
| coursedisplay | 1 |
|
|
|
19 |
| initsections | 1 |
|
|
|
20 |
And the following "course enrolments" exist:
|
|
|
21 |
| user | course | role |
|
|
|
22 |
| teacher1 | C1 | editingteacher |
|
|
|
23 |
| student1 | C1 | student |
|
|
|
24 |
And the following "activities" exist:
|
|
|
25 |
| activity | course | section | name | visible |
|
|
|
26 |
| forum | C1 | 1 | Test hidden forum 11 name | 0 |
|
|
|
27 |
| forum | C1 | 1 | Test hidden forum 12 name | 1 |
|
|
|
28 |
| forum | C1 | 2 | Test hidden forum 21 name | 0 |
|
|
|
29 |
| forum | C1 | 2 | Test hidden forum 22 name | 1 |
|
|
|
30 |
| forum | C1 | 3 | Test hidden forum 31 name | 0 |
|
|
|
31 |
| forum | C1 | 3 | Test hidden forum 32 name | 1 |
|
|
|
32 |
And I log in as "teacher1"
|
|
|
33 |
And I am on "Course 1" course homepage with editing mode on
|
|
|
34 |
|
|
|
35 |
@javascript
|
|
|
36 |
Scenario: Show / hide section icon functions correctly
|
|
|
37 |
When I hide section "1"
|
|
|
38 |
Then section "1" should be hidden
|
|
|
39 |
And section "2" should be visible
|
|
|
40 |
And section "3" should be visible
|
|
|
41 |
And I hide section "2"
|
|
|
42 |
And section "2" should be hidden
|
|
|
43 |
And I show section "2"
|
|
|
44 |
And section "2" should be visible
|
|
|
45 |
And I hide section "3"
|
|
|
46 |
And I show section "3"
|
|
|
47 |
And I hide section "3"
|
|
|
48 |
And section "3" should be hidden
|
|
|
49 |
And I reload the page
|
|
|
50 |
And section "1" should be hidden
|
|
|
51 |
And all activities in section "1" should be hidden
|
|
|
52 |
And section "2" should be visible
|
|
|
53 |
And section "3" should be hidden
|
|
|
54 |
And all activities in section "1" should be hidden
|
|
|
55 |
And I am on the "Course 1" course page logged in as student1
|
|
|
56 |
And section "1" should be hidden
|
|
|
57 |
And all activities in section "1" should be hidden
|
|
|
58 |
And section "2" should be visible
|
|
|
59 |
And section "3" should be hidden
|
|
|
60 |
And all activities in section "1" should be hidden
|
|
|
61 |
|
|
|
62 |
@javascript
|
|
|
63 |
Scenario: Students can not navigate to hidden sections
|
|
|
64 |
Given I hide section "2"
|
|
|
65 |
And I navigate to "Settings" in current page administration
|
|
|
66 |
And I set the following fields to these values:
|
|
|
67 |
| Course layout | Show one section per page |
|
|
|
68 |
And I press "Save and display"
|
|
|
69 |
When I click on "Section 1" "link" in the "region-main" "region"
|
|
|
70 |
Then I should see "Section 2" in the "region-main" "region"
|
|
|
71 |
And I click on "Section 2" "link" in the "region-main" "region"
|
|
|
72 |
And I should see "Section 1" in the "region-main" "region"
|
|
|
73 |
And I should see "Section 3" in the "region-main" "region"
|
|
|
74 |
And I am on the "Course 1" course page logged in as student1
|
|
|
75 |
And I click on "Section 1" "link" in the "region-main" "region"
|
|
|
76 |
And I should not see "Section 2" in the "region-main" "region"
|
|
|
77 |
And I should see "Section 3" in the "region-main" "region"
|
|
|
78 |
And I click on "Section 3" "link" in the "region-main" "region"
|
|
|
79 |
And I should not see "Section 2" in the "region-main" "region"
|
|
|
80 |
And I should see "Section 1" in the "region-main" "region"
|
|
|
81 |
|
|
|
82 |
@javascript
|
|
|
83 |
Scenario: Students can not navigate to restricted sections
|
|
|
84 |
Given the following "activities" exist:
|
|
|
85 |
| activity | course | section | name | completion |
|
|
|
86 |
| label | C1 | 1 | Test label | 1 |
|
|
|
87 |
And I edit the section "2"
|
|
|
88 |
And I expand all fieldsets
|
|
|
89 |
And I click on "Add restriction..." "button"
|
|
|
90 |
And I click on "Activity completion" "button" in the "Add restriction..." "dialogue"
|
|
|
91 |
And I set the following fields to these values:
|
|
|
92 |
| cm | Test label |
|
|
|
93 |
| Required completion status | must be marked complete |
|
|
|
94 |
And I press "Save changes"
|
|
|
95 |
When I click on "Section 1" "link" in the "region-main" "region"
|
|
|
96 |
Then I should see "Section 2" in the "region-main" "region"
|
|
|
97 |
And I click on "Section 2" "link" in the "region-main" "region"
|
|
|
98 |
And I should see "Section 1" in the "region-main" "region"
|
|
|
99 |
And I should see "Section 3" in the "region-main" "region"
|
|
|
100 |
And I am on the "Course 1" course page logged in as student1
|
|
|
101 |
And I click on "Section 1" "link" in the "region-main" "region"
|
|
|
102 |
And I should not see "Section 2" in the "region-main" "region"
|
|
|
103 |
And I should see "Section 3" in the "region-main" "region"
|
|
|
104 |
And I click on "Section 3" "link" in the "region-main" "region"
|
|
|
105 |
And I should not see "Section 2" in the "region-main" "region"
|
|
|
106 |
And I should see "Section 1" in the "region-main" "region"
|