Merge branch 'MDL-77581-master' of https://github.com/dpalou/moodle
This commit is contained in:
@@ -279,6 +279,17 @@ abstract class behat_generator_base {
|
||||
' data generator is not implemented');
|
||||
}
|
||||
}
|
||||
|
||||
// Notify that the all the elements have been generated.
|
||||
if (method_exists($this->componentdatagenerator, 'finish_generate_' . $generatortype)) {
|
||||
// Using the component's own data generator if it exists.
|
||||
$this->componentdatagenerator->{'finish_generate_' . $generatortype}();
|
||||
|
||||
} else if (method_exists($this->datagenerator, 'finish_generate_' . $generatortype)) {
|
||||
// Use a method on the core data geneator, if there is one.
|
||||
$this->datagenerator->{'finish_generate_' . $generatortype}();
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -24,18 +24,13 @@ Feature: Using the lesson activities which support point scale
|
||||
|
||||
@javascript
|
||||
Scenario: Lesson rescale grade should not be possible when users are graded
|
||||
Given I am on the "Test lesson name" "lesson activity" page logged in as teacher1
|
||||
And I follow "Add a question page"
|
||||
And I set the field "Select a question type" to "Numerical"
|
||||
And I press "Add a question page"
|
||||
And I set the following fields to these values:
|
||||
| Page title | Numerical question |
|
||||
| Page contents | What is 1 + 2? |
|
||||
| id_answer_editor_0 | 3 |
|
||||
| id_jumpto_0 | End of lesson |
|
||||
| id_enableotheranswers | 1 |
|
||||
| id_jumpto_6 | Next page |
|
||||
And I press "Save page"
|
||||
Given the following "mod_lesson > page" exist:
|
||||
| lesson | qtype | title | content |
|
||||
| Test lesson name | numeric | Numerical question | What is 1 + 2? |
|
||||
And the following "mod_lesson > answers" exist:
|
||||
| page | answer | jumpto | score |
|
||||
| Numerical question | 3 | End of lesson | 1 |
|
||||
| Numerical question | @#wronganswer#@ | Next page | 0 |
|
||||
And I am on the "Test lesson name" "lesson activity" page logged in as student1
|
||||
And I set the field "Your answer" to "5"
|
||||
And I press "Submit"
|
||||
|
||||
@@ -10,6 +10,7 @@ information provided here is intended especially for developers.
|
||||
drag/drop, which can be used to add transition effects in calling code
|
||||
* course_modinfo now has a purge_course_modules_cache() method, which takes a list of cmids and purges
|
||||
them all in a single cache set.
|
||||
* Behat generators can now implement the function finish_generate_ to detect when the whole list of elements have been generated.
|
||||
|
||||
=== 4.3 ===
|
||||
|
||||
|
||||
@@ -87,6 +87,29 @@ class lesson_page_type_cluster extends lesson_page {
|
||||
}
|
||||
return $this->properties->nextpageid;
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates answers within the database for this cluster page. Usually only ever
|
||||
* called when creating a new page instance.
|
||||
* @param object $properties
|
||||
* @return array
|
||||
*/
|
||||
public function create_answers($properties) {
|
||||
global $DB;
|
||||
|
||||
$newanswer = new stdClass;
|
||||
$newanswer->lessonid = $this->lesson->id;
|
||||
$newanswer->pageid = $this->properties->id;
|
||||
$newanswer->timecreated = $this->properties->timecreated;
|
||||
|
||||
if (isset($properties->jumpto[0])) {
|
||||
$newanswer->jumpto = $properties->jumpto[0];
|
||||
}
|
||||
$newanswer->id = $DB->insert_record('lesson_answers', $newanswer);
|
||||
$answers = [$newanswer->id => new lesson_page_answer($newanswer)];
|
||||
$this->answers = $answers;
|
||||
return $answers;
|
||||
}
|
||||
}
|
||||
|
||||
class lesson_add_page_form_cluster extends lesson_add_page_form_base {
|
||||
@@ -179,4 +202,4 @@ class lesson_add_page_form_cluster extends lesson_add_page_form_base {
|
||||
$lesson->add_message(get_string('addedcluster', 'lesson'), 'notifysuccess');
|
||||
redirect($CFG->wwwroot.'/mod/lesson/edit.php?id='.$PAGE->cm->id);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -115,6 +115,29 @@ class lesson_page_type_endofbranch extends lesson_page {
|
||||
public function valid_page_and_view(&$validpages, &$pageviews) {
|
||||
return $this->properties->nextpageid;
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates answers within the database for this end of cluster page. Usually only ever
|
||||
* called when creating a new page instance.
|
||||
* @param object $properties
|
||||
* @return array
|
||||
*/
|
||||
public function create_answers($properties) {
|
||||
global $DB;
|
||||
|
||||
$newanswer = new stdClass;
|
||||
$newanswer->lessonid = $this->lesson->id;
|
||||
$newanswer->pageid = $this->properties->id;
|
||||
$newanswer->timecreated = $this->properties->timecreated;
|
||||
|
||||
if (isset($properties->jumpto[0])) {
|
||||
$newanswer->jumpto = $properties->jumpto[0];
|
||||
}
|
||||
$newanswer->id = $DB->insert_record('lesson_answers', $newanswer);
|
||||
$answers = [$newanswer->id => new lesson_page_answer($newanswer)];
|
||||
$this->answers = $answers;
|
||||
return $answers;
|
||||
}
|
||||
}
|
||||
|
||||
class lesson_add_page_form_endofbranch extends lesson_add_page_form_base {
|
||||
|
||||
@@ -95,6 +95,29 @@ class lesson_page_type_endofcluster extends lesson_page {
|
||||
public function valid_page_and_view(&$validpages, &$pageviews) {
|
||||
return $this->properties->nextpageid;
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates answers within the database for this end of cluster page. Usually only ever
|
||||
* called when creating a new page instance.
|
||||
* @param object $properties
|
||||
* @return array
|
||||
*/
|
||||
public function create_answers($properties) {
|
||||
global $DB;
|
||||
|
||||
$newanswer = new stdClass;
|
||||
$newanswer->lessonid = $this->lesson->id;
|
||||
$newanswer->pageid = $this->properties->id;
|
||||
$newanswer->timecreated = $this->properties->timecreated;
|
||||
|
||||
if (isset($properties->jumpto[0])) {
|
||||
$newanswer->jumpto = $properties->jumpto[0];
|
||||
}
|
||||
$newanswer->id = $DB->insert_record('lesson_answers', $newanswer);
|
||||
$answers = [$newanswer->id => new lesson_page_answer($newanswer)];
|
||||
$this->answers = $answers;
|
||||
return $answers;
|
||||
}
|
||||
}
|
||||
|
||||
class lesson_add_page_form_endofcluster extends lesson_add_page_form_base {
|
||||
|
||||
@@ -10,45 +10,24 @@ Feature: Set end of lesson reached as a completion condition for a lesson
|
||||
| student1 | Student | 1 | student1@example.com |
|
||||
| teacher1 | Teacher | 1 | teacher1@example.com |
|
||||
And the following "courses" exist:
|
||||
| fullname | shortname | category |
|
||||
| Course 1 | C1 | 0 |
|
||||
| fullname | shortname | category | enablecompletion |
|
||||
| Course 1 | C1 | 0 | 1 |
|
||||
And the following "course enrolments" exist:
|
||||
| user | course | role |
|
||||
| teacher1 | C1 | editingteacher |
|
||||
| student1 | C1 | student |
|
||||
Given the following "activity" exists:
|
||||
| activity | lesson |
|
||||
| course | C1 |
|
||||
| idnumber | 0001 |
|
||||
| name | Test lesson |
|
||||
And I log in as "teacher1"
|
||||
And I am on "Course 1" course homepage with editing mode on
|
||||
And I navigate to "Settings" in current page administration
|
||||
And I set the following fields to these values:
|
||||
| Enable completion tracking | Yes |
|
||||
And I press "Save and display"
|
||||
And I am on the "Test lesson" "lesson activity editing" page
|
||||
And I set the following fields to these values:
|
||||
| Add requirements | 1 |
|
||||
| completionview | 0 |
|
||||
| completionendreached | 1 |
|
||||
And I press "Save and display"
|
||||
And I follow "Add a content page"
|
||||
And I set the following fields to these values:
|
||||
| Page title | First page name |
|
||||
| Page contents | First page contents |
|
||||
| id_answer_editor_0 | Next page |
|
||||
| id_jumpto_0 | Next page |
|
||||
And I press "Save page"
|
||||
And I select "Add a content page" from the "qtype" singleselect
|
||||
And I set the following fields to these values:
|
||||
| Page title | Second page name |
|
||||
| Page contents | Second page contents |
|
||||
| id_answer_editor_0 | Previous page |
|
||||
| id_jumpto_0 | Previous page |
|
||||
| id_answer_editor_1 | Next page |
|
||||
| id_jumpto_1 | Next page |
|
||||
And I press "Save page"
|
||||
And the following "activity" exist:
|
||||
| activity | name | course | idnumber | completion | completionview | completionendreached |
|
||||
| lesson | Test lesson | C1 | 0001 | 2 | 0 | 1 |
|
||||
And the following "mod_lesson > pages" exist:
|
||||
| lesson | qtype | title | content |
|
||||
| Test lesson | content | First page name | First page contents |
|
||||
| Test lesson | content | Second page name | Second page contents |
|
||||
And the following "mod_lesson > answers" exist:
|
||||
| page | answer | jumpto |
|
||||
| First page name | Next page | Next page |
|
||||
| Second page name | Previous page | Previous page |
|
||||
| Second page name | Next page | Next page |
|
||||
When I am on the "Course 1" course page logged in as student1
|
||||
Then the "Go through the activity to the end" completion condition of "Test lesson" is displayed as "todo"
|
||||
And I follow "Test lesson"
|
||||
|
||||
@@ -6,50 +6,29 @@ Feature: Set time spent as a completion condition for a lesson
|
||||
|
||||
Scenario: Set time spent as a condition
|
||||
Given the following "users" exist:
|
||||
| username | firstname | lastname | email |
|
||||
| student1 | Student | 1 | student1@example.com |
|
||||
| teacher1 | Teacher | 1 | teacher1@example.com |
|
||||
| username | firstname | lastname | email |
|
||||
| student1 | Student | 1 | student1@example.com |
|
||||
| teacher1 | Teacher | 1 | teacher1@example.com |
|
||||
And the following "courses" exist:
|
||||
| fullname | shortname | category |
|
||||
| Course 1 | C1 | 0 |
|
||||
| fullname | shortname | category | enablecompletion |
|
||||
| Course 1 | C1 | 0 | 1 |
|
||||
And the following "course enrolments" exist:
|
||||
| user | course | role |
|
||||
| teacher1 | C1 | editingteacher |
|
||||
| student1 | C1 | student |
|
||||
And the following "activity" exists:
|
||||
| activity | lesson |
|
||||
| course | C1 |
|
||||
| idnumber | 0001 |
|
||||
| name | Test lesson |
|
||||
And I am on the "Course 1" course page logged in as teacher1
|
||||
And I navigate to "Settings" in current page administration
|
||||
And I set the following fields to these values:
|
||||
| Enable completion tracking | Yes |
|
||||
And I press "Save and display"
|
||||
And I am on the "Test lesson" "lesson activity editing" page
|
||||
And I set the following fields to these values:
|
||||
| Add requirements | 1 |
|
||||
| completionview | 0 |
|
||||
| completiontimespentenabled | 1 |
|
||||
| completiontimespent[timeunit] | 1 |
|
||||
| completiontimespent[number] | 5 |
|
||||
And I press "Save and display"
|
||||
And I follow "Add a content page"
|
||||
And I set the following fields to these values:
|
||||
| Page title | First page name |
|
||||
| Page contents | First page contents |
|
||||
| id_answer_editor_0 | Next page |
|
||||
| id_jumpto_0 | Next page |
|
||||
And I press "Save page"
|
||||
And I select "Add a content page" from the "qtype" singleselect
|
||||
And I set the following fields to these values:
|
||||
| Page title | Second page name |
|
||||
| Page contents | Second page contents |
|
||||
| id_answer_editor_0 | Previous page |
|
||||
| id_jumpto_0 | Previous page |
|
||||
| id_answer_editor_1 | Next page |
|
||||
| id_jumpto_1 | Next page |
|
||||
And I press "Save page"
|
||||
| user | course | role |
|
||||
| teacher1 | C1 | editingteacher |
|
||||
| student1 | C1 | student |
|
||||
And the following "activity" exist:
|
||||
| activity | name | course | idnumber | completion | completionview | completiontimespentenabled | completiontimespent |
|
||||
| lesson | Test lesson | C1 | 0001 | 2 | 0 | 1 | 5 |
|
||||
And the following "mod_lesson > pages" exist:
|
||||
| lesson | qtype | title | content |
|
||||
| Test lesson | content | First page name | First page contents |
|
||||
| Test lesson | content | Second page name | Second page contents |
|
||||
And the following "mod_lesson > answers" exist:
|
||||
| page | answer | jumpto |
|
||||
| First page name | Next page | Next page |
|
||||
| Second page name | Previous page | Previous page |
|
||||
| Second page name | Next page | Next page |
|
||||
|
||||
When I am on the "Course 1" course page logged in as student1
|
||||
Then the "Spend at least 5 secs on this activity" completion condition of "Test lesson" is displayed as "todo"
|
||||
And I follow "Test lesson"
|
||||
|
||||
@@ -19,11 +19,15 @@ Feature: A teacher can set available from and deadline dates to access a lesson
|
||||
And the following "activities" exist:
|
||||
| activity | name | course | idnumber |
|
||||
| lesson | Test lesson | C1 | lesson1 |
|
||||
And I log in as "teacher1"
|
||||
And I am on "Course 1" course homepage with editing mode on
|
||||
And the following "mod_lesson > pages" exist:
|
||||
| lesson | qtype | title | content |
|
||||
| Test lesson | content | First page name | First page contents |
|
||||
And the following "mod_lesson > answers" exist:
|
||||
| page | answer | jumpto |
|
||||
| First page name | Next page | Next page |
|
||||
|
||||
Scenario: Forbidding lesson accesses until a specified date
|
||||
Given I am on the "Test lesson" "lesson activity editing" page
|
||||
Given I am on the "Test lesson" "lesson activity editing" page logged in as teacher1
|
||||
And I set the field "id_available_enabled" to "1"
|
||||
And I set the following fields to these values:
|
||||
| available[day] | 1 |
|
||||
@@ -32,18 +36,12 @@ Feature: A teacher can set available from and deadline dates to access a lesson
|
||||
| available[hour] | 08 |
|
||||
| available[minute] | 00 |
|
||||
And I press "Save and display"
|
||||
And I follow "Add a content page"
|
||||
And I set the following fields to these values:
|
||||
| Page title | First page name |
|
||||
| Page contents | First page contents |
|
||||
| Description | The first one |
|
||||
And I press "Save page"
|
||||
When I am on the "Test lesson" "lesson activity" page logged in as student1
|
||||
Then the activity date in "Test lesson" should contain "Opens: Tuesday, 1 January 2030, 8:00"
|
||||
And I should not see "First page contents"
|
||||
|
||||
Scenario: Forbidding lesson accesses after a specified date
|
||||
Given I am on the "Test lesson" "lesson activity editing" page
|
||||
Given I am on the "Test lesson" "lesson activity editing" page logged in as teacher1
|
||||
And I set the field "id_deadline_enabled" to "1"
|
||||
And I set the following fields to these values:
|
||||
| deadline[day] | 1 |
|
||||
@@ -52,12 +50,6 @@ Feature: A teacher can set available from and deadline dates to access a lesson
|
||||
| deadline[hour] | 08 |
|
||||
| deadline[minute] | 00 |
|
||||
And I press "Save and display"
|
||||
And I follow "Add a content page"
|
||||
And I set the following fields to these values:
|
||||
| Page title | First page name |
|
||||
| Page contents | First page contents |
|
||||
| Description | The first one |
|
||||
And I press "Save page"
|
||||
When I am on the "Test lesson" "lesson activity" page logged in as student1
|
||||
Then the activity date in "Test lesson" should contain "Closed: Saturday, 1 January 2000, 8:00"
|
||||
And I should not see "First page contents"
|
||||
|
||||
@@ -14,26 +14,22 @@ Feature: Display the lesson description in the lesson and optionally in the cour
|
||||
And the following "course enrolments" exist:
|
||||
| user | course | role |
|
||||
| teacher1 | C1 | editingteacher |
|
||||
Given the following "activity" exists:
|
||||
| activity | lesson |
|
||||
| course | C1 |
|
||||
| idnumber | 0001 |
|
||||
| name | Test lesson name |
|
||||
| intro | Test lesson description |
|
||||
And I am on the "Test lesson name" "lesson activity" page logged in as teacher1
|
||||
And I follow "Add a content page"
|
||||
And I set the following fields to these values:
|
||||
| Page title | Test lesson part 1 |
|
||||
| Description | Lesson part 1 description |
|
||||
| Jump | Next page |
|
||||
And I click on "Save page" "button"
|
||||
And the following "activity" exist:
|
||||
| activity | name | intro | course | idnumber |
|
||||
| lesson | Test lesson name | Test lesson description | C1 | 0001 |
|
||||
And the following "mod_lesson > page" exist:
|
||||
| lesson | qtype | title | content |
|
||||
| Test lesson name | content | Test lesson part 1 | Test lesson part 1 |
|
||||
And the following "mod_lesson > answer" exist:
|
||||
| page | answer | jumpto |
|
||||
| Test lesson part 1 | Next page | Next page |
|
||||
|
||||
Scenario: Description is displayed in the Lesson
|
||||
When I am on the "Test lesson name" "lesson activity" page
|
||||
When I am on the "Test lesson name" "lesson activity" page logged in as teacher1
|
||||
Then I should see "Test lesson description"
|
||||
|
||||
Scenario: Show lesson description in the course homepage
|
||||
Given I am on the "Test lesson name" "lesson activity editing" page
|
||||
Given I am on the "Test lesson name" "lesson activity editing" page logged in as teacher1
|
||||
And the following fields match these values:
|
||||
| Display description on course page | |
|
||||
And I set the following fields to these values:
|
||||
@@ -43,7 +39,7 @@ Feature: Display the lesson description in the lesson and optionally in the cour
|
||||
Then I should see "Test lesson description"
|
||||
|
||||
Scenario: Hide lesson description in the course homepage
|
||||
Given I am on the "Test lesson name" "lesson activity editing" page
|
||||
Given I am on the "Test lesson name" "lesson activity editing" page logged in as teacher1
|
||||
And the following fields match these values:
|
||||
| Display description on course page | |
|
||||
And I press "Save and return to course"
|
||||
|
||||
@@ -28,22 +28,14 @@ Feature: View activity completion in the lesson activity
|
||||
| completionendreached | 1 |
|
||||
| completiontimespentenabled | 1 |
|
||||
| completiontimespent | 3 |
|
||||
And I am on the "Music history" "lesson activity" page logged in as teacher1
|
||||
And I follow "Add a content page"
|
||||
And I set the following fields to these values:
|
||||
| Page title | Music history part 1 |
|
||||
| Description | The history of music part 1 |
|
||||
| Jump | Next page |
|
||||
And I click on "Save page" "button"
|
||||
And I select "Add a question page" from the "qtype" singleselect
|
||||
And I set the field "Select a question type" to "Essay"
|
||||
And I press "Add a question page"
|
||||
And I set the following fields to these values:
|
||||
| Page title | Music essay |
|
||||
| Page contents | Write a really interesting music essay |
|
||||
| Jump | End of lesson |
|
||||
| Score | 1 |
|
||||
And I press "Save page"
|
||||
And the following "mod_lesson > pages" exist:
|
||||
| lesson | qtype | title | content |
|
||||
| Music history | content | Music history part 1 | |
|
||||
| Music history | essay | Music essay | Write a really interesting music essay |
|
||||
And the following "mod_lesson > answers" exist:
|
||||
| page | answer | jumpto | score |
|
||||
| Music history part 1 | The history of music part 1 | Next page | 0 |
|
||||
| Music essay | | Next page | 1 |
|
||||
|
||||
Scenario: View automatic completion items as a teacher
|
||||
When I am on the "Music history" "lesson activity" page logged in as teacher1
|
||||
|
||||
@@ -18,29 +18,18 @@ Feature: Teachers can review student progress on all lessons in a course by view
|
||||
And the following "activities" exist:
|
||||
| activity | name | course | idnumber | retake |
|
||||
| lesson | Test lesson name | C1 | lesson1 | 1 |
|
||||
And I am on the "Test lesson name" "lesson activity" page logged in as teacher1
|
||||
|
||||
Scenario: View student progress for lesson that was never attempted
|
||||
Given I follow "Add a content page"
|
||||
And I set the following fields to these values:
|
||||
| Page title | First page name |
|
||||
| Page contents | First page contents |
|
||||
| id_answer_editor_0 | Next page |
|
||||
| id_jumpto_0 | Next page |
|
||||
And I press "Save page"
|
||||
And I select "Add a question page" from the "qtype" singleselect
|
||||
And I set the field "Select a question type" to "True/false"
|
||||
And I press "Add a question page"
|
||||
And I set the following fields to these values:
|
||||
| Page title | True/false question 1 |
|
||||
| Page contents | Paper is made from trees. |
|
||||
| id_answer_editor_0 | True |
|
||||
| id_response_editor_0 | Correct |
|
||||
| id_jumpto_0 | Next page |
|
||||
| id_answer_editor_1 | False |
|
||||
| id_response_editor_1 | Wrong |
|
||||
| id_jumpto_1 | This page |
|
||||
And I press "Save page"
|
||||
Given the following "mod_lesson > pages" exist:
|
||||
| lesson | qtype | title | content |
|
||||
| Test lesson name | content | First page name | First page contents |
|
||||
| Test lesson name | truefalse | True/false question 1 | Paper is made from trees. |
|
||||
And the following "mod_lesson > answers" exist:
|
||||
| page | answer | response | jumpto | score |
|
||||
| First page name | Next page | | Next page | 0 |
|
||||
| True/false question 1 | True | Correct | Next page | 1 |
|
||||
| True/false question 1 | False | Wrong | This page | 0 |
|
||||
And I log in as "teacher1"
|
||||
When I am on "Course 1" course homepage
|
||||
And I navigate to course participants
|
||||
And I follow "Student 1"
|
||||
@@ -48,36 +37,17 @@ Feature: Teachers can review student progress on all lessons in a course by view
|
||||
Then I should see "No attempts have been made on this lesson"
|
||||
|
||||
Scenario: View student progress for an incomplete lesson containing both content and question pages
|
||||
Given I follow "Add a content page"
|
||||
And I set the following fields to these values:
|
||||
| Page title | First page name |
|
||||
| Page contents | First page contents |
|
||||
| id_answer_editor_0 | Next page |
|
||||
| id_jumpto_0 | Next page |
|
||||
And I press "Save page"
|
||||
And I select "Add a question page" from the "qtype" singleselect
|
||||
And I set the field "Select a question type" to "True/false"
|
||||
And I press "Add a question page"
|
||||
And I set the following fields to these values:
|
||||
| Page title | True/false question 1 |
|
||||
| Page contents | Paper is made from trees. |
|
||||
| id_answer_editor_0 | True |
|
||||
| id_response_editor_0 | Correct |
|
||||
| id_jumpto_0 | Next page |
|
||||
| id_answer_editor_1 | False |
|
||||
| id_response_editor_1 | Wrong |
|
||||
| id_jumpto_1 | This page |
|
||||
And I press "Save page"
|
||||
And I select "Add a content page" from the "qtype" singleselect
|
||||
And I set the following fields to these values:
|
||||
| Page title | Second page name |
|
||||
| Page contents | Second page contents |
|
||||
| id_answer_editor_0 | Previous page |
|
||||
| id_jumpto_0 | Previous page |
|
||||
| id_answer_editor_1 | Next page |
|
||||
| id_jumpto_1 | Next page |
|
||||
And I press "Save page"
|
||||
And I log out
|
||||
Given the following "mod_lesson > pages" exist:
|
||||
| lesson | qtype | title | content |
|
||||
| Test lesson name | content | First page name | First page contents |
|
||||
| Test lesson name | content | Second page name | Second page contents |
|
||||
| Test lesson name | truefalse | True/false question 1 | Paper is made from trees. |
|
||||
And the following "mod_lesson > answers" exist:
|
||||
| page | answer | response | jumpto | score |
|
||||
| First page name | Next page | | Next page | 0 |
|
||||
| Second page name | Next page | | Next page | 0 |
|
||||
| True/false question 1 | True | Correct | Next page | 1 |
|
||||
| True/false question 1 | False | Wrong | This page | 0 |
|
||||
When I am on the "Test lesson name" "lesson activity" page logged in as student1
|
||||
And I should see "First page contents"
|
||||
And I press "Next page"
|
||||
@@ -90,48 +60,21 @@ Feature: Teachers can review student progress on all lessons in a course by view
|
||||
And I should see "0" in the ".cell.c2" "css_element"
|
||||
|
||||
Scenario: View student progress for a lesson containing both content and question pages
|
||||
Given I follow "Add a content page"
|
||||
And I set the following fields to these values:
|
||||
| Page title | First page name |
|
||||
| Page contents | First page contents |
|
||||
| id_answer_editor_0 | Next page |
|
||||
| id_jumpto_0 | Next page |
|
||||
And I press "Save page"
|
||||
And I select "Add a question page" from the "qtype" singleselect
|
||||
And I set the field "Select a question type" to "True/false"
|
||||
And I press "Add a question page"
|
||||
And I set the following fields to these values:
|
||||
| Page title | True/false question 1 |
|
||||
| Page contents | The sky is Pink. |
|
||||
| id_answer_editor_0 | False |
|
||||
| id_response_editor_0 | Correct |
|
||||
| id_jumpto_0 | Next page |
|
||||
| id_answer_editor_1 | True |
|
||||
| id_response_editor_1 | Wrong |
|
||||
| id_jumpto_1 | This page |
|
||||
And I press "Save page"
|
||||
And I select "Add a question page" from the "qtype" singleselect
|
||||
And I set the field "Select a question type" to "True/false"
|
||||
And I press "Add a question page"
|
||||
And I set the following fields to these values:
|
||||
| Page title | True/false question 1 |
|
||||
| Page contents | Paper is made from trees. |
|
||||
| id_answer_editor_0 | True |
|
||||
| id_response_editor_0 | Correct |
|
||||
| id_jumpto_0 | Next page |
|
||||
| id_answer_editor_1 | False |
|
||||
| id_response_editor_1 | Wrong |
|
||||
| id_jumpto_1 | This page |
|
||||
And I press "Save page"
|
||||
And I select "Add a content page" from the "qtype" singleselect
|
||||
And I set the following fields to these values:
|
||||
| Page title | Second page name |
|
||||
| Page contents | Second page contents |
|
||||
| id_answer_editor_0 | Previous page |
|
||||
| id_jumpto_0 | Previous page |
|
||||
| id_answer_editor_1 | Next page |
|
||||
| id_jumpto_1 | Next page |
|
||||
And I press "Save page"
|
||||
Given the following "mod_lesson > pages" exist:
|
||||
| lesson | qtype | title | content |
|
||||
| Test lesson name | content | First page name | First page contents |
|
||||
| Test lesson name | content | Second page name | Second page contents |
|
||||
| Test lesson name | truefalse | True/false question 1 | Paper is made from trees. |
|
||||
| Test lesson name | truefalse | True/false question 2 | The sky is Pink. |
|
||||
And the following "mod_lesson > answers" exist:
|
||||
| page | answer | response | jumpto | score |
|
||||
| First page name | Next page | | Next page | 0 |
|
||||
| Second page name | Previous page | | Previous page | 0 |
|
||||
| Second page name | Next page | | Next page | 0 |
|
||||
| True/false question 1 | True | Correct | Next page | 1 |
|
||||
| True/false question 1 | False | Wrong | This page | 0 |
|
||||
| True/false question 2 | False | Correct | Next page | 1 |
|
||||
| True/false question 2 | True | Wrong | This page | 0 |
|
||||
When I am on the "Test lesson name" "lesson activity" page logged in as student1
|
||||
And I should see "First page contents"
|
||||
And I press "Next page"
|
||||
@@ -158,22 +101,15 @@ Feature: Teachers can review student progress on all lessons in a course by view
|
||||
And I should see "1" in the ".cell.c3" "css_element"
|
||||
|
||||
Scenario: View student attempts in a lesson containing only content pages
|
||||
Given I follow "Add a content page"
|
||||
And I set the following fields to these values:
|
||||
| Page title | First page name |
|
||||
| Page contents | First page contents |
|
||||
| id_answer_editor_0 | Next page |
|
||||
| id_jumpto_0 | Next page |
|
||||
And I press "Save page"
|
||||
And I select "Add a content page" from the "qtype" singleselect
|
||||
And I set the following fields to these values:
|
||||
| Page title | Second page name |
|
||||
| Page contents | Second page contents |
|
||||
| id_answer_editor_0 | Previous page |
|
||||
| id_jumpto_0 | Previous page |
|
||||
| id_answer_editor_1 | End of lesson |
|
||||
| id_jumpto_1 | End of lesson |
|
||||
And I press "Save page"
|
||||
Given the following "mod_lesson > pages" exist:
|
||||
| lesson | qtype | title | content |
|
||||
| Test lesson name | content | First page name | First page contents |
|
||||
| Test lesson name | content | Second page name | Second page contents |
|
||||
And the following "mod_lesson > answers" exist:
|
||||
| page | answer | jumpto |
|
||||
| First page name | Next page | Next page |
|
||||
| Second page name | Previous page | Previous page |
|
||||
| Second page name | End of lesson | End of lesson |
|
||||
When I am on the "Test lesson name" "lesson activity" page logged in as student1
|
||||
And I should see "First page contents"
|
||||
And I press "Next page"
|
||||
|
||||
@@ -9,21 +9,14 @@ Feature: Pass grade activity completion in the lesson activity
|
||||
| student3 | Vinnie | Student3 | student3@example.com |
|
||||
| teacher1 | Darrell | Teacher1 | teacher1@example.com |
|
||||
And the following "courses" exist:
|
||||
| fullname | shortname | category |
|
||||
| Course 1 | C1 | 0 |
|
||||
| fullname | shortname | category | enablecompletion | showcompletionconditions |
|
||||
| Course 1 | C1 | 0 | 1 | 1 |
|
||||
And the following "course enrolments" exist:
|
||||
| user | course | role |
|
||||
| student1 | C1 | student |
|
||||
| student2 | C1 | student |
|
||||
| student3 | C1 | student |
|
||||
| teacher1 | C1 | editingteacher |
|
||||
And I am on the "Course 1" course page logged in as teacher1
|
||||
And I navigate to "Settings" in current page administration
|
||||
And I expand all fieldsets
|
||||
And I set the following fields to these values:
|
||||
| Enable completion tracking | Yes |
|
||||
| Show activity completion conditions | Yes |
|
||||
And I press "Save and display"
|
||||
And the following "activity" exists:
|
||||
| activity | lesson |
|
||||
| course | C1 |
|
||||
@@ -33,18 +26,13 @@ Feature: Pass grade activity completion in the lesson activity
|
||||
| completion | 2 |
|
||||
| completionusegrade | 1 |
|
||||
| completionpassgrade | 1 |
|
||||
And I am on the "Music history" "lesson activity" page
|
||||
And I follow "Add a question page"
|
||||
And I set the field "Select a question type" to "Numerical"
|
||||
And I press "Add a question page"
|
||||
And I set the following fields to these values:
|
||||
| Page title | Numerical question |
|
||||
| Page contents | What is 1 + 2? |
|
||||
| id_answer_editor_0 | 3 |
|
||||
| id_jumpto_0 | End of lesson |
|
||||
| id_enableotheranswers | 1 |
|
||||
| id_jumpto_6 | Next page |
|
||||
And I press "Save page"
|
||||
And the following "mod_lesson > page" exist:
|
||||
| lesson | qtype | title | content |
|
||||
| Music history | numeric | Numerical question | What is 1 + 2? |
|
||||
And the following "mod_lesson > answers" exist:
|
||||
| page | answer | jumpto | score |
|
||||
| Numerical question | 3 | End of lesson | 1 |
|
||||
| Numerical question | @#wronganswer#@ | Next page | 0 |
|
||||
|
||||
Scenario: View automatic completion items as a teacher
|
||||
When I am on the "Music history" "lesson activity" page logged in as teacher1
|
||||
|
||||
@@ -25,20 +25,13 @@ Feature: Lesson reset
|
||||
And the following "activities" exist:
|
||||
| activity | name | course | idnumber |
|
||||
| lesson | Test lesson name | C1 | lesson1 |
|
||||
And I am on the "Test lesson name" "lesson activity" page logged in as teacher1
|
||||
And I follow "Add a question page"
|
||||
And I set the field "Select a question type" to "True/false"
|
||||
And I press "Add a question page"
|
||||
And I set the following fields to these values:
|
||||
| Page title | True/false question 1 |
|
||||
| Page contents | Cat is an amphibian |
|
||||
| id_answer_editor_0 | False |
|
||||
| id_response_editor_0 | Correct |
|
||||
| id_jumpto_0 | Next page |
|
||||
| id_answer_editor_1 | True |
|
||||
| id_response_editor_1 | Wrong |
|
||||
| id_jumpto_1 | This page |
|
||||
And I press "Save page"
|
||||
And the following "mod_lesson > page" exist:
|
||||
| lesson | qtype | title | content |
|
||||
| Test lesson name | truefalse | True/false question 1 | Cat is an amphibian |
|
||||
And the following "mod_lesson > answers" exist:
|
||||
| page | answer | response | jumpto | score |
|
||||
| True/false question 1 | False | Correct | Next page | 1 |
|
||||
| True/false question 1 | True | Wrong | This page | 0 |
|
||||
|
||||
Scenario: Use course reset to clear all attempt data
|
||||
When I am on the "Test lesson name" "lesson activity" page logged in as student1
|
||||
@@ -62,7 +55,7 @@ Feature: Lesson reset
|
||||
|
||||
@javascript
|
||||
Scenario: Use course reset to remove user overrides.
|
||||
When I am on the "Test lesson name" "lesson activity" page
|
||||
When I am on the "Test lesson name" "lesson activity" page logged in as teacher1
|
||||
And I navigate to "Overrides" in current page administration
|
||||
And I follow "Add user override"
|
||||
And I set the following fields to these values:
|
||||
@@ -80,7 +73,8 @@ Feature: Lesson reset
|
||||
Then I should not see "Sam1 Student1"
|
||||
|
||||
Scenario: Use course reset to remove group overrides.
|
||||
When I navigate to "Overrides" in current page administration
|
||||
When I am on the "Test lesson name" "lesson activity" page logged in as teacher1
|
||||
And I navigate to "Overrides" in current page administration
|
||||
And I select "Group overrides" from the "jump" singleselect
|
||||
And I follow "Add group override"
|
||||
And I set the following fields to these values:
|
||||
|
||||
@@ -0,0 +1,284 @@
|
||||
@mod @mod_lesson
|
||||
Feature: In a lesson activity, teacher can create lesson's pages
|
||||
In order to set up an existing lesson
|
||||
As a teacher
|
||||
I need to create pages in the lesson
|
||||
|
||||
Background:
|
||||
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 "activities" exist:
|
||||
| activity | name | course | idnumber |
|
||||
| lesson | Test lesson name | C1 | lesson1 |
|
||||
|
||||
Scenario: Create content page
|
||||
When I am on the "Test lesson name" "lesson activity" page logged in as teacher1
|
||||
And I follow "Add a content page"
|
||||
And I set the following fields to these values:
|
||||
| Page title | First page name |
|
||||
| Page contents | First page contents |
|
||||
| id_answer_editor_0 | Forward |
|
||||
| id_jumpto_0 | Next page |
|
||||
| id_answer_editor_1 | Backward |
|
||||
| id_jumpto_1 | Previous page |
|
||||
And I press "Save page"
|
||||
And I select edit type "Expanded"
|
||||
Then I should see "First page name"
|
||||
And I should see "First page contents"
|
||||
And I should see "Forward" in the "Content 1" "table_row"
|
||||
And I should see "Next page" in the "Jump 1" "table_row"
|
||||
And I should see "Backward" in the "Content 2" "table_row"
|
||||
And I should see "Previous page" in the "Jump 2" "table_row"
|
||||
|
||||
Scenario: Create essay page
|
||||
When I am on the "Test lesson name" "lesson activity" page logged in as teacher1
|
||||
And I follow "Add a question page"
|
||||
And I set the field "Select a question type" to "Essay"
|
||||
And I press "Add a question page"
|
||||
And I set the following fields to these values:
|
||||
| Page title | Music essay |
|
||||
| Page contents | Write a really interesting music essay |
|
||||
| Jump | End of lesson |
|
||||
| Score | 1 |
|
||||
And I press "Save page"
|
||||
And I select edit type "Expanded"
|
||||
Then I should see "Music essay"
|
||||
And I should see "Write a really interesting music essay"
|
||||
And I should see "End of lesson" in the "Jump 1" "table_row"
|
||||
|
||||
Scenario: Create matching page
|
||||
When I am on the "Test lesson name" "lesson activity" page logged in as teacher1
|
||||
And I follow "Add a question page"
|
||||
And I set the field "Select a question type" to "Matching"
|
||||
And I press "Add a question page"
|
||||
And I set the following fields to these values:
|
||||
| Page title | Geography |
|
||||
| Page contents | Match each city with its country |
|
||||
| id_answer_editor_0 | Correct! |
|
||||
| id_jumpto_0 | End of lesson |
|
||||
| id_score_0 | 2 |
|
||||
| id_answer_editor_1 | Wrong! |
|
||||
| id_jumpto_1 | This page |
|
||||
| id_score_1 | 0 |
|
||||
| id_answer_editor_2 | Barcelona |
|
||||
| id_response_editor_2 | Spain |
|
||||
| id_answer_editor_3 | Perth |
|
||||
| id_response_editor_3 | Australia |
|
||||
| id_answer_editor_4 | Tokyo |
|
||||
| id_response_editor_4 | Japan |
|
||||
| id_answer_editor_5 | Buenos Aires |
|
||||
| id_response_editor_5 | Argentina |
|
||||
| id_answer_editor_6 | Cairo |
|
||||
| id_response_editor_6 | Egypt |
|
||||
And I press "Save page"
|
||||
And I select edit type "Expanded"
|
||||
Then I should see "Geography"
|
||||
And I should see "Match each city with its country"
|
||||
And I should see "Correct!" in the "Correct response" "table_row"
|
||||
And I should see "2" in the "Correct answer score" "table_row"
|
||||
And I should see "End of lesson" in the "Correct answer jump" "table_row"
|
||||
And I should see "Wrong!" in the "Wrong response" "table_row"
|
||||
And I should see "0" in the "Wrong answer score" "table_row"
|
||||
And I should see "This page" in the "Wrong answer jump" "table_row"
|
||||
And I should see "Barcelona" in the "Answer 1" "table_row"
|
||||
And I should see "Spain" in the "Matches with answer 1" "table_row"
|
||||
And I should see "Perth" in the "Answer 2" "table_row"
|
||||
And I should see "Australia" in the "Matches with answer 2" "table_row"
|
||||
And I should see "Tokyo" in the "Answer 3" "table_row"
|
||||
And I should see "Japan" in the "Matches with answer 3" "table_row"
|
||||
And I should see "Buenos Aires" in the "Answer 4" "table_row"
|
||||
And I should see "Argentina" in the "Matches with answer 4" "table_row"
|
||||
And I should see "Cairo" in the "Answer 5" "table_row"
|
||||
And I should see "Egypt" in the "Matches with answer 5" "table_row"
|
||||
|
||||
Scenario: Create multichoice page
|
||||
When I am on the "Test lesson name" "lesson activity" page logged in as teacher1
|
||||
And I follow "Add a question page"
|
||||
And I set the field "Select a question type" to "Multichoice"
|
||||
And I press "Add a question page"
|
||||
And I set the following fields to these values:
|
||||
| Page title | Multichoice question |
|
||||
| Page contents | What animal is an amphibian? |
|
||||
| id_answer_editor_0 | Frog |
|
||||
| id_response_editor_0 | Correct answer |
|
||||
| id_jumpto_0 | End of lesson |
|
||||
| id_score_0 | 2 |
|
||||
| id_answer_editor_1 | Cat |
|
||||
| id_response_editor_1 | Incorrect answer |
|
||||
| id_jumpto_1 | This page |
|
||||
| id_score_1 | 0 |
|
||||
| id_answer_editor_2 | Dog |
|
||||
| id_response_editor_2 | Incorrect answer |
|
||||
| id_jumpto_2 | Next page |
|
||||
| id_score_2 | 0 |
|
||||
And I press "Save page"
|
||||
And I select edit type "Expanded"
|
||||
Then I should see "Multichoice question"
|
||||
And I should see "What animal is an amphibian?"
|
||||
And I should see "Frog" in the "Answer 1" "table_row"
|
||||
And I should see "Correct answer" in the "Response 1" "table_row"
|
||||
And I should see "End of lesson" in the "//tr[contains(.,'Jump')][1]" "xpath_element"
|
||||
And I should see "2" in the "//tr[contains(.,'Score')][1]" "xpath_element"
|
||||
And I should see "Cat" in the "Answer 2" "table_row"
|
||||
And I should see "Incorrect answer" in the "Response 2" "table_row"
|
||||
And I should see "This page" in the "//tr[contains(.,'Jump')][2]" "xpath_element"
|
||||
And I should see "0" in the "//tr[contains(.,'Score')][2]" "xpath_element"
|
||||
And I should see "Dog" in the "Answer 3" "table_row"
|
||||
And I should see "Incorrect answer" in the "Response 3" "table_row"
|
||||
And I should see "Next page" in the "//tr[contains(.,'Jump')][3]" "xpath_element"
|
||||
And I should see "0" in the "//tr[contains(.,'Score')][3]" "xpath_element"
|
||||
|
||||
Scenario: Create numerical page
|
||||
When I am on the "Test lesson name" "lesson activity" page logged in as teacher1
|
||||
And I follow "Add a question page"
|
||||
And I set the field "Select a question type" to "Numerical"
|
||||
And I press "Add a question page"
|
||||
And I set the following fields to these values:
|
||||
| Page title | Really hard question |
|
||||
| Page contents | What is 1 + 2? |
|
||||
| id_answer_editor_0 | 3 |
|
||||
| id_response_editor_0 | Correct |
|
||||
| id_jumpto_0 | End of lesson |
|
||||
| id_score_0 | 2 |
|
||||
| id_answer_editor_1 | 2 |
|
||||
| id_response_editor_1 | Close, but wrong |
|
||||
| id_jumpto_1 | Next page |
|
||||
| id_score_1 | 1 |
|
||||
| id_enableotheranswers | 1 |
|
||||
| id_response_editor_6 | Wrong |
|
||||
| id_jumpto_6 | This page |
|
||||
| id_score_6 | 0 |
|
||||
And I press "Save page"
|
||||
And I select edit type "Expanded"
|
||||
Then I should see "Really hard question"
|
||||
And I should see "What is 1 + 2?"
|
||||
And I should see "3" in the "Answer 1" "table_row"
|
||||
And I should see "Correct" in the "Response 1" "table_row"
|
||||
And I should see "End of lesson" in the "//tr[contains(.,'Jump')][1]" "xpath_element"
|
||||
And I should see "2" in the "//tr[contains(.,'Score')][1]" "xpath_element"
|
||||
And I should see "2" in the "Answer 2" "table_row"
|
||||
And I should see "Close, but wrong" in the "Response 2" "table_row"
|
||||
And I should see "Next page" in the "//tr[contains(.,'Jump')][2]" "xpath_element"
|
||||
And I should see "1" in the "//tr[contains(.,'Score')][2]" "xpath_element"
|
||||
And I should see "@#wronganswer#@" in the "Answer 3" "table_row"
|
||||
And I should see "Wrong" in the "Response 3" "table_row"
|
||||
And I should see "This page" in the "//tr[contains(.,'Jump')][3]" "xpath_element"
|
||||
And I should see "0" in the "//tr[contains(.,'Score')][3]" "xpath_element"
|
||||
|
||||
Scenario: Create short answer page
|
||||
When I am on the "Test lesson name" "lesson activity" page logged in as teacher1
|
||||
And I follow "Add a question page"
|
||||
And I set the field "Select a question type" to "Short answer"
|
||||
And I press "Add a question page"
|
||||
And I set the following fields to these values:
|
||||
| Page title | Geography |
|
||||
| Page contents | Capital of Canada |
|
||||
| id_answer_editor_0 | Ottawa |
|
||||
| id_response_editor_0 | Correct |
|
||||
| id_jumpto_0 | End of lesson |
|
||||
| id_score_0 | 2 |
|
||||
| id_answer_editor_1 | Toronto |
|
||||
| id_response_editor_1 | It's in Canada, but it's not the capital |
|
||||
| id_jumpto_1 | Next page |
|
||||
| id_score_1 | 1 |
|
||||
| id_answer_editor_2 | Vancouver |
|
||||
| id_response_editor_2 | It's in Canada, but it's not the capital |
|
||||
| id_jumpto_2 | Next page |
|
||||
| id_score_2 | 1 |
|
||||
| id_enableotheranswers | 1 |
|
||||
| id_response_editor_6 | Wrong |
|
||||
| id_jumpto_6 | This page |
|
||||
| id_score_6 | 0 |
|
||||
And I press "Save page"
|
||||
And I select edit type "Expanded"
|
||||
Then I should see "Geography"
|
||||
And I should see "Capital of Canada"
|
||||
And I should see "Ottawa" in the "Answer 1" "table_row"
|
||||
And I should see "Correct" in the "Response 1" "table_row"
|
||||
And I should see "End of lesson" in the "//tr[contains(.,'Jump')][1]" "xpath_element"
|
||||
And I should see "2" in the "//tr[contains(.,'Score')][1]" "xpath_element"
|
||||
And I should see "Toronto" in the "Answer 2" "table_row"
|
||||
And I should see "It's in Canada, but it's not the capital" in the "Response 2" "table_row"
|
||||
And I should see "Next page" in the "//tr[contains(.,'Jump')][2]" "xpath_element"
|
||||
And I should see "1" in the "//tr[contains(.,'Score')][2]" "xpath_element"
|
||||
And I should see "Vancouver" in the "Answer 3" "table_row"
|
||||
And I should see "It's in Canada, but it's not the capital" in the "Response 3" "table_row"
|
||||
And I should see "Next page" in the "//tr[contains(.,'Jump')][3]" "xpath_element"
|
||||
And I should see "1" in the "//tr[contains(.,'Score')][3]" "xpath_element"
|
||||
And I should see "@#wronganswer#@" in the "Answer 4" "table_row"
|
||||
And I should see "Wrong" in the "Response 4" "table_row"
|
||||
And I should see "This page" in the "//tr[contains(.,'Jump')][4]" "xpath_element"
|
||||
And I should see "0" in the "//tr[contains(.,'Score')][4]" "xpath_element"
|
||||
|
||||
Scenario: Create true/false page
|
||||
When I am on the "Test lesson name" "lesson activity" page logged in as teacher1
|
||||
And I follow "Add a question page"
|
||||
And I set the field "Select a question type" to "True/false"
|
||||
And I press "Add a question page"
|
||||
And I set the following fields to these values:
|
||||
| Page title | True/false question |
|
||||
| Page contents | Paper is made from trees. |
|
||||
| id_answer_editor_0 | True |
|
||||
| id_response_editor_0 | Correct |
|
||||
| id_jumpto_0 | End of lesson |
|
||||
| id_score_0 | 2 |
|
||||
| id_answer_editor_1 | False |
|
||||
| id_response_editor_1 | Wrong |
|
||||
| id_jumpto_1 | This page |
|
||||
| id_score_1 | 0 |
|
||||
And I press "Save page"
|
||||
And I select edit type "Expanded"
|
||||
Then I should see "True/false question"
|
||||
And I should see "Paper is made from trees."
|
||||
And I should see "True" in the "Answer 1" "table_row"
|
||||
And I should see "Correct" in the "Response 1" "table_row"
|
||||
And I should see "End of lesson" in the "//tr[contains(.,'Jump')][1]" "xpath_element"
|
||||
And I should see "2" in the "//tr[contains(.,'Score')][1]" "xpath_element"
|
||||
And I should see "False" in the "Answer 2" "table_row"
|
||||
And I should see "Wrong" in the "Response 2" "table_row"
|
||||
And I should see "This page" in the "//tr[contains(.,'Jump')][2]" "xpath_element"
|
||||
And I should see "0" in the "//tr[contains(.,'Score')][2]" "xpath_element"
|
||||
|
||||
Scenario: Create cluster pages
|
||||
When I am on the "Test lesson name" "lesson activity" page logged in as teacher1
|
||||
And I follow "Add a cluster"
|
||||
And I select edit type "Expanded"
|
||||
And I click on "Add a question page here" "link" in the "//div[contains(concat(' ', normalize-space(@class), ' '), ' addlinks ')][2]" "xpath_element"
|
||||
And I set the field "Select a question type" to "Multichoice"
|
||||
And I press "Add a question page"
|
||||
And I set the following fields to these values:
|
||||
| Page title | question 1 |
|
||||
| Page contents | Question from cluster |
|
||||
| id_answer_editor_0 | Correct answer |
|
||||
| id_response_editor_0 | Good |
|
||||
| id_jumpto_0 | Cluster |
|
||||
| id_score_0 | 1 |
|
||||
| id_answer_editor_1 | Incorrect answer |
|
||||
| id_response_editor_1 | Bad |
|
||||
| id_jumpto_1 | This page |
|
||||
| id_score_1 | 0 |
|
||||
And I press "Save page"
|
||||
And I click on "Add a content page" "link" in the "//div[contains(concat(' ', normalize-space(@class), ' '), ' addlinks ')][3]" "xpath_element"
|
||||
And I set the following fields to these values:
|
||||
| Page title | Second page name |
|
||||
| Page contents | This page mark the the beginning of the subcluster it should not be seen by students |
|
||||
| id_answer_editor_0 | Next page |
|
||||
| id_jumpto_0 | Next page |
|
||||
And I press "Save page"
|
||||
And I click on "Add an end of branch" "link" in the "//div[contains(concat(' ', normalize-space(@class), ' '), ' addlinks ')][4]" "xpath_element"
|
||||
And I click on "Add an end of cluster" "link" in the "//div[contains(concat(' ', normalize-space(@class), ' '), ' addlinks ')][5]" "xpath_element"
|
||||
Then I should see "Cluster"
|
||||
And I should see "Unseen question within a cluster" in the "//tr[contains(.,'Jump')][1]" "xpath_element"
|
||||
And I should see "Question from cluster"
|
||||
And I should see "This page mark the the beginning of the subcluster it should not be seen by students"
|
||||
And I should see "End of branch"
|
||||
And I should see "End of cluster"
|
||||
@@ -20,31 +20,18 @@ branch table contents
|
||||
And the following "activities" exist:
|
||||
| activity | name | course | idnumber |
|
||||
| lesson | Test lesson name | C1 | lesson1 |
|
||||
And the following "mod_lesson > pages" exist:
|
||||
| lesson | qtype | title | content |
|
||||
| Test lesson name | content | First page name | First page contents |
|
||||
| Test lesson name | numeric | Hardest question ever | 1 + 1? |
|
||||
And the following "mod_lesson > answers" exist:
|
||||
| page | answer | response | jumpto | score |
|
||||
| First page name | Next page | | Next page | 0 |
|
||||
| First page name | Previous page | | Previous page | 0 |
|
||||
| Hardest question ever | 2 | Correct answer | End of lesson | 1 |
|
||||
| Hardest question ever | 1 | Incorrect answer | First page name | 0 |
|
||||
And I am on the "Test lesson name" "lesson activity" page logged in as teacher1
|
||||
And I follow "Add a content page"
|
||||
And I set the following fields to these values:
|
||||
| Page title | First page name |
|
||||
| Page contents | First page contents |
|
||||
| id_answer_editor_0 | Next page |
|
||||
| id_jumpto_0 | Next page |
|
||||
| id_answer_editor_1 | Previous page |
|
||||
| id_jumpto_1 | Previous page |
|
||||
And I press "Save page"
|
||||
And I select "Add a question page" from the "qtype" singleselect
|
||||
And I set the field "Select a question type" to "Numerical"
|
||||
And I press "Add a question page"
|
||||
And I set the following fields to these values:
|
||||
| Page title | Hardest question ever |
|
||||
| Page contents | 1 + 1? |
|
||||
| id_answer_editor_0 | 2 |
|
||||
| id_response_editor_0 | Correct answer |
|
||||
| id_jumpto_0 | End of lesson |
|
||||
| id_score_0 | 1 |
|
||||
| id_answer_editor_1 | 1 |
|
||||
| id_response_editor_1 | Incorrect answer |
|
||||
| id_jumpto_1 | First page name |
|
||||
| id_score_1 | 0 |
|
||||
And I press "Save page"
|
||||
And I press "Edit lesson"
|
||||
And I select edit type "Expanded"
|
||||
|
||||
Scenario: Edit lesson content page
|
||||
|
||||
@@ -19,57 +19,30 @@ Feature: In a lesson activity, teacher can edit a cluster page
|
||||
And the following "activities" exist:
|
||||
| activity | name | course | idnumber |
|
||||
| lesson | Lesson with cluster | C1 | lesson1 |
|
||||
And I am on the "Lesson with cluster" "lesson activity" page logged in as teacher1
|
||||
And I follow "Add a content page"
|
||||
And I set the following fields to these values:
|
||||
| Page title | First page name |
|
||||
| Page contents | First page contents |
|
||||
| id_answer_editor_0 | Next page |
|
||||
| id_jumpto_0 | Next page |
|
||||
And I press "Save page"
|
||||
And I select edit type "Expanded"
|
||||
And I click on "Add a cluster" "link" in the "//div[contains(concat(' ', normalize-space(@class), ' '), ' addlinks ')][2]" "xpath_element"
|
||||
And I click on "Add a question page here" "link" in the "//div[contains(concat(' ', normalize-space(@class), ' '), ' addlinks ')][3]" "xpath_element"
|
||||
And I set the field "Select a question type" to "Multichoice"
|
||||
And I press "Add a question page"
|
||||
And I set the following fields to these values:
|
||||
| Page title | question 1 |
|
||||
| Page contents | Question from cluster |
|
||||
| id_answer_editor_0 | Correct answer |
|
||||
| id_response_editor_0 | Good |
|
||||
| id_jumpto_0 | Cluster |
|
||||
| id_score_0 | 1 |
|
||||
| id_answer_editor_1 | Incorrect answer |
|
||||
| id_response_editor_1 | Bad |
|
||||
| id_jumpto_1 | This page |
|
||||
| id_score_1 | 0 |
|
||||
And I press "Save page"
|
||||
And I click on "Add a question page here" "link" in the "//div[contains(concat(' ', normalize-space(@class), ' '), ' addlinks ')][4]" "xpath_element"
|
||||
And I set the field "Select a question type" to "Multichoice"
|
||||
And I press "Add a question page"
|
||||
And I set the following fields to these values:
|
||||
| Page title | question 2 |
|
||||
| Page contents | Question from cluster |
|
||||
| id_answer_editor_0 | Correct answer |
|
||||
| id_response_editor_0 | Good |
|
||||
| id_jumpto_0 | Cluster |
|
||||
| id_score_0 | 1 |
|
||||
| id_answer_editor_1 | Incorrect answer |
|
||||
| id_response_editor_1 | Bad |
|
||||
| id_jumpto_1 | This page |
|
||||
| id_score_1 | 0 |
|
||||
And I press "Save page"
|
||||
And I click on "Add an end of cluster" "link" in the "//div[contains(concat(' ', normalize-space(@class), ' '), ' addlinks ')][5]" "xpath_element"
|
||||
And I click on "Add a content page" "link" in the "//div[contains(concat(' ', normalize-space(@class), ' '), ' addlinks ')][6]" "xpath_element"
|
||||
And I set the following fields to these values:
|
||||
| Page title | Second page name |
|
||||
| Page contents | Content page after cluster |
|
||||
| id_answer_editor_0 | Next page |
|
||||
| id_jumpto_0 | Next page |
|
||||
And I press "Save page"
|
||||
And the following "mod_lesson > pages" exist:
|
||||
| lesson | qtype | title | content |
|
||||
| Lesson with cluster | content | First page name | First page contents |
|
||||
| Lesson with cluster | cluster | Cluster | Cluster |
|
||||
| Lesson with cluster | multichoice | Question 1 | Question from cluster |
|
||||
| Lesson with cluster | multichoice | Question 2 | Question from cluster |
|
||||
| Lesson with cluster | endofcluster | End of cluster | End of cluster |
|
||||
| Lesson with cluster | content | Second page name | Content page after cluster |
|
||||
And the following "mod_lesson > answers" exist:
|
||||
| page | answer | response | jumpto | score |
|
||||
| First page name | Next page | | Next page | 0 |
|
||||
| Cluster | | | Unseen question within a cluster | 0 |
|
||||
| Question 1 | Correct answer | Good | Cluster | 1 |
|
||||
| Question 1 | Incorrect answer | Bad | This page | 0 |
|
||||
| Question 2 | Correct answer | Good | Cluster | 1 |
|
||||
| Question 2 | Incorrect answer | Bad | This page | 0 |
|
||||
| End of cluster | | | Next page | 0 |
|
||||
| Second page name | Next page | | Next page | 0 |
|
||||
|
||||
Scenario: Edit lesson cluster page
|
||||
Given I click on "//th[normalize-space(.)='Cluster']/descendant::a[3]" "xpath_element"
|
||||
Given I am on the "Lesson with cluster" "lesson activity" page logged in as teacher1
|
||||
And I press "Edit lesson"
|
||||
And I select edit type "Expanded"
|
||||
And I click on "//th[normalize-space(.)='Cluster']/descendant::a[3]" "xpath_element"
|
||||
When I set the following fields to these values:
|
||||
| Page title | Modified name |
|
||||
| Page contents | Modified contents |
|
||||
|
||||
@@ -19,39 +19,21 @@ Feature: In a lesson activity, teacher can edit lesson's pages
|
||||
And the following "activities" exist:
|
||||
| activity | name | course | idnumber |
|
||||
| lesson | Test lesson name | C1 | lesson1 |
|
||||
And the following "mod_lesson > pages" exist:
|
||||
| lesson | qtype | title | content |
|
||||
| Test lesson name | content | First page name | First page contents |
|
||||
| Test lesson name | content | Second page name | Second page contents |
|
||||
| Test lesson name | numeric | Hardest question ever | 1 + 1? |
|
||||
And the following "mod_lesson > answers" exist:
|
||||
| page | answer | response | jumpto | score |
|
||||
| First page name | Next page | | Next page | 0 |
|
||||
| Second page name | Previous page | | Previous page | 0 |
|
||||
| Second page name | Next page | | Next page | 0 |
|
||||
| Hardest question ever | 2 | Correct answer | End of lesson | 1 |
|
||||
| Hardest question ever | 1 | Incorrect answer | Second page name | 0 |
|
||||
And I am on the "Test lesson name" "lesson activity" page logged in as teacher1
|
||||
And I follow "Add a content page"
|
||||
And I set the following fields to these values:
|
||||
| Page title | First page name |
|
||||
| Page contents | First page contents |
|
||||
| id_answer_editor_0 | Next page |
|
||||
| id_jumpto_0 | Next page |
|
||||
And I press "Save page"
|
||||
And I select "Add a content page" from the "qtype" singleselect
|
||||
And I set the following fields to these values:
|
||||
| Page title | Second page name |
|
||||
| Page contents | Second page contents |
|
||||
| id_answer_editor_0 | Previous page |
|
||||
| id_jumpto_0 | Previous page |
|
||||
| id_answer_editor_1 | Next page |
|
||||
| id_jumpto_1 | Next page |
|
||||
And I press "Save page"
|
||||
And I press "Edit lesson"
|
||||
And I select edit type "Expanded"
|
||||
And I click on "Add a question page here" "link" in the "//div[contains(concat(' ', normalize-space(@class), ' '), ' addlinks ')][3]" "xpath_element"
|
||||
And I set the field "Select a question type" to "Numerical"
|
||||
And I press "Add a question page"
|
||||
And I set the following fields to these values:
|
||||
| Page title | Hardest question ever |
|
||||
| Page contents | 1 + 1? |
|
||||
| id_answer_editor_0 | 2 |
|
||||
| id_response_editor_0 | Correct answer |
|
||||
| id_jumpto_0 | End of lesson |
|
||||
| id_score_0 | 1 |
|
||||
| id_answer_editor_1 | 1 |
|
||||
| id_response_editor_1 | Incorrect answer |
|
||||
| id_jumpto_1 | Second page name |
|
||||
| id_score_1 | 0 |
|
||||
And I press "Save page"
|
||||
|
||||
Scenario: Edit lesson content page
|
||||
Given I click on "//th[normalize-space(.)='Second page name']/descendant::a[3]" "xpath_element"
|
||||
|
||||
@@ -18,14 +18,12 @@ Feature: In a lesson activity, teacher can add an essay question
|
||||
And the following "activities" exist:
|
||||
| activity | name | course | idnumber | feedback |
|
||||
| lesson | Test lesson name | C1 | lesson1 | 1 |
|
||||
And I am on the "Test lesson name" "lesson activity" page logged in as teacher1
|
||||
And I follow "Add a question page"
|
||||
And I set the field "Select a question type" to "Essay"
|
||||
And I press "Add a question page"
|
||||
And I set the following fields to these values:
|
||||
| Page title | Essay question |
|
||||
| Page contents | <p>Please write a story about a <b>frog</b>.</p> |
|
||||
And I press "Save page"
|
||||
And the following "mod_lesson > page" exist:
|
||||
| lesson | qtype | title | content |
|
||||
| Test lesson name | essay | Essay question | <p>Please write a story about a <b>frog</b>.</p> |
|
||||
And the following "mod_lesson > answer" exist:
|
||||
| page | jumpto | score |
|
||||
| Essay question | Next page | 1 |
|
||||
When I am on the "Test lesson name" "lesson activity" page logged in as student1
|
||||
Then I should see "Please write a story about a frog."
|
||||
And I set the field "Your answer" to "<p>Once upon a time there was a little <b>green</b> frog."
|
||||
|
||||
@@ -18,171 +18,51 @@ Feature: In a lesson activity, students can exit and re-enter the activity when
|
||||
And the following "activities" exist:
|
||||
| activity | name | course | idnumber |
|
||||
| lesson | Lesson with cluster | C1 | lesson1 |
|
||||
And I am on the "Lesson with cluster" "lesson activity" page logged in as teacher1
|
||||
And I follow "Add a content page"
|
||||
And I set the following fields to these values:
|
||||
| Page title | First page name |
|
||||
| Page contents | First page contents |
|
||||
| id_answer_editor_0 | Next page |
|
||||
| id_jumpto_0 | Next page |
|
||||
And I press "Save page"
|
||||
And I select edit type "Expanded"
|
||||
And I click on "Add a cluster" "link" in the "//div[contains(concat(' ', normalize-space(@class), ' '), ' addlinks ')][2]" "xpath_element"
|
||||
And I follow "Update page: Cluster"
|
||||
And I set the following fields to these values:
|
||||
| Page title | C Cluster |
|
||||
| Page contents | C Cluster |
|
||||
| Jump | Unseen question within a cluster |
|
||||
And I press "Save page"
|
||||
And I click on "Add a cluster" "link" in the "//div[contains(concat(' ', normalize-space(@class), ' '), ' addlinks ')][2]" "xpath_element"
|
||||
And I follow "Update page: Cluster"
|
||||
And I set the following fields to these values:
|
||||
| Page title | B Cluster |
|
||||
| Page contents | B Cluster |
|
||||
| Jump | Unseen question within a cluster |
|
||||
And I press "Save page"
|
||||
And I click on "Add a cluster" "link" in the "//div[contains(concat(' ', normalize-space(@class), ' '), ' addlinks ')][2]" "xpath_element"
|
||||
And I follow "Update page: Cluster"
|
||||
And I set the following fields to these values:
|
||||
| Page title | A Cluster |
|
||||
| Page contents | A Cluster |
|
||||
| Jump | Unseen question within a cluster |
|
||||
And I press "Save page"
|
||||
And I click on "Add a question page here" "link" in the "//div[contains(concat(' ', normalize-space(@class), ' '), ' addlinks ')][3]" "xpath_element"
|
||||
And I set the field "Select a question type" to "Multichoice"
|
||||
And I press "Add a question page"
|
||||
And I set the following fields to these values:
|
||||
| Page title | Question 1 A Cluster |
|
||||
| Page contents | Question 1 from A cluster |
|
||||
| id_answer_editor_0 | Correct answer |
|
||||
| id_response_editor_0 | Good |
|
||||
| id_jumpto_0 | B Cluster |
|
||||
| id_score_0 | 1 |
|
||||
| id_answer_editor_1 | Incorrect answer |
|
||||
| id_response_editor_1 | Bad |
|
||||
| id_jumpto_1 | Unseen question within a cluster |
|
||||
| id_score_1 | 0 |
|
||||
And I press "Save page"
|
||||
And I click on "Add a question page here" "link" in the "//div[contains(concat(' ', normalize-space(@class), ' '), ' addlinks ')][4]" "xpath_element"
|
||||
And I set the field "Select a question type" to "Multichoice"
|
||||
And I press "Add a question page"
|
||||
And I set the following fields to these values:
|
||||
| Page title | Question 2 A Cluster |
|
||||
| Page contents | Question 2 from A cluster |
|
||||
| id_answer_editor_0 | Correct answer |
|
||||
| id_response_editor_0 | Good |
|
||||
| id_jumpto_0 | B Cluster |
|
||||
| id_score_0 | 1 |
|
||||
| id_answer_editor_1 | Incorrect answer |
|
||||
| id_response_editor_1 | Bad |
|
||||
| id_jumpto_1 | Unseen question within a cluster |
|
||||
| id_score_1 | 0 |
|
||||
And I press "Save page"
|
||||
And I click on "Add a question page here" "link" in the "//div[contains(concat(' ', normalize-space(@class), ' '), ' addlinks ')][5]" "xpath_element"
|
||||
And I press "Add a question page"
|
||||
And I set the following fields to these values:
|
||||
| Page title | Question 3 A Cluster |
|
||||
| Page contents | Question 3 from A cluster |
|
||||
| id_answer_editor_0 | Correct answer |
|
||||
| id_response_editor_0 | Good |
|
||||
| id_jumpto_0 | B Cluster |
|
||||
| id_score_0 | 1 |
|
||||
| id_answer_editor_1 | Incorrect answer |
|
||||
| id_response_editor_1 | Bad |
|
||||
| id_jumpto_1 | Unseen question within a cluster |
|
||||
| id_score_1 | 0 |
|
||||
And I press "Save page"
|
||||
And I click on "Add an end of cluster" "link" in the "//div[contains(concat(' ', normalize-space(@class), ' '), ' addlinks ')][6]" "xpath_element"
|
||||
And I click on "Add a question page here" "link" in the "//div[contains(concat(' ', normalize-space(@class), ' '), ' addlinks ')][8]" "xpath_element"
|
||||
And I set the field "Select a question type" to "Multichoice"
|
||||
And I press "Add a question page"
|
||||
And I set the following fields to these values:
|
||||
| Page title | Question 1 B Cluster |
|
||||
| Page contents | Question 1 from B cluster |
|
||||
| id_answer_editor_0 | Correct answer |
|
||||
| id_response_editor_0 | Good |
|
||||
| id_jumpto_0 | C Cluster |
|
||||
| id_score_0 | 1 |
|
||||
| id_answer_editor_1 | Incorrect answer |
|
||||
| id_response_editor_1 | Bad |
|
||||
| id_jumpto_1 | Unseen question within a cluster |
|
||||
| id_score_1 | 0 |
|
||||
And I press "Save page"
|
||||
And I click on "Add a question page here" "link" in the "//div[contains(concat(' ', normalize-space(@class), ' '), ' addlinks ')][9]" "xpath_element"
|
||||
And I set the field "Select a question type" to "Multichoice"
|
||||
And I press "Add a question page"
|
||||
And I set the following fields to these values:
|
||||
| Page title | Question 2 B Cluster |
|
||||
| Page contents | Question 2 from B cluster |
|
||||
| id_answer_editor_0 | Correct answer |
|
||||
| id_response_editor_0 | Good |
|
||||
| id_jumpto_0 | C Cluster |
|
||||
| id_score_0 | 1 |
|
||||
| id_answer_editor_1 | Incorrect answer |
|
||||
| id_response_editor_1 | Bad |
|
||||
| id_jumpto_1 | Unseen question within a cluster |
|
||||
| id_score_1 | 0 |
|
||||
And I press "Save page"
|
||||
And I click on "Add a question page here" "link" in the "//div[contains(concat(' ', normalize-space(@class), ' '), ' addlinks ')][10]" "xpath_element"
|
||||
And I press "Add a question page"
|
||||
And I set the following fields to these values:
|
||||
| Page title | Question 3 B Cluster |
|
||||
| Page contents | Question 3 from B cluster |
|
||||
| id_answer_editor_0 | Correct answer |
|
||||
| id_response_editor_0 | Good |
|
||||
| id_jumpto_0 | C Cluster |
|
||||
| id_score_0 | 1 |
|
||||
| id_answer_editor_1 | Incorrect answer |
|
||||
| id_response_editor_1 | Bad |
|
||||
| id_jumpto_1 | Unseen question within a cluster |
|
||||
| id_score_1 | 0 |
|
||||
And I press "Save page"
|
||||
And I click on "Add an end of cluster" "link" in the "//div[contains(concat(' ', normalize-space(@class), ' '), ' addlinks ')][11]" "xpath_element"
|
||||
And I click on "Add a question page here" "link" in the "//div[contains(concat(' ', normalize-space(@class), ' '), ' addlinks ')][13]" "xpath_element"
|
||||
And I set the field "Select a question type" to "Multichoice"
|
||||
And I press "Add a question page"
|
||||
And I set the following fields to these values:
|
||||
| Page title | Question 1 C Cluster |
|
||||
| Page contents | Question 1 from C cluster |
|
||||
| id_answer_editor_0 | Correct answer |
|
||||
| id_response_editor_0 | Good |
|
||||
| id_jumpto_0 | End of lesson |
|
||||
| id_score_0 | 1 |
|
||||
| id_answer_editor_1 | Incorrect answer |
|
||||
| id_response_editor_1 | Bad |
|
||||
| id_jumpto_1 | Unseen question within a cluster |
|
||||
| id_score_1 | 0 |
|
||||
And I press "Save page"
|
||||
And I click on "Add a question page here" "link" in the "//div[contains(concat(' ', normalize-space(@class), ' '), ' addlinks ')][14]" "xpath_element"
|
||||
And I set the field "Select a question type" to "Multichoice"
|
||||
And I press "Add a question page"
|
||||
And I set the following fields to these values:
|
||||
| Page title | Question 2 C Cluster |
|
||||
| Page contents | Question 2 from C cluster |
|
||||
| id_answer_editor_0 | Correct answer |
|
||||
| id_response_editor_0 | Good |
|
||||
| id_jumpto_0 | End of lesson |
|
||||
| id_score_0 | 1 |
|
||||
| id_answer_editor_1 | Incorrect answer |
|
||||
| id_response_editor_1 | Bad |
|
||||
| id_jumpto_1 | Unseen question within a cluster |
|
||||
| id_score_1 | 0 |
|
||||
And I press "Save page"
|
||||
And I click on "Add a question page here" "link" in the "//div[contains(concat(' ', normalize-space(@class), ' '), ' addlinks ')][15]" "xpath_element"
|
||||
And I press "Add a question page"
|
||||
And I set the following fields to these values:
|
||||
| Page title | Question 3 C Cluster |
|
||||
| Page contents | Question 3 from C cluster |
|
||||
| id_answer_editor_0 | Correct answer |
|
||||
| id_response_editor_0 | Good |
|
||||
| id_jumpto_0 | End of lesson |
|
||||
| id_score_0 | 1 |
|
||||
| id_answer_editor_1 | Incorrect answer |
|
||||
| id_response_editor_1 | Bad |
|
||||
| id_jumpto_1 | Unseen question within a cluster |
|
||||
| id_score_1 | 0 |
|
||||
And I press "Save page"
|
||||
And I click on "Add an end of cluster" "link" in the "//div[contains(concat(' ', normalize-space(@class), ' '), ' addlinks ')][16]" "xpath_element"
|
||||
And the following "mod_lesson > pages" exist:
|
||||
| lesson | qtype | title | content |
|
||||
| Lesson with cluster | content | First page name | First page contents |
|
||||
| Lesson with cluster | cluster | A Cluster | A Cluster |
|
||||
| Lesson with cluster | multichoice | Question 1 A Cluster | Question 1 from A cluster |
|
||||
| Lesson with cluster | multichoice | Question 2 A Cluster | Question 2 from A cluster |
|
||||
| Lesson with cluster | multichoice | Question 3 A Cluster | Question 3 from A cluster |
|
||||
| Lesson with cluster | endofcluster | End of A cluster | End of A cluster |
|
||||
| Lesson with cluster | cluster | B Cluster | B Cluster |
|
||||
| Lesson with cluster | multichoice | Question 1 B Cluster | Question 1 from B cluster |
|
||||
| Lesson with cluster | multichoice | Question 2 B Cluster | Question 2 from B cluster |
|
||||
| Lesson with cluster | multichoice | Question 3 B Cluster | Question 3 from B cluster |
|
||||
| Lesson with cluster | endofcluster | End of B cluster | End of B cluster |
|
||||
| Lesson with cluster | cluster | C Cluster | C Cluster |
|
||||
| Lesson with cluster | multichoice | Question 1 C Cluster | Question 1 from C cluster |
|
||||
| Lesson with cluster | multichoice | Question 2 C Cluster | Question 2 from C cluster |
|
||||
| Lesson with cluster | multichoice | Question 3 C Cluster | Question 3 from C cluster |
|
||||
| Lesson with cluster | endofcluster | End of C cluster | End of C cluster |
|
||||
And the following "mod_lesson > answers" exist:
|
||||
| page | answer | response | jumpto | score |
|
||||
| First page name | Next page | | Next page | 0 |
|
||||
| A Cluster | | | Unseen question within a cluster | 0 |
|
||||
| Question 1 A Cluster | Correct answer | Good | B Cluster | 1 |
|
||||
| Question 1 A Cluster | Incorrect answer | Bad | Unseen question within a cluster | 0 |
|
||||
| Question 2 A Cluster | Correct answer | Good | B Cluster | 1 |
|
||||
| Question 2 A Cluster | Incorrect answer | Bad | Unseen question within a cluster | 0 |
|
||||
| Question 3 A Cluster | Correct answer | Good | B Cluster | 1 |
|
||||
| Question 3 A Cluster | Incorrect answer | Bad | Unseen question within a cluster | 0 |
|
||||
| End of A cluster | | | Next page | 0 |
|
||||
| B Cluster | | | Unseen question within a cluster | 0 |
|
||||
| Question 1 B Cluster | Correct answer | Good | C Cluster | 1 |
|
||||
| Question 1 B Cluster | Incorrect answer | Bad | Unseen question within a cluster | 0 |
|
||||
| Question 2 B Cluster | Correct answer | Good | C Cluster | 1 |
|
||||
| Question 2 B Cluster | Incorrect answer | Bad | Unseen question within a cluster | 0 |
|
||||
| Question 3 B Cluster | Correct answer | Good | C Cluster | 1 |
|
||||
| Question 3 B Cluster | Incorrect answer | Bad | Unseen question within a cluster | 0 |
|
||||
| End of B cluster | | | Next page | 0 |
|
||||
| C Cluster | | | Unseen question within a cluster | 0 |
|
||||
| Question 1 C Cluster | Correct answer | Good | End of lesson | 1 |
|
||||
| Question 1 C Cluster | Incorrect answer | Bad | Unseen question within a cluster | 0 |
|
||||
| Question 2 C Cluster | Correct answer | Good | End of lesson | 1 |
|
||||
| Question 2 C Cluster | Incorrect answer | Bad | Unseen question within a cluster | 0 |
|
||||
| Question 3 C Cluster | Correct answer | Good | End of lesson | 1 |
|
||||
| Question 3 C Cluster | Incorrect answer | Bad | Unseen question within a cluster | 0 |
|
||||
| End of C cluster | | | Next page | 0 |
|
||||
|
||||
Scenario: Accessing as student to a cluster only lesson
|
||||
Given I am on the "Lesson with cluster" "lesson activity" page logged in as student1
|
||||
|
||||
@@ -32,20 +32,13 @@ Feature: Lesson group override
|
||||
And the following "activities" exist:
|
||||
| activity | name | groupmode | course | idnumber |
|
||||
| lesson | Test lesson name | 1 | C1 | lesson1 |
|
||||
And I am on the "Test lesson name" "lesson activity" page logged in as teacher1
|
||||
And I follow "Add a question page"
|
||||
And I set the field "Select a question type" to "True/false"
|
||||
And I press "Add a question page"
|
||||
And I set the following fields to these values:
|
||||
| Page title | True/false question 1 |
|
||||
| Page contents | Cat is an amphibian |
|
||||
| id_answer_editor_0 | False |
|
||||
| id_response_editor_0 | Correct |
|
||||
| id_jumpto_0 | Next page |
|
||||
| id_answer_editor_1 | True |
|
||||
| id_response_editor_1 | Wrong |
|
||||
| id_jumpto_1 | This page |
|
||||
And I press "Save page"
|
||||
And the following "mod_lesson > page" exist:
|
||||
| lesson | qtype | title | content |
|
||||
| Test lesson name | truefalse | True/false question 1 | Cat is an amphibian |
|
||||
And the following "mod_lesson > answers" exist:
|
||||
| page | answer | response | jumpto | score |
|
||||
| True/false question 1 | False | Correct | Next page | 1 |
|
||||
| True/false question 1 | True | Wrong | This page | 0 |
|
||||
|
||||
Scenario: Add, modify then delete a group override
|
||||
Given I am on the "Test lesson name" "lesson activity" page logged in as teacher1
|
||||
|
||||
@@ -20,31 +20,20 @@ Feature: In a lesson activity, if custom scoring is not enabled, student should
|
||||
And the following "activities" exist:
|
||||
| activity | name | course | idnumber |
|
||||
| lesson | Test lesson name | C1 | lesson1 |
|
||||
And the following "mod_lesson > pages" exist:
|
||||
| lesson | qtype | title | content |
|
||||
| Test lesson name | content | First page name | First page contents |
|
||||
| Test lesson name | numeric | Hardest question ever | 1 + 1? |
|
||||
And the following "mod_lesson > answers" exist:
|
||||
| page | answer | response | jumpto | score |
|
||||
| First page name | Next page | | Next page | 0 |
|
||||
| Hardest question ever | 2 | Correct answer | Next page | 1 |
|
||||
| Hardest question ever | 1 | Incorrect answer | This page | 0 |
|
||||
And I am on the "Test lesson name" "lesson activity editing" page logged in as teacher1
|
||||
And I set the following fields to these values:
|
||||
| Maximum grade | 75 |
|
||||
| Custom scoring | No |
|
||||
And I press "Save and display"
|
||||
And I follow "Add a content page"
|
||||
And I set the following fields to these values:
|
||||
| Page title | First page name |
|
||||
| Page contents | First page contents |
|
||||
| id_answer_editor_0 | Next page |
|
||||
| id_jumpto_0 | Next page |
|
||||
And I press "Save page"
|
||||
And I select "Add a question page" from the "qtype" singleselect
|
||||
And I set the field "Select a question type" to "Numerical"
|
||||
And I press "Add a question page"
|
||||
And I set the following fields to these values:
|
||||
| Page title | Hardest question ever |
|
||||
| Page contents | 1 + 1? |
|
||||
| id_answer_editor_0 | 2 |
|
||||
| id_response_editor_0 | Correct answer |
|
||||
| id_jumpto_0 | Next page |
|
||||
| id_answer_editor_1 | 1 |
|
||||
| id_response_editor_1 | Incorrect answer |
|
||||
| id_jumpto_1 | This page |
|
||||
And I press "Save page"
|
||||
And I am on "Course 1" course homepage with editing mode on
|
||||
And I duplicate "Test lesson name" activity
|
||||
And I wait until section "1" is available
|
||||
|
||||
@@ -19,42 +19,20 @@ Feature: In a lesson activity, students can navigate through a series of pages i
|
||||
And the following "activities" exist:
|
||||
| activity | name | course | idnumber |
|
||||
| lesson | Test lesson name | C1 | lesson1 |
|
||||
And I log in as "teacher1"
|
||||
|
||||
Scenario: Student navigation with pages and questions
|
||||
Given I am on the "Test lesson name" "lesson activity" page
|
||||
And I follow "Add a content page"
|
||||
And I set the following fields to these values:
|
||||
| Page title | First page name |
|
||||
| Page contents | First page contents |
|
||||
| id_answer_editor_0 | Next page |
|
||||
| id_jumpto_0 | Next page |
|
||||
And I press "Save page"
|
||||
And I select "Add a content page" from the "qtype" singleselect
|
||||
And I set the following fields to these values:
|
||||
| Page title | Second page name |
|
||||
| Page contents | Second page contents |
|
||||
| id_answer_editor_0 | Previous page |
|
||||
| id_jumpto_0 | Previous page |
|
||||
| id_answer_editor_1 | Next page |
|
||||
| id_jumpto_1 | Next page |
|
||||
And I press "Save page"
|
||||
And I select edit type "Expanded"
|
||||
And I click on "Add a question page here" "link" in the "//div[contains(concat(' ', normalize-space(@class), ' '), ' addlinks ')][3]" "xpath_element"
|
||||
And I set the field "Select a question type" to "Numerical"
|
||||
And I press "Add a question page"
|
||||
And I set the following fields to these values:
|
||||
| Page title | Hardest question ever |
|
||||
| Page contents | 1 + 1? |
|
||||
| id_answer_editor_0 | 2 |
|
||||
| id_response_editor_0 | Correct answer |
|
||||
| id_jumpto_0 | End of lesson |
|
||||
| id_score_0 | 1 |
|
||||
| id_answer_editor_1 | 1 |
|
||||
| id_response_editor_1 | Incorrect answer |
|
||||
| id_jumpto_1 | Second page name |
|
||||
| id_score_1 | 0 |
|
||||
And I press "Save page"
|
||||
Given the following "mod_lesson > pages" exist:
|
||||
| lesson | qtype | title | content |
|
||||
| Test lesson name | content | First page name | First page contents |
|
||||
| Test lesson name | content | Second page name | Second page contents |
|
||||
| Test lesson name | numeric | Hardest question ever | 1 + 1? |
|
||||
And the following "mod_lesson > answers" exist:
|
||||
| page | answer | response | jumpto | score |
|
||||
| First page name | Next page | | Next page | 0 |
|
||||
| Second page name | Previous page | | Previous page | 0 |
|
||||
| Second page name | Next page | | Next page | 0 |
|
||||
| Hardest question ever | 2 | Correct answer | End of lesson | 1 |
|
||||
| Hardest question ever | 1 | Incorrect answer | Second page name | 0 |
|
||||
When I am on the "Test lesson name" "lesson activity" page logged in as student1
|
||||
Then I should see "First page contents"
|
||||
And I press "Next page"
|
||||
@@ -84,21 +62,18 @@ Feature: In a lesson activity, students can navigate through a series of pages i
|
||||
And I should see "Your score is 0 (out of 1)."
|
||||
|
||||
Scenario: Student reattempts a question until out of attempts
|
||||
Given I am on the "Test lesson name" "lesson activity editing" page
|
||||
Given the following "mod_lesson > page" exist:
|
||||
| lesson | qtype | title | content |
|
||||
| Test lesson name | truefalse | Test question | Test content |
|
||||
And the following "mod_lesson > answers" exist:
|
||||
| page | answer | jumpto | score |
|
||||
| Test question | right | Next page | 1 |
|
||||
| Test question | wrong | This page | 0 |
|
||||
And I am on the "Test lesson name" "lesson activity editing" page logged in as teacher1
|
||||
And I set the following fields to these values:
|
||||
| id_review | Yes |
|
||||
| id_maxattempts | 3 |
|
||||
And I press "Save and display"
|
||||
And I follow "Add a question page"
|
||||
And I set the following fields to these values:
|
||||
| id_qtype | True/false |
|
||||
And I press "Add a question page"
|
||||
And I set the following fields to these values:
|
||||
| Page title | Test question |
|
||||
| Page contents | Test content |
|
||||
| id_answer_editor_0 | right |
|
||||
| id_answer_editor_1 | wrong |
|
||||
And I press "Save page"
|
||||
When I am on the "Test lesson name" "lesson activity" page logged in as student1
|
||||
Then I should see "Test content"
|
||||
And I set the following fields to these values:
|
||||
@@ -121,32 +96,21 @@ Feature: In a lesson activity, students can navigate through a series of pages i
|
||||
And I should see "Congratulations - end of lesson reached"
|
||||
|
||||
Scenario: Student reattempts a question until out of attempts with specific jumps
|
||||
Given I am on the "Test lesson name" "lesson activity editing" page
|
||||
Given the following "mod_lesson > pages" exist:
|
||||
| lesson | qtype | title | content |
|
||||
| Test lesson name | truefalse | Test question | Test content 1 |
|
||||
| Test lesson name | truefalse | Test question 2 | Test content 2 |
|
||||
And the following "mod_lesson > answers" exist:
|
||||
| page | answer | jumpto | score |
|
||||
| Test question | right | Next page | 1 |
|
||||
| Test question | wrong | This page | 0 |
|
||||
| Test question 2 | right | Test question | 1 |
|
||||
| Test question 2 | wrong | Test question | 0 |
|
||||
And I am on the "Test lesson name" "lesson activity editing" page logged in as teacher1
|
||||
And I set the following fields to these values:
|
||||
| id_review | Yes |
|
||||
| id_maxattempts | 3 |
|
||||
| id_review | Yes |
|
||||
| id_maxattempts | 3 |
|
||||
And I press "Save and display"
|
||||
And I follow "Add a question page"
|
||||
And I set the following fields to these values:
|
||||
| id_qtype | True/false |
|
||||
And I press "Add a question page"
|
||||
And I set the following fields to these values:
|
||||
| Page title | Test question |
|
||||
| Page contents | Test content 1 |
|
||||
| id_answer_editor_0 | right |
|
||||
| id_answer_editor_1 | wrong |
|
||||
And I press "Save page"
|
||||
And I select "Add a question page" from the "qtype" singleselect
|
||||
And I set the field "Select a question type" to "True/false"
|
||||
And I press "Add a question page"
|
||||
And I set the following fields to these values:
|
||||
| Page title | Test question 2 |
|
||||
| Page contents | Test content 2 |
|
||||
| id_answer_editor_0 | right |
|
||||
| id_jumpto_0 | Test question |
|
||||
| id_answer_editor_1 | wrong |
|
||||
| id_jumpto_1 | Test question |
|
||||
And I press "Save page"
|
||||
When I am on the "Test lesson name" "lesson activity" page logged in as student1
|
||||
Then I should see "Test content 1"
|
||||
And I set the following fields to these values:
|
||||
@@ -173,21 +137,18 @@ Feature: In a lesson activity, students can navigate through a series of pages i
|
||||
And I should see "Test content 1"
|
||||
|
||||
Scenario: Student should not see remaining attempts notification if maximum number of attempts is set to unlimited
|
||||
Given I am on the "Test lesson name" "lesson activity editing" page
|
||||
Given the following "mod_lesson > page" exist:
|
||||
| lesson | qtype | title | content |
|
||||
| Test lesson name | truefalse | Test question | Test content |
|
||||
And the following "mod_lesson > answers" exist:
|
||||
| page | answer | jumpto | score |
|
||||
| Test question | right | Next page | 1 |
|
||||
| Test question | wrong | This page | 0 |
|
||||
And I am on the "Test lesson name" "lesson activity editing" page logged in as teacher1
|
||||
And I set the following fields to these values:
|
||||
| id_review | Yes |
|
||||
| id_maxattempts | 0 |
|
||||
And I press "Save and display"
|
||||
And I follow "Add a question page"
|
||||
And I set the following fields to these values:
|
||||
| id_qtype | True/false |
|
||||
And I press "Add a question page"
|
||||
And I set the following fields to these values:
|
||||
| Page title | Test question |
|
||||
| Page contents | Test content |
|
||||
| id_answer_editor_0 | right |
|
||||
| id_answer_editor_1 | wrong |
|
||||
And I press "Save page"
|
||||
When I am on the "Test lesson name" "lesson activity" page logged in as student1
|
||||
Then I should see "Test content"
|
||||
And I set the following fields to these values:
|
||||
|
||||
@@ -27,7 +27,20 @@ Feature: In Dashboard, teacher can see the number of student attempts to lessons
|
||||
| idnumber | 0001 |
|
||||
| name | Test lesson name |
|
||||
| retake | 1 |
|
||||
When I am on the "Test lesson name" "lesson activity editing" page
|
||||
And the following "mod_lesson > pages" exist:
|
||||
| lesson | qtype | title | content |
|
||||
| Test lesson name | truefalse | True/false question 1 | Cat is an amphibian |
|
||||
| Test lesson name | truefalse | True/false question 2 | Paper is made from trees. |
|
||||
| Test lesson name | truefalse | True/false question 3 | 1+1=2 |
|
||||
And the following "mod_lesson > answers" exist:
|
||||
| page | answer | response | jumpto | score |
|
||||
| True/false question 1 | False | Correct | Next page | 1 |
|
||||
| True/false question 1 | True | Wrong | This page | 0 |
|
||||
| True/false question 2 | True | Correct | Next page | 1 |
|
||||
| True/false question 2 | False | Wrong | This page | 0 |
|
||||
| True/false question 3 | True | Correct | Next page | 1 |
|
||||
| True/false question 3 | False | Wrong | This page | 0 |
|
||||
And I am on the "Test lesson name" "lesson activity editing" page
|
||||
And I expand all fieldsets
|
||||
And I set the following fields to these values:
|
||||
| id_deadline_enabled | 1 |
|
||||
@@ -37,47 +50,7 @@ Feature: In Dashboard, teacher can see the number of student attempts to lessons
|
||||
| deadline[hour] | 08 |
|
||||
| deadline[minute] | 00 |
|
||||
And I press "Save and display"
|
||||
And I follow "Add a question page"
|
||||
And I set the field "Select a question type" to "True/false"
|
||||
And I press "Add a question page"
|
||||
And I set the following fields to these values:
|
||||
| Page title | True/false question 1 |
|
||||
| Page contents | Cat is an amphibian |
|
||||
| id_answer_editor_0 | False |
|
||||
| id_response_editor_0 | Correct |
|
||||
| id_jumpto_0 | Next page |
|
||||
| id_answer_editor_1 | True |
|
||||
| id_response_editor_1 | Wrong |
|
||||
| id_jumpto_1 | This page |
|
||||
And I press "Save page"
|
||||
And I select "Add a question page" from the "qtype" singleselect
|
||||
And I set the field "Select a question type" to "True/false"
|
||||
And I press "Add a question page"
|
||||
And I set the following fields to these values:
|
||||
| Page title | True/false question 2 |
|
||||
| Page contents | Paper is made from trees. |
|
||||
| id_answer_editor_0 | True |
|
||||
| id_response_editor_0 | Correct |
|
||||
| id_jumpto_0 | Next page |
|
||||
| id_answer_editor_1 | False |
|
||||
| id_response_editor_1 | Wrong |
|
||||
| id_jumpto_1 | This page |
|
||||
And I press "Save page"
|
||||
And I select edit type "Expanded"
|
||||
And I click on "Add a question page here" "link" in the "//div[contains(concat(' ', normalize-space(@class), ' '), ' addlinks ')][3]" "xpath_element"
|
||||
And I set the field "Select a question type" to "True/false"
|
||||
And I press "Add a question page"
|
||||
And I set the following fields to these values:
|
||||
| Page title | True/false question 3 |
|
||||
| Page contents | 1+1=2 |
|
||||
| id_answer_editor_0 | True |
|
||||
| id_response_editor_0 | Correct |
|
||||
| id_jumpto_0 | Next page |
|
||||
| id_answer_editor_1 | False |
|
||||
| id_response_editor_1 | Wrong |
|
||||
| id_jumpto_1 | This page |
|
||||
And I press "Save page"
|
||||
And I am on the "Test lesson name" "lesson activity" page logged in as student1
|
||||
When I am on the "Test lesson name" "lesson activity" page logged in as student1
|
||||
And I should see "Cat is an amphibian"
|
||||
And I set the following fields to these values:
|
||||
| False | 1 |
|
||||
|
||||
@@ -19,22 +19,37 @@ Feature: In a lesson activity, I need to edit pages in the lesson taking into ac
|
||||
And the following "activities" exist:
|
||||
| activity | name | course | idnumber | modattempts |
|
||||
| lesson | Test lesson name | C1 | lesson1 | 1 |
|
||||
And I am on the "Test lesson name" "lesson activity" page logged in as teacher1
|
||||
And I follow "Add a question page"
|
||||
And the following "mod_lesson > page" exist:
|
||||
| lesson | qtype | title | content |
|
||||
| Test lesson name | numeric | Hardest question ever | 1 + 1? |
|
||||
And the following "mod_lesson > answers" exist:
|
||||
| page | answer | response | jumpto | score |
|
||||
| Hardest question ever | 2.87 | Correct answer | End of lesson | 1 |
|
||||
| Hardest question ever | 2.1:2.8 | Incorrect answer | This page | 0 |
|
||||
|
||||
Scenario: Create a numerical question with the locale specific variables
|
||||
Given the following "activities" exist:
|
||||
| activity | name | course | idnumber | modattempts |
|
||||
| lesson | Empty lesson name | C1 | lesson2 | 1 |
|
||||
And I am on the "Empty lesson name" "lesson activity" page logged in as teacher1
|
||||
When I follow "Add a question page"
|
||||
And I set the field "Select a question type" to "Numerical"
|
||||
And I press "Add a question page"
|
||||
And I set the following fields to these values:
|
||||
| Page title | Hardest question ever |
|
||||
| Page contents | 1 + 1? |
|
||||
| id_answer_editor_0 | 2#87 |
|
||||
| Page title | Second question |
|
||||
| Page contents | 2 + 2? |
|
||||
| id_answer_editor_0 | 4#87 |
|
||||
| id_response_editor_0 | Correct answer |
|
||||
| id_jumpto_0 | End of lesson |
|
||||
| id_score_0 | 1 |
|
||||
| id_answer_editor_1 | 2#1:2#8 |
|
||||
| id_answer_editor_1 | 4#1:4#8 |
|
||||
| id_response_editor_1 | Incorrect answer |
|
||||
| id_jumpto_1 | This page |
|
||||
| id_score_1 | 0 |
|
||||
And I press "Save page"
|
||||
And I follow "Second question"
|
||||
Then I should see "4#87"
|
||||
And I should see "4#1:4#8"
|
||||
|
||||
Scenario: Edit a numerical question with the locale specific variables
|
||||
Given I am on the "Test lesson name" "lesson activity" page logged in as teacher1
|
||||
|
||||
@@ -24,62 +24,35 @@ Feature: Teachers can review student progress on all lessons in a course by view
|
||||
And I am on the "Test lesson name" "lesson activity" page logged in as teacher1
|
||||
|
||||
Scenario: View student progress for lesson that was never attempted
|
||||
Given I follow "Add a content page"
|
||||
And I set the following fields to these values:
|
||||
| Page title | First page name |
|
||||
| Page contents | First page contents |
|
||||
| id_answer_editor_0 | Next page |
|
||||
| id_jumpto_0 | Next page |
|
||||
And I press "Save page"
|
||||
And I select "Add a question page" from the "qtype" singleselect
|
||||
And I set the field "Select a question type" to "True/false"
|
||||
And I press "Add a question page"
|
||||
And I set the following fields to these values:
|
||||
| Page title | True/false question 1 |
|
||||
| Page contents | Paper is made from trees. |
|
||||
| id_answer_editor_0 | True |
|
||||
| id_response_editor_0 | Correct |
|
||||
| id_jumpto_0 | Next page |
|
||||
| id_answer_editor_1 | False |
|
||||
| id_response_editor_1 | Wrong |
|
||||
| id_jumpto_1 | This page |
|
||||
And I press "Save page"
|
||||
When I am on "Course 1" course homepage
|
||||
Given the following "mod_lesson > pages" exist:
|
||||
| lesson | qtype | title | content |
|
||||
| Test lesson name | content | First page name | First page contents |
|
||||
| Test lesson name | truefalse | True/false question 1 | Paper is made from trees. |
|
||||
And the following "mod_lesson > answers" exist:
|
||||
| page | answer | response | jumpto | score |
|
||||
| First page name | Next page | | Next page | 0 |
|
||||
| True/false question 1 | True | Correct | Next page | 1 |
|
||||
| True/false question 1 | False | Wrong | This page | 0 |
|
||||
When I log in as "teacher1"
|
||||
And I am on "Course 1" course homepage
|
||||
And I navigate to course participants
|
||||
And I follow "Student 1"
|
||||
And I follow "Outline report"
|
||||
Then I should see "No attempts have been made on this lesson"
|
||||
|
||||
Scenario: View student progress for an incomplete lesson containing both content and question pages
|
||||
Given I follow "Add a content page"
|
||||
And I set the following fields to these values:
|
||||
| Page title | First page name |
|
||||
| Page contents | First page contents |
|
||||
| id_answer_editor_0 | Next page |
|
||||
| id_jumpto_0 | Next page |
|
||||
And I press "Save page"
|
||||
And I select "Add a question page" from the "qtype" singleselect
|
||||
And I set the field "Select a question type" to "True/false"
|
||||
And I press "Add a question page"
|
||||
And I set the following fields to these values:
|
||||
| Page title | True/false question 1 |
|
||||
| Page contents | Paper is made from trees. |
|
||||
| id_answer_editor_0 | True |
|
||||
| id_response_editor_0 | Correct |
|
||||
| id_jumpto_0 | Next page |
|
||||
| id_answer_editor_1 | False |
|
||||
| id_response_editor_1 | Wrong |
|
||||
| id_jumpto_1 | This page |
|
||||
And I press "Save page"
|
||||
And I select "Add a content page" from the "qtype" singleselect
|
||||
And I set the following fields to these values:
|
||||
| Page title | Second page name |
|
||||
| Page contents | Second page contents |
|
||||
| id_answer_editor_0 | Previous page |
|
||||
| id_jumpto_0 | Previous page |
|
||||
| id_answer_editor_1 | Next page |
|
||||
| id_jumpto_1 | Next page |
|
||||
And I press "Save page"
|
||||
Given the following "mod_lesson > pages" exist:
|
||||
| lesson | qtype | title | content |
|
||||
| Test lesson name | content | First page name | First page contents |
|
||||
| Test lesson name | content | Second page name | Second page contents |
|
||||
| Test lesson name | truefalse | True/false question 1 | Paper is made from trees. |
|
||||
And the following "mod_lesson > answers" exist:
|
||||
| page | answer | response | jumpto | score |
|
||||
| First page name | Next page | | Next page | 0 |
|
||||
| Second page name | Previous page | | Previous page | 0 |
|
||||
| Second page name | Next page | | Next page | 0 |
|
||||
| True/false question 1 | True | Correct | Next page | 1 |
|
||||
| True/false question 1 | False | Wrong | This page | 0 |
|
||||
When I am on the "Test lesson name" "lesson activity" page logged in as student1
|
||||
And I should see "First page contents"
|
||||
And I press "Next page"
|
||||
@@ -90,35 +63,18 @@ Feature: Teachers can review student progress on all lessons in a course by view
|
||||
And I should see "Lesson has been started, but not yet completed"
|
||||
|
||||
Scenario: View student progress for a lesson containing both content and question pages
|
||||
Given I follow "Add a content page"
|
||||
And I set the following fields to these values:
|
||||
| Page title | First page name |
|
||||
| Page contents | First page contents |
|
||||
| id_answer_editor_0 | Next page |
|
||||
| id_jumpto_0 | Next page |
|
||||
And I press "Save page"
|
||||
And I select "Add a question page" from the "qtype" singleselect
|
||||
And I set the field "Select a question type" to "True/false"
|
||||
And I press "Add a question page"
|
||||
And I set the following fields to these values:
|
||||
| Page title | True/false question 1 |
|
||||
| Page contents | Paper is made from trees. |
|
||||
| id_answer_editor_0 | True |
|
||||
| id_response_editor_0 | Correct |
|
||||
| id_jumpto_0 | Next page |
|
||||
| id_answer_editor_1 | False |
|
||||
| id_response_editor_1 | Wrong |
|
||||
| id_jumpto_1 | This page |
|
||||
And I press "Save page"
|
||||
And I select "Add a content page" from the "qtype" singleselect
|
||||
And I set the following fields to these values:
|
||||
| Page title | Second page name |
|
||||
| Page contents | Second page contents |
|
||||
| id_answer_editor_0 | Previous page |
|
||||
| id_jumpto_0 | Previous page |
|
||||
| id_answer_editor_1 | Next page |
|
||||
| id_jumpto_1 | Next page |
|
||||
And I press "Save page"
|
||||
Given the following "mod_lesson > pages" exist:
|
||||
| lesson | qtype | title | content |
|
||||
| Test lesson name | content | First page name | First page contents |
|
||||
| Test lesson name | content | Second page name | Second page contents |
|
||||
| Test lesson name | truefalse | True/false question 1 | Paper is made from trees. |
|
||||
And the following "mod_lesson > answers" exist:
|
||||
| page | answer | response | jumpto | score |
|
||||
| First page name | Next page | | Next page | 0 |
|
||||
| Second page name | Previous page | | Previous page | 0 |
|
||||
| Second page name | Next page | | Next page | 0 |
|
||||
| True/false question 1 | True | Correct | Next page | 1 |
|
||||
| True/false question 1 | False | Wrong | This page | 0 |
|
||||
When I am on the "Test lesson name" "lesson activity" page logged in as student1
|
||||
And I should see "First page contents"
|
||||
And I press "Next page"
|
||||
@@ -137,22 +93,15 @@ Feature: Teachers can review student progress on all lessons in a course by view
|
||||
And I should see "Grade: 100.00 / 100.00"
|
||||
|
||||
Scenario: View student attempts in a lesson containing only content pages
|
||||
Given I follow "Add a content page"
|
||||
And I set the following fields to these values:
|
||||
| Page title | First page name |
|
||||
| Page contents | First page contents |
|
||||
| id_answer_editor_0 | Next page |
|
||||
| id_jumpto_0 | Next page |
|
||||
And I press "Save page"
|
||||
And I select "Add a content page" from the "qtype" singleselect
|
||||
And I set the following fields to these values:
|
||||
| Page title | Second page name |
|
||||
| Page contents | Second page contents |
|
||||
| id_answer_editor_0 | Previous page |
|
||||
| id_jumpto_0 | Previous page |
|
||||
| id_answer_editor_1 | End of lesson |
|
||||
| id_jumpto_1 | End of lesson |
|
||||
And I press "Save page"
|
||||
Given the following "mod_lesson > pages" exist:
|
||||
| lesson | qtype | title | content |
|
||||
| Test lesson name | content | First page name | First page contents |
|
||||
| Test lesson name | content | Second page name | Second page contents |
|
||||
And the following "mod_lesson > answers" exist:
|
||||
| page | answer | jumpto | score |
|
||||
| First page name | Next page | Next page | 0 |
|
||||
| Second page name | Previous page | Previous page | 0 |
|
||||
| Second page name | End of lesson | End of lesson | 0 |
|
||||
When I am on the "Test lesson name" "lesson activity" page logged in as student1
|
||||
And I should see "First page contents"
|
||||
And I press "Next page"
|
||||
|
||||
@@ -21,17 +21,14 @@ Feature: Practice mode in a lesson activity
|
||||
| course | C1 |
|
||||
| idnumber | 0001 |
|
||||
| name | Test lesson name |
|
||||
And I am on the "Test lesson name" "lesson activity" page logged in as teacher1
|
||||
And I follow "Add a question page"
|
||||
And I set the field "Select a question type" to "True/false"
|
||||
And I press "Add a question page"
|
||||
And I set the following fields to these values:
|
||||
| Page title | True or False |
|
||||
| Page contents | Paper is made from trees. |
|
||||
| id_answer_editor_0 | True |
|
||||
| id_answer_editor_1 | False |
|
||||
And I press "Save page"
|
||||
And I am on the "Test lesson name" "lesson activity editing" page
|
||||
And the following "mod_lesson > page" exist:
|
||||
| lesson | qtype | title | content |
|
||||
| Test lesson name | truefalse | True or False | Paper is made from trees. |
|
||||
And the following "mod_lesson > answers" exist:
|
||||
| page | answer | jumpto | score |
|
||||
| True or False | True | Next page | 1 |
|
||||
| True or False | False | This page | 0 |
|
||||
And I am on the "Test lesson name" "lesson activity editing" page logged in as teacher1
|
||||
|
||||
Scenario: Non-practice lesson records grades in the gradebook
|
||||
Given I set the following fields to these values:
|
||||
|
||||
@@ -19,42 +19,22 @@ Feature: In a lesson activity, students can see their progress viewing a progres
|
||||
And the following "activities" exist:
|
||||
| activity | name | course | idnumber |
|
||||
| lesson | Test lesson name | C1 | lesson1 |
|
||||
And the following "mod_lesson > pages" exist:
|
||||
| lesson | qtype | title | content |
|
||||
| Test lesson name | content | First page name | First page contents |
|
||||
| Test lesson name | content | Second page name | Second page contents |
|
||||
| Test lesson name | numeric | Hardest question ever | 1 + 1? |
|
||||
And the following "mod_lesson > answers" exist:
|
||||
| page | answer | response | jumpto | score |
|
||||
| First page name | Next page | | Next page | 0 |
|
||||
| Second page name | Previous page | | Previous page | 0 |
|
||||
| Second page name | Next page | | Next page | 0 |
|
||||
| Hardest question ever | 2 | Correct answer | End of lesson | 1 |
|
||||
| Hardest question ever | 1 | Incorrect answer | First page name | 0 |
|
||||
And I am on the "Test lesson name" "lesson activity editing" page logged in as teacher1
|
||||
And I set the following fields to these values:
|
||||
| Progress bar | Yes |
|
||||
And I press "Save and display"
|
||||
And I follow "Add a content page"
|
||||
And I set the following fields to these values:
|
||||
| Page title | First page name |
|
||||
| Page contents | First page contents |
|
||||
| id_answer_editor_0 | Next page |
|
||||
| id_jumpto_0 | Next page |
|
||||
And I press "Save page"
|
||||
And I select "Add a content page" from the "qtype" singleselect
|
||||
And I set the following fields to these values:
|
||||
| Page title | Second page name |
|
||||
| Page contents | Second page contents |
|
||||
| id_answer_editor_0 | Previous page |
|
||||
| id_jumpto_0 | Previous page |
|
||||
| id_answer_editor_1 | Next page |
|
||||
| id_jumpto_1 | Next page |
|
||||
And I press "Save page"
|
||||
And I select edit type "Expanded"
|
||||
And I click on "Add a question page here" "link" in the "//div[contains(concat(' ', normalize-space(@class), ' '), ' addlinks ')][3]" "xpath_element"
|
||||
And I set the field "Select a question type" to "Numerical"
|
||||
And I press "Add a question page"
|
||||
And I set the following fields to these values:
|
||||
| Page title | Hardest question ever |
|
||||
| Page contents | 1 + 1? |
|
||||
| id_answer_editor_0 | 2 |
|
||||
| id_response_editor_0 | Correct answer |
|
||||
| id_jumpto_0 | End of lesson |
|
||||
| id_score_0 | 1 |
|
||||
| id_answer_editor_1 | 1 |
|
||||
| id_response_editor_1 | Incorrect answer |
|
||||
| id_jumpto_1 | Second page name |
|
||||
| id_score_1 | 0 |
|
||||
And I press "Save page"
|
||||
When I am on the "Test lesson name" "lesson activity" page logged in as student1
|
||||
Then I should see "First page contents"
|
||||
And I should see "You have completed 0% of the lesson"
|
||||
|
||||
@@ -22,71 +22,27 @@ Feature: In a lesson activity, students can not re-attempt a question more than
|
||||
| name | Test lesson name |
|
||||
| retake | 1 |
|
||||
| minquestions | 3 |
|
||||
And I am on the "Test lesson name" "lesson activity" page logged in as teacher1
|
||||
And I follow "Add a content page"
|
||||
And I set the following fields to these values:
|
||||
| Page title | First page name |
|
||||
| Page contents | First page contents |
|
||||
| id_answer_editor_0 | Next page |
|
||||
| id_jumpto_0 | Next page |
|
||||
And I press "Save page"
|
||||
And I select "Add a content page" from the "qtype" singleselect
|
||||
And I set the following fields to these values:
|
||||
| Page title | Third page name |
|
||||
| Page contents | Third page contents |
|
||||
| id_answer_editor_0 | Previous page |
|
||||
| id_jumpto_0 | Previous page |
|
||||
| id_answer_editor_1 | Next page |
|
||||
| id_jumpto_1 | Next page |
|
||||
And I press "Save page"
|
||||
And I select "Add a question page" from the "qtype" singleselect
|
||||
And I set the field "Select a question type" to "True/false"
|
||||
And I press "Add a question page"
|
||||
And I set the following fields to these values:
|
||||
| Page title | True/false question 3 |
|
||||
| Page contents | Paper is made from trees. |
|
||||
| id_answer_editor_0 | True |
|
||||
| id_response_editor_0 | Correct |
|
||||
| id_jumpto_0 | Next page |
|
||||
| id_answer_editor_1 | False |
|
||||
| id_response_editor_1 | Wrong |
|
||||
| id_jumpto_1 | This page |
|
||||
And I press "Save page"
|
||||
And I select "Add a content page" from the "qtype" singleselect
|
||||
And I set the following fields to these values:
|
||||
| Page title | Second page name |
|
||||
| Page contents | Second page contents |
|
||||
| id_answer_editor_0 | Previous page |
|
||||
| id_jumpto_0 | Previous page |
|
||||
| id_answer_editor_1 | Next page |
|
||||
| id_jumpto_1 | Next page |
|
||||
And I press "Save page"
|
||||
And I select "Add a question page" from the "qtype" singleselect
|
||||
And I set the field "Select a question type" to "True/false"
|
||||
And I press "Add a question page"
|
||||
And I set the following fields to these values:
|
||||
| Page title | True/false question 2 |
|
||||
| Page contents | Kermit is a frog |
|
||||
| id_answer_editor_0 | True |
|
||||
| id_response_editor_0 | Correct |
|
||||
| id_jumpto_0 | Next page |
|
||||
| id_answer_editor_1 | False |
|
||||
| id_response_editor_1 | Wrong |
|
||||
| id_jumpto_1 | This page |
|
||||
And I press "Save page"
|
||||
And I select "Add a question page" from the "qtype" singleselect
|
||||
And I set the field "Select a question type" to "True/false"
|
||||
And I press "Add a question page"
|
||||
And I set the following fields to these values:
|
||||
| Page title | True/false question 1 |
|
||||
| Page contents | The earth is round. |
|
||||
| id_answer_editor_0 | True |
|
||||
| id_response_editor_0 | Correct |
|
||||
| id_jumpto_0 | Next page |
|
||||
| id_answer_editor_1 | False |
|
||||
| id_response_editor_1 | Wrong |
|
||||
| id_jumpto_1 | This page |
|
||||
And I press "Save page"
|
||||
And the following "mod_lesson > pages" exist:
|
||||
| lesson | qtype | title | content |
|
||||
| Test lesson name | content | First page name | First page contents |
|
||||
| Test lesson name | truefalse | True/false question 1 | The earth is round. |
|
||||
| Test lesson name | truefalse | True/false question 2 | Kermit is a frog |
|
||||
| Test lesson name | content | Second page name | Second page contents |
|
||||
| Test lesson name | truefalse | True/false question 3 | Paper is made from trees. |
|
||||
| Test lesson name | content | Third page name | Third page contents |
|
||||
And the following "mod_lesson > answers" exist:
|
||||
| page | answer | response | jumpto | score |
|
||||
| First page name | Next page | | Next page | 0 |
|
||||
| Second page name | Previous page | | Previous page | 0 |
|
||||
| Second page name | Next page | | Next page | 0 |
|
||||
| True/false question 1 | True | Correct | Next page | 1 |
|
||||
| True/false question 1 | False | Wrong | This page | 0 |
|
||||
| True/false question 2 | True | Correct | Next page | 1 |
|
||||
| True/false question 2 | False | Wrong | This page | 0 |
|
||||
| True/false question 3 | True | Correct | Next page | 1 |
|
||||
| True/false question 3 | False | Wrong | This page | 0 |
|
||||
| Third page name | Previous page | | Previous page | 0 |
|
||||
| Third page name | Next page | | Next page | 0 |
|
||||
|
||||
Scenario: Check that we can leave a quiz and when we re-enter we can not re-attempt the question again
|
||||
Given I am on the "Test lesson name" "lesson activity" page logged in as student1
|
||||
|
||||
@@ -19,60 +19,26 @@ Feature: In a lesson activity, teachers can review student attempts
|
||||
And the following "activities" exist:
|
||||
| activity | name | course | idnumber | retake |
|
||||
| lesson | Test lesson name | C1 | lesson1 | 1 |
|
||||
And I am on the "Test lesson name" "lesson activity" page logged in as teacher1
|
||||
|
||||
Scenario: View student attempts in a lesson containing both content and question pages
|
||||
Given I follow "Add a content page"
|
||||
And I set the following fields to these values:
|
||||
| Page title | First page name |
|
||||
| Page contents | First page contents |
|
||||
| id_answer_editor_0 | Next page |
|
||||
| id_jumpto_0 | Next page |
|
||||
And I press "Save page"
|
||||
And I select "Add a question page" from the "qtype" singleselect
|
||||
And I set the field "Select a question type" to "True/false"
|
||||
And I press "Add a question page"
|
||||
And I set the following fields to these values:
|
||||
| Page title | True/false question 2 |
|
||||
| Page contents | Kermit is a frog |
|
||||
| id_answer_editor_0 | True |
|
||||
| id_response_editor_0 | Correct |
|
||||
| id_jumpto_0 | Next page |
|
||||
| id_answer_editor_1 | False |
|
||||
| id_response_editor_1 | Wrong |
|
||||
| id_jumpto_1 | This page |
|
||||
And I press "Save page"
|
||||
And I select "Add a question page" from the "qtype" singleselect
|
||||
And I set the field "Select a question type" to "True/false"
|
||||
And I press "Add a question page"
|
||||
And I set the following fields to these values:
|
||||
| Page title | True/false question 1 |
|
||||
| Page contents | Paper is made from trees. |
|
||||
| id_answer_editor_0 | True |
|
||||
| id_response_editor_0 | Correct |
|
||||
| id_jumpto_0 | Next page |
|
||||
| id_answer_editor_1 | False |
|
||||
| id_response_editor_1 | Wrong |
|
||||
| id_jumpto_1 | This page |
|
||||
And I press "Save page"
|
||||
And I select "Add a content page" from the "qtype" singleselect
|
||||
And I set the following fields to these values:
|
||||
| Page title | Third page name |
|
||||
| Page contents | Third page contents |
|
||||
| id_answer_editor_0 | Previous page |
|
||||
| id_jumpto_0 | Previous page |
|
||||
| id_answer_editor_1 | Next page |
|
||||
| id_jumpto_1 | Next page |
|
||||
And I press "Save page"
|
||||
And I select "Add a content page" from the "qtype" singleselect
|
||||
And I set the following fields to these values:
|
||||
| Page title | Second page name |
|
||||
| Page contents | Second page contents |
|
||||
| id_answer_editor_0 | Previous page |
|
||||
| id_jumpto_0 | Previous page |
|
||||
| id_answer_editor_1 | Next page |
|
||||
| id_jumpto_1 | Next page |
|
||||
And I press "Save page"
|
||||
Given the following "mod_lesson > pages" exist:
|
||||
| lesson | qtype | title | content |
|
||||
| Test lesson name | content | First page name | First page contents |
|
||||
| Test lesson name | content | Second page name | Second page contents |
|
||||
| Test lesson name | content | Third page name | Third page contents |
|
||||
| Test lesson name | truefalse | True/false question 1 | Paper is made from trees. |
|
||||
| Test lesson name | truefalse | True/false question 2 | Kermit is a frog |
|
||||
And the following "mod_lesson > answers" exist:
|
||||
| page | answer | response | jumpto | score |
|
||||
| First page name | Next page | | Next page | 0 |
|
||||
| Second page name | Previous page | | Previous page | 0 |
|
||||
| Second page name | Next page | | Next page | 0 |
|
||||
| Third page name | Previous page | | Previous page | 0 |
|
||||
| Third page name | Next page | | Next page | 0 |
|
||||
| True/false question 1 | True | Correct | Next page | 1 |
|
||||
| True/false question 1 | False | Wrong | This page | 0 |
|
||||
| True/false question 2 | True | Correct | Next page | 1 |
|
||||
| True/false question 2 | False | Wrong | This page | 0 |
|
||||
When I am on the "Test lesson name" "lesson activity" page logged in as student1
|
||||
And I should see "First page contents"
|
||||
And I press "Next page"
|
||||
@@ -100,40 +66,21 @@ Feature: In a lesson activity, teachers can review student attempts
|
||||
And I should see "Low score"
|
||||
|
||||
Scenario: View student attempts in a lesson containing only content pages
|
||||
Given I follow "Add a content page"
|
||||
And I set the following fields to these values:
|
||||
| Page title | First page name |
|
||||
| Page contents | First page contents |
|
||||
| id_answer_editor_0 | Next page |
|
||||
| id_jumpto_0 | Next page |
|
||||
And I press "Save page"
|
||||
And I select "Add a content page" from the "qtype" singleselect
|
||||
And I set the following fields to these values:
|
||||
| Page title | Fourth page name |
|
||||
| Page contents | Fourth page contents |
|
||||
| id_answer_editor_0 | Previous page |
|
||||
| id_jumpto_0 | Previous page |
|
||||
| id_answer_editor_1 | End of lesson |
|
||||
| id_jumpto_1 | End of lesson |
|
||||
And I press "Save page"
|
||||
And I select "Add a content page" from the "qtype" singleselect
|
||||
And I set the following fields to these values:
|
||||
| Page title | Third page name |
|
||||
| Page contents | Third page contents |
|
||||
| id_answer_editor_0 | Previous page |
|
||||
| id_jumpto_0 | Previous page |
|
||||
| id_answer_editor_1 | Next page |
|
||||
| id_jumpto_1 | Next page |
|
||||
And I press "Save page"
|
||||
And I select "Add a content page" from the "qtype" singleselect
|
||||
And I set the following fields to these values:
|
||||
| Page title | Second page name |
|
||||
| Page contents | Second page contents |
|
||||
| id_answer_editor_0 | Previous page |
|
||||
| id_jumpto_0 | Previous page |
|
||||
| id_answer_editor_1 | Next page |
|
||||
| id_jumpto_1 | Next page |
|
||||
And I press "Save page"
|
||||
Given the following "mod_lesson > pages" exist:
|
||||
| lesson | qtype | title | content |
|
||||
| Test lesson name | content | First page name | First page contents |
|
||||
| Test lesson name | content | Second page name | Second page contents |
|
||||
| Test lesson name | content | Third page name | Third page contents |
|
||||
| Test lesson name | content | Fourth page name | Fourth page contents |
|
||||
And the following "mod_lesson > answers" exist:
|
||||
| page | answer | jumpto |
|
||||
| First page name | Next page | Next page |
|
||||
| Second page name | Previous page | Previous page |
|
||||
| Second page name | Next page | Next page |
|
||||
| Third page name | Previous page | Previous page |
|
||||
| Third page name | Next page | Next page |
|
||||
| Fourth page name | Previous page | Previous page |
|
||||
| Fourth page name | End of lesson | End of lesson |
|
||||
When I am on the "Test lesson name" "lesson activity" page logged in as student1
|
||||
And I should see "First page contents"
|
||||
And I press "Next page"
|
||||
|
||||
@@ -24,15 +24,12 @@ Feature: In a lesson activity, teachers can view detailed statistics report
|
||||
And I am on the "Test lesson name" "lesson activity" page logged in as teacher1
|
||||
|
||||
Scenario: View detailed statistics in a lesson when empty string is given as answer
|
||||
Given I follow "Add a question page"
|
||||
And I set the field "Select a question type" to "Numerical"
|
||||
And I press "Add a question page"
|
||||
And I set the following fields to these values:
|
||||
| Page title | Numerical question |
|
||||
| Page contents | What is 1 + 0.5? |
|
||||
| id_answer_editor_0 | 1.5 |
|
||||
| id_jumpto_0 | End of lesson |
|
||||
And I press "Save page"
|
||||
Given the following "mod_lesson > page" exist:
|
||||
| lesson | qtype | title | content |
|
||||
| Test lesson name | numeric | Numerical question | What is 1 + 0.5? |
|
||||
And the following "mod_lesson > answer" exist:
|
||||
| page | answer | jumpto | score |
|
||||
| Numerical question | 1.5 | End of lesson | 1 |
|
||||
When I am on the "Test lesson name" "lesson activity" page logged in as student1
|
||||
And I press "Submit"
|
||||
And I log out
|
||||
|
||||
@@ -16,9 +16,19 @@ Feature: In a lesson activity, students can review the answers they gave to ques
|
||||
| user | course | role |
|
||||
| teacher1 | C1 | editingteacher |
|
||||
| student1 | C1 | student |
|
||||
Given the following "activities" exist:
|
||||
And the following "activity" exist:
|
||||
| activity | name | course | idnumber |
|
||||
| lesson | Test lesson name | C1 | lesson1 |
|
||||
And the following "mod_lesson > pages" exist:
|
||||
| lesson | qtype | title | content |
|
||||
| Test lesson name | numeric | Hardest question ever | 1 + 1? |
|
||||
| Test lesson name | truefalse | Next question | Paper is made from trees. |
|
||||
And the following "mod_lesson > answers" exist:
|
||||
| page | answer | response | jumpto | score |
|
||||
| Hardest question ever | 2 | Correct answer | Next page | 1 |
|
||||
| Hardest question ever | 1 | Incorrect answer | This page | 0 |
|
||||
| Next question | True | Correct | Next page | 1 |
|
||||
| Next question | False | Wrong | This page | 0 |
|
||||
And I am on the "Test lesson name" "lesson activity editing" page logged in as teacher1
|
||||
And I set the following fields to these values:
|
||||
| Display ongoing score | Yes |
|
||||
@@ -29,32 +39,6 @@ Feature: In a lesson activity, students can review the answers they gave to ques
|
||||
| Custom scoring | No |
|
||||
| Re-takes allowed | Yes |
|
||||
And I press "Save and display"
|
||||
And I follow "Add a question page"
|
||||
And I set the field "Select a question type" to "Numerical"
|
||||
And I press "Add a question page"
|
||||
And I set the following fields to these values:
|
||||
| Page title | Hardest question ever |
|
||||
| Page contents | 1 + 1? |
|
||||
| id_answer_editor_0 | 2 |
|
||||
| id_response_editor_0 | Correct answer |
|
||||
| id_jumpto_0 | Next page |
|
||||
| id_answer_editor_1 | 1 |
|
||||
| id_response_editor_1 | Incorrect answer |
|
||||
| id_jumpto_1 | This page |
|
||||
And I press "Save page"
|
||||
And I select "Add a question page" from the "qtype" singleselect
|
||||
And I set the field "Select a question type" to "True/false"
|
||||
And I press "Add a question page"
|
||||
And I set the following fields to these values:
|
||||
| Page title | Next question |
|
||||
| Page contents | Paper is made from trees. |
|
||||
| id_answer_editor_0 | True |
|
||||
| id_response_editor_0 | Correct |
|
||||
| id_jumpto_0 | Next page |
|
||||
| id_answer_editor_1 | False |
|
||||
| id_response_editor_1 | Wrong |
|
||||
| id_jumpto_1 | This page |
|
||||
And I press "Save page"
|
||||
And I am on the "Test lesson name" "lesson activity" page logged in as student1
|
||||
And I should see "You have answered 0 correctly out of 0 attempts."
|
||||
And I set the following fields to these values:
|
||||
|
||||
@@ -1,325 +0,0 @@
|
||||
@mod @mod_lesson
|
||||
Feature: In Dashboard, a student can see their current status on all lessons with an upcoming due date
|
||||
In order to know my status on a lesson
|
||||
As a student
|
||||
I need to see it in Dashboard
|
||||
|
||||
Background:
|
||||
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 "activities" exist:
|
||||
| activity | name | deadline | retake | course | idnumber |
|
||||
| lesson | Test lesson name | 1893481200 | 1 | C1 | lesson1 |
|
||||
|
||||
Scenario: A completed lesson with only questions that allows multiple attempts
|
||||
Given I am on the "Test lesson name" "lesson activity" page logged in as teacher1
|
||||
And I follow "Add a question page"
|
||||
And I set the field "Select a question type" to "True/false"
|
||||
And I press "Add a question page"
|
||||
And I set the following fields to these values:
|
||||
| Page title | True/false question 1 |
|
||||
| Page contents | Cat is an amphibian |
|
||||
| id_answer_editor_0 | False |
|
||||
| id_response_editor_0 | Correct |
|
||||
| id_jumpto_0 | Next page |
|
||||
| id_answer_editor_1 | True |
|
||||
| id_response_editor_1 | Wrong |
|
||||
| id_jumpto_1 | This page |
|
||||
And I press "Save page"
|
||||
And I select "Add a question page" from the "qtype" singleselect
|
||||
And I set the field "Select a question type" to "True/false"
|
||||
And I press "Add a question page"
|
||||
And I set the following fields to these values:
|
||||
| Page title | True/false question 2 |
|
||||
| Page contents | Paper is made from trees. |
|
||||
| id_answer_editor_0 | True |
|
||||
| id_response_editor_0 | Correct |
|
||||
| id_jumpto_0 | Next page |
|
||||
| id_answer_editor_1 | False |
|
||||
| id_response_editor_1 | Wrong |
|
||||
| id_jumpto_1 | This page |
|
||||
And I press "Save page"
|
||||
And I am on the "Test lesson name" "lesson activity" page logged in as student1
|
||||
And I should see "Cat is an amphibian"
|
||||
And I set the following fields to these values:
|
||||
| False | 1 |
|
||||
And I press "Submit"
|
||||
And I press "Continue"
|
||||
And I should see "Paper is made from trees."
|
||||
And I set the following fields to these values:
|
||||
| False | 1 |
|
||||
And I press "Submit"
|
||||
And I press "Continue"
|
||||
And I should see "Congratulations - end of lesson reached"
|
||||
|
||||
Scenario: A completed lesson with only questions that does not allow multiple attempts
|
||||
Given I am on the "Test lesson name" "lesson activity editing" page logged in as teacher1
|
||||
And I set the following fields to these values:
|
||||
| Re-takes allowed | 0 |
|
||||
And I press "Save and display"
|
||||
And I follow "Add a question page"
|
||||
And I set the field "Select a question type" to "True/false"
|
||||
And I press "Add a question page"
|
||||
And I set the following fields to these values:
|
||||
| Page title | True/false question 1 |
|
||||
| Page contents | Cat is an amphibian |
|
||||
| id_answer_editor_0 | False |
|
||||
| id_response_editor_0 | Correct |
|
||||
| id_jumpto_0 | Next page |
|
||||
| id_answer_editor_1 | True |
|
||||
| id_response_editor_1 | Wrong |
|
||||
| id_jumpto_1 | This page |
|
||||
And I press "Save page"
|
||||
And I select "Add a question page" from the "qtype" singleselect
|
||||
And I set the field "Select a question type" to "True/false"
|
||||
And I press "Add a question page"
|
||||
And I set the following fields to these values:
|
||||
| Page title | True/false question 2 |
|
||||
| Page contents | Paper is made from trees. |
|
||||
| id_answer_editor_0 | True |
|
||||
| id_response_editor_0 | Correct |
|
||||
| id_jumpto_0 | Next page |
|
||||
| id_answer_editor_1 | False |
|
||||
| id_response_editor_1 | Wrong |
|
||||
| id_jumpto_1 | This page |
|
||||
And I press "Save page"
|
||||
And I am on the "Test lesson name" "lesson activity" page logged in as student1
|
||||
And I should see "Cat is an amphibian"
|
||||
And I set the following fields to these values:
|
||||
| False | 1 |
|
||||
And I press "Submit"
|
||||
And I press "Continue"
|
||||
And I should see "Paper is made from trees."
|
||||
And I set the following fields to these values:
|
||||
| False | 1 |
|
||||
And I press "Submit"
|
||||
And I press "Continue"
|
||||
And I should see "Congratulations - end of lesson reached"
|
||||
|
||||
Scenario: A completed lesson with only content pages that allows multiple attempts
|
||||
Given I am on the "Test lesson name" "lesson activity" page logged in as teacher1
|
||||
And I follow "Add a content page"
|
||||
And I set the following fields to these values:
|
||||
| Page title | First page name |
|
||||
| Page contents | First page contents |
|
||||
| id_answer_editor_0 | Next page |
|
||||
| id_jumpto_0 | Next page |
|
||||
And I press "Save page"
|
||||
And I select "Add a content page" from the "qtype" singleselect
|
||||
And I set the following fields to these values:
|
||||
| Page title | Second page name |
|
||||
| Page contents | Second page contents |
|
||||
| id_answer_editor_0 | Previous page |
|
||||
| id_jumpto_0 | Previous page |
|
||||
| id_answer_editor_1 | End of lesson |
|
||||
| id_jumpto_1 | End of lesson |
|
||||
And I press "Save page"
|
||||
And I am on the "Test lesson name" "lesson activity" page logged in as student1
|
||||
And I should see "First page contents"
|
||||
And I press "Next page"
|
||||
And I should see "Second page contents"
|
||||
And I press "End of lesson"
|
||||
|
||||
Scenario: A completed lesson with only content pages that does not allow multiple attempts
|
||||
Given I am on the "Test lesson name" "lesson activity editing" page logged in as teacher1
|
||||
And I set the following fields to these values:
|
||||
| Re-takes allowed | 0 |
|
||||
And I press "Save and display"
|
||||
And I follow "Add a content page"
|
||||
And I set the following fields to these values:
|
||||
| Page title | First page name |
|
||||
| Page contents | First page contents |
|
||||
| id_answer_editor_0 | Next page |
|
||||
| id_jumpto_0 | Next page |
|
||||
And I press "Save page"
|
||||
And I select "Add a content page" from the "qtype" singleselect
|
||||
And I set the following fields to these values:
|
||||
| Page title | Second page name |
|
||||
| Page contents | Second page contents |
|
||||
| id_answer_editor_0 | Previous page |
|
||||
| id_jumpto_0 | Previous page |
|
||||
| id_answer_editor_1 | End of lesson |
|
||||
| id_jumpto_1 | End of lesson |
|
||||
And I press "Save page"
|
||||
And I am on the "Test lesson name" "lesson activity" page logged in as student1
|
||||
And I should see "First page contents"
|
||||
And I press "Next page"
|
||||
And I should see "Second page contents"
|
||||
And I press "End of lesson"
|
||||
|
||||
Scenario: An incomplete lesson with only questions.
|
||||
Given I am on the "Test lesson name" "lesson activity" page logged in as teacher1
|
||||
And I follow "Add a question page"
|
||||
And I set the field "Select a question type" to "True/false"
|
||||
And I press "Add a question page"
|
||||
And I set the following fields to these values:
|
||||
| Page title | True/false question 1 |
|
||||
| Page contents | Cat is an amphibian |
|
||||
| id_answer_editor_0 | False |
|
||||
| id_response_editor_0 | Correct |
|
||||
| id_jumpto_0 | Next page |
|
||||
| id_answer_editor_1 | True |
|
||||
| id_response_editor_1 | Wrong |
|
||||
| id_jumpto_1 | This page |
|
||||
And I press "Save page"
|
||||
And I select "Add a question page" from the "qtype" singleselect
|
||||
And I set the field "Select a question type" to "True/false"
|
||||
And I press "Add a question page"
|
||||
And I set the following fields to these values:
|
||||
| Page title | True/false question 2 |
|
||||
| Page contents | Paper is made from trees. |
|
||||
| id_answer_editor_0 | True |
|
||||
| id_response_editor_0 | Correct |
|
||||
| id_jumpto_0 | Next page |
|
||||
| id_answer_editor_1 | False |
|
||||
| id_response_editor_1 | Wrong |
|
||||
| id_jumpto_1 | This page |
|
||||
And I press "Save page"
|
||||
And I am on the "Test lesson name" "lesson activity" page logged in as student1
|
||||
And I should see "Cat is an amphibian"
|
||||
And I set the following fields to these values:
|
||||
| False | 1 |
|
||||
And I press "Submit"
|
||||
And I press "Continue"
|
||||
|
||||
Scenario: An incomplete lesson with only content pages.
|
||||
Given I am on the "Test lesson name" "lesson activity" page logged in as teacher1
|
||||
And I follow "Add a content page"
|
||||
And I set the following fields to these values:
|
||||
| Page title | First page name |
|
||||
| Page contents | First page contents |
|
||||
| id_answer_editor_0 | Next page |
|
||||
| id_jumpto_0 | Next page |
|
||||
And I press "Save page"
|
||||
And I select "Add a content page" from the "qtype" singleselect
|
||||
And I set the following fields to these values:
|
||||
| Page title | Second page name |
|
||||
| Page contents | Second page contents |
|
||||
| id_answer_editor_0 | Previous page |
|
||||
| id_jumpto_0 | Previous page |
|
||||
| id_answer_editor_1 | End of lesson |
|
||||
| id_jumpto_1 | End of lesson |
|
||||
And I press "Save page"
|
||||
And I am on the "Test lesson name" "lesson activity" page logged in as student1
|
||||
And I should see "First page contents"
|
||||
And I press "Next page"
|
||||
And I should see "Second page contents"
|
||||
|
||||
Scenario: A lesson with only questions that has not been started.
|
||||
Given I am on the "Test lesson name" "lesson activity" page logged in as teacher1
|
||||
And I follow "Add a question page"
|
||||
And I set the field "Select a question type" to "True/false"
|
||||
And I press "Add a question page"
|
||||
And I set the following fields to these values:
|
||||
| Page title | True/false question 1 |
|
||||
| Page contents | Cat is an amphibian |
|
||||
| id_answer_editor_0 | False |
|
||||
| id_response_editor_0 | Correct |
|
||||
| id_jumpto_0 | Next page |
|
||||
| id_answer_editor_1 | True |
|
||||
| id_response_editor_1 | Wrong |
|
||||
| id_jumpto_1 | This page |
|
||||
And I press "Save page"
|
||||
And I select "Add a question page" from the "qtype" singleselect
|
||||
And I set the field "Select a question type" to "True/false"
|
||||
And I press "Add a question page"
|
||||
And I set the following fields to these values:
|
||||
| Page title | True/false question 2 |
|
||||
| Page contents | Paper is made from trees. |
|
||||
| id_answer_editor_0 | True |
|
||||
| id_response_editor_0 | Correct |
|
||||
| id_jumpto_0 | Next page |
|
||||
| id_answer_editor_1 | False |
|
||||
| id_response_editor_1 | Wrong |
|
||||
| id_jumpto_1 | This page |
|
||||
And I press "Save page"
|
||||
|
||||
Scenario: A lesson with only content pages that has not been started.
|
||||
Given I am on the "Test lesson name" "lesson activity" page logged in as teacher1
|
||||
And I follow "Add a content page"
|
||||
And I set the following fields to these values:
|
||||
| Page title | First page name |
|
||||
| Page contents | First page contents |
|
||||
| id_answer_editor_0 | Next page |
|
||||
| id_jumpto_0 | Next page |
|
||||
And I press "Save page"
|
||||
And I select "Add a content page" from the "qtype" singleselect
|
||||
And I set the following fields to these values:
|
||||
| Page title | Second page name |
|
||||
| Page contents | Second page contents |
|
||||
| id_answer_editor_0 | Previous page |
|
||||
| id_jumpto_0 | Previous page |
|
||||
| id_answer_editor_1 | End of lesson |
|
||||
| id_jumpto_1 | End of lesson |
|
||||
And I press "Save page"
|
||||
|
||||
Scenario: Viewing the status for multiple lessons in multiple courses
|
||||
Given the following "courses" exist:
|
||||
| fullname | shortname | category |
|
||||
| Course 2 | C2 | 0 |
|
||||
And the following "course enrolments" exist:
|
||||
| user | course | role |
|
||||
| teacher1 | C2 | editingteacher |
|
||||
| student1 | C2 | student |
|
||||
And the following "activities" exist:
|
||||
| activity | name | deadline | retake | course | idnumber |
|
||||
| lesson | Test lesson name 2 | 1893481200 | 1 | C1 | lesson1 |
|
||||
| lesson | Test lesson name 3 | 1893481200 | 1 | C2 | lesson1 |
|
||||
And I am on the "Test lesson name" "lesson activity" page logged in as teacher1
|
||||
And I follow "Add a question page"
|
||||
And I set the field "Select a question type" to "True/false"
|
||||
And I press "Add a question page"
|
||||
And I set the following fields to these values:
|
||||
| Page title | True/false question |
|
||||
| Page contents | D035 M00d13 r0x0rz j00 b0x0rs? |
|
||||
| id_answer_editor_0 | True |
|
||||
| id_answer_editor_1 | False |
|
||||
And I press "Save page"
|
||||
And I am on the "Test lesson name 2" "lesson activity" page
|
||||
And I follow "Add a question page"
|
||||
And I set the field "Select a question type" to "True/false"
|
||||
And I press "Add a question page"
|
||||
And I set the following fields to these values:
|
||||
| Page title | True/false question |
|
||||
| Page contents | D035 M00d13 r0x0rz j00 b0x0rs? |
|
||||
| id_answer_editor_0 | True |
|
||||
| id_answer_editor_1 | False |
|
||||
And I press "Save page"
|
||||
And I am on the "Test lesson name 3" "lesson activity" page
|
||||
And I follow "Add a question page"
|
||||
And I set the field "Select a question type" to "True/false"
|
||||
And I press "Add a question page"
|
||||
And I set the following fields to these values:
|
||||
| Page title | True/false question 1 |
|
||||
| Page contents | D035 M00d13 r0x0rz j00 b0x0rs? |
|
||||
| id_answer_editor_0 | True |
|
||||
| id_answer_editor_1 | False |
|
||||
And I press "Save page"
|
||||
And I select "Add a question page" from the "qtype" singleselect
|
||||
And I set the field "Select a question type" to "True/false"
|
||||
And I press "Add a question page"
|
||||
And I set the following fields to these values:
|
||||
| Page title | True/false question 2 |
|
||||
| Page contents | D035 M00d13 r0x0rz j00 b0x0rs? |
|
||||
| id_answer_editor_0 | True |
|
||||
| id_answer_editor_1 | False |
|
||||
And I press "Save page"
|
||||
And I am on the "Test lesson name" "lesson activity" page logged in as student1
|
||||
And I should see "D035 M00d13 r0x0rz j00 b0x0rs?"
|
||||
And I set the following fields to these values:
|
||||
| True | 1 |
|
||||
And I press "Submit"
|
||||
And I am on the "Test lesson name 3" "lesson activity" page
|
||||
And I should see "D035 M00d13 r0x0rz j00 b0x0rs?"
|
||||
And I set the following fields to these values:
|
||||
| True | 1 |
|
||||
And I press "Submit"
|
||||
@@ -20,60 +20,26 @@ Feature: In a lesson activity a student should
|
||||
| course | C1 |
|
||||
| idnumber | 0001 |
|
||||
| retake | 1 |
|
||||
And I am on the "Test lesson name" "lesson activity" page logged in as teacher1
|
||||
|
||||
Scenario: resume a lesson with both content then question pages
|
||||
Given I follow "Add a content page"
|
||||
And I set the following fields to these values:
|
||||
| Page title | First page name |
|
||||
| Page contents | First page contents |
|
||||
| id_answer_editor_0 | Next page |
|
||||
| id_jumpto_0 | Next page |
|
||||
And I press "Save page"
|
||||
And I select "Add a question page" from the "qtype" singleselect
|
||||
And I set the field "Select a question type" to "True/false"
|
||||
And I press "Add a question page"
|
||||
And I set the following fields to these values:
|
||||
| Page title | True/false question 2 |
|
||||
| Page contents | Kermit is a frog |
|
||||
| id_answer_editor_0 | True |
|
||||
| id_response_editor_0 | Correct |
|
||||
| id_jumpto_0 | Next page |
|
||||
| id_answer_editor_1 | False |
|
||||
| id_response_editor_1 | Wrong |
|
||||
| id_jumpto_1 | This page |
|
||||
And I press "Save page"
|
||||
And I select "Add a question page" from the "qtype" singleselect
|
||||
And I set the field "Select a question type" to "True/false"
|
||||
And I press "Add a question page"
|
||||
And I set the following fields to these values:
|
||||
| Page title | True/false question 1 |
|
||||
| Page contents | Paper is made from trees. |
|
||||
| id_answer_editor_0 | True |
|
||||
| id_response_editor_0 | Correct |
|
||||
| id_jumpto_0 | Next page |
|
||||
| id_answer_editor_1 | False |
|
||||
| id_response_editor_1 | Wrong |
|
||||
| id_jumpto_1 | This page |
|
||||
And I press "Save page"
|
||||
And I select "Add a content page" from the "qtype" singleselect
|
||||
And I set the following fields to these values:
|
||||
| Page title | Third page name |
|
||||
| Page contents | Third page contents |
|
||||
| id_answer_editor_0 | Previous page |
|
||||
| id_jumpto_0 | Previous page |
|
||||
| id_answer_editor_1 | Next page |
|
||||
| id_jumpto_1 | Next page |
|
||||
And I press "Save page"
|
||||
And I select "Add a content page" from the "qtype" singleselect
|
||||
And I set the following fields to these values:
|
||||
| Page title | Second page name |
|
||||
| Page contents | Second page contents |
|
||||
| id_answer_editor_0 | Previous page |
|
||||
| id_jumpto_0 | Previous page |
|
||||
| id_answer_editor_1 | Next page |
|
||||
| id_jumpto_1 | Next page |
|
||||
And I press "Save page"
|
||||
Given the following "mod_lesson > pages" exist:
|
||||
| lesson | qtype | title | content |
|
||||
| Test lesson name | content | First page name | First page contents |
|
||||
| Test lesson name | content | Second page name | Second page contents |
|
||||
| Test lesson name | content | Third page name | Third page contents |
|
||||
| Test lesson name | truefalse | True/false question 1 | Paper is made from trees. |
|
||||
| Test lesson name | truefalse | True/false question 2 | Kermit is a frog |
|
||||
And the following "mod_lesson > answers" exist:
|
||||
| page | answer | response | jumpto | score |
|
||||
| First page name | Next page | | Next page | 0 |
|
||||
| Second page name | Previous page | | Previous page | 0 |
|
||||
| Second page name | Next page | | Next page | 0 |
|
||||
| Third page name | Previous page | | Previous page | 0 |
|
||||
| Third page name | Next page | | Next page | 0 |
|
||||
| True/false question 1 | True | Correct | Next page | 1 |
|
||||
| True/false question 1 | False | Wrong | This page | 0 |
|
||||
| True/false question 2 | True | Correct | Next page | 1 |
|
||||
| True/false question 2 | False | Wrong | This page | 0 |
|
||||
When I am on the "Test lesson name" "lesson activity" page logged in as student1
|
||||
And I should see "First page contents"
|
||||
And I press "Next page"
|
||||
@@ -116,40 +82,21 @@ Feature: In a lesson activity a student should
|
||||
And I should see "Congratulations - end of lesson reached"
|
||||
|
||||
Scenario: resume a lesson with only content pages
|
||||
Given I follow "Add a content page"
|
||||
And I set the following fields to these values:
|
||||
| Page title | First page name |
|
||||
| Page contents | First page contents |
|
||||
| id_answer_editor_0 | Next page |
|
||||
| id_jumpto_0 | Next page |
|
||||
And I press "Save page"
|
||||
And I select "Add a content page" from the "qtype" singleselect
|
||||
And I set the following fields to these values:
|
||||
| Page title | Fourth page name |
|
||||
| Page contents | Fourth page contents |
|
||||
| id_answer_editor_0 | Previous page |
|
||||
| id_jumpto_0 | Previous page |
|
||||
| id_answer_editor_1 | End of lesson |
|
||||
| id_jumpto_1 | End of lesson |
|
||||
And I press "Save page"
|
||||
And I select "Add a content page" from the "qtype" singleselect
|
||||
And I set the following fields to these values:
|
||||
| Page title | Third page name |
|
||||
| Page contents | Third page contents |
|
||||
| id_answer_editor_0 | Previous page |
|
||||
| id_jumpto_0 | Previous page |
|
||||
| id_answer_editor_1 | Next page |
|
||||
| id_jumpto_1 | Next page |
|
||||
And I press "Save page"
|
||||
And I select "Add a content page" from the "qtype" singleselect
|
||||
And I set the following fields to these values:
|
||||
| Page title | Second page name |
|
||||
| Page contents | Second page contents |
|
||||
| id_answer_editor_0 | Previous page |
|
||||
| id_jumpto_0 | Previous page |
|
||||
| id_answer_editor_1 | Next page |
|
||||
| id_jumpto_1 | Next page |
|
||||
And I press "Save page"
|
||||
Given the following "mod_lesson > pages" exist:
|
||||
| lesson | qtype | title | content |
|
||||
| Test lesson name | content | First page name | First page contents |
|
||||
| Test lesson name | content | Second page name | Second page contents |
|
||||
| Test lesson name | content | Third page name | Third page contents |
|
||||
| Test lesson name | content | Fourth page name | Fourth page contents |
|
||||
And the following "mod_lesson > answers" exist:
|
||||
| page | answer | jumpto |
|
||||
| First page name | Next page | Next page |
|
||||
| Second page name | Previous page | Previous page |
|
||||
| Second page name | Next page | Next page |
|
||||
| Third page name | Previous page | Previous page |
|
||||
| Third page name | Next page | Next page |
|
||||
| Fourth page name | Previous page | Previous page |
|
||||
| Fourth page name | End of lesson | End of lesson |
|
||||
When I am on the "Test lesson name" "lesson activity" page logged in as student1
|
||||
And I should see "First page contents"
|
||||
And I press "Next page"
|
||||
@@ -173,92 +120,36 @@ Feature: In a lesson activity a student should
|
||||
And I should see "First page contents"
|
||||
|
||||
Scenario: resume a lesson with both question then content pages
|
||||
Given I follow "Add a question page"
|
||||
And I set the field "Select a question type" to "True/false"
|
||||
And I press "Add a question page"
|
||||
And I set the following fields to these values:
|
||||
| Page title | True/false question 1 |
|
||||
| Page contents | Cat is an amphibian |
|
||||
| id_answer_editor_0 | False |
|
||||
| id_response_editor_0 | Correct |
|
||||
| id_jumpto_0 | Next page |
|
||||
| id_answer_editor_1 | True |
|
||||
| id_response_editor_1 | Wrong |
|
||||
| id_jumpto_1 | This page |
|
||||
And I press "Save page"
|
||||
And I select "Add a question page" from the "qtype" singleselect
|
||||
And I set the field "Select a question type" to "True/false"
|
||||
And I press "Add a question page"
|
||||
And I set the following fields to these values:
|
||||
| Page title | True/false question 5 |
|
||||
| Page contents | Kermit is a frog |
|
||||
| id_answer_editor_0 | True |
|
||||
| id_response_editor_0 | Correct |
|
||||
| id_jumpto_0 | Next page |
|
||||
| id_answer_editor_1 | False |
|
||||
| id_response_editor_1 | Wrong |
|
||||
| id_jumpto_1 | This page |
|
||||
And I press "Save page"
|
||||
And I select "Add a content page" from the "qtype" singleselect
|
||||
And I set the following fields to these values:
|
||||
| Page title | Content page 2 |
|
||||
| Page contents | Second content page |
|
||||
| id_answer_editor_0 | Next page |
|
||||
| id_jumpto_0 | Next page |
|
||||
And I press "Save page"
|
||||
And I select "Add a question page" from the "qtype" singleselect
|
||||
And I set the field "Select a question type" to "True/false"
|
||||
And I press "Add a question page"
|
||||
And I set the following fields to these values:
|
||||
| Page title | True/false question 4 |
|
||||
| Page contents | 2+2=4 |
|
||||
| id_answer_editor_0 | True |
|
||||
| id_response_editor_0 | Correct |
|
||||
| id_jumpto_0 | Next page |
|
||||
| id_answer_editor_1 | False |
|
||||
| id_response_editor_1 | Wrong |
|
||||
| id_jumpto_1 | This page |
|
||||
And I press "Save page"
|
||||
And I select "Add a question page" from the "qtype" singleselect
|
||||
And I set the field "Select a question type" to "True/false"
|
||||
And I press "Add a question page"
|
||||
And I set the following fields to these values:
|
||||
| Page title | True/false question 3 |
|
||||
| Page contents | 1+1=2 |
|
||||
| id_answer_editor_0 | True |
|
||||
| id_response_editor_0 | Correct |
|
||||
| id_jumpto_0 | Next page |
|
||||
| id_answer_editor_1 | False |
|
||||
| id_response_editor_1 | Wrong |
|
||||
| id_jumpto_1 | This page |
|
||||
And I press "Save page"
|
||||
And I select "Add a question page" from the "qtype" singleselect
|
||||
And I set the field "Select a question type" to "True/false"
|
||||
And I press "Add a question page"
|
||||
And I set the following fields to these values:
|
||||
| Page title | True/false question 2 |
|
||||
| Page contents | Paper is made from trees. |
|
||||
| id_answer_editor_0 | True |
|
||||
| id_response_editor_0 | Correct |
|
||||
| id_jumpto_0 | Next page |
|
||||
| id_answer_editor_1 | False |
|
||||
| id_response_editor_1 | Wrong |
|
||||
| id_jumpto_1 | This page |
|
||||
And I press "Save page"
|
||||
And I select "Add a content page" from the "qtype" singleselect
|
||||
And I set the following fields to these values:
|
||||
| Page title | Content page 1 |
|
||||
| Page contents | First content page |
|
||||
| id_answer_editor_0 | Next page |
|
||||
| id_jumpto_0 | Next page |
|
||||
And I press "Save page"
|
||||
Given the following "mod_lesson > pages" exist:
|
||||
| lesson | qtype | title | content |
|
||||
| Test lesson name | truefalse | True/false question 1 | Cat is an amphibian |
|
||||
| Test lesson name | content | First page name | First page contents |
|
||||
| Test lesson name | truefalse | True/false question 2 | Paper is made from trees. |
|
||||
| Test lesson name | truefalse | True/false question 3 | 1+1=2 |
|
||||
| Test lesson name | truefalse | True/false question 4 | 2+2=4 |
|
||||
| Test lesson name | content | Second page name | Second page contents |
|
||||
| Test lesson name | truefalse | True/false question 5 | Kermit is a frog |
|
||||
And the following "mod_lesson > answers" exist:
|
||||
| page | answer | response | jumpto | score |
|
||||
| True/false question 1 | False | Correct | Next page | 1 |
|
||||
| True/false question 1 | True | Wrong | This page | 0 |
|
||||
| First page name | Next page | | Next page | 0 |
|
||||
| True/false question 2 | True | Correct | Next page | 1 |
|
||||
| True/false question 2 | False | Wrong | This page | 0 |
|
||||
| True/false question 3 | True | Correct | Next page | 1 |
|
||||
| True/false question 3 | False | Wrong | This page | 0 |
|
||||
| True/false question 4 | True | Correct | Next page | 1 |
|
||||
| True/false question 4 | False | Wrong | This page | 0 |
|
||||
| Second page name | Next page | | Next page | 0 |
|
||||
| True/false question 5 | True | Correct | Next page | 1 |
|
||||
| True/false question 5 | False | Wrong | This page | 0 |
|
||||
When I am on the "Test lesson name" "lesson activity" page logged in as student1
|
||||
And I should see "Cat is an amphibian"
|
||||
And I set the following fields to these values:
|
||||
| False | 1 |
|
||||
And I press "Submit"
|
||||
And I press "Continue"
|
||||
And I should see "First content page"
|
||||
And I should see "First page contents"
|
||||
And I press "Next page"
|
||||
And I should see "Paper is made from trees."
|
||||
And I set the following fields to these values:
|
||||
@@ -285,13 +176,13 @@ Feature: In a lesson activity a student should
|
||||
And I wait "1" seconds
|
||||
And I press "Submit"
|
||||
And I press "Continue"
|
||||
And I should see "Second content page"
|
||||
And I should see "Second page contents"
|
||||
And I am on "Course 1" course homepage
|
||||
And I follow "Test lesson name"
|
||||
And I should see "You have seen more than one page of this lesson already."
|
||||
And I should see "Do you want to start at the last page you saw?"
|
||||
And I follow "Yes"
|
||||
And I should see "Second content page"
|
||||
And I should see "Second page contents"
|
||||
And I press "Next page"
|
||||
And I should see "Kermit is a frog"
|
||||
And I set the following fields to these values:
|
||||
@@ -301,71 +192,25 @@ Feature: In a lesson activity a student should
|
||||
And I should see "Congratulations - end of lesson reached"
|
||||
|
||||
Scenario: resume a lesson with only question pages
|
||||
Given I follow "Add a question page"
|
||||
And I set the field "Select a question type" to "True/false"
|
||||
And I press "Add a question page"
|
||||
And I set the following fields to these values:
|
||||
| Page title | True/false question 1 |
|
||||
| Page contents | Cat is an amphibian |
|
||||
| id_answer_editor_0 | False |
|
||||
| id_response_editor_0 | Correct |
|
||||
| id_jumpto_0 | Next page |
|
||||
| id_answer_editor_1 | True |
|
||||
| id_response_editor_1 | Wrong |
|
||||
| id_jumpto_1 | This page |
|
||||
And I press "Save page"
|
||||
And I select "Add a question page" from the "qtype" singleselect
|
||||
And I set the field "Select a question type" to "True/false"
|
||||
And I press "Add a question page"
|
||||
And I set the following fields to these values:
|
||||
| Page title | True/false question 5 |
|
||||
| Page contents | Kermit is a frog |
|
||||
| id_answer_editor_0 | True |
|
||||
| id_response_editor_0 | Correct |
|
||||
| id_jumpto_0 | Next page |
|
||||
| id_answer_editor_1 | False |
|
||||
| id_response_editor_1 | Wrong |
|
||||
| id_jumpto_1 | This page |
|
||||
And I press "Save page"
|
||||
And I select "Add a question page" from the "qtype" singleselect
|
||||
And I set the field "Select a question type" to "True/false"
|
||||
And I press "Add a question page"
|
||||
And I set the following fields to these values:
|
||||
| Page title | True/false question 4 |
|
||||
| Page contents | 2+2=4 |
|
||||
| id_answer_editor_0 | True |
|
||||
| id_response_editor_0 | Correct |
|
||||
| id_jumpto_0 | Next page |
|
||||
| id_answer_editor_1 | False |
|
||||
| id_response_editor_1 | Wrong |
|
||||
| id_jumpto_1 | This page |
|
||||
And I press "Save page"
|
||||
And I select "Add a question page" from the "qtype" singleselect
|
||||
And I set the field "Select a question type" to "True/false"
|
||||
And I press "Add a question page"
|
||||
And I set the following fields to these values:
|
||||
| Page title | True/false question 3 |
|
||||
| Page contents | 1+1=2 |
|
||||
| id_answer_editor_0 | True |
|
||||
| id_response_editor_0 | Correct |
|
||||
| id_jumpto_0 | Next page |
|
||||
| id_answer_editor_1 | False |
|
||||
| id_response_editor_1 | Wrong |
|
||||
| id_jumpto_1 | This page |
|
||||
And I press "Save page"
|
||||
And I select "Add a question page" from the "qtype" singleselect
|
||||
And I set the field "Select a question type" to "True/false"
|
||||
And I press "Add a question page"
|
||||
And I set the following fields to these values:
|
||||
| Page title | True/false question 2 |
|
||||
| Page contents | Paper is made from trees. |
|
||||
| id_answer_editor_0 | True |
|
||||
| id_response_editor_0 | Correct |
|
||||
| id_jumpto_0 | Next page |
|
||||
| id_answer_editor_1 | False |
|
||||
| id_response_editor_1 | Wrong |
|
||||
| id_jumpto_1 | This page |
|
||||
And I press "Save page"
|
||||
Given the following "mod_lesson > pages" exist:
|
||||
| lesson | qtype | title | content |
|
||||
| Test lesson name | truefalse | True/false question 1 | Cat is an amphibian |
|
||||
| Test lesson name | truefalse | True/false question 2 | Paper is made from trees. |
|
||||
| Test lesson name | truefalse | True/false question 3 | 1+1=2 |
|
||||
| Test lesson name | truefalse | True/false question 4 | 2+2=4 |
|
||||
| Test lesson name | truefalse | True/false question 5 | Kermit is a frog |
|
||||
And the following "mod_lesson > answers" exist:
|
||||
| page | answer | response | jumpto | score |
|
||||
| True/false question 1 | False | Correct | Next page | 1 |
|
||||
| True/false question 1 | True | Wrong | This page | 0 |
|
||||
| True/false question 2 | True | Correct | Next page | 1 |
|
||||
| True/false question 2 | False | Wrong | This page | 0 |
|
||||
| True/false question 3 | True | Correct | Next page | 1 |
|
||||
| True/false question 3 | False | Wrong | This page | 0 |
|
||||
| True/false question 4 | True | Correct | Next page | 1 |
|
||||
| True/false question 4 | False | Wrong | This page | 0 |
|
||||
| True/false question 5 | True | Correct | Next page | 1 |
|
||||
| True/false question 5 | False | Wrong | This page | 0 |
|
||||
When I am on the "Test lesson name" "lesson activity" page logged in as student1
|
||||
And I should see "Cat is an amphibian"
|
||||
And I set the following fields to these values:
|
||||
|
||||
@@ -21,20 +21,13 @@ Feature: Lesson user override
|
||||
And the following "activities" exist:
|
||||
| activity | name | course | idnumber |
|
||||
| lesson | Test lesson name | C1 | lesson1 |
|
||||
And I am on the "Test lesson name" "lesson activity" page logged in as teacher1
|
||||
And I follow "Add a question page"
|
||||
And I set the field "Select a question type" to "True/false"
|
||||
And I press "Add a question page"
|
||||
And I set the following fields to these values:
|
||||
| Page title | True/false question 1 |
|
||||
| Page contents | Cat is an amphibian |
|
||||
| id_answer_editor_0 | False |
|
||||
| id_response_editor_0 | Correct |
|
||||
| id_jumpto_0 | Next page |
|
||||
| id_answer_editor_1 | True |
|
||||
| id_response_editor_1 | Wrong |
|
||||
| id_jumpto_1 | This page |
|
||||
And I press "Save page"
|
||||
And the following "mod_lesson > page" exist:
|
||||
| lesson | qtype | title | content |
|
||||
| Test lesson name | truefalse | True/false question 1 | Cat is an amphibian |
|
||||
And the following "mod_lesson > answers" exist:
|
||||
| page | answer | response | jumpto | score |
|
||||
| True/false question 1 | False | Correct | Next page | 1 |
|
||||
| True/false question 1 | True | Wrong | This page | 0 |
|
||||
|
||||
@javascript
|
||||
Scenario: Add, modify then delete a user override
|
||||
|
||||
@@ -22,102 +22,39 @@ Feature: In a lesson activity, students can see questions in random order
|
||||
And I log in as "teacher1"
|
||||
|
||||
Scenario: Lesson with two clusters
|
||||
Given I am on the "Lesson with clusters" "lesson activity" page
|
||||
And I follow "Add a content page"
|
||||
And I set the following fields to these values:
|
||||
| Page title | First page name |
|
||||
| Page contents | First page contents |
|
||||
| id_answer_editor_0 | Next page |
|
||||
| id_jumpto_0 | Next page |
|
||||
And I press "Save page"
|
||||
And I select "Add a content page" from the "qtype" singleselect
|
||||
And I set the following fields to these values:
|
||||
| Page title | Second page name |
|
||||
| Page contents | Second page contents |
|
||||
| id_answer_editor_0 | Previous page |
|
||||
| id_jumpto_0 | Previous page |
|
||||
| id_answer_editor_1 | Next page |
|
||||
| id_jumpto_1 | Next page |
|
||||
And I press "Save page"
|
||||
And I select edit type "Expanded"
|
||||
And I click on "Add a cluster" "link" in the "//div[contains(concat(' ', normalize-space(@class), ' '), ' addlinks ')][3]" "xpath_element"
|
||||
And I click on "Add a question page here" "link" in the "//div[contains(concat(' ', normalize-space(@class), ' '), ' addlinks ')][4]" "xpath_element"
|
||||
And I set the field "Select a question type" to "Multichoice"
|
||||
And I press "Add a question page"
|
||||
And I set the following fields to these values:
|
||||
| Page title | question 1 |
|
||||
| Page contents | Question from cluster 1 |
|
||||
| id_answer_editor_0 | Correct answer |
|
||||
| id_response_editor_0 | Good |
|
||||
| id_jumpto_0 | Cluster |
|
||||
| id_score_0 | 1 |
|
||||
| id_answer_editor_1 | Incorrect answer |
|
||||
| id_response_editor_1 | Bad |
|
||||
| id_jumpto_1 | This page |
|
||||
| id_score_1 | 0 |
|
||||
And I press "Save page"
|
||||
And I click on "Add a question page here" "link" in the "//div[contains(concat(' ', normalize-space(@class), ' '), ' addlinks ')][5]" "xpath_element"
|
||||
And I set the field "Select a question type" to "Multichoice"
|
||||
And I press "Add a question page"
|
||||
And I set the following fields to these values:
|
||||
| Page title | question 2 |
|
||||
| Page contents | Question from cluster 1 |
|
||||
| id_answer_editor_0 | Correct answer |
|
||||
| id_response_editor_0 | Good |
|
||||
| id_jumpto_0 | Cluster |
|
||||
| id_score_0 | 1 |
|
||||
| id_answer_editor_1 | Incorrect answer |
|
||||
| id_response_editor_1 | Bad |
|
||||
| id_jumpto_1 | This page |
|
||||
| id_score_1 | 0 |
|
||||
And I press "Save page"
|
||||
And I click on "Add an end of cluster" "link" in the "//div[contains(concat(' ', normalize-space(@class), ' '), ' addlinks ')][6]" "xpath_element"
|
||||
And I click on "Add a content page" "link" in the "//div[contains(concat(' ', normalize-space(@class), ' '), ' addlinks ')][7]" "xpath_element"
|
||||
And I set the following fields to these values:
|
||||
| Page title | Third page name |
|
||||
| Page contents | Content page after cluster 1 |
|
||||
| id_answer_editor_0 | Next page |
|
||||
| id_jumpto_0 | Next page |
|
||||
And I press "Save page"
|
||||
And I click on "Add a cluster" "link" in the "//div[contains(concat(' ', normalize-space(@class), ' '), ' addlinks ')][8]" "xpath_element"
|
||||
And I click on "Add a question page here" "link" in the "//div[contains(concat(' ', normalize-space(@class), ' '), ' addlinks ')][9]" "xpath_element"
|
||||
And I set the field "Select a question type" to "Multichoice"
|
||||
And I press "Add a question page"
|
||||
And I set the following fields to these values:
|
||||
| Page title | question 3 |
|
||||
| Page contents | Question from cluster 2 |
|
||||
| id_answer_editor_0 | Correct answer |
|
||||
| id_response_editor_0 | Good |
|
||||
| id_jumpto_0 | Unseen question within a cluster |
|
||||
| id_score_0 | 1 |
|
||||
| id_answer_editor_1 | Incorrect answer |
|
||||
| id_response_editor_1 | Bad |
|
||||
| id_jumpto_1 | This page |
|
||||
| id_score_1 | 0 |
|
||||
And I press "Save page"
|
||||
And I click on "Add a question page here" "link" in the "//div[contains(concat(' ', normalize-space(@class), ' '), ' addlinks ')][10]" "xpath_element"
|
||||
And I set the field "Select a question type" to "Multichoice"
|
||||
And I press "Add a question page"
|
||||
And I set the following fields to these values:
|
||||
| Page title | question 4 |
|
||||
| Page contents | Question from cluster 2 |
|
||||
| id_answer_editor_0 | Correct answer |
|
||||
| id_response_editor_0 | Good |
|
||||
| id_jumpto_0 | Unseen question within a cluster |
|
||||
| id_score_0 | 1 |
|
||||
| id_answer_editor_1 | Incorrect answer |
|
||||
| id_response_editor_1 | Bad |
|
||||
| id_jumpto_1 | This page |
|
||||
| id_score_1 | 0 |
|
||||
And I press "Save page"
|
||||
And I click on "Add an end of cluster" "link" in the "//div[contains(concat(' ', normalize-space(@class), ' '), ' addlinks ')][11]" "xpath_element"
|
||||
And I click on "Add a content page" "link" in the "//div[contains(concat(' ', normalize-space(@class), ' '), ' addlinks ')][12]" "xpath_element"
|
||||
And I set the following fields to these values:
|
||||
| Page title | Fourth page name |
|
||||
| Page contents | Content page after cluster 2 |
|
||||
| id_answer_editor_0 | Next page |
|
||||
| id_jumpto_0 | Next page |
|
||||
And I press "Save page"
|
||||
Given the following "mod_lesson > pages" exist:
|
||||
| lesson | qtype | title | content |
|
||||
| Lesson with clusters | content | First page name | First page contents |
|
||||
| Lesson with clusters | content | Second page name | Second page contents |
|
||||
| Lesson with clusters | cluster | Cluster 1 | Cluster 1 |
|
||||
| Lesson with clusters | multichoice | Question 1 | Question from cluster 1 |
|
||||
| Lesson with clusters | multichoice | Question 2 | Question from cluster 1 |
|
||||
| Lesson with clusters | endofcluster | End of cluster 1 | End of cluster 1 |
|
||||
| Lesson with clusters | content | Third page name | Content page after cluster 1 |
|
||||
| Lesson with clusters | cluster | Cluster 2 | Cluster 2 |
|
||||
| Lesson with clusters | multichoice | Question 3 | Question from cluster 2 |
|
||||
| Lesson with clusters | multichoice | Question 4 | Question from cluster 2 |
|
||||
| Lesson with clusters | endofcluster | End of cluster 2 | End of cluster 2 |
|
||||
| Lesson with clusters | content | Fourth page name | Content page after cluster 2 |
|
||||
And the following "mod_lesson > answers" exist:
|
||||
| page | answer | response | jumpto | score |
|
||||
| First page name | Next page | | Next page | 0 |
|
||||
| Second page name | Previous page | | Previous page | 0 |
|
||||
| Second page name | Next page | | Next page | 0 |
|
||||
| Cluster 1 | | | Unseen question within a cluster | 0 |
|
||||
| Question 1 | Correct answer | Good | Cluster 1 | 1 |
|
||||
| Question 1 | Incorrect answer | Bad | This page | 0 |
|
||||
| Question 2 | Correct answer | Good | Cluster 1 | 1 |
|
||||
| Question 2 | Incorrect answer | Bad | This page | 0 |
|
||||
| End of cluster 1 | | | Next page | 0 |
|
||||
| Third page name | Next page | | Next page | 0 |
|
||||
| Cluster 2 | | | Unseen question within a cluster | 0 |
|
||||
| Question 3 | Correct answer | Good | Unseen question within a cluster | 1 |
|
||||
| Question 3 | Incorrect answer | Bad | This page | 0 |
|
||||
| Question 4 | Correct answer | Good | Unseen question within a cluster | 1 |
|
||||
| Question 4 | Incorrect answer | Bad | This page | 0 |
|
||||
| End of cluster 2 | | | Next page | 0 |
|
||||
| Fourth page name | Next page | | Next page | 0 |
|
||||
When I am on the "Lesson with clusters" "lesson activity" page logged in as student1
|
||||
Then I should see "First page contents"
|
||||
And I press "Next page"
|
||||
|
||||
@@ -22,122 +22,40 @@ Feature: In a lesson activity, students can see questions in random order and a
|
||||
And I log in as "teacher1"
|
||||
|
||||
Scenario: Lesson with subcluster
|
||||
Given I am on the "Lesson with subcluster" "lesson activity" page
|
||||
And I follow "Add a content page"
|
||||
And I set the following fields to these values:
|
||||
| Page title | First page name |
|
||||
| Page contents | First page contents |
|
||||
| id_answer_editor_0 | Next page |
|
||||
| id_jumpto_0 | Next page |
|
||||
And I press "Save page"
|
||||
And I select edit type "Expanded"
|
||||
And I click on "Add a cluster" "link" in the "//div[contains(concat(' ', normalize-space(@class), ' '), ' addlinks ')][2]" "xpath_element"
|
||||
And I click on "Add a question page here" "link" in the "//div[contains(concat(' ', normalize-space(@class), ' '), ' addlinks ')][3]" "xpath_element"
|
||||
And I set the field "Select a question type" to "Multichoice"
|
||||
And I press "Add a question page"
|
||||
And I set the following fields to these values:
|
||||
| Page title | question 1 |
|
||||
| Page contents | Question from cluster |
|
||||
| id_answer_editor_0 | Correct answer |
|
||||
| id_response_editor_0 | Good |
|
||||
| id_jumpto_0 | Cluster |
|
||||
| id_score_0 | 1 |
|
||||
| id_answer_editor_1 | Incorrect answer |
|
||||
| id_response_editor_1 | Bad |
|
||||
| id_jumpto_1 | This page |
|
||||
| id_score_1 | 0 |
|
||||
And I press "Save page"
|
||||
And I click on "Add a question page here" "link" in the "//div[contains(concat(' ', normalize-space(@class), ' '), ' addlinks ')][4]" "xpath_element"
|
||||
And I set the field "Select a question type" to "Multichoice"
|
||||
And I press "Add a question page"
|
||||
And I set the following fields to these values:
|
||||
| Page title | question 2 |
|
||||
| Page contents | Question from cluster |
|
||||
| id_answer_editor_0 | Correct answer |
|
||||
| id_response_editor_0 | Good |
|
||||
| id_jumpto_0 | Cluster |
|
||||
| id_score_0 | 1 |
|
||||
| id_answer_editor_1 | Incorrect answer |
|
||||
| id_response_editor_1 | Bad |
|
||||
| id_jumpto_1 | This page |
|
||||
| id_score_1 | 0 |
|
||||
And I press "Save page"
|
||||
And I click on "Add a content page" "link" in the "//div[contains(concat(' ', normalize-space(@class), ' '), ' addlinks ')][5]" "xpath_element"
|
||||
And I set the following fields to these values:
|
||||
| Page title | Second page name |
|
||||
| Page contents | This page mark the the beginning of the subcluster it should not be seen by students |
|
||||
| id_answer_editor_0 | Next page |
|
||||
| id_jumpto_0 | Next page |
|
||||
And I press "Save page"
|
||||
And I click on "Add a question page here" "link" in the "//div[contains(concat(' ', normalize-space(@class), ' '), ' addlinks ')][6]" "xpath_element"
|
||||
And I set the field "Select a question type" to "Multichoice"
|
||||
And I press "Add a question page"
|
||||
And I set the following fields to these values:
|
||||
| Page title | question 3 |
|
||||
| Page contents | Question from cluster |
|
||||
| id_answer_editor_0 | Correct answer |
|
||||
| id_response_editor_0 | Good |
|
||||
| id_jumpto_0 | Cluster |
|
||||
| id_score_0 | 1 |
|
||||
| id_answer_editor_1 | Incorrect answer |
|
||||
| id_response_editor_1 | Bad |
|
||||
| id_jumpto_1 | This page |
|
||||
| id_score_1 | 0 |
|
||||
And I press "Save page"
|
||||
And I click on "Add a question page here" "link" in the "//div[contains(concat(' ', normalize-space(@class), ' '), ' addlinks ')][7]" "xpath_element"
|
||||
And I set the field "Select a question type" to "Multichoice"
|
||||
And I press "Add a question page"
|
||||
And I set the following fields to these values:
|
||||
| Page title | question 4 |
|
||||
| Page contents | Question from cluster |
|
||||
| id_answer_editor_0 | Correct answer |
|
||||
| id_response_editor_0 | Good |
|
||||
| id_jumpto_0 | Cluster |
|
||||
| id_score_0 | 1 |
|
||||
| id_answer_editor_1 | Incorrect answer |
|
||||
| id_response_editor_1 | Bad |
|
||||
| id_jumpto_1 | This page |
|
||||
| id_score_1 | 0 |
|
||||
And I press "Save page"
|
||||
And I click on "Add a question page here" "link" in the "//div[contains(concat(' ', normalize-space(@class), ' '), ' addlinks ')][8]" "xpath_element"
|
||||
And I set the field "Select a question type" to "Multichoice"
|
||||
And I press "Add a question page"
|
||||
And I set the following fields to these values:
|
||||
| Page title | question 5 |
|
||||
| Page contents | Question from cluster |
|
||||
| id_answer_editor_0 | Correct answer |
|
||||
| id_response_editor_0 | Good |
|
||||
| id_jumpto_0 | Cluster |
|
||||
| id_score_0 | 1 |
|
||||
| id_answer_editor_1 | Incorrect answer |
|
||||
| id_response_editor_1 | Bad |
|
||||
| id_jumpto_1 | This page |
|
||||
| id_score_1 | 0 |
|
||||
And I press "Save page"
|
||||
And I click on "Add an end of branch" "link" in the "//div[contains(concat(' ', normalize-space(@class), ' '), ' addlinks ')][9]" "xpath_element"
|
||||
And I click on "Add a question page here" "link" in the "//div[contains(concat(' ', normalize-space(@class), ' '), ' addlinks ')][10]" "xpath_element"
|
||||
And I set the field "Select a question type" to "Multichoice"
|
||||
And I press "Add a question page"
|
||||
And I set the following fields to these values:
|
||||
| Page title | question 6 |
|
||||
| Page contents | Question from cluster |
|
||||
| id_answer_editor_0 | Correct answer |
|
||||
| id_response_editor_0 | Good |
|
||||
| id_jumpto_0 | Cluster |
|
||||
| id_score_0 | 1 |
|
||||
| id_answer_editor_1 | Incorrect answer |
|
||||
| id_response_editor_1 | Bad |
|
||||
| id_jumpto_1 | This page |
|
||||
| id_score_1 | 0 |
|
||||
And I press "Save page"
|
||||
And I click on "Add an end of cluster" "link" in the "//div[contains(concat(' ', normalize-space(@class), ' '), ' addlinks ')][11]" "xpath_element"
|
||||
And I click on "Add a content page" "link" in the "//div[contains(concat(' ', normalize-space(@class), ' '), ' addlinks ')][12]" "xpath_element"
|
||||
And I set the following fields to these values:
|
||||
| Page title | Third page name |
|
||||
| Page contents | Content page after cluster |
|
||||
| id_answer_editor_0 | Next page |
|
||||
| id_jumpto_0 | Next page |
|
||||
And I press "Save page"
|
||||
Given the following "mod_lesson > pages" exist:
|
||||
| lesson | qtype | title | content |
|
||||
| Lesson with subcluster | content | First page name | First page contents |
|
||||
| Lesson with subcluster | cluster | Cluster | Cluster |
|
||||
| Lesson with subcluster | multichoice | Question 1 | Question from cluster |
|
||||
| Lesson with subcluster | multichoice | Question 2 | Question from cluster |
|
||||
| Lesson with subcluster | content | Second page name | Beginning of the subcluster, should not be seen by students |
|
||||
| Lesson with subcluster | multichoice | Question 3 | Question from cluster |
|
||||
| Lesson with subcluster | multichoice | Question 4 | Question from cluster |
|
||||
| Lesson with subcluster | multichoice | Question 5 | Question from cluster |
|
||||
| Lesson with subcluster | endofbranch | End of branch | End of branch |
|
||||
| Lesson with subcluster | multichoice | Question 6 | Question from cluster |
|
||||
| Lesson with subcluster | endofcluster | End of cluster | End of cluster |
|
||||
| Lesson with subcluster | content | Third page name | Content page after cluster |
|
||||
And the following "mod_lesson > answers" exist:
|
||||
| page | answer | response | jumpto | score |
|
||||
| First page name | Next page | | Next page | 0 |
|
||||
| Cluster | | | Unseen question within a cluster | 0 |
|
||||
| Question 1 | Correct answer | Good | Cluster | 1 |
|
||||
| Question 1 | Incorrect answer | Bad | This page | 0 |
|
||||
| Question 2 | Correct answer | Good | Cluster | 1 |
|
||||
| Question 2 | Incorrect answer | Bad | This page | 0 |
|
||||
| Second page name | Next page | | Next page | 0 |
|
||||
| Question 3 | Correct answer | Good | Cluster | 1 |
|
||||
| Question 3 | Incorrect answer | Bad | This page | 0 |
|
||||
| Question 4 | Correct answer | Good | Cluster | 1 |
|
||||
| Question 4 | Incorrect answer | Bad | This page | 0 |
|
||||
| Question 5 | Correct answer | Good | Cluster | 1 |
|
||||
| Question 5 | Incorrect answer | Bad | This page | 0 |
|
||||
| End of branch | | | Second page name | 0 |
|
||||
| Question 6 | Correct answer | Good | Cluster | 1 |
|
||||
| Question 6 | Incorrect answer | Bad | This page | 0 |
|
||||
| End of cluster | | | Next page | 0 |
|
||||
| Third page name | Next page | | Next page | 0 |
|
||||
When I am on the "Lesson with subcluster" "lesson activity" page logged in as student1
|
||||
Then I should see "First page contents"
|
||||
And I press "Next page"
|
||||
|
||||
@@ -19,23 +19,15 @@ Feature: link to gradebook on the end of lesson page
|
||||
And the following "activities" exist:
|
||||
| activity | name | course | idnumber |
|
||||
| lesson | Test lesson | C1 | lesson1 |
|
||||
And I am on the "Test lesson" "lesson activity" page logged in as teacher1
|
||||
And I follow "Add a content page"
|
||||
And I set the following fields to these values:
|
||||
| Page title | First page name |
|
||||
| Page contents | First page contents |
|
||||
| id_answer_editor_0 | Next page |
|
||||
| id_jumpto_0 | Next page |
|
||||
And I press "Save page"
|
||||
And I select "Add a content page" from the "qtype" singleselect
|
||||
And I set the following fields to these values:
|
||||
| Page title | Second page name |
|
||||
| Page contents | Second page contents |
|
||||
| id_answer_editor_0 | Previous page |
|
||||
| id_jumpto_0 | Previous page |
|
||||
| id_answer_editor_1 | Next page |
|
||||
| id_jumpto_1 | Next page |
|
||||
And I press "Save page"
|
||||
And the following "mod_lesson > pages" exist:
|
||||
| lesson | qtype | title | content |
|
||||
| Test lesson | content | First page name | First page contents |
|
||||
| Test lesson | content | Second page name | Second page contents |
|
||||
And the following "mod_lesson > answers" exist:
|
||||
| page | answer | jumpto |
|
||||
| First page name | Next page | Next page |
|
||||
| Second page name | Previous page | Previous page |
|
||||
| Second page name | Next page | Next page |
|
||||
|
||||
Scenario: Link to gradebook for non practice lesson
|
||||
When I am on the "Test lesson" "lesson activity" page logged in as student1
|
||||
@@ -48,7 +40,7 @@ Feature: link to gradebook on the end of lesson page
|
||||
And I should see "Test lesson"
|
||||
|
||||
Scenario: No link to gradebook for non graded lesson
|
||||
Given I am on the "Test lesson" "lesson activity editing" page
|
||||
Given I am on the "Test lesson" "lesson activity editing" page logged in as teacher1
|
||||
And I set the following fields to these values:
|
||||
| Type | None |
|
||||
And I press "Save and display"
|
||||
@@ -59,7 +51,7 @@ Feature: link to gradebook on the end of lesson page
|
||||
And I should not see "View grades"
|
||||
|
||||
Scenario: No link to gradebook for practice lesson
|
||||
Given I am on the "Test lesson" "lesson activity editing" page
|
||||
Given I am on the "Test lesson" "lesson activity editing" page logged in as teacher1
|
||||
And I set the following fields to these values:
|
||||
| Practice lesson | Yes |
|
||||
And I press "Save and display"
|
||||
@@ -70,7 +62,8 @@ Feature: link to gradebook on the end of lesson page
|
||||
And I should not see "View grades"
|
||||
|
||||
Scenario: No link if Show gradebook to student disabled
|
||||
Given I am on "Course 1" course homepage
|
||||
Given I log in as "teacher1"
|
||||
And I am on "Course 1" course homepage
|
||||
And I navigate to "Settings" in current page administration
|
||||
And I set the following fields to these values:
|
||||
| Show gradebook to students | No |
|
||||
|
||||
@@ -23,13 +23,12 @@ Feature: A teacher can password protect a lesson
|
||||
| name | Test lesson |
|
||||
| usepassword | 1 |
|
||||
| password | moodle_rules |
|
||||
And I am on the "Test lesson" "lesson activity" page logged in as teacher1
|
||||
And I follow "Add a content page"
|
||||
And I set the following fields to these values:
|
||||
| Page title | First page name |
|
||||
| Page contents | First page contents |
|
||||
| Description | The first one |
|
||||
And I press "Save page"
|
||||
Given the following "mod_lesson > page" exist:
|
||||
| lesson | qtype | title | content |
|
||||
| Test lesson | content | First page name | First page contents |
|
||||
And the following "mod_lesson > answer" exist:
|
||||
| page | answer | jumpto |
|
||||
| First page name | The first one | Next page |
|
||||
When I am on the "Test lesson" "lesson activity" page logged in as student1
|
||||
Then I should see "Test lesson is a password protected lesson"
|
||||
And I should not see "First page contents"
|
||||
|
||||
@@ -42,17 +42,16 @@ Feature: In a lesson activity, a non editing teacher can grade essay questions
|
||||
And the following "activities" exist:
|
||||
| activity | name | course | idnumber |
|
||||
| lesson | Test lesson name | C1 | lesson1 |
|
||||
And the following "mod_lesson > page" exist:
|
||||
| lesson | qtype | title | content |
|
||||
| Test lesson name | essay | Essay question | <p>Please write a story about a <b>frog</b>.</p> |
|
||||
And the following "mod_lesson > answer" exist:
|
||||
| page | jumpto | score |
|
||||
| Essay question | Next page | 1 |
|
||||
And I am on the "Test lesson name" "lesson activity editing" page logged in as teacher1
|
||||
And I set the following fields to these values:
|
||||
| Group mode | Separate groups |
|
||||
And I press "Save and display"
|
||||
And I follow "Add a question page"
|
||||
And I set the field "Select a question type" to "Essay"
|
||||
And I press "Add a question page"
|
||||
And I set the following fields to these values:
|
||||
| Page title | Essay question |
|
||||
| Page contents | <p>Please write a story about a frog.</p> |
|
||||
And I press "Save page"
|
||||
And I am on the "Test lesson name" "lesson activity" page logged in as student1
|
||||
And I set the field "Your answer" to "<p>Once upon a time there was a little green frog."
|
||||
And I press "Submit"
|
||||
|
||||
@@ -20,6 +20,12 @@ Feature: A teacher can set a time limit for a lesson
|
||||
And the following "activities" exist:
|
||||
| activity | course | name |
|
||||
| lesson | C1 | Test lesson |
|
||||
And the following "mod_lesson > page" exist:
|
||||
| lesson | qtype | title | content |
|
||||
| Test lesson | content | Lesson page name | Single lesson page contents |
|
||||
And the following "mod_lesson > answer" exist:
|
||||
| page | answer | jumpto |
|
||||
| Lesson page name | Single button | This page |
|
||||
And I am on the "Test lesson" "lesson activity editing" page logged in as teacher1
|
||||
And I expand all fieldsets
|
||||
And I set the following fields to these values:
|
||||
@@ -27,12 +33,6 @@ Feature: A teacher can set a time limit for a lesson
|
||||
| timelimit[timeunit] | 1 |
|
||||
| timelimit[number] | 10 |
|
||||
And I press "Save and display"
|
||||
And I follow "Add a content page"
|
||||
And I set the following fields to these values:
|
||||
| Page title | Lesson page name |
|
||||
| Page contents | Single lesson page contents |
|
||||
| Description | Single button |
|
||||
And I press "Save page"
|
||||
When I am on the "Test lesson" "lesson activity" page logged in as student1
|
||||
Then I should see "You have 10 secs to finish the lesson."
|
||||
And I wait "3" seconds
|
||||
|
||||
@@ -26,24 +26,15 @@ Feature: An incorrect response to an answer with multiple attempts show appropri
|
||||
And I press "Save and display"
|
||||
|
||||
Scenario: A student answering incorrectly to a question will see an option to move to the next question if set up.
|
||||
Given I follow "Add a question page"
|
||||
And I set the field "Select a question type" to "Numerical"
|
||||
And I press "Add a question page"
|
||||
And I set the following fields to these values:
|
||||
| Page title | Numerical question |
|
||||
| Page contents | What is 1 + 2? |
|
||||
| id_answer_editor_0 | 3 |
|
||||
| id_jumpto_0 | Next page |
|
||||
| id_answer_editor_1 | 2 |
|
||||
| id_jumpto_1 | Next page |
|
||||
And I press "Save page"
|
||||
And I select "Add a content page" from the "qtype" singleselect
|
||||
And I set the following fields to these values:
|
||||
| Page title | Just move on page |
|
||||
| Page contents | You are here to move on |
|
||||
| id_answer_editor_0 | End this lesson |
|
||||
| id_jumpto_0 | End of lesson |
|
||||
And I press "Save page"
|
||||
Given the following "mod_lesson > pages" exist:
|
||||
| lesson | qtype | title | content |
|
||||
| Test lesson name | numeric | Numerical question | What is 1 + 2? |
|
||||
| Test lesson name | content | Just move on page | You are here to move on |
|
||||
And the following "mod_lesson > answers" exist:
|
||||
| page | answer | jumpto | score |
|
||||
| Numerical question | 3 | Next page | 1 |
|
||||
| Numerical question | 2 | Next page | 0 |
|
||||
| Just move on page | End this lesson | End of lesson | 0 |
|
||||
And I am on the "Test lesson name" "lesson activity" page logged in as student1
|
||||
When I set the field "Your answer" to "2"
|
||||
And I press "Submit"
|
||||
@@ -53,22 +44,14 @@ Feature: An incorrect response to an answer with multiple attempts show appropri
|
||||
Then I should see "You are here to move on"
|
||||
|
||||
Scenario: A student answering incorrectly to a question will only see an option to try again if there is no matching wrong response.
|
||||
Given I follow "Add a question page"
|
||||
And I set the field "Select a question type" to "Numerical"
|
||||
And I press "Add a question page"
|
||||
And I set the following fields to these values:
|
||||
| Page title | Numerical question |
|
||||
| Page contents | What is 1 + 2? |
|
||||
| id_answer_editor_0 | 3 |
|
||||
| id_jumpto_0 | Next page |
|
||||
And I press "Save page"
|
||||
And I select "Add a content page" from the "qtype" singleselect
|
||||
And I set the following fields to these values:
|
||||
| Page title | Just move on page |
|
||||
| Page contents | You are here to move on |
|
||||
| id_answer_editor_0 | End this lesson |
|
||||
| id_jumpto_0 | End of lesson |
|
||||
And I press "Save page"
|
||||
Given the following "mod_lesson > pages" exist:
|
||||
| lesson | qtype | title | content |
|
||||
| Test lesson name | numeric | Numerical question | What is 1 + 2? |
|
||||
| Test lesson name | content | Just move on page | You are here to move on |
|
||||
And the following "mod_lesson > answers" exist:
|
||||
| page | answer | jumpto | score |
|
||||
| Numerical question | 3 | Next page | 1 |
|
||||
| Just move on page | End this lesson | End of lesson | 0 |
|
||||
And I am on the "Test lesson name" "lesson activity" page logged in as student1
|
||||
When I set the field "Your answer" to "2"
|
||||
And I press "Submit"
|
||||
|
||||
@@ -0,0 +1,65 @@
|
||||
<?php
|
||||
// This file is part of Moodle - http://moodle.org/
|
||||
//
|
||||
// Moodle is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU General Public License as published by
|
||||
// the Free Software Foundation, either version 3 of the License, or
|
||||
// (at your option) any later version.
|
||||
//
|
||||
// Moodle is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with Moodle. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
/**
|
||||
* Behat data generator for mod_lesson.
|
||||
*
|
||||
* @package mod_lesson
|
||||
* @category test
|
||||
* @copyright 2023 Dani Palou <[email protected]>
|
||||
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
|
||||
*/
|
||||
|
||||
/**
|
||||
* Behat data generator for mod_lesson.
|
||||
*
|
||||
* @copyright 2023 Dani Palou <[email protected]>
|
||||
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
|
||||
*/
|
||||
class behat_mod_lesson_generator extends behat_generator_base {
|
||||
|
||||
/**
|
||||
* Get a list of the entities that can be created.
|
||||
*
|
||||
* @return array entity name => information about how to generate.
|
||||
*/
|
||||
protected function get_creatable_entities(): array {
|
||||
return [
|
||||
'pages' => [
|
||||
'singular' => 'page',
|
||||
'datagenerator' => 'page',
|
||||
'required' => ['lesson', 'qtype'],
|
||||
'switchids' => ['lesson' => 'lessonid'],
|
||||
],
|
||||
'answers' => [
|
||||
'singular' => 'answer',
|
||||
'datagenerator' => 'answer',
|
||||
'required' => ['page'],
|
||||
],
|
||||
];
|
||||
}
|
||||
|
||||
/**
|
||||
* Look up the id of a lesson from its name.
|
||||
*
|
||||
* @param string $idnumberorname the lesson idnumber or name, for example 'Test lesson'.
|
||||
* @return int corresponding id.
|
||||
*/
|
||||
protected function get_lesson_id(string $idnumberorname): int {
|
||||
return $this->get_cm_by_activity_name('lesson', $idnumberorname)->instance;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -25,6 +25,8 @@
|
||||
|
||||
defined('MOODLE_INTERNAL') || die();
|
||||
|
||||
require_once($CFG->dirroot.'/mod/lesson/locallib.php');
|
||||
|
||||
/**
|
||||
* mod_lesson data generator class.
|
||||
*
|
||||
@@ -40,6 +42,25 @@ class mod_lesson_generator extends testing_module_generator {
|
||||
*/
|
||||
protected $pagecount = 0;
|
||||
|
||||
/**
|
||||
* @var array list of candidate pages to be created when all answers have been added.
|
||||
*/
|
||||
protected $candidatepages = [];
|
||||
|
||||
/**
|
||||
* @var array map of readable jumpto to integer value.
|
||||
*/
|
||||
protected $jumptomap = [
|
||||
'This page' => LESSON_THISPAGE,
|
||||
'Next page' => LESSON_NEXTPAGE,
|
||||
'Previous page' => LESSON_PREVIOUSPAGE,
|
||||
'End of lesson' => LESSON_EOL,
|
||||
'Unseen question within a content page' => LESSON_UNSEENBRANCHPAGE,
|
||||
'Random question within a content page' => LESSON_RANDOMPAGE,
|
||||
'Random content page' => LESSON_RANDOMBRANCH,
|
||||
'Unseen question within a cluster' => LESSON_CLUSTERJUMP,
|
||||
];
|
||||
|
||||
/**
|
||||
* To be called from data reset code only,
|
||||
* do not use in tests.
|
||||
@@ -47,9 +68,17 @@ class mod_lesson_generator extends testing_module_generator {
|
||||
*/
|
||||
public function reset() {
|
||||
$this->pagecount = 0;
|
||||
$this->candidatepages = [];
|
||||
parent::reset();
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates a lesson instance for testing purposes.
|
||||
*
|
||||
* @param null|array|stdClass $record data for module being generated.
|
||||
* @param null|array $options general options for course module.
|
||||
* @return stdClass record from module-defined table with additional field cmid (corresponding id in course_modules table)
|
||||
*/
|
||||
public function create_instance($record = null, array $options = null) {
|
||||
global $CFG;
|
||||
|
||||
@@ -92,9 +121,93 @@ class mod_lesson_generator extends testing_module_generator {
|
||||
return parent::create_instance($record, (array)$options);
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates a page for testing purposes. The page will be created when answers are added.
|
||||
*
|
||||
* @param null|array|stdClass $record data for page being generated.
|
||||
* @param null|array $options general options.
|
||||
*/
|
||||
public function create_page($record = null, array $options = null) {
|
||||
$record = (array) $record;
|
||||
|
||||
// Pages require answers to work. Add it as a candidate page to be created once answers have been added.
|
||||
$record['answer_editor'] = [];
|
||||
$record['response_editor'] = [];
|
||||
$record['jumpto'] = [];
|
||||
$record['score'] = [];
|
||||
|
||||
if (!isset($record['previouspage']) || $record['previouspage'] === '') {
|
||||
// Previous page not set, set it to the last candidate page (if any).
|
||||
$record['previouspage'] = empty($this->candidatepages) ? '0' : end($this->candidatepages)['title'];
|
||||
}
|
||||
|
||||
$this->candidatepages[] = $record;
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates a page and its answers for testing purposes.
|
||||
*
|
||||
* @param array $record data for page being generated.
|
||||
* @return stdClass created page, null if couldn't be created because it has a jump to a page that doesn't exist.
|
||||
* @throws coding_exception
|
||||
*/
|
||||
private function perform_create_page(array $record): ?stdClass {
|
||||
global $DB;
|
||||
|
||||
$lesson = $DB->get_record('lesson', ['id' => $record['lessonid']], '*', MUST_EXIST);
|
||||
$cm = get_coursemodule_from_instance('lesson', $lesson->id);
|
||||
$lesson->cmid = $cm->id;
|
||||
$qtype = $record['qtype'];
|
||||
|
||||
unset($record['qtype']);
|
||||
unset($record['lessonid']);
|
||||
|
||||
if (isset($record['content'])) {
|
||||
$record['contents_editor'] = [
|
||||
'text' => $record['content'],
|
||||
'format' => FORMAT_MOODLE,
|
||||
'itemid' => 0,
|
||||
];
|
||||
unset($record['content']);
|
||||
}
|
||||
|
||||
$record['pageid'] = $this->get_previouspage_id($lesson->id, $record['previouspage']);
|
||||
unset($record['previouspage']);
|
||||
|
||||
try {
|
||||
$record['jumpto'] = $this->convert_page_jumpto($lesson->id, $record['jumpto']);
|
||||
} catch (coding_exception $e) {
|
||||
// This page has a jump to a page that hasn't been created yet.
|
||||
return null;
|
||||
}
|
||||
|
||||
switch ($qtype) {
|
||||
case 'content':
|
||||
case 'cluster':
|
||||
case 'endofcluster':
|
||||
case 'endofbranch':
|
||||
$funcname = "create_{$qtype}";
|
||||
break;
|
||||
default:
|
||||
$funcname = "create_question_{$qtype}";
|
||||
}
|
||||
|
||||
if (!method_exists($this, $funcname)) {
|
||||
throw new coding_exception('The page '.$record['title']." has an invalid qtype: $qtype");
|
||||
}
|
||||
|
||||
return $this->{$funcname}($lesson, $record);
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates a content page for testing purposes.
|
||||
*
|
||||
* @param stdClass $lesson instance where to create the page.
|
||||
* @param array|stdClass $record data for page being generated.
|
||||
* @return stdClass page record.
|
||||
*/
|
||||
public function create_content($lesson, $record = array()) {
|
||||
global $DB, $CFG;
|
||||
require_once($CFG->dirroot.'/mod/lesson/locallib.php');
|
||||
$now = time();
|
||||
$this->pagecount++;
|
||||
$record = (array)$record + array(
|
||||
@@ -120,11 +233,10 @@ class mod_lesson_generator extends testing_module_generator {
|
||||
* Create True/false question pages.
|
||||
* @param object $lesson
|
||||
* @param array $record
|
||||
* @return \stdClass
|
||||
* @return stdClass page record.
|
||||
*/
|
||||
public function create_question_truefalse($lesson, $record = array()) {
|
||||
global $DB, $CFG;
|
||||
require_once($CFG->dirroot.'/mod/lesson/locallib.php');
|
||||
$now = time();
|
||||
$this->pagecount++;
|
||||
$record = (array)$record + array(
|
||||
@@ -173,11 +285,10 @@ class mod_lesson_generator extends testing_module_generator {
|
||||
* Create multichoice question pages.
|
||||
* @param object $lesson
|
||||
* @param array $record
|
||||
* @return int
|
||||
* @return stdClass page record.
|
||||
*/
|
||||
public function create_question_multichoice($lesson, $record = array()) {
|
||||
global $DB, $CFG;
|
||||
require_once($CFG->dirroot.'/mod/lesson/locallib.php');
|
||||
$now = time();
|
||||
$this->pagecount++;
|
||||
$record = (array)$record + array(
|
||||
@@ -226,11 +337,10 @@ class mod_lesson_generator extends testing_module_generator {
|
||||
* Create essay question pages.
|
||||
* @param object $lesson
|
||||
* @param array $record
|
||||
* @return int
|
||||
* @return stdClass page record.
|
||||
*/
|
||||
public function create_question_essay($lesson, $record = array()) {
|
||||
global $DB, $CFG;
|
||||
require_once($CFG->dirroot.'/mod/lesson/locallib.php');
|
||||
$now = time();
|
||||
$this->pagecount++;
|
||||
$record = (array)$record + array(
|
||||
@@ -268,11 +378,10 @@ class mod_lesson_generator extends testing_module_generator {
|
||||
* Create matching question pages.
|
||||
* @param object $lesson
|
||||
* @param array $record
|
||||
* @return int
|
||||
* @return stdClass page record.
|
||||
*/
|
||||
public function create_question_matching($lesson, $record = array()) {
|
||||
global $DB, $CFG;
|
||||
require_once($CFG->dirroot.'/mod/lesson/locallib.php');
|
||||
$now = time();
|
||||
$this->pagecount++;
|
||||
$record = (array)$record + array(
|
||||
@@ -347,11 +456,10 @@ class mod_lesson_generator extends testing_module_generator {
|
||||
* Create shortanswer question pages.
|
||||
* @param object $lesson
|
||||
* @param array $record
|
||||
* @return int
|
||||
* @return stdClass page record.
|
||||
*/
|
||||
public function create_question_shortanswer($lesson, $record = array()) {
|
||||
global $DB, $CFG;
|
||||
require_once($CFG->dirroot.'/mod/lesson/locallib.php');
|
||||
$now = time();
|
||||
$this->pagecount++;
|
||||
$record = (array)$record + array(
|
||||
@@ -389,11 +497,10 @@ class mod_lesson_generator extends testing_module_generator {
|
||||
* Create shortanswer question pages.
|
||||
* @param object $lesson
|
||||
* @param array $record
|
||||
* @return int
|
||||
* @return stdClass page record.
|
||||
*/
|
||||
public function create_question_numeric($lesson, $record = array()) {
|
||||
global $DB, $CFG;
|
||||
require_once($CFG->dirroot.'/mod/lesson/locallib.php');
|
||||
$now = time();
|
||||
$this->pagecount++;
|
||||
$record = (array)$record + array(
|
||||
@@ -427,10 +534,101 @@ class mod_lesson_generator extends testing_module_generator {
|
||||
return $DB->get_record('lesson_pages', array('id' => $page->id), '*', MUST_EXIST);
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates a cluster page for testing purposes.
|
||||
*
|
||||
* @param stdClass $lesson instance where to create the page.
|
||||
* @param array $record data for page being generated.
|
||||
* @return stdClass page record.
|
||||
*/
|
||||
public function create_cluster(stdClass $lesson, array $record = []): stdClass {
|
||||
global $DB, $CFG;
|
||||
$now = time();
|
||||
$this->pagecount++;
|
||||
$record = $record + [
|
||||
'lessonid' => $lesson->id,
|
||||
'title' => 'Cluster '.$this->pagecount,
|
||||
'timecreated' => $now,
|
||||
'qtype' => 30, // LESSON_PAGE_CLUSTER.
|
||||
'pageid' => 0, // By default insert in the beginning.
|
||||
];
|
||||
if (!isset($record['contents_editor'])) {
|
||||
$record['contents_editor'] = [
|
||||
'text' => 'Cluster '.$this->pagecount,
|
||||
'format' => FORMAT_MOODLE,
|
||||
'itemid' => 0,
|
||||
];
|
||||
}
|
||||
$context = context_module::instance($lesson->cmid);
|
||||
$page = lesson_page::create((object)$record, new lesson($lesson), $context, $CFG->maxbytes);
|
||||
return $DB->get_record('lesson_pages', ['id' => $page->id], '*', MUST_EXIST);
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates a end of cluster page for testing purposes.
|
||||
*
|
||||
* @param stdClass $lesson instance where to create the page.
|
||||
* @param array $record data for page being generated.
|
||||
* @return stdClass page record.
|
||||
*/
|
||||
public function create_endofcluster(stdClass $lesson, array $record = []): stdClass {
|
||||
global $DB, $CFG;
|
||||
$now = time();
|
||||
$this->pagecount++;
|
||||
$record = $record + [
|
||||
'lessonid' => $lesson->id,
|
||||
'title' => 'End of cluster '.$this->pagecount,
|
||||
'timecreated' => $now,
|
||||
'qtype' => 31, // LESSON_PAGE_ENDOFCLUSTER.
|
||||
'pageid' => 0, // By default insert in the beginning.
|
||||
];
|
||||
if (!isset($record['contents_editor'])) {
|
||||
$record['contents_editor'] = [
|
||||
'text' => 'End of cluster '.$this->pagecount,
|
||||
'format' => FORMAT_MOODLE,
|
||||
'itemid' => 0,
|
||||
];
|
||||
}
|
||||
$context = context_module::instance($lesson->cmid);
|
||||
$page = lesson_page::create((object)$record, new lesson($lesson), $context, $CFG->maxbytes);
|
||||
return $DB->get_record('lesson_pages', ['id' => $page->id], '*', MUST_EXIST);
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates a end of branch page for testing purposes.
|
||||
*
|
||||
* @param stdClass $lesson instance where to create the page.
|
||||
* @param array $record data for page being generated.
|
||||
* @return stdClass page record.
|
||||
*/
|
||||
public function create_endofbranch(stdClass $lesson, array $record = []): stdClass {
|
||||
global $DB, $CFG;
|
||||
$now = time();
|
||||
$this->pagecount++;
|
||||
$record = $record + [
|
||||
'lessonid' => $lesson->id,
|
||||
'title' => 'End of branch '.$this->pagecount,
|
||||
'timecreated' => $now,
|
||||
'qtype' => 21, // LESSON_PAGE_ENDOFBRANCH.
|
||||
'pageid' => 0, // By default insert in the beginning.
|
||||
];
|
||||
if (!isset($record['contents_editor'])) {
|
||||
$record['contents_editor'] = [
|
||||
'text' => 'End of branch '.$this->pagecount,
|
||||
'format' => FORMAT_MOODLE,
|
||||
'itemid' => 0,
|
||||
];
|
||||
}
|
||||
$context = context_module::instance($lesson->cmid);
|
||||
$page = lesson_page::create((object)$record, new lesson($lesson), $context, $CFG->maxbytes);
|
||||
return $DB->get_record('lesson_pages', ['id' => $page->id], '*', MUST_EXIST);
|
||||
}
|
||||
|
||||
/**
|
||||
* Create a lesson override (either user or group).
|
||||
*
|
||||
* @param array $data must specify lessonid, and one of userid or groupid.
|
||||
* @throws coding_exception
|
||||
*/
|
||||
public function create_override(array $data): void {
|
||||
global $DB;
|
||||
@@ -449,4 +647,159 @@ class mod_lesson_generator extends testing_module_generator {
|
||||
|
||||
$DB->insert_record('lesson_overrides', (object) $data);
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates an answer in a page for testing purposes.
|
||||
*
|
||||
* @param null|array|stdClass $record data for module being generated.
|
||||
* @param null|array $options general options.
|
||||
* @throws coding_exception
|
||||
*/
|
||||
public function create_answer($record = null, array $options = null) {
|
||||
$record = (array) $record;
|
||||
|
||||
$candidatepage = null;
|
||||
$pagetitle = $record['page'];
|
||||
$found = false;
|
||||
foreach ($this->candidatepages as &$candidatepage) {
|
||||
if ($candidatepage['title'] === $pagetitle) {
|
||||
$found = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (!$found) {
|
||||
throw new coding_exception("Page '$pagetitle' not found in candidate pages. Please make sure the page exists "
|
||||
. 'and all answers are in the same table.');
|
||||
}
|
||||
|
||||
if (isset($record['answer'])) {
|
||||
$candidatepage['answer_editor'][] = [
|
||||
'text' => $record['answer'],
|
||||
'format' => FORMAT_HTML,
|
||||
];
|
||||
} else {
|
||||
$candidatepage['answer_editor'][] = null;
|
||||
}
|
||||
|
||||
if (isset($record['response'])) {
|
||||
$candidatepage['response_editor'][] = [
|
||||
'text' => $record['response'],
|
||||
'format' => FORMAT_HTML,
|
||||
];
|
||||
} else {
|
||||
$candidatepage['response_editor'][] = null;
|
||||
}
|
||||
|
||||
$candidatepage['jumpto'][] = $record['jumpto'] ?? LESSON_THISPAGE;
|
||||
$candidatepage['score'][] = $record['score'] ?? 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* All answers in a table have been generated, create the pages.
|
||||
*/
|
||||
public function finish_generate_answer() {
|
||||
$this->create_candidate_pages();
|
||||
}
|
||||
|
||||
/**
|
||||
* Create candidate pages.
|
||||
*
|
||||
* @throws coding_exception
|
||||
*/
|
||||
protected function create_candidate_pages(): void {
|
||||
// For performance reasons it would be better to use a topological sort algorithm. But since test cases shouldn't have
|
||||
// a lot of paged and complex jumps it was implemented using a simpler approach.
|
||||
$consecutiveblocked = 0;
|
||||
|
||||
while (count($this->candidatepages) > 0) {
|
||||
$page = array_shift($this->candidatepages);
|
||||
$id = $this->perform_create_page($page);
|
||||
|
||||
if ($id === null) {
|
||||
// Page cannot be created yet because of jumpto. Move it to the end of list.
|
||||
$consecutiveblocked++;
|
||||
$this->candidatepages[] = $page;
|
||||
|
||||
if ($consecutiveblocked === count($this->candidatepages)) {
|
||||
throw new coding_exception('There is a circular dependency in pages jumps.');
|
||||
}
|
||||
} else {
|
||||
$consecutiveblocked = 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Calculate the previous page id.
|
||||
* If no page title is supplied, use the last page created in the lesson (0 if no pages).
|
||||
* If page title is supplied, search it in DB and the list of candidate pages.
|
||||
*
|
||||
* @param int $lessonid the lesson id.
|
||||
* @param string $pagetitle the page title, for example 'Test page'. '0' if no previous page.
|
||||
* @return int corresponding id. 0 if no previous page.
|
||||
* @throws coding_exception
|
||||
*/
|
||||
protected function get_previouspage_id(int $lessonid, string $pagetitle): int {
|
||||
global $DB;
|
||||
|
||||
if (is_numeric($pagetitle) && intval($pagetitle) === 0) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
$pages = $DB->get_records('lesson_pages', ['lessonid' => $lessonid, 'title' => $pagetitle], 'id ASC', 'id, title');
|
||||
|
||||
if (count($pages) > 1) {
|
||||
throw new coding_exception("More than one page with '$pagetitle' found");
|
||||
} else if (!empty($pages)) {
|
||||
return current($pages)->id;
|
||||
}
|
||||
|
||||
// Page doesn't exist, search if it's a candidate page. If it is, use its previous page instead.
|
||||
foreach ($this->candidatepages as $candidatepage) {
|
||||
if ($candidatepage['title'] === $pagetitle) {
|
||||
return $this->get_previouspage_id($lessonid, $candidatepage['previouspage']);
|
||||
}
|
||||
}
|
||||
|
||||
throw new coding_exception("Page '$pagetitle' not found");
|
||||
}
|
||||
|
||||
/**
|
||||
* Convert the jumpto using a string to an integer value.
|
||||
* The jumpto can contain a page name or one of our predefined values.
|
||||
*
|
||||
* @param int $lessonid the lesson id.
|
||||
* @param array|null $jumptolist list of jumpto to treat.
|
||||
* @return array|null list of jumpto already treated.
|
||||
* @throws coding_exception
|
||||
*/
|
||||
protected function convert_page_jumpto(int $lessonid, ?array $jumptolist): ?array {
|
||||
global $DB;
|
||||
|
||||
if (empty($jumptolist)) {
|
||||
return $jumptolist;
|
||||
}
|
||||
|
||||
foreach ($jumptolist as $i => $jumpto) {
|
||||
if (empty($jumpto) || is_numeric($jumpto)) {
|
||||
continue;
|
||||
}
|
||||
|
||||
if (isset($this->jumptomap[$jumpto])) {
|
||||
$jumptolist[$i] = $this->jumptomap[$jumpto];
|
||||
|
||||
continue;
|
||||
}
|
||||
|
||||
$page = $DB->get_record('lesson_pages', ['lessonid' => $lessonid, 'title' => $jumpto], 'id');
|
||||
if ($page === false) {
|
||||
throw new coding_exception("Jump '$jumpto' not found in pages.");
|
||||
}
|
||||
|
||||
$jumptolist[$i] = $page->id;
|
||||
}
|
||||
|
||||
return $jumptolist;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -23,6 +23,7 @@ namespace mod_lesson;
|
||||
* @category test
|
||||
* @copyright 2013 Marina Glancy
|
||||
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
|
||||
* @covers \mod_lesson_generator
|
||||
*/
|
||||
class generator_test extends \advanced_testcase {
|
||||
|
||||
@@ -213,4 +214,537 @@ class generator_test extends \advanced_testcase {
|
||||
$this->assertEquals($page2->id, $records[$page2->id]->id);
|
||||
$this->assertEquals($page2->title, $records[$page2->id]->title);
|
||||
}
|
||||
|
||||
/**
|
||||
* This tests the generators for cluster, endofcluster and endofbranch pages.
|
||||
*
|
||||
* @covers ::create_cluster
|
||||
* @covers ::create_endofcluster
|
||||
* @covers ::create_endofbranch
|
||||
* @dataProvider create_cluster_pages_provider
|
||||
*
|
||||
* @param string $type Type of page to test: LESSON_PAGE_CLUSTER, LESSON_PAGE_ENDOFCLUSTER or LESSON_PAGE_ENDOFBRANCH.
|
||||
*/
|
||||
public function test_create_cluster_pages(string $type): void {
|
||||
global $DB;
|
||||
$this->resetAfterTest();
|
||||
$this->setAdminUser();
|
||||
|
||||
$course = $this->getDataGenerator()->create_course();
|
||||
$lesson = $this->getDataGenerator()->create_module('lesson', ['course' => $course]);
|
||||
$lessongenerator = $this->getDataGenerator()->get_plugin_generator('mod_lesson');
|
||||
|
||||
$page2data = [
|
||||
'title' => 'Custom title',
|
||||
'contents_editor' => [
|
||||
'text' => 'Custom content',
|
||||
'format' => FORMAT_MOODLE,
|
||||
'itemid' => 0,
|
||||
],
|
||||
'jumpto' => [LESSON_EOL],
|
||||
];
|
||||
|
||||
switch ($type) {
|
||||
case LESSON_PAGE_CLUSTER:
|
||||
$page1 = $lessongenerator->create_cluster($lesson);
|
||||
$page2 = $lessongenerator->create_cluster($lesson, $page2data);
|
||||
break;
|
||||
case LESSON_PAGE_ENDOFCLUSTER:
|
||||
$page1 = $lessongenerator->create_endofcluster($lesson);
|
||||
$page2 = $lessongenerator->create_endofcluster($lesson, $page2data);
|
||||
break;
|
||||
case LESSON_PAGE_ENDOFBRANCH:
|
||||
$page1 = $lessongenerator->create_endofbranch($lesson);
|
||||
$page2 = $lessongenerator->create_endofbranch($lesson, $page2data);
|
||||
break;
|
||||
default:
|
||||
throw new coding_exception('Cluster page type not valid: ' . $type);
|
||||
}
|
||||
|
||||
$records = $DB->get_records('lesson_pages', ['lessonid' => $lesson->id], 'id');
|
||||
$p1answers = $DB->get_records('lesson_answers', ['lessonid' => $lesson->id, 'pageid' => $page1->id], 'id');
|
||||
$p2answers = $DB->get_records('lesson_answers', ['lessonid' => $lesson->id, 'pageid' => $page2->id], 'id');
|
||||
|
||||
$this->assertCount(2, $records);
|
||||
$this->assertEquals($page1->id, $records[$page1->id]->id);
|
||||
$this->assertEquals($type, $records[$page1->id]->qtype);
|
||||
$this->assertEquals($page2->id, $records[$page2->id]->id);
|
||||
$this->assertEquals($type, $records[$page2->id]->qtype);
|
||||
$this->assertEquals($page2->title, $records[$page2->id]->title);
|
||||
$this->assertEquals($page2data['contents_editor']['text'], $records[$page2->id]->contents);
|
||||
$this->assertCount(1, $p1answers);
|
||||
$this->assertCount(1, $p2answers);
|
||||
$this->assertEquals(LESSON_THISPAGE, array_pop($p1answers)->jumpto);
|
||||
$this->assertEquals(LESSON_EOL, array_pop($p2answers)->jumpto);
|
||||
}
|
||||
|
||||
/**
|
||||
* Data provider for test_create_cluster_pages().
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public static function create_cluster_pages_provider(): array {
|
||||
// Using the page constants here throws an error: Undefined constant "mod_lesson\LESSON_PAGE_CLUSTER".
|
||||
return [
|
||||
'Cluster' => [
|
||||
'type' => '30',
|
||||
],
|
||||
'End of cluster' => [
|
||||
'type' => '31',
|
||||
],
|
||||
'End of branch' => [
|
||||
'type' => '21',
|
||||
],
|
||||
];
|
||||
}
|
||||
|
||||
/**
|
||||
* Test create some pages and their answers.
|
||||
*
|
||||
* @covers ::create_page
|
||||
* @covers ::create_answer
|
||||
* @covers ::finish_generate_answer
|
||||
*/
|
||||
public function test_create_page_and_answers(): void {
|
||||
global $DB;
|
||||
$this->resetAfterTest();
|
||||
$this->setAdminUser();
|
||||
|
||||
$course = $this->getDataGenerator()->create_course();
|
||||
$lesson = $this->getDataGenerator()->create_module('lesson', ['course' => $course]);
|
||||
$lessongenerator = $this->getDataGenerator()->get_plugin_generator('mod_lesson');
|
||||
|
||||
// Define the pages. Only a couple pages will be created since each page type has their own unit tests.
|
||||
$contentpage = [
|
||||
'title' => 'First page name',
|
||||
'content' => 'First page contents',
|
||||
'qtype' => 'content',
|
||||
'lessonid' => $lesson->id,
|
||||
];
|
||||
$multichoicepage = [
|
||||
'title' => 'Multichoice question',
|
||||
'content' => 'What animal is an amphibian?',
|
||||
'qtype' => 'multichoice',
|
||||
'lessonid' => $lesson->id,
|
||||
];
|
||||
|
||||
$lessongenerator->create_page($contentpage);
|
||||
$lessongenerator->create_page($multichoicepage);
|
||||
|
||||
// Check that pages haven't been generated yet because no answers were added.
|
||||
$pages = $DB->get_records('lesson_pages', ['lessonid' => $lesson->id], 'id');
|
||||
$this->assertEquals(0, count($pages));
|
||||
|
||||
// Now add answers to the pages.
|
||||
$contentpagecontinueanswer = [
|
||||
'page' => $contentpage['title'],
|
||||
'answer' => 'Continue',
|
||||
'jumpto' => 'Next page',
|
||||
'score' => 1,
|
||||
];
|
||||
$contentpagestayanswer = [
|
||||
'page' => $contentpage['title'],
|
||||
'answer' => 'Stay',
|
||||
'jumpto' => 'This page',
|
||||
'score' => 0,
|
||||
];
|
||||
$multichoicepagefroganswer = [
|
||||
'page' => $multichoicepage['title'],
|
||||
'answer' => 'Frog',
|
||||
'response' => 'Correct answer',
|
||||
'jumpto' => 'Next page',
|
||||
'score' => 1,
|
||||
];
|
||||
$multichoicepagecatanswer = [
|
||||
'page' => $multichoicepage['title'],
|
||||
'answer' => 'Cat',
|
||||
'response' => 'Incorrect answer',
|
||||
'jumpto' => 'This page',
|
||||
'score' => 0,
|
||||
];
|
||||
$multichoicepagedoganswer = [
|
||||
'page' => $multichoicepage['title'],
|
||||
'answer' => 'Dog',
|
||||
'response' => 'Incorrect answer',
|
||||
'jumpto' => 'This page',
|
||||
'score' => 0,
|
||||
];
|
||||
|
||||
$lessongenerator->create_answer($contentpagecontinueanswer);
|
||||
$lessongenerator->create_answer($contentpagestayanswer);
|
||||
$lessongenerator->create_answer($multichoicepagefroganswer);
|
||||
$lessongenerator->create_answer($multichoicepagecatanswer);
|
||||
$lessongenerator->create_answer($multichoicepagedoganswer);
|
||||
|
||||
// Check that pages and answers haven't been generated yet because maybe not all answers have been added yet.
|
||||
$pages = $DB->get_records('lesson_pages', ['lessonid' => $lesson->id], 'id');
|
||||
$answers = $DB->get_records('lesson_answers', ['lessonid' => $lesson->id], 'id');
|
||||
$this->assertEquals(0, count($pages));
|
||||
$this->assertEquals(0, count($answers));
|
||||
|
||||
// Notify that all answers have been added, so pages can be created.
|
||||
$lessongenerator->finish_generate_answer();
|
||||
|
||||
// Check that pages and answers have been created.
|
||||
$pages = $DB->get_records('lesson_pages', ['lessonid' => $lesson->id], 'title DESC');
|
||||
$this->assertEquals(2, count($pages));
|
||||
|
||||
$contentpagedb = array_pop($pages);
|
||||
$multichoicepagedb = array_pop($pages);
|
||||
$this->assertEquals($contentpage['title'], $contentpagedb->title);
|
||||
$this->assertEquals($contentpage['content'], $contentpagedb->contents);
|
||||
$this->assertEquals(LESSON_PAGE_BRANCHTABLE, $contentpagedb->qtype);
|
||||
$this->assertEquals($multichoicepage['title'], $multichoicepagedb->title);
|
||||
$this->assertEquals($multichoicepage['content'], $multichoicepagedb->contents);
|
||||
$this->assertEquals(LESSON_PAGE_MULTICHOICE, $multichoicepagedb->qtype);
|
||||
|
||||
$answers = $DB->get_records('lesson_answers', ['lessonid' => $lesson->id], 'answer DESC');
|
||||
$this->assertEquals(5, count($answers));
|
||||
|
||||
$multichoicepagecatanswerdb = array_pop($answers);
|
||||
$contentpagecontinueanswerdb = array_pop($answers);
|
||||
$multichoicepagedoganswerdb = array_pop($answers);
|
||||
$multichoicepagefroganswerdb = array_pop($answers);
|
||||
$contentpagestayanswerdb = array_pop($answers);
|
||||
$this->assertEquals($contentpagedb->id, $contentpagecontinueanswerdb->pageid);
|
||||
$this->assertEquals($contentpagecontinueanswer['answer'], $contentpagecontinueanswerdb->answer);
|
||||
$this->assertEquals(LESSON_NEXTPAGE, $contentpagecontinueanswerdb->jumpto);
|
||||
$this->assertEquals($contentpagecontinueanswer['score'], $contentpagecontinueanswerdb->score);
|
||||
$this->assertEquals($contentpagedb->id, $contentpagestayanswerdb->pageid);
|
||||
$this->assertEquals($contentpagestayanswer['answer'], $contentpagestayanswerdb->answer);
|
||||
$this->assertEquals(LESSON_THISPAGE, $contentpagestayanswerdb->jumpto);
|
||||
$this->assertEquals($contentpagestayanswer['score'], $contentpagestayanswerdb->score);
|
||||
$this->assertEquals($multichoicepagedb->id, $multichoicepagefroganswerdb->pageid);
|
||||
$this->assertEquals($multichoicepagefroganswer['answer'], $multichoicepagefroganswerdb->answer);
|
||||
$this->assertEquals($multichoicepagefroganswer['response'], $multichoicepagefroganswerdb->response);
|
||||
$this->assertEquals(LESSON_NEXTPAGE, $multichoicepagefroganswerdb->jumpto);
|
||||
$this->assertEquals($multichoicepagefroganswer['score'], $multichoicepagefroganswerdb->score);
|
||||
$this->assertEquals($multichoicepagedb->id, $multichoicepagedoganswerdb->pageid);
|
||||
$this->assertEquals($multichoicepagedoganswer['answer'], $multichoicepagedoganswerdb->answer);
|
||||
$this->assertEquals($multichoicepagedoganswer['response'], $multichoicepagedoganswerdb->response);
|
||||
$this->assertEquals(LESSON_THISPAGE, $multichoicepagedoganswerdb->jumpto);
|
||||
$this->assertEquals($multichoicepagedoganswer['score'], $multichoicepagedoganswerdb->score);
|
||||
$this->assertEquals($multichoicepagedb->id, $multichoicepagecatanswerdb->pageid);
|
||||
$this->assertEquals($multichoicepagecatanswer['answer'], $multichoicepagecatanswerdb->answer);
|
||||
$this->assertEquals($multichoicepagecatanswer['response'], $multichoicepagecatanswerdb->response);
|
||||
$this->assertEquals(LESSON_THISPAGE, $multichoicepagecatanswerdb->jumpto);
|
||||
$this->assertEquals($multichoicepagecatanswer['score'], $multichoicepagecatanswerdb->score);
|
||||
}
|
||||
|
||||
/**
|
||||
* Test creating pages defining the previous pages.
|
||||
*
|
||||
* @covers ::create_page
|
||||
*/
|
||||
public function test_create_page_with_previouspage(): void {
|
||||
global $DB;
|
||||
$this->resetAfterTest();
|
||||
$this->setAdminUser();
|
||||
|
||||
$course = $this->getDataGenerator()->create_course();
|
||||
$lesson = $this->getDataGenerator()->create_module('lesson', ['course' => $course]);
|
||||
$lessongenerator = $this->getDataGenerator()->get_plugin_generator('mod_lesson');
|
||||
|
||||
$firstpage = [
|
||||
'title' => 'First page name',
|
||||
'content' => 'First page contents',
|
||||
'qtype' => 'content',
|
||||
'lessonid' => $lesson->id,
|
||||
'previouspage' => 0, // No previous page, this will be the first page.
|
||||
];
|
||||
$secondpage = [
|
||||
'title' => 'Second page name',
|
||||
'content' => 'Second page contents',
|
||||
'qtype' => 'content',
|
||||
'lessonid' => $lesson->id,
|
||||
'previouspage' => 'First page name',
|
||||
];
|
||||
$thirdpage = [
|
||||
'title' => 'Third page name',
|
||||
'content' => 'Third page contents',
|
||||
'qtype' => 'content',
|
||||
'lessonid' => $lesson->id,
|
||||
'previouspage' => 'Second page name',
|
||||
];
|
||||
|
||||
// Create the third page first to check that the added order is not important, the order will still be calculated right.
|
||||
$lessongenerator->create_page($thirdpage);
|
||||
$lessongenerator->create_page($firstpage);
|
||||
$lessongenerator->create_page($secondpage);
|
||||
|
||||
// Don't define any answers, the default answers will be added.
|
||||
$lessongenerator->finish_generate_answer();
|
||||
|
||||
$pages = $DB->get_records('lesson_pages', ['lessonid' => $lesson->id], 'title DESC');
|
||||
$this->assertEquals(3, count($pages));
|
||||
|
||||
$firstpagedb = array_pop($pages);
|
||||
$secondpagedb = array_pop($pages);
|
||||
$thirdpagedb = array_pop($pages);
|
||||
$this->assertEquals($firstpage['title'], $firstpagedb->title);
|
||||
$this->assertEquals(0, $firstpagedb->prevpageid);
|
||||
$this->assertEquals($secondpagedb->id, $firstpagedb->nextpageid);
|
||||
$this->assertEquals($secondpage['title'], $secondpagedb->title);
|
||||
$this->assertEquals($firstpagedb->id, $secondpagedb->prevpageid);
|
||||
$this->assertEquals($thirdpagedb->id, $secondpagedb->nextpageid);
|
||||
$this->assertEquals($thirdpage['title'], $thirdpagedb->title);
|
||||
$this->assertEquals($secondpagedb->id, $thirdpagedb->prevpageid);
|
||||
$this->assertEquals(0, $thirdpagedb->nextpageid);
|
||||
}
|
||||
|
||||
/**
|
||||
* Test creating a page with a previous page that doesn't exist.
|
||||
*
|
||||
* @covers ::create_page
|
||||
*/
|
||||
public function test_create_page_invalid_previouspage(): void {
|
||||
$this->resetAfterTest();
|
||||
$this->setAdminUser();
|
||||
|
||||
$course = $this->getDataGenerator()->create_course();
|
||||
$lesson = $this->getDataGenerator()->create_module('lesson', ['course' => $course]);
|
||||
$lessongenerator = $this->getDataGenerator()->get_plugin_generator('mod_lesson');
|
||||
|
||||
$this->expectException('coding_exception');
|
||||
$lessongenerator->create_page([
|
||||
'title' => 'First page name',
|
||||
'content' => 'First page contents',
|
||||
'qtype' => 'content',
|
||||
'lessonid' => $lesson->id,
|
||||
'previouspage' => 'Invalid page',
|
||||
]);
|
||||
$lessongenerator->finish_generate_answer();
|
||||
}
|
||||
|
||||
/**
|
||||
* Test that circular dependencies are not allowed in previous pages.
|
||||
*
|
||||
* @covers ::create_page
|
||||
*/
|
||||
public function test_create_page_previouspage_circular_dependency(): void {
|
||||
$this->resetAfterTest();
|
||||
$this->setAdminUser();
|
||||
|
||||
$course = $this->getDataGenerator()->create_course();
|
||||
$lesson = $this->getDataGenerator()->create_module('lesson', ['course' => $course]);
|
||||
$lessongenerator = $this->getDataGenerator()->get_plugin_generator('mod_lesson');
|
||||
|
||||
$this->expectException('coding_exception');
|
||||
$lessongenerator->create_page([
|
||||
'title' => 'First page name',
|
||||
'content' => 'First page contents',
|
||||
'qtype' => 'content',
|
||||
'lessonid' => $lesson->id,
|
||||
'previouspage' => 'Second page name',
|
||||
]);
|
||||
$lessongenerator->create_page([
|
||||
'title' => 'Second page name',
|
||||
'content' => 'Second page contents',
|
||||
'qtype' => 'content',
|
||||
'lessonid' => $lesson->id,
|
||||
'previouspage' => 'First page name',
|
||||
]);
|
||||
$lessongenerator->finish_generate_answer();
|
||||
}
|
||||
|
||||
/**
|
||||
* Test creating an answer in a page that doesn't exist.
|
||||
*
|
||||
* @covers ::create_answer
|
||||
*/
|
||||
public function test_create_answer_invalid_page(): void {
|
||||
$lessongenerator = $this->getDataGenerator()->get_plugin_generator('mod_lesson');
|
||||
|
||||
$this->expectException('coding_exception');
|
||||
$lessongenerator->create_answer([
|
||||
'page' => 'Invalid page',
|
||||
]);
|
||||
}
|
||||
|
||||
/**
|
||||
* Test that all the possible values of jumpto work as expected when creating an answer.
|
||||
*
|
||||
* @covers ::create_answer
|
||||
*/
|
||||
public function test_create_answer_jumpto(): void {
|
||||
global $DB;
|
||||
$this->resetAfterTest();
|
||||
$this->setAdminUser();
|
||||
|
||||
$course = $this->getDataGenerator()->create_course();
|
||||
$lesson = $this->getDataGenerator()->create_module('lesson', ['course' => $course]);
|
||||
$lessongenerator = $this->getDataGenerator()->get_plugin_generator('mod_lesson');
|
||||
|
||||
$contentpage = [
|
||||
'title' => 'First page name',
|
||||
'content' => 'First page contents',
|
||||
'qtype' => 'content',
|
||||
'lessonid' => $lesson->id,
|
||||
];
|
||||
$secondcontentpage = [
|
||||
'title' => 'Second page name',
|
||||
'content' => 'Second page contents',
|
||||
'qtype' => 'content',
|
||||
'lessonid' => $lesson->id,
|
||||
];
|
||||
$thirdcontentpage = [
|
||||
'title' => 'Third page name',
|
||||
'content' => 'Third page contents',
|
||||
'qtype' => 'content',
|
||||
'lessonid' => $lesson->id,
|
||||
];
|
||||
$lessongenerator->create_page($contentpage);
|
||||
$lessongenerator->create_page($secondcontentpage);
|
||||
$lessongenerator->create_page($thirdcontentpage);
|
||||
|
||||
$lessongenerator->create_answer([
|
||||
'page' => $contentpage['title'],
|
||||
'answer' => 'A',
|
||||
'jumpto' => 'This page',
|
||||
]);
|
||||
$lessongenerator->create_answer([
|
||||
'page' => $contentpage['title'],
|
||||
'answer' => 'B',
|
||||
'jumpto' => 'Next page',
|
||||
]);
|
||||
$lessongenerator->create_answer([
|
||||
'page' => $contentpage['title'],
|
||||
'answer' => 'C',
|
||||
'jumpto' => 'Previous page',
|
||||
]);
|
||||
$lessongenerator->create_answer([
|
||||
'page' => $secondcontentpage['title'],
|
||||
'answer' => 'D',
|
||||
'jumpto' => 'End of lesson',
|
||||
]);
|
||||
$lessongenerator->create_answer([
|
||||
'page' => $secondcontentpage['title'],
|
||||
'answer' => 'E',
|
||||
'jumpto' => 'Unseen question within a content page',
|
||||
]);
|
||||
$lessongenerator->create_answer([
|
||||
'page' => $secondcontentpage['title'],
|
||||
'answer' => 'F',
|
||||
'jumpto' => 'Random question within a content page',
|
||||
]);
|
||||
$lessongenerator->create_answer([
|
||||
'page' => $thirdcontentpage['title'],
|
||||
'answer' => 'G',
|
||||
'jumpto' => 'Random content page',
|
||||
]);
|
||||
$lessongenerator->create_answer([
|
||||
'page' => $thirdcontentpage['title'],
|
||||
'answer' => 'H',
|
||||
'jumpto' => 'Unseen question within a cluster',
|
||||
]);
|
||||
$lessongenerator->create_answer([
|
||||
'page' => $thirdcontentpage['title'],
|
||||
'answer' => 'I',
|
||||
'jumpto' => 1234, // A page ID, it doesn't matter that it doesn't exist.
|
||||
]);
|
||||
$lessongenerator->create_answer([
|
||||
'page' => $contentpage['title'],
|
||||
'answer' => 'J',
|
||||
'jumpto' => 'Third page name',
|
||||
]);
|
||||
$lessongenerator->create_answer([
|
||||
'page' => $thirdcontentpage['title'],
|
||||
'answer' => 'K',
|
||||
'jumpto' => 'Second page name',
|
||||
]);
|
||||
|
||||
$lessongenerator->finish_generate_answer();
|
||||
|
||||
$secondcontentpagedb = $DB->get_record('lesson_pages', ['lessonid' => $lesson->id, 'title' => $secondcontentpage['title']]);
|
||||
$thirdcontentpagedb = $DB->get_record('lesson_pages', ['lessonid' => $lesson->id, 'title' => $thirdcontentpage['title']]);
|
||||
$answers = $DB->get_records('lesson_answers', ['lessonid' => $lesson->id], 'answer DESC');
|
||||
$this->assertEquals(11, count($answers));
|
||||
|
||||
$this->assertEquals(LESSON_THISPAGE, array_pop($answers)->jumpto);
|
||||
$this->assertEquals(LESSON_NEXTPAGE, array_pop($answers)->jumpto);
|
||||
$this->assertEquals(LESSON_PREVIOUSPAGE, array_pop($answers)->jumpto);
|
||||
$this->assertEquals(LESSON_EOL, array_pop($answers)->jumpto);
|
||||
$this->assertEquals(LESSON_UNSEENBRANCHPAGE, array_pop($answers)->jumpto);
|
||||
$this->assertEquals(LESSON_RANDOMPAGE, array_pop($answers)->jumpto);
|
||||
$this->assertEquals(LESSON_RANDOMBRANCH, array_pop($answers)->jumpto);
|
||||
$this->assertEquals(LESSON_CLUSTERJUMP, array_pop($answers)->jumpto);
|
||||
$this->assertEquals(1234, array_pop($answers)->jumpto);
|
||||
$this->assertEquals($thirdcontentpagedb->id, array_pop($answers)->jumpto);
|
||||
$this->assertEquals($secondcontentpagedb->id, array_pop($answers)->jumpto);
|
||||
}
|
||||
|
||||
/**
|
||||
* Test invalid jumpto when creating answers.
|
||||
*
|
||||
* @covers ::create_answer
|
||||
*/
|
||||
public function test_create_answer_invalid_jumpto(): void {
|
||||
$this->resetAfterTest();
|
||||
$this->setAdminUser();
|
||||
|
||||
$course = $this->getDataGenerator()->create_course();
|
||||
$lesson = $this->getDataGenerator()->create_module('lesson', ['course' => $course]);
|
||||
$lessongenerator = $this->getDataGenerator()->get_plugin_generator('mod_lesson');
|
||||
|
||||
$contentpage = [
|
||||
'title' => 'First page name',
|
||||
'content' => 'First page contents',
|
||||
'qtype' => 'content',
|
||||
'lessonid' => $lesson->id,
|
||||
];
|
||||
$lessongenerator->create_page($contentpage);
|
||||
|
||||
$lessongenerator->create_answer([
|
||||
'page' => $contentpage['title'],
|
||||
'answer' => 'Next',
|
||||
'jumpto' => 'Invalid page',
|
||||
]);
|
||||
|
||||
$this->expectException('coding_exception');
|
||||
$lessongenerator->finish_generate_answer();
|
||||
}
|
||||
|
||||
/**
|
||||
* Test that circular dependencies are not allowed when creating answers.
|
||||
*
|
||||
* @covers ::create_answer
|
||||
*/
|
||||
public function test_create_answer_jumpto_circular_dependency(): void {
|
||||
$this->resetAfterTest();
|
||||
$this->setAdminUser();
|
||||
|
||||
$course = $this->getDataGenerator()->create_course();
|
||||
$lesson = $this->getDataGenerator()->create_module('lesson', ['course' => $course]);
|
||||
$lessongenerator = $this->getDataGenerator()->get_plugin_generator('mod_lesson');
|
||||
|
||||
$contentpage = [
|
||||
'title' => 'First page name',
|
||||
'content' => 'First page contents',
|
||||
'qtype' => 'content',
|
||||
'lessonid' => $lesson->id,
|
||||
];
|
||||
$secondcontentpage = [
|
||||
'title' => 'Second page name',
|
||||
'content' => 'Second page contents',
|
||||
'qtype' => 'content',
|
||||
'lessonid' => $lesson->id,
|
||||
];
|
||||
$lessongenerator->create_page($contentpage);
|
||||
$lessongenerator->create_page($secondcontentpage);
|
||||
|
||||
$lessongenerator->create_answer([
|
||||
'page' => $contentpage['title'],
|
||||
'answer' => 'Next',
|
||||
'jumpto' => 'Second page name',
|
||||
]);
|
||||
$lessongenerator->create_answer([
|
||||
'page' => $contentpage['title'],
|
||||
'answer' => 'Back',
|
||||
'jumpto' => 'First page name',
|
||||
]);
|
||||
|
||||
$this->expectException('coding_exception');
|
||||
$lessongenerator->finish_generate_answer();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user