From 2f9032a198b014ea51dbde00905a36d951f99a62 Mon Sep 17 00:00:00 2001 From: Tim Hunt Date: Wed, 16 Feb 2022 16:41:31 +0000 Subject: [PATCH] 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. --- .../grading/tests/behat/grading.feature | 8 +-- .../responses/tests/behat/basic.feature | 12 +--- .../statistics/tests/behat/basic.feature | 12 ++-- .../behat/attempt_redo_questions.feature | 4 +- mod/quiz/tests/behat/behat_mod_quiz.php | 1 + mod/quiz/tests/behat/editing_add.feature | 4 +- .../editing_set_marks_with_attempts.feature | 1 - .../tests/behat/question_status.feature | 2 +- question/bank/managecategories/category.php | 11 +++- .../behat/move_question_categories.feature | 4 +- .../tests/behat/question_categories.feature | 8 +-- .../question_categories_idnumber.feature | 10 ++- .../aiken/tests/behat/aiken_export.feature | 2 +- .../aiken/tests/behat/aiken_import.feature | 2 +- .../gift/tests/behat/import_export.feature | 6 +- .../xml/tests/behat/import_export.feature | 10 +-- question/templates/qbank_action_menu.mustache | 2 +- .../ddimageortext/tests/behat/export.feature | 2 +- .../ddimageortext/tests/behat/import.feature | 2 +- .../type/ddmarker/tests/behat/export.feature | 2 +- .../type/ddmarker/tests/behat/import.feature | 2 +- .../type/ddwtos/tests/behat/export.feature | 2 +- .../type/ddwtos/tests/behat/import.feature | 2 +- .../description/tests/behat/export.feature | 2 +- .../description/tests/behat/import.feature | 2 +- .../type/essay/tests/behat/export.feature | 2 +- .../type/essay/tests/behat/import.feature | 2 +- .../gapselect/tests/behat/import_test.feature | 4 +- .../type/match/tests/behat/export.feature | 2 +- .../type/match/tests/behat/import.feature | 2 +- .../multichoice/tests/behat/export.feature | 2 +- .../multichoice/tests/behat/import.feature | 2 +- .../type/numerical/tests/behat/export.feature | 2 +- .../type/numerical/tests/behat/import.feature | 2 +- .../shortanswer/tests/behat/export.feature | 2 +- .../shortanswer/tests/behat/import.feature | 2 +- .../type/truefalse/tests/behat/export.feature | 2 +- .../type/truefalse/tests/behat/import.feature | 2 +- .../tests/behat/question_reports.feature | 2 +- .../behat_theme_classic_behat_mod_quiz.php | 65 ------------------- 40 files changed, 66 insertions(+), 144 deletions(-) delete mode 100644 theme/classic/tests/behat/behat_theme_classic_behat_mod_quiz.php diff --git a/mod/quiz/report/grading/tests/behat/grading.feature b/mod/quiz/report/grading/tests/behat/grading.feature index e5d191dda17..686bf59224f 100644 --- a/mod/quiz/report/grading/tests/behat/grading.feature +++ b/mod/quiz/report/grading/tests/behat/grading.feature @@ -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)" diff --git a/mod/quiz/report/responses/tests/behat/basic.feature b/mod/quiz/report/responses/tests/behat/basic.feature index 510029dd579..a6dd5d5f5d2 100644 --- a/mod/quiz/report/responses/tests/behat/basic.feature +++ b/mod/quiz/report/responses/tests/behat/basic.feature @@ -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 diff --git a/mod/quiz/report/statistics/tests/behat/basic.feature b/mod/quiz/report/statistics/tests/behat/basic.feature index 32c6e071faf..3228635443a 100644 --- a/mod/quiz/report/statistics/tests/behat/basic.feature +++ b/mod/quiz/report/statistics/tests/behat/basic.feature @@ -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. diff --git a/mod/quiz/tests/behat/attempt_redo_questions.feature b/mod/quiz/tests/behat/attempt_redo_questions.feature index ef294199436..3000d26728f 100644 --- a/mod/quiz/tests/behat/attempt_redo_questions.feature +++ b/mod/quiz/tests/behat/attempt_redo_questions.feature @@ -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%" diff --git a/mod/quiz/tests/behat/behat_mod_quiz.php b/mod/quiz/tests/behat/behat_mod_quiz.php index 674aa25a5eb..6201222d421 100644 --- a/mod/quiz/tests/behat/behat_mod_quiz.php +++ b/mod/quiz/tests/behat/behat_mod_quiz.php @@ -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) | * diff --git a/mod/quiz/tests/behat/editing_add.feature b/mod/quiz/tests/behat/editing_add.feature index 1d47ca2660b..1e34c43ead4 100644 --- a/mod/quiz/tests/behat/editing_add.feature +++ b/mod/quiz/tests/behat/editing_add.feature @@ -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" diff --git a/mod/quiz/tests/behat/editing_set_marks_with_attempts.feature b/mod/quiz/tests/behat/editing_set_marks_with_attempts.feature index 7e4f9b66316..c20750885cb 100644 --- a/mod/quiz/tests/behat/editing_set_marks_with_attempts.feature +++ b/mod/quiz/tests/behat/editing_set_marks_with_attempts.feature @@ -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 | diff --git a/question/bank/editquestion/tests/behat/question_status.feature b/question/bank/editquestion/tests/behat/question_status.feature index 54954b3cd8f..dc6175fc273 100644 --- a/question/bank/editquestion/tests/behat/question_status.feature +++ b/question/bank/editquestion/tests/behat/question_status.feature @@ -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" diff --git a/question/bank/managecategories/category.php b/question/bank/managecategories/category.php index 4a4208b4a4d..183fff8f942 100644 --- a/question/bank/managecategories/category.php +++ b/question/bank/managecategories/category.php @@ -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 { diff --git a/question/bank/managecategories/tests/behat/move_question_categories.feature b/question/bank/managecategories/tests/behat/move_question_categories.feature index b548617fa40..c73897ae1b1 100644 --- a/question/bank/managecategories/tests/behat/move_question_categories.feature +++ b/question/bank/managecategories/tests/behat/move_question_categories.feature @@ -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 | diff --git a/question/bank/managecategories/tests/behat/question_categories.feature b/question/bank/managecategories/tests/behat/question_categories.feature index 03cd0a762e5..e2b8e7c7bd5 100644 --- a/question/bank/managecategories/tests/behat/question_categories.feature +++ b/question/bank/managecategories/tests/behat/question_categories.feature @@ -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" diff --git a/question/bank/managecategories/tests/behat/question_categories_idnumber.feature b/question/bank/managecategories/tests/behat/question_categories_idnumber.feature index c3199726d2c..3ec452c5dae 100644 --- a/question/bank/managecategories/tests/behat/question_categories_idnumber.feature +++ b/question/bank/managecategories/tests/behat/question_categories_idnumber.feature @@ -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" diff --git a/question/format/aiken/tests/behat/aiken_export.feature b/question/format/aiken/tests/behat/aiken_export.feature index 9f937a7c22d..ecedbe81370 100644 --- a/question/format/aiken/tests/behat/aiken_export.feature +++ b/question/format/aiken/tests/behat/aiken_export.feature @@ -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 diff --git a/question/format/aiken/tests/behat/aiken_import.feature b/question/format/aiken/tests/behat/aiken_import.feature index 807e7f80f02..f51cf2fd91c 100644 --- a/question/format/aiken/tests/behat/aiken_import.feature +++ b/question/format/aiken/tests/behat/aiken_import.feature @@ -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" diff --git a/question/format/gift/tests/behat/import_export.feature b/question/format/gift/tests/behat/import_export.feature index e398594c95f..911132ed084 100644 --- a/question/format/gift/tests/behat/import_export.feature +++ b/question/format/gift/tests/behat/import_export.feature @@ -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" diff --git a/question/format/xml/tests/behat/import_export.feature b/question/format/xml/tests/behat/import_export.feature index 48e2cca5e77..1bfa77392fb 100644 --- a/question/format/xml/tests/behat/import_export.feature +++ b/question/format/xml/tests/behat/import_export.feature @@ -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" diff --git a/question/templates/qbank_action_menu.mustache b/question/templates/qbank_action_menu.mustache index 37d0b0f5372..6d725d8e58d 100644 --- a/question/templates/qbank_action_menu.mustache +++ b/question/templates/qbank_action_menu.mustache @@ -32,7 +32,7 @@ "classes": "urlselect", "formid": "questionbankaction", "id": "url_select61a85bc543dca7", - "label": "questionbankactionselect", + "label": "Question bank tertiary navigation", "options": [{ "name": "Questions", "selected": true, diff --git a/question/type/ddimageortext/tests/behat/export.feature b/question/type/ddimageortext/tests/behat/export.feature index 62265d391ab..1b4fa9d0bd1 100644 --- a/question/type/ddimageortext/tests/behat/export.feature +++ b/question/type/ddimageortext/tests/behat/export.feature @@ -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 diff --git a/question/type/ddimageortext/tests/behat/import.feature b/question/type/ddimageortext/tests/behat/import.feature index d10b432d9a9..d4996633f79 100644 --- a/question/type/ddimageortext/tests/behat/import.feature +++ b/question/type/ddimageortext/tests/behat/import.feature @@ -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" diff --git a/question/type/ddmarker/tests/behat/export.feature b/question/type/ddmarker/tests/behat/export.feature index 8b196229822..0efe8e614ba 100644 --- a/question/type/ddmarker/tests/behat/export.feature +++ b/question/type/ddmarker/tests/behat/export.feature @@ -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 diff --git a/question/type/ddmarker/tests/behat/import.feature b/question/type/ddmarker/tests/behat/import.feature index ba32882d9d0..671dedfc070 100644 --- a/question/type/ddmarker/tests/behat/import.feature +++ b/question/type/ddmarker/tests/behat/import.feature @@ -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" diff --git a/question/type/ddwtos/tests/behat/export.feature b/question/type/ddwtos/tests/behat/export.feature index ae6151892db..2580e6cc787 100644 --- a/question/type/ddwtos/tests/behat/export.feature +++ b/question/type/ddwtos/tests/behat/export.feature @@ -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 diff --git a/question/type/ddwtos/tests/behat/import.feature b/question/type/ddwtos/tests/behat/import.feature index 2659d869cf9..119359a8c3f 100644 --- a/question/type/ddwtos/tests/behat/import.feature +++ b/question/type/ddwtos/tests/behat/import.feature @@ -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" diff --git a/question/type/description/tests/behat/export.feature b/question/type/description/tests/behat/export.feature index 91c300fda38..619dfcd8ac4 100644 --- a/question/type/description/tests/behat/export.feature +++ b/question/type/description/tests/behat/export.feature @@ -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 diff --git a/question/type/description/tests/behat/import.feature b/question/type/description/tests/behat/import.feature index 3b7cf52f85d..59855e7cec7 100644 --- a/question/type/description/tests/behat/import.feature +++ b/question/type/description/tests/behat/import.feature @@ -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" diff --git a/question/type/essay/tests/behat/export.feature b/question/type/essay/tests/behat/export.feature index a3b7aa59188..2fb531197b2 100644 --- a/question/type/essay/tests/behat/export.feature +++ b/question/type/essay/tests/behat/export.feature @@ -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 diff --git a/question/type/essay/tests/behat/import.feature b/question/type/essay/tests/behat/import.feature index e756b8f6eb1..ea18fc8c88f 100644 --- a/question/type/essay/tests/behat/import.feature +++ b/question/type/essay/tests/behat/import.feature @@ -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" diff --git a/question/type/gapselect/tests/behat/import_test.feature b/question/type/gapselect/tests/behat/import_test.feature index 24cb258f747..6ef2c81b1c0 100644 --- a/question/type/gapselect/tests/behat/import_test.feature +++ b/question/type/gapselect/tests/behat/import_test.feature @@ -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 diff --git a/question/type/match/tests/behat/export.feature b/question/type/match/tests/behat/export.feature index 0df927c1ca2..aba921421fd 100644 --- a/question/type/match/tests/behat/export.feature +++ b/question/type/match/tests/behat/export.feature @@ -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 diff --git a/question/type/match/tests/behat/import.feature b/question/type/match/tests/behat/import.feature index a7511298eec..75fe19338fe 100644 --- a/question/type/match/tests/behat/import.feature +++ b/question/type/match/tests/behat/import.feature @@ -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" diff --git a/question/type/multichoice/tests/behat/export.feature b/question/type/multichoice/tests/behat/export.feature index 1d4c8a22763..aa48ea4526e 100644 --- a/question/type/multichoice/tests/behat/export.feature +++ b/question/type/multichoice/tests/behat/export.feature @@ -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 diff --git a/question/type/multichoice/tests/behat/import.feature b/question/type/multichoice/tests/behat/import.feature index 79e7dc9abc7..31482f1d533 100644 --- a/question/type/multichoice/tests/behat/import.feature +++ b/question/type/multichoice/tests/behat/import.feature @@ -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" diff --git a/question/type/numerical/tests/behat/export.feature b/question/type/numerical/tests/behat/export.feature index d77074457da..ee700662eda 100644 --- a/question/type/numerical/tests/behat/export.feature +++ b/question/type/numerical/tests/behat/export.feature @@ -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 diff --git a/question/type/numerical/tests/behat/import.feature b/question/type/numerical/tests/behat/import.feature index b7026ea5748..9135e85c20a 100644 --- a/question/type/numerical/tests/behat/import.feature +++ b/question/type/numerical/tests/behat/import.feature @@ -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" diff --git a/question/type/shortanswer/tests/behat/export.feature b/question/type/shortanswer/tests/behat/export.feature index d83243fecb1..4cc9edefc7a 100644 --- a/question/type/shortanswer/tests/behat/export.feature +++ b/question/type/shortanswer/tests/behat/export.feature @@ -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 diff --git a/question/type/shortanswer/tests/behat/import.feature b/question/type/shortanswer/tests/behat/import.feature index a8df6faea91..c0c8378b8ac 100644 --- a/question/type/shortanswer/tests/behat/import.feature +++ b/question/type/shortanswer/tests/behat/import.feature @@ -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" diff --git a/question/type/truefalse/tests/behat/export.feature b/question/type/truefalse/tests/behat/export.feature index 81b9de39ade..f628e540faf 100644 --- a/question/type/truefalse/tests/behat/export.feature +++ b/question/type/truefalse/tests/behat/export.feature @@ -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 diff --git a/question/type/truefalse/tests/behat/import.feature b/question/type/truefalse/tests/behat/import.feature index 4bf13dceb86..10ad32dd00f 100644 --- a/question/type/truefalse/tests/behat/import.feature +++ b/question/type/truefalse/tests/behat/import.feature @@ -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" diff --git a/report/questioninstances/tests/behat/question_reports.feature b/report/questioninstances/tests/behat/question_reports.feature index 78d2d2b2f47..0e2a502d3fe 100644 --- a/report/questioninstances/tests/behat/question_reports.feature +++ b/report/questioninstances/tests/behat/question_reports.feature @@ -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" diff --git a/theme/classic/tests/behat/behat_theme_classic_behat_mod_quiz.php b/theme/classic/tests/behat/behat_theme_classic_behat_mod_quiz.php deleted file mode 100644 index ea366409a10..00000000000 --- a/theme/classic/tests/behat/behat_theme_classic_behat_mod_quiz.php +++ /dev/null @@ -1,65 +0,0 @@ -. - -/** - * 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); - } -}