[ Index ]

PHP Cross Reference of moodle-2.8

title

Body

[close]

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

   1  @mod @mod_quiz
   2  Feature: Edit quiz page - delete
   3    In order to change the layout of a quiz I built
   4    As a teacher
   5    I need to be able to delete questions.
   6  
   7    Background:
   8      Given the following "users" exist:
   9        | username | firstname | lastname | email               |
  10        | teacher1 | T1        | Teacher1 | [email protected] |
  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   | course | idnumber |
  19        | quiz       | Quiz 1 | C1     | quiz1    |
  20      And I log in as "teacher1"
  21      And I follow "Course 1"
  22  
  23    @javascript
  24    Scenario: Delete questions by clicking on the delete icon.
  25      And I add a "True/False" question to the "Quiz 1" quiz with:
  26        | Question name | Question A |
  27        | Question text | Answer me  |
  28      And I add a "True/False" question to the "Quiz 1" quiz with:
  29        | Question name | Question B   |
  30        | Question text | Answer again |
  31      And I add a "True/False" question to the "Quiz 1" quiz with:
  32        | Question name | Question C |
  33        | Question text | And again  |
  34      And I click on the "Add" page break icon after question "Question B"
  35  
  36      # Confirm the starting point.
  37      Then I should see "Question A" on quiz page "1"
  38      And I should see "Question B" on quiz page "1"
  39      And I should see "Question C" on quiz page "2"
  40      And I should see "Total of marks: 3.00"
  41      And I should see "Questions: 3"
  42      And I should see "This quiz is open"
  43  
  44      # Delete last question in last page. Page contains multiple questions
  45      When I delete "Question C" in the quiz by clicking the delete icon
  46      Then I should see "Question A" on quiz page "1"
  47      And I should see "Question B" on quiz page "1"
  48      And I should not see "Question C" on quiz page "2"
  49      And I should see "Total of marks: 2.00"
  50      And I should see "Questions: 2"
  51  
  52      # Delete last question in last page. The page contains multiple questions and there are multiple pages.
  53      When I click on the "Add" page break icon after question "Question A"
  54      Then I should see "Question B" on quiz page "2"
  55      And the "Remove" page break icon after question "Question A" should exist
  56      And I delete "Question B" in the quiz by clicking the delete icon
  57      Then I should see "Question A" on quiz page "1"
  58      And I should not see "Page 2"
  59      And I should not see "Question B" on quiz page "2"
  60      And the "Remove" page break icon after question "Question A" should not exist
  61      And I should see "Total of marks: 1.00"
  62  
  63      # Delete last remaining question in the last remaining page.
  64      And I delete "Question A" in the quiz by clicking the delete icon
  65      Then I should not see "Question A" on quiz page "1"
  66      And I should not see "Page 1"
  67      And I should see "Total of marks: 0.00"
  68  
  69    @javascript @edit_quiz_delete_start
  70    Scenario: Delete questions from the start of the list.
  71      # Add more questions.
  72      When I add a "Description" question to the "Quiz 1" quiz with:
  73      | Question name | Question A |
  74      | Question text | Answer A   |
  75  
  76      And I add a "True/False" question to the "Quiz 1" quiz with:
  77      | Question name | Question B |
  78      | Question text | Answer B   |
  79  
  80      And I add a "Description" question to the "Quiz 1" quiz with:
  81      | Question name | Question C |
  82      | Question text | Answer C   |
  83  
  84      And I add a "True/False" question to the "Quiz 1" quiz with:
  85      | Question name | Question D |
  86      | Question text | Answer D   |
  87  
  88      And I add a "True/False" question to the "Quiz 1" quiz with:
  89      | Question name | Question E |
  90      | Question text | Answer E   |
  91  
  92      Then "Question A" should have number "i" on the edit quiz page
  93      And "Question B" should have number "1" on the edit quiz page
  94      And "Question C" should have number "i" on the edit quiz page
  95      And "Question D" should have number "2" on the edit quiz page
  96      And "Question E" should have number "3" on the edit quiz page
  97  
  98      # Delete from first question in the last remaining page. Are the page breaks updated?
  99      When I delete "Question A" in the quiz by clicking the delete icon
 100      Then "Question B" should have number "1" on the edit quiz page
 101      And "Question C" should have number "i" on the edit quiz page
 102      And "Question D" should have number "2" on the edit quiz page
 103      And "Question E" should have number "3" on the edit quiz page
 104  
 105      When I click on the "Add" page break icon after question "Question C"
 106      Then I should see "Page 1"
 107      And I should see "Question B" on quiz page "1"
 108      And I should see "Question C" on quiz page "1"
 109      Then I should see "Page 2"
 110      And I should see "Question D" on quiz page "2"
 111      And I should see "Question E" on quiz page "2"
 112  
 113      # Test reorder of pages
 114      When I click on the "Add" page break icon after question "Question B"
 115      Then I should see "Page 1"
 116      And I should see "Question B" on quiz page "1"
 117      Then I should see "Page 2"
 118      And I should see "Question C" on quiz page "2"
 119      Then I should see "Page 3"
 120      And I should see "Question D" on quiz page "3"
 121      And I should see "Question E" on quiz page "3"


Generated: Fri Nov 28 20:29:05 2014 Cross-referenced by PHPXref 0.7.1