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: Checkbox questions can have forced minimum and maximum numbers of boxes selected
3
  In order to force minimum and maximum selections
4
  As a teacher
5
  I need to specify the minimum and maximum numbers in the question fields
6
 
7
  Background: Add a checkbox question to a questionnaire with a min and max entered
8
    Given the following "users" exist:
9
      | username | firstname | lastname | email |
10
      | teacher1 | Teacher | 1 | teacher1@example.com |
11
      | student1 | Student | 1 | student1@example.com |
12
    And the following "courses" exist:
13
      | fullname | shortname | category |
14
      | Course 1 | C1 | 0 |
15
    And the following "course enrolments" exist:
16
      | user | course | role |
17
      | teacher1 | C1 | editingteacher |
18
      | student1 | C1 | student |
19
    And the following "activities" exist:
20
      | activity | name | description | course | idnumber |
21
      | questionnaire | Test questionnaire | Test questionnaire description | C1 | questionnaire0 |
22
    And I log in as "teacher1"
23
    And I am on "Course 1" course homepage
24
    And I follow "Test questionnaire"
25
    And I navigate to "Questions" in current page administration
26
    And I add a "Check Boxes" question and I fill the form with:
27
      | Question Name | Q1 |
28
      | Yes | y |
29
      | Min. forced responses | 1 |
30
      | Max. forced responses | 2 |
31
      | Question Text | Select one or two choices only |
32
      | Possible answers | One,Two,Three,Four |
33
    And I add a "Check Boxes" question and I fill the form with:
34
      | Question Name | Q2 |
35
      | Yes | y |
36
      | Min. forced responses | 1 |
37
      | Max. forced responses | 0 |
38
      | Question Text | Select one or two choices only |
39
      | Possible answers | Red,Blue,Yellow,Green |
40
    And I add a "Check Boxes" question and I fill the form with:
41
      | Question Name | Q3 |
42
      | Yes | y |
43
      | Min. forced responses | 0 |
44
      | Max. forced responses | 3 |
45
      | Question Text | Select one or two choices only |
46
      | Possible answers | Car,Bike,Plane,Boat |
47
    And I log out
48
 
49
  @javascript
50
  Scenario: Student must select exactly one or two boxes to submit the question.
51
    And I log in as "student1"
52
    And I am on "Course 1" course homepage
53
    And I follow "Test questionnaire"
54
    And I navigate to "Answer the questions..." in current page administration
55
    Then I should see "Select one or two choices only"
56
    And I press "Submit questionnaire"
57
    Then I should see "Please answer required questions: #1. #2. #3."
58
    And I should see "Please answer required question #1."
59
    And I should see "Please answer required question #2."
60
    And I should see "Please answer required question #3."
61
    And I set the field "One" to "checked"
62
    And I set the field "Two" to "checked"
63
    And I set the field "Three" to "checked"
64
    And I set the field "Red" to "checked"
65
    And I set the field "Blue" to "checked"
66
    And I set the field "Car" to "checked"
67
    And I set the field "Bike" to "checked"
68
    And I set the field "Plane" to "checked"
69
    And I set the field "Boat" to "checked"
70
    And I press "Submit questionnaire"
71
#    Then I should see "There is something wrong with your answer to question: #1." -- Need to figure out why this isn't working.
72
    Then I should see "For this question you must tick a maximum of 2 box(es)."
73
    And I should not see "For this question you must tick exactly 1 box(es)."
74
    And I should see "For this question you must tick a maximum of 3 box(es)."