2 Feature: Sections can be edited and deleted in topics format
3 In order to rearrange my course contents
5 I need to edit and Delete topics
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 "activities" exist:
15 | activity | name | intro | course | idnumber | section |
16 | assign | Test assignment name | Test assignment description | C1 | assign1 | 0 |
17 | book | Test book name | Test book description | C1 | book1 | 1 |
18 | chat | Test chat name | Test chat description | C1 | chat1 | 4 |
19 | choice | Test choice name | Test choice description | C1 | choice1 | 5 |
20 And the following "course enrolments" exist:
21 | user | course | role |
22 | teacher1 | C1 | editingteacher |
23 And I log in as "teacher1"
24 And I am on "Course 1" course homepage with editing mode on
26 Scenario: View the default name of the general section in topics format
27 When I click on "Edit section" "link" in the "li#section-0" "css_element"
28 Then the field "Custom" matches value "0"
29 And the field "New value for Section name" matches value "General"
31 Scenario: Edit the default name of the general section in topics format
32 When I click on "Edit section" "link" in the "li#section-0" "css_element"
33 And I set the following fields to these values:
35 | New value for Section name | This is the general section |
36 And I press "Save changes"
37 Then I should see "This is the general section" in the "li#section-0" "css_element"
39 Scenario: View the default name of the second section in topics format
40 When I click on "Edit topic" "link" in the "li#section-2" "css_element"
41 Then the field "Custom" matches value "0"
42 And the field "New value for Section name" matches value "Topic 2"
44 Scenario: Edit section summary in topics format
45 When I edit the section "2" and I fill the form with:
46 | Summary | Welcome to section 2 |
47 Then I should see "Welcome to section 2" in the "li#section-2" "css_element"
49 Scenario: Edit section default name in topics format
50 When I edit the section "2" and I fill the form with:
52 | New value for Section name | This is the second topic |
53 Then I should see "This is the second topic" in the "li#section-2" "css_element"
54 And I should not see "Topic 2" in the "li#section-2" "css_element"
57 Scenario: Inline edit section name in topics format
58 When I click on "Edit topic name" "link" in the "li#section-1" "css_element"
59 And I set the field "New name for topic Topic 1" to "Midterm evaluation"
60 And I press key "13" in the field "New name for topic Topic 1"
61 Then I should not see "Topic 1" in the "region-main" "region"
62 And "New name for topic" "field" should not exist
63 And I should see "Midterm evaluation" in the "li#section-1" "css_element"
64 And I am on "Course 1" course homepage
65 And I should not see "Topic 1" in the "region-main" "region"
66 And I should see "Midterm evaluation" in the "li#section-1" "css_element"
68 Scenario: Deleting the last section in topics format
69 When I delete section "5"
70 Then I should see "Are you absolutely sure you want to completely delete \"Topic 5\" and all the activities it contains?"
72 And I should not see "Topic 5"
73 And I should see "Topic 4"
75 Scenario: Deleting the middle section in topics format
76 When I delete section "4"
78 Then I should not see "Topic 5"
79 And I should not see "Test chat name"
80 And I should see "Test choice name" in the "li#section-4" "css_element"
81 And I should see "Topic 4"