Proyectos de Subversion Moodle

Rev

| Ultima modificación | Ver Log |

Rev Autor Línea Nro. Línea
1 efrain 1
@mod @mod_quiz
2
Feature: Quiz availability can be set
3
  In order to see quiz availability
4
  As a teacher
5
  I need to be able to set quiz opening and closing times
6
 
7
  Background:
8
    Given the following "users" exist:
9
      | username | firstname | lastname | email                |
10
      | teacher1 | Teacher   | One      | teacher1@example.com |
11
      | student1 | Student   | One      | student1@example.com |
12
    And the following "courses" exist:
13
      | fullname | shortname |
14
      | Course 1 | C1        |
15
    And the following "course enrolments" exist:
16
      | user     | course | role           |
17
      | teacher1 | C1     | editingteacher |
18
      | student1 | C1     | student        |
19
    And the following "question categories" exist:
20
      | contextlevel | reference | name           |
21
      | Course       | C1        | Test questions |
22
    And the following "questions" exist:
23
      | questioncategory | qtype     | name | questiontext    |
24
      | Test questions   | truefalse | TF1  | First question  |
25
 
26
  Scenario Outline: Set quiz opening time while closing time is disabled
27
    Given the following "activities" exist:
28
      | activity | course | name   | timeopen   |
29
      | quiz     | C1     | Quiz 1 | <timeopen> |
30
    And quiz "Quiz 1" contains the following questions:
31
      | question | page | maxmark |
32
      | TF1      | 1    | 2       |
33
    When I am on the "Quiz 1" "quiz activity" page logged in as student1
34
    # Confirm display as student depending on case.
35
    Then I should see "<opentext>:"
36
    And I should see "<timeopen>%A, %d %B %Y, %I:%M##"
37
    And I should not see "Close:"
38
    And I <quizavailability> see "This quiz is currently not available."
39
    And "Attempt quiz" "button" <attemptvisibility> exist
40
 
41
    Examples:
42
      | opentext | timeopen      | attemptvisibility | quizavailability |
43
      # Case 1 - open is set to future date, close is disabled.
44
      | Opens    | ##tomorrow##  | should not        | should           |
45
      # Case 4 - open is set to past date, close is disabled.
46
      | Opened   | ##yesterday## | should           | should not        |
47
 
48
  Scenario Outline: Set quiz closing time while opening time is disabled
49
    Given the following "activities" exist:
50
      | activity | course | name   | timeclose   |
51
      | quiz     | C1     | Quiz 1 | <timeclose> |
52
    And quiz "Quiz 1" contains the following questions:
53
      | question | page | maxmark |
54
      | TF1      | 1    | 2       |
55
    When I am on the "Quiz 1" "quiz activity" page logged in as student1
56
    # Confirm display as student depending on case.
57
    Then I should see "<closetext>:"
58
    And I should see "<timeclose>%A, %d %B %Y, %I:%M##"
59
    And I <quizavailability> see "This quiz is currently not available."
60
    And "Attempt quiz" "button" <attemptvisibility> exist
61
 
62
    Examples:
63
      | closetext | timeclose      | attemptvisibility | quizavailability |
64
      # Case 2 - open is disabled, close is set to past date.
65
      | Closed    | ##yesterday##  | should not        | should not       |
66
      # Case 5 - open is disabled, close is set to future date.
67
      | Closes    | ##tomorrow##   | should            | should not       |
68
 
69
  Scenario Outline: Set quiz opening and closing times
70
    Given the following "activities" exist:
71
      | activity | course | name   | timeopen   | timeclose   |
72
      | quiz     | C1     | Quiz 1 | <timeopen> | <timeclose> |
73
    And quiz "Quiz 1" contains the following questions:
74
      | question | page | maxmark |
75
      | TF1      | 1    | 2       |
76
    When I am on the "Quiz 1" "quiz activity" page logged in as student1
77
    # Confirm display as student depending on case.
78
    Then I should see "<opentext>:"
79
    And I should see "<timeopen>%A, %d %B %Y, %I:%M##"
80
    And I should see "<closetext>:"
81
    And I should see "<timeclose>%A, %d %B %Y, %I:%M##"
82
    And I <quizavailability> see "This quiz is currently not available."
83
    And "Attempt quiz" "button" <attemptvisibility> exist
84
 
85
    Examples:
86
      | opentext | timeopen        | closetext | timeclose      | attemptvisibility | quizavailability |
87
      # Case 6 - open and close are set to past date.
88
      | Opened   | ##3 days ago## | Closed     | ##yesterday##  | should not        | should not       |
89
      # Case 7 - open is set to past date, close is set to future date.
90
      | Opened   | ##yesterday##  | Closes     | ##tomorrow##   | should            | should not       |
91
      # Case 8 - open and close are set to future date
92
      | Opens    | ##tomorrow##   | Closes     | ##+2 days##    | should not        | should           |
93
 
94
  Scenario: Quiz time open and time close are disabled
95
    # Case 3 - both open and close are disabled.
96
    Given the following "activities" exist:
97
      | activity | course | name   |
98
      | quiz     | C1     | Quiz 1 |
99
    And quiz "Quiz 1" contains the following questions:
100
      | question | page | maxmark |
101
      | TF1      | 1    | 2       |
102
    When I am on the "Quiz 1" "quiz activity" page logged in as student1
103
    Then I should not see "Opens"
104
    And I should not see "Opened"
105
    And I should not see "Closes"
106
    And I should not see "Closed"
107
    And I should not see "This quiz is currently not available."
108
    And "Attempt quiz" "button" should exist
109
 
110
  @javascript
111
  Scenario Outline: Timer is displayed when quiz closes in less than an hour
112
    Given the following "activities" exist:
113
      | activity | course | name   | timeclose   |
114
      | quiz     | C1     | Quiz 1 | <closedate> |
115
    And quiz "Quiz 1" contains the following questions:
116
      | question | page |
117
      | TF1      | 1    |
118
    And I am on the "Quiz 1" "quiz activity" page logged in as "teacher1"
119
    When I press "Preview quiz"
120
    # Confirm timer visibility for teacher
121
    Then I <timervisibility> see "Time left"
122
    And I am on the "Quiz 1" "quiz activity" page logged in as "student1"
123
    And I press "Attempt quiz"
124
    # Confirm timer visibility for student
125
    And I <timervisibility> see "Time left"
126
 
127
    Examples:
128
      | closedate           | timervisibility |
129
      # Case 1 - closedate is < 1hr, the timer is visible
130
      | ##now +10 minutes## | should          |
131
      # Case 2 - closedate is > 1hr, the timer is not visible
132
      | ##now +2 hours##    | should not      |