MDL-63185 mod_quiz: replace existing tests to use new step
[moodle.git] / mod / quiz / tests / behat / preview.feature
bloba410d0e0c01c7021b8ec68a990fd7aad8067963e
1 @mod @mod_quiz
2 Feature: Preview a quiz as a teacher
3   In order to verify my quizzes are ready for my students
4   As a teacher
5   I need to be able to preview them
7   Background:
8     Given the following "users" exist:
9       | username | firstname | lastname | email               |
10       | teacher  | Teacher   | One      | teacher@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       | teacher  | C1     | teacher |
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   | intro              | course | idnumber |
22       | quiz       | Quiz 1 | Quiz 1 description | C1     | quiz1    |
23     And the following "questions" exist:
24       | questioncategory | qtype       | name  | questiontext    |
25       | Test questions   | truefalse   | TF1   | First question  |
26       | Test questions   | truefalse   | TF2   | Second question |
27     And quiz "Quiz 1" contains the following questions:
28       | question | page | maxmark |
29       | TF1      | 1    |         |
30       | TF2      | 1    | 3.0     |
31     And user "teacher" has attempted "Quiz 1" with responses:
32       | slot | response |
33       |   1  | True     |
34       |   2  | False    |
36   @javascript
37   Scenario: Preview a quiz
38     When I log in as "teacher"
39     And I am on "Course 1" course homepage
40     When I follow "Quiz 1"
41     And I follow "Review"
42     Then I should see "25.00 out of 100.00"
43     And I follow "Finish review"
44     And "Review" "link" in the "Preview" "table_row" should be visible