Merge branch 'wip-MDL-57769-master' of https://github.com/marinaglancy/moodle
[moodle.git] / course / format / topics / tests / behat / edit_delete_sections.feature
CommitLineData
ca9cae84
MG
1@format @format_topics
2Feature: Sections can be edited and deleted in topics format
3 In order to rearrange my course contents
4 As a teacher
5 I need to edit and Delete topics
6
7 Background:
8 Given the following "users" exist:
9 | username | firstname | lastname | email |
0fe86bbd 10 | teacher1 | Teacher | 1 | teacher1@example.com |
ca9cae84
MG
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"
fdeeaff9 24 And I am on "Course 1" course homepage with editing mode on
ca9cae84 25
f1bfc897
JP
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"
f840bf03
MG
28 Then the field "Custom" matches value "0"
29 And the field "New value for Section name" matches value "General"
f1bfc897
JP
30
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:
f840bf03
MG
34 | Custom | 1 |
35 | New value for Section name | This is the general section |
f1bfc897
JP
36 And I press "Save changes"
37 Then I should see "This is the general section" in the "li#section-0" "css_element"
38
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"
f840bf03
MG
41 Then the field "Custom" matches value "0"
42 And the field "New value for Section name" matches value "Topic 2"
f1bfc897 43
ca9cae84 44 Scenario: Edit section summary in topics format
a48f2d3d 45 When I edit the section "2" and I fill the form with:
ca9cae84 46 | Summary | Welcome to section 2 |
ca9cae84
MG
47 Then I should see "Welcome to section 2" in the "li#section-2" "css_element"
48
49 Scenario: Edit section default name in topics format
a48f2d3d 50 When I edit the section "2" and I fill the form with:
f840bf03
MG
51 | Custom | 1 |
52 | New value for Section name | This is the second topic |
ca9cae84
MG
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"
55
f26481c2
MG
56 @javascript
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"
ba5c5083 61 Then I should not see "Topic 1" in the "region-main" "region"
f26481c2
MG
62 And "New name for topic" "field" should not exist
63 And I should see "Midterm evaluation" in the "li#section-1" "css_element"
fdeeaff9 64 And I am on "Course 1" course homepage
ba5c5083 65 And I should not see "Topic 1" in the "region-main" "region"
f26481c2
MG
66 And I should see "Midterm evaluation" in the "li#section-1" "css_element"
67
ca9cae84 68 Scenario: Deleting the last section in topics format
60cf0742 69 When I delete section "5"
5962f0df 70 Then I should see "Are you absolutely sure you want to completely delete \"Topic 5\" and all the activities it contains?"
fdb5d626 71 And I press "Delete"
ca9cae84 72 And I should not see "Topic 5"
af0698c0 73 And I should see "Topic 4"
ca9cae84
MG
74
75 Scenario: Deleting the middle section in topics format
60cf0742 76 When I delete section "4"
fdb5d626 77 And I press "Delete"
ca9cae84
MG
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"
af0698c0 81 And I should see "Topic 4"