MDL-63185 mod_quiz: replace existing tests to use new step
Part of MDL-62610
This commit is contained in:
@@ -17,50 +17,35 @@ Feature: Basic use of the Manual grading report
|
||||
| user | course | role |
|
||||
| teacher1 | C1 | editingteacher |
|
||||
| student1 | C1 | student |
|
||||
And I log in as "teacher1"
|
||||
And I am on "Course 1" course homepage with editing mode on
|
||||
And I add a "Quiz" to section "1" and I fill the form with:
|
||||
| Name | Quiz 1 |
|
||||
| Description | Quiz 1 description |
|
||||
And I add a "Short answer" question to the "Quiz 1" quiz with:
|
||||
| Question name | Short answer 001 |
|
||||
| Question text | Where is the capital city of France? |
|
||||
| Answer 1 | Paris |
|
||||
| Grade | 100% |
|
||||
And the following "question categories" exist:
|
||||
| contextlevel | reference | name |
|
||||
| Course | C1 | Test questions |
|
||||
And the following "questions" exist:
|
||||
| questioncategory | qtype | name | questiontext | answer 1 | grade |
|
||||
| Test questions | shortanswer | Short answer 001 | Where is the capital city of France? | Paris | 100% |
|
||||
And the following "activities" exist:
|
||||
| activity | name | course | idnumber |
|
||||
| quiz | Quiz 1 | C1 | quiz1 |
|
||||
And quiz "Quiz 1" contains the following questions:
|
||||
| question | page |
|
||||
| Short answer 001 | 1 |
|
||||
|
||||
# Check report shows nothing when there are no attempts.
|
||||
When I log in as "teacher1"
|
||||
And I am on "Course 1" course homepage
|
||||
And I follow "Quiz 1"
|
||||
When I navigate to "Results > Manual grading" in current page administration
|
||||
And I navigate to "Results > Manual grading" in current page administration
|
||||
Then I should see "Manual grading"
|
||||
And I should see "Quiz 1"
|
||||
And I should see "Nothing to display"
|
||||
And I follow "Also show questions that have been graded automatically"
|
||||
And I should see "Nothing to display"
|
||||
And I log out
|
||||
|
||||
# Create an attempt.
|
||||
And I log in as "student1"
|
||||
And I am on "Course 1" course homepage
|
||||
And I follow "Quiz 1"
|
||||
And I press "Attempt quiz now"
|
||||
And I should see "Question 1"
|
||||
And I should see "Not yet answered"
|
||||
And I should see "Where is the capital city of France?"
|
||||
And I set the field "Answer:" to "Paris"
|
||||
And I press "Finish attempt ..."
|
||||
And I should see "Answer saved"
|
||||
And I press "Submit all and finish"
|
||||
And I click on "Submit all and finish" "button" in the "Confirmation" "dialogue"
|
||||
And I log out
|
||||
|
||||
# Use the manual grading report.
|
||||
And I log in as "teacher1"
|
||||
And I am on "Course 1" course homepage
|
||||
And I follow "Quiz 1"
|
||||
And I navigate to "Results > Manual grading" in current page administration
|
||||
And I should see "Manual grading"
|
||||
And I follow "Also show questions that have been graded automatically"
|
||||
And user "student1" has attempted "Quiz 1" with responses:
|
||||
| slot | response |
|
||||
| 1 | Paris |
|
||||
And I reload the page
|
||||
And I should see "Short answer 001"
|
||||
And "Short answer 001" row "To grade" column of "questionstograde" table should contain "0"
|
||||
And "Short answer 001" row "Already graded" column of "questionstograde" table should contain "0"
|
||||
|
||||
@@ -35,29 +35,14 @@ Feature: Basic use of the Grades report
|
||||
| question | page | maxmark |
|
||||
| TF1 | 1 | |
|
||||
| TF2 | 1 | 3.0 |
|
||||
|
||||
# Add some attempts
|
||||
And I log in as "student1"
|
||||
And I am on "Course 1" course homepage
|
||||
And I follow "Quiz 1"
|
||||
And I press "Attempt quiz now"
|
||||
And I click on "True" "radio" in the "First question" "question"
|
||||
And I click on "False" "radio" in the "Second question" "question"
|
||||
And I press "Finish attempt ..."
|
||||
And I press "Submit all and finish"
|
||||
And I click on "Submit all and finish" "button" in the "Confirmation" "dialogue"
|
||||
And I log out
|
||||
|
||||
And I log in as "student2"
|
||||
And I am on "Course 1" course homepage
|
||||
And I follow "Quiz 1"
|
||||
And I press "Attempt quiz now"
|
||||
And I click on "True" "radio" in the "First question" "question"
|
||||
And I click on "True" "radio" in the "Second question" "question"
|
||||
And I press "Finish attempt ..."
|
||||
And I press "Submit all and finish"
|
||||
And I click on "Submit all and finish" "button" in the "Confirmation" "dialogue"
|
||||
And I log out
|
||||
And user "student1" has attempted "Quiz 1" with responses:
|
||||
| slot | response |
|
||||
| 1 | True |
|
||||
| 2 | False |
|
||||
And user "student2" has attempted "Quiz 1" with responses:
|
||||
| slot | response |
|
||||
| 1 | True |
|
||||
| 2 | True |
|
||||
|
||||
# Basic check of the Grades report
|
||||
When I log in as "teacher1"
|
||||
|
||||
@@ -42,31 +42,12 @@ Feature: Basic use of the Responses report
|
||||
And I set the field "Attempts from" to "enrolled users who have not attempted the quiz"
|
||||
And I press "Show report"
|
||||
And "Student One" row "State" column of "responses" table should contain "-"
|
||||
|
||||
@javascript
|
||||
Scenario: Report works when there are attempts
|
||||
# Add an attempt
|
||||
Given I log in as "student1"
|
||||
And I am on "Course 1" course homepage
|
||||
And I follow "Quiz 1"
|
||||
And I press "Attempt quiz now"
|
||||
And I set the field "Answer" to "1.0"
|
||||
And I press "Check"
|
||||
And I press "Try again"
|
||||
And I set the field "Answer" to "3.0"
|
||||
And I press "Check"
|
||||
And I press "Try again"
|
||||
And I set the field "Answer" to "3.14"
|
||||
And I press "Check"
|
||||
And I press "Finish attempt ..."
|
||||
And I press "Submit all and finish"
|
||||
And I click on "Submit all and finish" "button" in the "Confirmation" "dialogue"
|
||||
And I log out
|
||||
|
||||
When I log in as "teacher"
|
||||
And I am on "Course 1" course homepage
|
||||
And I follow "Quiz 1"
|
||||
And I navigate to "Results > Responses" in current page administration
|
||||
And user "student1" has attempted "Quiz 1" with responses:
|
||||
| slot | response |
|
||||
| 1 | 1.0 |
|
||||
| 1 | 3.0 |
|
||||
| 1 | 3.14 |
|
||||
And I reload the page
|
||||
Then I should see "Attempts: 1"
|
||||
And I should see "Student One"
|
||||
And I should not see "Student Two"
|
||||
|
||||
@@ -31,15 +31,14 @@ Feature: Attempt a quiz
|
||||
| question | page | maxmark |
|
||||
| TF1 | 1 | |
|
||||
| TF2 | 1 | 3.0 |
|
||||
And user "student" has attempted "Quiz 1" with responses:
|
||||
| slot | response |
|
||||
| 1 | True |
|
||||
| 2 | False |
|
||||
When I log in as "student"
|
||||
And I am on "Course 1" course homepage
|
||||
And I follow "Quiz 1"
|
||||
And I press "Attempt quiz now"
|
||||
And I click on "True" "radio" in the "First question" "question"
|
||||
And I click on "False" "radio" in the "Second question" "question"
|
||||
And I press "Finish attempt ..."
|
||||
And I press "Submit all and finish"
|
||||
And I click on "Submit all and finish" "button" in the "Confirmation" "dialogue"
|
||||
And I follow "Review"
|
||||
Then I should see "25.00 out of 100.00"
|
||||
|
||||
@javascript
|
||||
|
||||
@@ -592,9 +592,9 @@ class behat_mod_quiz extends behat_question_base {
|
||||
* @param string $quizname the name of the quiz the user will attempt.
|
||||
* @param string $username the username of the user that will attempt.
|
||||
* @param TableNode $attemptinfo information about the questions to add, as above.
|
||||
* @Given /^I attempt quiz "([^"]*)" as "([^"]*)" with the following responses:$/
|
||||
* @Given /^user "([^"]*)" has attempted "([^"]*)" with responses:$/
|
||||
*/
|
||||
public function i_attempt_quiz_as_user_setting_the_following_responses($quizname, $username, TableNode $attemptinfo) {
|
||||
public function user_has_attempted_with_responses($username, $quizname, TableNode $attemptinfo) {
|
||||
global $DB, $USER;
|
||||
|
||||
/** @var mod_quiz_generator $quizgenerator */
|
||||
|
||||
@@ -30,19 +30,15 @@ Feature: Set a quiz to be marked complete when the student uses all attempts all
|
||||
And quiz "Test quiz name" contains the following questions:
|
||||
| question | page |
|
||||
| First question | 1 |
|
||||
And user "student1" has attempted "Test quiz name" with responses:
|
||||
| slot | response |
|
||||
| 1 | False |
|
||||
|
||||
Scenario: student1 uses up both attempts without passing
|
||||
When I log in as "student1"
|
||||
And I am on "Course 1" course homepage
|
||||
And the "Test quiz name" "quiz" activity with "auto" completion should be marked as not complete
|
||||
And I follow "Test quiz name"
|
||||
And I press "Attempt quiz now"
|
||||
And I set the field "False" to "1"
|
||||
And I press "Finish attempt ..."
|
||||
And I press "Submit all and finish"
|
||||
And I am on "Course 1" course homepage
|
||||
And the "Test quiz name" "quiz" activity with "auto" completion should be marked as not complete
|
||||
And I follow "Test quiz name"
|
||||
And I press "Re-attempt quiz"
|
||||
And I set the field "False" to "1"
|
||||
And I press "Finish attempt ..."
|
||||
|
||||
@@ -35,11 +35,9 @@ Feature: Set a quiz to be marked complete when the student passes
|
||||
When I log in as "student1"
|
||||
And I am on "Course 1" course homepage
|
||||
And the "Test quiz name" "quiz" activity with "auto" completion should be marked as not complete
|
||||
And I follow "Test quiz name"
|
||||
And I press "Attempt quiz now"
|
||||
And I set the field "True" to "1"
|
||||
And I press "Finish attempt ..."
|
||||
And I press "Submit all and finish"
|
||||
And user "student1" has attempted "Test quiz name" with responses:
|
||||
| slot | response |
|
||||
| 1 | True |
|
||||
And I am on "Course 1" course homepage
|
||||
Then "Completed: Test quiz name" "icon" should exist in the "li.modtype_quiz" "css_element"
|
||||
And I log out
|
||||
|
||||
@@ -28,18 +28,17 @@ Feature: Preview a quiz as a teacher
|
||||
| question | page | maxmark |
|
||||
| TF1 | 1 | |
|
||||
| TF2 | 1 | 3.0 |
|
||||
And I log in as "teacher"
|
||||
And I am on "Course 1" course homepage
|
||||
And user "teacher" has attempted "Quiz 1" with responses:
|
||||
| slot | response |
|
||||
| 1 | True |
|
||||
| 2 | False |
|
||||
|
||||
@javascript
|
||||
Scenario: Preview a quiz
|
||||
When I log in as "teacher"
|
||||
And I am on "Course 1" course homepage
|
||||
When I follow "Quiz 1"
|
||||
And I press "Preview quiz now"
|
||||
And I click on "True" "radio" in the "First question" "question"
|
||||
And I click on "False" "radio" in the "Second question" "question"
|
||||
And I press "Finish attempt ..."
|
||||
And I press "Submit all and finish"
|
||||
And I click on "Submit all and finish" "button" in the "Confirmation" "dialogue"
|
||||
And I follow "Review"
|
||||
Then I should see "25.00 out of 100.00"
|
||||
And I follow "Finish review"
|
||||
And "Review" "link" in the "Preview" "table_row" should be visible
|
||||
|
||||
@@ -32,17 +32,12 @@ Feature: Quiz reset
|
||||
And quiz "Test quiz name" contains the following questions:
|
||||
| question | page |
|
||||
| TF1 | 1 |
|
||||
And user "student1" has attempted "Test quiz name" with responses:
|
||||
| slot | response |
|
||||
| 1 | True |
|
||||
|
||||
Scenario: Use course reset to clear all attempt data
|
||||
When I log in as "student1"
|
||||
And I am on "Course 1" course homepage
|
||||
And I follow "Test quiz name"
|
||||
And I press "Attempt quiz now"
|
||||
And I set the field "True" to "1"
|
||||
And I press "Finish attempt ..."
|
||||
And I press "Submit all and finish"
|
||||
And I log out
|
||||
And I log in as "teacher1"
|
||||
When I log in as "teacher1"
|
||||
And I am on "Course 1" course homepage
|
||||
And I navigate to "Reset" in current page administration
|
||||
And I set the following fields to these values:
|
||||
|
||||
Reference in New Issue
Block a user