MDL-43802 behat: Testing deleted activity with JS enabled
[moodle.git] / course / tests / behat / course_controls.feature
CommitLineData
fbd904ef 1@core @core_course
b576bdc7
DM
2Feature: Course activity controls works as expected
3 In order to manage my course's activities
4 As a teacher
5 I need to edit, hide, show and indent activities inside course sections
6
686279d0 7 # The difference between these two scenario outlines is that one is with
fbd904ef
DM
8 # JS enabled and the other one with JS disabled; we can not use Background
9 # sections when using Scenario Outlines because of Behat framework restrictions.
b576bdc7
DM
10
11 # We are testing:
12 # * Javascript on and off
13 # * Topics and weeks course formats
14 # * Course controls without paged mode
15 # * Course controls with paged mode in the course home page
16 # * Course controls with paged mode in a section's page
17
18 @javascript @_cross_browser
19 Scenario Outline: General activities course controls using topics and weeks formats, and paged mode and not paged mode works as expected
20 Given the following "users" exists:
21 | username | firstname | lastname | email |
22 | teacher1 | Teacher | 1 | teacher1@asd.com |
23 And the following "courses" exists:
24 | fullname | shortname | format | coursedisplay | numsections |
25 | Course 1 | C1 | <courseformat> | <coursedisplay> | 5 |
26 And the following "course enrolments" exists:
27 | user | course | role |
28 | teacher1 | C1 | editingteacher |
29 And I log in as "teacher1"
30 And I follow "Course 1"
31 When I follow <targetpage>
32 And I press "Turn editing on"
33 Then I should see "Turn editing off"
34 And I press "Turn editing off"
35 And "Turn editing on" "button" should exists
36 And I follow "Turn editing on"
37 And "Turn editing off" "button" should exists
38 And I follow "Turn editing off"
39 And I should see "Turn editing on"
40 And "Turn editing on" "button" should exists
41 And I turn editing mode on
fcc0b5b9 42 And I click on "Actions" "link" in the "Recent activity" "block"
b576bdc7
DM
43 And I click on "Delete Recent activity block" "link"
44 And I press "Yes"
45 And "#section-2" "css_element" <should_see_other_sections> exists
46 And I add a "Forum" to section "1" and I fill the form with:
47 | Forum name | Test forum name 1 |
48 | Description | Test forum description 1 |
49 And I add a "Forum" to section "1" and I fill the form with:
50 | Forum name | Test forum name 2 |
51 | Description | Test forum description 2 |
52 And "#section-2" "css_element" <should_see_other_sections> exists
53 And I indent right "Test forum name 1" activity
54 And "#section-2" "css_element" <should_see_other_sections> exists
55 And I indent left "Test forum name 1" activity
56 And "#section-2" "css_element" <should_see_other_sections> exists
2a9275c4 57 And I open "Test forum name 1" actions menu
047a8800 58 And I click on "Edit settings" "link" in the "Test forum name 1" activity
b576bdc7
DM
59 And I should see "Updating Forum"
60 And I should see "Display description on course page"
d1e55a47
DM
61 And I fill the moodle form with:
62 | Forum name | Just to check that I can edit the name |
63 | Description | Just to check that I can edit the description |
64 | Display description on course page | 1 |
65 And I click on "Cancel" "button"
b576bdc7 66 And "#section-2" "css_element" <should_see_other_sections> exists
2a9275c4 67 And I open "Test forum name 1" actions menu
b576bdc7
DM
68 And I click on "Hide" "link" in the "Test forum name 1" activity
69 And "#section-2" "css_element" <should_see_other_sections> exists
fbd904ef
DM
70 And I open "Test forum name 1" actions menu
71 And I delete "Test forum name 1" activity
72 And I should not see "Test forum name 1" in the "#region-main" "css_element"
b576bdc7
DM
73 And I duplicate "Test forum name 2" activity editing the new copy with:
74 | Forum name | Edited test forum name 2 |
75 And "#section-2" "css_element" <should_see_other_sections> exists
76 And I should see "Test forum name 2"
77 And I should see "Edited test forum name 2"
78 And I hide section "1"
79 And "#section-2" "css_element" <should_see_other_sections> exists
80 And section "1" should be hidden
26df91ca 81 And all activities in section "1" should be hidden
b576bdc7
DM
82 And I show section "1"
83 And "#section-2" "css_element" <should_see_other_sections> exists
84 And section "1" should be visible
85 And I add the "Section links" block
86 And "#section-2" "css_element" <should_see_other_sections> exists
fcc0b5b9
DM
87 And I should see "1 2 3 4 5" in the "Section links" "block"
88 And I click on "2" "link" in the "Section links" "block"
b576bdc7
DM
89 And I <should_see_other_sections_following_block_sections_links> see "Test forum name 2"
90
91 Examples:
92 | courseformat | coursedisplay | targetpage | should_see_other_sections | should_see_other_sections_following_block_sections_links |
93 | topics | 0 | "Course 1" | should | should |
94 | topics | 1 | "Topic 1" | should not | should not |
95 | topics | 1 | "Course 1" | should | should not |
96 | weeks | 0 | "Course 1" | should | should |
97 | weeks | 1 | "1 January - 7 January" | should not | should not |
98 | weeks | 1 | "Course 1" | should | should not |
99
b576bdc7
DM
100 Scenario Outline: General activities course controls using topics and weeks formats, and paged mode and not paged mode works as expected
101 Given the following "users" exists:
102 | username | firstname | lastname | email |
103 | teacher1 | Teacher | 1 | teacher1@asd.com |
104 And the following "courses" exists:
105 | fullname | shortname | format | coursedisplay | numsections |
106 | Course 1 | C1 | <courseformat> | <coursedisplay> | 5 |
107 And the following "course enrolments" exists:
108 | user | course | role |
109 | teacher1 | C1 | editingteacher |
110 And I log in as "teacher1"
111 And I follow "Course 1"
112 When I follow <targetpage>
113 And I press "Turn editing on"
114 Then I should see "Turn editing off"
115 And I press "Turn editing off"
116 And "Turn editing on" "button" should exists
117 And I follow "Turn editing on"
118 And "Turn editing off" "button" should exists
119 And I follow "Turn editing off"
120 And I should see "Turn editing on"
121 And "Turn editing on" "button" should exists
122 And I turn editing mode on
fcc0b5b9 123 And I click on "Actions" "link" in the "Recent activity" "block"
b576bdc7
DM
124 And I click on "Delete Recent activity block" "link"
125 And I press "Yes"
126 And "#section-2" "css_element" <should_see_other_sections> exists
127 And I add a "Forum" to section "1" and I fill the form with:
128 | Forum name | Test forum name 1 |
129 | Description | Test forum description 1 |
130 And I add a "Forum" to section "1" and I fill the form with:
131 | Forum name | Test forum name 2 |
132 | Description | Test forum description 2 |
133 And "#section-2" "css_element" <should_see_other_sections> exists
134 And I indent right "Test forum name 1" activity
135 And "#section-2" "css_element" <should_see_other_sections> exists
136 And I indent left "Test forum name 1" activity
137 And "#section-2" "css_element" <should_see_other_sections> exists
047a8800 138 And I click on "Edit settings" "link" in the "Test forum name 1" activity
b576bdc7
DM
139 And I should see "Updating Forum"
140 And I should see "Display description on course page"
141 And I press "Save and return to course"
142 And "#section-2" "css_element" <should_see_other_sections> exists
143 And I click on "Hide" "link" in the "Test forum name 1" activity
144 And "#section-2" "css_element" <should_see_other_sections> exists
145 And I delete "Test forum name 1" activity
146 And "#section-2" "css_element" <should_see_other_sections> exists
5df9e40c 147 And I should not see "Test forum name 1" in the "#region-main" "css_element"
b576bdc7
DM
148 And I duplicate "Test forum name 2" activity editing the new copy with:
149 | Forum name | Edited test forum name 2 |
150 And "#section-2" "css_element" <should_see_other_sections> exists
151 And I should see "Test forum name 2"
152 And I should see "Edited test forum name 2"
153 And I hide section "1"
154 And "#section-2" "css_element" <should_see_other_sections> exists
155 And section "1" should be hidden
26df91ca 156 And all activities in section "1" should be hidden
b576bdc7
DM
157 And I show section "1"
158 And "#section-2" "css_element" <should_see_other_sections> exists
159 And section "1" should be visible
160 And I add the "Section links" block
161 And "#section-2" "css_element" <should_see_other_sections> exists
fcc0b5b9
DM
162 And I should see "1 2 3 4 5" in the "Section links" "block"
163 And I click on "2" "link" in the "Section links" "block"
b576bdc7
DM
164 And I <should_see_other_sections_following_block_sections_links> see "Test forum name 2"
165
166 Examples:
167 | courseformat | coursedisplay | targetpage | should_see_other_sections | should_see_other_sections_following_block_sections_links |
168 | topics | 0 | "Course 1" | should | should |
169 | topics | 1 | "Topic 1" | should not | should not |
170 | topics | 1 | "Course 1" | should | should not |
171 | weeks | 0 | "Course 1" | should | should |
172 | weeks | 1 | "1 January - 7 January" | should not | should not |
173 | weeks | 1 | "Course 1" | should | should not |