Proyectos de Subversion Moodle

Rev

| Ultima modificación | Ver Log |

Rev Autor Línea Nro. Línea
1 efrain 1
@mod @mod_questionnaire
2
Feature: Questionnaires can be public, private or template
3
  In order to view a questionnaire
4
  As a user
5
  The type of the questionnaire affects how it is displayed.
6
 
7
  @javascript
8
  Scenario: Add a template questionnaire
9
    Given the following "users" exist:
10
      | username | firstname | lastname | email |
11
      | manager1 | Manager | 1 | manager1@example.com |
12
      | teacher1 | Teacher | 1 | teacher1@example.com |
13
      | student1 | Student | 1 | student1@example.com |
14
    And the following "courses" exist:
15
      | fullname | shortname | category |
16
      | Course 1 | C1 | 0 |
17
    And the following "course enrolments" exist:
18
      | user | course | role |
19
      | teacher1 | C1 | editingteacher |
20
      | student1 | C1 | student |
21
      | manager1 | C1 | manager |
22
    And the following "activities" exist:
23
      | activity | name | description | course | idnumber |
24
      | questionnaire | Test questionnaire | Test questionnaire description | C1 | questionnaire0 |
25
    And I am on the "Test questionnaire" "mod_questionnaire > advsettings" page logged in as "manager1"
26
    And I should see "Content options"
27
    And I set the field "id_realm" to "template"
28
    And I press "Save and display"
29
    Then I should see "Template questionnaires are not viewable"
30
 
31
  @javascript
32
  Scenario: Add a questionnaire from a public questionnaire
33
    Given the following "users" exist:
34
      | username | firstname | lastname | email |
35
      | manager1 | Manager | 1 | manager1@example.com |
36
      | teacher1 | Teacher | 1 | teacher1@example.com |
37
      | student1 | Student | 1 | student1@example.com |
38
    And the following "courses" exist:
39
      | fullname | shortname | category |
40
      | Course 1 | C1 | 0 |
41
      | Course 2 | C2 | 0 |
42
    And the following "course enrolments" exist:
43
      | user | course | role |
44
      | teacher1 | C1 | editingteacher |
45
      | student1 | C1 | student |
46
      | manager1 | C1 | manager |
47
      | manager1 | C2 | manager |
48
      | student1 | C2 | student |
49
    And the following "activities" exist:
50
      | activity | name | description | course | idnumber |
51
      | questionnaire | Test questionnaire | Test questionnaire description | C1 | questionnaire0 |
52
    And the following config values are set as admin:
53
      | coursebinenable | 0 | tool_recyclebin |
54
    And I log in as "manager1"
55
    And I am on site homepage
56
    And I am on "Course 1" course homepage
57
    And I follow "Test questionnaire"
58
    And I follow "Test questionnaire"
59
    And I navigate to "Questions" in current page administration
60
    And I add a "Check Boxes" question and I fill the form with:
61
      | Question Name | Q1 |
62
      | Yes | y |
63
      | Min. forced responses | 1 |
64
      | Max. forced responses | 2 |
65
      | Question Text | Select one or two choices only |
66
      | Possible answers | One,Two,Three,Four |
67
# Neither of the following steps work in 3.2, since the admin options are not available on any page but "view".
68
    And I am on the "Test questionnaire" "mod_questionnaire > advsettings" page
69
    And I should see "Content options"
70
    And I set the field "id_realm" to "public"
71
    And I press "Save and return to course"
72
# Verify that a public questionnaire cannot be used in the same course.
73
    And I am on "Course 1" course homepage with editing mode on
74
    And I add a "Questionnaire" to section "1"
75
    And I expand all fieldsets
76
    Then I should see "(No public questionnaires.)"
77
    And I press "Cancel"
78
# Verify that a public questionnaire can be used in a different course.
79
    And I am on site homepage
80
    And I am on "Course 2" course homepage
81
    And I add a "Questionnaire" to section "1"
82
    And I expand all fieldsets
83
    And I set the field "name" to "Questionnaire from public"
84
    And I click on "Test questionnaire [Course 1]" "radio"
85
    And I press "Save and return to course"
86
    And I log out
87
    And I log in as "student1"
88
    And I am on "Course 2" course homepage
89
    And I follow "Questionnaire from public"
90
    Then I should see "Answer the questions..."
91
# Verify message for public questionnaire that has been deleted.
92
    And I log out
93
    And I log in as "manager1"
94
    And I am on site homepage
95
    And I am on "Course 1" course homepage
96
    And I turn editing mode on
97
    And I delete "Test questionnaire" activity
98
    And I am on site homepage
99
    And I am on the "Questionnaire from public" "mod_questionnaire > view" page
100
    Then I should see "This questionnaire used to depend on a Public questionnaire which has been deleted."
101
    And I should see "It can no longer be used and should be deleted."
102
    And I log out
103
    And I am on the "Questionnaire from public" "mod_questionnaire > view" page logged in as "student1"
104
    Then I should see "This questionnaire is no longer available. Ask your teacher to delete it."