[ Index ]

PHP Cross Reference of Unnamed Project

title

Body

[close]

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

   1  @mod @mod_quiz
   2  Feature: Edit quiz page - remove questions
   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 | 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 "question categories" exist:
  18        | contextlevel | reference | name           |
  19        | Course       | C1        | Test questions |
  20      And the following "activities" exist:
  21        | activity   | name   | course | idnumber |
  22        | quiz       | Quiz 1 | C1     | quiz1    |
  23      And I log in as "teacher1"
  24      And I follow "Course 1"
  25      And I follow "Quiz 1"
  26  
  27    @javascript
  28    Scenario: Delete questions by clicking on the delete icon.
  29      Given the following "questions" exist:
  30        | questioncategory | qtype     | name       | questiontext        |
  31        | Test questions   | truefalse | Question A | This is question 01 |
  32        | Test questions   | truefalse | Question B | This is question 02 |
  33        | Test questions   | truefalse | Question C | This is question 03 |
  34      And quiz "Quiz 1" contains the following questions:
  35        | question   | page |
  36        | Question A | 1    |
  37        | Question B | 1    |
  38        | Question C | 2    |
  39      And I follow "Edit quiz"
  40  
  41      # Confirm the starting point.
  42      Then I should see "Question A" on quiz page "1"
  43      And I should see "Question B" on quiz page "1"
  44      And I should see "Question C" on quiz page "2"
  45      And I should see "Total of marks: 3.00"
  46      And I should see "Questions: 3"
  47      And I should see "This quiz is open"
  48  
  49      # Delete last question in last page. Page contains multiple questions
  50      When I delete "Question C" in the quiz by clicking the delete icon
  51      Then I should see "Question A" on quiz page "1"
  52      And I should see "Question B" on quiz page "1"
  53      And I should not see "Question C" on quiz page "2"
  54      And I should see "Total of marks: 2.00"
  55      And I should see "Questions: 2"
  56  
  57      # Delete last question in last page. The page contains multiple questions and there are multiple pages.
  58      When I click on the "Add" page break icon after question "Question A"
  59      Then I should see "Question B" on quiz page "2"
  60      And the "Remove" page break icon after question "Question A" should exist
  61      And I delete "Question A" in the quiz by clicking the delete icon
  62      Then I should see "Question B" on quiz page "1"
  63      And I should not see "Page 2"
  64      And I should not see "Question A" on quiz page "2"
  65      And the "Remove" page break icon after question "Question B" should not exist
  66      And I should see "Total of marks: 1.00"
  67  
  68    @javascript
  69    Scenario: Cannot delete the last question in a section.
  70      Given the following "questions" exist:
  71        | questioncategory | qtype     | name       | questiontext        |
  72        | Test questions   | truefalse | Question A | This is question 01 |
  73        | Test questions   | truefalse | Question B | This is question 02 |
  74        | Test questions   | truefalse | Question C | This is question 03 |
  75      And quiz "Quiz 1" contains the following questions:
  76        | question   | page |
  77        | Question A | 1    |
  78        | Question B | 1    |
  79        | Question C | 2    |
  80      And quiz "Quiz 1" contains the following sections:
  81        | heading   | firstslot | shuffle |
  82        | Heading 1 | 1         | 1       |
  83        | Heading 2 | 2         | 1       |
  84      When I follow "Edit quiz"
  85      Then "Delete" "link" in the "Question A" "list_item" should not be visible
  86      Then "Delete" "link" in the "Question B" "list_item" should be visible
  87      Then "Delete" "link" in the "Question C" "list_item" should be visible
  88  
  89    @javascript
  90    Scenario: Can delete the last question in a quiz.
  91      Given the following "questions" exist:
  92        | questioncategory | qtype     | name       | questiontext        |
  93        | Test questions   | truefalse | Question A | This is question 01 |
  94      And quiz "Quiz 1" contains the following questions:
  95        | question   | page |
  96        | Question A | 1    |
  97      When I follow "Edit quiz"
  98      And I delete "Question A" in the quiz by clicking the delete icon
  99      Then I should see "Questions: 0"


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