MDL-40988 quiz: ability to break quizzes into sections
[moodle.git] / mod / quiz / tests / behat / editing_remove_question.feature
blob41a8a7d5a213cee772276d6babc3b27e98e9d665
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.
7   Background:
8     Given the following "users" exist:
9       | username | firstname | lastname | email               |
10       | teacher1 | T1        | Teacher1 | teacher1@moodle.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"
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"
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"
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"
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"