MDL-73335 quiz/questions: fix Behat fails from nav changes

The Classic quiz behat override is no longer needed.
The way it is implemented is Boost/core works in all cases.
This commit is contained in:
Tim Hunt
2022-02-24 09:26:29 +02:00
committed by Ilya Tregubov
parent b610055bbd
commit 2f9032a198
40 changed files with 66 additions and 144 deletions
@@ -41,9 +41,7 @@ Feature: Basic use of the Manual grading report
Scenario: Use the Manual grading report
# Check report shows nothing when there are no attempts.
When I am on the "Quiz 1" "mod_quiz > View" page logged in as "teacher1"
And I navigate to "Results" in current page administration
And I select "Manual grading" from the "jump" singleselect
When I am on the "Quiz 1" "mod_quiz > Manual grading report" page logged in as "teacher1"
Then I should see "Quiz 1" in the "//nav[contains(concat(' ', normalize-space(@aria-label), ' '), ' Navigation bar ')]" "xpath_element"
And I should see "Quiz 1"
And I should see "Nothing to display"
@@ -126,9 +124,7 @@ Feature: Basic use of the Manual grading report
Given user "student1" has attempted "Quiz 1" with responses:
| slot | response |
| 1 | Paris |
When I am on the "Quiz 1" "mod_quiz > View" page logged in as "teacher1"
And I navigate to "Results" in current page administration
And I select "Manual grading" from the "jump" singleselect
When I am on the "Quiz 1" "mod_quiz > Manual grading report" page logged in as "teacher1"
And I follow "Also show questions that have been graded automatically"
And I click on "update grades" "link" in the "Short answer 001" "table_row"
Then I should see "Attempt number 1 for S1 Student1 (student1, S1000, student1@example.com, little yellow frog)"
@@ -33,9 +33,7 @@ Feature: Basic use of the Responses report
@javascript
Scenario: Report works when there are no attempts
Given I am on the "Quiz 1" "quiz activity" page logged in as teacher
When I navigate to "Results" in current page administration
And I select "Responses" from the "jump" singleselect
When I am on the "Quiz 1" "mod_quiz > Responses report" page logged in as teacher
Then I should see "Attempts: 0"
And I should see "Nothing to display"
And I set the field "Attempts from" to "enrolled users who have not attempted the quiz"
@@ -54,9 +52,7 @@ Feature: Basic use of the Responses report
| 1 | 3.14 |
And user "student1" has finished an attempt at quiz "Quiz 1"
And I am on the "Quiz 1" "quiz activity" page logged in as teacher
And I navigate to "Results" in current page administration
And I select "Responses" from the "jump" singleselect
When I am on the "Quiz 1" "mod_quiz > Responses report" page logged in as teacher
Then I should see "Attempts: 1"
And I should see "Student One"
And I should not see "Student Two"
@@ -72,9 +68,7 @@ Feature: Basic use of the Responses report
@javascript
Scenario: Report does not allow strange combinations of options
Given I am on the "Quiz 1" "quiz activity" page logged in as teacher
And I navigate to "Results" in current page administration
And I select "Responses" from the "jump" singleselect
Given I am on the "Quiz 1" "mod_quiz > Responses report" page logged in as teacher
And the "Which tries" "select" should be enabled
When I set the field "Attempts from" to "enrolled users who have not attempted the quiz"
Then the "Which tries" "select" should be disabled
@@ -39,13 +39,11 @@ Feature: Basic use of the Statistics report
@javascript
Scenario: Report works when there are no attempts
Given I am on the "Quiz 1" "quiz activity" page logged in as teacher1
And I navigate to "Results" in current page administration
And I select "Statistics" from the "jump" singleselect
When I am on the "Quiz 1" "mod_quiz > Statistics report" page logged in as teacher1
Then I should see "No attempts have been made at this quiz, or all attempts have questions that need manual grading."
And I should not see "Statistics for question positions"
And "Show chart data" "link" should not exist
When user "student1" has attempted "Quiz 1" with responses:
And user "student1" has attempted "Quiz 1" with responses:
| slot | response |
| 1 | True |
| 2 | False |
@@ -60,11 +58,9 @@ Feature: Basic use of the Statistics report
| 1 | False |
| 2 | False |
| 3 | False |
And I am on the "Quiz 1" "quiz activity" page logged in as teacher1
And I navigate to "Results" in current page administration
And I select "Statistics" from the "jump" singleselect
And I am on the "Quiz 1" "mod_quiz > Statistics report" page logged in as teacher1
And I press "Show report"
Then I should not see "No questions have been attempted yet"
And I should not see "No questions have been attempted yet"
And "Show chart data" "link" should exist
# Question A statistics breakdown.
@@ -86,9 +86,7 @@ Feature: Allow students to redo questions in a practice quiz, without starting a
And I switch to the main window
And the state of "First question" question is shown as "Not answered"
And I should not see "Submit" in the ".history" "css_element"
And I am on the "Quiz 1" "mod_quiz > View" page
And I navigate to "Results" in current page administration
And I select "Statistics" from the "jump" singleselect
And I am on the "Quiz 1" "mod_quiz > Statistics report" page logged in as teacher
And I follow "TF1"
And "False" row "Frequency" column of "quizresponseanalysis" table should contain "100.00%"
And "True" row "Frequency" column of "quizresponseanalysis" table should contain "0.00%"
+1
View File
@@ -68,6 +68,7 @@ class behat_mod_quiz extends behat_question_base {
* | User overrides | Quiz name | The manage user overrides page |
* | Grades report | Quiz name | The overview report for a quiz |
* | Responses report | Quiz name | The responses report for a quiz |
* | Manual grading report | Quiz name | The manual grading report for a quiz |
* | Statistics report | Quiz name | The statistics report for a quiz |
* | Attempt review | Quiz name > username > [Attempt] attempt no | Review page for a given attempt (review.php) |
*
+2 -2
View File
@@ -101,7 +101,7 @@ Feature: Edit quiz page - adding things
# Create a couple of sub categories.
When I am on "Course 1" course homepage
And I navigate to "Question bank" in current page administration
And I select "Categories" from the "questionbankactionselect" singleselect
And I select "Categories" from the "Question bank tertiary navigation" singleselect
Then I should see "Add category"
And I follow "Add category"
Then I set the field "Parent category" to "Default for C1"
@@ -117,7 +117,7 @@ Feature: Edit quiz page - adding things
And I press "id_submitbutton"
And I should see "Subcat 2"
And I select "Questions" from the "questionbankactionselect" singleselect
And I select "Questions" from the "Question bank tertiary navigation" singleselect
And I should see "Question bank"
And I should see "Select a category"
@@ -20,7 +20,6 @@ Feature: Edit quiz marks with attempts
| activity | name | course | idnumber | grade | decimalpoints | questiondecimalpoints |
| quiz | Quiz 1 | C1 | quiz1 | 20 | 2 | -1 |
And I log in as "teacher1"
And I am on "Course 1" course homepage
And I add a "True/False" question to the "Quiz 1" quiz with:
| Question name | First question |
| Question text | Answer me |
@@ -20,7 +20,7 @@ Feature: Use the qbank base view to test the status change using
Scenario: Question status modal should change the status of the question
Given I log in as "admin"
And I am on the "Test quiz" "quiz activity" page
And I navigate to "Question bank > Questions" in current page administration
And I navigate to "Question bank" in current page administration
And I set the field "Select a category" to "Test questions"
And I should see "Test questions"
And I should see "Ready" in the "First question" "table_row"
+8 -3
View File
@@ -146,7 +146,9 @@ if ($qcobject->catform->is_cancelled()) {
redirect($thispageurl);
}
if ($param->edit !== null) {
if ($param->edit !== null || $qcobject->catform->is_submitted()) {
// In the is_submitted case, we only get here if it was submitted,
// but not valid, so we need to show the validation error.
$PAGE->navbar->add(get_string('editingcategory', 'question'));
}
@@ -163,8 +165,11 @@ $qbankaction = new \core_question\output\qbank_action_menu($url);
echo $renderer->render($qbankaction);
// Display the UI.
if ($param->edit !== null) {
$qcobject->edit_single_category($param->edit);
if ($param->edit !== null || $qcobject->catform->is_submitted()) {
// In the is_submitted case, we only get here if it was submitted,
// but not valid, so we need to show the validation error.
// In this case, category id is in the 'id' hidden filed.
$qcobject->edit_single_category($param->edit ?? required_param('id', PARAM_INT));
} else if ($questionstomove) {
$qcobject->display_move_form($questionstomove, $category);
} else {
@@ -23,7 +23,7 @@ Feature: A teacher can move question categories in the question bank
Scenario: A question category can be moved to another context
When I follow "Test quiz"
And I navigate to "Question bank" in current page administration
And I select "Categories" from the "questionbankactionselect" singleselect
And I select "Categories" from the "Question bank tertiary navigation" singleselect
And I follow "Add category"
And I set the following fields to these values:
| Name | Test category |
@@ -35,7 +35,7 @@ Feature: A teacher can move question categories in the question bank
Scenario: A question category can be moved to top level
When I follow "Test quiz"
And I navigate to "Question bank" in current page administration
And I select "Categories" from the "questionbankactionselect" singleselect
And I select "Categories" from the "Question bank tertiary navigation" singleselect
And I follow "Add category"
And I set the following fields to these values:
| Name | Test category |
@@ -28,7 +28,7 @@ Feature: A teacher can put questions in categories in the question bank
Scenario: A new question category can be created
When I navigate to "Question bank" in current page administration
And I select "Categories" from the "questionbankactionselect" singleselect
And I select "Categories" from the "Question bank tertiary navigation" singleselect
And I follow "Add category"
And I set the following fields to these values:
| Name | New Category 1 |
@@ -46,7 +46,7 @@ Feature: A teacher can put questions in categories in the question bank
Scenario: A question category can be edited
When I navigate to "Question bank" in current page administration
And I select "Categories" from the "questionbankactionselect" singleselect
And I select "Categories" from the "Question bank tertiary navigation" singleselect
And I click on "Edit this category" "link" in the "Subcategory" "list_item"
And the field "parent" matches value "   Default for C1"
And I set the following fields to these values:
@@ -58,13 +58,13 @@ Feature: A teacher can put questions in categories in the question bank
Scenario: An empty question category can be deleted
When I navigate to "Question bank" in current page administration
And I select "Categories" from the "questionbankactionselect" singleselect
And I select "Categories" from the "Question bank tertiary navigation" singleselect
And I click on "Delete" "link" in the "Subcategory" "list_item"
Then I should not see "Subcategory"
Scenario: An non-empty question category can be deleted if you move the contents elsewhere
When I navigate to "Question bank" in current page administration
And I select "Categories" from the "questionbankactionselect" singleselect
And I select "Categories" from the "Question bank tertiary navigation" singleselect
And I click on "Delete" "link" in the "Used category" "list_item"
And I should see "The category 'Used category' contains 1 questions"
And I press "Save in category"
@@ -24,21 +24,19 @@ Feature: A teacher can put questions with idnumbers in categories with idnumbers
| Course | C1 | Top | top | |
| Course | C1 | top | Used category | c1used |
And I navigate to "Question bank" in current page administration
And I select "Categories" from the "questionbankactionselect" singleselect
And I select "Categories" from the "Question bank tertiary navigation" singleselect
And I follow "Add category"
And I set the following fields to these values:
| Name | Sub used category |
| Parent category | Used category |
| Category info | Created as a test |
| ID number | c1used |
# Press the Add category button in category page.
And I click on "Add category" "button" in the "[id='fitem_id_submitbutton']" "css_element"
And I click on "Add category" "button"
# Standard warning.
Then I should see "This ID number is already in use"
# Correction to a unique idnumber for the context.
And I set the field "ID number" to "c1unused"
# Press the Add category button in the addcategory page.
And I click on "[id='id_submitbutton']" "css_element"
And I press "Add category"
Then I should see "Sub used category"
And I should see "ID number"
And I should see "c1unused"
@@ -51,7 +49,7 @@ Feature: A teacher can put questions with idnumbers in categories with idnumbers
| Course | C1 | Top | top | |
| Course | C1 | top | Used category | c1used |
And I navigate to "Question bank" in current page administration
And I select "Categories" from the "questionbankactionselect" singleselect
And I select "Categories" from the "Question bank tertiary navigation" singleselect
And I click on "Edit this category" "link" in the "Used category" "list_item"
And I press "Save changes"
Then I should not see "This ID number is already in use"
@@ -26,7 +26,7 @@ Feature: Test exporting questions using Aiken format.
Scenario: Aiken export
When I navigate to "Question bank" in current page administration
And I select "Export" from the "questionbankactionselect" singleselect
And I select "Export" from the "Question bank tertiary navigation" singleselect
And I set the field "id_format_aiken" to "1"
When I press "Export questions to file"
Then following "click here" should download between "68" and "70" bytes
@@ -20,7 +20,7 @@ Feature: Test importing questions from Aiken format.
@javascript @_file_upload
Scenario: import some Aiken questions
When I navigate to "Question bank" in current page administration
And I select "Import" from the "questionbankactionselect" singleselect
And I select "Import" from the "Question bank tertiary navigation" singleselect
And I set the field "id_format_aiken" to "1"
And I upload "question/format/aiken/tests/fixtures/questions.aiken.txt" file to "Import" filemanager
And I press "id_submitbutton"
@@ -20,7 +20,7 @@ Feature: Test importing questions from GIFT format.
@javascript @_file_upload
Scenario: import some GIFT questions
When I navigate to "Question bank" in current page administration
And I select "Import" from the "questionbankactionselect" singleselect
And I select "Import" from the "Question bank tertiary navigation" singleselect
And I set the field "id_format_gift" to "1"
And I upload "question/format/gift/tests/fixtures/questions.gift.txt" file to "Import" filemanager
And I press "id_submitbutton"
@@ -33,7 +33,7 @@ Feature: Test importing questions from GIFT format.
# Now export again.
And I am on "Course 1" course homepage
And I navigate to "Question bank" in current page administration
And I select "Export" from the "questionbankactionselect" singleselect
And I select "Export" from the "Question bank tertiary navigation" singleselect
And I set the field "id_format_gift" to "1"
And I press "Export questions to file"
And following "click here" should download between "1500" and "1800" bytes
@@ -41,7 +41,7 @@ Feature: Test importing questions from GIFT format.
@javascript @_file_upload
Scenario: import a GIFT file which specifies the category
When I navigate to "Question bank" in current page administration
And I select "Import" from the "questionbankactionselect" singleselect
And I select "Import" from the "Question bank tertiary navigation" singleselect
And I set the field "id_format_gift" to "1"
And I upload "question/format/gift/tests/fixtures/questions_in_category.gift.txt" file to "Import" filemanager
And I press "id_submitbutton"
@@ -20,7 +20,7 @@ Feature: Test importing questions from Moodle XML format.
@javascript @_file_upload
Scenario: import some true/false questions from Moodle XML format
When I navigate to "Question bank" in current page administration
And I select "Import" from the "questionbankactionselect" singleselect
And I select "Import" from the "Question bank tertiary navigation" singleselect
And I set the field "id_format_xml" to "1"
And I upload "question/format/xml/tests/fixtures/truefalse.xml" file to "Import" filemanager
And I press "id_submitbutton"
@@ -35,7 +35,7 @@ Feature: Test importing questions from Moodle XML format.
# Now export again.
And I am on "Course 1" course homepage
When I navigate to "Question bank" in current page administration
And I select "Export" from the "questionbankactionselect" singleselect
And I select "Export" from the "Question bank tertiary navigation" singleselect
And I set the field "id_format_xml" to "1"
And I set the field "Export category" to "TrueFalse"
And I press "Export questions to file"
@@ -44,7 +44,7 @@ Feature: Test importing questions from Moodle XML format.
@javascript @_file_upload
Scenario: import some multiple choice questions from Moodle XML format
When I navigate to "Question bank" in current page administration
And I select "Import" from the "questionbankactionselect" singleselect
And I select "Import" from the "Question bank tertiary navigation" singleselect
And I set the field "id_format_xml" to "1"
And I upload "question/format/xml/tests/fixtures/multichoice.xml" file to "Import" filemanager
And I press "id_submitbutton"
@@ -57,7 +57,7 @@ Feature: Test importing questions from Moodle XML format.
@javascript @_file_upload
Scenario: import some multi-answer questions from Moodle XML format
When I navigate to "Question bank" in current page administration
And I select "Import" from the "questionbankactionselect" singleselect
And I select "Import" from the "Question bank tertiary navigation" singleselect
And I set the field "id_format_xml" to "1"
And I upload "question/format/xml/tests/fixtures/multianswer.xml" file to "Import" filemanager
And I press "id_submitbutton"
@@ -70,7 +70,7 @@ Feature: Test importing questions from Moodle XML format.
@javascript @_file_upload
Scenario: import some questions with legacy-style images from Moodle XML format
When I navigate to "Question bank" in current page administration
And I select "Import" from the "questionbankactionselect" singleselect
And I select "Import" from the "Question bank tertiary navigation" singleselect
And I set the field "id_format_xml" to "1"
And I upload "question/format/xml/tests/fixtures/sample_questions_with_old_image_tag.xml" file to "Import" filemanager
And I press "id_submitbutton"
@@ -32,7 +32,7 @@
"classes": "urlselect",
"formid": "questionbankaction",
"id": "url_select61a85bc543dca7",
"label": "questionbankactionselect",
"label": "Question bank tertiary navigation",
"options": [{
"name": "Questions",
"selected": true,
@@ -27,7 +27,7 @@ Feature: Test exporting drag and drop onto image questions
Scenario: Export a drag and drop onto image question
# Import sample file.
When I navigate to "Question bank" in current page administration
And I select "Export" from the "questionbankactionselect" singleselect
And I select "Export" from the "Question bank tertiary navigation" singleselect
And I set the field "id_format_xml" to "1"
And I press "Export questions to file"
And following "click here" should download between "18600" and "19150" bytes
@@ -20,7 +20,7 @@ Feature: Test importing drag and drop onto image questions
@javascript @_file_upload
Scenario: import drag and drop onto image question.
When I navigate to "Question bank" in current page administration
And I select "Import" from the "questionbankactionselect" singleselect
And I select "Import" from the "Question bank tertiary navigation" singleselect
And I set the field "id_format_xml" to "1"
And I upload "question/type/ddimageortext/tests/fixtures/testquestion.moodle.xml" file to "Import" filemanager
And I press "id_submitbutton"
@@ -27,7 +27,7 @@ Feature: Test exporting drag and drop markers questions
Scenario: Export a drag and drop markers question
# Import sample file.
When I navigate to "Question bank" in current page administration
And I select "Export" from the "questionbankactionselect" singleselect
And I select "Export" from the "Question bank tertiary navigation" singleselect
And I set the field "id_format_xml" to "1"
And I press "Export questions to file"
And following "click here" should download between "233700" and "233950" bytes
@@ -20,7 +20,7 @@ Feature: Test importing drag and drop markers questions
@javascript @_file_upload
Scenario: import drag and drop markers question.
When I navigate to "Question bank" in current page administration
And I select "Import" from the "questionbankactionselect" singleselect
And I select "Import" from the "Question bank tertiary navigation" singleselect
And I set the field "id_format_xml" to "1"
And I upload "question/type/ddmarker/tests/fixtures/testquestion.moodle.xml" file to "Import" filemanager
And I press "id_submitbutton"
@@ -27,7 +27,7 @@ Feature: Test exporting drag and drop into text questions
Scenario: Export a drag and drop into text question
# Import sample file.
When I navigate to "Question bank" in current page administration
And I select "Export" from the "questionbankactionselect" singleselect
And I select "Export" from the "Question bank tertiary navigation" singleselect
And I set the field "id_format_xml" to "1"
And I press "Export questions to file"
And following "click here" should download between "1550" and "1700" bytes
@@ -20,7 +20,7 @@ Feature: Test importing drag and drop into text questions
@javascript @_file_upload
Scenario: import drag and drop into text question.
When I navigate to "Question bank" in current page administration
And I select "Import" from the "questionbankactionselect" singleselect
And I select "Import" from the "Question bank tertiary navigation" singleselect
And I set the field "id_format_xml" to "1"
And I upload "question/type/ddwtos/tests/fixtures/testquestion.moodle.xml" file to "Import" filemanager
And I press "id_submitbutton"
@@ -25,7 +25,7 @@ Feature: Test exporting Description questions
Scenario: Export a Description question
When I navigate to "Question bank" in current page administration
And I select "Export" from the "questionbankactionselect" singleselect
And I select "Export" from the "Question bank tertiary navigation" singleselect
And I set the field "id_format_xml" to "1"
And I press "Export questions to file"
Then following "click here" should download between "650" and "900" bytes
@@ -20,7 +20,7 @@ Feature: Test importing Description questions
@javascript @_file_upload
Scenario: import a Description question.
When I navigate to "Question bank" in current page administration
And I select "Import" from the "questionbankactionselect" singleselect
And I select "Import" from the "Question bank tertiary navigation" singleselect
And I set the field "id_format_xml" to "1"
And I upload "question/type/description/tests/fixtures/testquestion.moodle.xml" file to "Import" filemanager
And I press "id_submitbutton"
@@ -27,7 +27,7 @@ Feature: Test exporting Essay questions
Scenario: Export 3 Essay questions
When I navigate to "Question bank" in current page administration
And I select "Export" from the "questionbankactionselect" singleselect
And I select "Export" from the "Question bank tertiary navigation" singleselect
And I set the field "id_format_xml" to "1"
And I press "Export questions to file"
Then following "click here" should download between "3000" and "3500" bytes
@@ -20,7 +20,7 @@ Feature: Test importing Essay questions
@javascript @_file_upload
Scenario: import Essay question.
When I navigate to "Question bank" in current page administration
And I select "Import" from the "questionbankactionselect" singleselect
And I select "Import" from the "Question bank tertiary navigation" singleselect
And I set the field "id_format_xml" to "1"
And I upload "question/type/essay/tests/fixtures/testquestion.moodle.xml" file to "Import" filemanager
And I press "id_submitbutton"
@@ -21,7 +21,7 @@ Feature: Import and export select missing words questions
Scenario: Import and export select missing words questions
# Import sample file.
When I navigate to "Question bank" in current page administration
And I select "Import" from the "questionbankactionselect" singleselect
And I select "Import" from the "Question bank tertiary navigation" singleselect
And I set the field "id_format_xml" to "1"
And I upload "question/type/gapselect/tests/fixtures/testquestion.moodle.xml" file to "Import" filemanager
And I press "id_submitbutton"
@@ -34,7 +34,7 @@ Feature: Import and export select missing words questions
# Now export again.
And I am on "Course 1" course homepage
When I navigate to "Question bank" in current page administration
And I select "Export" from the "questionbankactionselect" singleselect
And I select "Export" from the "Question bank tertiary navigation" singleselect
And I set the field "id_format_xml" to "1"
And I press "Export questions to file"
Then following "click here" should download between "1650" and "1800" bytes
@@ -25,7 +25,7 @@ Feature: Test exporting Matching questions
Scenario: Export a Matching question
When I navigate to "Question bank" in current page administration
And I select "Export" from the "questionbankactionselect" singleselect
And I select "Export" from the "Question bank tertiary navigation" singleselect
And I set the field "id_format_xml" to "1"
And I press "Export questions to file"
Then following "click here" should download between "1600" and "1750" bytes
@@ -20,7 +20,7 @@ Feature: Test importing Matching questions
@javascript @_file_upload
Scenario: import Matching question.
When I navigate to "Question bank" in current page administration
And I select "Import" from the "questionbankactionselect" singleselect
And I select "Import" from the "Question bank tertiary navigation" singleselect
And I set the field "id_format_xml" to "1"
And I upload "question/type/match/tests/fixtures/testquestion.moodle.xml" file to "Import" filemanager
And I press "id_submitbutton"
@@ -26,7 +26,7 @@ Feature: Test exporting Multiple choice questions
Scenario: Export a Multiple choice question
When I navigate to "Question bank" in current page administration
And I select "Export" from the "questionbankactionselect" singleselect
And I select "Export" from the "Question bank tertiary navigation" singleselect
And I set the field "id_format_xml" to "1"
And I press "Export questions to file"
Then following "click here" should download between "3900" and "4100" bytes
@@ -20,7 +20,7 @@ Feature: Test importing Multiple choice questions
@javascript @_file_upload
Scenario: import Multiple choice question.
When I navigate to "Question bank" in current page administration
And I select "Import" from the "questionbankactionselect" singleselect
And I select "Import" from the "Question bank tertiary navigation" singleselect
And I set the field "id_format_xml" to "1"
And I upload "question/type/multichoice/tests/fixtures/testquestion.moodle.xml" file to "Import" filemanager
And I press "id_submitbutton"
@@ -26,7 +26,7 @@ Feature: Test exporting Numerical questions
Scenario: Export a Numerical question
When I navigate to "Question bank" in current page administration
And I select "Export" from the "questionbankactionselect" singleselect
And I select "Export" from the "Question bank tertiary navigation" singleselect
And I set the field "id_format_xml" to "1"
And I press "Export questions to file"
Then following "click here" should download between "3650" and "3750" bytes
@@ -20,7 +20,7 @@ Feature: Test importing Numerical questions
@javascript @_file_upload
Scenario: import Numerical question.
When I navigate to "Question bank" in current page administration
And I select "Import" from the "questionbankactionselect" singleselect
And I select "Import" from the "Question bank tertiary navigation" singleselect
And I set the field "id_format_xml" to "1"
And I upload "question/type/numerical/tests/fixtures/testquestion.moodle.xml" file to "Import" filemanager
And I press "id_submitbutton"
@@ -25,7 +25,7 @@ Feature: Test exporting Short answer questions
Scenario: Export a Short answer question
When I navigate to "Question bank" in current page administration
And I select "Export" from the "questionbankactionselect" singleselect
And I select "Export" from the "Question bank tertiary navigation" singleselect
And I set the field "id_format_xml" to "1"
And I press "Export questions to file"
Then following "click here" should download between "1200" and "1450" bytes
@@ -20,7 +20,7 @@ Feature: Test importing Short answer questions
@javascript @_file_upload
Scenario: import Matching question.
When I navigate to "Question bank" in current page administration
And I select "Import" from the "questionbankactionselect" singleselect
And I select "Import" from the "Question bank tertiary navigation" singleselect
And I set the field "id_format_xml" to "1"
And I upload "question/type/shortanswer/tests/fixtures/testquestion.moodle.xml" file to "Import" filemanager
And I press "id_submitbutton"
@@ -25,7 +25,7 @@ Feature: Test exporting True/False questions
Scenario: Export a True/False question
When I navigate to "Question bank" in current page administration
And I select "Export" from the "questionbankactionselect" singleselect
And I select "Export" from the "Question bank tertiary navigation" singleselect
And I set the field "id_format_xml" to "1"
And I press "Export questions to file"
Then following "click here" should download between "1000" and "1200" bytes
@@ -20,7 +20,7 @@ Feature: Test importing True/False questions
@javascript @_file_upload
Scenario: import a True/False question.
When I navigate to "Question bank" in current page administration
And I select "Import" from the "questionbankactionselect" singleselect
And I select "Import" from the "Question bank tertiary navigation" singleselect
And I set the field "id_format_xml" to "1"
And I upload "question/type/truefalse/tests/fixtures/testquestion.moodle.xml" file to "Import" filemanager
And I press "id_submitbutton"
@@ -44,7 +44,7 @@ Feature: A Teacher can generate question instance reports
@javascript
Scenario: Generate report displaying hidden questions
Given I am on the "Test quiz Q001" "quiz activity" page logged in as "admin"
And I navigate to "Question bank > Questions" in current page administration
And I navigate to "Question bank" in current page administration
And I click on "Edit" "link" in the "TF" "table_row"
And I choose "Delete" in the open action menu
And I press "Delete"
@@ -1,65 +0,0 @@
<?php
// This file is part of Moodle - http://moodle.org/
//
// Moodle is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// Moodle is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with Moodle. If not, see <http://www.gnu.org/licenses/>.
/**
* Step definitions related to mod_quiz overrides for the Classic theme.
*
* @package theme_classic
* @category test
* @copyright 2019 Michael Hawkins
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
// NOTE: no MOODLE_INTERNAL test here, this file may be required by behat before including /config.php.
require_once(__DIR__ . '/../../../../mod/quiz/tests/behat/behat_mod_quiz.php');
use Behat\Gherkin\Node\TableNode as TableNode;
/**
* Step definitions related to mod_quiz overrides for the Classic theme.
*
* @package theme_classic
* @category test
* @copyright 2019 Michael Hawkins
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
class behat_theme_classic_behat_mod_quiz extends behat_mod_quiz {
/**
* Adds a question to the existing quiz with filling the form.
* The form for creating a question should be on one page.
*
* @param string $questiontype
* @param string $quizname
* @param TableNode $questiondata with data for filling the add question form
*/
public function i_add_question_to_the_quiz_with($questiontype, $quizname, TableNode $questiondata) {
$quizname = $this->escape($quizname);
$editquiz = $this->escape(get_string('editquiz', 'quiz'));
$menuxpath = "//div[contains(@class, ' page-add-actions ')][last()]//a[contains(@class, ' dropdown-toggle')]";
$itemxpath = "//div[contains(@class, ' page-add-actions ')][last()]//a[contains(@class, ' addquestion ')]";
$this->execute('behat_general::click_link', $quizname);
$this->execute("behat_navigation::i_navigate_to_in_current_page_administration", $editquiz);
$this->execute("behat_general::i_click_on", array($menuxpath, "xpath_element"));
$this->execute("behat_general::i_click_on", array($itemxpath, "xpath_element"));
$this->finish_adding_question($questiontype, $questiondata);
}
}