Commit cad67991 authored by Eloy Lafuente (stronk7)'s avatar Eloy Lafuente (stronk7)

Merge branch 'MDL-52964' of https://github.com/mkassaei/moodle

parents 83fe83e9 50aaf13e
@qtype @qtype_description
Feature: Test creating a Description question
As a teacher
In order to test my students
I need to be able to create a Description question
Background:
Given the following "users" exist:
| username | firstname | lastname | email |
| teacher1 | T1 | Teacher1 | teacher1@moodle.com |
And the following "courses" exist:
| fullname | shortname | category |
| Course 1 | C1 | 0 |
And the following "course enrolments" exist:
| user | course | role |
| teacher1 | C1 | editingteacher |
And I log in as "teacher1"
And I follow "Course 1"
And I navigate to "Question bank" node in "Course administration"
@javascript
Scenario: Create a Description question with Correct answer as False
When I add a "Description" question filling the form with:
| Question name | description-001 |
| Question text | Instructions about the following questions. |
| General feedback | Why actually the field 'General feedback' used in this qytype? |
Then I should see "description-001"
@qtype @qtype_description
Feature: Test duplicating a quiz containing a Description question
As a teacher
In order re-use my courses containing Description questions
I need to be able to backup and restore them
Background:
And the following "courses" exist:
| fullname | shortname | category |
| Course 1 | C1 | 0 |
And the following "question categories" exist:
| contextlevel | reference | name |
| Course | C1 | Test questions |
And the following "questions" exist:
| questioncategory | qtype | name | template |
| Test questions | description | description-001 | info |
And the following "activities" exist:
| activity | name | course | idnumber |
| quiz | Test quiz | C1 | quiz1 |
And quiz "Test quiz" contains the following questions:
| description-001 | 1 |
And I log in as "admin"
And I am on site homepage
And I follow "Course 1"
@javascript
Scenario: Backup and restore a course containing a Description question
When I backup "Course 1" course using this options:
| Confirmation | Filename | test_backup.mbz |
And I restore "test_backup.mbz" backup into a new course using this options:
| Schema | Course name | Course 2 |
And I navigate to "Question bank" node in "Course administration"
And I click on "Edit" "link" in the "description-001" "table_row"
Then the following fields match these values:
| Question name | description-001 |
| Question text | Here is some information about the questions you are about to attempt. |
| General feedback | And here is some more text shown only on the review page. |
@qtype @qtype_description
Feature: Test editing a Description question
As a teacher
In order to be able to update my Description question
I need to edit them
Background:
Given the following "users" exist:
| username | firstname | lastname | email |
| teacher1 | T1 | Teacher1 | teacher1@example.com |
And the following "courses" exist:
| fullname | shortname | category |
| Course 1 | C1 | 0 |
And the following "course enrolments" exist:
| user | course | role |
| teacher1 | C1 | editingteacher |
And the following "question categories" exist:
| contextlevel | reference | name |
| Course | C1 | Test questions |
And the following "questions" exist:
| questioncategory | qtype | name | template |
| Test questions | description | description-001 | info |
And I log in as "teacher1"
And I follow "Course 1"
And I navigate to "Question bank" node in "Course administration"
@javascript
Scenario: Edit a Description question
When I click on "Edit" "link" in the "description-001" "table_row"
And I set the following fields to these values:
| Question name | |
And I press "id_submitbutton"
Then I should see "You must supply a value here."
When I set the following fields to these values:
| Question name | Edited description-001 name |
And I press "id_submitbutton"
Then I should see "Edited description-001 name"
@qtype @qtype_description
Feature: Test exporting Description questions
As a teacher
In order to be able to reuse my Description questions
I need to export them
Background:
Given the following "users" exist:
| username | firstname | lastname | email |
| teacher1 | T1 | Teacher1 | teacher1@example.com |
And the following "courses" exist:
| fullname | shortname | category |
| Course 1 | C1 | 0 |
And the following "course enrolments" exist:
| user | course | role |
| teacher1 | C1 | editingteacher |
And the following "question categories" exist:
| contextlevel | reference | name |
| Course | C1 | Test questions |
And the following "questions" exist:
| questioncategory | qtype | name | template |
| Test questions | description | description-001 | info |
And I log in as "teacher1"
And I follow "Course 1"
@javascript
Scenario: Export a Description question
When I navigate to "Export" node in "Course administration > Question bank"
And I set the field "id_format_xml" to "1"
And I press "Export questions to file"
Then following "click here" should download between "650" and "750" bytes
# 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
# has already conducted its reset (generating an error). By putting a logout
# step we avoid behat doing the reset until we are off that page.
And I log out
@qtype @qtype_description
Feature: Test importing Description questions
As a teacher
In order to reuse Description questions
I need to import them
Background:
Given the following "users" exist:
| username | firstname | lastname | email |
| teacher1 | T1 | Teacher1 | teacher1@example.com |
And the following "courses" exist:
| fullname | shortname | category |
| Course 1 | C1 | 0 |
And the following "course enrolments" exist:
| user | course | role |
| teacher1 | C1 | editingteacher |
And I log in as "teacher1"
And I follow "Course 1"
@javascript @_file_upload
Scenario: import a Description question.
When I navigate to "Import" node in "Course administration > Question bank"
And I set the field "id_format_xml" to "1"
And I upload "question/type/description/tests/fixtures/testquestion.moodle.xml" file to "Import" filemanager
And I press "id_submitbutton"
Then I should see "Parsing questions from import file."
And I should see "Importing 1 questions from file"
And I should see "Instructions about the following questions."
And I press "Continue"
And I should see "description-001"
@qtype @qtype_description
Feature: Preview a Description question
As a teacher
In order to check my Description questions will work for students
I need to preview them
Background:
Given the following "users" exist:
| username | firstname | lastname | email |
| teacher1 | T1 | Teacher1 | teacher1@moodle.com |
And the following "courses" exist:
| fullname | shortname | category |
| Course 1 | C1 | 0 |
And the following "course enrolments" exist:
| user | course | role |
| teacher1 | C1 | editingteacher |
And the following "question categories" exist:
| contextlevel | reference | name |
| Course | C1 | Test questions |
And the following "questions" exist:
| questioncategory | qtype | name | template |
| Test questions | description | description-001 | info |
Given I log in as "teacher1"
And I follow "Course 1"
And I navigate to "Question bank" node in "Course administration"
@javascript
Scenario: Preview a question and submit a correct response.
When I click on "Preview" "link" in the "description-001" "table_row"
And I switch to "questionpreview" window
And I set the field "How questions behave" to "Immediate feedback"
And I press "Start again with these options"
And I should see "Here is some information about the questions you are about to attempt."
And I switch to the main window
<?xml version="1.0" encoding="UTF-8"?>
<quiz>
<!-- question: 0 -->
<question type="category">
<category>
<text>$course$/Default for C1</text>
</category>
</question>
<!-- question: 115000 -->
<question type="description">
<name>
<text>description-001</text>
</name>
<questiontext format="html">
<text>Instructions about the following questions.</text>
</questiontext>
<generalfeedback format="html">
<text>Why actually the field 'General feedback' used in this qytype?</text>
</generalfeedback>
<defaultgrade>0.0000000</defaultgrade>
<penalty>0.0000000</penalty>
<hidden>0</hidden>
</question>
</quiz>
@qtype @qtype_essay
Feature: Test creating an Essay question
As a teacher
In order to test my students
I need to be able to create an Essay question
Background:
Given the following "users" exist:
| username | firstname | lastname | email |
| teacher1 | T1 | Teacher1 | teacher1@moodle.com |
And the following "courses" exist:
| fullname | shortname | category |
| Course 1 | C1 | 0 |
And the following "course enrolments" exist:
| user | course | role |
| teacher1 | C1 | editingteacher |
And I log in as "teacher1"
And I follow "Course 1"
And I navigate to "Question bank" node in "Course administration"
@javascript
Scenario: Create an Essay question with Response format set to 'HTML editor'
When I add a "Essay" question filling the form with:
| Question name | essay-001 |
| Question text | Write an essay with 500 words. |
| General feedback | This is general feedback |
| Response format | HTML editor |
Then I should see "essay-001"
@javascript
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:
| Question name | essay-002 |
| Question text | Write an essay with 500 words. |
| General feedback | This is general feedback |
| Response format | HTML editor |
Then I should see "essay-002"
@qtype @qtype_essay
Feature: Test duplicating a quiz containing an Assay question
As a teacher
In order re-use my courses containing Essay questions
I need to be able to backup and restore them
Background:
And the following "courses" exist:
| fullname | shortname | category |
| Course 1 | C1 | 0 |
And the following "question categories" exist:
| contextlevel | reference | name |
| Course | C1 | Test questions |
And the following "questions" exist:
| questioncategory | qtype | name | template |
| Test questions | essay | essay-001 | editor |
| Test questions | essay | essay-002 | editorfilepicker |
| Test questions | essay | essay-003 | plain |
And the following "activities" exist:
| activity | name | course | idnumber |
| quiz | Test quiz | C1 | quiz1 |
And quiz "Test quiz" contains the following questions:
| essay-001 | 1 |
| essay-002 | 1 |
| essay-003 | 1 |
And I log in as "admin"
And I am on site homepage
And I follow "Course 1"
@javascript
Scenario: Backup and restore a course containing 3 Essay questions
When I backup "Course 1" course using this options:
| Confirmation | Filename | test_backup.mbz |
And I restore "test_backup.mbz" backup into a new course using this options:
| Schema | Course name | Course 2 |
And I navigate to "Question bank" node in "Course administration"
And I should see "essay-001"
And I should see "essay-002"
And I should see "essay-003"
And I click on "Edit" "link" in the "essay-001" "table_row"
Then the following fields match these values:
| Question name | essay-001 |
| Question text | Please write a story about a frog. |
| General feedback | I hope your story had a beginning, a middle and an end. |
| Response format | HTML editor |
| Require text | Require the student to enter text |
And I press "Cancel"
And I click on "Edit" "link" in the "essay-002" "table_row"
Then the following fields match these values:
| Question name | essay-002 |
| Question text | Please write a story about a frog. |
| General feedback | I hope your story had a beginning, a middle and an end. |
| Response format | HTML editor with file picker |
| Require text | Require the student to enter text |
And I press "Cancel"
And I click on "Edit" "link" in the "essay-003" "table_row"
Then the following fields match these values:
| Question name | essay-003 |
| Question text | Please write a story about a frog. |
| General feedback | I hope your story had a beginning, a middle and an end. |
| Response format | Plain text |
| Require text | Require the student to enter text |
@qtype @qtype_essay
Feature: Test editing an Essay question
As a teacher
In order to be able to update my Essay question
I need to edit them
Background:
Given the following "users" exist:
| username | firstname | lastname | email |
| teacher1 | T1 | Teacher1 | teacher1@example.com |
And the following "courses" exist:
| fullname | shortname | category |
| Course 1 | C1 | 0 |
And the following "course enrolments" exist:
| user | course | role |
| teacher1 | C1 | editingteacher |
And the following "question categories" exist:
| contextlevel | reference | name |
| Course | C1 | Test questions |
And the following "questions" exist:
| questioncategory | qtype | name | template |
| Test questions | essay | essay-001 | editor |
| Test questions | essay | essay-002 | editorfilepicker |
| Test questions | essay | essay-003 | plain |
And I log in as "teacher1"
And I follow "Course 1"
And I navigate to "Question bank" node in "Course administration"
@javascript
Scenario: Edit an Essay question
When I click on "Edit" "link" in the "essay-001" "table_row"
And I set the following fields to these values:
| Question name | |
And I press "id_submitbutton"
Then I should see "You must supply a value here."
When I set the following fields to these values:
| Question name | Edited essay-001 name |
| Response format | No inline text |
And I press "id_submitbutton"
Then I should see "When \"no inline text\" is selected, or responses are optional, you must allow at least one attachment."
When I set the following fields to these values:
| Response format | Plain text |
And I press "id_submitbutton"
Then I should see "Edited essay-001 name"
@qtype @qtype_essay
Feature: Test exporting Essay questions
As a teacher
In order to be able to reuse my Essay questions
I need to export them
Background:
Given the following "users" exist:
| username | firstname | lastname | email |
| teacher1 | T1 | Teacher1 | teacher1@example.com |
And the following "courses" exist:
| fullname | shortname | category |
| Course 1 | C1 | 0 |
And the following "course enrolments" exist:
| user | course | role |
| teacher1 | C1 | editingteacher |
And the following "question categories" exist:
| contextlevel | reference | name |
| Course | C1 | Test questions |
And the following "questions" exist:
| questioncategory | qtype | name | template |
| Test questions | essay | essay-001 | editor |
| Test questions | essay | essay-002 | editorfilepicker |
| Test questions | essay | essay-003 | plain |
And I log in as "teacher1"
And I follow "Course 1"
@javascript
Scenario: Export 3 Essay questions
When I navigate to "Export" node in "Course administration > Question bank"
And I set the field "id_format_xml" to "1"
And I press "Export questions to file"
Then following "click here" should download between "2600" and "2700" bytes
# 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
# has already conducted its reset (generating an error). By putting a logout
# step we avoid behat doing the reset until we are off that page.
And I log out
@qtype @qtype_essay
Feature: Test importing Essay questions
As a teacher
In order to reuse Essay questions
I need to import them
Background:
Given the following "users" exist:
| username | firstname | lastname | email |
| teacher1 | T1 | Teacher1 | teacher1@example.com |
And the following "courses" exist:
| fullname | shortname | category |
| Course 1 | C1 | 0 |
And the following "course enrolments" exist:
| user | course | role |
| teacher1 | C1 | editingteacher |
And I log in as "teacher1"
And I follow "Course 1"
@javascript @_file_upload
Scenario: import Essay question.
When I navigate to "Import" node in "Course administration > Question bank"
And I set the field "id_format_xml" to "1"
And I upload "question/type/essay/tests/fixtures/testquestion.moodle.xml" file to "Import" filemanager
And I press "id_submitbutton"
Then I should see "Parsing questions from import file."
And I should see "Importing 1 questions from file"
And I should see "Write an essay with 500 words."
And I press "Continue"
And I should see "essay-001"
@qtype @qtype_essay
Feature: Preview Essay questions
As a teacher
In order to check my Essay questions will work for students
I need to preview them
Background:
Given the following "users" exist:
| username | firstname | lastname | email |
| teacher1 | T1 | Teacher1 | teacher1@moodle.com |
And the following "courses" exist:
| fullname | shortname | category |
| Course 1 | C1 | 0 |
And the following "course enrolments" exist:
| user | course | role |
| teacher1 | C1 | editingteacher |
And the following "question categories" exist:
| contextlevel | reference | name |
| Course | C1 | Test questions |
And the following "questions" exist:
| questioncategory | qtype | name | template |
| Test questions | essay | essay-001 | editor |
| Test questions | essay | essay-002 | editorfilepicker |
| Test questions | essay | essay-003 | plain |
Given I log in as "teacher1"
And I follow "Course 1"
And I navigate to "Question bank" node in "Course administration"
@javascript
Scenario: Preview a question and submit a partially correct response.
When I click on "Preview" "link" in the "essay-001" "table_row"
And I switch to "questionpreview" window
And I set the field "How questions behave" to "Immediate feedback"
And I press "Start again with these options"
And I should see "Please write a story about a frog."
And I switch to the main window
@javascript
Scenario: Preview a question and submit a partially correct response.
When I click on "Preview" "link" in the "essay-002" "table_row"
And I switch to "questionpreview" window
And I set the field "How questions behave" to "Immediate feedback"
And I press "Start again with these options"
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 switch to the main window
@javascript
Scenario: Preview a question and submit a partially correct response.
When I click on "Preview" "link" in the "essay-003" "table_row"
And I switch to "questionpreview" window
And I set the field "How questions behave" to "Immediate feedback"
And I press "Start again with these options"
And I should see "Please write a story about a frog."
And I switch to the main window
<?xml version="1.0" encoding="UTF-8"?>
<quiz>
<!-- question: 0 -->
<question type="category">
<category>
<text>$course$/Default for C1</text>
</category>
</question>
<!-- question: 114000 -->
<question type="essay">
<name>
<text>essay-001</text>
</name>
<questiontext format="html">
<text>Write an essay with 500 words.</text>
</questiontext>
<generalfeedback format="html">
<text>This is general feedback</text>
</generalfeedback>
<defaultgrade>1.0000000</defaultgrade>
<penalty>0.0000000</penalty>
<hidden>0</hidden>
<responseformat>editor</responseformat>
<responserequired>1</responserequired>
<responsefieldlines>15</responsefieldlines>
<attachments>0</attachments>
<attachmentsrequired>0</attachmentsrequired>
<graderinfo format="html">
<text></text>
</graderinfo>
<responsetemplate format="html">
<text></text>
</responsetemplate>
</question>
</quiz>
@qtype @qtype_match
Feature: Test creating a Matching question
As a teacher
In order to test my students
I need to be able to create a Matching question
Background:
Given the following "users" exist:
| username | firstname | lastname | email |
| teacher1 | T1 | Teacher1 | teacher1@moodle.com |
And the following "courses" exist:
| fullname | shortname | category |
| Course 1 | C1 | 0 |
And the following "course enrolments" exist:
| user | course | role |
| teacher1 | C1 | editingteacher |
And I log in as "teacher1"
And I follow "Course 1"
And I navigate to "Question bank" node in "Course administration"
@javascript
Scenario: Create a Matching question with 3 subquestions
When I add a "Matching" question filling the form with:
| Question name | match-001 |
| Question text | Match the country with the capital city. |
| General feedback | England=London, France=Paris and Spain=Madrid. |
| id_subquestions_0 | England |
| id_subanswers_0 | London |
| id_subquestions_1 | France |
| id_subanswers_1 | Paris |
| id_subquestions_2 | Spain |
| id_subanswers_2 | Madrid |
| For any correct response | Your answer is correct |
| For any partially correct response | Your answer is partially correct |
| For any incorrect response | Your answer is incorrect |
| Hint 1 | This is your first hint |
| Hint 2 | This is your second hint |
Then I should see "match-001"
@qtype @qtype_match
Feature: Test duplicating a quiz containing a Matching question
As a teacher
In order re-use my courses containing Matching questions
I need to be able to backup and restore them
Background:
And the following "courses" exist:
| fullname | shortname | category |
| Course 1 | C1 | 0 |
And the following "question categories" exist:
| contextlevel | reference | name |
| Course | C1 | Test questions |
And the following "questions" exist:
| questioncategory | qtype | name | template |
| Test questions | match | matching-001 | foursubq |
And the following "activities" exist:
| activity | name | course | idnumber |
| quiz | Test quiz | C1 | quiz1 |
And quiz "Test quiz" contains the following questions:
| matching-001 | 1 |
And I log in as "admin"
And I am on site homepage
And I follow "Course 1"
@javascript
Scenario: Backup and restore a course containing a Matching question
When I backup "Course 1" course using this options:
| Confirmation | Filename | test_backup.mbz |
And I restore "test_backup.mbz" backup into a new course using this options:
| Schema | Course name | Course 2 |
And I navigate to "Question bank" node in "Course administration"
And I click on "Edit" "link" in the "matching-001" "table_row"
Then the following fields match these values:
| Question name | matching-001 |
| Question text | Classify the animals. |
| General feedback | General feedback. |
| Default mark | 1 |
| Shuffle | 1 |
| Question 1 | frog |
| Question 2 | cat |
| Question 3 | newt |
| Question 4 | |
| id_subanswers_0 | amphibian |
| id_subanswers_1 | mammal |
| id_subanswers_2 | amphibian |
| id_subanswers_3 | insect |
@qtype @qtype_match
Feature: Test editing a Matching question
As a teacher
In order to be able to update my Matching question
I need to edit them
Background:
Given the following "users" exist:
| username | firstname | lastname | email |
| teacher1 | T1 | Teacher1 | teacher1@example.com |
And the following "courses" exist:
| fullname | shortname | category |
| Course 1 | C1 | 0 |
And the following "course enrolments" exist:
| user | course | role |
| teacher1 | C1 | editingteacher |
And the following "question categories" exist:
| contextlevel | reference | name |
| Course | C1 | Test questions |
And the following "questions" exist:
| questioncategory | qtype | name | template |
| Test questions | match | Matching for editing | foursubq |
And I log in as "teacher1"
And I follow "Course 1"
And I navigate to "Question bank" node in "Course administration"
@javascript
Scenario: Edit a Matching question
When I click on "Edit" "link" in the "Matching for editing" "table_row"
And I set the following fields to these values:
| Question name | |
And I press "id_submitbutton"
Then I should see "You must supply a value here."
When I set the following fields to these values:
| Question name | Edited Matching name |
And I press "id_submitbutton"