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: Preview a quiz as a teacher
3
  In order to verify my quizzes are ready for my students
4
  As a teacher
5
  I need to be able to preview them
6
 
7
  Background:
8
    Given the following "users" exist:
9
      | username | firstname | lastname | email               |
10
      | teacher  | Teacher   | One      | teacher@example.com |
11
    And the following "courses" exist:
12
      | fullname | shortname | category |
13
      | Course 1 | C1        | 0        |
14
    And the following "course enrolments" exist:
15
      | user     | course | role           |
16
      | teacher  | C1     | editingteacher |
17
    And the following "question categories" exist:
18
      | contextlevel | reference | name           |
19
      | Course       | C1        | Test questions |
20
    And the following "activities" exist:
21
      | activity   | name   | intro              | course | idnumber |
22
      | quiz       | Quiz 1 | Quiz 1 description | C1     | quiz1    |
23
    And the following "questions" exist:
24
      | questioncategory | qtype       | name  | questiontext    |
25
      | Test questions   | truefalse   | TF1   | First question  |
26
      | Test questions   | truefalse   | TF2   | Second question |
27
    And quiz "Quiz 1" contains the following questions:
28
      | question | page | maxmark |
29
      | TF1      | 1    |         |
30
      | TF2      | 1    | 3.0     |
31
    And user "teacher" has attempted "Quiz 1" with responses:
32
      | slot | response |
33
      |   1  | True     |
34
      |   2  | False    |
35
 
36
  @javascript
37
  Scenario: Review the quiz attempt
38
    When I am on the "Quiz 1" "mod_quiz > View" page logged in as "teacher"
39
    And I follow "Review"
40
    Then I should see "25.00 out of 100.00"
41
    And I should see "v1 (latest)" in the "Question 1" "question"
42
    And I follow "Finish review"
43
    And "Review" "link" in the "Attempt 1" "list_item" should be visible
44
 
45
  @javascript
46
  Scenario: Review the quiz attempt with custom decimal separator
47
    Given the following "language customisations" exist:
48
      | component       | stringid | value |
49
      | core_langconfig | decsep   | #     |
50
    When I am on the "Quiz 1" "mod_quiz > View" page logged in as "teacher"
51
    And I follow "Review"
52
    Then I should see "1#00/4#00"
53
    And I should see "25#00 out of 100#00"
54
    And I should see "Mark 1#00 out of 1#00"
55
    And I follow "Finish review"
56
    And "Review" "link" in the "Attempt 1" "list_item" should be visible
57
 
58
  Scenario: Preview the quiz
59
    Given I am on the "Quiz 1" "mod_quiz > View" page logged in as "teacher"
60
    When I press "Preview quiz"
61
    Then I should see "Question 1"
62
    And I should see "v1 (latest)" in the "Question 1" "question"
63
    And "Start a new preview" "button" should exist
64
 
65
  Scenario: Teachers should see a notice if the quiz is not available to students
66
    Given the following "activities" exist:
67
      | activity   | name   | course | timeclose     |
68
      | quiz       | Quiz 2 | C1     | ##yesterday## |
69
    And quiz "Quiz 2" contains the following questions:
70
      | question | page | maxmark |
71
      | TF1      | 1    |         |
72
      | TF2      | 1    | 3.0     |
73
    When I am on the "Quiz 2" "mod_quiz > View" page logged in as "admin"
74
    And I should see "This quiz is currently not available."
75
    And I press "Preview quiz"
76
    Then I should see "if this were a real attempt, you would be blocked" in the ".alert-warning" "css_element"
77
 
78
  Scenario: Admins should be able to preview a quiz
79
    Given I am on the "Quiz 1" "mod_quiz > View" page logged in as "admin"
80
    When I press "Preview quiz"
81
    Then I should see "Question 1"
82
    And "Start a new preview" "button" should exist
83
 
84
  @javascript
85
  Scenario: Teacher responses should be cleared after updating the question too much in the preview.
86
    Given the following "activities" exist:
87
      | activity | name   | course |
88
      | quiz     | Quiz 3 | C1     |
89
    And the following "questions" exist:
90
      | questioncategory | qtype       | name             | questiontext |
91
      | Test questions   | multichoice | Multi-choice-002 | one_of_four  |
92
    And quiz "Quiz 3" contains the following questions:
93
      | question         | page |
94
      | Multi-choice-002 | 1    |
95
    When I am on the "Quiz 3" "mod_quiz > View" page logged in as "teacher"
96
    And I press "Preview quiz"
97
    And I should see "one_of_four"
98
    And I should see "v1 (latest)"
99
    And I click on "One" "qtype_multichoice > Answer"
100
    And I click on "Two" "qtype_multichoice > Answer"
101
    And I press "Finish attempt ..."
102
    And I press "Return to attempt"
103
    And I click on "Edit question" "link" in the "Question 1" "question"
104
    And I set the field "Question text" to "one_of_four version 2"
105
    And I set the field "Choice 4" to ""
106
    And I press "id_submitbutton"
107
    Then I should see "one_of_four version 2"
108
    And I should see "v2 (latest)"
109
    And I should see "One"
110
    And I should see "Two"
111
    And I should see "Three"
112
    And I should not see "Four"
113
    And "input[type=checkbox][name$=choice0]:checked" "css_element" should not exist
114
    And "input[type=checkbox][name$=choice1]:checked" "css_element" should not exist
115
    And "input[type=checkbox][name$=choice2]:checked" "css_element" should not exist