[ Index ]

PHP Cross Reference of Unnamed Project

title

Body

[close]

/mod/quiz/tests/behat/ -> attempt_basic.feature (source)

   1  @mod @mod_quiz
   2  Feature: Attemp a quiz where some questions require that the previous question has been answered.
   3    As a student
   4    In order to demonstrate what I know
   5    I need to be able to attempt quizzes
   6  
   7    Background:
   8      Given the following "users" exist:
   9        | username | firstname | lastname | email               |
  10        | student  | Student   | One      | student@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        | student  | C1     | student |
  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  
  24    @javascript
  25    Scenario: Attempt a quiz with a single unnamed section
  26      Given the following "questions" exist:
  27        | questioncategory | qtype       | name  | questiontext    |
  28        | Test questions   | truefalse   | TF1   | First question  |
  29        | Test questions   | truefalse   | TF2   | Second question |
  30      And quiz "Quiz 1" contains the following questions:
  31        | question | page | maxmark |
  32        | TF1      | 1    |         |
  33        | TF2      | 1    | 3.0     |
  34      When I log in as "student"
  35      And I follow "Course 1"
  36      And I follow "Quiz 1"
  37      And I press "Attempt quiz now"
  38      And I click on "True" "radio" in the "First question" "question"
  39      And I click on "False" "radio" in the "Second question" "question"
  40      And I press "Finish attempt ..."
  41      And I press "Submit all and finish"
  42      And I click on "Submit all and finish" "button" in the "Confirmation" "dialogue"
  43      Then I should see "25.00 out of 100.00"
  44  
  45    @javascript
  46    Scenario: Attempt a quiz with mulitple sections
  47      Given the following "questions" exist:
  48        | questioncategory | qtype       | name  | questiontext    |
  49        | Test questions   | truefalse   | TF1   | First question  |
  50        | Test questions   | truefalse   | TF2   | Second question |
  51        | Test questions   | truefalse   | TF3   | Third question  |
  52        | Test questions   | truefalse   | TF4   | Fourth question |
  53        | Test questions   | truefalse   | TF5   | Fifth question  |
  54        | Test questions   | truefalse   | TF6   | Sixth question  |
  55      And quiz "Quiz 1" contains the following questions:
  56        | question | page |
  57        | TF1      | 1    |
  58        | TF2      | 1    |
  59        | TF3      | 2    |
  60        | TF4      | 3    |
  61        | TF5      | 4    |
  62        | TF6      | 4    |
  63      And quiz "Quiz 1" contains the following sections:
  64        | heading   | firstslot | shuffle |
  65        | Section 1 | 1         | 1       |
  66        | Section 2 | 3         | 0       |
  67        |           | 4         | 1       |
  68        | Section 3 | 5         | 0       |
  69  
  70      When I log in as "student"
  71      And I follow "Course 1"
  72      And I follow "Quiz 1"
  73      And I press "Attempt quiz now"
  74  
  75      Then I should see "Section 1" in the "Quiz navigation" "block"
  76      And I should see question "1" in section "Section 1" in the quiz navigation
  77      And I should see question "2" in section "Section 1" in the quiz navigation
  78      And I should see question "3" in section "Section 2" in the quiz navigation
  79      And I should see question "4" in section "Section 2" in the quiz navigation
  80      And I should see question "5" in section "Section 3" in the quiz navigation
  81      And I should see question "6" in section "Section 3" in the quiz navigation
  82  
  83      And I follow "Finish attempt ..."
  84      And I should see question "1" in section "Section 1" in the quiz navigation
  85      And I should see question "2" in section "Section 1" in the quiz navigation
  86      And I should see question "3" in section "Section 2" in the quiz navigation
  87      And I should see question "4" in section "Section 2" in the quiz navigation
  88      And I should see question "5" in section "Section 3" in the quiz navigation
  89      And I should see question "6" in section "Section 3" in the quiz navigation
  90      And I should see "Section 1" in the "quizsummaryofattempt" "table"
  91      And I should see "Section 2" in the "quizsummaryofattempt" "table"
  92      And I should see "Section 3" in the "quizsummaryofattempt" "table"
  93  
  94      And I press "Submit all and finish"
  95      And I click on "Submit all and finish" "button" in the "Confirmation" "dialogue"
  96      And I should see question "1" in section "Section 1" in the quiz navigation
  97      And I should see question "2" in section "Section 1" in the quiz navigation
  98      And I should see question "3" in section "Section 2" in the quiz navigation
  99      And I should see question "4" in section "Section 2" in the quiz navigation
 100      And I should see question "5" in section "Section 3" in the quiz navigation
 101      And I should see question "6" in section "Section 3" in the quiz navigation
 102  
 103    @javascript
 104    Scenario: Next and previous navigation
 105      Given the following "questions" exist:
 106        | questioncategory | qtype       | name  | questiontext                |
 107        | Test questions   | truefalse   | TF1   | Text of the first question  |
 108        | Test questions   | truefalse   | TF2   | Text of the second question |
 109      And quiz "Quiz 1" contains the following questions:
 110        | question | page |
 111        | TF1      | 1    |
 112        | TF2      | 2    |
 113      When I log in as "student"
 114      And I follow "Course 1"
 115      And I follow "Quiz 1"
 116      And I press "Attempt quiz now"
 117      Then I should see "Text of the first question"
 118      And I should not see "Text of the second question"
 119      And I press "Next page"
 120      And I should see "Text of the second question"
 121      And I should not see "Text of the first question"
 122      And I click on "Finish attempt ..." "button" in the "region-main" "region"
 123      And I should see "Summary of attempt"
 124      And I press "Return to attempt"
 125      And I should see "Text of the second question"
 126      And I should not see "Text of the first question"
 127      And I press "Previous page"
 128      And I should see "Text of the first question"
 129      And I should not see "Text of the second question"
 130      And I follow "Finish attempt ..."
 131      And I press "Submit all and finish"
 132      And I click on "Submit all and finish" "button" in the "Confirmation" "dialogue"
 133      And I should see "Text of the first question"
 134      And I should see "Text of the second question"
 135      And I follow "Show one page at a time"
 136      And I should see "Text of the first question"
 137      And I should not see "Text of the second question"
 138      And I follow "Next page"
 139      And I should see "Text of the second question"
 140      And I should not see "Text of the first question"
 141      And I follow "Previous page"
 142      And I should see "Text of the first question"
 143      And I should not see "Text of the second question"


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