diff --git a/course/format/templates/local/content/section/header.mustache b/course/format/templates/local/content/section/header.mustache
index b8a7b3876f4..e4046428cba 100644
--- a/course/format/templates/local/content/section/header.mustache
+++ b/course/format/templates/local/content/section/header.mustache
@@ -64,10 +64,12 @@
aria-label="{{name}}">
{{#pix}} t/expandedchevron, core {{/pix}}
+ {{#str}} collapse, core {{/str}}
{{#pix}} t/collapsedchevron, core {{/pix}}
{{#pix}} t/collapsedchevron_rtl, core {{/pix}}
+ {{#str}} expand, core {{/str}}
Subsection1" "course > section" page
# Subsection page. Open the section header action menu.
And I click on "Edit" "icon" in the "[data-region='header-actions-container']" "css_element"
And I choose "Edit settings" in the open action menu
@@ -120,7 +120,7 @@ Feature: The module menu replaces the delegated section menu
When I choose "Permalink" in the open action menu
Then I click on "Copy to clipboard" "link"
And I should see "Text copied to clipboard"
- And I am on the "Subsection1" "subsection activity" page
+ And I am on the "C1 > Subsection1" "course > section" page
# Subsection page. Open the section header action menu.
And I click on "Edit" "icon" in the "[data-region='header-actions-container']" "css_element"
And I choose "Permalink" in the open action menu
@@ -153,7 +153,7 @@ Feature: The module menu replaces the delegated section menu
And I choose "Delete" in the open action menu
And I click on "Delete" "button" in the "Delete activity?" "dialogue"
And "Subsection2" "link" should not exist in the "#region-main-box" "css_element"
- And I am on the "Subsection3" "subsection activity" page
+ And I am on the "C1 > Subsection3" "course > section" page
# Subsection page. Open the section header action menu.
And I click on "Edit" "icon" in the "[data-region='header-actions-container']" "css_element"
And "Delete" "link" should not exist in the "[data-region='header-actions-container']" "css_element"
diff --git a/mod/subsection/tests/behat/subsection_coursepage.feature b/mod/subsection/tests/behat/subsection_coursepage.feature
new file mode 100644
index 00000000000..2caa5b96b58
--- /dev/null
+++ b/mod/subsection/tests/behat/subsection_coursepage.feature
@@ -0,0 +1,66 @@
+@mod @mod_subsection
+Feature: Users view subsections on course page
+ In order to use subsections
+ As an user
+ I need to view subsections on course page
+
+ Background:
+ Given I enable "subsection" "mod" plugin
+ And the following "users" exist:
+ | username | firstname | lastname | email |
+ | teacher1 | Teacher | 1 | teacher1@example.com |
+ | student1 | Student | 1 | student1@example.com |
+ And the following "courses" exist:
+ | fullname | shortname | category | numsections |
+ | Course 1 | C1 | 0 | 2 |
+ And the following "course enrolments" exist:
+ | user | course | role |
+ | teacher1 | C1 | editingteacher |
+ | student1 | C1 | student |
+ And the following "activities" exist:
+ | activity | name | course | idnumber | section |
+ | subsection | Subsection1 | C1 | sub1 | 1 |
+ | page | Page1 in Subsection1 | C1 | page11 | 3 |
+ | subsection | Subsection2 | C1 | sub2 | 1 |
+
+ @javascript
+ Scenario: Student can view, expand and collapse subsections on course page
+ When I log in as "student1"
+ And I am on "Course 1" course homepage
+ Then I should see "Subsection1" in the "region-main" "region"
+ And I should see "Page1 in Subsection1" in the "Subsection1" "activity"
+ And I click on "Collapse" "link" in the "Subsection1" "activity"
+ And I should not see "Page1 in Subsection1" in the "Subsection1" "activity"
+ And I click on "Expand" "link" in the "Subsection1" "activity"
+ And I click on "Page1 in Subsection1" "link" in the "Subsection1" "activity"
+
+ @javascript
+ Scenario: Teacher can create activities inside subsections on course page
+ When I log in as "teacher1"
+ And I am on "Course 1" course homepage with editing mode on
+ # Add an assignment to the top of Subsection1.
+ And I hover "Insert an activity or resource before 'Page1 in Subsection1'" "button"
+ And I press "Insert an activity or resource before 'Page1 in Subsection1'"
+ And I click on "Add a new Assignment" "link" in the "Add an activity or resource" "dialogue"
+ And I set the following fields to these values:
+ | Assignment name | Assignment1 in Subsection1 |
+ And I press "Save and return to course"
+ Then I should see "Assignment1 in Subsection1" in the "Subsection1" "activity"
+ # Add an assignment to the empty Subsection2.
+ And I add an "assign" activity to course "Course 1" section "4" and I fill the form with:
+ | Assignment name | Assignment1 in Subsection2 |
+ And I should see "Assignment1 in Subsection2" in the "Subsection2" "activity"
+
+ @javascript
+ Scenario: Teacher can create activities between subsections on course page
+ When I log in as "teacher1"
+ And I am on "Course 1" course homepage with editing mode on
+ And I hover "Insert an activity or resource before 'Subsection2'" "button"
+ And I press "Insert an activity or resource before 'Subsection2'"
+ And I click on "Add a new Assignment" "link" in the "Add an activity or resource" "dialogue"
+ And I set the following fields to these values:
+ | Assignment name | Assignment between subsections |
+ And I press "Save and return to course"
+ And I wait "5" seconds
+ And "Assignment between subsections" "link" should appear after "Page1 in Subsection1" "text"
+ And "Assignment between subsections" "link" should appear before "Subsection2" "text"
diff --git a/mod/subsection/tests/behat/subsection_rename.feature b/mod/subsection/tests/behat/subsection_rename.feature
index e1d758a709c..ec310da2a98 100644
--- a/mod/subsection/tests/behat/subsection_rename.feature
+++ b/mod/subsection/tests/behat/subsection_rename.feature
@@ -25,10 +25,11 @@ Feature: Teachers can rename subsections
@javascript
Scenario: Renaming the subsection activity changes the subsection name
Given I should see "Subsection activity" in the "page-content" "region"
- When I set the field "Edit title" in the "Subsection activity" "activity" to "New name"
+ When I set the field "Edit section name" in the "Subsection activity" "activity" to "New name"
And I should not see "Subsection activity" in the "region-main" "region"
And I should see "New name" in the "page-content" "region"
- Then I click on "New name" "link" in the "page-content" "region"
+ Then I open "New name" actions menu
+ And I choose "View" in the open action menu
And I should see "New name" in the "page" "region"
And I should see "Subactivity" in the "region-main" "region"
diff --git a/mod/subsection/tests/behat/subsection_handling.feature b/mod/subsection/tests/behat/subsection_sectionpage.feature
similarity index 67%
rename from mod/subsection/tests/behat/subsection_handling.feature
rename to mod/subsection/tests/behat/subsection_sectionpage.feature
index 0224555f3b8..3e99c1bccc5 100644
--- a/mod/subsection/tests/behat/subsection_handling.feature
+++ b/mod/subsection/tests/behat/subsection_sectionpage.feature
@@ -1,6 +1,6 @@
@mod @mod_subsection
-Feature: Teachers create and destroy subsections
- In order to use subsections
+Feature: Teachers create and destroy subsections on section page
+ In order to use subsections on section page
As an teacher
I need to create and destroy subsections
@@ -17,18 +17,6 @@ Feature: Teachers create and destroy subsections
| teacher1 | C1 | editingteacher |
And I log in as "teacher1"
- Scenario: Subsections are not listed as regular sections
- Given the following "activities" exist:
- | activity | name | course | idnumber | section |
- | subsection | Subsection1 | C1 | forum1 | 1 |
- | data | Subactivity1 | C1 | data1 | 3 |
- When I am on "Course 1" course homepage
- Then "Subsection1" "section" should not exist
- And I should not see "Subactivity1" in the "region-main" "region"
- And I click on "Subsection1" "link" in the "region-main" "region"
- And I should see "Subsection1" in the "page" "region"
- And I should see "Subactivity1" in the "region-main" "region"
-
Scenario: Activities can be created in a subsection
Given the following "activities" exist:
| activity | name | course | idnumber | section |
@@ -40,8 +28,6 @@ Feature: Teachers create and destroy subsections
And I am on "Course 1" course homepage
And I click on "Subsection1" "link" in the "region-main" "region"
Then I should see "Test assignment name" in the "region-main" "region"
- And I am on "Course 1" course homepage
- And I should not see "Test assignment name" in the "region-main" "region"
@javascript
Scenario: Teacher can create activities in a subsection page with the activity chooser
@@ -57,5 +43,3 @@ Feature: Teachers create and destroy subsections
| Description | Test assignment description |
And I press "Save and return to course"
Then I should see "Test assignment name" in the "region-main" "region"
- And I am on "Course 1" course homepage
- And I should not see "Test assignment name" in the "region-main" "region"