Skip to content

Commit 04ceb5b

Browse files
committed
MDL-80460 behat: Fix tests to replace Topic with Section
The behat tests using the course format topics have been reviewed to: - Add the 'inisections' parameter where necessary, facilitating automatic renaming of section names. - Evaluate failing tests due to slight changes in ordering. Notably, in the topics format, sections are now uniformly named 'New section' without any numbering.
1 parent 10ca277 commit 04ceb5b

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

43 files changed

+757
-655
lines changed

admin/tool/behat/tests/behat/data_generators.feature

+1-1
Original file line numberDiff line numberDiff line change
@@ -101,7 +101,7 @@ Feature: Set up contextual data for tests
101101
| user | course | role |
102102
| student1 | C1 | student |
103103
When I am on the "Course 1" course page logged in as student1
104-
Then I should see "Topic 1"
104+
Then I should see "New section"
105105

106106
Scenario: Add role assigns
107107
Given the following "roles" exist:

admin/tool/generator/tests/behat/testscenario.feature

+2-2
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,8 @@ Feature: Create testing scenarios using generators
1212
And I press "Import"
1313
And I should see "Scenario: Create course content"
1414
Then I am on the "C1" "Course" page
15-
And I should see "Activity sample 1" in the "Topic 1" "section"
16-
And I should see "Activity sample 2" in the "Topic 1" "section"
15+
And I should see "Activity sample 1" in the "Section 1" "section"
16+
And I should see "Activity sample 2" in the "Section 1" "section"
1717
And I navigate to course participants
1818
And I should see "Teacher Test1"
1919
And I should see "Student Test1"

admin/tool/generator/tests/fixtures/testscenario/scenario.feature

+1
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ Feature: Prepare scenario for testing
55
| shortname | C1 |
66
| category | 0 |
77
| numsections | 3 |
8+
| initsections | 1 |
89
And the following "activities" exist:
910
| activity | name | intro | course | idnumber | section | visible |
1011
| assign | Activity sample 1 | Test assignment description | C1 | sample1 | 1 | 1 |

admin/tool/recyclebin/tests/behat/basic_functionality.feature

+4-4
Original file line numberDiff line numberDiff line change
@@ -11,9 +11,9 @@ Feature: Basic recycle bin functionality
1111
| student1 | Student | 1 | student@asd.com |
1212
| student2 | Student | 2 | student2@asd.com |
1313
And the following "courses" exist:
14-
| fullname | shortname |
15-
| Course 1 | C1 |
16-
| Course 2 | C2 |
14+
| fullname | shortname | initsections |
15+
| Course 1 | C1 | 1 |
16+
| Course 2 | C2 | 0 |
1717
And the following "activities" exist:
1818
| activity | course | section | name | intro |
1919
| assign | C1 | 1 | Test assign 1 | Test 1 |
@@ -56,7 +56,7 @@ Feature: Basic recycle bin functionality
5656
And I should see "'Test assign 1' has been restored"
5757
And I wait to be redirected
5858
And I am on "Course 1" course homepage
59-
And I should see "Test assign 1" in the "Topic 1" "section"
59+
And I should see "Test assign 1" in the "Section 1" "section"
6060

6161
@javascript
6262
Scenario: Restore a deleted course

availability/tests/behat/display_availability.feature

+11-9
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
@core @core_availability
2-
Feature: display_availability
2+
Feature: Display availability for activities and sections
33
In order to know which activities are available
44
As a user
55
I need to see appropriate availability restrictions for activities and sections
@@ -23,9 +23,11 @@ Feature: display_availability
2323
# and for each condition type.)
2424

2525
Background:
26-
Given the following "courses" exist:
27-
| fullname | shortname | format |
28-
| Course 1 | C1 | topics |
26+
Given the following "course" exists:
27+
| fullname | Course 1 |
28+
| shortname | C1 |
29+
| format | topics |
30+
| initsections | 1 |
2931
And the following "users" exist:
3032
| username |
3133
| teacher1 |
@@ -93,17 +95,17 @@ Feature: display_availability
9395

9496
# Page 1 display still there but should not be a link.
9597
Then I should see "Page 1" in the "#section-1" "css_element"
96-
And ".activity-instance a" "css_element" should not exist in the "Topic 1" "section"
98+
And ".activity-instance a" "css_element" should not exist in the "Section 1" "section"
9799

98100
# Date display should be present.
99-
And I should see "Available until" in the "Topic 1" "section"
101+
And I should see "Available until" in the "Section 1" "section"
100102

101103
# Page 2 display not there at all
102104
And I should not see "Page 2" in the "region-main" "region"
103105

104106
# Page 3 display and link
105107
And I should see "Page 3" in the "region-main" "region"
106-
And ".activity-instance a" "css_element" should exist in the "Topic 3" "section"
108+
And ".activity-instance a" "css_element" should exist in the "Section 3" "section"
107109

108110
@javascript
109111
Scenario: Section availability display
@@ -153,12 +155,12 @@ Feature: display_availability
153155
And I should see "Page 3" in the "region-main" "region"
154156

155157
# Section 1 should be visible and show info.
156-
And I should see "Topic 1" in the "region-main" "region"
158+
And I should see "Section 1" in the "region-main" "region"
157159
And I should see "Not available unless" in the "section-1" "core_availability > Section availability"
158160
And I click on "Show more" "button" in the "section-1" "core_availability > Section availability"
159161
And I should see "Email address" in the "section-1" "core_availability > Section availability"
160162
And I click on "Show less" "button" in the "section-1" "core_availability > Section availability"
161163
And I should not see "Email address" in the "section-1" "core_availability > Section availability"
162164

163165
# Section 2 should not be available at all
164-
And I should not see "Topic 2" in the "region-main" "region"
166+
And I should not see "Section 2" in the "region-main" "region"

backup/util/ui/tests/behat/backup_courses.feature

+7-7
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,9 @@ Feature: Backup Moodle courses
66

77
Background:
88
Given the following "courses" exist:
9-
| fullname | shortname | category | numsections |
10-
| Course 1 | C1 | 0 | 10 |
11-
| Course 2 | C2 | 0 | 2 |
9+
| fullname | shortname | category | numsections | initsections |
10+
| Course 1 | C1 | 0 | 10 | 1 |
11+
| Course 2 | C2 | 0 | 2 | 1 |
1212
And the following "activities" exist:
1313
| activity | course | idnumber | name | intro | section |
1414
| assign | C2 | assign1 | Test assign | Assign description | 1 |
@@ -28,11 +28,11 @@ Feature: Backup Moodle courses
2828
When I backup "Course 1" course using this options:
2929
| Initial | Include calendar events | 0 |
3030
| Initial | Include course logs | 1 |
31-
| Schema | Topic 5 | 0 |
31+
| Schema | Section 5 | 0 |
3232
| Confirmation | Filename | test_backup.mbz |
3333
Then I should see "Restore"
3434
And I click on "Restore" "link" in the "test_backup.mbz" "table_row"
35-
And I should not see "Section 3"
35+
And I should not see "Section 5" in the "region-main" "region"
3636
And I press "Continue"
3737
And I click on "Continue" "button" in the ".bcs-current-course" "css_element"
3838
And "No" "icon" should exist in the "//div[contains(concat(' ', normalize-space(@class), ' '), ' fitem ')][contains(., 'Include calendar events')]" "xpath_element"
@@ -47,11 +47,11 @@ Feature: Backup Moodle courses
4747
Scenario: Backup selecting just one section
4848
When I backup "Course 2" course using this options:
4949
| Schema | Test data | 0 |
50-
| Schema | Topic 2 | 0 |
50+
| Schema | Section 2 | 0 |
5151
| Confirmation | Filename | test_backup.mbz |
5252
Then I should see "Course backup area"
5353
And I click on "Restore" "link" in the "test_backup.mbz" "table_row"
54-
And I should not see "Section 2"
54+
And I should not see "Section 2" in the "region-main" "region"
5555
And I press "Continue"
5656
And I click on "Continue" "button" in the ".bcs-current-course" "css_element"
5757
And I press "Next"

backup/util/ui/tests/behat/duplicate_activities.feature

+7-5
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,11 @@ Feature: Duplicate activities
55
I need to duplicate activities inside the same course
66

77
Scenario: Duplicate an activity
8-
Given the following "courses" exist:
9-
| fullname | shortname | category |
10-
| Course 1 | C1 | 0 |
8+
Given the following "course" exists:
9+
| fullname | Course 1 |
10+
| shortname | C1 |
11+
| category | 0 |
12+
| initsections | 1 |
1113
And the following "users" exist:
1214
| username | firstname | lastname | email |
1315
| teacher1 | Teacher | 1 | teacher1@example.com |
@@ -33,6 +35,6 @@ Feature: Duplicate activities
3335
| Name | Duplicated database name |
3436
| Description | Duplicated database description |
3537
And I press "Save and return to course"
36-
Then I should see "Original database name" in the "Topic 1" "section"
37-
And I should see "Duplicated database name" in the "Topic 1" "section"
38+
Then I should see "Original database name" in the "Section 1" "section"
39+
And I should see "Duplicated database name" in the "Section 1" "section"
3840
And "Original database name" "link" should appear before "Duplicated database name" "link"

backup/util/ui/tests/behat/restore_moodle2_courses.feature

+33-29
Original file line numberDiff line numberDiff line change
@@ -6,20 +6,24 @@ Feature: Restore Moodle 2 course backups
66

77
Background:
88
Given the following "courses" exist:
9-
| fullname | shortname | category | format | numsections | coursedisplay |
10-
| Course 1 | C1 | 0 | topics | 15 | 1 |
11-
| Course 2 | C2 | 0 | topics | 5 | 0 |
12-
| Course 3 | C3 | 0 | topics | 2 | 0 |
13-
| Course 4 | C4 | 0 | topics | 20 | 0 |
9+
| fullname | shortname | category | format | numsections | coursedisplay | initsections |
10+
| Course 1 | C1 | 0 | topics | 15 | 1 | 1 |
11+
| Course 2 | C2 | 0 | topics | 5 | 0 | 1 |
12+
| Course 3 | C3 | 0 | topics | 2 | 0 | 1 |
13+
| Course 4 | C4 | 0 | topics | 20 | 0 | 1 |
14+
| Course 5 | C5 | 0 | topics | 15 | 1 | 0 |
1415
And the following "activities" exist:
1516
| activity | course | idnumber | name | intro | section | externalurl |
1617
| assign | C3 | assign1 | Test assign name | Assign description | 1 | |
1718
| data | C3 | data1 | Test database name | Database description | 2 | |
1819
| forum | C1 | 0001 | Test forum name | | 1 | |
1920
| url | C1 | url1 | Test URL name | Test URL description | 3 | http://www.moodle.org |
21+
| forum | C5 | 0005 | Test forum name | | 1 | |
22+
| url | C5 | url5 | Test URL name | Test URL description | 3 | http://www.moodle.org |
2023
And the following "blocks" exist:
2124
| blockname | contextlevel | reference | pagetypepattern | defaultregion |
2225
| activity_modules | Course | C1 | course-view-* | side-pre |
26+
| activity_modules | Course | C5 | course-view-* | side-pre |
2327
And I log in as "admin"
2428
And I am on "Course 1" course homepage with editing mode on
2529

@@ -41,8 +45,8 @@ Feature: Restore Moodle 2 course backups
4145
Then I should see "Course 1 restored in a new course"
4246
And I should see "Activities" in the "Activities" "block"
4347
And I should see "Test forum name"
44-
And I should see "Topic 15"
45-
And I should not see "Topic 16"
48+
And I should see "Section 15"
49+
And I should not see "Section 16"
4650
And I navigate to "Settings" in current page administration
4751
And I expand all fieldsets
4852
And the field "id_format" matches value "Custom sections"
@@ -79,10 +83,10 @@ Feature: Restore Moodle 2 course backups
7983

8084
@javascript
8185
Scenario: Restore a backup into a new course changing the course format afterwards
82-
Given I backup "Course 1" course using this options:
86+
Given I backup "Course 5" course using this options:
8387
| Confirmation | Filename | test_backup.mbz |
8488
When I restore "test_backup.mbz" backup into a new course using this options:
85-
Then I should see "Topic 1"
89+
Then I should see "New section"
8690
And I should see "Test forum name"
8791
And I navigate to "Settings" in current page administration
8892
And I expand all fieldsets
@@ -125,10 +129,10 @@ Feature: Restore Moodle 2 course backups
125129
And section "3" should be visible
126130
And section "7" should be hidden
127131
And section "15" should be visible
128-
And I should see "Topic 15"
129-
And I should not see "Topic 16"
130-
And I should see "Test URL name" in the "Topic 3" "section"
131-
And I should see "Test forum name" in the "Topic 1" "section"
132+
And I should see "Section 15"
133+
And I should not see "Section 16"
134+
And I should see "Test URL name" in the "Section 3" "section"
135+
And I should see "Test forum name" in the "Section 1" "section"
132136

133137
@javascript
134138
Scenario: Restore a backup in an existing course keeping the target course settings
@@ -147,10 +151,10 @@ Feature: Restore Moodle 2 course backups
147151
And section "3" should be visible
148152
And section "7" should be hidden
149153
And section "15" should be visible
150-
And I should see "Topic 15"
151-
And I should not see "Topic 16"
152-
And I should see "Test URL name" in the "Topic 3" "section"
153-
And I should see "Test forum name" in the "Topic 1" "section"
154+
And I should see "Section 15"
155+
And I should not see "Section 16"
156+
And I should see "Test URL name" in the "Section 3" "section"
157+
And I should see "Test forum name" in the "Section 1" "section"
154158

155159
@javascript
156160
Scenario: Restore a backup in an existing course deleting contents and retaining the backup course settings
@@ -171,10 +175,10 @@ Feature: Restore Moodle 2 course backups
171175
And section "3" should be hidden
172176
And section "7" should be hidden
173177
And section "15" should be visible
174-
And I should see "Topic 15"
175-
And I should not see "Topic 16"
176-
And I should see "Test URL name" in the "Topic 3" "section"
177-
And I should see "Test forum name" in the "Topic 1" "section"
178+
And I should see "Section 15"
179+
And I should not see "Section 16"
180+
And I should see "Test URL name" in the "Section 3" "section"
181+
And I should see "Test forum name" in the "Section 1" "section"
178182

179183
@javascript
180184
Scenario: Restore a backup in an existing course deleting contents and keeping the current course settings
@@ -195,10 +199,10 @@ Feature: Restore Moodle 2 course backups
195199
And section "3" should be hidden
196200
And section "7" should be hidden
197201
And section "15" should be visible
198-
And I should see "Topic 15"
199-
And I should not see "Topic 16"
200-
And I should see "Test URL name" in the "Topic 3" "section"
201-
And I should see "Test forum name" in the "Topic 1" "section"
202+
And I should see "Section 15"
203+
And I should not see "Section 16"
204+
And I should see "Test URL name" in the "Section 3" "section"
205+
And I should see "Test forum name" in the "Section 1" "section"
202206

203207
@javascript
204208
Scenario: Restore a backup in an existing course deleting contents decreasing the number of sections
@@ -219,10 +223,10 @@ Feature: Restore Moodle 2 course backups
219223
And section "3" should be hidden
220224
And section "7" should be hidden
221225
And section "15" should be visible
222-
And I should see "Topic 15"
223-
And I should not see "Topic 16"
224-
And I should see "Test URL name" in the "Topic 3" "section"
225-
And I should see "Test forum name" in the "Topic 1" "section"
226+
And I should see "Section 15"
227+
And I should not see "Section 16"
228+
And I should see "Test URL name" in the "Section 3" "section"
229+
And I should see "Test forum name" in the "Section 1" "section"
226230

227231
@javascript
228232
Scenario: Restore a backup with override permission

blocks/section_links/tests/behat/show_section_name.feature

+10-6
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,13 @@
22
Feature: The Section links block can be configured to display section name in addition to section number
33

44
Background:
5-
Given the following "courses" exist:
6-
| fullname | shortname | category | numsections | coursedisplay |
7-
| Course 1 | C1 | 0 | 10 | 1 |
5+
Given the following "course" exists:
6+
| fullname | Course 1 |
7+
| shortname | C1 |
8+
| category | 0 |
9+
| numsections | 10 |
10+
| coursedisplay | 1 |
11+
| initsections | 1 |
812
And the following "activities" exist:
913
| activity | name | course | idnumber | section |
1014
| assign | First assignment | C1 | assign1 | 7 |
@@ -25,8 +29,8 @@ Feature: The Section links block can be configured to display section name in ad
2529

2630
Scenario: Student can see section name under the Section links block
2731
When I am on the "Course 1" course page logged in as student1
28-
Then I should see "7: Topic 7" in the "Section links" "block"
29-
And I follow "7: Topic 7"
32+
Then I should see "7: Section 7" in the "Section links" "block"
33+
And I follow "7: Section 7"
3034
And I should see "First assignment"
3135

3236
Scenario: Teacher can configure existing Section links block to display section number or section name
@@ -36,7 +40,7 @@ Feature: The Section links block can be configured to display section name in ad
3640
And I set the following fields to these values:
3741
| Display section name | No |
3842
And I click on "Save changes" "button"
39-
Then I should not see "7: Topic 7" in the "Section links" "block"
43+
Then I should not see "7: Section 7" in the "Section links" "block"
4044
And I should see "7" in the "Section links" "block"
4145
And I follow "7"
4246
And I should see "First assignment"

0 commit comments

Comments
 (0)