[ Index ]

PHP Cross Reference of Unnamed Project

title

Body

[close]

/course/format/topics/tests/behat/ -> edit_delete_sections.feature (source)

   1  @format @format_topics
   2  Feature: 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            |
  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 follow "Course 1"
  25      And I turn editing mode on
  26  
  27    Scenario: View the default name of the general section in topics 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 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:
  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 topics format
  40      When I click on "Edit topic" "link" in the "li#section-2" "css_element"
  41      Then I should see "Use default section name [Topic 2]"
  42  
  43    Scenario: Edit section summary in topics format
  44      When I edit the section "2" and I fill the form with:
  45        | Summary | Welcome to section 2 |
  46      Then I should see "Welcome to section 2" in the "li#section-2" "css_element"
  47  
  48    Scenario: Edit section default name in topics format
  49      When I edit the section "2" and I fill the form with:
  50        | Use default section name | 0                        |
  51        | name                     | This is the second topic |
  52      Then I should see "This is the second topic" in the "li#section-2" "css_element"
  53      And I should not see "Topic 2" in the "li#section-2" "css_element"
  54  
  55    @javascript
  56    Scenario: Inline edit section name in topics format
  57      When I click on "Edit topic name" "link" in the "li#section-1" "css_element"
  58      And I set the field "New name for topic Topic 1" to "Midterm evaluation"
  59      And I press key "13" in the field "New name for topic Topic 1"
  60      Then I should not see "Topic 1" in the "#region-main" "css_element"
  61      And "New name for topic" "field" should not exist
  62      And I should see "Midterm evaluation" in the "li#section-1" "css_element"
  63      And I follow "Course 1"
  64      And I should not see "Topic 1" in the "#region-main" "css_element"
  65      And I should see "Midterm evaluation" in the "li#section-1" "css_element"
  66  
  67    Scenario: Deleting the last section in topics format
  68      When I delete section "5"
  69      Then I should see "Are you absolutely sure you want to completely delete \"Topic 5\" and all the activities it contains?"
  70      And I press "Delete"
  71      And I should not see "Topic 5"
  72      And I navigate to "Edit settings" node in "Course administration"
  73      And I expand all fieldsets
  74      And the field "Number of sections" matches value "4"
  75  
  76    Scenario: Deleting the middle section in topics format
  77      When I delete section "4"
  78      And I press "Delete"
  79      Then I should not see "Topic 5"
  80      And I should not see "Test chat name"
  81      And I should see "Test choice name" in the "li#section-4" "css_element"
  82      And I navigate to "Edit settings" node in "Course administration"
  83      And I expand all fieldsets
  84      And the field "Number of sections" matches value "4"
  85  
  86    Scenario: Deleting the orphaned section in topics format
  87      When I follow "Reduce the number of sections"
  88      Then I should see "Orphaned activities (section 5)" in the "li#section-5" "css_element"
  89      And I delete section "5"
  90      And I press "Delete"
  91      And I should not see "Topic 5"
  92      And I should not see "Orphaned activities"
  93      And "li#section-5" "css_element" should not exist
  94      And I navigate to "Edit settings" node in "Course administration"
  95      And I expand all fieldsets
  96      And the field "Number of sections" matches value "4"
  97  
  98    Scenario: Deleting a section when orphaned section is present in topics format
  99      When I follow "Reduce the number of sections"
 100      Then I should see "Orphaned activities (section 5)" in the "li#section-5" "css_element"
 101      And "li#section-5.orphaned" "css_element" should exist
 102      And "li#section-4.orphaned" "css_element" should not exist
 103      And I delete section "1"
 104      And I press "Delete"
 105      And I should not see "Test book name"
 106      And I should see "Orphaned activities (section 4)" in the "li#section-4" "css_element"
 107      And "li#section-5" "css_element" should not exist
 108      And "li#section-4.orphaned" "css_element" should exist
 109      And "li#section-3.orphaned" "css_element" should not exist


Generated: Thu Aug 11 10:00:09 2016 Cross-referenced by PHPXref 0.7.1