1 |
efrain |
1 |
@format @format_topics
|
|
|
2 |
Feature: Sections can be edited and deleted in custom sections format
|
|
|
3 |
In order to rearrange my course contents
|
|
|
4 |
As a teacher
|
|
|
5 |
I need to edit and delete sections
|
|
|
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 | initsections |
|
|
|
13 |
| Course 1 | C1 | topics | 0 | 5 | 1 |
|
|
|
14 |
| Course 2 | C2 | topics | 0 | 1 | 0 |
|
|
|
15 |
And the following "activities" exist:
|
|
|
16 |
| activity | name | intro | course | idnumber | section |
|
|
|
17 |
| assign | Test assignment name | Test assignment description | C1 | assign1 | 0 |
|
|
|
18 |
| book | Test book name | | C1 | book1 | 1 |
|
|
|
19 |
| lesson | Test lesson name | Test lesson description | C1 | lesson1 | 4 |
|
|
|
20 |
| choice | Test choice name | Test choice description | C1 | choice1 | 5 |
|
|
|
21 |
And the following "course enrolments" exist:
|
|
|
22 |
| user | course | role |
|
|
|
23 |
| teacher1 | C1 | editingteacher |
|
|
|
24 |
| teacher1 | C2 | editingteacher |
|
|
|
25 |
And I log in as "teacher1"
|
|
|
26 |
|
|
|
27 |
Scenario: View the default name of the general section in custom sections format
|
|
|
28 |
Given I am on "Course 1" course homepage with editing mode on
|
|
|
29 |
When I edit the section "0"
|
|
|
30 |
Then the field "Section name" matches value ""
|
|
|
31 |
And I should see "General"
|
|
|
32 |
|
|
|
33 |
Scenario: Edit the default name of the general section in custom sections format
|
|
|
34 |
Given I am on "Course 1" course homepage with editing mode on
|
|
|
35 |
And I should see "General" in the "General" "section"
|
|
|
36 |
When I edit the section "0" and I fill the form with:
|
|
|
37 |
| Section name | This is the general section |
|
|
|
38 |
Then I should see "This is the general section" in the "page" "region"
|
|
|
39 |
|
|
|
40 |
Scenario: View the default name of the second section in custom sections format
|
|
|
41 |
Given I am on "Course 2" course homepage with editing mode on
|
|
|
42 |
When I edit the section "1"
|
|
|
43 |
Then the field "Section name" matches value ""
|
|
|
44 |
And I should see "New section"
|
|
|
45 |
|
|
|
46 |
Scenario: Edit section summary in custom sections format
|
|
|
47 |
Given I am on "Course 1" course homepage with editing mode on
|
|
|
48 |
When I edit the section "2" and I fill the form with:
|
|
|
49 |
| Description | Welcome to section 2 |
|
|
|
50 |
Then I should see "Welcome to section 2" in the "page" "region"
|
|
|
51 |
|
|
|
52 |
Scenario: Edit section default name in custom sections format
|
|
|
53 |
Given I am on "Course 1" course homepage with editing mode on
|
|
|
54 |
When I edit the section "2" and I fill the form with:
|
|
|
55 |
| Section name | This is the second section |
|
|
|
56 |
Then I should see "This is the second section" in the "page" "region"
|
|
|
57 |
And I should not see "Section 2" in the "region-main" "region"
|
|
|
58 |
|
|
|
59 |
@javascript
|
|
|
60 |
Scenario: Inline edit section name in custom sections format
|
|
|
61 |
Given I am on "Course 1" course homepage with editing mode on
|
|
|
62 |
When I set the field "Edit section name" in the "Section 1" "section" to "Midterm evaluation"
|
|
|
63 |
Then I should not see "Section 1" in the "region-main" "region"
|
|
|
64 |
And "New name for section" "field" should not exist
|
|
|
65 |
And I should see "Midterm evaluation" in the "Midterm evaluation" "section"
|
|
|
66 |
And I am on "Course 1" course homepage
|
|
|
67 |
And I should not see "Section 1" in the "region-main" "region"
|
|
|
68 |
And I should see "Midterm evaluation" in the "Midterm evaluation" "section"
|
|
|
69 |
|
|
|
70 |
Scenario: Deleting the last section in custom sections format
|
|
|
71 |
Given I am on "Course 1" course homepage with editing mode on
|
|
|
72 |
When I delete section "5"
|
|
|
73 |
Then I should see "Are you absolutely sure you want to completely delete \"Section 5\" and all the activities it contains?"
|
|
|
74 |
And I press "Delete"
|
|
|
75 |
And I should not see "Section 5"
|
|
|
76 |
And I should see "Section 4"
|
|
|
77 |
|
|
|
78 |
Scenario: Deleting the middle section in custom sections format
|
|
|
79 |
Given I am on "Course 1" course homepage with editing mode on
|
|
|
80 |
When I delete section "4"
|
|
|
81 |
And I press "Delete"
|
|
|
82 |
Then I should not see "Section 4"
|
|
|
83 |
And I should see "Section 5"
|
|
|
84 |
And I should not see "Test lesson name"
|
|
|
85 |
And I should see "Test choice name" in the "Section 5" "section"
|
|
|
86 |
|
|
|
87 |
@javascript
|
|
|
88 |
Scenario: Adding sections at the end of a custom sections format
|
|
|
89 |
Given I am on "Course 1" course homepage with editing mode on
|
|
|
90 |
When I click on "Add section" "link" in the "course-addsection" "region"
|
|
|
91 |
Then I should see "New section" in the "New section" "section"
|
|
|
92 |
And I should see "Test choice name" in the "Section 5" "section"
|
|
|
93 |
|
|
|
94 |
@javascript
|
|
|
95 |
Scenario: Adding sections between in custom sections format
|
|
|
96 |
Given I am on "Course 1" course homepage with editing mode on
|
|
|
97 |
When I hover over the "Add section" "link" in the "Section 4" "section"
|
|
|
98 |
And I click on "Add section" "link" in the "Section 4" "section"
|
|
|
99 |
Then I should see "New section" in the "New section" "section"
|
|
|
100 |
And I should see "Test choice name" in the "Section 5" "section"
|
|
|
101 |
And I should not see "Test choice name" in the "New section" "section"
|
|
|
102 |
|
|
|
103 |
@javascript
|
|
|
104 |
Scenario: Add a section and then add an activity in it
|
|
|
105 |
Given I am on "Course 1" course homepage with editing mode on
|
|
|
106 |
When I click on "Add section" "link" in the "course-addsection" "region"
|
|
|
107 |
And I add an assign activity to course "Course 1" section "6" and I fill the form with:
|
|
|
108 |
| Assignment name | Very new activity |
|
|
|
109 |
| Description | Test |
|
|
|
110 |
Then I should see "Very new activity" in the "New section" "section"
|
|
|
111 |
|
|
|
112 |
@javascript
|
|
|
113 |
Scenario: Copy section permalink URL to clipboard
|
|
|
114 |
Given I am on "Course 1" course homepage with editing mode on
|
|
|
115 |
When I open section "1" edit menu
|
|
|
116 |
And I click on "Permalink" "link" in the "Section 1" "section"
|
|
|
117 |
And I click on "Copy to clipboard" "link" in the "Permalink" "dialogue"
|
|
|
118 |
Then I should see "Text copied to clipboard"
|