Proyectos de Subversion Moodle

Rev

| Ultima modificación | Ver Log |

Rev Autor Línea Nro. Línea
1 efrain 1
@core @core_course
2
Feature: Test we can resort course in the management interface.
3
  As a moodle admin
4
  I need to test we can resort courses within a category.
5
  I need to test we can manually sort courses.
6
 
7
  # Test resorting courses with
8
  Scenario Outline: Resort courses.
9
    Given the following "categories" exist:
10
      | name | category 0| idnumber |
11
      | Cat 1 | 0 | CAT1 |
12
    And the following "courses" exist:
13
      | category | fullname | shortname | idnumber | sortorder | timecreated |
14
      | CAT1 | Social studies | Senior school | Ext003 | 1 | 1000000001 |
15
      | CAT1 | Applied sciences  | Middle school | Sci001 | 2 | 1000000002 |
16
      | CAT1 | Extended social studies  | Junior school | Ext002 | 3 | 1000000003 |
17
 
18
    And I log in as "admin"
19
    And I go to the courses management page
20
    And I should see the "Course categories and courses" management page
21
    And I click on category "Cat 1" in the management interface
22
    # Redirect.
23
    And I should see the "Course categories and courses" management page
24
    And I should see "Sort courses" in the ".course-listing-actions" "css_element"
25
    And I should see "Sort by Course full name ascending" in the ".course-listing-actions" "css_element"
26
    And I should see "Sort by Course full name descending" in the ".course-listing-actions" "css_element"
27
    And I should see "Sort by Course short name ascending" in the ".course-listing-actions" "css_element"
28
    And I should see "Sort by Course short name descending" in the ".course-listing-actions" "css_element"
29
    And I should see "Sort by Course ID number ascending" in the ".course-listing-actions" "css_element"
30
    And I should see "Sort by Course ID number descending" in the ".course-listing-actions" "css_element"
31
    And I should see "Sort by Course time created ascending" in the ".course-listing-actions" "css_element"
32
    And I should see "Sort by Course time created descending" in the ".course-listing-actions" "css_element"
33
    And I click on <sortby> "link" in the ".course-listing-actions" "css_element"
34
    # Redirect.
35
    And I should see the "Course categories and courses" management page
36
    And I should see course listing <course1> before <course2>
37
    And I should see course listing <course2> before <course3>
38
 
39
    Examples:
40
      | sortby | course1 | course2 | course3 |
41
      | "Sort by Course full name ascending"     | "Applied sciences"        | "Extended social studies" | "Social studies" |
42
      | "Sort by Course full name descending"    | "Social studies"          | "Extended social studies" | "Applied sciences" |
43
      | "Sort by Course short name ascending"    | "Extended social studies" | "Applied sciences"        | "Social studies" |
44
      | "Sort by Course short name descending"   | "Social studies"          | "Applied sciences"        | "Extended social studies" |
45
      | "Sort by Course ID number ascending"     | "Extended social studies" | "Social studies"          | "Applied sciences" |
46
      | "Sort by Course ID number descending"    | "Applied sciences"        | "Social studies"          | "Extended social studies" |
47
      | "Sort by Course time created ascending"  | "Social studies"          | "Applied sciences"        | "Extended social studies" |
48
      | "Sort by Course time created descending" | "Extended social studies" | "Applied sciences"        | "Social studies" |
49
 
50
  @javascript
51
  Scenario Outline: Resort courses with JavaScript enabled.
52
    Given the following "categories" exist:
53
      | name | category 0| idnumber |
54
      | Cat 1 | 0 | CAT1 |
55
    And the following "courses" exist:
56
      | category | fullname | shortname | idnumber | sortorder | timecreated |
57
      | CAT1 | Social studies | Senior school | Ext003 | 1 | 1000000001 |
58
      | CAT1 | Applied sciences  | Middle school | Sci001 | 2 | 1000000002 |
59
      | CAT1 | Extended social studies  | Junior school | Ext002 | 3 | 1000000003 |
60
 
61
    And I log in as "admin"
62
    And I go to the courses management page
63
    And I start watching to see if a new page loads
64
    And I should see the "Course categories and courses" management page
65
    And I click on category "Cat 1" in the management interface
66
    And a new page should have loaded since I started watching
67
    And I start watching to see if a new page loads
68
    And I should see the "Course categories and courses" management page
69
    And I should see "Sort courses" in the ".course-listing-actions" "css_element"
70
    And I should not see "Sort by Course full name ascending" in the ".course-listing-actions" "css_element"
71
    And I should not see "Sort by Course full name descending" in the ".course-listing-actions" "css_element"
72
    And I should not see "Sort by Course short name ascending" in the ".course-listing-actions" "css_element"
73
    And I should not see "Sort by Course short name descending" in the ".course-listing-actions" "css_element"
74
    And I should not see "Sort by Course ID number ascending" in the ".course-listing-actions" "css_element"
75
    And I should not see "Sort by Course ID number descending" in the ".course-listing-actions" "css_element"
76
    And I should not see "Sort by Course time created ascending" in the ".course-listing-actions" "css_element"
77
    And I should not see "Sort by Course time created descending" in the ".course-listing-actions" "css_element"
78
    And I open the action menu in ".course-listing-actions" "css_element"
79
    And I should see "Sort by Course full name ascending" in the ".course-listing-actions" "css_element"
80
    And I should see "Sort by Course full name descending" in the ".course-listing-actions" "css_element"
81
    And I should see "Sort by Course short name ascending" in the ".course-listing-actions" "css_element"
82
    And I should see "Sort by Course short name descending" in the ".course-listing-actions" "css_element"
83
    And I should see "Sort by Course ID number ascending" in the ".course-listing-actions" "css_element"
84
    And I should see "Sort by Course ID number descending" in the ".course-listing-actions" "css_element"
85
    And I should see "Sort by Course time created ascending" in the ".course-listing-actions" "css_element"
86
    And I should see "Sort by Course time created descending" in the ".course-listing-actions" "css_element"
87
    And I click on <sortby> "link" in the ".course-listing-actions" "css_element"
88
    And a new page should have loaded since I started watching
89
    And I should see the "Course categories and courses" management page
90
    And I should see course listing <course1> before <course2>
91
    And I should see course listing <course2> before <course3>
92
 
93
    Examples:
94
      | sortby | course1 | course2 | course3 |
95
      | "Sort by Course full name ascending"     | "Applied sciences"        | "Extended social studies" | "Social studies" |
96
      | "Sort by Course full name descending"    | "Social studies"          | "Extended social studies" | "Applied sciences" |
97
      | "Sort by Course short name ascending"    | "Extended social studies" | "Applied sciences"        | "Social studies" |
98
      | "Sort by Course short name descending"   | "Social studies"          | "Applied sciences"        | "Extended social studies" |
99
      | "Sort by Course ID number ascending"     | "Extended social studies" | "Social studies"          | "Applied sciences" |
100
      | "Sort by Course ID number descending"    | "Applied sciences"        | "Social studies"          | "Extended social studies" |
101
      | "Sort by Course time created ascending"  | "Social studies"          | "Applied sciences"        | "Extended social studies" |
102
      | "Sort by Course time created descending" | "Extended social studies" | "Applied sciences"        | "Social studies" |
103
 
104
  Scenario: Test moving courses up and down by one.
105
    Given the following "categories" exist:
106
      | name | category | idnumber |
107
      | Cat 1 | 0 | CAT1 |
108
    And the following "courses" exist:
109
      | category | fullname | shortname | idnumber |
110
      | CAT1 | Course 1 | Course 1 | C1 |
111
      | CAT1 | Course 2 | Course 2 | C2 |
112
      | CAT1 | Course 3 | Course 3 | C3 |
113
 
114
    And I log in as "admin"
115
    And I go to the courses management page
116
    And I should see the "Course categories and courses" management page
117
    And I click on category "Cat 1" in the management interface
118
    # Redirect.
119
    And I should see the "Course categories and courses" management page
120
    And I should see "Course categories" in the "#category-listing h3" "css_element"
121
    And I should see "Cat 1" in the "#category-listing" "css_element"
122
    And I open the action menu in ".course-listing-actions" "css_element"
123
    And I click on "Sort by Course ID number ascending" "link" in the ".course-listing-actions" "css_element"
124
    # Redirect.
125
    And I should see the "Course categories and courses" management page
126
    And I should see course listing "Course 1" before "Course 2"
127
    And I should see course listing "Course 2" before "Course 3"
128
    And I click to move course "C1" down one
129
    # Redirect.
130
    And I should see the "Course categories and courses" management page with a course selected
131
    And I should see course listing "Course 2" before "Course 1"
132
    And I should see course listing "Course 1" before "Course 3"
133
    And I click to move course "C3" up one
134
    # Redirect.
135
    And I should see the "Course categories and courses" management page with a course selected
136
    And I should see course listing "Course 2" before "Course 3"
137
    And I should see course listing "Course 3" before "Course 1"
138
 
139
  # Like the above test but with JavaScript enabled.
140
  @javascript
141
  Scenario: Test using AJAX to move courses up and down by one.
142
    Given the following "categories" exist:
143
      | name | category | idnumber |
144
      | Cat 1 | 0 | CAT1 |
145
    And the following "courses" exist:
146
      | category | fullname | shortname | idnumber |
147
      | CAT1 | Course 1 | Course 1 | C1 |
148
      | CAT1 | Course 2 | Course 2 | C2 |
149
      | CAT1 | Course 3 | Course 3 | C3 |
150
 
151
    And I log in as "admin"
152
    And I go to the courses management page
153
    And I start watching to see if a new page loads
154
    And I should see the "Course categories and courses" management page
155
    And I click on category "Cat 1" in the management interface
156
    And a new page should have loaded since I started watching
157
    And I start watching to see if a new page loads
158
    And I should see the "Course categories and courses" management page
159
    And I should see "Course categories" in the "#category-listing h3" "css_element"
160
    And I should see "Cat 1" in the "#category-listing" "css_element"
161
    And I open the action menu in ".course-listing-actions" "css_element"
162
    And I click on "Sort by Course ID number ascending" "link" in the ".course-listing-actions" "css_element"
163
    And a new page should have loaded since I started watching
164
    And I start watching to see if a new page loads
165
    And I should see the "Course categories and courses" management page
166
    And I should see course listing "Course 1" before "Course 2"
167
    And I should see course listing "Course 2" before "Course 3"
168
    And I click to move course "C1" down one
169
    And a new page should not have loaded since I started watching
170
    And I should see course listing "Course 2" before "Course 1"
171
    And I should see course listing "Course 1" before "Course 3"
172
    And I click to move course "C3" up one
173
    And a new page should not have loaded since I started watching
174
    And I should see course listing "Course 2" before "Course 3"
175
    And I should see course listing "Course 3" before "Course 1"