MDL-63185 mod_quiz: replace existing tests to use new step
[moodle.git] / mod / quiz / report / responses / tests / behat / basic.feature
blobd1e86bfbf777481975788c75ae54482e7d0291a9
1 @mod @mod_quiz @quiz @quiz_reponses
2 Feature: Basic use of the Responses report
3   In order to see how my students are progressing
4   As a teacher
5   I need to see all their quiz responses
7   Background: Using the Responses report
8     Given the following "users" exist:
9       | username | firstname | lastname |
10       | teacher  | The       | Teacher  |
11       | student1 | Student   | One      |
12       | student2 | Student   | Two      |
13     And the following "courses" exist:
14       | fullname | shortname |
15       | Course 1 | C1        |
16     And the following "course enrolments" exist:
17       | user     | course | role           |
18       | teacher  | C1     | editingteacher |
19       | student1 | C1     | student        |
20       | student2 | C1     | student        |
21     And the following "question categories" exist:
22       | contextlevel | reference | name           |
23       | Course       | C1        | Test questions |
24     And the following "activities" exist:
25       | activity   | name   | intro              | course | idnumber | preferredbehaviour |
26       | quiz       | Quiz 1 | Quiz 1 description | C1     | quiz1    | interactive        |
27     And the following "questions" exist:
28       | questioncategory | qtype     | name | template |
29       | Test questions   | numerical | NQ   | pi3tries |
30     And quiz "Quiz 1" contains the following questions:
31       | question | page | maxmark |
32       | NQ       | 1    | 3.0     |
34   @javascript
35   Scenario: Report works when there are no attempts
36     When I log in as "teacher"
37     And I am on "Course 1" course homepage
38     And I follow "Quiz 1"
39     And I navigate to "Results > Responses" in current page administration
40     Then I should see "Attempts: 0"
41     And I should see "Nothing to display"
42     And I set the field "Attempts from" to "enrolled users who have not attempted the quiz"
43     And I press "Show report"
44     And "Student One" row "State" column of "responses" table should contain "-"
45     And user "student1" has attempted "Quiz 1" with responses:
46       | slot | response |
47       |   1  | 1.0     |
48       |   1  | 3.0    |
49       |   1  | 3.14    |
50     And I reload the page
51     Then I should see "Attempts: 1"
52     And I should see "Student One"
53     And I should not see "Student Two"
54     And I set the field "Attempts from" to "enrolled users who have, or have not, attempted the quiz"
55     And I set the field "Which tries" to "All tries"
56     And I press "Show report"
57     And "Student OneReview attempt" row "Response 1Sort by Response 1 Ascending" column of "responses" table should contain "1.0"
58     And "Student OneReview attempt" row "State" column of "responses" table should contain ""
59     And "Finished" row "Grade/100.00Sort by Grade/100.00 Ascending" column of "responses" table should contain "33.33"
60     And "Finished" row "Response 1Sort by Response 1 Ascending" column of "responses" table should contain "3.14"
61     And "Student Two" row "State" column of "responses" table should contain "-"
62     And "Student Two" row "Response 1Sort by Response 1 Ascending" column of "responses" table should contain "-"
64   @javascript
65   Scenario: Report does not allow strange combinations of options
66     When I log in as "teacher"
67     And I am on "Course 1" course homepage
68     And I follow "Quiz 1"
69     And I navigate to "Results > Responses" in current page administration
70     And the "Which tries" "select" should be enabled
71     And I set the field "Attempts from" to "enrolled users who have not attempted the quiz"
72     Then the "Which tries" "select" should be disabled