[ Index ]

PHP Cross Reference of Unnamed Project

title

Body

[close]

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

   1  @mod @mod_quiz
   2  Feature: Edit quiz page - pagination
   3    In order to build a quiz laid out in pages the way I want
   4    As a teacher
   5    I need to be able to add and remove pages, and repaginate.
   6  
   7    Background:
   8      Given the following "users" exist:
   9        | username | firstname | lastname | email                |
  10        | teacher1 | T1        | Teacher1 | teacher1@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        | teacher1 | C1     | editingteacher |
  17      And the following "activities" exist:
  18        | activity   | name   | intro              | course | idnumber |
  19        | quiz       | Quiz 1 | Quiz 1 description | C1     | quiz1    |
  20  
  21      When I log in as "teacher1"
  22      And I follow "Course 1"
  23      And I follow "Quiz 1"
  24      And I follow "Edit quiz"
  25  
  26    @javascript
  27    Scenario: Repaginate questions with N question(s) per page as well as clicking
  28      on "add page break" or "Remove page break" icons to repaginate in any desired format.
  29  
  30      Then I should see "Editing quiz: Quiz 1"
  31  
  32      # Add the first Essay question.
  33      And I follow "Add"
  34      And I follow "a new question"
  35      And I set the field "qtype_qtype_essay" to "1"
  36      And I press "submitbutton"
  37      Then I should see "Adding an Essay question"
  38      And I set the field "Question name" to "Essay 01 new"
  39      And I set the field "Question text" to "Please write 100 words about Essay 01"
  40      And I press "id_submitbutton"
  41      Then I should see "Editing quiz: Quiz 1"
  42      And I should see "Essay 01 new" on quiz page "1"
  43  
  44      # Add the second Essay question.
  45      And I follow "Add"
  46      And I follow "a new question"
  47      And I set the field "qtype_qtype_essay" to "1"
  48      And I press "submitbutton"
  49      Then I should see "Adding an Essay question"
  50      And I set the field "Question name" to "Essay 02 new"
  51      And I set the field "Question text" to "Please write 200 words about Essay 02"
  52      And I press "id_submitbutton"
  53      Then I should see "Editing quiz: Quiz 1"
  54      And I should see "Essay 01 new" on quiz page "1"
  55      And I should see "Essay 02 new" on quiz page "1"
  56  
  57      # Start repaginating.
  58      And I should not see "Page 2"
  59  
  60      When I click on the "Add" page break icon after question "Essay 01 new"
  61      And I should see "Essay 01 new" on quiz page "1"
  62      And I should see "Essay 02 new" on quiz page "2"
  63  
  64      When I click on the "Remove" page break icon after question "Essay 01 new"
  65      And I should see "Essay 01 new" on quiz page "1"
  66      And I should see "Essay 02 new" on quiz page "1"
  67      And I should not see "Page 2"
  68  
  69      # Add the third Essay question.
  70      And I follow "Add"
  71      And I follow "a new question"
  72      And I set the field "qtype_qtype_essay" to "1"
  73      And I press "submitbutton"
  74      Then I should see "Adding an Essay question"
  75      And I set the field "Question name" to "Essay 03 new"
  76      And I set the field "Question text" to "Please write 200 words about Essay 03"
  77      And I press "id_submitbutton"
  78      Then I should see "Editing quiz: Quiz 1"
  79      And I should see "Essay 01 new" on quiz page "1"
  80      And I should see "Essay 02 new" on quiz page "1"
  81      And I should see "Essay 03 new" on quiz page "1"
  82      And I should not see "Page 2"
  83      And I should not see "Page 3"
  84  
  85      When I click on the "Add" page break icon after question "Essay 02 new"
  86      And I should see "Essay 01 new" on quiz page "1"
  87      And I should see "Essay 02 new" on quiz page "1"
  88      And I should see "Essay 03 new" on quiz page "2"
  89      And I should not see "Page 3"
  90  
  91      When I click on the "Add" page break icon after question "Essay 01 new"
  92      And I should see "Essay 01 new" on quiz page "1"
  93      And I should see "Essay 02 new" on quiz page "2"
  94      And I should see "Essay 03 new" on quiz page "3"
  95  
  96      When I click on the "Remove" page break icon after question "Essay 02 new"
  97      And I should see "Essay 01 new" on quiz page "1"
  98      And I should see "Essay 02 new" on quiz page "2"
  99      And I should see "Essay 03 new" on quiz page "2"
 100      And I should not see "Page 3"
 101  
 102      When I click on the "Remove" page break icon after question "Essay 01 new"
 103      And I should see "Essay 01 new" on quiz page "1"
 104      And I should see "Essay 02 new" on quiz page "1"
 105      And I should see "Essay 03 new" on quiz page "1"
 106      And I should not see "Page 2"
 107      And I should not see "Page 3"
 108  
 109      # Repaginate one question per page.
 110      When I press "Repaginate"
 111      And I set the field "menuquestionsperpage" to "1"
 112      And I press "Go"
 113      Then I should see "Essay 01 new" on quiz page "1"
 114      And I should see "Essay 02 new" on quiz page "2"
 115      And I should see "Essay 03 new" on quiz page "3"
 116  
 117      # Add the forth Essay question in a new page (Page 4).
 118      When I open the "Page 3" add to quiz menu
 119      And I follow "a new question" in the open menu
 120      And I set the field "qtype_qtype_essay" to "1"
 121      And I press "submitbutton"
 122      Then I should see "Adding an Essay question"
 123      When I set the field "Question name" to "Essay 04 new"
 124      And I set the field "Question text" to "Please write 300 words about Essay 04"
 125      And I press "id_submitbutton"
 126      Then I should see "Editing quiz: Quiz 1"
 127      And I should see "Essay 01 new" on quiz page "1"
 128      And I should see "Essay 02 new" on quiz page "2"
 129      And I should see "Essay 03 new" on quiz page "3"
 130      And I should see "Essay 04 new" on quiz page "3"
 131  
 132      When I click on the "Add" page break icon after question "Essay 03 new"
 133      And I should see "Essay 01 new" on quiz page "1"
 134      And I should see "Essay 02 new" on quiz page "2"
 135      And I should see "Essay 03 new" on quiz page "3"
 136      And I should see "Essay 04 new" on quiz page "4"
 137  
 138      # Repaginate with 2 questions per page.
 139      When I press "Repaginate"
 140      And I set the field "menuquestionsperpage" to "2"
 141      And I press "Go"
 142      Then I should see "Essay 01 new" on quiz page "1"
 143      And I should see "Essay 02 new" on quiz page "1"
 144      And I should see "Essay 03 new" on quiz page "2"
 145      And I should see "Essay 04 new" on quiz page "2"
 146  
 147      # Repaginate with unlimited questions per page (All questions on Page 1).
 148      When I press "Repaginate"
 149      And I set the field "menuquestionsperpage" to "Unlimited"
 150      And I press "Go"
 151      Then I should see "Essay 01 new" on quiz page "1"
 152      And I should see "Essay 02 new" on quiz page "1"
 153      And I should see "Essay 03 new" on quiz page "1"
 154      And I should see "Essay 04 new" on quiz page "1"


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