source: moodle/trunk/fuentes/course/tests/behat/course_controls.feature @ 1331

Last change on this file since 1331 was 1331, checked in by jrpelegrina, 3 years ago

Updated to moodle 3.0.3

File size: 10.1 KB
Line 
1@core @core_course
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
7  # The difference between these two scenario outlines is that one is with
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.
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" exist:
21      | username | firstname | lastname | email |
22      | teacher1 | Teacher | 1 | teacher1@example.com |
23    And the following "courses" exist:
24      | fullname | shortname | format | coursedisplay | numsections |
25      | Course 1 | C1 | <courseformat> | <coursedisplay> | 5 |
26    And the following "course enrolments" exist:
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 exist
36    And I follow "Turn editing on"
37    And "Turn editing off" "button" should exist
38    And I follow "Turn editing off"
39    And I should see "Turn editing on"
40    And "Turn editing on" "button" should exist
41    And I turn editing mode on
42    And I click on "Actions" "link" in the "Recent activity" "block"
43    And I click on "Delete Recent activity block" "link"
44    And I press "Yes"
45    And <belowpage> "section" <should_see_other_sections> exist
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 <belowpage> "section" <should_see_other_sections> exist
53    And I indent right "Test forum name 1" activity
54    And <belowpage> "section" <should_see_other_sections> exist
55    And I indent left "Test forum name 1" activity
56    And <belowpage> "section" <should_see_other_sections> exist
57    And I open "Test forum name 1" actions menu
58    And I click on "Edit settings" "link" in the "Test forum name 1" activity
59    And I should see "Updating Forum"
60    And I should see "Display description on course page"
61    And I set the following fields to these values:
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"
66    And <belowpage> "section" <should_see_other_sections> exist
67    And I open "Test forum name 1" actions menu
68    And I click on "Hide" "link" in the "Test forum name 1" activity
69    And <belowpage> "section" <should_see_other_sections> exist
70    And I delete "Test forum name 1" activity
71    And I should not see "Test forum name 1" in the "#region-main" "css_element"
72    And I duplicate "Test forum name 2" activity editing the new copy with:
73      | Forum name | Edited test forum name 2 |
74    And <belowpage> "section" <should_see_other_sections> exist
75    And I should see "Test forum name 2"
76    And I should see "Edited test forum name 2"
77    And I hide section "1"
78    And <belowpage> "section" <should_see_other_sections> exist
79    And section "1" should be hidden
80    And all activities in section "1" should be hidden
81    And I show section "1"
82    And <belowpage> "section" <should_see_other_sections> exist
83    And section "1" should be visible
84    And I add the "Section links" block
85    And <belowpage> "section" <should_see_other_sections> exist
86    And I should see "1 2 3 4 5" in the "Section links" "block"
87    And I click on "2" "link" in the "Section links" "block"
88    And I <should_see_other_sections_following_block_sections_links> see "Test forum name 2"
89
90    Examples:
91      | courseformat | coursedisplay | targetpage              | should_see_other_sections | should_see_other_sections_following_block_sections_links | belowpage                |
92      | topics       | 0             | "Course 1"              | should                    | should                                                   | "Topic 2"                |
93      | topics       | 1             | "Topic 1"               | should not                | should not                                               | "Topic 2"                |
94      | topics       | 1             | "Course 1"              | should                    | should not                                               | "Topic 2"                |
95      | weeks        | 0             | "Course 1"              | should                    | should                                                   | "8 January - 14 January" |
96      | weeks        | 1             | "1 January - 7 January" | should not                | should not                                               | "8 January - 14 January" |
97      | weeks        | 1             | "Course 1"              | should                    | should not                                               | "8 January - 14 January" |
98
99  Scenario Outline: General activities course controls using topics and weeks formats, and paged mode and not paged mode works as expected
100    Given the following "users" exist:
101      | username | firstname | lastname | email |
102      | teacher1 | Teacher | 1 | teacher1@example.com |
103    And the following "courses" exist:
104      | fullname | shortname | format | coursedisplay | numsections |
105      | Course 1 | C1 | <courseformat> | <coursedisplay> | 5 |
106    And the following "course enrolments" exist:
107      | user | course | role |
108      | teacher1 | C1 | editingteacher |
109    And I log in as "teacher1"
110    And I follow "Course 1"
111    When I follow <targetpage>
112    And I press "Turn editing on"
113    Then I should see "Turn editing off"
114    And I press "Turn editing off"
115    And "Turn editing on" "button" should exist
116    And I follow "Turn editing on"
117    And "Turn editing off" "button" should exist
118    And I follow "Turn editing off"
119    And I should see "Turn editing on"
120    And "Turn editing on" "button" should exist
121    And I turn editing mode on
122    And I click on "Actions" "link" in the "Recent activity" "block"
123    And I click on "Delete Recent activity block" "link"
124    And I press "Yes"
125    And <belowpage> "section" <should_see_other_sections> exist
126    And I add a "Forum" to section "1" and I fill the form with:
127      | Forum name | Test forum name 1 |
128      | Description | Test forum description 1 |
129    And I add a "Forum" to section "1" and I fill the form with:
130      | Forum name | Test forum name 2 |
131      | Description | Test forum description 2 |
132    And <belowpage> "section" <should_see_other_sections> exist
133    And I indent right "Test forum name 1" activity
134    And <belowpage> "section" <should_see_other_sections> exist
135    And I indent left "Test forum name 1" activity
136    And <belowpage> "section" <should_see_other_sections> exist
137    And I click on "Edit settings" "link" in the "Test forum name 1" activity
138    And I should see "Updating Forum"
139    And I should see "Display description on course page"
140    And I press "Save and return to course"
141    And <belowpage> "section" <should_see_other_sections> exist
142    And I click on "Hide" "link" in the "Test forum name 1" activity
143    And <belowpage> "section" <should_see_other_sections> exist
144    And I delete "Test forum name 1" activity
145    And <belowpage> "section" <should_see_other_sections> exist
146    And I should not see "Test forum name 1" in the "#region-main" "css_element"
147    And I duplicate "Test forum name 2" activity editing the new copy with:
148      | Forum name | Edited test forum name 2 |
149    And <belowpage> "section" <should_see_other_sections> exist
150    And I should see "Test forum name 2"
151    And I should see "Edited test forum name 2"
152    And I hide section "1"
153    And <belowpage> "section" <should_see_other_sections> exist
154    And section "1" should be hidden
155    And all activities in section "1" should be hidden
156    And I show section "1"
157    And <belowpage> "section" <should_see_other_sections> exist
158    And section "1" should be visible
159    And I add the "Section links" block
160    And <belowpage> "section" <should_see_other_sections> exist
161    And I should see "1 2 3 4 5" in the "Section links" "block"
162    And I click on "2" "link" in the "Section links" "block"
163    And I <should_see_other_sections_following_block_sections_links> see "Test forum name 2"
164
165    Examples:
166      | courseformat | coursedisplay | targetpage              | should_see_other_sections | should_see_other_sections_following_block_sections_links | belowpage                |
167      | topics       | 0             | "Course 1"              | should                    | should                                                   | "Topic 2"                |
168      | topics       | 1             | "Topic 1"               | should not                | should not                                               | "Topic 2"                |
169      | topics       | 1             | "Course 1"              | should                    | should not                                               | "Topic 2"                |
170      | weeks        | 0             | "Course 1"              | should                    | should                                                   | "8 January - 14 January" |
171      | weeks        | 1             | "1 January - 7 January" | should not                | should not                                               | "8 January - 14 January" |
172      | weeks        | 1             | "Course 1"              | should                    | should not                                               | "8 January - 14 January" |
Note: See TracBrowser for help on using the repository browser.