MDL-87095 behat: reorganize lesson question importing tests
This commit is contained in:
@@ -1,38 +0,0 @@
|
||||
@mod @mod_lesson
|
||||
Feature: In a lesson activity, teacher can import blackboard fill in the blank question
|
||||
As a teacher
|
||||
I need to import a fill in the blank question made in Blackboard in a lesson
|
||||
|
||||
@javascript @_file_upload
|
||||
Scenario: Import fill in the blank question in a lesson
|
||||
Given the following "users" exist:
|
||||
| username | firstname | lastname | email |
|
||||
| teacher1 | Teacher | 1 | teacher1@example.com |
|
||||
| student1 | Student | 1 | student1@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 |
|
||||
| student1 | C1 | student |
|
||||
And the following "activity" exists:
|
||||
| course | C1 |
|
||||
| activity | lesson |
|
||||
| name | Test lesson name |
|
||||
When I am on the "Test lesson name" "lesson activity" page logged in as teacher1
|
||||
And I follow "Import questions"
|
||||
And I set the field "File format" to "Blackboard"
|
||||
And I upload "mod/lesson/tests/fixtures/sample_blackboard_fib_qti.dat" file to "Upload" filemanager
|
||||
And I press "Import"
|
||||
Then I should see "Importing 1 questions"
|
||||
And I should see "Name an amphibian: __________"
|
||||
And I press "Continue"
|
||||
And I should not see "__________"
|
||||
And I should not see "Your answer"
|
||||
And I set the field "id_answer" to "frog"
|
||||
And I press "Submit"
|
||||
And I should see "Your answer : frog"
|
||||
And I should see "A frog is an amphibian"
|
||||
And I press "Continue"
|
||||
And I should see "Congratulations - end of lesson reached"
|
||||
@@ -1,35 +0,0 @@
|
||||
@mod @mod_lesson
|
||||
Feature: In a lesson activity, teacher can import embedded images in questions answers and responses
|
||||
As a teacher
|
||||
I need to import a question with images in answers and responses in a lesson
|
||||
|
||||
@javascript @_file_upload
|
||||
Scenario: Import questions with images in answers and responses in a lesson
|
||||
Given the following "users" exist:
|
||||
| username | firstname | lastname | email |
|
||||
| teacher1 | Teacher | 1 | teacher1@example.com |
|
||||
| student1 | Student | 1 | student1@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 |
|
||||
| student1 | C1 | student |
|
||||
And the following "activity" exists:
|
||||
| course | C1 |
|
||||
| activity | lesson |
|
||||
| name | Test lesson name |
|
||||
When I am on the "Test lesson name" "lesson activity" page logged in as teacher1
|
||||
And I follow "Import questions"
|
||||
And I set the field "File format" to "Moodle XML format"
|
||||
And I upload "mod/lesson/tests/fixtures/multichoice.xml" file to "Upload" filemanager
|
||||
And I press "Import"
|
||||
Then I should see "Importing 1 questions"
|
||||
And I should see " Listen to this greeting:"
|
||||
And I should see "What language is being spoken?"
|
||||
And I press "Continue"
|
||||
And I should see "What language is being spoken?"
|
||||
And "//audio[contains(@title, 'Listen to this greeting:')]/source[contains(@src, 'bonjour.mp3')]" "xpath_element" should exist
|
||||
And "//*[contains(@class, 'answeroption')]//img[contains(@src, 'pluginfile.php')]" "xpath_element" should exist
|
||||
And "//*[contains(@class, 'answeroption')]//img[contains(@src, 'flag-france.jpg')]" "xpath_element" should exist
|
||||
@@ -1,5 +1,7 @@
|
||||
@mod @mod_lesson @_file_upload
|
||||
Feature: Teacher can import questions into a lesson activity
|
||||
@mod @mod_lesson
|
||||
Feature: Import questions into a lesson from multiple formats
|
||||
As a teacher
|
||||
I want to import question files in different formats into a lesson so images and audio are preserved
|
||||
|
||||
Background:
|
||||
Given the following "users" exist:
|
||||
@@ -12,35 +14,57 @@ Feature: Teacher can import questions into a lesson activity
|
||||
| user | course | role |
|
||||
| teacher1 | C1 | editingteacher |
|
||||
And the following "activities" exist:
|
||||
| activity | name | course |
|
||||
| lesson | Import lesson | C1 |
|
||||
| activity | name | course |
|
||||
| lesson | Test lesson name | C1 |
|
||||
|
||||
@javascript
|
||||
Scenario: Teacher imports questions using Moodle XML (image is displayed)
|
||||
Given I am on the "Import lesson" "lesson activity" page logged in as "teacher1"
|
||||
And I follow "Import questions"
|
||||
And I set the field "File format" to "Moodle XML"
|
||||
When I upload "mod/lesson/tests/fixtures/multichoice.xml" file to "Upload" filemanager
|
||||
And I press "Import"
|
||||
And I press "Continue"
|
||||
Then I should see "Lesson is currently being previewed."
|
||||
And "//img[contains(@src, 'pluginfile.php')]" "xpath_element" should exist
|
||||
And I press "Edit page contents"
|
||||
And I set the field "Page contents" to "Edited page contents"
|
||||
And I press "Save page"
|
||||
And I should see "Edited page contents"
|
||||
|
||||
@javascript
|
||||
Scenario: Teacher imports questions using GIFT (images are not displayed)
|
||||
Given I am on the "Import lesson" "lesson activity" page logged in as "teacher1"
|
||||
@javascript @_file_upload
|
||||
Scenario: Imports questions using GIFT format and edits page contents
|
||||
Given I am on the "Test lesson name" "lesson activity" page logged in as "teacher1"
|
||||
And I follow "Import questions"
|
||||
And I set the field "File format" to "GIFT"
|
||||
When I upload "mod/lesson/tests/fixtures/lesson_import_questions.gift" file to "Upload" filemanager
|
||||
When I upload "mod/lesson/tests/fixtures/moodle_questions.gift" file to "Upload" filemanager
|
||||
And I press "Import"
|
||||
And I press "Continue"
|
||||
Then I should see "Lesson is currently being previewed."
|
||||
And "//img[contains(@src, 'pluginfile.php')]" "xpath_element" should not exist
|
||||
And I should see "Match the activity to the description."
|
||||
And I should see "An activity supporting asynchronous discussions."
|
||||
And I should see "A teacher asks a question and specifies a choice of multiple responses."
|
||||
And I press "Edit page contents"
|
||||
And I set the field "Page contents" to "Edited page contents"
|
||||
And I set the field "Page contents" to "Match the activity to the description (Edited)"
|
||||
And I press "Save page"
|
||||
And I should see "Edited page contents"
|
||||
And I should see "Match the activity to the description (Edited)"
|
||||
|
||||
@javascript @_file_upload
|
||||
Scenario: Import questions in XML format with images and audio in answers and responses
|
||||
Given I am on the "Test lesson name" "lesson activity" page logged in as teacher1
|
||||
And I follow "Import questions"
|
||||
And I set the field "File format" to "Moodle XML format"
|
||||
When I upload "mod/lesson/tests/fixtures/multichoice.xml" file to "Upload" filemanager
|
||||
And I press "Import"
|
||||
Then I should see "Importing 1 questions"
|
||||
And I should see " Listen to this greeting:"
|
||||
And I should see "What language is being spoken?"
|
||||
And I press "Continue"
|
||||
And I should see "What language is being spoken?"
|
||||
And "//audio[contains(@title, 'Listen to this greeting:')]/source[contains(@src, 'bonjour.mp3')]" "xpath_element" should exist
|
||||
And "//*[contains(@class, 'answeroption')]//img[contains(@src, 'pluginfile.php')]" "xpath_element" should exist
|
||||
And "//*[contains(@class, 'answeroption')]//img[contains(@src, 'flag-france.jpg')]" "xpath_element" should exist
|
||||
|
||||
@javascript @_file_upload
|
||||
Scenario: Import fill in the blank question in a lesson
|
||||
Given I am on the "Test lesson name" "lesson activity" page logged in as teacher1
|
||||
And I follow "Import questions"
|
||||
And I set the field "File format" to "Blackboard"
|
||||
When I upload "mod/lesson/tests/fixtures/sample_blackboard_fib_qti.dat" file to "Upload" filemanager
|
||||
And I press "Import"
|
||||
Then I should see "Importing 1 questions"
|
||||
And I should see "Name an amphibian: __________"
|
||||
And I press "Continue"
|
||||
And I should not see "__________"
|
||||
And I should not see "Your answer"
|
||||
And I set the field "id_answer" to "frog"
|
||||
And I press "Submit"
|
||||
And I should see "Your answer : frog"
|
||||
And I should see "A frog is an amphibian"
|
||||
And I press "Continue"
|
||||
And I should see "Congratulations - end of lesson reached"
|
||||
|
||||
@@ -1,12 +0,0 @@
|
||||
::MC question::
|
||||
What is 2 + 2?
|
||||
<img src="example.png" alt="Example image">
|
||||
{
|
||||
=4
|
||||
~3
|
||||
}
|
||||
|
||||
::Essay question::
|
||||
Describe something.
|
||||
<img src="example.png" alt="Example image">
|
||||
{}
|
||||
+19
@@ -0,0 +1,19 @@
|
||||
// question: 0 name: switch category to $course$/Default for New Features
|
||||
$CATEGORY: $course$/Default for New Features
|
||||
|
||||
// question: 44 name: Moodle activities
|
||||
::Moodle activities::[html]Match the activity to the description.{
|
||||
=An activity supporting asynchronous discussions. -> Forum
|
||||
=A teacher asks a question and specifies a choice of multiple responses. -> Choice
|
||||
=A bank of record entries which participants can add to. -> Database
|
||||
=A collection of web pages that anyone can add to or edit. -> Wiki
|
||||
= -> Chat
|
||||
}
|
||||
|
||||
// question: 46 name: Moodle user
|
||||
::Moodle user::[html]Anyone who uses Moodle is a ...{
|
||||
=%100%Moodler#
|
||||
}
|
||||
|
||||
// question: 45 name: Moodle acronym
|
||||
::Moodle acronym::[html]Moodle is an acronym for <span style\="font-style\: italic;">Modular Object-Oriented Dynamic Learning Environment</span>.{TRUE}
|
||||
Reference in New Issue
Block a user