| 1 | 
           efrain | 
           1 | 
           @mod @mod_quiz
  | 
        
        
            | 
            | 
           2 | 
           Feature: Attempt a quiz in a sequential mode
  | 
        
        
            | 
            | 
           3 | 
             As a student I should not be able to see the previous questions
  | 
        
        
            | 
            | 
           4 | 
              | 
        
        
            | 
            | 
           5 | 
             Background:
  | 
        
        
            | 
            | 
           6 | 
               Given the following "users" exist:
  | 
        
        
            | 
            | 
           7 | 
                 | username | firstname | lastname | email               |
  | 
        
        
            | 
            | 
           8 | 
                 | student  | Student   | One      | student@example.com |
  | 
        
        
            | 
            | 
           9 | 
                 | teacher  | Teacher   | One      | teacher@example.com |
  | 
        
        
            | 
            | 
           10 | 
               And the following "courses" exist:
  | 
        
        
            | 
            | 
           11 | 
                 | fullname | shortname | category |
  | 
        
        
            | 
            | 
           12 | 
                 | Course 1 | C1        | 0        |
  | 
        
        
            | 
            | 
           13 | 
               And the following "course enrolments" exist:
  | 
        
        
            | 
            | 
           14 | 
                 | user    | course | role    |
  | 
        
        
            | 
            | 
           15 | 
                 | student | C1     | student |
  | 
        
        
            | 
            | 
           16 | 
                 | teacher | C1     | teacher |
  | 
        
        
            | 
            | 
           17 | 
               And the following "question categories" exist:
  | 
        
        
            | 
            | 
           18 | 
                 | contextlevel | reference | name           |
  | 
        
        
            | 
            | 
           19 | 
                 | Course       | C1        | Test questions |
  | 
        
        
            | 
            | 
           20 | 
               And the following "questions" exist:
  | 
        
        
            | 
            | 
           21 | 
                 | questioncategory | qtype     | name | questiontext    |
  | 
        
        
            | 
            | 
           22 | 
                 | Test questions   | truefalse | TF1  | First question  |
  | 
        
        
            | 
            | 
           23 | 
                 | Test questions   | truefalse | TF2  | Second question |
  | 
        
        
            | 
            | 
           24 | 
                 | Test questions   | truefalse | TF3  | Third question  |
  | 
        
        
            | 
            | 
           25 | 
                 | Test questions   | truefalse | TF4  | Fourth question |
  | 
        
        
            | 
            | 
           26 | 
               And the following "activities" exist:
  | 
        
        
            | 
            | 
           27 | 
                 | activity | name   | intro              | course | idnumber | preferredbehaviour | navmethod  |
  | 
        
        
            | 
            | 
           28 | 
                 | quiz     | Quiz 1 | Quiz 1 description | C1     | quiz1    | immediatefeedback  | sequential |
  | 
        
        
            | 
            | 
           29 | 
               And quiz "Quiz 1" contains the following questions:
  | 
        
        
            | 
            | 
           30 | 
                 | question | page | requireprevious |
  | 
        
        
            | 
            | 
           31 | 
                 | TF1      | 1    | 1               |
  | 
        
        
            | 
            | 
           32 | 
                 | TF2      | 2    | 1               |
  | 
        
        
            | 
            | 
           33 | 
                 | TF3      | 3    | 1               |
  | 
        
        
            | 
            | 
           34 | 
                 | TF4      | 4    | 1               |
  | 
        
        
            | 
            | 
           35 | 
              | 
        
        
            | 
            | 
           36 | 
             @javascript
  | 
        
        
            | 
            | 
           37 | 
             Scenario Outline: As a student I should not be able to navigate out of sequence if sequential navigation is on.
  | 
        
        
            | 
            | 
           38 | 
               Given I am on the "Quiz 1" "mod_quiz > View" page logged in as "student"
  | 
        
        
            | 
            | 
           39 | 
               And I press "Attempt quiz"
  | 
        
        
            | 
            | 
           40 | 
               And I should see "First question"
  | 
        
        
            | 
            | 
           41 | 
               When I am on the "Quiz 1 > student > Attempt 1 > <pagenumber>" "mod_quiz > Attempt view" page
  | 
        
        
            | 
            | 
           42 | 
               And I should see "<canseequestion>"
  | 
        
        
            | 
            | 
           43 | 
               Then I should not see "<cannotseequestion>"
  | 
        
        
            | 
            | 
           44 | 
               Examples:
  | 
        
        
            | 
            | 
           45 | 
                 | pagenumber | canseequestion  | cannotseequestion |
  | 
        
        
            | 
            | 
           46 | 
                 | 1          | First question  | Second question   |
  | 
        
        
            | 
            | 
           47 | 
                 | 2          | Second question | First question    |
  | 
        
        
            | 
            | 
           48 | 
                 | 4          | First question  | Fourth question   |
  | 
        
        
            | 
            | 
           49 | 
              | 
        
        
            | 
            | 
           50 | 
             @javascript
  | 
        
        
            | 
            | 
           51 | 
             Scenario: As a student I should not be able to navigate out of sequence by opening new windows on the same quiz.
  | 
        
        
            | 
            | 
           52 | 
               Given the following config values are set as admin:
  | 
        
        
            | 
            | 
           53 | 
                 | config         | value | plugin |
  | 
        
        
            | 
            | 
           54 | 
                 | autosaveperiod | 60    | quiz   |
  | 
        
        
            | 
            | 
           55 | 
               And I am on the "Quiz 1" "mod_quiz > View" page logged in as "student"
  | 
        
        
            | 
            | 
           56 | 
               And I press "Attempt quiz"
  | 
        
        
            | 
            | 
           57 | 
               And I should see "First question"
  | 
        
        
            | 
            | 
           58 | 
               And I click on "True" "radio" in the "First question" "question"
  | 
        
        
            | 
            | 
           59 | 
               And I click on "Next page" "button"
  | 
        
        
            | 
            | 
           60 | 
               When I am on the "Quiz 1 > student > Attempt 1 > 3" "mod_quiz > Attempt view" page
  | 
        
        
            | 
            | 
           61 | 
               And I click on "True" "radio" in the "Third question" "question"
  | 
        
        
            | 
            | 
           62 | 
               And I should see "Third question"
  | 
        
        
            | 
            | 
           63 | 
               And I click on "Next page" "button"
  | 
        
        
            | 
            | 
           64 | 
               And I am on the "Quiz 1 > student > Attempt 1 > 1" "mod_quiz > Attempt view" page
  | 
        
        
            | 
            | 
           65 | 
               Then I should see "Fourth question"
  | 
        
        
            | 
            | 
           66 | 
              | 
        
        
            | 
            | 
           67 | 
             @javascript
  | 
        
        
            | 
            | 
           68 | 
             Scenario: As a student I should not be able to save my data by opening a given page out of sequence.
  | 
        
        
            | 
            | 
           69 | 
               Given the following config values are set as admin:
  | 
        
        
            | 
            | 
           70 | 
                 | config         | value | plugin |
  | 
        
        
            | 
            | 
           71 | 
                 | autosaveperiod | 1     | quiz   |
  | 
        
        
            | 
            | 
           72 | 
               When I am on the "Quiz 1" "mod_quiz > View" page logged in as "student"
  | 
        
        
            | 
            | 
           73 | 
               And I press "Attempt quiz"
  | 
        
        
            | 
            | 
           74 | 
               And I am on the "Quiz 1 > student > Attempt 1 > 2" "mod_quiz > Attempt view" page
  | 
        
        
            | 
            | 
           75 | 
               And I should see "Second question"
  | 
        
        
            | 
            | 
           76 | 
               And I click on "True" "radio" in the "Second question" "question"
  | 
        
        
            | 
            | 
           77 | 
               And I wait "2" seconds
  | 
        
        
            | 
            | 
           78 | 
               And I am on the "Quiz 1 > student > Attempt 1 > 1" "mod_quiz > Attempt view" page
  | 
        
        
            | 
            | 
           79 | 
               Then I should see "Second question"
  | 
        
        
            | 
            | 
           80 | 
              | 
        
        
            | 
            | 
           81 | 
             @javascript
  | 
        
        
            | 
            | 
           82 | 
             Scenario: As a student I can review question I have finished in any order
  | 
        
        
            | 
            | 
           83 | 
               Given user "student" has attempted "Quiz 1" with responses:
  | 
        
        
            | 
            | 
           84 | 
                 | slot | response |
  | 
        
        
            | 
            | 
           85 | 
                 |   1  | True     |
  | 
        
        
            | 
            | 
           86 | 
                 |   2  | False    |
  | 
        
        
            | 
            | 
           87 | 
                 |   3  | False    |
  | 
        
        
            | 
            | 
           88 | 
                 |   4  | False    |
  | 
        
        
            | 
            | 
           89 | 
               When I am on the "Quiz 1" "mod_quiz > View" page logged in as "student"
  | 
        
        
            | 
            | 
           90 | 
               And I follow "Review"
  | 
        
        
            | 
            | 
           91 | 
               And I am on the "Quiz 1 > student > Attempt 1 > 3" "mod_quiz > Attempt view" page
  | 
        
        
            | 
            | 
           92 | 
               And I should see "Third question"
  | 
        
        
            | 
            | 
           93 | 
               And I am on the "Quiz 1 > student > Attempt 1 > 2" "mod_quiz > Attempt view" page
  | 
        
        
            | 
            | 
           94 | 
               Then I should see "Second question"
  |