1@core @core_course
2Feature: Sections can be moved
3  In order to rearrange my course contents
4  As a teacher
5  I need to move sections up and down
6
7  Background:
8    Given the following "users" exist:
9      | username | firstname | lastname | email |
10      | teacher1 | Teacher | 1 | teacher1@example.com |
11    And the following "courses" exist:
12      | fullname | shortname | format | coursedisplay | numsections |
13      | Course 1 | C1 | topics | 0 | 5 |
14    And the following "course enrolments" exist:
15      | user | course | role |
16      | teacher1 | C1 | editingteacher |
17    And I log in as "teacher1"
18    And I am on "Course 1" course homepage with editing mode on
19
20  Scenario: Move up and down a section with Javascript disabled in a single page course
21    Given I add a "Forum" to section "1" and I fill the form with:
22      | Forum name | Test forum name |
23      | Description | Test forum description |
24    When I move down section "1"
25    Then I should see "Test forum name" in the "Topic 2" "section"
26    And I move up section "2"
27    And I should see "Test forum name" in the "Topic 1" "section"
28
29  Scenario: Move up and down a section with Javascript disabled in the course home of a course using paged mode
30    Given I navigate to "Edit settings" in current page administration
31    And I set the following fields to these values:
32      | Course layout | Show one section per page |
33    And I press "Save and display"
34    And I add a "Forum" to section "1" and I fill the form with:
35      | Forum name | Test forum name |
36      | Description | Test forum description |
37    When I move down section "1"
38    Then I should see "Test forum name" in the "Topic 2" "section"
39    And I move up section "2"
40    And I should see "Test forum name" in the "Topic 1" "section"
41
42  Scenario: Sections can not be moved with Javascript disabled in a section page of a course using paged mode
43    Given I navigate to "Edit settings" in current page administration
44    And I set the following fields to these values:
45      | Course layout | Show one section per page |
46    And I press "Save and display"
47    And I add a "Forum" to section "2" and I fill the form with:
48      | Forum name | Test forum name |
49      | Description | Test forum description |
50    When I follow "Topic 2"
51    Then "Topic 1" "section" should not exist
52    And "Topic 3" "section" should not exist
53    And "Move down" "link" should not exist
54    And "Move up" "link" should not exist
55