MDL-63854 competencies, themes: misplaced dropdown arrows
[moodle.git] / course / tests / behat / activities_visibility_icons.feature
blobb936e4a2327ee73ff3a04b04d0bdef817bda7556
1 @core @core_course @_cross_browser
2 Feature: Toggle activities visibility from the course page
3   In order to delay activities availability
4   As a teacher
5   I need to quickly change the visibility of an activity
7   @javascript
8   Scenario: Hide/Show toggle with javascript enabled
9     Given the following "users" exist:
10       | username | firstname | lastname | email |
11       | teacher1 | Teacher | 1 | teacher1@example.com |
12       | student1 | Student | 1 | student1@example.com |
13     And the following "courses" exist:
14       | fullname | shortname | format |
15       | Course 1 | C1 | topics |
16     And the following "course enrolments" exist:
17       | user | course | role |
18       | teacher1 | C1 | editingteacher |
19       | student1 | C1 | student |
20     And I log in as "teacher1"
21     And I am on "Course 1" course homepage with editing mode on
22     And I add a "Forum" to section "1" and I fill the form with:
23       | Forum name | Test forum name |
24       | Description | Test forum description |
25       | Availability | Show on course page |
26     When I open "Test forum name" actions menu
27     Then "Test forum name" actions menu should not have "Show" item
28     And "Test forum name" actions menu should not have "Make available" item
29     And "Test forum name" actions menu should not have "Make unavailable" item
30     And I click on "Hide" "link" in the "Test forum name" activity
31     And "Test forum name" activity should be hidden
32     And I open "Test forum name" actions menu
33     And "Test forum name" actions menu should not have "Hide" item
34     # Stealth behaviour is not available by default:
35     And "Test forum name" actions menu should not have "Make available" item
36     And "Test forum name" actions menu should not have "Make unavailable" item
37     And I click on "Show" "link" in the "Test forum name" activity
38     And "Test forum name" activity should be visible
39     And I open "Test forum name" actions menu
40     And "Test forum name" actions menu should not have "Show" item
41     And "Test forum name" actions menu should not have "Make available" item
42     And "Test forum name" actions menu should not have "Make unavailable" item
43     And I click on "Hide" "link" in the "Test forum name" activity
44     And "Test forum name" activity should be hidden
45     And I reload the page
46     And "Test forum name" activity should be hidden
47     # Make sure that "Availability" dropdown in the edit menu has two options: Show/Hide.
48     And I open "Test forum name" actions menu
49     And I click on "Edit settings" "link" in the "Test forum name" activity
50     And I expand all fieldsets
51     And the "Availability" select box should contain "Show on course page"
52     And the "Availability" select box should not contain "Make available but not shown on course page"
53     And the field "Availability" matches value "Hide from students"
54     And I press "Save and return to course"
55     And "Test forum name" activity should be hidden
56     And I turn editing mode off
57     And "Test forum name" activity should be hidden
58     And I log out
59     # Student should not see this activity.
60     And I log in as "student1"
61     And I am on "Course 1" course homepage
62     And I should not see "Test forum name"
63     And I log out
65   @javascript
66   Scenario: Activities can be made available and unavailable inside a hidden section
67     Given the following "users" exist:
68       | username | firstname | lastname | email |
69       | teacher1 | Teacher | 1 | teacher1@example.com |
70       | student1 | Student | 1 | student1@example.com |
71     And the following "courses" exist:
72       | fullname | shortname | format | numsections |
73       | Course 1 | C1 | topics | 2 |
74     And the following "course enrolments" exist:
75       | user | course | role |
76       | teacher1 | C1 | editingteacher |
77       | student1 | C1 | student |
78     And I log in as "teacher1"
79     And I am on "Course 1" course homepage with editing mode on
80     And I add the "Recent activity" block
81     And I add a "Forum" to section "2" and I fill the form with:
82       | Forum name | Test forum name |
83       | Description | Test forum description |
84       | Availability | Show on course page |
85     When I hide section "2"
86     Then "Test forum name" activity should be hidden
87     And I open "Test forum name" actions menu
88     And "Test forum name" actions menu should not have "Show" item
89     And "Test forum name" actions menu should not have "Hide" item
90     And "Test forum name" actions menu should not have "Make unavailable" item
91     And I click on "Make available" "link" in the "Test forum name" activity
92     And "Test forum name" activity should be available but hidden from course page
93     And I open "Test forum name" actions menu
94     And "Test forum name" actions menu should not have "Show" item
95     And "Test forum name" actions menu should not have "Hide" item
96     And "Test forum name" actions menu should not have "Make available" item
97     And I click on "Make unavailable" "link" in the "Test forum name" activity
98     And "Test forum name" activity should be hidden
99     # Make sure that "Availability" dropdown in the edit menu has three options.
100     And I open "Test forum name" actions menu
101     And I click on "Edit settings" "link" in the "Test forum name" activity
102     And I expand all fieldsets
103     And the "Availability" select box should contain "Hide from students"
104     And the "Availability" select box should contain "Make available but not shown on course page"
105     And the "Availability" select box should not contain "Show on course page"
106     And I set the field "Availability" to "Make available but not shown on course page"
107     And I press "Save and return to course"
108     And "Test forum name" activity should be available but hidden from course page
109     And I turn editing mode off
110     And "Test forum name" activity should be available but hidden from course page
111     And I log out
112     # Student will not see the module on the course page but can access it from other reports and blocks:
113     And I log in as "student1"
114     And I am on "Course 1" course homepage
115     And "Test forum name" activity should be hidden
116     And I click on "Test forum name" "link" in the "Recent activity" "block"
117     And I should see "Test forum name"
118     And I should see "(There are no discussion topics yet in this forum)"
119     And I log out
121   @javascript
122   Scenario: Activities can be made available but not visible on a course page
123     Given the following "users" exist:
124       | username | firstname | lastname | email |
125       | teacher1 | Teacher | 1 | teacher1@example.com |
126       | student1 | Student | 1 | student1@example.com |
127     And the following "courses" exist:
128       | fullname | shortname | format | numsections |
129       | Course 1 | C1        | topics | 2           |
130     And the following "course enrolments" exist:
131       | user | course | role |
132       | teacher1 | C1 | editingteacher |
133       | student1 | C1 | student |
134     And I log in as "admin"
135     And I set the following administration settings values:
136       | allowstealth | 1 |
137     And I log out
138     And I log in as "teacher1"
139     And I am on "Course 1" course homepage with editing mode on
140     And I add the "Recent activity" block
141     And I add a "Assignment" to section "2" and I fill the form with:
142       | Assignment name | Test assignment name |
143       | Description | Test assignment description |
144       | Availability | Show on course page |
145     When I open "Test assignment name" actions menu
146     Then "Test assignment name" actions menu should not have "Show" item
147     And "Test assignment name" actions menu should have "Hide" item
148     And "Test assignment name" actions menu should not have "Make available" item
149     And "Test assignment name" actions menu should not have "Make unavailable" item
150     And I click on "Hide" "link" in the "Test assignment name" activity
151     And "Test assignment name" activity should be hidden
152     And I open "Test assignment name" actions menu
153     And "Test assignment name" actions menu should have "Show" item
154     And "Test assignment name" actions menu should not have "Hide" item
155     And "Test assignment name" actions menu should not have "Make unavailable" item
156     And I click on "Make available" "link" in the "Test assignment name" activity
157     And "Test assignment name" activity should be available but hidden from course page
158     # Make sure that "Availability" dropdown in the edit menu has three options.
159     And I open "Test assignment name" actions menu
160     And I click on "Edit settings" "link" in the "Test assignment name" activity
161     And I expand all fieldsets
162     And the "Availability" select box should contain "Show on course page"
163     And the "Availability" select box should contain "Hide from students"
164     And the field "Availability" matches value "Make available but not shown on course page"
165     And I press "Save and return to course"
166     And "Test assignment name" activity should be available but hidden from course page
167     And I turn editing mode off
168     And "Test assignment name" activity should be available but hidden from course page
169     And I log out
170     # Student will not see the module on the course page but can access it from other reports and blocks:
171     And I log in as "student1"
172     And I am on "Course 1" course homepage
173     And "Test assignment name" activity should be hidden
174     And I click on "Test assignment name" "link" in the "Recent activity" "block"
175     And I should see "Test assignment name"
176     And I should see "Submission status"
177     And I log out