source: moodle/trunk/fuentes/course/format/weeks/tests/behat/edit_delete_sections.feature @ 1331

Last change on this file since 1331 was 1331, checked in by jrpelegrina, 3 years ago

Updated to moodle 3.0.3

File size: 5.3 KB
Line 
1@format @format_weeks
2Feature: Sections can be edited and deleted in weeks format
3  In order to rearrange my course contents
4  As a teacher
5  I need to edit and Delete weeks
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 | 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 follow "Course 1"
25    And I turn editing mode on
26
27  Scenario: View the default name of the general section in weeks format
28    When I click on "Edit section" "link" in the "li#section-0" "css_element"
29    Then I should see "Use default section name [General]"
30
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:
34      | Use default section name | 0                           |
35      | 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"
38
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 I should see "Use default section name [8 May - 14 May]"
42
43  Scenario: Edit section summary in weeks format
44    When I click on "Edit week" "link" in the "li#section-2" "css_element"
45    And I set the following fields to these values:
46      | Summary | Welcome to section 2 |
47    And I press "Save changes"
48    Then I should see "Welcome to section 2" in the "li#section-2" "css_element"
49
50  Scenario: Edit section default name in weeks format
51    Given I should see "8 May - 14 May" in the "li#section-2" "css_element"
52    When I click on "Edit week" "link" in the "li#section-2" "css_element"
53    And I set the following fields to these values:
54      | Use default section name | 0                       |
55      | name                     | This is the second week |
56    And I press "Save changes"
57    Then I should see "This is the second week" in the "li#section-2" "css_element"
58    And I should not see "8 May - 14 May" in the "li#section-2" "css_element"
59
60  Scenario: Deleting the last section in weeks format
61    Given I should see "29 May - 4 June" in the "li#section-5" "css_element"
62    When I delete section "5"
63    Then I should see "Are you absolutely sure you want to completely delete \"29 May - 4 June\" and all the activities it contains?"
64    And I press "Delete"
65    And I should not see "29 May - 4 June"
66    And I navigate to "Edit settings" node in "Course administration"
67    And I expand all fieldsets
68    And the field "Number of sections" matches value "4"
69
70  Scenario: Deleting the middle section in weeks format
71    Given I should see "29 May - 4 June" in the "li#section-5" "css_element"
72    When I delete section "4"
73    And I press "Delete"
74    Then I should not see "29 May - 4 June"
75    And I should not see "Test chat name"
76    And I should see "Test choice name" in the "li#section-4" "css_element"
77    And I navigate to "Edit settings" node in "Course administration"
78    And I expand all fieldsets
79    And the field "Number of sections" matches value "4"
80
81  Scenario: Deleting the orphaned section in weeks format
82    When I follow "Reduce the number of sections"
83    Then I should see "Orphaned activities (section 5)" in the "li#section-5" "css_element"
84    And I delete section "5"
85    And I press "Delete"
86    And I should not see "29 May - 4 June"
87    And I should not see "Orphaned activities"
88    And "li#section-5" "css_element" should not exist
89    And I navigate to "Edit settings" node in "Course administration"
90    And I expand all fieldsets
91    And the field "Number of sections" matches value "4"
92
93  Scenario: Deleting a section when orphaned section is present in weeks format
94    When I follow "Reduce the number of sections"
95    Then I should see "Orphaned activities (section 5)" in the "li#section-5" "css_element"
96    And "li#section-5.orphaned" "css_element" should exist
97    And "li#section-4.orphaned" "css_element" should not exist
98    And I delete section "1"
99    And I press "Delete"
100    And I should not see "Test book name"
101    And I should see "Orphaned activities (section 4)" in the "li#section-4" "css_element"
102    And "li#section-5" "css_element" should not exist
103    And "li#section-4.orphaned" "css_element" should exist
104    And "li#section-3.orphaned" "css_element" should not exist
Note: See TracBrowser for help on using the repository browser.