MDL-74130 question behat: Update tests to use the new navigation steps

This commit is contained in:
Tim Hunt 2022-03-08 17:03:57 +00:00
parent 49f8c0213f
commit 2b13b00703
66 changed files with 480 additions and 677 deletions

View file

@ -6,21 +6,19 @@ Feature: Test creating a drag and drop onto image question
Background: Background:
Given the following "users" exist: Given the following "users" exist:
| username | firstname | lastname | email | | username |
| teacher1 | T1 | Teacher1 | teacher1@moodle.com | | teacher |
And the following "courses" exist: And the following "courses" exist:
| fullname | shortname | category | | fullname | shortname | category |
| Course 1 | C1 | 0 | | Course 1 | C1 | 0 |
And the following "course enrolments" exist: And the following "course enrolments" exist:
| user | course | role | | user | course | role |
| teacher1 | C1 | editingteacher | | teacher | C1 | editingteacher |
And I log in as "teacher1"
And I am on "Course 1" course homepage
And I navigate to "Question bank" in current page administration
@javascript @_file_upload @javascript @_file_upload
Scenario: Create a drag and drop onto image question Scenario: Create a drag and drop onto image question
When I press "Create a new question ..." When I am on the "Course 1" "core_question > course question bank" page logged in as teacher
And I press "Create a new question ..."
And I set the field "Drag and drop onto image" to "1" And I set the field "Drag and drop onto image" to "1"
And I click on "Add" "button" in the "Choose a question type to add" "dialogue" And I click on "Add" "button" in the "Choose a question type to add" "dialogue"
And I set the field "Question name" to "Drag and drop onto image 001" And I set the field "Question name" to "Drag and drop onto image 001"

View file

@ -19,16 +19,16 @@ Feature: Test duplicating a quiz containing a drag and drop onto image question
| quiz | Test quiz | C1 | quiz1 | | quiz | Test quiz | C1 | quiz1 |
And quiz "Test quiz" contains the following questions: And quiz "Test quiz" contains the following questions:
| Drag onto image | 1 | | Drag onto image | 1 |
And I log in as "admin"
And I am on "Course 1" course homepage
@javascript @javascript
Scenario: Backup and restore a course containing a drag and drop onto image question Scenario: Backup and restore a course containing a drag and drop onto image question
When I backup "Course 1" course using this options: When I am on the "Course 1" course page logged in as admin
And I backup "Course 1" course using this options:
| Confirmation | Filename | test_backup.mbz | | Confirmation | Filename | test_backup.mbz |
And I restore "test_backup.mbz" backup into a new course using this options: And I restore "test_backup.mbz" backup into a new course using this options:
| Schema | Course name | Course 2 | | Schema | Course name | Course 2 |
And I navigate to "Question bank" in current page administration | Schema | Course short name | C2 |
And I am on the "Course 2" "core_question > course question bank" page
And I choose "Edit question" action for "Drag onto image" in the question bank And I choose "Edit question" action for "Drag onto image" in the question bank
Then the following fields match these values: Then the following fields match these values:
| Question name | Drag onto image | | Question name | Drag onto image |

View file

@ -6,27 +6,24 @@ Feature: Test editing a drag and drop onto image questions
Background: Background:
Given the following "users" exist: Given the following "users" exist:
| username | firstname | lastname | email | | username |
| teacher1 | T1 | Teacher1 | teacher1@example.com | | teacher |
And the following "courses" exist: And the following "courses" exist:
| fullname | shortname | category | | fullname | shortname | category |
| Course 1 | C1 | 0 | | Course 1 | C1 | 0 |
And the following "course enrolments" exist: And the following "course enrolments" exist:
| user | course | role | | user | course | role |
| teacher1 | C1 | editingteacher | | teacher | C1 | editingteacher |
And the following "question categories" exist: And the following "question categories" exist:
| contextlevel | reference | name | | contextlevel | reference | name |
| Course | C1 | Test questions | | Course | C1 | Test questions |
And the following "questions" exist: And the following "questions" exist:
| questioncategory | qtype | name | template | | questioncategory | qtype | name | template |
| Test questions | ddimageortext | Drag onto image | xsection | | Test questions | ddimageortext | Drag onto image | xsection |
And I log in as "teacher1"
And I am on "Course 1" course homepage
And I navigate to "Question bank" in current page administration
@javascript @javascript
Scenario: Edit a drag and drop onto image question Scenario: Edit a drag and drop onto image question
And I choose "Edit question" action for "Drag onto image" in the question bank When I am on the "Drag onto image" "core_question > edit" page logged in as teacher
And I set the following fields to these values: And I set the following fields to these values:
| Question name | Edited question name | | Question name | Edited question name |
And I press "id_submitbutton" And I press "id_submitbutton"

View file

@ -6,30 +6,27 @@ Feature: Test exporting drag and drop onto image questions
Background: Background:
Given the following "users" exist: Given the following "users" exist:
| username | firstname | lastname | email | | username |
| teacher1 | T1 | Teacher1 | teacher1@example.com | | teacher |
And the following "courses" exist: And the following "courses" exist:
| fullname | shortname | category | | fullname | shortname | category |
| Course 1 | C1 | 0 | | Course 1 | C1 | 0 |
And the following "course enrolments" exist: And the following "course enrolments" exist:
| user | course | role | | user | course | role |
| teacher1 | C1 | editingteacher | | teacher | C1 | editingteacher |
And the following "question categories" exist: And the following "question categories" exist:
| contextlevel | reference | name | | contextlevel | reference | name |
| Course | C1 | Test questions | | Course | C1 | Test questions |
And the following "questions" exist: And the following "questions" exist:
| questioncategory | qtype | name | template | | questioncategory | qtype | name | template |
| Test questions | ddimageortext | Drag onto image | xsection | | Test questions | ddimageortext | Drag onto image | xsection |
And I log in as "teacher1"
And I am on "Course 1" course homepage
@javascript @javascript
Scenario: Export a drag and drop onto image question Scenario: Export a drag and drop onto image question
# Import sample file. When I am on the "Course 1" "core_question > course question export" page logged in as teacher
When I navigate to "Question bank > Export" in current page administration
And I set the field "id_format_xml" to "1" And I set the field "id_format_xml" to "1"
And I press "Export questions to file" And I press "Export questions to file"
And following "click here" should download between "18600" and "19150" bytes Then following "click here" should download between "18600" and "19150" bytes
# If the download step is the last in the scenario then we can sometimes run # If the download step is the last in the scenario then we can sometimes run
# into the situation where the download page causes a http redirect but behat # into the situation where the download page causes a http redirect but behat
# has already conducted its reset (generating an error). By putting a logout # has already conducted its reset (generating an error). By putting a logout

View file

@ -6,20 +6,18 @@ Feature: Test importing drag and drop onto image questions
Background: Background:
Given the following "users" exist: Given the following "users" exist:
| username | firstname | lastname | email | | username |
| teacher1 | T1 | Teacher1 | teacher1@example.com | | teacher |
And the following "courses" exist: And the following "courses" exist:
| fullname | shortname | category | | fullname | shortname | category |
| Course 1 | C1 | 0 | | Course 1 | C1 | 0 |
And the following "course enrolments" exist: And the following "course enrolments" exist:
| user | course | role | | user | course | role |
| teacher1 | C1 | editingteacher | | teacher | C1 | editingteacher |
And I log in as "teacher1"
And I am on "Course 1" course homepage
@javascript @_file_upload @javascript @_file_upload
Scenario: import drag and drop onto image question. Scenario: import drag and drop onto image 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_xml" to "1" 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 upload "question/type/ddimageortext/tests/fixtures/testquestion.moodle.xml" file to "Import" filemanager
And I press "id_submitbutton" And I press "id_submitbutton"

View file

@ -6,31 +6,24 @@ Feature: Preview a drag-drop onto image question
Background: Background:
Given the following "users" exist: Given the following "users" exist:
| username | firstname | lastname | email | | username |
| teacher1 | T1 | Teacher1 | teacher1@moodle.com | | teacher |
And the following "courses" exist: And the following "courses" exist:
| fullname | shortname | category | | fullname | shortname | category |
| Course 1 | C1 | 0 | | Course 1 | C1 | 0 |
And the following "course enrolments" exist: And the following "course enrolments" exist:
| user | course | role | | user | course | role |
| teacher1 | C1 | editingteacher | | teacher | C1 | editingteacher |
And the following "question categories" exist: And the following "question categories" exist:
| contextlevel | reference | name | | contextlevel | reference | name |
| Course | C1 | Test questions | | Course | C1 | Test questions |
And the following "questions" exist: And the following "questions" exist:
| questioncategory | qtype | name | template | | questioncategory | qtype | name | template |
| Test questions | ddimageortext | Drag onto image | xsection | | Test questions | ddimageortext | Drag onto image | xsection |
Given I log in as "teacher1"
And I am on "Course 1" course homepage
And I navigate to "Question bank" in current page administration
@javascript @_bug_phantomjs @javascript @_bug_phantomjs
Scenario: Preview a question using the mouse. Scenario: Preview a question using the mouse.
When I choose "Preview" action for "Drag onto image" in the question bank When I am on the "Drag onto image" "core_question > preview" page logged in as teacher
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.
And I change window size to "medium"
And I wait "2" seconds And I wait "2" seconds
# Odd, but the <br>s go to nothing, not a space. # Odd, but the <br>s go to nothing, not a space.
And I drag "mountainbelt" to place "1" in the drag and drop onto image question And I drag "mountainbelt" to place "1" in the drag and drop onto image question
@ -44,12 +37,10 @@ Feature: Preview a drag-drop onto image question
And I press "Submit and finish" And I press "Submit and finish"
Then the state of "Identify the features" question is shown as "Correct" Then the state of "Identify the features" question is shown as "Correct"
And I should see "Mark 1.00 out of 1.00" And I should see "Mark 1.00 out of 1.00"
And I switch to the main window
@javascript @javascript
Scenario: Preview a question using the keyboard. Scenario: Preview a question using the keyboard.
When I choose "Preview" action for "Drag onto image" in the question bank When I am on the "Drag onto image" "core_question > preview" page logged in as teacher
And I switch to "questionpreview" window
# Increase window size and wait 2 seconds to ensure elements are placed properly by js. # Increase window size and wait 2 seconds to ensure elements are placed properly by js.
And I change window size to "medium" And I change window size to "medium"
And I wait "2" seconds And I wait "2" seconds
@ -64,4 +55,3 @@ Feature: Preview a drag-drop onto image question
And I press "Submit and finish" And I press "Submit and finish"
Then the state of "Identify the features" question is shown as "Correct" Then the state of "Identify the features" question is shown as "Correct"
And I should see "Mark 1.00 out of 1.00" And I should see "Mark 1.00 out of 1.00"
And I switch to the main window

View file

@ -6,21 +6,19 @@ Feature: Test creating a drag and drop markers question
Background: Background:
Given the following "users" exist: Given the following "users" exist:
| username | firstname | lastname | email | | username |
| teacher1 | T1 | Teacher1 | teacher1@moodle.com | | teacher |
And the following "courses" exist: And the following "courses" exist:
| fullname | shortname | category | | fullname | shortname | category |
| Course 1 | C1 | 0 | | Course 1 | C1 | 0 |
And the following "course enrolments" exist: And the following "course enrolments" exist:
| user | course | role | | user | course | role |
| teacher1 | C1 | editingteacher | | teacher | C1 | editingteacher |
And I log in as "teacher1"
And I am on "Course 1" course homepage
And I navigate to "Question bank" in current page administration
@javascript @_file_upload @javascript @_file_upload
Scenario: Create a drag and drop markers question Scenario: Create a drag and drop markers question
When I press "Create a new question ..." When I am on the "Course 1" "core_question > course question bank" page logged in as teacher
And I press "Create a new question ..."
And I set the field "Drag and drop markers" to "1" And I set the field "Drag and drop markers" to "1"
And I click on "Add" "button" in the "Choose a question type to add" "dialogue" And I click on "Add" "button" in the "Choose a question type to add" "dialogue"
And I set the field "Question name" to "Drag and drop markers" And I set the field "Question name" to "Drag and drop markers"

View file

@ -28,6 +28,7 @@ Feature: Test duplicating a quiz containing a drag and drop markers question
| Confirmation | Filename | test_backup.mbz | | Confirmation | Filename | test_backup.mbz |
And I restore "test_backup.mbz" backup into a new course using this options: And I restore "test_backup.mbz" backup into a new course using this options:
| Schema | Course name | Course 2 | | Schema | Course name | Course 2 |
| Schema | Course short name | C2 |
And I navigate to "Question bank" in current page administration And I navigate to "Question bank" in current page administration
And I choose "Edit question" action for "Drag markers" in the question bank And I choose "Edit question" action for "Drag markers" in the question bank
Then the following fields match these values: Then the following fields match these values:

View file

@ -6,27 +6,24 @@ Feature: Test editing a drag and drop markers questions
Background: Background:
Given the following "users" exist: Given the following "users" exist:
| username | firstname | lastname | email | | username |
| teacher1 | T1 | Teacher1 | teacher1@example.com | | teacher |
And the following "courses" exist: And the following "courses" exist:
| fullname | shortname | category | | fullname | shortname | category |
| Course 1 | C1 | 0 | | Course 1 | C1 | 0 |
And the following "course enrolments" exist: And the following "course enrolments" exist:
| user | course | role | | user | course | role |
| teacher1 | C1 | editingteacher | | teacher | C1 | editingteacher |
And the following "question categories" exist: And the following "question categories" exist:
| contextlevel | reference | name | | contextlevel | reference | name |
| Course | C1 | Test questions | | Course | C1 | Test questions |
And the following "questions" exist: And the following "questions" exist:
| questioncategory | qtype | name | template | | questioncategory | qtype | name | template |
| Test questions | ddmarker | Drag markers | mkmap | | Test questions | ddmarker | Drag markers | mkmap |
And I log in as "teacher1"
And I am on "Course 1" course homepage
And I navigate to "Question bank" in current page administration
@javascript @javascript
Scenario: Edit a drag and drop markers question Scenario: Edit a drag and drop markers question
When I choose "Edit question" action for "Drag markers" in the question bank When I am on the "Drag markers" "core_question > edit" page logged in as teacher
And I set the following fields to these values: And I set the following fields to these values:
| Question name | Edited question name | | Question name | Edited question name |
And I press "id_submitbutton" And I press "id_submitbutton"

View file

@ -6,30 +6,27 @@ Feature: Test exporting drag and drop markers questions
Background: Background:
Given the following "users" exist: Given the following "users" exist:
| username | firstname | lastname | email | | username |
| teacher1 | T1 | Teacher1 | teacher1@example.com | | teacher |
And the following "courses" exist: And the following "courses" exist:
| fullname | shortname | category | | fullname | shortname | category |
| Course 1 | C1 | 0 | | Course 1 | C1 | 0 |
And the following "course enrolments" exist: And the following "course enrolments" exist:
| user | course | role | | user | course | role |
| teacher1 | C1 | editingteacher | | teacher | C1 | editingteacher |
And the following "question categories" exist: And the following "question categories" exist:
| contextlevel | reference | name | | contextlevel | reference | name |
| Course | C1 | Test questions | | Course | C1 | Test questions |
And the following "questions" exist: And the following "questions" exist:
| questioncategory | qtype | name | template | | questioncategory | qtype | name | template |
| Test questions | ddmarker | Drag markers | mkmap | | Test questions | ddmarker | Drag markers | mkmap |
And I log in as "teacher1"
And I am on "Course 1" course homepage
@javascript @javascript
Scenario: Export a drag and drop markers question Scenario: Export a drag and drop markers question
# Import sample file. When I am on the "Course 1" "core_question > course question export" page logged in as teacher
When I navigate to "Question bank > Export" in current page administration
And I set the field "id_format_xml" to "1" And I set the field "id_format_xml" to "1"
And I press "Export questions to file" And I press "Export questions to file"
And following "click here" should download between "233700" and "233950" bytes Then following "click here" should download between "233700" and "233950" bytes
# If the download step is the last in the scenario then we can sometimes run # If the download step is the last in the scenario then we can sometimes run
# into the situation where the download page causes a http redirect but behat # into the situation where the download page causes a http redirect but behat
# has already conducted its reset (generating an error). By putting a logout # has already conducted its reset (generating an error). By putting a logout

View file

@ -6,20 +6,18 @@ Feature: Test importing drag and drop markers questions
Background: Background:
Given the following "users" exist: Given the following "users" exist:
| username | firstname | lastname | email | | username |
| teacher1 | T1 | Teacher1 | teacher1@example.com | | teacher |
And the following "courses" exist: And the following "courses" exist:
| fullname | shortname | category | | fullname | shortname | category |
| Course 1 | C1 | 0 | | Course 1 | C1 | 0 |
And the following "course enrolments" exist: And the following "course enrolments" exist:
| user | course | role | | user | course | role |
| teacher1 | C1 | editingteacher | | teacher | C1 | editingteacher |
And I log in as "teacher1"
And I am on "Course 1" course homepage
@javascript @_file_upload @javascript @_file_upload
Scenario: import drag and drop markers question. Scenario: import drag and drop markers 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_xml" to "1" 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 upload "question/type/ddmarker/tests/fixtures/testquestion.moodle.xml" file to "Import" filemanager
And I press "id_submitbutton" And I press "id_submitbutton"

View file

@ -6,33 +6,24 @@ Feature: Preview a drag-drop marker question
Background: Background:
Given the following "users" exist: Given the following "users" exist:
| username | firstname | lastname | email | | username |
| teacher1 | T1 | Teacher1 | teacher1@moodle.com | | teacher |
And the following "courses" exist: And the following "courses" exist:
| fullname | shortname | category | | fullname | shortname | category |
| Course 1 | C1 | 0 | | Course 1 | C1 | 0 |
And the following "course enrolments" exist: And the following "course enrolments" exist:
| user | course | role | | user | course | role |
| teacher1 | C1 | editingteacher | | teacher | C1 | editingteacher |
And the following "question categories" exist: And the following "question categories" exist:
| contextlevel | reference | name | | contextlevel | reference | name |
| Course | C1 | Test questions | | Course | C1 | Test questions |
And the following "questions" exist: And the following "questions" exist:
| questioncategory | qtype | name | template | | questioncategory | qtype | name | template |
| Test questions | ddmarker | Drag markers | mkmap | | Test questions | ddmarker | Drag markers | mkmap |
Given I log in as "teacher1"
And I am on "Course 1" course homepage
And I navigate to "Question bank" in current page administration
@javascript @_bug_phantomjs @javascript @_bug_phantomjs
Scenario: Preview a question using the mouse. Scenario: Preview a question using the mouse
When I choose "Preview" action for "Drag markers" in the question bank When I am on the "Drag markers" "core_question > preview" page logged in as teacher
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.
And I change window size to "large"
And I wait "2" seconds
# Odd, but the <br>s go to nothing, not a space.
And I drag "OU" to "322,213" in the drag and drop markers question And I drag "OU" to "322,213" in the drag and drop markers question
And I drag "Railway station" to "144,84" in the drag and drop markers question And I drag "Railway station" to "144,84" in the drag and drop markers question
And I drag "Railway station" to "195,180" in the drag and drop markers question And I drag "Railway station" to "195,180" in the drag and drop markers question
@ -40,27 +31,19 @@ Feature: Preview a drag-drop marker question
And I press "Submit and finish" And I press "Submit and finish"
Then the state of "Please place the markers on the map of Milton Keynes" question is shown as "Correct" Then the state of "Please place the markers on the map of Milton Keynes" question is shown as "Correct"
And I should see "Mark 1.00 out of 1.00" And I should see "Mark 1.00 out of 1.00"
And I switch to the main window
@javascript @javascript
Scenario: Preview a question using the keyboard. Scenario: Preview a question using the keyboard
When I choose "Preview" action for "Drag markers" in the question bank When I am on the "Drag markers" "core_question > preview" page logged in as teacher
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.
And I change window size to "medium"
And I wait "2" seconds
And I type "up" "88" times on marker "Railway station" in the drag and drop markers question And I type "up" "88" times on marker "Railway station" in the drag and drop markers question
And I type "right" "26" times on marker "Railway station" in the drag and drop markers question And I type "right" "26" times on marker "Railway station" in the drag and drop markers question
And I press "Submit and finish" And I press "Submit and finish"
Then the state of "Please place the markers on the map of Milton Keynes" question is shown as "Partially correct" Then the state of "Please place the markers on the map of Milton Keynes" question is shown as "Partially correct"
And I should see "Mark 0.25 out of 1.00" And I should see "Mark 0.25 out of 1.00"
And I switch to the main window
@javascript @javascript
Scenario: Preview a question in multiple viewports. Scenario: Preview a question in multiple viewports
When I choose "Preview" action for "Drag markers" in the question bank When I am on the "Drag markers" "core_question > preview" page logged in as teacher
And I switch to "questionpreview" window
And I change viewport size to "large" And I change viewport size to "large"
And I drag "OU" to "322,213" in the drag and drop markers question And I drag "OU" to "322,213" in the drag and drop markers question
And I drag "Railway station" to "144,84" in the drag and drop markers question And I drag "Railway station" to "144,84" in the drag and drop markers question

View file

@ -6,21 +6,19 @@ Feature: Test creating a drag and drop into text question
Background: Background:
Given the following "users" exist: Given the following "users" exist:
| username | firstname | lastname | email | | username |
| teacher1 | T1 | Teacher1 | teacher1@moodle.com | | teacher |
And the following "courses" exist: And the following "courses" exist:
| fullname | shortname | category | | fullname | shortname | category |
| Course 1 | C1 | 0 | | Course 1 | C1 | 0 |
And the following "course enrolments" exist: And the following "course enrolments" exist:
| user | course | role | | user | course | role |
| teacher1 | C1 | editingteacher | | teacher | C1 | editingteacher |
And I log in as "teacher1"
And I am on "Course 1" course homepage
And I navigate to "Question bank" in current page administration
@javascript @javascript
Scenario: Create a drag and drop into text question Scenario: Create a drag and drop into text question
When I add a "Drag and drop into text" question filling the form with: When I am on the "Course 1" "core_question > course question bank" page logged in as teacher
And I add a "Drag and drop into text" question filling the form with:
| Question name | Drag and drop into text 001 | | Question name | Drag and drop into text 001 |
| Question text | The [[1]] [[2]] on the [[3]]. | | Question text | The [[1]] [[2]] on the [[3]]. |
| General feedback | The cat sat on the mat. | | General feedback | The cat sat on the mat. |

View file

@ -19,16 +19,16 @@ Feature: Test duplicating a quiz containing a drag and drop into text question
| quiz | Test quiz | C1 | quiz1 | | quiz | Test quiz | C1 | quiz1 |
And quiz "Test quiz" contains the following questions: And quiz "Test quiz" contains the following questions:
| Drag to text | 1 | | Drag to text | 1 |
And I log in as "admin"
And I am on "Course 1" course homepage
@javascript @javascript
Scenario: Backup and restore a course containing a drag and drop into text question Scenario: Backup and restore a course containing a drag and drop into text question
When I backup "Course 1" course using this options: When I am on the "Course 1" course page logged in as admin
And I backup "Course 1" course using this options:
| Confirmation | Filename | test_backup.mbz | | Confirmation | Filename | test_backup.mbz |
And I restore "test_backup.mbz" backup into a new course using this options: And I restore "test_backup.mbz" backup into a new course using this options:
| Schema | Course name | Course 2 | | Schema | Course name | Course 2 |
And I navigate to "Question bank" in current page administration | Schema | Course short name | C2 |
And I am on the "Course 2" "core_question > course question bank" page
And I choose "Edit question" action for "Drag to text" in the question bank And I choose "Edit question" action for "Drag to text" in the question bank
Then the following fields match these values: Then the following fields match these values:
| Question name | Drag to text | | Question name | Drag to text |

View file

@ -6,28 +6,25 @@ Feature: Test editing a drag and drop into text questions
Background: Background:
Given the following "users" exist: Given the following "users" exist:
| username | firstname | lastname | email | | username |
| teacher1 | T1 | Teacher1 | teacher1@example.com | | teacher |
And the following "courses" exist: And the following "courses" exist:
| fullname | shortname | category | | fullname | shortname | category |
| Course 1 | C1 | 0 | | Course 1 | C1 | 0 |
And the following "course enrolments" exist: And the following "course enrolments" exist:
| user | course | role | | user | course | role |
| teacher1 | C1 | editingteacher | | teacher | C1 | editingteacher |
And the following "question categories" exist: And the following "question categories" exist:
| contextlevel | reference | name | | contextlevel | reference | name |
| Course | C1 | Test questions | | Course | C1 | Test questions |
And the following "questions" exist: And the following "questions" exist:
| questioncategory | qtype | name | template | | questioncategory | qtype | name | template |
| Test questions | ddwtos | Drag to text | fox | | Test questions | ddwtos | Drag to text | fox |
And I log in as "teacher1"
And I am on "Course 1" course homepage
And I navigate to "Question bank" in current page administration
@javascript @javascript
Scenario: Edit a drag and drop into text question Scenario: Edit a drag and drop into text question
When I choose "Edit question" action for "Drag to text" in the question bank When I am on the "Drag to text" "core_question > edit" page logged in as teacher
Then I should see "Choice [[1]]" And I should see "Choice [[1]]"
And I should see "Choice [[2]]" And I should see "Choice [[2]]"
And I should see "Choice [[3]]" And I should see "Choice [[3]]"
And I set the following fields to these values: And I set the following fields to these values:

View file

@ -6,27 +6,24 @@ Feature: Test exporting drag and drop into text questions
Background: Background:
Given the following "users" exist: Given the following "users" exist:
| username | firstname | lastname | email | | username |
| teacher1 | T1 | Teacher1 | teacher1@example.com | | teacher |
And the following "courses" exist: And the following "courses" exist:
| fullname | shortname | category | | fullname | shortname | category |
| Course 1 | C1 | 0 | | Course 1 | C1 | 0 |
And the following "course enrolments" exist: And the following "course enrolments" exist:
| user | course | role | | user | course | role |
| teacher1 | C1 | editingteacher | | teacher | C1 | editingteacher |
And the following "question categories" exist: And the following "question categories" exist:
| contextlevel | reference | name | | contextlevel | reference | name |
| Course | C1 | Test questions | | Course | C1 | Test questions |
And the following "questions" exist: And the following "questions" exist:
| questioncategory | qtype | name | template | | questioncategory | qtype | name | template |
| Test questions | ddwtos | Drag to text | fox | | Test questions | ddwtos | Drag to text | fox |
And I log in as "teacher1"
And I am on "Course 1" course homepage
@javascript @javascript
Scenario: Export a drag and drop into text question Scenario: Export a drag and drop into text question
# Import sample file. When I am on the "Course 1" "core_question > course question export" page logged in as teacher
When I navigate to "Question bank > Export" in current page administration
And I set the field "id_format_xml" to "1" And I set the field "id_format_xml" to "1"
And I press "Export questions to file" And I press "Export questions to file"
And following "click here" should download between "1550" and "1700" bytes And following "click here" should download between "1550" and "1700" bytes

View file

@ -6,20 +6,18 @@ Feature: Test importing drag and drop into text questions
Background: Background:
Given the following "users" exist: Given the following "users" exist:
| username | firstname | lastname | email | | username |
| teacher1 | T1 | Teacher1 | teacher1@example.com | | teacher |
And the following "courses" exist: And the following "courses" exist:
| fullname | shortname | category | | fullname | shortname | category |
| Course 1 | C1 | 0 | | Course 1 | C1 | 0 |
And the following "course enrolments" exist: And the following "course enrolments" exist:
| user | course | role | | user | course | role |
| teacher1 | C1 | editingteacher | | teacher | C1 | editingteacher |
And I log in as "teacher1"
And I am on "Course 1" course homepage
@javascript @_file_upload @javascript @_file_upload
Scenario: import drag and drop into text question. Scenario: import drag and drop into text 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_xml" to "1" 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 upload "question/type/ddwtos/tests/fixtures/testquestion.moodle.xml" file to "Import" filemanager
And I press "id_submitbutton" And I press "id_submitbutton"

View file

@ -6,14 +6,14 @@ Feature: Preview a drag-drop into text question
Background: Background:
Given the following "users" exist: Given the following "users" exist:
| username | firstname | lastname | email | | username |
| teacher1 | T1 | Teacher1 | teacher1@moodle.com | | teacher |
And the following "courses" exist: And the following "courses" exist:
| fullname | shortname | category | | fullname | shortname | category |
| Course 1 | C1 | 0 | | Course 1 | C1 | 0 |
And the following "course enrolments" exist: And the following "course enrolments" exist:
| user | course | role | | user | course | role |
| teacher1 | C1 | editingteacher | | teacher | C1 | editingteacher |
And the following "question categories" exist: And the following "question categories" exist:
| contextlevel | reference | name | | contextlevel | reference | name |
| Course | C1 | Test questions | | Course | C1 | Test questions |
@ -21,75 +21,54 @@ Feature: Preview a drag-drop into text question
| questioncategory | qtype | name | template | | questioncategory | qtype | name | template |
| Test questions | ddwtos | Drag to text | fox | | Test questions | ddwtos | Drag to text | fox |
| Test questions | ddwtos | Drag to text infinite | infinite | | Test questions | ddwtos | Drag to text infinite | infinite |
Given I log in as "teacher1"
And I am on "Course 1" course homepage
And I navigate to "Question bank" in current page administration
@javascript @_bug_phantomjs @javascript @_bug_phantomjs
Scenario: Preview a question using the mouse. Scenario: Preview a question using the mouse.
When I choose "Preview" action for "Drag to text" in the question bank When I am on the "Drag to text" "core_question > preview" page logged in as teacher
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.
And I change window size to "medium"
And I wait "2" seconds
And I drag "quick" to space "1" in the drag and drop into text question And I drag "quick" to space "1" in the drag and drop into text question
And I drag "fox" to space "2" in the drag and drop into text question And I drag "fox" to space "2" in the drag and drop into text question
And I drag "assiduous" to space "3" in the drag and drop into text question And I drag "assiduous" to space "3" in the drag and drop into text question
And I press "Submit and finish" And I press "Submit and finish"
Then the state of "The" question is shown as "Partially correct" Then the state of "The" question is shown as "Partially correct"
And I should see "Mark 0.67 out of 1.00" And I should see "Mark 0.67 out of 1.00"
And I switch to the main window
@javascript @javascript
Scenario: Preview a question using the keyboard & submit incomplete. Scenario: Preview a question using the keyboard & submit incomplete.
When I choose "Preview" action for "Drag to text" in the question bank When I am on the "Drag to text" "core_question > preview" page logged in as teacher
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 "1" in the drag and drop onto image question
And I type " " into space "2" in the drag and drop onto image question And I type " " into space "2" in the drag and drop onto image question
And I type " " into space "3" in the drag and drop onto image question And I type " " into space "3" in the drag and drop onto image question
And I press "Save" And I press "Save"
Then the state of "The" question is shown as "Incomplete answer" Then the state of "The" question is shown as "Incomplete answer"
And I should see "Please put an answer in each box." And I should see "Please put an answer in each box."
And I switch to the main window
@javascript @javascript
Scenario: Preview a question using the keyboard. Scenario: Preview a question using the keyboard.
When I choose "Preview" action for "Drag to text" in the question bank When I am on the "Drag to text" "core_question > preview" page logged in as teacher
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 "1" in the drag and drop onto image question
And I type " " into space "2" in the drag and drop onto image question And I type " " into space "2" in the drag and drop onto image question
And I type " " into space "3" in the drag and drop onto image question And I type " " into space "3" in the drag and drop onto image question
And I press "Submit and finish" And I press "Submit and finish"
Then the state of "The" question is shown as "Incorrect" Then the state of "The" question is shown as "Incorrect"
And I should see "Mark 0.00 out of 1.00" And I should see "Mark 0.00 out of 1.00"
And I switch to the main window
@javascript @javascript
Scenario: Preview a question that uses strange group numbers using the keyboard. Scenario: Preview a question that uses strange group numbers using the keyboard.
Given the following "questions" exist: Given the following "questions" exist:
| questioncategory | qtype | name | template | | questioncategory | qtype | name | template |
| Test questions | ddwtos | Funny groups | oddgroups | | Test questions | ddwtos | Funny groups | oddgroups |
And I reload the page When I am on the "Funny groups" "core_question > preview" page logged in as teacher
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 "1" in the drag and drop onto image question
And I type " " into space "2" in the drag and drop onto image question And I type " " into space "2" in the drag and drop onto image question
And I type " " into space "3" in the drag and drop onto image question And I type " " into space "3" in the drag and drop onto image question
And I press "Submit and finish" And I press "Submit and finish"
Then the state of "The" question is shown as "Correct" Then the state of "The" question is shown as "Correct"
And I should see "Mark 1.00 out of 1.00" And I should see "Mark 1.00 out of 1.00"
And I switch to the main window
@javascript @javascript
Scenario: Preview a infinite question. Scenario: Preview a infinite question.
When I choose "Preview" action for "Drag to text infinite" in the question bank When I am on the "Drag to text infinite" "core_question > preview" page logged in as teacher
And I switch to "questionpreview" window
# Increase window size.
# Keep window large else drag will scroll the window to find element.
And I change window size to "medium"
And I press "Fill in correct responses" And I press "Fill in correct responses"
Then I should see "Option1" in the home area of drag and drop into text question Then I should see "Option1" in the home area of drag and drop into text question
And I should see "Option2" in the home area of drag and drop into text question And I should see "Option2" in the home area of drag and drop into text question
And I should see "Option3" in the home area of drag and drop into text question And I should see "Option3" in the home area of drag and drop into text question
And I switch to the main window

View file

@ -6,20 +6,18 @@ Feature: Test creating a Description question
Background: Background:
Given the following "users" exist: Given the following "users" exist:
| username | firstname | lastname | email | | username |
| teacher1 | T1 | Teacher1 | teacher1@moodle.com | | teacher |
And the following "courses" exist: And the following "courses" exist:
| fullname | shortname | category | | fullname | shortname | category |
| Course 1 | C1 | 0 | | Course 1 | C1 | 0 |
And the following "course enrolments" exist: And the following "course enrolments" exist:
| user | course | role | | user | course | role |
| teacher1 | C1 | editingteacher | | teacher | C1 | editingteacher |
And I log in as "teacher1"
And I am on "Course 1" course homepage
And I navigate to "Question bank" in current page administration
Scenario: Create a Description question with Correct answer as False Scenario: Create a Description question with Correct answer as False
When I add a "Description" question filling the form with: When I am on the "Course 1" "core_question > course question bank" page logged in as teacher
And I add a "Description" question filling the form with:
| Question name | description-001 | | Question name | description-001 |
| Question text | Instructions about the following questions. | | Question text | Instructions about the following questions. |
| General feedback | Why actually the field 'General feedback' used in this qytype? | | General feedback | Why actually the field 'General feedback' used in this qytype? |

View file

@ -19,16 +19,16 @@ Feature: Test duplicating a quiz containing a Description question
| quiz | Test quiz | C1 | quiz1 | | quiz | Test quiz | C1 | quiz1 |
And quiz "Test quiz" contains the following questions: And quiz "Test quiz" contains the following questions:
| description-001 | 1 | | description-001 | 1 |
And I log in as "admin"
And I am on "Course 1" course homepage
@javascript @javascript
Scenario: Backup and restore a course containing a Description question Scenario: Backup and restore a course containing a Description question
When I backup "Course 1" course using this options: When I am on the "Course 1" course page logged in as admin
And I backup "Course 1" course using this options:
| Confirmation | Filename | test_backup.mbz | | Confirmation | Filename | test_backup.mbz |
And I restore "test_backup.mbz" backup into a new course using this options: And I restore "test_backup.mbz" backup into a new course using this options:
| Schema | Course name | Course 2 | | Schema | Course name | Course 2 |
And I navigate to "Question bank" in current page administration | Schema | Course short name | C2 |
And I am on the "Course 2" "core_question > course question bank" page
And I choose "Edit question" action for "description-001" in the question bank And I choose "Edit question" action for "description-001" in the question bank
Then the following fields match these values: Then the following fields match these values:
| Question name | description-001 | | Question name | description-001 |

View file

@ -6,26 +6,23 @@ Feature: Test editing a Description question
Background: Background:
Given the following "users" exist: Given the following "users" exist:
| username | firstname | lastname | email | | username |
| teacher1 | T1 | Teacher1 | teacher1@example.com | | teacher |
And the following "courses" exist: And the following "courses" exist:
| fullname | shortname | category | | fullname | shortname | category |
| Course 1 | C1 | 0 | | Course 1 | C1 | 0 |
And the following "course enrolments" exist: And the following "course enrolments" exist:
| user | course | role | | user | course | role |
| teacher1 | C1 | editingteacher | | teacher | C1 | editingteacher |
And the following "question categories" exist: And the following "question categories" exist:
| contextlevel | reference | name | | contextlevel | reference | name |
| Course | C1 | Test questions | | Course | C1 | Test questions |
And the following "questions" exist: And the following "questions" exist:
| questioncategory | qtype | name | template | | questioncategory | qtype | name | template |
| Test questions | description | description-001 | info | | Test questions | description | description-001 | info |
And I log in as "teacher1"
And I am on "Course 1" course homepage
And I navigate to "Question bank" in current page administration
Scenario: Edit a Description question Scenario: Edit a Description question
When I choose "Edit question" action for "description-001" in the question bank When I am on the "description-001" "core_question > edit" page logged in as teacher
And I set the following fields to these values: And I set the following fields to these values:
| Question name | | | Question name | |
And I press "id_submitbutton" And I press "id_submitbutton"

View file

@ -6,25 +6,23 @@ Feature: Test exporting Description questions
Background: Background:
Given the following "users" exist: Given the following "users" exist:
| username | firstname | lastname | email | | username |
| teacher1 | T1 | Teacher1 | teacher1@example.com | | teacher |
And the following "courses" exist: And the following "courses" exist:
| fullname | shortname | category | | fullname | shortname | category |
| Course 1 | C1 | 0 | | Course 1 | C1 | 0 |
And the following "course enrolments" exist: And the following "course enrolments" exist:
| user | course | role | | user | course | role |
| teacher1 | C1 | editingteacher | | teacher | C1 | editingteacher |
And the following "question categories" exist: And the following "question categories" exist:
| contextlevel | reference | name | | contextlevel | reference | name |
| Course | C1 | Test questions | | Course | C1 | Test questions |
And the following "questions" exist: And the following "questions" exist:
| questioncategory | qtype | name | template | | questioncategory | qtype | name | template |
| Test questions | description | description-001 | info | | Test questions | description | description-001 | info |
And I log in as "teacher1"
And I am on "Course 1" course homepage
Scenario: Export a Description question Scenario: Export a Description question
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 teacher
And I set the field "id_format_xml" to "1" And I set the field "id_format_xml" to "1"
And I press "Export questions to file" And I press "Export questions to file"
Then following "click here" should download between "650" and "900" bytes Then following "click here" should download between "650" and "900" bytes

View file

@ -6,20 +6,18 @@ Feature: Test importing Description questions
Background: Background:
Given the following "users" exist: Given the following "users" exist:
| username | firstname | lastname | email | | username |
| teacher1 | T1 | Teacher1 | teacher1@example.com | | teacher |
And the following "courses" exist: And the following "courses" exist:
| fullname | shortname | category | | fullname | shortname | category |
| Course 1 | C1 | 0 | | Course 1 | C1 | 0 |
And the following "course enrolments" exist: And the following "course enrolments" exist:
| user | course | role | | user | course | role |
| teacher1 | C1 | editingteacher | | teacher | C1 | editingteacher |
And I log in as "teacher1"
And I am on "Course 1" course homepage
@javascript @_file_upload @javascript @_file_upload
Scenario: import a Description question. Scenario: import a Description 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_xml" to "1" 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 upload "question/type/description/tests/fixtures/testquestion.moodle.xml" file to "Import" filemanager
And I press "id_submitbutton" And I press "id_submitbutton"

View file

@ -6,29 +6,25 @@ Feature: Preview a Description question
Background: Background:
Given the following "users" exist: Given the following "users" exist:
| username | firstname | lastname | email | | username |
| teacher1 | T1 | Teacher1 | teacher1@moodle.com | | teacher |
And the following "courses" exist: And the following "courses" exist:
| fullname | shortname | category | | fullname | shortname | category |
| Course 1 | C1 | 0 | | Course 1 | C1 | 0 |
And the following "course enrolments" exist: And the following "course enrolments" exist:
| user | course | role | | user | course | role |
| teacher1 | C1 | editingteacher | | teacher | C1 | editingteacher |
And the following "question categories" exist: And the following "question categories" exist:
| contextlevel | reference | name | | contextlevel | reference | name |
| Course | C1 | Test questions | | Course | C1 | Test questions |
And the following "questions" exist: And the following "questions" exist:
| questioncategory | qtype | name | template | | questioncategory | qtype | name | template |
| Test questions | description | description-001 | info | | Test questions | description | description-001 | info |
Given I log in as "teacher1"
And I am on "Course 1" course homepage
And I navigate to "Question bank" in current page administration
@javascript @_switch_window @javascript @_switch_window
Scenario: Preview a Description question and submit a correct response. Scenario: Preview a Description question and submit a correct response.
When I choose "Preview" action for "description-001" in the question bank When I am on the "description-001" "core_question > preview" page logged in as teacher
And I switch to "questionpreview" window And I expand all fieldsets
And I set the field "How questions behave" to "Immediate feedback" And I set the field "How questions behave" to "Immediate feedback"
And I press "Start again with these options" And I press "Start again with these options"
And I should see "Here is some information about the questions you are about to attempt." And I should see "Here is some information about the questions you are about to attempt."
And I switch to the main window

View file

@ -6,20 +6,18 @@ Feature: Test creating an Essay question
Background: Background:
Given the following "users" exist: Given the following "users" exist:
| username | firstname | lastname | email | | username |
| teacher1 | T1 | Teacher1 | teacher1@moodle.com | | teacher |
And the following "courses" exist: And the following "courses" exist:
| fullname | shortname | category | | fullname | shortname | category |
| Course 1 | C1 | 0 | | Course 1 | C1 | 0 |
And the following "course enrolments" exist: And the following "course enrolments" exist:
| user | course | role | | user | course | role |
| teacher1 | C1 | editingteacher | | teacher | C1 | editingteacher |
And I log in as "teacher1"
And I am on "Course 1" course homepage
And I navigate to "Question bank" in current page administration
Scenario: Create an Essay question with Response format set to 'HTML editor' Scenario: Create an Essay question with Response format set to 'HTML editor'
When I add a "Essay" question filling the form with: When I am on the "Course 1" "core_question > course question bank" page logged in as teacher
And I add a "Essay" question filling the form with:
| Question name | essay-001 | | Question name | essay-001 |
| Question text | Write an essay with 500 words. | | Question text | Write an essay with 500 words. |
| General feedback | This is general feedback | | General feedback | This is general feedback |
@ -27,7 +25,8 @@ Feature: Test creating an Essay question
Then I should see "essay-001" Then I should see "essay-001"
Scenario: Create an Essay question with Response format set to 'HTML editor with the file picker' Scenario: Create an Essay question with Response format set to 'HTML editor with the file picker'
When I add a "Essay" question filling the form with: When I am on the "Course 1" "core_question > course question bank" page logged in as teacher
And I add a "Essay" question filling the form with:
| Question name | essay-002 | | Question name | essay-002 |
| Question text | Write an essay with 500 words. | | Question text | Write an essay with 500 words. |
| General feedback | This is general feedback | | General feedback | This is general feedback |

View file

@ -23,17 +23,17 @@ Feature: Test duplicating a quiz containing an Assay question
| essay-001 | 1 | | essay-001 | 1 |
| essay-002 | 1 | | essay-002 | 1 |
| essay-003 | 1 | | essay-003 | 1 |
And I log in as "admin"
And I am on "Course 1" course homepage
@javascript @javascript
Scenario: Backup and restore a course containing 3 Essay questions Scenario: Backup and restore a course containing 3 Essay questions
When I backup "Course 1" course using this options: When I am on the "Course 1" course page logged in as admin
And I backup "Course 1" course using this options:
| Confirmation | Filename | test_backup.mbz | | Confirmation | Filename | test_backup.mbz |
And I restore "test_backup.mbz" backup into a new course using this options: And I restore "test_backup.mbz" backup into a new course using this options:
| Schema | Course name | Course 2 | | Schema | Course name | Course 2 |
And I navigate to "Question bank" in current page administration | Schema | Course short name | C2 |
And I should see "essay-001" And I am on the "Course 2" "core_question > course question bank" page
Then I should see "essay-001"
And I should see "essay-002" And I should see "essay-002"
And I should see "essay-003" And I should see "essay-003"
And I choose "Edit question" action for "essay-001" in the question bank And I choose "Edit question" action for "essay-001" in the question bank

View file

@ -6,14 +6,14 @@ Feature: Test editing an Essay question
Background: Background:
Given the following "users" exist: Given the following "users" exist:
| username | firstname | lastname | email | | username |
| teacher1 | T1 | Teacher1 | teacher1@example.com | | teacher |
And the following "courses" exist: And the following "courses" exist:
| fullname | shortname | category | | fullname | shortname | category |
| Course 1 | C1 | 0 | | Course 1 | C1 | 0 |
And the following "course enrolments" exist: And the following "course enrolments" exist:
| user | course | role | | user | course | role |
| teacher1 | C1 | editingteacher | | teacher | C1 | editingteacher |
And the following "question categories" exist: And the following "question categories" exist:
| contextlevel | reference | name | | contextlevel | reference | name |
| Course | C1 | Test questions | | Course | C1 | Test questions |
@ -22,22 +22,20 @@ Feature: Test editing an Essay question
| Test questions | essay | essay-001 | editor | | Test questions | essay | essay-001 | editor |
| Test questions | essay | essay-002 | editorfilepicker | | Test questions | essay | essay-002 | editorfilepicker |
| Test questions | essay | essay-003 | plain | | Test questions | essay | essay-003 | plain |
And I log in as "teacher1"
And I am on "Course 1" course homepage
And I navigate to "Question bank" in current page administration
Scenario: Edit an Essay question Scenario: Edit an Essay question
When I choose "Edit question" action for "essay-001" in the question bank When I am on the "Course 1" "core_question > course question bank" page logged in as teacher
And I choose "Edit question" action for "essay-001" in the question bank
And I set the following fields to these values: And I set the following fields to these values:
| Question name | | | Question name | |
And I press "id_submitbutton" And I press "id_submitbutton"
Then I should see "You must supply a value here." And I should see "You must supply a value here."
When I set the following fields to these values: And I set the following fields to these values:
| Question name | Edited essay-001 name | | Question name | Edited essay-001 name |
| Response format | No online text | | Response format | No online text |
And I press "id_submitbutton" And I press "id_submitbutton"
Then I should see "When \"No online text\" is selected, or responses are optional, you must allow at least one attachment." And I should see "When \"No online text\" is selected, or responses are optional, you must allow at least one attachment."
When I set the following fields to these values: And I set the following fields to these values:
| Response format | Plain text | | Response format | Plain text |
And I press "id_submitbutton" And I press "id_submitbutton"
Then I should see "Edited essay-001 name" Then I should see "Edited essay-001 name"

View file

@ -6,14 +6,14 @@ Feature: Test exporting Essay questions
Background: Background:
Given the following "users" exist: Given the following "users" exist:
| username | firstname | lastname | email | | username |
| teacher1 | T1 | Teacher1 | teacher1@example.com | | teacher |
And the following "courses" exist: And the following "courses" exist:
| fullname | shortname | category | | fullname | shortname | category |
| Course 1 | C1 | 0 | | Course 1 | C1 | 0 |
And the following "course enrolments" exist: And the following "course enrolments" exist:
| user | course | role | | user | course | role |
| teacher1 | C1 | editingteacher | | teacher | C1 | editingteacher |
And the following "question categories" exist: And the following "question categories" exist:
| contextlevel | reference | name | | contextlevel | reference | name |
| Course | C1 | Test questions | | Course | C1 | Test questions |
@ -22,11 +22,9 @@ Feature: Test exporting Essay questions
| Test questions | essay | essay-001 | editor | | Test questions | essay | essay-001 | editor |
| Test questions | essay | essay-002 | editorfilepicker | | Test questions | essay | essay-002 | editorfilepicker |
| Test questions | essay | essay-003 | plain | | Test questions | essay | essay-003 | plain |
And I log in as "teacher1"
And I am on "Course 1" course homepage
Scenario: Export 3 Essay questions Scenario: Export 3 Essay questions
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 teacher
And I set the field "id_format_xml" to "1" And I set the field "id_format_xml" to "1"
And I press "Export questions to file" And I press "Export questions to file"
Then following "click here" should download between "2750" and "3250" bytes Then following "click here" should download between "2750" and "3250" bytes

View file

@ -6,16 +6,16 @@ I need to limit the submittable file types
Background: Background:
Given the following "users" exist: Given the following "users" exist:
| username | firstname | lastname | email | | username |
| teacher1 | Teacher | 1 | teacher1@example.com | | teacher |
| student1 | Student | 1 | student0@example.com | | student |
And the following "courses" exist: And the following "courses" exist:
| fullname | shortname | category | | fullname | shortname | category |
| Course 1 | C1 | 0 | | Course 1 | C1 | 0 |
And the following "course enrolments" exist: And the following "course enrolments" exist:
| user | course | role | | user | course | role |
| teacher1 | C1 | editingteacher | | teacher | C1 | editingteacher |
| student1 | C1 | student | | student | C1 | student |
And the following "question categories" exist: And the following "question categories" exist:
| contextlevel | reference | name | | contextlevel | reference | name |
| Course | C1 | Test questions | | Course | C1 | Test questions |
@ -28,18 +28,19 @@ I need to limit the submittable file types
And quiz "Quiz 1" contains the following questions: And quiz "Quiz 1" contains the following questions:
| question | page | | question | page |
| TF1 | 1 | | TF1 | 1 |
Given I am on the "Quiz 1" "mod_quiz > edit" page logged in as teacher1 Given I am on the "Quiz 1" "mod_quiz > edit" page logged in as teacher
And I click on "Edit question TF1" "link" And I click on "Edit question TF1" "link"
And I set the field "Allow attachments" to "1" And I set the field "Allow attachments" to "1"
And I set the field "Response format" to "No online text" And I set the field "Response format" to "No online text"
And I set the field "Require attachments" to "1" And I set the field "Require attachments" to "1"
And I set the field "filetypeslist[filetypes]" to ".txt" And I set the field "filetypeslist[filetypes]" to ".txt"
And I press "Save changes" And I press "Save changes"
And I am on the "Quiz 1" "mod_quiz > edit" page
Then I log out Then I log out
@javascript @_file_upload @javascript @_file_upload
Scenario: Preview an Essay question and submit a response with a correct filetype. Scenario: Preview an Essay question and submit a response with a correct filetype.
When I log in as "student1" When I log in as "student"
And I follow "Manage private files" And I follow "Manage private files"
And I upload "lib/tests/fixtures/empty.txt" file to "Files" filemanager And I upload "lib/tests/fixtures/empty.txt" file to "Files" filemanager
And I press "Save changes" And I press "Save changes"
@ -57,7 +58,7 @@ I need to limit the submittable file types
@javascript @_file_upload @javascript @_file_upload
Scenario: Preview an Essay question and try to submit a response with an incorrect filetype. Scenario: Preview an Essay question and try to submit a response with an incorrect filetype.
When I log in as "student1" When I log in as "student"
And I follow "Manage private files" And I follow "Manage private files"
And I upload "lib/tests/fixtures/upload_users.csv" file to "Files" filemanager And I upload "lib/tests/fixtures/upload_users.csv" file to "Files" filemanager
And I press "Save changes" And I press "Save changes"

View file

@ -6,20 +6,18 @@ Feature: Test importing Essay questions
Background: Background:
Given the following "users" exist: Given the following "users" exist:
| username | firstname | lastname | email | | username |
| teacher1 | T1 | Teacher1 | teacher1@example.com | | teacher |
And the following "courses" exist: And the following "courses" exist:
| fullname | shortname | category | | fullname | shortname | category |
| Course 1 | C1 | 0 | | Course 1 | C1 | 0 |
And the following "course enrolments" exist: And the following "course enrolments" exist:
| user | course | role | | user | course | role |
| teacher1 | C1 | editingteacher | | teacher | C1 | editingteacher |
And I log in as "teacher1"
And I am on "Course 1" course homepage
@javascript @_file_upload @javascript @_file_upload
Scenario: import Essay question. Scenario: import Essay 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_xml" to "1" 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 upload "question/type/essay/tests/fixtures/testquestion.moodle.xml" file to "Import" filemanager
And I press "id_submitbutton" And I press "id_submitbutton"

View file

@ -3,16 +3,17 @@ Feature: In an essay question, let the question author choose the maxbytes for a
In order to constrain student submissions for marking In order to constrain student submissions for marking
As a teacher As a teacher
I need to choose the appropriate maxbytes for attachments I need to choose the appropriate maxbytes for attachments
Background: Background:
Given the following "users" exist: Given the following "users" exist:
| username | firstname | lastname | email | | username |
| teacher1 | T1 | Teacher1 | teacher1@moodle.com | | teacher |
And the following "courses" exist: And the following "courses" exist:
| fullname | shortname | category | maxbytes | | fullname | shortname | category | maxbytes |
| Course 1 | C1 | 0 | 1048576 | | Course 1 | C1 | 0 | 1048576 |
And the following "course enrolments" exist: And the following "course enrolments" exist:
| user | course | role | | user | course | role |
| teacher1 | C1 | editingteacher | | teacher | C1 | editingteacher |
And the following "question categories" exist: And the following "question categories" exist:
| contextlevel | reference | name | | contextlevel | reference | name |
| Course | C1 | Test questions | | Course | C1 | Test questions |
@ -20,22 +21,15 @@ I need to choose the appropriate maxbytes for attachments
| questioncategory | qtype | name | template | attachments | maxbytes | | questioncategory | qtype | name | template | attachments | maxbytes |
| Test questions | essay | essay-1-512KB | editor | 1 | 524288 | | Test questions | essay | essay-1-512KB | editor | 1 | 524288 |
| Test questions | essay | essay-1-max | editor | 1 | 0 | | Test questions | essay | essay-1-max | editor | 1 | 0 |
And I log in as "teacher1"
And I am on "Course 1" course homepage
And I navigate to "Question bank" in current page administration
@javascript @_switch_window @javascript @_switch_window
Scenario: Preview an Essay question and see the allowed maximum file sizes and number of attachments. Scenario: Preview an Essay question and see the allowed maximum file sizes and number of attachments.
When I choose "Preview" action for "essay-1-512KB" in the question bank When I am on the "essay-1-512KB" "core_question > preview" page logged in as teacher
And I switch to "questionpreview" window
Then I should see "Please write a story about a frog." Then I should see "Please write a story about a frog."
And I should see "Maximum file size: 512KB, maximum number of files: 1" And I should see "Maximum file size: 512KB, maximum number of files: 1"
And I switch to the main window
@javascript @_switch_window @javascript @_switch_window
Scenario: Preview an Essay question with Course upload limit and see the allowed maximum file size. Scenario: Preview an Essay question with Course upload limit and see the allowed maximum file size.
When I choose "Preview" action for "essay-1-max" in the question bank When I am on the "essay-1-max" "core_question > preview" page logged in as teacher
And I switch to "questionpreview" window
Then I should see "Please write a story about a frog." Then I should see "Please write a story about a frog."
And I should see "Maximum file size: 1MB, maximum number of files: 1" And I should see "Maximum file size: 1MB, maximum number of files: 1"
And I switch to the main window

View file

@ -6,14 +6,14 @@ Feature: Preview Essay questions
Background: Background:
Given the following "users" exist: Given the following "users" exist:
| username | firstname | lastname | email | | username |
| teacher1 | T1 | Teacher1 | teacher1@moodle.com | | teacher |
And the following "courses" exist: And the following "courses" exist:
| fullname | shortname | category | | fullname | shortname | category |
| Course 1 | C1 | 0 | | Course 1 | C1 | 0 |
And the following "course enrolments" exist: And the following "course enrolments" exist:
| user | course | role | | user | course | role |
| teacher1 | C1 | editingteacher | | teacher | C1 | editingteacher |
And the following "question categories" exist: And the following "question categories" exist:
| contextlevel | reference | name | | contextlevel | reference | name |
| Course | C1 | Test questions | | Course | C1 | Test questions |
@ -22,34 +22,28 @@ Feature: Preview Essay questions
| Test questions | essay | essay-001 | editor | | Test questions | essay | essay-001 | editor |
| Test questions | essay | essay-002 | editorfilepicker | | Test questions | essay | essay-002 | editorfilepicker |
| Test questions | essay | essay-003 | plain | | Test questions | essay | essay-003 | plain |
Given I log in as "teacher1"
And I am on "Course 1" course homepage
And I navigate to "Question bank" in current page administration
@javascript @_switch_window @javascript @_switch_window
Scenario: Preview an Essay question and submit a partially correct response. Scenario: Preview an Essay question that uses the HTML editor.
When I choose "Preview" action for "essay-001" in the question bank When I am on the "essay-001" "core_question > preview" page logged in as teacher
And I switch to "questionpreview" window And I expand all fieldsets
And I set the field "How questions behave" to "Immediate feedback" And I set the field "How questions behave" to "Immediate feedback"
And I press "Start again with these options" And I press "Start again with these options"
And I should see "Please write a story about a frog." And I should see "Please write a story about a frog."
And I switch to the main window
@javascript @_switch_window @javascript @_switch_window
Scenario: Preview an Essay question and submit a partially correct response. Scenario: Preview an Essay question that uses the HTML editor with embedded files.
When I choose "Preview" action for "essay-002" in the question bank When I am on the "essay-002" "core_question > preview" page logged in as teacher
And I switch to "questionpreview" window And I expand all fieldsets
And I set the field "How questions behave" to "Immediate feedback" And I set the field "How questions behave" to "Immediate feedback"
And I press "Start again with these options" And I press "Start again with these options"
And I should see "Please write a story about a frog." And I should see "Please write a story about a frog."
And I should see "You can drag and drop files here to add them." And I should see "You can drag and drop files here to add them."
And I switch to the main window
@javascript @_switch_window @javascript @_switch_window
Scenario: Preview an Essay question and submit a partially correct response. Scenario: Preview an Essay question that uses a plain text area.
When I choose "Preview" action for "essay-003" in the question bank When I am on the "essay-003" "core_question > preview" page logged in as teacher
And I switch to "questionpreview" window And I expand all fieldsets
And I set the field "How questions behave" to "Immediate feedback" And I set the field "How questions behave" to "Immediate feedback"
And I press "Start again with these options" And I press "Start again with these options"
And I should see "Please write a story about a frog." And I should see "Please write a story about a frog."
And I switch to the main window

View file

@ -5,20 +5,18 @@ Feature: Test all the basic functionality of this question type
Background: Background:
Given the following "users" exist: Given the following "users" exist:
| username | firstname | lastname | email | | username |
| teacher1 | T1 | Teacher1 | teacher1@moodle.com | | teacher |
And the following "courses" exist: And the following "courses" exist:
| fullname | shortname | category | | fullname | shortname | category |
| Course 1 | C1 | 0 | | Course 1 | C1 | 0 |
And the following "course enrolments" exist: And the following "course enrolments" exist:
| user | course | role | | user | course | role |
| teacher1 | C1 | editingteacher | | teacher | C1 | editingteacher |
@javascript @javascript
Scenario: Create, edit then preview a gapselect question. Scenario: Create, edit then preview a gapselect question.
Given I log in as "teacher1" When I am on the "Course 1" "core_question > course question bank" page logged in as teacher
And I am on "Course 1" course homepage
And I navigate to "Question bank" in current page administration
# Create a new question. # Create a new question.
And I add a "Select missing words" question filling the form with: And I add a "Select missing words" question filling the form with:
@ -38,7 +36,7 @@ Feature: Test all the basic functionality of this question type
Then I should see "Select missing words 001" Then I should see "Select missing words 001"
# Preview it. # Preview it.
When I choose "Preview" action for "Select missing words 001" in the question bank And I choose "Preview" action for "Select missing words 001" in the question bank
And I switch to "questionpreview" window And I switch to "questionpreview" window
# Gaps (drop-down menus) do not have labels. ids and names are generated # Gaps (drop-down menus) do not have labels. ids and names are generated
@ -60,7 +58,7 @@ Feature: Test all the basic functionality of this question type
And I set space "2" to "sat" in the select missing words question And I set space "2" to "sat" in the select missing words question
And I set space "3" to "mat" in the select missing words question And I set space "3" to "mat" in the select missing words question
And I press "Check" And I press "Check"
Then I should see "Your answer is correct" And I should see "Your answer is correct"
And I should see "The cat sat on the mat" And I should see "The cat sat on the mat"
And I should see "The correct answer is: The [cat] [sat] on the [mat]." And I should see "The correct answer is: The [cat] [sat] on the [mat]."
And I press "Start again" And I press "Start again"
@ -70,19 +68,19 @@ Feature: Test all the basic functionality of this question type
And I set space "2" to "sat" in the select missing words question And I set space "2" to "sat" in the select missing words question
And I set space "3" to "dog" in the select missing words question And I set space "3" to "dog" in the select missing words question
And I press "Check" And I press "Check"
Then I should see "Your answer is partially correct" And I should see "Your answer is partially correct"
And I should see "First hint" And I should see "First hint"
When I press "Try again" And I press "Try again"
And I set space "3" to "table" in the select missing words question And I set space "3" to "table" in the select missing words question
And I press "Check" And I press "Check"
Then I should see "Your answer is partially correct" And I should see "Your answer is partially correct"
And I should see "Second hint" And I should see "Second hint"
When I press "Try again" And I press "Try again"
And I set space "3" to "mat" in the select missing words question And I set space "3" to "mat" in the select missing words question
And I press "Check" And I press "Check"
Then I should see "Your answer is correct" And I should see "Your answer is correct"
And I should see "The cat sat on the mat" And I should see "The cat sat on the mat"
And I should see "The correct answer is: The [cat] [sat] on the [mat]." And I should see "The correct answer is: The [cat] [sat] on the [mat]."
@ -92,8 +90,8 @@ Feature: Test all the basic functionality of this question type
And I press "Start again with these options" And I press "Start again with these options"
# Answer question correctly # Answer question correctly
When I press "Check" And I press "Check"
Then I should see "Please put an answer in each box." And I should see "Please put an answer in each box."
And I set space "1" to "cat" in the select missing words question And I set space "1" to "cat" in the select missing words question
And I set space "2" to "sat" in the select missing words question And I set space "2" to "sat" in the select missing words question
And I set space "3" to "mat" in the select missing words question And I set space "3" to "mat" in the select missing words question
@ -108,7 +106,7 @@ Feature: Test all the basic functionality of this question type
And I set space "2" to "sat" in the select missing words question And I set space "2" to "sat" in the select missing words question
And I set space "3" to "cat" in the select missing words question And I set space "3" to "cat" in the select missing words question
And I press "Check" And I press "Check"
Then I should see "Your answer is partially correct" And I should see "Your answer is partially correct"
And I should see "You have correctly selected 1." And I should see "You have correctly selected 1."
And I should see "The cat sat on the mat" And I should see "The cat sat on the mat"
And I should see "The correct answer is: The [cat] [sat] on the [mat]." And I should see "The correct answer is: The [cat] [sat] on the [mat]."
@ -119,25 +117,25 @@ Feature: Test all the basic functionality of this question type
And I set space "2" to "ran" in the select missing words question And I set space "2" to "ran" in the select missing words question
And I set space "3" to "table" in the select missing words question And I set space "3" to "table" in the select missing words question
And I press "Check" And I press "Check"
Then I should see "Your answer is incorrect" And I should see "Your answer is incorrect"
And I should see "The cat sat on the mat" And I should see "The cat sat on the mat"
And I should see "The correct answer is: The [cat] [sat] on the [mat]." And I should see "The correct answer is: The [cat] [sat] on the [mat]."
And I switch to the main window And I switch to the main window
# Backup the course and restore it. # Backup the course and restore it.
When I log out And I log out
And I log in as "admin" And I log in as "admin"
When I backup "Course 1" course using this options: And I backup "Course 1" course using this options:
| Confirmation | Filename | test_backup.mbz | | Confirmation | Filename | test_backup.mbz |
When I restore "test_backup.mbz" backup into a new course using this options: And I restore "test_backup.mbz" backup into a new course using this options:
| Schema | Course name | Course 2 | | Schema | Course name | Course 2 |
Then I should see "Course 2" And I should see "Course 2"
When I navigate to "Question bank" in current page administration And I navigate to "Question bank" in current page administration
Then I should see "Select missing words 001" And I should see "Select missing words 001"
# Edit the copy and verify the form field contents. # Edit the copy and verify the form field contents.
When I choose "Edit question" action for "Select missing words 001" in the question bank And I choose "Edit question" action for "Select missing words 001" in the question bank
Then the following fields match these values: And the following fields match these values:
| Question name | Select missing words 001 | | Question name | Select missing words 001 |
| Question text | The [[1]] [[2]] on the [[3]]. | | Question text | The [[1]] [[2]] on the [[3]]. |
| General feedback | The cat sat on the mat. | | General feedback | The cat sat on the mat. |
@ -154,4 +152,4 @@ Feature: Test all the basic functionality of this question type
And I set the following fields to these values: And I set the following fields to these values:
| Question name | Edited question name | | Question name | Edited question name |
And I press "id_submitbutton" And I press "id_submitbutton"
Then I should see "Edited question name" And I should see "Edited question name"

View file

@ -6,21 +6,19 @@ Feature: Import and export select missing words questions
Background: Background:
Given the following "users" exist: Given the following "users" exist:
| username | firstname | lastname | email | | username |
| teacher1 | T1 | Teacher1 | teacher1@moodle.com | | teacher |
And the following "courses" exist: And the following "courses" exist:
| fullname | shortname | category | | fullname | shortname | category |
| Course 1 | C1 | 0 | | Course 1 | C1 | 0 |
And the following "course enrolments" exist: And the following "course enrolments" exist:
| user | course | role | | user | course | role |
| teacher1 | C1 | editingteacher | | teacher | C1 | editingteacher |
And I log in as "teacher1"
And I am on "Course 1" course homepage
@javascript @_file_upload @javascript @_file_upload
Scenario: Import and export select missing words questions Scenario: Import and export select missing words questions
# Import sample file. # Import sample file.
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 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 upload "question/type/gapselect/tests/fixtures/testquestion.moodle.xml" file to "Import" filemanager
And I press "id_submitbutton" And I press "id_submitbutton"
@ -31,10 +29,10 @@ Feature: Import and export select missing words questions
And I should see "Imported Select missing words 001" And I should see "Imported Select missing words 001"
# Now export again. # Now export again.
When I follow "Export" And I am on the "Course 1" "core_question > course question export" page logged in as teacher
And I set the field "id_format_xml" to "1" And I set the field "id_format_xml" to "1"
And I press "Export questions to file" And I press "Export questions to file"
Then following "click here" should download between "1650" and "1800" bytes And following "click here" should download between "1650" and "1800" bytes
# If the download step is the last in the scenario then we can sometimes run # If the download step is the last in the scenario then we can sometimes run
# into the situation where the download page causes a http redirect but behat # into the situation where the download page causes a http redirect but behat
# has already conducted its reset (generating an error). By putting a logout # has already conducted its reset (generating an error). By putting a logout

View file

@ -6,20 +6,18 @@ Feature: Test creating a Matching question
Background: Background:
Given the following "users" exist: Given the following "users" exist:
| username | firstname | lastname | email | | username |
| teacher1 | T1 | Teacher1 | teacher1@moodle.com | | teacher |
And the following "courses" exist: And the following "courses" exist:
| fullname | shortname | category | | fullname | shortname | category |
| Course 1 | C1 | 0 | | Course 1 | C1 | 0 |
And the following "course enrolments" exist: And the following "course enrolments" exist:
| user | course | role | | user | course | role |
| teacher1 | C1 | editingteacher | | teacher | C1 | editingteacher |
And I log in as "teacher1"
And I am on "Course 1" course homepage
And I navigate to "Question bank" in current page administration
Scenario: Create a Matching question with 3 subquestions Scenario: Create a Matching question with 3 subquestions
When I add a "Matching" question filling the form with: When I am on the "Course 1" "core_question > course question bank" page logged in as teacher
And I add a "Matching" question filling the form with:
| Question name | match-001 | | Question name | match-001 |
| Question text | Match the country with the capital city. | | Question text | Match the country with the capital city. |
| General feedback | England=London, France=Paris and Spain=Madrid. | | General feedback | England=London, France=Paris and Spain=Madrid. |

View file

@ -19,16 +19,16 @@ Feature: Test duplicating a quiz containing a Matching question
| quiz | Test quiz | C1 | quiz1 | | quiz | Test quiz | C1 | quiz1 |
And quiz "Test quiz" contains the following questions: And quiz "Test quiz" contains the following questions:
| matching-001 | 1 | | matching-001 | 1 |
And I log in as "admin"
And I am on "Course 1" course homepage
@javascript @javascript
Scenario: Backup and restore a course containing a Matching question Scenario: Backup and restore a course containing a Matching question
When I backup "Course 1" course using this options: When I am on the "Course 1" course page logged in as admin
And I backup "Course 1" course using this options:
| Confirmation | Filename | test_backup.mbz | | Confirmation | Filename | test_backup.mbz |
And I restore "test_backup.mbz" backup into a new course using this options: And I restore "test_backup.mbz" backup into a new course using this options:
| Schema | Course name | Course 2 | | Schema | Course name | Course 2 |
And I navigate to "Question bank" in current page administration | Schema | Course short name | C2 |
And I am on the "Course 2" "core_question > course question bank" page
And I choose "Edit question" action for "matching-001" in the question bank And I choose "Edit question" action for "matching-001" in the question bank
Then the following fields match these values: Then the following fields match these values:
| Question name | matching-001 | | Question name | matching-001 |

View file

@ -6,45 +6,42 @@ Feature: Test editing a Matching question
Background: Background:
Given the following "users" exist: Given the following "users" exist:
| username | firstname | lastname | email | | username |
| teacher1 | T1 | Teacher1 | teacher1@example.com | | teacher |
And the following "courses" exist: And the following "courses" exist:
| fullname | shortname | category | | fullname | shortname | category |
| Course 1 | C1 | 0 | | Course 1 | C1 | 0 |
And the following "course enrolments" exist: And the following "course enrolments" exist:
| user | course | role | | user | course | role |
| teacher1 | C1 | editingteacher | | teacher | C1 | editingteacher |
And the following "question categories" exist: And the following "question categories" exist:
| contextlevel | reference | name | | contextlevel | reference | name |
| Course | C1 | Test questions | | Course | C1 | Test questions |
And the following "questions" exist: And the following "questions" exist:
| questioncategory | qtype | name | template | | questioncategory | qtype | name | template |
| Test questions | match | Matching for editing | foursubq | | Test questions | match | Matching for editing | foursubq |
And I log in as "teacher1"
And I am on "Course 1" course homepage
And I navigate to "Question bank" in current page administration
@javascript @_switch_window @javascript @_switch_window
Scenario: Edit a Matching question Scenario: Edit a Matching question
When I choose "Edit question" action for "Matching for editing" in the question bank When I am on the "Matching for editing" "core_question > edit" page logged in as teacher
And I set the following fields to these values: And I set the following fields to these values:
| Question name | | | Question name | |
And I press "id_submitbutton" And I press "id_submitbutton"
Then I should see "You must supply a value here." And I should see "You must supply a value here."
When I set the following fields to these values: And I set the following fields to these values:
| Question name | Edited Matching name | | Question name | Edited Matching name |
And I press "id_submitbutton" And I press "id_submitbutton"
Then I should see "Edited Matching name" And I should see "Edited Matching name"
When I choose "Edit question" action for "Edited Matching name" in the question bank And I choose "Edit question" action for "Edited Matching name" in the question bank
And I set the following fields to these values: And I set the following fields to these values:
| Shuffle | 0 | | Shuffle | 0 |
| Question 2 | dog | | Question 2 | dog |
| Question 4 | fly | | Question 4 | fly |
And I press "id_submitbutton" And I press "id_submitbutton"
Then I should see "Edited Matching name" Then I should see "Edited Matching name"
When I choose "Preview" action for "Edited Matching name" in the question bank And I choose "Preview" action for "Edited Matching name" in the question bank
And I switch to "questionpreview" window And I switch to "questionpreview" window
Then I should see "frog" And I should see "frog"
And I should see "dog" And I should see "dog"
And I should see "newt" And I should see "newt"
And I should see "fly" And I should see "fly"

View file

@ -6,25 +6,23 @@ Feature: Test exporting Matching questions
Background: Background:
Given the following "users" exist: Given the following "users" exist:
| username | firstname | lastname | email | | username |
| teacher1 | T1 | Teacher1 | teacher1@example.com | | teacher |
And the following "courses" exist: And the following "courses" exist:
| fullname | shortname | category | | fullname | shortname | category |
| Course 1 | C1 | 0 | | Course 1 | C1 | 0 |
And the following "course enrolments" exist: And the following "course enrolments" exist:
| user | course | role | | user | course | role |
| teacher1 | C1 | editingteacher | | teacher | C1 | editingteacher |
And the following "question categories" exist: And the following "question categories" exist:
| contextlevel | reference | name | | contextlevel | reference | name |
| Course | C1 | Test questions | | Course | C1 | Test questions |
And the following "questions" exist: And the following "questions" exist:
| questioncategory | qtype | name | template | | questioncategory | qtype | name | template |
| Test questions | match | matching-001 | foursubq | | Test questions | match | matching-001 | foursubq |
And I log in as "teacher1"
And I am on "Course 1" course homepage
Scenario: Export a Matching question Scenario: Export a Matching question
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 teacher
And I set the field "id_format_xml" to "1" And I set the field "id_format_xml" to "1"
And I press "Export questions to file" And I press "Export questions to file"
Then following "click here" should download between "1600" and "1750" bytes Then following "click here" should download between "1600" and "1750" bytes

View file

@ -6,20 +6,18 @@ Feature: Test importing Matching questions
Background: Background:
Given the following "users" exist: Given the following "users" exist:
| username | firstname | lastname | email | | username |
| teacher1 | T1 | Teacher1 | teacher1@example.com | | teacher |
And the following "courses" exist: And the following "courses" exist:
| fullname | shortname | category | | fullname | shortname | category |
| Course 1 | C1 | 0 | | Course 1 | C1 | 0 |
And the following "course enrolments" exist: And the following "course enrolments" exist:
| user | course | role | | user | course | role |
| teacher1 | C1 | editingteacher | | teacher | C1 | editingteacher |
And I log in as "teacher1"
And I am on "Course 1" course homepage
@javascript @_file_upload @javascript @_file_upload
Scenario: import Matching question. Scenario: import Matching 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_xml" to "1" 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 upload "question/type/match/tests/fixtures/testquestion.moodle.xml" file to "Import" filemanager
And I press "id_submitbutton" And I press "id_submitbutton"

View file

@ -6,74 +6,56 @@ Feature: Preview a Matching question
Background: Background:
Given the following "users" exist: Given the following "users" exist:
| username | firstname | lastname | email | | username |
| teacher1 | T1 | Teacher1 | teacher1@moodle.com | | teacher |
And the following "courses" exist: And the following "courses" exist:
| fullname | shortname | category | | fullname | shortname | category |
| Course 1 | C1 | 0 | | Course 1 | C1 | 0 |
And the following "course enrolments" exist: And the following "course enrolments" exist:
| user | course | role | | user | course | role |
| teacher1 | C1 | editingteacher | | teacher | C1 | editingteacher |
And the following "question categories" exist: And the following "question categories" exist:
| contextlevel | reference | name | | contextlevel | reference | name |
| Course | C1 | Test questions | | Course | C1 | Test questions |
And the following "questions" exist: And the following "questions" exist:
| questioncategory | qtype | name | template | | questioncategory | qtype | name | template | shuffleanswers |
| Test questions | match | matching-001 | foursubq | | Test questions | match | matching-001 | foursubq | 0 |
Given I log in as "teacher1"
And I am on "Course 1" course homepage
And I navigate to "Question bank" in current page administration
@javascript @_switch_window @javascript @_switch_window
Scenario: Preview a Matching question and submit a correct response. Scenario: Preview a Matching question and submit a correct response.
When I choose "Edit question" action for "matching-001" in the question bank When I am on the "matching-001" "core_question > preview" page logged in as teacher
And I set the following fields to these values: And I expand all fieldsets
| Shuffle | 0 |
And I press "id_submitbutton"
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 set the field "How questions behave" to "Immediate feedback"
And I press "Start again with these options" And I press "Start again with these options"
And I set the field with xpath "//table[@class='answer']//td[@class='control']//select[contains(@id, '1_sub0')]" to "amphibian" And I set the field "Answer 1" to "amphibian"
And I set the field with xpath "//table[@class='answer']//td[@class='control']//select[contains(@id, '1_sub1')]" to "mammal" And I set the field "Answer 2" to "mammal"
And I set the field with xpath "//table[@class='answer']//td[@class='control']//select[contains(@id, '1_sub2')]" to "amphibian" And I set the field "Answer 3" to "amphibian"
And I press "Check" And I press "Check"
Then I should see "Well done!" Then I should see "Well done!"
And I should see "General feedback." And I should see "General feedback."
And I switch to the main window
@javascript @_switch_window @javascript @_switch_window
Scenario: Preview a Matching question and submit a partially correct response. Scenario: Preview a Matching question and submit a partially correct response.
When I choose "Edit question" action for "matching-001" in the question bank When I am on the "matching-001" "core_question > preview" page logged in as teacher
And I set the following fields to these values: And I expand all fieldsets
| Shuffle | 0 |
And I press "id_submitbutton"
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 set the field "How questions behave" to "Immediate feedback"
And I press "Start again with these options" And I press "Start again with these options"
And I set the field with xpath "//table[@class='answer']//td[@class='control']//select[contains(@id, '1_sub0')]" to "amphibian" And I set the field "Answer 1" to "amphibian"
And I set the field with xpath "//table[@class='answer']//td[@class='control']//select[contains(@id, '1_sub1')]" to "insect" And I set the field "Answer 2" to "insect"
And I set the field with xpath "//table[@class='answer']//td[@class='control']//select[contains(@id, '1_sub2')]" to "amphibian" And I set the field "Answer 3" to "amphibian"
And I press "Check" And I press "Check"
Then I should see "Parts, but only parts, of your response are correct." Then I should see "Parts, but only parts, of your response are correct."
And I should see "General feedback." And I should see "General feedback."
And I switch to the main window
@javascript @_switch_window @javascript @_switch_window
Scenario: Preview a Matching question and submit an incorrect response. Scenario: Preview a Matching question and submit an incorrect response.
When I choose "Edit question" action for "matching-001" in the question bank When I am on the "matching-001" "core_question > preview" page logged in as teacher
And I set the following fields to these values: And I expand all fieldsets
| Shuffle | 0 |
And I press "id_submitbutton"
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 set the field "How questions behave" to "Immediate feedback"
And I press "Start again with these options" And I press "Start again with these options"
And I set the field with xpath "//table[@class='answer']//td[@class='control']//select[contains(@id, '1_sub0')]" to "mammal" And I set the field "Answer 1" to "mammal"
And I set the field with xpath "//table[@class='answer']//td[@class='control']//select[contains(@id, '1_sub1')]" to "insect" And I set the field "Answer 2" to "insect"
And I set the field with xpath "//table[@class='answer']//td[@class='control']//select[contains(@id, '1_sub2')]" to "insect" And I set the field "Answer 3" to "insect"
And I press "Check" And I press "Check"
Then I should see "That is not right at all." Then I should see "That is not right at all."
And I should see "General feedback." And I should see "General feedback."
And I switch to the main window

View file

@ -6,33 +6,32 @@ Feature: Test creating a Multianswer (Cloze) question
Background: Background:
Given the following "users" exist: Given the following "users" exist:
| username | firstname | lastname | email | | username |
| teacher1 | T1 | Teacher1 | teacher1@moodle.com | | teacher |
And the following "courses" exist: And the following "courses" exist:
| fullname | shortname | category | | fullname | shortname | category |
| Course 1 | C1 | 0 | | Course 1 | C1 | 0 |
And the following "course enrolments" exist: And the following "course enrolments" exist:
| user | course | role | | user | course | role |
| teacher1 | C1 | editingteacher | | teacher | C1 | editingteacher |
And I log in as "teacher1"
And I am on "Course 1" course homepage
And I navigate to "Question bank" in current page administration
Scenario: Create a Cloze question Scenario: Create a Cloze question
When I add a "Embedded answers (Cloze)" question filling the form with: When I am on the "Course 1" "core_question > course question bank" page logged in as teacher
And I add a "Embedded answers (Cloze)" question filling the form with:
| Question name | multianswer-001 | | Question name | multianswer-001 |
| Question text | {1:SHORTANSWER:=Berlin} is the capital of Germany. | | Question text | {1:SHORTANSWER:=Berlin} is the capital of Germany. |
| General feedback | The capital of Germany is Berlin. | | General feedback | The capital of Germany is Berlin. |
Then I should see "multianswer-001" in the "categoryquestions" "table" Then I should see "multianswer-001" in the "categoryquestions" "table"
Scenario: Create a broken Cloze question and correct it Scenario: Create a broken Cloze question and correct it
Given I press "Create a new question ..." When I am on the "Course 1" "core_question > course question bank" page logged in as teacher
And I press "Create a new question ..."
And I set the field "Embedded answers (Cloze)" to "1" And I set the field "Embedded answers (Cloze)" to "1"
And I press "Add" And I press "Add"
And I set the field "Question name" to "multianswer-002" And I set the field "Question name" to "multianswer-002"
And I set the field "Question text" to "Please select the fruits {1:MULTICHOICE:=Apple#Correct}" And I set the field "Question text" to "Please select the fruits {1:MULTICHOICE:=Apple#Correct}"
And I set the field "General feedback" to "Apple are delicious." And I set the field "General feedback" to "Apple are delicious."
When I press "id_submitbutton" And I press "id_submitbutton"
Then I should see "This type of question requires at least 2 choices" Then I should see "This type of question requires at least 2 choices"
And I set the following fields to these values: And I set the following fields to these values:
| Question text | Please select the fruits {1:MULTICHOICE:=Apple#Correct~Banana#Wrong} | | Question text | Please select the fruits {1:MULTICHOICE:=Apple#Correct~Banana#Wrong} |
@ -40,11 +39,12 @@ Feature: Test creating a Multianswer (Cloze) question
And I should see "multianswer-002" in the "categoryquestions" "table" And I should see "multianswer-002" in the "categoryquestions" "table"
Scenario: Try to create a Cloze question that has no answer Scenario: Try to create a Cloze question that has no answer
Given I press "Create a new question ..." When I am on the "Course 1" "core_question > course question bank" page logged in as teacher
And I press "Create a new question ..."
And I set the field "Embedded answers (Cloze)" to "1" And I set the field "Embedded answers (Cloze)" to "1"
And I press "Add" And I press "Add"
And I set the following fields to these values: And I set the following fields to these values:
| Question name | multianswer-003 | | Question name | multianswer-003 |
| Question text | {1:SHORTANSWER:= } is the capital of Germany. | | Question text | {1:SHORTANSWER:= } is the capital of Germany. |
And I press "id_submitbutton" And I press "id_submitbutton"
And I should see "This type of question requires at least 1 answers" Then I should see "This type of question requires at least 1 answers"

View file

@ -6,20 +6,18 @@ Feature: Test creating a Multiple choice question
Background: Background:
Given the following "users" exist: Given the following "users" exist:
| username | firstname | lastname | email | | username |
| teacher1 | T1 | Teacher1 | teacher1@moodle.com | | teacher |
And the following "courses" exist: And the following "courses" exist:
| fullname | shortname | category | | fullname | shortname | category |
| Course 1 | C1 | 0 | | Course 1 | C1 | 0 |
And the following "course enrolments" exist: And the following "course enrolments" exist:
| user | course | role | | user | course | role |
| teacher1 | C1 | editingteacher | | teacher | C1 | editingteacher |
And I log in as "teacher1"
And I am on "Course 1" course homepage
And I navigate to "Question bank" in current page administration
Scenario: Create a Multiple choice question with multiple response Scenario: Create a Multiple choice question with multiple response
When I add a "Multiple choice" question filling the form with: When I am on the "Course 1" "core_question > course question bank" page logged in as teacher
And I add a "Multiple choice" question filling the form with:
| Question name | Multi-choice-001 | | Question name | Multi-choice-001 |
| Question text | Find the capital cities in Europe. | | Question text | Find the capital cities in Europe. |
| General feedback | Paris and London | | General feedback | Paris and London |
@ -39,7 +37,8 @@ Feature: Test creating a Multiple choice question
Then I should see "Multi-choice-001" Then I should see "Multi-choice-001"
Scenario: Create a Multiple choice question with single response Scenario: Create a Multiple choice question with single response
When I add a "Multiple choice" question filling the form with: When I am on the "Course 1" "core_question > course question bank" page logged in as teacher
And I add a "Multiple choice" question filling the form with:
| Question name | Multi-choice-002 | | Question name | Multi-choice-002 |
| Question text | Find the capital city of England. | | Question text | Find the capital city of England. |
| General feedback | London is the capital city of England. | | General feedback | London is the capital city of England. |

View file

@ -19,16 +19,16 @@ Feature: Test duplicating a quiz containing a Multiple choice question
| quiz | Test quiz | C1 | quiz1 | | quiz | Test quiz | C1 | quiz1 |
And quiz "Test quiz" contains the following questions: And quiz "Test quiz" contains the following questions:
| Multi-choice-001 | 1 | | Multi-choice-001 | 1 |
And I log in as "admin"
And I am on "Course 1" course homepage
@javascript @javascript
Scenario: Backup and restore a course containing a Multiple choice question Scenario: Backup and restore a course containing a Multiple choice question
When I backup "Course 1" course using this options: When I am on the "Course 1" course page logged in as admin
And I backup "Course 1" course using this options:
| Confirmation | Filename | test_backup.mbz | | Confirmation | Filename | test_backup.mbz |
And I restore "test_backup.mbz" backup into a new course using this options: And I restore "test_backup.mbz" backup into a new course using this options:
| Schema | Course name | Course 2 | | Schema | Course name | Course 2 |
And I navigate to "Question bank" in current page administration | Schema | Course short name | C2 |
And I am on the "Course 2" "core_question > course question bank" page
And I choose "Edit question" action for "Multi-choice-001" in the question bank And I choose "Edit question" action for "Multi-choice-001" in the question bank
Then the following fields match these values: Then the following fields match these values:
| Question name | Multi-choice-001 | | Question name | Multi-choice-001 |

View file

@ -6,15 +6,15 @@ Feature: Clear my answers
Background: Background:
Given the following "users" exist: Given the following "users" exist:
| username | firstname | lastname | email | | username |
| student1 | S1 | Student1 | student1@moodle.com | | student |
And the following "course" exists: And the following "course" exists:
| fullname | Course 1 | | fullname | Course 1 |
| shortname | C1 | | shortname | C1 |
| category | 0 | | category | 0 |
And the following "course enrolments" exist: And the following "course enrolments" exist:
| user | course | role | | user | course | role |
| student1 | C1 | student | | student | C1 | student |
And the following "question category" exists: And the following "question category" exists:
| contextlevel | Course | | contextlevel | Course |
| reference | C1 | | reference | C1 |
@ -39,8 +39,8 @@ Feature: Clear my answers
@javascript @javascript
Scenario: Attempt a quiz and reset my chosen answer. Scenario: Attempt a quiz and reset my chosen answer.
Given I am on the "Quiz 1" "quiz activity" page logged in as student1 Given I am on the "Quiz 1" "quiz activity" page logged in as student
When I press "Attempt quiz now" When I press "Attempt quiz"
And I should see "Question One" And I should see "Question One"
And I click on "Four" "qtype_multichoice > Answer" in the "Question One" "question" And I click on "Four" "qtype_multichoice > Answer" in the "Question One" "question"
And I should see "Clear my choice" And I should see "Clear my choice"
@ -51,8 +51,8 @@ Feature: Clear my answers
@javascript @javascript
Scenario: Attempt a quiz and revisit a cleared answer. Scenario: Attempt a quiz and revisit a cleared answer.
Given I am on the "Quiz 1" "quiz activity" page logged in as student1 Given I am on the "Quiz 1" "quiz activity" page logged in as student
When I press "Attempt quiz now" When I press "Attempt quiz"
And I should see "Question One" And I should see "Question One"
And I click on "Four" "qtype_multichoice > Answer" in the "Question One" "question" And I click on "Four" "qtype_multichoice > Answer" in the "Question One" "question"
And I follow "Finish attempt ..." And I follow "Finish attempt ..."

View file

@ -6,14 +6,14 @@ Feature: Test editing a Multiple choice question
Background: Background:
Given the following "users" exist: Given the following "users" exist:
| username | firstname | lastname | email | | username |
| teacher1 | T1 | Teacher1 | teacher1@example.com | | teacher |
And the following "courses" exist: And the following "courses" exist:
| fullname | shortname | category | | fullname | shortname | category |
| Course 1 | C1 | 0 | | Course 1 | C1 | 0 |
And the following "course enrolments" exist: And the following "course enrolments" exist:
| user | course | role | | user | course | role |
| teacher1 | C1 | editingteacher | | teacher | C1 | editingteacher |
And the following "question categories" exist: And the following "question categories" exist:
| contextlevel | reference | name | | contextlevel | reference | name |
| Course | C1 | Test questions | | Course | C1 | Test questions |
@ -21,23 +21,20 @@ Feature: Test editing a Multiple choice question
| questioncategory | qtype | name | template | | questioncategory | qtype | name | template |
| Test questions | multichoice | Multiple choice for editing | two_of_four | | Test questions | multichoice | Multiple choice for editing | two_of_four |
| Test questions | multichoice | Single choice for editing | one_of_four | | Test questions | multichoice | Single choice for editing | one_of_four |
And I log in as "teacher1"
And I am on "Course 1" course homepage
And I navigate to "Question bank" in current page administration
Scenario: Edit a Multiple choice question with multiple response (checkboxes) Scenario: Edit a Multiple choice question with multiple response (checkboxes)
When I choose "Edit question" action for "Multiple choice for editing" in the question bank When I am on the "Multiple choice for editing" "core_question > edit" page logged in as teacher
And I set the following fields to these values: And I set the following fields to these values:
| Question name | | | Question name | |
And I press "id_submitbutton" And I press "id_submitbutton"
Then I should see "You must supply a value here." And I should see "You must supply a value here."
When I set the following fields to these values: And I set the following fields to these values:
| Question name | Edited Multiple choice name | | Question name | Edited Multiple choice name |
And I press "id_submitbutton" And I press "id_submitbutton"
Then I should see "Edited Multiple choice name" Then I should see "Edited Multiple choice name"
Scenario: Edit a Multiple choice question with single response (radio buttons) Scenario: Edit a Multiple choice question with single response (radio buttons)
When I choose "Edit question" action for "Single choice for editing" in the question bank When I am on the "Single choice for editing" "core_question > edit" page logged in as teacher
And I set the following fields to these values: And I set the following fields to these values:
| Question name | Edited Single choice name | | Question name | Edited Single choice name |
And I press "id_submitbutton" And I press "id_submitbutton"

View file

@ -6,14 +6,14 @@ Feature: Test exporting Multiple choice questions
Background: Background:
Given the following "users" exist: Given the following "users" exist:
| username | firstname | lastname | email | | username |
| teacher1 | T1 | Teacher1 | teacher1@example.com | | teacher |
And the following "courses" exist: And the following "courses" exist:
| fullname | shortname | category | | fullname | shortname | category |
| Course 1 | C1 | 0 | | Course 1 | C1 | 0 |
And the following "course enrolments" exist: And the following "course enrolments" exist:
| user | course | role | | user | course | role |
| teacher1 | C1 | editingteacher | | teacher | C1 | editingteacher |
And the following "question categories" exist: And the following "question categories" exist:
| contextlevel | reference | name | | contextlevel | reference | name |
| Course | C1 | Test questions | | Course | C1 | Test questions |
@ -21,11 +21,9 @@ Feature: Test exporting Multiple choice questions
| questioncategory | qtype | name | template | | questioncategory | qtype | name | template |
| Test questions | multichoice | Multi-choice-001 | two_of_four | | Test questions | multichoice | Multi-choice-001 | two_of_four |
| Test questions | multichoice | Multi-choice-002 | one_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: Export a Multiple choice question Scenario: Export a Multiple choice question
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 teacher
And I set the field "id_format_xml" to "1" And I set the field "id_format_xml" to "1"
And I press "Export questions to file" And I press "Export questions to file"
Then following "click here" should download between "3900" and "4100" bytes Then following "click here" should download between "3900" and "4100" bytes

View file

@ -6,20 +6,18 @@ Feature: Test importing Multiple choice questions
Background: Background:
Given the following "users" exist: Given the following "users" exist:
| username | firstname | lastname | email | | username |
| teacher1 | T1 | Teacher1 | teacher1@example.com | | teacher |
And the following "courses" exist: And the following "courses" exist:
| fullname | shortname | category | | fullname | shortname | category |
| Course 1 | C1 | 0 | | Course 1 | C1 | 0 |
And the following "course enrolments" exist: And the following "course enrolments" exist:
| user | course | role | | user | course | role |
| teacher1 | C1 | editingteacher | | teacher | C1 | editingteacher |
And I log in as "teacher1"
And I am on "Course 1" course homepage
@javascript @_file_upload @javascript @_file_upload
Scenario: import Multiple choice question. Scenario: import Multiple choice 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_xml" to "1" 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 upload "question/type/multichoice/tests/fixtures/testquestion.moodle.xml" file to "Import" filemanager
And I press "id_submitbutton" And I press "id_submitbutton"

View file

@ -6,14 +6,14 @@ Feature: Preview a Multiple choice question
Background: Background:
Given the following "users" exist: Given the following "users" exist:
| username | firstname | lastname | email | | username |
| teacher1 | T1 | Teacher1 | teacher1@moodle.com | | teacher |
And the following "courses" exist: And the following "courses" exist:
| fullname | shortname | category | | fullname | shortname | category |
| Course 1 | C1 | 0 | | Course 1 | C1 | 0 |
And the following "course enrolments" exist: And the following "course enrolments" exist:
| user | course | role | | user | course | role |
| teacher1 | C1 | editingteacher | | teacher | C1 | editingteacher |
And the following "question categories" exist: And the following "question categories" exist:
| contextlevel | reference | name | | contextlevel | reference | name |
| Course | C1 | Test questions | | Course | C1 | Test questions |
@ -21,14 +21,11 @@ Feature: Preview a Multiple choice question
| questioncategory | qtype | name | template | | questioncategory | qtype | name | template |
| Test questions | multichoice | Multi-choice-001 | two_of_four | | Test questions | multichoice | Multi-choice-001 | two_of_four |
| Test questions | multichoice | Multi-choice-002 | one_of_four | | Test questions | multichoice | Multi-choice-002 | one_of_four |
Given I log in as "teacher1"
And I am on "Course 1" course homepage
And I navigate to "Question bank" in current page administration
@javascript @_switch_window @javascript @_switch_window
Scenario: Preview a Multiple choice question and submit a partially correct response. Scenario: Preview a Multiple choice question and submit a partially correct response.
When I choose "Preview" action for "Multi-choice-001" in the question bank When I am on the "Multi-choice-001" "core_question > preview" page logged in as teacher
And I switch to "questionpreview" window And I expand all fieldsets
And I set the field "How questions behave" to "Immediate feedback" And I set the field "How questions behave" to "Immediate feedback"
And I press "Start again with these options" And I press "Start again with these options"
And I click on "One" "qtype_multichoice > Answer" And I click on "One" "qtype_multichoice > Answer"
@ -38,12 +35,11 @@ Feature: Preview a Multiple choice question
And I should see "Two is even" And I should see "Two is even"
And I should see "Mark 0.50 out of 1.00" And I should see "Mark 0.50 out of 1.00"
And I should see "Parts, but only parts, of your response are correct." And I should see "Parts, but only parts, of your response are correct."
And I switch to the main window
@javascript @_switch_window @javascript @_switch_window
Scenario: Preview a Multiple choice question and submit a correct response. Scenario: Preview a Multiple choice question and submit a correct response.
When I choose "Preview" action for "Multi-choice-001" in the question bank When I am on the "Multi-choice-001" "core_question > preview" page logged in as teacher
And I switch to "questionpreview" window And I expand all fieldsets
And I set the field "How questions behave" to "Immediate feedback" And I set the field "How questions behave" to "Immediate feedback"
And I press "Start again with these options" And I press "Start again with these options"
And I click on "One" "qtype_multichoice > Answer" And I click on "One" "qtype_multichoice > Answer"
@ -55,12 +51,11 @@ Feature: Preview a Multiple choice question
And I should see "Well done!" And I should see "Well done!"
And I should see "The odd numbers are One and Three." And I should see "The odd numbers are One and Three."
And I should see "The correct answers are: One, Three" And I should see "The correct answers are: One, Three"
And I switch to the main window
@javascript @_switch_window @javascript @_switch_window
Scenario: Preview a Multiple choice question and submit a correct response. Scenario: Preview a Multiple choice question and submit a correct response.
When I choose "Preview" action for "Multi-choice-002" in the question bank When I am on the "Multi-choice-002" "core_question > preview" page logged in as teacher
And I switch to "questionpreview" window And I expand all fieldsets
And I set the field "How questions behave" to "Immediate feedback" And I set the field "How questions behave" to "Immediate feedback"
And I press "Start again with these options" And I press "Start again with these options"
And I click on "One" "qtype_multichoice > Answer" And I click on "One" "qtype_multichoice > Answer"
@ -69,16 +64,14 @@ Feature: Preview a Multiple choice question
And I should see "Mark 1.00 out of 1.00" And I should see "Mark 1.00 out of 1.00"
And I should see "Well done!" And I should see "Well done!"
And I should see "The correct answer is: One" And I should see "The correct answer is: One"
And I switch to the main window
@javascript @_switch_window @javascript @_switch_window
Scenario: Preview a multiple choice question (single response) and clear a previous selected option. Scenario: Preview a multiple choice question (single response) and clear a previous selected option.
When I choose "Preview" action for "Multi-choice-002" in the question bank When I am on the "Multi-choice-002" "core_question > preview" page logged in as teacher
And I switch to "questionpreview" window And I expand all fieldsets
And I set the field "How questions behave" to "Immediate feedback" And I set the field "How questions behave" to "Immediate feedback"
And I press "Start again with these options" And I press "Start again with these options"
And I click on "One" "qtype_multichoice > Answer" And I click on "One" "qtype_multichoice > Answer"
Then I should see "Clear my choice" Then I should see "Clear my choice"
And I click on "Clear my choice" "text" And I click on "Clear my choice" "text"
And I should not see "Clear my choice" And I should not see "Clear my choice"
And I switch to the main window

View file

@ -6,23 +6,21 @@ Feature: Test creating a Numerical question
Background: Background:
Given the following "users" exist: Given the following "users" exist:
| username | firstname | lastname | email | | username |
| teacher1 | T1 | Teacher1 | teacher1@example.com | | teacher |
And the following "courses" exist: And the following "courses" exist:
| fullname | shortname | category | | fullname | shortname | category |
| Course 1 | C1 | 0 | | Course 1 | C1 | 0 |
And the following "course enrolments" exist: And the following "course enrolments" exist:
| user | course | role | | user | course | role |
| teacher1 | C1 | editingteacher | | teacher | C1 | editingteacher |
And the following "language customisations" exist: And the following "language customisations" exist:
| component | stringid | value | | component | stringid | value |
| core_langconfig | decsep | # | | core_langconfig | decsep | # |
And I log in as "teacher1"
And I am on "Course 1" course homepage
And I navigate to "Question bank" in current page administration
Scenario: Create a Numerical question Scenario: Create a Numerical question
When I add a "Numerical" question filling the form with: When I am on the "Course 1" "core_question > course question bank" page logged in as teacher
And I add a "Numerical" question filling the form with:
| Question name | Numerical-001 | | Question name | Numerical-001 |
| Question text | What is the average of 4, 5, 6 and 10? | | Question text | What is the average of 4, 5, 6 and 10? |
| Default mark | 1 | | Default mark | 1 |

View file

@ -19,16 +19,16 @@ Feature: Test duplicating a quiz containing a Numerical question
| quiz | Test quiz | C1 | quiz1 | | quiz | Test quiz | C1 | quiz1 |
And quiz "Test quiz" contains the following questions: And quiz "Test quiz" contains the following questions:
| Numerical-001 | 1 | | Numerical-001 | 1 |
And I log in as "admin"
And I am on "Course 1" course homepage
@javascript @javascript
Scenario: Backup and restore a course containing a Numerical question Scenario: Backup and restore a course containing a Numerical question
When I backup "Course 1" course using this options: When I am on the "Course 1" course page logged in as admin
And I backup "Course 1" course using this options:
| Confirmation | Filename | test_backup.mbz | | Confirmation | Filename | test_backup.mbz |
And I restore "test_backup.mbz" backup into a new course using this options: And I restore "test_backup.mbz" backup into a new course using this options:
| Schema | Course name | Course 2 | | Schema | Course name | Course 2 |
And I navigate to "Question bank" in current page administration | Schema | Course short name | C2 |
And I am on the "Course 2" "core_question > course question bank" page
And I choose "Edit question" action for "Numerical-001" in the question bank And I choose "Edit question" action for "Numerical-001" in the question bank
Then the following fields match these values: Then the following fields match these values:
| Question name | Numerical-001 | | Question name | Numerical-001 |

View file

@ -6,14 +6,14 @@ Feature: Test editing a Numerical question
Background: Background:
Given the following "users" exist: Given the following "users" exist:
| username | firstname | lastname | email | | username |
| teacher1 | T1 | Teacher1 | teacher1@example.com | | teacher |
And the following "courses" exist: And the following "courses" exist:
| fullname | shortname | category | | fullname | shortname | category |
| Course 1 | C1 | 0 | | Course 1 | C1 | 0 |
And the following "course enrolments" exist: And the following "course enrolments" exist:
| user | course | role | | user | course | role |
| teacher1 | C1 | editingteacher | | teacher | C1 | editingteacher |
And the following "question categories" exist: And the following "question categories" exist:
| contextlevel | reference | name | | contextlevel | reference | name |
| Course | C1 | Test questions | | Course | C1 | Test questions |
@ -25,20 +25,17 @@ Feature: Test editing a Numerical question
Given the following "language customisations" exist: Given the following "language customisations" exist:
| component | stringid | value | | component | stringid | value |
| core_langconfig | decsep | # | | core_langconfig | decsep | # |
And I log in as "teacher1" When I am on the "Numerical for editing" "core_question > edit" page logged in as teacher
And I am on "Course 1" course homepage And the field "id_answer_0" matches value "3#14"
And I navigate to "Question bank" in current page administration And I set the following fields to these values:
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 | | | Question name | |
And I press "id_submitbutton" And I press "id_submitbutton"
Then I should see "You must supply a value here." And I should see "You must supply a value here."
When I set the following fields to these values: And I set the following fields to these values:
| Question name | Edited Numerical name | | Question name | Edited Numerical name |
And I press "id_submitbutton" And I press "id_submitbutton"
Then I should see "Edited Numerical name" Then I should see "Edited Numerical name"
When I choose "Edit question" action for "Edited Numerical name" in the question bank And I choose "Edit question" action for "Edited Numerical name" in the question bank
And I set the following fields to these values: And I set the following fields to these values:
| id_answer_1 | 3#141592 | | id_answer_1 | 3#141592 |
| id_tolerance_1 | 0#005 | | id_tolerance_1 | 0#005 |
@ -46,13 +43,10 @@ Feature: Test editing a Numerical question
| id_tolerance_2 | 0.005 | | id_tolerance_2 | 0.005 |
| id_answer_3 | 3,01 | | id_answer_3 | 3,01 |
And I press "id_submitbutton" And I press "id_submitbutton"
Then I should see "Edited Numerical name" And I should see "Edited Numerical name"
Scenario: Edit a Numerical question with very small answer Scenario: Edit a Numerical question with very small answer
Given I log in as "teacher1" When I am on the "Numerical for editing" "core_question > edit" page logged in as teacher
And I am on "Course 1" course homepage
And I navigate to "Question bank" in current page administration
When I choose "Edit question" action for "Numerical for editing" in the question bank
And I set the following fields to these values: And I set the following fields to these values:
| id_answer_0 | 0.00000123456789 | | id_answer_0 | 0.00000123456789 |
| id_tolerance_1 | 0.0000123456789 | | id_tolerance_1 | 0.0000123456789 |

View file

@ -6,14 +6,14 @@ Feature: Test exporting Numerical questions
Background: Background:
Given the following "users" exist: Given the following "users" exist:
| username | firstname | lastname | email | | username |
| teacher1 | T1 | Teacher1 | teacher1@example.com | | teacher |
And the following "courses" exist: And the following "courses" exist:
| fullname | shortname | category | | fullname | shortname | category |
| Course 1 | C1 | 0 | | Course 1 | C1 | 0 |
And the following "course enrolments" exist: And the following "course enrolments" exist:
| user | course | role | | user | course | role |
| teacher1 | C1 | editingteacher | | teacher | C1 | editingteacher |
And the following "question categories" exist: And the following "question categories" exist:
| contextlevel | reference | name | | contextlevel | reference | name |
| Course | C1 | Test questions | | Course | C1 | Test questions |
@ -21,11 +21,9 @@ Feature: Test exporting Numerical questions
| questioncategory | qtype | name | template | | questioncategory | qtype | name | template |
| Test questions | numerical | Numerical-001 | pi | | Test questions | numerical | Numerical-001 | pi |
| Test questions | numerical | Numerical-002 | pi3tries | | Test questions | numerical | Numerical-002 | pi3tries |
And I log in as "teacher1"
And I am on "Course 1" course homepage
Scenario: Export a Numerical question Scenario: Export a Numerical question
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 teacher
And I set the field "id_format_xml" to "1" And I set the field "id_format_xml" to "1"
And I press "Export questions to file" And I press "Export questions to file"
Then following "click here" should download between "3650" and "3750" bytes Then following "click here" should download between "3650" and "3750" bytes

View file

@ -6,20 +6,18 @@ Feature: Test importing Numerical questions
Background: Background:
Given the following "users" exist: Given the following "users" exist:
| username | firstname | lastname | email | | username |
| teacher1 | T1 | Teacher1 | teacher1@example.com | | teacher |
And the following "courses" exist: And the following "courses" exist:
| fullname | shortname | category | | fullname | shortname | category |
| Course 1 | C1 | 0 | | Course 1 | C1 | 0 |
And the following "course enrolments" exist: And the following "course enrolments" exist:
| user | course | role | | user | course | role |
| teacher1 | C1 | editingteacher | | teacher | C1 | editingteacher |
And I log in as "teacher1"
And I am on "Course 1" course homepage
@javascript @_file_upload @javascript @_file_upload
Scenario: import Numerical question. Scenario: import Numerical 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_xml" to "1" 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 upload "question/type/numerical/tests/fixtures/testquestion.moodle.xml" file to "Import" filemanager
And I press "id_submitbutton" And I press "id_submitbutton"

View file

@ -6,14 +6,14 @@ Feature: Preview a Numerical question
Background: Background:
Given the following "users" exist: Given the following "users" exist:
| username | firstname | lastname | email | | username |
| teacher1 | T1 | Teacher1 | teacher1@example.com | | teacher |
And the following "courses" exist: And the following "courses" exist:
| fullname | shortname | category | | fullname | shortname | category |
| Course 1 | C1 | 0 | | Course 1 | C1 | 0 |
And the following "course enrolments" exist: And the following "course enrolments" exist:
| user | course | role | | user | course | role |
| teacher1 | C1 | editingteacher | | teacher | C1 | editingteacher |
And the following "question categories" exist: And the following "question categories" exist:
| contextlevel | reference | name | | contextlevel | reference | name |
| Course | C1 | Test questions | | Course | C1 | Test questions |
@ -24,28 +24,24 @@ Feature: Preview a Numerical question
And the following "language customisations" exist: And the following "language customisations" exist:
| component | stringid | value | | component | stringid | value |
| core_langconfig | decsep | # | | core_langconfig | decsep | # |
Given I log in as "teacher1"
And I am on "Course 1" course homepage
And I navigate to "Question bank" in current page administration
@javascript @_switch_window @javascript @_switch_window
Scenario: Preview a Numerical question and submit a correct response. Scenario: Preview a Numerical question and submit a correct response.
When I choose "Preview" action for "Numerical-001" in the question bank When I am on the "Numerical-001" "core_question > preview" page logged in as teacher
And I switch to "questionpreview" window And I should see "What is pi to two d.p.?"
Then I should see "What is pi to two d.p.?" And I expand all fieldsets
When I set the field "How questions behave" to "Immediate feedback" And I set the field "How questions behave" to "Immediate feedback"
And I press "Start again with these options" And I press "Start again with these options"
And I set the field with xpath "//span[@class='answer']//input[contains(@id, '1_answer')]" to "3.14" And I set the field with xpath "//span[@class='answer']//input[contains(@id, '1_answer')]" to "3.14"
And I press "Check" And I press "Check"
Then I should see "Very good." Then I should see "Very good."
And I should see "Mark 1#00 out of 1#00" And I should see "Mark 1#00 out of 1#00"
When I press "Start again" And I press "Start again"
And I set the field with xpath "//span[@class='answer']//input[contains(@id, '1_answer')]" to "3,14" And I set the field with xpath "//span[@class='answer']//input[contains(@id, '1_answer')]" to "3,14"
And I press "Check" And I press "Check"
Then I should see "Please enter your answer without using the thousand separator (,)." And I should see "Please enter your answer without using the thousand separator (,)."
When I press "Start again" And I press "Start again"
And I set the field with xpath "//span[@class='answer']//input[contains(@id, '1_answer')]" to "3#14" And I set the field with xpath "//span[@class='answer']//input[contains(@id, '1_answer')]" to "3#14"
And I press "Check" And I press "Check"
Then I should see "Very good." And I should see "Very good."
And I should see "Mark 1#00 out of 1#00" And I should see "Mark 1#00 out of 1#00"
And I switch to the main window

View file

@ -6,20 +6,19 @@ Feature: Test creating a Short answer question
Background: Background:
Given the following "users" exist: Given the following "users" exist:
| username | firstname | lastname | email | | username |
| teacher1 | T1 | Teacher1 | teacher1@moodle.com | | teacher |
And the following "courses" exist: And the following "courses" exist:
| fullname | shortname | category | | fullname | shortname | category |
| Course 1 | C1 | 0 | | Course 1 | C1 | 0 |
And the following "course enrolments" exist: And the following "course enrolments" exist:
| user | course | role | | user | course | role |
| teacher1 | C1 | editingteacher | | teacher | C1 | editingteacher |
And I log in as "teacher1"
And I am on "Course 1" course homepage
And I navigate to "Question bank" in current page administration
@javascript
Scenario: Create a Short answer question Scenario: Create a Short answer question
When I add a "Short answer" question filling the form with: When I am on the "Course 1" "core_question > course question bank" page logged in as teacher
And I add a "Short answer" question filling the form with:
| Question name | shortanswer-001 | | Question name | shortanswer-001 |
| Question text | What is the national langauge in France? | | Question text | What is the national langauge in France? |
| General feedback | The national langauge in France is French | | General feedback | The national langauge in France is French |

View file

@ -19,16 +19,16 @@ Feature: Test duplicating a quiz containing a Short answer question
| quiz | Test quiz | C1 | quiz1 | | quiz | Test quiz | C1 | quiz1 |
And quiz "Test quiz" contains the following questions: And quiz "Test quiz" contains the following questions:
| shortanswer-001 | 1 | | shortanswer-001 | 1 |
And I log in as "admin"
And I am on "Course 1" course homepage
@javascript @javascript
Scenario: Backup and restore a course containing a Short answer question Scenario: Backup and restore a course containing a Short answer question
When I backup "Course 1" course using this options: When I am on the "Course 1" course page logged in as admin
And I backup "Course 1" course using this options:
| Confirmation | Filename | test_backup.mbz | | Confirmation | Filename | test_backup.mbz |
And I restore "test_backup.mbz" backup into a new course using this options: And I restore "test_backup.mbz" backup into a new course using this options:
| Schema | Course name | Course 2 | | Schema | Course name | Course 2 |
And I navigate to "Question bank" in current page administration | Schema | Course short name | C2 |
And I am on the "Course 2" "core_question > course question bank" page
And I choose "Edit question" action for "shortanswer-001" in the question bank And I choose "Edit question" action for "shortanswer-001" in the question bank
Then the following fields match these values: Then the following fields match these values:
| Question name | shortanswer-001 | | Question name | shortanswer-001 |

View file

@ -6,51 +6,48 @@ Feature: Test editing a Short answer question
Background: Background:
Given the following "users" exist: Given the following "users" exist:
| username | firstname | lastname | email | | username |
| teacher1 | T1 | Teacher1 | teacher1@example.com | | teacher |
And the following "courses" exist: And the following "courses" exist:
| fullname | shortname | category | | fullname | shortname | category |
| Course 1 | C1 | 0 | | Course 1 | C1 | 0 |
And the following "course enrolments" exist: And the following "course enrolments" exist:
| user | course | role | | user | course | role |
| teacher1 | C1 | editingteacher | | teacher | C1 | editingteacher |
And the following "question categories" exist: And the following "question categories" exist:
| contextlevel | reference | name | | contextlevel | reference | name |
| Course | C1 | Test questions | | Course | C1 | Test questions |
And the following "questions" exist: And the following "questions" exist:
| questioncategory | qtype | name | template | | questioncategory | qtype | name | template |
| Test questions | shortanswer | shortanswer-001 for editing | frogtoad | | Test questions | shortanswer | shortanswer-001 for editing | frogtoad |
And I log in as "teacher1"
And I am on "Course 1" course homepage
And I navigate to "Question bank" in current page administration
@javascript @_switch_window @javascript @_switch_window
Scenario: Edit a Short answer question Scenario: Edit a Short answer question
When I choose "Edit question" action for "shortanswer-001" in the question bank When I am on the "shortanswer-001 for editing" "core_question > edit" page logged in as teacher
And I set the following fields to these values: And I set the following fields to these values:
| Question name | | | Question name | |
And I press "id_submitbutton" And I press "id_submitbutton"
Then I should see "You must supply a value here." And I should see "You must supply a value here."
When I set the following fields to these values: And I set the following fields to these values:
| Question name | Edited shortanswer-001 name | | Question name | Edited shortanswer-001 name |
And I press "id_submitbutton" And I press "id_submitbutton"
Then I should see "Edited shortanswer-001 name" Then I should see "Edited shortanswer-001 name"
When I choose "Edit question" action for "Edited shortanswer-001" in the question bank And I choose "Edit question" action for "Edited shortanswer-001" in the question bank
And I set the following fields to these values: And I set the following fields to these values:
| id_answer_1 | newt | | id_answer_1 | newt |
| id_fraction_1 | 70% | | id_fraction_1 | 70% |
| id_feedback_1 | Newt is an OK good answer. | | id_feedback_1 | Newt is an OK good answer. |
And I press "id_submitbutton" And I press "id_submitbutton"
Then I should see "Edited shortanswer-001 name" And I should see "Edited shortanswer-001 name"
When I choose "Preview" action for "Edited shortanswer-001" in the question bank And I choose "Preview" action for "Edited shortanswer-001" in the question bank
And I switch to "questionpreview" window And I switch to "questionpreview" window
Then I should see "Name an amphibian:" And I should see "Name an amphibian:"
# Set behaviour options # Set behaviour options
And I set the following fields to these values: And I set the following fields to these values:
| behaviour | immediatefeedback | | behaviour | immediatefeedback |
And I press "Start again with these options" And I press "Start again with these options"
And I set the field with xpath "//div[@class='qtext']//input[contains(@id, '1_answer')]" to "newt" And I set the field with xpath "//div[@class='qtext']//input[contains(@id, '1_answer')]" to "newt"
And I press "Check" And I press "Check"
Then I should see "Newt is an OK good answer." And I should see "Newt is an OK good answer."
And I should see "Generalfeedback: frog or toad would have been OK." And I should see "Generalfeedback: frog or toad would have been OK."
And I should see "The correct answer is: frog" And I should see "The correct answer is: frog"

View file

@ -6,25 +6,23 @@ Feature: Test exporting Short answer questions
Background: Background:
Given the following "users" exist: Given the following "users" exist:
| username | firstname | lastname | email | | username |
| teacher1 | T1 | Teacher1 | teacher1@example.com | | teacher |
And the following "courses" exist: And the following "courses" exist:
| fullname | shortname | category | | fullname | shortname | category |
| Course 1 | C1 | 0 | | Course 1 | C1 | 0 |
And the following "course enrolments" exist: And the following "course enrolments" exist:
| user | course | role | | user | course | role |
| teacher1 | C1 | editingteacher | | teacher | C1 | editingteacher |
And the following "question categories" exist: And the following "question categories" exist:
| contextlevel | reference | name | | contextlevel | reference | name |
| Course | C1 | Test questions | | Course | C1 | Test questions |
And the following "questions" exist: And the following "questions" exist:
| questioncategory | qtype | name | template | | questioncategory | qtype | name | template |
| Test questions | shortanswer | shortanswer-001 | frogtoad | | Test questions | shortanswer | shortanswer-001 | frogtoad |
And I log in as "teacher1"
And I am on "Course 1" course homepage
Scenario: Export a Short answer question Scenario: Export a Short answer question
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 teacher
And I set the field "id_format_xml" to "1" And I set the field "id_format_xml" to "1"
And I press "Export questions to file" And I press "Export questions to file"
Then following "click here" should download between "1200" and "1450" bytes Then following "click here" should download between "1200" and "1450" bytes

View file

@ -6,20 +6,18 @@ Feature: Test importing Short answer questions
Background: Background:
Given the following "users" exist: Given the following "users" exist:
| username | firstname | lastname | email | | username |
| teacher1 | T1 | Teacher1 | teacher1@example.com | | teacher |
And the following "courses" exist: And the following "courses" exist:
| fullname | shortname | category | | fullname | shortname | category |
| Course 1 | C1 | 0 | | Course 1 | C1 | 0 |
And the following "course enrolments" exist: And the following "course enrolments" exist:
| user | course | role | | user | course | role |
| teacher1 | C1 | editingteacher | | teacher | C1 | editingteacher |
And I log in as "teacher1"
And I am on "Course 1" course homepage
@javascript @_file_upload @javascript @_file_upload
Scenario: import Matching question. Scenario: import Matching 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_xml" to "1" 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 upload "question/type/shortanswer/tests/fixtures/testquestion.moodle.xml" file to "Import" filemanager
And I press "id_submitbutton" And I press "id_submitbutton"

View file

@ -6,29 +6,25 @@ Feature: Preview a Short answer question
Background: Background:
Given the following "users" exist: Given the following "users" exist:
| username | firstname | lastname | email | | username |
| teacher1 | T1 | Teacher1 | teacher1@moodle.com | | teacher |
And the following "courses" exist: And the following "courses" exist:
| fullname | shortname | category | | fullname | shortname | category |
| Course 1 | C1 | 0 | | Course 1 | C1 | 0 |
And the following "course enrolments" exist: And the following "course enrolments" exist:
| user | course | role | | user | course | role |
| teacher1 | C1 | editingteacher | | teacher | C1 | editingteacher |
And the following "question categories" exist: And the following "question categories" exist:
| contextlevel | reference | name | | contextlevel | reference | name |
| Course | C1 | Test questions | | Course | C1 | Test questions |
And the following "questions" exist: And the following "questions" exist:
| questioncategory | qtype | name | template | | questioncategory | qtype | name | template |
| Test questions | shortanswer | shortanswer-001 | frogtoad | | Test questions | shortanswer | shortanswer-001 | frogtoad |
Given I log in as "teacher1"
And I am on "Course 1" course homepage
And I navigate to "Question bank" in current page administration
@javascript @_switch_window @javascript @_switch_window
Scenario: Preview a Short answer question with correct answer Scenario: Preview a Short answer question with correct answer
When I choose "Preview" action for "shortanswer-001" in the question bank When I am on the "shortanswer-001" "core_question > preview" page logged in as teacher
And I switch to "questionpreview" window And I should see "Name an amphibian:"
Then I should see "Name an amphibian:"
# Set behaviour options # Set behaviour options
And I set the following fields to these values: And I set the following fields to these values:
| behaviour | immediatefeedback | | behaviour | immediatefeedback |
@ -41,9 +37,8 @@ Feature: Preview a Short answer question
@javascript @_switch_window @javascript @_switch_window
Scenario: Preview a Short answer question with almost correct answer Scenario: Preview a Short answer question with almost correct answer
When I choose "Preview" action for "shortanswer-001" in the question bank When I am on the "shortanswer-001" "core_question > preview" page logged in as teacher
And I switch to "questionpreview" window And I should see "Name an amphibian:"
Then I should see "Name an amphibian:"
# Set behaviour options # Set behaviour options
And I set the following fields to these values: And I set the following fields to these values:
| behaviour | immediatefeedback | | behaviour | immediatefeedback |
@ -56,9 +51,8 @@ Feature: Preview a Short answer question
@javascript @_switch_window @javascript @_switch_window
Scenario: Preview a Short answer question with incorrect answer Scenario: Preview a Short answer question with incorrect answer
When I choose "Preview" action for "shortanswer-001" in the question bank When I am on the "shortanswer-001" "core_question > preview" page logged in as teacher
And I switch to "questionpreview" window And I should see "Name an amphibian:"
Then I should see "Name an amphibian:"
# Set behaviour options # Set behaviour options
And I set the following fields to these values: And I set the following fields to these values:
| behaviour | immediatefeedback | | behaviour | immediatefeedback |

View file

@ -6,20 +6,18 @@ Feature: Test creating a True/False question
Background: Background:
Given the following "users" exist: Given the following "users" exist:
| username | firstname | lastname | email | | username |
| teacher1 | T1 | Teacher1 | teacher1@moodle.com | | teacher |
And the following "courses" exist: And the following "courses" exist:
| fullname | shortname | category | | fullname | shortname | category |
| Course 1 | C1 | 0 | | Course 1 | C1 | 0 |
And the following "course enrolments" exist: And the following "course enrolments" exist:
| user | course | role | | user | course | role |
| teacher1 | C1 | editingteacher | | teacher | C1 | editingteacher |
And I log in as "teacher1"
And I am on "Course 1" course homepage
And I navigate to "Question bank" in current page administration
Scenario: Create a True/False question with Correct answer as False Scenario: Create a True/False question with Correct answer as False
When I add a "True/False" question filling the form with: When I am on the "Course 1" "core_question > course question bank" page logged in as teacher
And I add a "True/False" question filling the form with:
| Question name | true-false-001 | | Question name | true-false-001 |
| Question text | Manchester is the capital city of England. | | Question text | Manchester is the capital city of England. |
| Default mark | 1 | | Default mark | 1 |
@ -30,7 +28,8 @@ Feature: Test creating a True/False question
Then I should see "true-false-001" Then I should see "true-false-001"
Scenario: Create a True/False question with Correct answer as True Scenario: Create a True/False question with Correct answer as True
When I add a "True/False" question filling the form with: When I am on the "Course 1" "core_question > course question bank" page logged in as teacher
And I add a "True/False" question filling the form with:
| Question name | true-false-002 | | Question name | true-false-002 |
| Question text | London is the capital city of England. | | Question text | London is the capital city of England. |
| Default mark | 1 | | Default mark | 1 |

View file

@ -19,16 +19,16 @@ Feature: Test duplicating a quiz containing a True/False question
| quiz | Test quiz | C1 | quiz1 | | quiz | Test quiz | C1 | quiz1 |
And quiz "Test quiz" contains the following questions: And quiz "Test quiz" contains the following questions:
| true-false-001 | 1 | | true-false-001 | 1 |
And I log in as "admin"
And I am on "Course 1" course homepage
@javascript @javascript
Scenario: Backup and restore a course containing a True/False question Scenario: Backup and restore a course containing a True/False question
When I backup "Course 1" course using this options: When I am on the "Course 1" course page logged in as admin
And I backup "Course 1" course using this options:
| Confirmation | Filename | test_backup.mbz | | Confirmation | Filename | test_backup.mbz |
And I restore "test_backup.mbz" backup into a new course using this options: And I restore "test_backup.mbz" backup into a new course using this options:
| Schema | Course name | Course 2 | | Schema | Course name | Course 2 |
And I navigate to "Question bank" in current page administration | Schema | Course short name | C2 |
And I am on the "Course 2" "core_question > course question bank" page
And I choose "Edit question" action for "true-false-001" in the question bank And I choose "Edit question" action for "true-false-001" in the question bank
Then the following fields match these values: Then the following fields match these values:
| Question name | true-false-001 | | Question name | true-false-001 |

View file

@ -6,31 +6,28 @@ Feature: Test editing a True/False question
Background: Background:
Given the following "users" exist: Given the following "users" exist:
| username | firstname | lastname | email | | username |
| teacher1 | T1 | Teacher1 | teacher1@example.com | | teacher |
And the following "courses" exist: And the following "courses" exist:
| fullname | shortname | category | | fullname | shortname | category |
| Course 1 | C1 | 0 | | Course 1 | C1 | 0 |
And the following "course enrolments" exist: And the following "course enrolments" exist:
| user | course | role | | user | course | role |
| teacher1 | C1 | editingteacher | | teacher | C1 | editingteacher |
And the following "question categories" exist: And the following "question categories" exist:
| contextlevel | reference | name | | contextlevel | reference | name |
| Course | C1 | Test questions | | Course | C1 | Test questions |
And the following "questions" exist: And the following "questions" exist:
| questioncategory | qtype | name | template | | questioncategory | qtype | name | template |
| Test questions | truefalse | true-false-001 | true | | Test questions | truefalse | true-false-001 | true |
And I log in as "teacher1"
And I am on "Course 1" course homepage
And I navigate to "Question bank" in current page administration
Scenario: Edit a True/False question Scenario: Edit a True/False question
When I choose "Edit question" action for "true-false-001" in the question bank When I am on the "true-false-001" "core_question > edit" page logged in as teacher
And I set the following fields to these values: And I set the following fields to these values:
| Question name | | | Question name | |
And I press "id_submitbutton" And I press "id_submitbutton"
Then I should see "You must supply a value here." Then I should see "You must supply a value here."
When I set the following fields to these values: And I set the following fields to these values:
| Question name | Edited true-false-001 name | | Question name | Edited true-false-001 name |
And I press "id_submitbutton" And I press "id_submitbutton"
Then I should see "Edited true-false-001 name" And I should see "Edited true-false-001 name"

View file

@ -6,25 +6,23 @@ Feature: Test exporting True/False questions
Background: Background:
Given the following "users" exist: Given the following "users" exist:
| username | firstname | lastname | email | | username |
| teacher1 | T1 | Teacher1 | teacher1@example.com | | teacher |
And the following "courses" exist: And the following "courses" exist:
| fullname | shortname | category | | fullname | shortname | category |
| Course 1 | C1 | 0 | | Course 1 | C1 | 0 |
And the following "course enrolments" exist: And the following "course enrolments" exist:
| user | course | role | | user | course | role |
| teacher1 | C1 | editingteacher | | teacher | C1 | editingteacher |
And the following "question categories" exist: And the following "question categories" exist:
| contextlevel | reference | name | | contextlevel | reference | name |
| Course | C1 | Test questions | | Course | C1 | Test questions |
And the following "questions" exist: And the following "questions" exist:
| questioncategory | qtype | name | template | | questioncategory | qtype | name | template |
| Test questions | truefalse | true-false-001 | true | | Test questions | truefalse | true-false-001 | true |
And I log in as "teacher1"
And I am on "Course 1" course homepage
Scenario: Export a True/False question Scenario: Export a True/False question
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 teacher
And I set the field "id_format_xml" to "1" And I set the field "id_format_xml" to "1"
And I press "Export questions to file" And I press "Export questions to file"
Then following "click here" should download between "1000" and "1200" bytes Then following "click here" should download between "1000" and "1200" bytes

View file

@ -6,20 +6,18 @@ Feature: Test importing True/False questions
Background: Background:
Given the following "users" exist: Given the following "users" exist:
| username | firstname | lastname | email | | username |
| teacher1 | T1 | Teacher1 | teacher1@example.com | | teacher |
And the following "courses" exist: And the following "courses" exist:
| fullname | shortname | category | | fullname | shortname | category |
| Course 1 | C1 | 0 | | Course 1 | C1 | 0 |
And the following "course enrolments" exist: And the following "course enrolments" exist:
| user | course | role | | user | course | role |
| teacher1 | C1 | editingteacher | | teacher | C1 | editingteacher |
And I log in as "teacher1"
And I am on "Course 1" course homepage
@javascript @_file_upload @javascript @_file_upload
Scenario: import a True/False question. Scenario: import a True/False 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_xml" to "1" 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 upload "question/type/truefalse/tests/fixtures/testquestion.moodle.xml" file to "Import" filemanager
And I press "id_submitbutton" And I press "id_submitbutton"

View file

@ -6,40 +6,36 @@ Feature: Preview a Trtue/False question
Background: Background:
Given the following "users" exist: Given the following "users" exist:
| username | firstname | lastname | email | | username |
| teacher1 | T1 | Teacher1 | teacher1@moodle.com | | teacher |
And the following "courses" exist: And the following "courses" exist:
| fullname | shortname | category | | fullname | shortname | category |
| Course 1 | C1 | 0 | | Course 1 | C1 | 0 |
And the following "course enrolments" exist: And the following "course enrolments" exist:
| user | course | role | | user | course | role |
| teacher1 | C1 | editingteacher | | teacher | C1 | editingteacher |
And the following "question categories" exist: And the following "question categories" exist:
| contextlevel | reference | name | | contextlevel | reference | name |
| Course | C1 | Test questions | | Course | C1 | Test questions |
And the following "questions" exist: And the following "questions" exist:
| questioncategory | qtype | name | template | | questioncategory | qtype | name | template |
| Test questions | truefalse | true-false-001 | true | | Test questions | truefalse | true-false-001 | true |
Given I log in as "teacher1"
And I am on "Course 1" course homepage
And I navigate to "Question bank" in current page administration
@javascript @_switch_window @javascript @_switch_window
Scenario: Preview a True/False question and submit a correct response. Scenario: Preview a True/False question and submit a correct response.
When I choose "Preview" action for "true-false-001" in the question bank When I am on the "true-false-001" "core_question > preview" page logged in as teacher
And I switch to "questionpreview" window And I expand all fieldsets
And I set the field "How questions behave" to "Immediate feedback" And I set the field "How questions behave" to "Immediate feedback"
And I press "Start again with these options" And I press "Start again with these options"
And I click on "True" "radio" And I click on "True" "radio"
And I press "Check" And I press "Check"
And I should see "This is the right answer." And I should see "This is the right answer."
And I should see "The correct answer is 'True'." And I should see "The correct answer is 'True'."
And I switch to the main window
@javascript @_switch_window @javascript @_switch_window
Scenario: Preview a True/False question and submit an incorrect response. Scenario: Preview a True/False question and submit an incorrect response.
When I choose "Preview" action for "true-false-001" in the question bank When I am on the "true-false-001" "core_question > preview" page logged in as teacher
And I switch to "questionpreview" window And I expand all fieldsets
And I set the field "How questions behave" to "Immediate feedback" And I set the field "How questions behave" to "Immediate feedback"
And I press "Start again with these options" And I press "Start again with these options"
And I click on "False" "radio" And I click on "False" "radio"
@ -47,4 +43,3 @@ Feature: Preview a Trtue/False question
And I should see "This is the wrong answer." And I should see "This is the wrong answer."
And I should see "You should have selected true." And I should see "You should have selected true."
And I should see "The correct answer is 'True'." And I should see "The correct answer is 'True'."
And I switch to the main window