diff --git a/mod/quiz/tests/behat/editing_add.feature b/mod/quiz/tests/behat/editing_add.feature index 2952285fc0f..c796dd61d0d 100644 --- a/mod/quiz/tests/behat/editing_add.feature +++ b/mod/quiz/tests/behat/editing_add.feature @@ -105,8 +105,7 @@ Feature: Edit quiz page - adding things in various categories and add them to the question bank. # Create a couple of sub categories. - When I am on "Course 1" course homepage - And I navigate to "Question bank > Categories" in current page administration + When I am on the "Course 1" "core_question > course question categories" page Then I should see "Add category" Then I set the field "Parent category" to "Default for C1" And I set the field "Name" to "Subcat 1" diff --git a/mod/quiz/tests/behat/editing_add_from_question_bank.feature b/mod/quiz/tests/behat/editing_add_from_question_bank.feature index 94b56cf13e8..c1479266b6d 100644 --- a/mod/quiz/tests/behat/editing_add_from_question_bank.feature +++ b/mod/quiz/tests/behat/editing_add_from_question_bank.feature @@ -26,10 +26,7 @@ Feature: Adding questions to a quiz from the question bank | Test questions | essay | question 02 name | teacher1 | Question 02 text | qidnum | Scenario: The questions can be filtered by tag - Given I log in as "teacher1" - And I am on "Course 1" course homepage - When I navigate to "Question bank > Questions" in current page administration - And I choose "Edit question" action for "question 01 name" in the question bank + Given I am on the "question 01 name" "core_question > edit" page logged in as "teacher1" And I set the following fields to these values: | Tags | foo | And I press "id_submitbutton" @@ -37,7 +34,7 @@ Feature: Adding questions to a quiz from the question bank And I set the following fields to these values: | Tags | bar | And I press "id_submitbutton" - And I am on the "Quiz 1" "mod_quiz > Edit" page + When I am on the "Quiz 1" "mod_quiz > Edit" page And I open the "last" add to quiz menu And I follow "from question bank" Then I should see "foo" in the "question 01 name" "table_row" diff --git a/question/format/aiken/tests/behat/aiken_export.feature b/question/format/aiken/tests/behat/aiken_export.feature index 13bddf67dea..28f20d56f5b 100644 --- a/question/format/aiken/tests/behat/aiken_export.feature +++ b/question/format/aiken/tests/behat/aiken_export.feature @@ -21,11 +21,9 @@ Feature: Test exporting questions using Aiken format. | questioncategory | qtype | name | template | | Test questions | multichoice | Multi-choice-001 | two_of_four | | Test questions | multichoice | Multi-choice-002 | one_of_four | - And I log in as "teacher1" - And I am on "Course 1" course homepage Scenario: Aiken export - When I navigate to "Question bank > Export" in current page administration + When I am on the "Course 1" "core_question > course question export" page logged in as "teacher1" 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 520b2ef2259..9b3ef2e0a3d 100644 --- a/question/format/aiken/tests/behat/aiken_import.feature +++ b/question/format/aiken/tests/behat/aiken_import.feature @@ -14,15 +14,13 @@ Feature: Test importing questions from Aiken format. And the following "course enrolments" exist: | user | course | role | | teacher | C1 | editingteacher | - And I log in as "teacher" - And I am on "Course 1" course homepage @javascript @_file_upload Scenario: import some Aiken questions - When I navigate to "Question bank > Import" in current page administration + Given I am on the "Course 1" "core_question > course question import" page logged in as "teacher" 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" + When I press "id_submitbutton" Then I should see "Parsing questions from import file." And I should see "Importing 2 questions from file" And I should see "The Moodle project was started by:" diff --git a/question/format/gift/tests/behat/import_export.feature b/question/format/gift/tests/behat/import_export.feature index 48f0227321f..b95486bf8f9 100644 --- a/question/format/gift/tests/behat/import_export.feature +++ b/question/format/gift/tests/behat/import_export.feature @@ -14,13 +14,11 @@ Feature: Test importing questions from GIFT format. And the following "course enrolments" exist: | user | course | role | | teacher | C1 | editingteacher | - And I log in as "teacher" - And I am on "Course 1" course homepage + And I am on the "Course 1" "core_question > course question import" page logged in as "teacher" @javascript @_file_upload Scenario: import some GIFT questions - When I navigate to "Question bank > Import" in current page administration - And I set the field "id_format_gift" to "1" + When 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" Then I should see "Parsing questions from import file." @@ -37,8 +35,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 > Import" in current page administration - And I set the field "id_format_gift" to "1" + When 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" Then I should see "Parsing questions from import file." diff --git a/question/format/webct/tests/behat/import.feature b/question/format/webct/tests/behat/import.feature index 1dc5157856b..f60671bc2aa 100644 --- a/question/format/webct/tests/behat/import.feature +++ b/question/format/webct/tests/behat/import.feature @@ -14,12 +14,10 @@ Feature: Test importing questions from WebCT format. And the following "course enrolments" exist: | user | course | role | | teacher | C1 | editingteacher | - And I log in as "teacher" - And I am on "Course 1" course homepage @javascript @_file_upload Scenario: import some WebCT questions - When I navigate to "Question bank > Import" in current page administration + When I am on the "Course 1" "core_question > course question import" page logged in as "teacher" And I set the field "id_format_webct" to "1" And I upload "question/format/webct/tests/fixtures/sample_webct.txt" file to "Import" filemanager And I press "id_submitbutton" diff --git a/question/format/webct/tests/behat/importcalculated.feature b/question/format/webct/tests/behat/importcalculated.feature index 33e1b9d4ac0..0520ad9a868 100644 --- a/question/format/webct/tests/behat/importcalculated.feature +++ b/question/format/webct/tests/behat/importcalculated.feature @@ -14,12 +14,10 @@ Feature: Test importing calculated question from WebCT format. And the following "course enrolments" exist: | user | course | role | | teacher | C1 | editingteacher | - And I log in as "teacher" - And I am on "Course 1" course homepage @javascript @_file_upload Scenario: import a WebCT calculated question - When I navigate to "Question bank > Import" in current page administration + When I am on the "Course 1" "core_question > course question import" page logged in as "teacher" And I set the field "id_format_webct" to "1" And I upload "question/format/webct/tests/fixtures/sample_calculated_webct.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 0be26d71ddc..66b2efbad24 100644 --- a/question/format/xml/tests/behat/import_export.feature +++ b/question/format/xml/tests/behat/import_export.feature @@ -14,12 +14,10 @@ Feature: Test importing questions from Moodle XML format. And the following "course enrolments" exist: | user | course | role | | teacher | C1 | editingteacher | - And I log in as "teacher" - And I am on "Course 1" course homepage @javascript @_file_upload Scenario: import some true/false questions from Moodle XML format - When I navigate to "Question bank > Import" in current page administration + When I am on the "Course 1" "core_question > course question import" page logged in as "teacher" 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" @@ -40,7 +38,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 > Import" in current page administration + When I am on the "Course 1" "core_question > course question import" page logged in as "teacher" 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" @@ -52,7 +50,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 > Import" in current page administration + When I am on the "Course 1" "core_question > course question import" page logged in as "teacher" 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" @@ -64,7 +62,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 > Import" in current page administration + When I am on the "Course 1" "core_question > course question import" page logged in as "teacher" 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/tests/behat/behat_core_question.php b/question/tests/behat/behat_core_question.php index e056f121a07..ca642df37fa 100644 --- a/question/tests/behat/behat_core_question.php +++ b/question/tests/behat/behat_core_question.php @@ -71,6 +71,10 @@ class behat_core_question extends behat_question_base { return new moodle_url('/question/edit.php', ['courseid' => $this->get_course_id($identifier)]); + case 'course question categories': + return new moodle_url('/question/category.php', + ['courseid' => $this->get_course_id($identifier)]); + case 'course question import': return new moodle_url('/question/import.php', ['courseid' => $this->get_course_id($identifier)]); diff --git a/question/tests/behat/delete_questions.feature b/question/tests/behat/delete_questions.feature index aef5bd72c68..a3b896f3495 100644 --- a/question/tests/behat/delete_questions.feature +++ b/question/tests/behat/delete_questions.feature @@ -20,9 +20,7 @@ Feature: A teacher can delete questions in the question bank And the following "questions" exist: | questioncategory | qtype | name | questiontext | | Test questions | essay | Test question to be deleted | Write about whatever you want | - And I log in as "teacher1" - And I am on "Course 1" course homepage - And I navigate to "Question bank > Questions" in current page administration + And I am on the "Course 1" "core_question > course question bank" page logged in as "teacher1" @javascript Scenario: A question not used anywhere can really be deleted @@ -52,8 +50,7 @@ Feature: A teacher can delete questions in the question bank And quiz "Test quiz" contains the following questions: | question | page | requireprevious | | Test used question to be deleted | 1 | 0 | - When I am on "Course 1" course homepage - And I navigate to "Question bank > Questions" in current page administration + When I am on the "Course 1" "core_question > course question bank" page And I choose "Delete" action for "Test used question to be deleted" in the question bank And I press "Delete" Then I should not see "Test used question to be deleted" diff --git a/question/tests/behat/duplicate_questions.feature b/question/tests/behat/duplicate_questions.feature index b04f661bc9d..d8212328667 100644 --- a/question/tests/behat/duplicate_questions.feature +++ b/question/tests/behat/duplicate_questions.feature @@ -20,9 +20,7 @@ Feature: A teacher can duplicate questions in the question bank And the following "questions" exist: | questioncategory | qtype | name | questiontext | idnumber | | Test questions | essay | Test question to be copied | Write about whatever you want | qid | - And I log in as "teacher" - And I am on "Course 1" course homepage - And I navigate to "Question bank > Questions" in current page administration + And I am on the "Course 1" "core_question > course question bank" page logged in as "teacher" Scenario: Duplicating a previously created question When I choose "Duplicate" action for "Test question to be copied" in the question bank diff --git a/question/tests/behat/edit_question_tags.feature b/question/tests/behat/edit_question_tags.feature index 6f7007deda0..f623128010c 100644 --- a/question/tests/behat/edit_question_tags.feature +++ b/question/tests/behat/edit_question_tags.feature @@ -20,9 +20,7 @@ Feature: A teacher can manage tags on questions in the question bank And the following "questions" exist: | questioncategory | qtype | name | questiontext | | Test questions | essay | Test question to be tagged | Write about whatever you want | - And I log in as "teacher1" - And I am on "Course 1" course homepage - And I navigate to "Question bank > Questions" in current page administration + And I am on the "Course 1" "core_question > course question bank" page logged in as "teacher1" @javascript Scenario: Manage tags on a question diff --git a/question/tests/behat/edit_questions.feature b/question/tests/behat/edit_questions.feature index 8fdb5ca08a7..039055ab7b4 100644 --- a/question/tests/behat/edit_questions.feature +++ b/question/tests/behat/edit_questions.feature @@ -20,9 +20,7 @@ Feature: A teacher can edit questions in the question bank And the following "questions" exist: | questioncategory | qtype | name | questiontext | | Test questions | essay | Test question to be edited | Write about whatever you want | - And I log in as "teacher1" - And I am on "Course 1" course homepage - And I navigate to "Question bank > Questions" in current page administration + And I am on the "Course 1" "core_question > course question bank" page logged in as "teacher1" Scenario: Edit a previously created question When I choose "Edit question" action for "Test question to be edited" in the question bank diff --git a/question/tests/behat/edit_questions_standard_tags.feature b/question/tests/behat/edit_questions_standard_tags.feature index c6307015d16..d170e0fe1c0 100644 --- a/question/tests/behat/edit_questions_standard_tags.feature +++ b/question/tests/behat/edit_questions_standard_tags.feature @@ -20,9 +20,7 @@ Feature: The questions can be tagged | bar | 1 | Scenario: The tags autocomplete should include standard tags - When I log in as "teacher1" - And I am on "Course 1" course homepage - And I navigate to "Question bank > Questions" in current page administration + When I am on the "Course 1" "core_question > course question bank" page logged in as teacher1 And I press "Create a new question ..." And I set the field "item_qtype_truefalse" to "1" And I click on "Add" "button" in the "Choose a question type to add" "dialogue" diff --git a/question/tests/behat/filter_questions_by_tag.feature b/question/tests/behat/filter_questions_by_tag.feature index ce9df72c5fe..6cfdc612d11 100644 --- a/question/tests/behat/filter_questions_by_tag.feature +++ b/question/tests/behat/filter_questions_by_tag.feature @@ -21,14 +21,11 @@ Feature: The questions in the question bank can be filtered by tags | questioncategory | qtype | name | user | questiontext | | Test questions | essay | question 1 name | admin | Question 1 text | | Test questions | essay | question 2 name | teacher1 | Question 2 text | - And I log in as "teacher1" - And I am on "Course 1" course homepage - And I navigate to "Question bank > Questions" in current page administration - And I choose "Edit question" action for "question 1 name" in the question bank + And I am on the "question 1 name" "core_question > edit" page logged in as "teacher1" And I set the following fields to these values: | Tags | foo | And I press "id_submitbutton" - And I choose "Edit question" action for "question 2 name" in the question bank + And I am on the "question 2 name" "core_question > edit" page And I set the following fields to these values: | Tags | bar | And I press "id_submitbutton" diff --git a/question/tests/behat/move_question_categories.feature b/question/tests/behat/move_question_categories.feature index d34e9797fd3..35297374ef5 100644 --- a/question/tests/behat/move_question_categories.feature +++ b/question/tests/behat/move_question_categories.feature @@ -17,12 +17,10 @@ Feature: A teacher can move question categories in the question bank And the following "activities" exist: | activity | name | course | idnumber | | quiz | Test quiz | C1 | quiz1 | - And I log in as "teacher1" - And I am on "Course 1" course homepage + And I am on the "Test quiz" "mod_quiz > View" page logged in as "teacher1" Scenario: A question category can be moved to another context - When I follow "Test quiz" - And I navigate to "Question bank > Categories" in current page administration + When I navigate to "Question bank > Categories" in current page administration And I set the following fields to these values: | Name | Test category | | Parent category | Top for Test quiz | @@ -31,8 +29,7 @@ Feature: A teacher can move question categories in the question bank Then I should see "Test category" in the "//div[contains(concat(' ', normalize-space(@class), ' '), ' questioncategories ') and contains(concat(' ', normalize-space(@class), ' '), ' contextlevel50 ')]" "xpath_element" Scenario: A question category can be moved to top level - When I follow "Test quiz" - And I navigate to "Question bank > Categories" in current page administration + When I navigate to "Question bank > Categories" in current page administration And I set the following fields to these values: | Name | Test category | | Parent category | Default for Test quiz | diff --git a/question/tests/behat/preview_question.feature b/question/tests/behat/preview_question.feature index e3630e34a39..c6b93bfd412 100644 --- a/question/tests/behat/preview_question.feature +++ b/question/tests/behat/preview_question.feature @@ -20,9 +20,7 @@ Feature: A teacher can preview questions in the question bank And the following "questions" exist: | questioncategory | qtype | name | | Test questions | numerical | Test question to be previewed | - And I log in as "teacher1" - And I am on "Course 1" course homepage - And I navigate to "Question bank > Questions" in current page administration + And I am on the "Course 1" "core_question > course question bank" page logged in as "teacher1" When I choose "Preview" action for "Test question to be previewed" in the question bank And I switch to "questionpreview" window diff --git a/question/tests/behat/question_categories.feature b/question/tests/behat/question_categories.feature index fbcba7531f1..03a919bc3a5 100644 --- a/question/tests/behat/question_categories.feature +++ b/question/tests/behat/question_categories.feature @@ -23,11 +23,9 @@ Feature: A teacher can put questions in categories in the question bank And the following "questions" exist: | questioncategory | qtype | name | questiontext | | Used category | essay | Test question to be moved | Write about whatever you want | - And I log in as "teacher1" - And I am on "Course 1" course homepage Scenario: A new question category can be created - When I navigate to "Question bank > Categories" in current page administration + When I am on the "Course 1" "core_question > course question categories" page logged in as "teacher1" And I set the following fields to these values: | Name | New Category 1 | | Parent category | Top | @@ -39,7 +37,7 @@ Feature: A teacher can put questions in categories in the question bank And "New Category 1 [newcatidnumber]" "option" should exist in the "Parent category" "select" Scenario: A question category can be edited - When I navigate to "Question bank > Categories" in current page administration + When I am on the "Course 1" "core_question > course question categories" page logged in as "teacher1" 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: @@ -50,12 +48,12 @@ Feature: A teacher can put questions in categories in the question bank And I should see "I was edited" in the "New name" "list_item" Scenario: An empty question category can be deleted - When I navigate to "Question bank > Categories" in current page administration + When I am on the "Course 1" "core_question > course question categories" page logged in as "teacher1" 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 > Categories" in current page administration + When I am on the "Course 1" "core_question > course question categories" page logged in as "teacher1" 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" @@ -64,7 +62,7 @@ Feature: A teacher can put questions in categories in the question bank @javascript Scenario: Move a question between categories via the question page - When I navigate to "Question bank > Questions" in current page administration + When I am on the "Course 1" "core_question > course question bank" page logged in as "teacher1" And I set the field "Select a category" to "Used category" And I click on "Test question to be moved" "checkbox" in the "Test question to be moved" "table_row" And I set the field "Question category" to "Subcategory" @@ -76,7 +74,7 @@ Feature: A teacher can put questions in categories in the question bank @javascript Scenario: Move a question between categories via the question settings page - When I navigate to "Question bank > Questions" in current page administration + When I am on the "Course 1" "core_question > course question bank" page logged in as "teacher1" And I set the field "Select a category" to "Used category" And I choose "Edit question" action for "Test question to be moved" in the question bank And I click on "Use this category" "checkbox" diff --git a/question/tests/behat/question_categories_idnumber.feature b/question/tests/behat/question_categories_idnumber.feature index 5665a021ffe..3107f8ab074 100644 --- a/question/tests/behat/question_categories_idnumber.feature +++ b/question/tests/behat/question_categories_idnumber.feature @@ -57,8 +57,7 @@ Feature: A teacher can put questions with idnumbers in categories with idnumbers | questioncategory | qtype | name | questiontext | idnumber | | Used category | essay | Test question 1 | Write about whatever you want | q1 | | Used category | essay | Test question 2 | Write about whatever you want | q2 | - And I navigate to "Question bank > Questions" in current page administration - And I choose "Edit question" action for "Test question 2" in the question bank + And I am on the "Test question 2" "core_question > edit" page And I set the field "ID number" to "q1" And I press "submitbutton" # This is the standard form warning reminding the user that the idnumber needs to be unique for a category. @@ -72,8 +71,7 @@ Feature: A teacher can put questions with idnumbers in categories with idnumbers And the following "questions" exist: | questioncategory | qtype | name | questiontext | idnumber | | Used category | essay | Test question 1 | Write about whatever you want | q1 | - And I navigate to "Question bank > Questions" in current page administration - And I choose "Edit question" action for "Test question 1" in the question bank + And I am on the "Test question 1" "core_question > edit" page And I press "Save changes" Then I should not see "This ID number is already in use" @@ -87,8 +85,7 @@ Feature: A teacher can put questions with idnumbers in categories with idnumbers | questioncategory | qtype | name | questiontext | idnumber | | Category 1 | essay | Question to edit | Write about whatever you want | q1 | | Category 2 | essay | Other question | Write about whatever you want | q2 | - And I navigate to "Question bank > Questions" in current page administration - And I choose "Edit question" action for "Question to edit" in the question bank + And I am on the "Question to edit" "core_question > edit" page And I set the following fields to these values: | Use this category | 0 | | ID number | q2 | @@ -108,8 +105,7 @@ Feature: A teacher can put questions with idnumbers in categories with idnumbers | Used category | essay | Test question 1 | Write about whatever you want | q1 | | Used category | essay | Test question 2 | Write about whatever you want | q2 | | Subcategory | essay | Test question 3 | Write about whatever you want | q3 | - When I navigate to "Question bank > Questions" in current page administration - And I choose "Edit question" action for "Test question 3" in the question bank + When I am on the "Test question 3" "core_question > edit" page # The q1 idnumber is allowed for this question while it is in the Subcategory. And I set the field "ID number" to "q1" And I press "submitbutton" diff --git a/question/tests/behat/select_questions.feature b/question/tests/behat/select_questions.feature index b4b766e3f5f..0403c1adbe0 100644 --- a/question/tests/behat/select_questions.feature +++ b/question/tests/behat/select_questions.feature @@ -22,9 +22,7 @@ Feature: The questions in the question bank can be selected in various ways | Test questions | essay | A question 1 name | admin | Question 1 text | | Test questions | essay | B question 2 name | teacher1 | Question 2 text | | Test questions | numerical | C question 3 name | teacher1 | Question 3 text | - And I log in as "teacher1" - And I am on "Course 1" course homepage - And I navigate to "Question bank > Questions" in current page administration + And I am on the "Course 1" "core_question > course question bank" page logged in as "teacher1" @javascript Scenario: The question text can be chosen all in the list of questions diff --git a/question/tests/behat/sort_questions.feature b/question/tests/behat/sort_questions.feature index af57ff9660e..e9ab9c4cbdc 100644 --- a/question/tests/behat/sort_questions.feature +++ b/question/tests/behat/sort_questions.feature @@ -22,9 +22,7 @@ Feature: The questions in the question bank can be sorted in various ways | Test questions | essay | A question 1 name | admin | Question 1 text | numidnum Questions" in current page administration + And I am on the "Course 1" "core_question > course question bank" page logged in as "teacher1" @javascript Scenario: The questions are sorted by type by default