2 Feature: Sections can be edited and deleted in weeks format
3 In order to rearrange my course contents
5 I need to edit and Delete weeks
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 | startdate |
13 | Course 1 | C1 | weeks | 0 | 5 | 957139200 |
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 weeks 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 weeks 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 weeks format
40 When I click on "Edit week" "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 "8 May - 14 May"
44 Scenario: Edit section summary in weeks format
45 When I click on "Edit week" "link" in the "li#section-2" "css_element"
46 And I set the following fields to these values:
47 | Summary | Welcome to section 2 |
48 And I press "Save changes"
49 Then I should see "Welcome to section 2" in the "li#section-2" "css_element"
51 Scenario: Edit section default name in weeks format
52 Given I should see "8 May - 14 May" in the "li#section-2" "css_element"
53 When I click on "Edit week" "link" in the "li#section-2" "css_element"
54 And I set the following fields to these values:
56 | New value for Section name | This is the second week |
57 And I press "Save changes"
58 Then I should see "This is the second week" in the "li#section-2" "css_element"
59 And I should not see "8 May - 14 May" in the "li#section-2" "css_element"
62 Scenario: Inline edit section name in weeks format
63 When I click on "Edit week name" "link" in the "li#section-1" "css_element"
64 And I set the field "New name for week 1 May - 7 May" to "Midterm evaluation"
65 And I press key "13" in the field "New name for week 1 May - 7 May"
66 Then I should not see "1 May - 7 May" in the "region-main" "region"
67 And "New name for week" "field" should not exist
68 And I should see "Midterm evaluation" in the "li#section-1" "css_element"
69 And I am on "Course 1" course homepage
70 And I should not see "1 May - 7 May" in the "region-main" "region"
71 And I should see "Midterm evaluation" in the "li#section-1" "css_element"
73 Scenario: Deleting the last section in weeks format
74 Given I should see "29 May - 4 June" in the "li#section-5" "css_element"
75 When I delete section "5"
76 Then I should see "Are you absolutely sure you want to completely delete \"29 May - 4 June\" and all the activities it contains?"
78 And I should not see "29 May - 4 June"
79 And I should see "22 May - 28 May"
81 Scenario: Deleting the middle section in weeks format
82 Given I should see "29 May - 4 June" in the "li#section-5" "css_element"
83 When I delete section "4"
85 Then I should not see "29 May - 4 June"
86 And I should not see "Test chat name"
87 And I should see "Test choice name" in the "li#section-4" "css_element"
88 And I should see "22 May - 28 May"