[ Index ]

PHP Cross Reference of Unnamed Project

title

Body

[close]

/mod/feedback/tests/behat/ -> templates.feature (source)

   1  @mod @mod_feedback
   2  Feature: Saving, using and deleting feedback templates
   3    In order to quickly create feedbacks
   4    As a manager
   5    I need to be able to create feedback templates
   6  
   7    Background:
   8      Given the following "users" exist:
   9        | username | firstname | lastname |
  10        | teacher  | Teacher   | 1        |
  11        | manager  | Manager   | 1        |
  12      And the following "courses" exist:
  13        | fullname | shortname |
  14        | Course 1 | C1        |
  15        | Course 2 | C2        |
  16      And the following "course enrolments" exist:
  17        | user     | course | role           |
  18        | teacher  | C1     | editingteacher |
  19        | teacher  | C2     | editingteacher |
  20      And the following "system role assigns" exist:
  21        | user    | course               | role    |
  22        | manager | Acceptance test site | manager |
  23      And the following "activities" exist:
  24        | activity   | name                         | course | idnumber    |
  25        | feedback   | Learning experience course 1 | C1     | feedback1   |
  26        | feedback   | Another feedback in course 1 | C1     | feedback2   |
  27        | feedback   | Learning experience course 2 | C2     | feedback3   |
  28      And I log in as "teacher"
  29      And I follow "Course 1"
  30      And I follow "Learning experience course 1"
  31      And I follow "Edit questions"
  32      And I add a "Multiple choice" question to the feedback with:
  33        | Question         | this is a multiple choice 1 |
  34        | Label            | multichoice1                |
  35        | Multiple choice type | Multiple choice - single answer |
  36        | Multiple choice values | option a\noption b\noption c  |
  37      And I log out
  38  
  39    Scenario: Teacher can save template and re-use it in the same course only
  40      # Go to feedback templates and make sure none exist yet
  41      When I log in as "teacher"
  42      And I follow "Course 1"
  43      And I follow "Learning experience course 1"
  44      And I follow "Templates"
  45      Then I should see "No templates available yet"
  46      And "Use a template" "field" should not exist
  47      And "Public" "field" should not exist
  48      And I follow "Delete template..."
  49      And "No templates available yet" "text" should exist in the ".coursetemplates" "css_element"
  50      And ".publictemplates" "css_element" should not exist
  51      And I press "Back"
  52      # Save as a course template
  53      And I set the field "Name" to "My first template"
  54      And I press "Save as new template"
  55      And I should see "Template saved"
  56      And the "Use a template" select box should contain "My first template"
  57      # Create a feedback from this template in the same course
  58      And I follow "Course 1"
  59      And I follow "Another feedback in course 1"
  60      And I follow "Templates"
  61      And I set the field "Use a template" to "My first template"
  62      And I press "Use this template"
  63      And I should see "this is a multiple choice 1"
  64      And I press "Save changes"
  65      And I follow "Edit questions"
  66      And I should see "this is a multiple choice 1"
  67      # Make sure this template is not available in another course
  68      And I am on site homepage
  69      And I follow "Course 2"
  70      And I follow "Learning experience course 2"
  71      And I follow "Templates"
  72      And I should see "No templates available yet"
  73      And "Use a template" "field" should not exist
  74      And I log out
  75  
  76    Scenario: Teacher can append template to existing questions or remove them
  77      # Save feedback as a course template
  78      When I log in as "teacher"
  79      And I follow "Course 1"
  80      And I follow "Learning experience course 1"
  81      And I follow "Templates"
  82      And I set the field "Name" to "My first template"
  83      And I press "Save as new template"
  84      # Add questions to another feedback
  85      And I follow "Course 1"
  86      And I follow "Another feedback in course 1"
  87      And I follow "Edit questions"
  88      And I add a "Multiple choice" question to the feedback with:
  89        | Question         | What is your favourite subject |
  90        | Label            | subjectchoice                  |
  91        | Multiple choice type | Multiple choice - single answer   |
  92        | Multiple choice values | Maths\bScience\nEnglish\nOther  |
  93      # Import template appending items
  94      And I follow "Templates"
  95      And I set the field "Use a template" to "My first template"
  96      And I press "Use this template"
  97      And I set the field "Append new items" to "1"
  98      And I press "Save changes"
  99      And I follow "Edit questions"
 100      Then "What is your favourite subject" "text" should appear before "this is a multiple choice 1" "text"
 101      # Import template replacing items
 102      And I follow "Templates"
 103      And I set the field "Use a template" to "My first template"
 104      And I press "Use this template"
 105      And I set the field "Delete old items" to "1"
 106      And I press "Save changes"
 107      And I follow "Edit questions"
 108      And I should see "this is a multiple choice 1"
 109      And I should not see "What is your favourite subject"
 110      And I log out
 111  
 112    Scenario: Manager can save template as public and it will be available in any course
 113      When I log in as "manager"
 114      And I am on site homepage
 115      And I follow "Course 1"
 116      And I follow "Learning experience course 1"
 117      And I follow "Templates"
 118      And I set the field "Name" to "My first template"
 119      And I set the field "Public" to "1"
 120      And I press "Save as new template"
 121      And I log out
 122      And I log in as "teacher"
 123      And I follow "Course 2"
 124      And I follow "Learning experience course 2"
 125      And I follow "Templates"
 126      And I set the field "Use a template" to "My first template"
 127      And I press "Use this template"
 128      Then I should see "this is a multiple choice 1"
 129      And I press "Save changes"
 130      And I follow "Edit questions"
 131      And I should see "this is a multiple choice 1"
 132      And I log out
 133  
 134    Scenario: Teacher can delete course templates but can not delete public templates
 135      # Save feedback as both public and course template
 136      When I log in as "manager"
 137      And I am on site homepage
 138      And I follow "Course 1"
 139      And I follow "Learning experience course 1"
 140      And I follow "Templates"
 141      And I set the field "Name" to "My public template"
 142      And I set the field "Public" to "1"
 143      And I press "Save as new template"
 144      And I set the field "Name" to "My course template"
 145      And I press "Save as new template"
 146      And I log out
 147      # Login as teacher and try to delete templates
 148      And I log in as "teacher"
 149      And I follow "Course 1"
 150      And I follow "Another feedback in course 1"
 151      And I follow "Templates"
 152      And I follow "Delete template..."
 153      Then I should not see "My public template"
 154      And ".publictemplates" "css_element" should not exist
 155      And "My course template" "text" should exist in the ".coursetemplates" "css_element"
 156      And I click on "Delete" "link" in the "My course template" "table_row"
 157      And I should see "Template deleted"
 158      And "My course template" "text" should not exist in the ".coursetemplates" "css_element"
 159      And "No templates available yet" "text" should exist in the ".coursetemplates" "css_element"
 160      And I press "Back"
 161      And the "Use a template" select box should not contain "My course template"
 162      And the "Use a template" select box should contain "My public template"
 163      And I log out
 164  
 165    @javascript
 166    Scenario: Manager can delete both course and public templates
 167      # Save feedback as both public and course template
 168      When I log in as "manager"
 169      And I am on site homepage
 170      And I follow "Course 1"
 171      And I follow "Learning experience course 1"
 172      And I follow "Templates"
 173      And I set the field "Name" to "My public template"
 174      And I set the field "Public" to "1"
 175      And I press "Save as new template"
 176      And I set the field "Name" to "My course template"
 177      And I press "Save as new template"
 178      # Delete course template
 179      And I follow "Delete template..."
 180      Then "My public template" "text" should exist in the ".publictemplates" "css_element"
 181      And "My course template" "text" should exist in the ".coursetemplates" "css_element"
 182      And I click on "Delete" "link" in the "My course template" "table_row"
 183      And I should see "Are you sure you want to delete this template?"
 184      And I press "Yes"
 185      And I should see "Template deleted"
 186      And "My course template" "text" should not exist in the ".coursetemplates" "css_element"
 187      And "No templates available yet" "text" should exist in the ".coursetemplates" "css_element"
 188      # Delete public template
 189      And "My public template" "text" should exist in the ".publictemplates" "css_element"
 190      And I click on "Delete" "link" in the "My public template" "table_row"
 191      And I should see "Are you sure you want to delete this template?"
 192      And I press "Yes"
 193      And I should see "Template deleted"
 194      And "My public template" "text" should not exist in the ".publictemplates" "css_element"
 195      And "No templates available yet" "text" should exist in the ".publictemplates" "css_element"
 196      And I press "Back"
 197      And I should see "No templates available yet"
 198      And "Use a template" "field" should not exist
 199      And I log out


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