MDL-66821 question behat: new step for acting on questions in the bank

There is a proposed change MDL-66816 which will change the question
bank UI. This will break any Behat tests which uses low-level steps
like

    When I click on "Duplicate" "link" in the "Test question" "table_row"

to perform an action on a question in the question bank. This commit
introduces a new step:

    When I choose "Duplicate" action for "Test question" in the question bank

This commit also converts all core Behat tests to use the new step.
This commit is contained in:
Tim Hunt
2019-10-14 11:36:12 +01:00
parent 5aacd5e70e
commit 9c14b28d0b
42 changed files with 113 additions and 81 deletions
@@ -29,11 +29,11 @@ Feature: Adding questions to a quiz from the question bank
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 click on "Edit" "link" in the "question 01 name" "table_row"
And I choose "Edit question" action for "question 01 name" in the question bank
And I set the following fields to these values:
| Tags | foo |
And I press "id_submitbutton"
And I click on "Edit" "link" in the "question 02 name" "table_row"
And I choose "Edit question" action for "question 02 name" in the question bank
And I set the following fields to these values:
| Tags | bar |
And I press "id_submitbutton"
@@ -30,11 +30,11 @@ Feature: Adding random questions to a quiz based on category and tags
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 click on "Edit" "link" in the "question 1 name" "table_row"
And I choose "Edit question" action for "question 1 name" in the question bank
And I set the following fields to these values:
| Tags | foo |
And I press "id_submitbutton"
And I click on "Manage tags" "link" in the "question 2 name" "table_row"
And I choose "Manage tags" action for "question 2 name" in the question bank
And I set the following fields in the "Question tags" "dialogue" to these values:
| Tags | bar |
And I press "Save changes"
+17
View File
@@ -86,4 +86,21 @@ class behat_question extends behat_question_base {
$xpath = $questionxpath . "/div[@class='info']/div[@class='state' and contains(., {$stateliteral})]";
$this->find('xpath', $xpath, $exception);
}
/**
* Activates a particular action on a particular question in the question bank UI.
*
* @When I choose :action action for :questionname in the question bank
* @param string $action the label for the action you want to activate.
* @param string $questionname the question name.
*/
public function i_action_the_question($action, $questionname) {
if ($action == 'Edit question') {
$action = 'Edit';
}
// Click the action from the menu.
$this->execute("behat_general::i_click_on_in_the",
[$action, 'link', $questionname, 'table_row']);
}
}
+3 -3
View File
@@ -26,7 +26,7 @@ Feature: A teacher can duplicate questions in the question bank
@javascript
Scenario: Duplicating a previously created question
When I click on "Duplicate" "link" in the "Test question to be copied" "table_row"
When I choose "Duplicate" action for "Test question to be copied" in the question bank
And I set the following fields to these values:
| Question name | Duplicated question name |
| Question text | Write a lot about duplicating questions |
@@ -38,12 +38,12 @@ Feature: A teacher can duplicate questions in the question bank
@javascript
Scenario: Duplicated questions automatically get a new name suggested
When I click on "Duplicate" "link" in the "Test question to be copied" "table_row"
When I choose "Duplicate" action for "Test question to be copied" in the question bank
Then the field "Question name" matches value "Test question to be copied (copy)"
@javascript
Scenario: The duplicate operation can be cancelled
When I click on "Duplicate" "link" in the "Test question to be copied" "table_row"
When I choose "Duplicate" action for "Test question to be copied" in the question bank
And I press "Cancel"
Then I should see "Test question to be copied"
And the field "Select a category" matches value "   Test questions (1)"
@@ -26,14 +26,14 @@ Feature: A teacher can delete questions in the question bank
@javascript
Scenario: A question not used anywhere can really be deleted
When I click on "Delete" "link" in the "Test question to be deleted" "table_row"
When I choose "Delete" action for "Test question to be deleted" in the question bank
And I press "Delete"
And I click on "Also show old questions" "checkbox"
Then I should not see "Test question to be deleted"
@javascript
Scenario: Deleting a question can be cancelled
When I click on "Delete" "link" in the "Test question to be deleted" "table_row"
When I choose "Delete" action for "Test question to be deleted" in the question bank
And I press "Cancel"
Then I should see "Test question to be deleted"
@@ -47,7 +47,7 @@ Feature: A teacher can delete questions in the question bank
| Question text | Write about whatever you want |
And I am on "Course 1" course homepage
And I navigate to "Question bank > Questions" in current page administration
When I click on "Delete" "link" in the "Test used question to be deleted" "table_row"
When 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"
And I click on "Also show old questions" "checkbox"
+2 -2
View File
@@ -26,7 +26,7 @@ Feature: A teacher can edit questions in the question bank
@javascript
Scenario: Edit a previously created question
When I click on "Edit" "link" in the "Test question to be edited" "table_row"
When I choose "Edit question" action for "Test question to be edited" in the question bank
And I set the following fields to these values:
| Question name | Edited question name |
| Question text | Write a lot about what you want |
@@ -38,7 +38,7 @@ Feature: A teacher can edit questions in the question bank
@javascript
Scenario: Editing a question can be cancelled
When I click on "Edit" "link" in the "Test question to be edited" "table_row"
When I choose "Edit question" action for "Test question to be edited" in the question bank
And I set the field "Question name" to "Edited question name"
And I press "Cancel"
Then I should see "Test question to be edited"
@@ -18,17 +18,17 @@ Feature: The questions in the question bank can be filtered by tags
| contextlevel | reference | name |
| Course | C1 | Test questions |
And the following "questions" exist:
| questioncategory | qtype | name | user | questiontext |
| 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 click on "Edit" "link" in the "question 1 name" "table_row"
And I choose "Edit question" action for "question 1 name" in the question bank
And I set the following fields to these values:
| Tags | foo |
And I press "id_submitbutton"
And I click on "Edit" "link" in the "question 2 name" "table_row"
And I choose "Edit question" action for "question 2 name" in the question bank
And I set the following fields to these values:
| Tags | bar |
And I press "id_submitbutton"
@@ -23,7 +23,7 @@ Feature: A teacher can preview questions in the question bank
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
When I click on "Preview" "link" in the "Test question to be previewed" "table_row"
When I choose "Preview" action for "Test question to be previewed" in the question bank
And I switch to "questionpreview" window
@javascript @_switch_window
@@ -78,7 +78,7 @@ Feature: A teacher can put questions in categories in the question bank
Scenario: Move a question between categories via the question settings page
When I navigate to "Question bank > Questions" in current page administration
And I set the field "Select a category" to "Used category"
And I click on "Edit" "link" in the "Test question to be moved" "table_row"
And I choose "Edit question" action for "Test question to be moved" in the question bank
And I click on "Use this category" "checkbox"
And I set the field "Save in category" to "Subcategory"
And I press "id_submitbutton"
@@ -58,7 +58,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 |
And I navigate to "Question bank > Questions" in current page administration
And I click on "Edit" "link" in the "Test question 2" "table_row"
And I choose "Edit question" action for "Test question 2" in the question bank
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.
@@ -73,11 +73,11 @@ 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 |
And I navigate to "Question bank > Questions" in current page administration
And I click on "Edit" "link" in the "Test question 1" "table_row"
And I choose "Edit question" action for "Test question 1" in the question bank
And I press "Save changes"
Then I should not see "This ID number is already in use"
Scenario: Question idnumber conficts found when saving to a different category.
Scenario: Question idnumber conflicts found when saving to a different category.
When the following "question categories" exist:
| contextlevel | reference | questioncategory | name |
| Course | C1 | Top | top |
@@ -88,7 +88,7 @@ Feature: A teacher can put questions with idnumbers in categories with idnumbers
| 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 click on "Edit" "link" in the "Question to edit" "table_row"
And I choose "Edit question" action for "Question to edit" in the question bank
And I set the following fields to these values:
| Use this category | 0 |
| ID number | q2 |
@@ -109,7 +109,7 @@ Feature: A teacher can put questions with idnumbers in categories with idnumbers
| 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 click on "Edit" "link" in the "Test question 3" "table_row"
And I choose "Edit question" action for "Test question 3" in the question bank
# 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"
@@ -117,6 +117,6 @@ Feature: A teacher can put questions with idnumbers in categories with idnumbers
And I click on "Test question 3" "checkbox" in the "Test question 3" "table_row"
And I set the field "Question category" to "Used category"
And I press "Move to >>"
And I click on "Edit" "link" in the "Test question 3" "table_row"
And I choose "Edit question" action for "Test question 3" in the question bank
# The question just moved into this category needs to have a unique idnumber, so a number is appended.
Then the field "ID number" matches value "q1_1"
@@ -29,7 +29,7 @@ Feature: Test duplicating a quiz containing a drag and drop onto image question
And I restore "test_backup.mbz" backup into a new course using this options:
| Schema | Course name | Course 2 |
And I navigate to "Question bank" in current page administration
And I click on "Edit" "link" in the "Drag onto image" "table_row"
And I choose "Edit question" action for "Drag onto image" in the question bank
Then the following fields match these values:
| Question name | Drag onto image |
| General feedback | <p>More information about the major features of the Earth's surface can be found in Block 3, Section 6.2.</p> |
@@ -26,7 +26,7 @@ Feature: Test editing a drag and drop onto image questions
@javascript
Scenario: Edit a drag and drop onto image question
When I click on "Edit" "link" in the "Drag onto image" "table_row"
And I choose "Edit question" action for "Drag onto image" in the question bank
And I set the following fields to these values:
| Question name | Edited question name |
And I press "id_submitbutton"
@@ -26,7 +26,7 @@ Feature: Preview a drag-drop onto image question
@javascript @_bug_phantomjs
Scenario: Preview a question using the mouse.
When I click on "Preview" "link" in the "Drag onto image" "table_row"
When I choose "Preview" action for "Drag onto image" in the question bank
And I switch to "questionpreview" window
# Increase window size and wait 2 seconds to ensure elements are placed properly by js.
# Keep window large else drag will scroll the window to find element.
@@ -48,7 +48,7 @@ Feature: Preview a drag-drop onto image question
@javascript
Scenario: Preview a question using the keyboard.
When I click on "Preview" "link" in the "Drag onto image" "table_row"
When I choose "Preview" action for "Drag onto image" in the question bank
And I switch to "questionpreview" window
# Increase window size and wait 2 seconds to ensure elements are placed properly by js.
And I change window size to "medium"
@@ -29,7 +29,7 @@ Feature: Test duplicating a quiz containing a drag and drop markers question
And I restore "test_backup.mbz" backup into a new course using this options:
| Schema | Course name | Course 2 |
And I navigate to "Question bank" in current page administration
And I click on "Edit" "link" in the "Drag markers" "table_row"
And I choose "Edit question" action for "Drag markers" in the question bank
Then the following fields match these values:
| Question name | Drag markers |
| Question text | Please place the markers on the map of Milton Keynes and be aware that there is more than one railway station. |
@@ -26,7 +26,7 @@ Feature: Test editing a drag and drop markers questions
@javascript
Scenario: Edit a drag and drop markers question
When I click on "Edit" "link" in the "Drag markers" "table_row"
When I choose "Edit question" action for "Drag markers" in the question bank
And I set the following fields to these values:
| Question name | Edited question name |
And I press "id_submitbutton"
@@ -26,7 +26,7 @@ Feature: Preview a drag-drop marker question
@javascript @_bug_phantomjs
Scenario: Preview a question using the mouse.
When I click on "Preview" "link" in the "Drag markers" "table_row"
When I choose "Preview" action for "Drag markers" in the question bank
And I switch to "questionpreview" window
# Increase window size and wait 2 seconds to ensure elements are placed properly by js.
# Keep window large else drag will scroll the window to find element.
@@ -44,7 +44,7 @@ Feature: Preview a drag-drop marker question
@javascript
Scenario: Preview a question using the keyboard.
When I click on "Preview" "link" in the "Drag markers" "table_row"
When I choose "Preview" action for "Drag markers" in the question bank
And I switch to "questionpreview" window
# Increase window size and wait 2 seconds to ensure elements are placed properly by js.
# Keep window large else drag will scroll the window to find element.
@@ -29,7 +29,7 @@ Feature: Test duplicating a quiz containing a drag and drop into text question
And I restore "test_backup.mbz" backup into a new course using this options:
| Schema | Course name | Course 2 |
And I navigate to "Question bank" in current page administration
And I click on "Edit" "link" in the "Drag to text" "table_row"
And I choose "Edit question" action for "Drag to text" in the question bank
Then the following fields match these values:
| Question name | Drag to text |
| Question text | The [[1]] brown [[2]] jumped over the [[3]] dog. |
@@ -26,7 +26,7 @@ Feature: Test editing a drag and drop into text questions
@javascript
Scenario: Edit a drag and drop into text question
When I click on "Edit" "link" in the "Drag to text" "table_row"
When I choose "Edit question" action for "Drag to text" in the question bank
Then I should see "Choice [[1]]"
And I should see "Choice [[2]]"
And I should see "Choice [[3]]"
@@ -26,7 +26,7 @@ Feature: Preview a drag-drop into text question
@javascript @_bug_phantomjs
Scenario: Preview a question using the mouse.
When I click on "Preview" "link" in the "Drag to text" "table_row"
When I choose "Preview" action for "Drag to text" in the question bank
And I switch to "questionpreview" window
# Increase window size and wait 2 seconds to ensure elements are placed properly by js.
# Keep window large else drag will scroll the window to find element.
@@ -42,7 +42,7 @@ Feature: Preview a drag-drop into text question
@javascript
Scenario: Preview a question using the keyboard & submit incomplete.
When I click on "Preview" "link" in the "Drag to text" "table_row"
When I choose "Preview" action for "Drag to text" in the question bank
And I switch to "questionpreview" window
And I type " " into space "1" in the drag and drop onto image question
And I type " " into space "2" in the drag and drop onto image question
@@ -54,7 +54,7 @@ Feature: Preview a drag-drop into text question
@javascript
Scenario: Preview a question using the keyboard.
When I click on "Preview" "link" in the "Drag to text" "table_row"
When I choose "Preview" action for "Drag to text" in the question bank
And I switch to "questionpreview" window
And I type " " into space "1" in the drag and drop onto image question
And I type " " into space "2" in the drag and drop onto image question
@@ -70,7 +70,7 @@ Feature: Preview a drag-drop into text question
| questioncategory | qtype | name | template |
| Test questions | ddwtos | Funny groups | oddgroups |
And I reload the page
When I click on "Preview" "link" in the "Funny groups" "table_row"
When I choose "Preview" action for "Funny groups" in the question bank
And I switch to "questionpreview" window
And I type " " into space "1" in the drag and drop onto image question
And I type " " into space "2" in the drag and drop onto image question
@@ -29,7 +29,7 @@ Feature: Test duplicating a quiz containing a Description question
And I restore "test_backup.mbz" backup into a new course using this options:
| Schema | Course name | Course 2 |
And I navigate to "Question bank" in current page administration
And I click on "Edit" "link" in the "description-001" "table_row"
And I choose "Edit question" action for "description-001" in the question bank
Then the following fields match these values:
| Question name | description-001 |
| Question text | Here is some information about the questions you are about to attempt. |
@@ -25,7 +25,7 @@ Feature: Test editing a Description question
And I navigate to "Question bank" in current page administration
Scenario: Edit a Description question
When I click on "Edit" "link" in the "description-001" "table_row"
When I choose "Edit question" action for "description-001" in the question bank
And I set the following fields to these values:
| Question name | |
And I press "id_submitbutton"
@@ -26,7 +26,7 @@ Feature: Preview a Description question
@javascript @_switch_window
Scenario: Preview a Description question and submit a correct response.
When I click on "Preview" "link" in the "description-001" "table_row"
When I choose "Preview" action for "description-001" in the question bank
And I switch to "questionpreview" window
And I set the field "How questions behave" to "Immediate feedback"
And I press "Start again with these options"
@@ -36,7 +36,7 @@ Feature: Test duplicating a quiz containing an Assay question
And I should see "essay-001"
And I should see "essay-002"
And I should see "essay-003"
And I click on "Edit" "link" in the "essay-001" "table_row"
And I choose "Edit question" action for "essay-001" in the question bank
Then the following fields match these values:
| Question name | essay-001 |
| Question text | Please write a story about a frog. |
@@ -44,7 +44,7 @@ Feature: Test duplicating a quiz containing an Assay question
| Response format | HTML editor |
| Require text | Require the student to enter text |
And I press "Cancel"
And I click on "Edit" "link" in the "essay-002" "table_row"
And I choose "Edit question" action for "essay-002" in the question bank
Then the following fields match these values:
| Question name | essay-002 |
| Question text | Please write a story about a frog. |
@@ -52,7 +52,7 @@ Feature: Test duplicating a quiz containing an Assay question
| Response format | HTML editor with file picker |
| Require text | Require the student to enter text |
And I press "Cancel"
And I click on "Edit" "link" in the "essay-003" "table_row"
And I choose "Edit question" action for "essay-003" in the question bank
Then the following fields match these values:
| Question name | essay-003 |
| Question text | Please write a story about a frog. |
+1 -1
View File
@@ -27,7 +27,7 @@ Feature: Test editing an Essay question
And I navigate to "Question bank" in current page administration
Scenario: Edit an Essay question
When I click on "Edit" "link" in the "essay-001" "table_row"
When I choose "Edit question" action for "essay-001" in the question bank
And I set the following fields to these values:
| Question name | |
And I press "id_submitbutton"
@@ -28,7 +28,7 @@ Feature: Preview Essay questions
@javascript @_switch_window
Scenario: Preview an Essay question and submit a partially correct response.
When I click on "Preview" "link" in the "essay-001" "table_row"
When I choose "Preview" action for "essay-001" in the question bank
And I switch to "questionpreview" window
And I set the field "How questions behave" to "Immediate feedback"
And I press "Start again with these options"
@@ -37,7 +37,7 @@ Feature: Preview Essay questions
@javascript @_switch_window
Scenario: Preview an Essay question and submit a partially correct response.
When I click on "Preview" "link" in the "essay-002" "table_row"
When I choose "Preview" action for "essay-002" in the question bank
And I switch to "questionpreview" window
And I set the field "How questions behave" to "Immediate feedback"
And I press "Start again with these options"
@@ -47,7 +47,7 @@ Feature: Preview Essay questions
@javascript @_switch_window
Scenario: Preview an Essay question and submit a partially correct response.
When I click on "Preview" "link" in the "essay-003" "table_row"
When I choose "Preview" action for "essay-003" in the question bank
And I switch to "questionpreview" window
And I set the field "How questions behave" to "Immediate feedback"
And I press "Start again with these options"
@@ -38,7 +38,7 @@ Feature: Test all the basic functionality of this question type
Then I should see "Select missing words 001"
# Preview it.
When I click on "Preview" "link" in the "Select missing words 001" "table_row"
When I choose "Preview" action for "Select missing words 001" in the question bank
And I switch to "questionpreview" window
# Gaps (drop-down menus) do not have labels. ids and names are generated
@@ -136,7 +136,7 @@ Feature: Test all the basic functionality of this question type
Then I should see "Select missing words 001"
# Edit the copy and verify the form field contents.
When I click on "Edit" "link" in the "Select missing words 001" "table_row"
When I choose "Edit question" action for "Select missing words 001" in the question bank
Then the following fields match these values:
| Question name | Select missing words 001 |
| Question text | The [[1]] [[2]] on the [[3]]. |
@@ -29,7 +29,7 @@ Feature: Test duplicating a quiz containing a Matching question
And I restore "test_backup.mbz" backup into a new course using this options:
| Schema | Course name | Course 2 |
And I navigate to "Question bank" in current page administration
And I click on "Edit" "link" in the "matching-001" "table_row"
And I choose "Edit question" action for "matching-001" in the question bank
Then the following fields match these values:
| Question name | matching-001 |
| Question text | Classify the animals. |
+3 -3
View File
@@ -26,7 +26,7 @@ Feature: Test editing a Matching question
@javascript @_switch_window
Scenario: Edit a Matching question
When I click on "Edit" "link" in the "Matching for editing" "table_row"
When I choose "Edit question" action for "Matching for editing" in the question bank
And I set the following fields to these values:
| Question name | |
And I press "id_submitbutton"
@@ -35,14 +35,14 @@ Feature: Test editing a Matching question
| Question name | Edited Matching name |
And I press "id_submitbutton"
Then I should see "Edited Matching name"
When I click on "Edit" "link" in the "Edited Matching name" "table_row"
When I choose "Edit question" action for "Edited Matching name" in the question bank
And I set the following fields to these values:
| Shuffle | 0 |
| Question 2 | dog |
| Question 4 | fly |
And I press "id_submitbutton"
Then I should see "Edited Matching name"
When I click on "Preview" "link" in the "Edited Matching name" "table_row"
When I choose "Preview" action for "Edited Matching name" in the question bank
And I switch to "questionpreview" window
Then I should see "frog"
And I should see "dog"
@@ -26,11 +26,11 @@ Feature: Preview a Matching question
@javascript @_switch_window
Scenario: Preview a Matching question and submit a correct response.
When I click on "Edit" "link" in the "matching-001" "table_row"
When I choose "Edit question" action for "matching-001" in the question bank
And I set the following fields to these values:
| Shuffle | 0 |
And I press "id_submitbutton"
When I click on "Preview" "link" in the "matching-001" "table_row"
When I choose "Preview" action for "matching-001" in the question bank
And I switch to "questionpreview" window
And I set the field "How questions behave" to "Immediate feedback"
And I press "Start again with these options"
@@ -44,11 +44,11 @@ Feature: Preview a Matching question
@javascript @_switch_window
Scenario: Preview a Matching question and submit a partially correct response.
When I click on "Edit" "link" in the "matching-001" "table_row"
When I choose "Edit question" action for "matching-001" in the question bank
And I set the following fields to these values:
| Shuffle | 0 |
And I press "id_submitbutton"
When I click on "Preview" "link" in the "matching-001" "table_row"
When I choose "Preview" action for "matching-001" in the question bank
And I switch to "questionpreview" window
And I set the field "How questions behave" to "Immediate feedback"
And I press "Start again with these options"
@@ -62,11 +62,11 @@ Feature: Preview a Matching question
@javascript @_switch_window
Scenario: Preview a Matching question and submit an incorrect response.
When I click on "Edit" "link" in the "matching-001" "table_row"
When I choose "Edit question" action for "matching-001" in the question bank
And I set the following fields to these values:
| Shuffle | 0 |
And I press "id_submitbutton"
When I click on "Preview" "link" in the "matching-001" "table_row"
When I choose "Preview" action for "matching-001" in the question bank
And I switch to "questionpreview" window
And I set the field "How questions behave" to "Immediate feedback"
And I press "Start again with these options"
@@ -29,7 +29,7 @@ Feature: Test duplicating a quiz containing a Multiple choice question
And I restore "test_backup.mbz" backup into a new course using this options:
| Schema | Course name | Course 2 |
And I navigate to "Question bank" in current page administration
And I click on "Edit" "link" in the "Multi-choice-001" "table_row"
And I choose "Edit question" action for "Multi-choice-001" in the question bank
Then the following fields match these values:
| Question name | Multi-choice-001 |
| Question text | Which are the odd numbers? |
@@ -26,7 +26,7 @@ Feature: Test editing a Multiple choice question
And I navigate to "Question bank" in current page administration
Scenario: Edit a Multiple choice question with multiple response (checkboxes)
When I click on "Edit" "link" in the "Multiple choice for editing" "table_row"
When I choose "Edit question" action for "Multiple choice for editing" in the question bank
And I set the following fields to these values:
| Question name | |
And I press "id_submitbutton"
@@ -37,7 +37,7 @@ Feature: Test editing a Multiple choice question
Then I should see "Edited Multiple choice name"
Scenario: Edit a Multiple choice question with single response (radio buttons)
When I click on "Edit" "link" in the "Single choice for editing" "table_row"
When I choose "Edit question" action for "Single choice for editing" in the question bank
And I set the following fields to these values:
| Question name | Edited Single choice name |
And I press "id_submitbutton"
@@ -27,7 +27,7 @@ Feature: Preview a Multiple choice question
@javascript @_switch_window
Scenario: Preview a Multiple choice question and submit a partially correct response.
When I click on "Preview" "link" in the "Multi-choice-001" "table_row"
When I choose "Preview" action for "Multi-choice-001" in the question bank
And I switch to "questionpreview" window
And I set the field "How questions behave" to "Immediate feedback"
And I press "Start again with these options"
@@ -42,7 +42,7 @@ Feature: Preview a Multiple choice question
@javascript @_switch_window
Scenario: Preview a Multiple choice question and submit a correct response.
When I click on "Preview" "link" in the "Multi-choice-001" "table_row"
When I choose "Preview" action for "Multi-choice-001" in the question bank
And I switch to "questionpreview" window
And I set the field "How questions behave" to "Immediate feedback"
And I press "Start again with these options"
@@ -59,7 +59,7 @@ Feature: Preview a Multiple choice question
@javascript @_switch_window
Scenario: Preview a Multiple choice question and submit a correct response.
When I click on "Preview" "link" in the "Multi-choice-002" "table_row"
When I choose "Preview" action for "Multi-choice-002" in the question bank
And I switch to "questionpreview" window
And I set the field "How questions behave" to "Immediate feedback"
And I press "Start again with these options"
@@ -73,7 +73,7 @@ Feature: Preview a Multiple choice question
@javascript @_switch_window
Scenario: Preview a multiple choice question (single response) and clear a previous selected option.
When I click on "Preview" "link" in the "Multi-choice-002" "table_row"
When I choose "Preview" action for "Multi-choice-002" in the question bank
And I switch to "questionpreview" window
And I set the field "How questions behave" to "Immediate feedback"
And I press "Start again with these options"
@@ -29,7 +29,7 @@ Feature: Test duplicating a quiz containing a Numerical question
And I restore "test_backup.mbz" backup into a new course using this options:
| Schema | Course name | Course 2 |
And I navigate to "Question bank" in current page administration
And I click on "Edit" "link" in the "Numerical-001" "table_row"
And I choose "Edit question" action for "Numerical-001" in the question bank
Then the following fields match these values:
| Question name | Numerical-001 |
| Question text | What is pi to two d.p.? |
@@ -28,7 +28,7 @@ Feature: Test editing a Numerical question
And I navigate to "Question bank" in current page administration
Scenario: Edit a Numerical question
When I click on "Edit" "link" in the "Numerical for editing" "table_row"
When I choose "Edit question" action for "Numerical for editing" in the question bank
Then the field "id_answer_0" matches value "3#14"
When I set the following fields to these values:
| Question name | |
@@ -38,7 +38,7 @@ Feature: Test editing a Numerical question
| Question name | Edited Numerical name |
And I press "id_submitbutton"
Then I should see "Edited Numerical name"
When I click on "Edit" "link" in the "Edited Numerical name" "table_row"
When I choose "Edit question" action for "Edited Numerical name" in the question bank
And I set the following fields to these values:
| id_answer_1 | 3#141592 |
| id_tolerance_1 | 0#005 |
@@ -30,7 +30,7 @@ Feature: Preview a Numerical question
@javascript @_switch_window
Scenario: Preview a Numerical question and submit a correct response.
When I click on "Preview" "link" in the "Numerical-001" "table_row"
When I choose "Preview" action for "Numerical-001" in the question bank
And I switch to "questionpreview" window
Then I should see "What is pi to two d.p.?"
When I set the field "How questions behave" to "Immediate feedback"
@@ -29,7 +29,7 @@ Feature: Test duplicating a quiz containing a Short answer question
And I restore "test_backup.mbz" backup into a new course using this options:
| Schema | Course name | Course 2 |
And I navigate to "Question bank" in current page administration
And I click on "Edit" "link" in the "shortanswer-001" "table_row"
And I choose "Edit question" action for "shortanswer-001" in the question bank
Then the following fields match these values:
| Question name | shortanswer-001 |
| Question text | Name an amphibian: __________ |
@@ -26,7 +26,7 @@ Feature: Test editing a Short answer question
@javascript @_switch_window
Scenario: Edit a Short answer question
When I click on "Edit" "link" in the "shortanswer-001 for editing" "table_row"
When I choose "Edit question" action for "shortanswer-001" in the question bank
And I set the following fields to these values:
| Question name | |
And I press "id_submitbutton"
@@ -35,14 +35,14 @@ Feature: Test editing a Short answer question
| Question name | Edited shortanswer-001 name |
And I press "id_submitbutton"
Then I should see "Edited shortanswer-001 name"
When I click on "Edit" "link" in the "Edited shortanswer-001 name" "table_row"
When I choose "Edit question" action for "Edited shortanswer-001" in the question bank
And I set the following fields to these values:
| id_answer_1 | newt |
| id_fraction_1 | 70% |
| id_feedback_1 | Newt is an OK good answer. |
And I press "id_submitbutton"
Then I should see "Edited shortanswer-001 name"
When I click on "Preview" "link" in the "Edited shortanswer-001 name" "table_row"
When I choose "Preview" action for "Edited shortanswer-001" in the question bank
And I switch to "questionpreview" window
Then I should see "Name an amphibian:"
# Set behaviour options
@@ -26,7 +26,7 @@ Feature: Preview a Short answer question
@javascript @_switch_window
Scenario: Preview a Short answer question with correct answer
When I click on "Preview" "link" in the "shortanswer-001" "table_row"
When I choose "Preview" action for "shortanswer-001" in the question bank
And I switch to "questionpreview" window
Then I should see "Name an amphibian:"
# Set behaviour options
@@ -41,7 +41,7 @@ Feature: Preview a Short answer question
@javascript @_switch_window
Scenario: Preview a Short answer question with almost correct answer
When I click on "Preview" "link" in the "shortanswer-001" "table_row"
When I choose "Preview" action for "shortanswer-001" in the question bank
And I switch to "questionpreview" window
Then I should see "Name an amphibian:"
# Set behaviour options
@@ -56,7 +56,7 @@ Feature: Preview a Short answer question
@javascript @_switch_window
Scenario: Preview a Short answer question with incorrect answer
When I click on "Preview" "link" in the "shortanswer-001" "table_row"
When I choose "Preview" action for "shortanswer-001" in the question bank
And I switch to "questionpreview" window
Then I should see "Name an amphibian:"
# Set behaviour options
@@ -29,7 +29,7 @@ Feature: Test duplicating a quiz containing a True/False question
And I restore "test_backup.mbz" backup into a new course using this options:
| Schema | Course name | Course 2 |
And I navigate to "Question bank" in current page administration
And I click on "Edit" "link" in the "true-false-001" "table_row"
And I choose "Edit question" action for "true-false-001" in the question bank
Then the following fields match these values:
| Question name | true-false-001 |
| Question text | The answer is true. |
@@ -25,7 +25,7 @@ Feature: Test editing a True/False question
And I navigate to "Question bank" in current page administration
Scenario: Edit a True/False question
When I click on "Edit" "link" in the "true-false-001" "table_row"
When I choose "Edit question" action for "true-false-001" in the question bank
And I set the following fields to these values:
| Question name | |
And I press "id_submitbutton"
@@ -26,7 +26,7 @@ Feature: Preview a Trtue/False question
@javascript @_switch_window
Scenario: Preview a True/False question and submit a correct response.
When I click on "Preview" "link" in the "true-false-001" "table_row"
When I choose "Preview" action for "true-false-001" in the question bank
And I switch to "questionpreview" window
And I set the field "How questions behave" to "Immediate feedback"
And I press "Start again with these options"
@@ -38,7 +38,7 @@ Feature: Preview a Trtue/False question
@javascript @_switch_window
Scenario: Preview a True/False question and submit an incorrect response.
When I click on "Preview" "link" in the "true-false-001" "table_row"
When I choose "Preview" action for "true-false-001" in the question bank
And I switch to "questionpreview" window
And I set the field "How questions behave" to "Immediate feedback"
And I press "Start again with these options"
+15
View File
@@ -1,6 +1,21 @@
This files describes API changes for question type plugins.
=== 3.8, 3.7.3, 3.6.7 ===
* Coming up in Moodle 3.8 are some changes to the question bank UI. These will break any
Behat automated tests which use the common pattern
When I click on "Duplicate" "link" in the "Test question" "table_row"
to trigger actions on questions when looking at the question bank screen. Therefore,
a new step has been introduced:
When I choose "Duplicate" action for "Test question" in the question bank
If you want your Behat tests to continue working with Moodle 3.8, you will need to use
the new step. The new step has been back-ported, so you can start updating your tests
and have them work with Moodle 3.6 and 3.7. In addition, if you want to trigger the
"Edit" action, you should change that to "Edit question".
=== 3.5 ===
+ Added new classes backup_qtype_extrafields_plugin and restore_qtype_extrafields_plugin
in order to use extra fields method in backup/restore question type. Require and inherit new classes for using it. See
backup_qtype_shortanswer_plugin and restore_qtype_shortanswer_plugin for an example of using this.