diff --git a/lib/form/tests/behat/graderescale_for_lesson_pointscale.feature b/lib/form/tests/behat/graderescale_for_lesson_pointscale.feature index f000b747894..f3c0a9a2675 100644 --- a/lib/form/tests/behat/graderescale_for_lesson_pointscale.feature +++ b/lib/form/tests/behat/graderescale_for_lesson_pointscale.feature @@ -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" diff --git a/mod/lesson/tests/behat/completion_condition_end_reached.feature b/mod/lesson/tests/behat/completion_condition_end_reached.feature index d9508bce482..9eaa9d94691 100644 --- a/mod/lesson/tests/behat/completion_condition_end_reached.feature +++ b/mod/lesson/tests/behat/completion_condition_end_reached.feature @@ -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 > page" 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 > answer" 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" diff --git a/mod/lesson/tests/behat/completion_condition_time_spent.feature b/mod/lesson/tests/behat/completion_condition_time_spent.feature index 46560113ff9..283f45fb6bd 100644 --- a/mod/lesson/tests/behat/completion_condition_time_spent.feature +++ b/mod/lesson/tests/behat/completion_condition_time_spent.feature @@ -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 > answer" 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" diff --git a/mod/lesson/tests/behat/date_availability.feature b/mod/lesson/tests/behat/date_availability.feature index b9d6627a23c..775c7c0abf1 100644 --- a/mod/lesson/tests/behat/date_availability.feature +++ b/mod/lesson/tests/behat/date_availability.feature @@ -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 > 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 | 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" diff --git a/mod/lesson/tests/behat/display_lesson_description.feature b/mod/lesson/tests/behat/display_lesson_description.feature index 10b4254c3be..34f210da7ca 100644 --- a/mod/lesson/tests/behat/display_lesson_description.feature +++ b/mod/lesson/tests/behat/display_lesson_description.feature @@ -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" diff --git a/mod/lesson/tests/behat/lesson_activity_completion.feature b/mod/lesson/tests/behat/lesson_activity_completion.feature index 8b0df560ade..cdc21d84ff1 100644 --- a/mod/lesson/tests/behat/lesson_activity_completion.feature +++ b/mod/lesson/tests/behat/lesson_activity_completion.feature @@ -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 > page" 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 > answer" 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 diff --git a/mod/lesson/tests/behat/lesson_complete_report.feature b/mod/lesson/tests/behat/lesson_complete_report.feature index 76d1a37b9a6..32907236bbe 100644 --- a/mod/lesson/tests/behat/lesson_complete_report.feature +++ b/mod/lesson/tests/behat/lesson_complete_report.feature @@ -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 > page" 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 > answer" 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 > page" 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 > answer" 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 > page" 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 > answer" 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 > page" 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 > answer" 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" diff --git a/mod/lesson/tests/behat/lesson_completion_pass_grade.feature b/mod/lesson/tests/behat/lesson_completion_pass_grade.feature index b631bfa3a9d..649467ebe02 100644 --- a/mod/lesson/tests/behat/lesson_completion_pass_grade.feature +++ b/mod/lesson/tests/behat/lesson_completion_pass_grade.feature @@ -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 > answer" 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 diff --git a/mod/lesson/tests/behat/lesson_course_reset.feature b/mod/lesson/tests/behat/lesson_course_reset.feature index 5b647e54fb3..c6b2ca9e8af 100644 --- a/mod/lesson/tests/behat/lesson_course_reset.feature +++ b/mod/lesson/tests/behat/lesson_course_reset.feature @@ -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 > answer" 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: diff --git a/mod/lesson/tests/behat/lesson_delete_answers.feature b/mod/lesson/tests/behat/lesson_delete_answers.feature index 571d4fca3cc..b836daf07c8 100644 --- a/mod/lesson/tests/behat/lesson_delete_answers.feature +++ b/mod/lesson/tests/behat/lesson_delete_answers.feature @@ -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 > page" 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 > answer" 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 diff --git a/mod/lesson/tests/behat/lesson_edit_pages.feature b/mod/lesson/tests/behat/lesson_edit_pages.feature index 26a957c4ba8..d6fa377e384 100644 --- a/mod/lesson/tests/behat/lesson_edit_pages.feature +++ b/mod/lesson/tests/behat/lesson_edit_pages.feature @@ -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 > page" 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 > answer" 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" diff --git a/mod/lesson/tests/behat/lesson_essay_question.feature b/mod/lesson/tests/behat/lesson_essay_question.feature index 3175432d23f..5d8d54404ae 100644 --- a/mod/lesson/tests/behat/lesson_essay_question.feature +++ b/mod/lesson/tests/behat/lesson_essay_question.feature @@ -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 |

Please write a story about a frog.

| - And I press "Save page" + And the following "mod_lesson > page" exist: + | lesson | qtype | title | content | + | Test lesson name | essay | Essay question |

Please write a story about a frog.

| + 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 "

Once upon a time there was a little green frog." diff --git a/mod/lesson/tests/behat/lesson_group_override.feature b/mod/lesson/tests/behat/lesson_group_override.feature index 639a61c901b..cfe3c78e318 100644 --- a/mod/lesson/tests/behat/lesson_group_override.feature +++ b/mod/lesson/tests/behat/lesson_group_override.feature @@ -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 > answer" 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 diff --git a/mod/lesson/tests/behat/lesson_informations_at_end.feature b/mod/lesson/tests/behat/lesson_informations_at_end.feature index 22c499f2ac1..a62842457e6 100644 --- a/mod/lesson/tests/behat/lesson_informations_at_end.feature +++ b/mod/lesson/tests/behat/lesson_informations_at_end.feature @@ -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 > page" 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 > answer" 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 diff --git a/mod/lesson/tests/behat/lesson_navigation.feature b/mod/lesson/tests/behat/lesson_navigation.feature index 0f197c55ebf..37514f01d45 100644 --- a/mod/lesson/tests/behat/lesson_navigation.feature +++ b/mod/lesson/tests/behat/lesson_navigation.feature @@ -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 > page" 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 > answer" 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 > answer" 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 > page" 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 > answer" 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 > answer" 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: diff --git a/mod/lesson/tests/behat/lesson_number_of_student_attempts.feature b/mod/lesson/tests/behat/lesson_number_of_student_attempts.feature index 310052d1d0a..b8bc847f77a 100644 --- a/mod/lesson/tests/behat/lesson_number_of_student_attempts.feature +++ b/mod/lesson/tests/behat/lesson_number_of_student_attempts.feature @@ -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 > page" 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 > answer" 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 | diff --git a/mod/lesson/tests/behat/lesson_numerical_question_with_locale.feature b/mod/lesson/tests/behat/lesson_numerical_question_with_locale.feature index 1be05ec5fab..7a7b39dc356 100644 --- a/mod/lesson/tests/behat/lesson_numerical_question_with_locale.feature +++ b/mod/lesson/tests/behat/lesson_numerical_question_with_locale.feature @@ -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 > answer" 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 diff --git a/mod/lesson/tests/behat/lesson_outline_report.feature b/mod/lesson/tests/behat/lesson_outline_report.feature index d31470bb6b9..183de7a733b 100644 --- a/mod/lesson/tests/behat/lesson_outline_report.feature +++ b/mod/lesson/tests/behat/lesson_outline_report.feature @@ -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 > page" 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 > answer" 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 > page" 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 > answer" 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 > page" 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 > answer" 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 > page" 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 > answer" 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" diff --git a/mod/lesson/tests/behat/lesson_practice.feature b/mod/lesson/tests/behat/lesson_practice.feature index 38beffc38d7..35214daf307 100644 --- a/mod/lesson/tests/behat/lesson_practice.feature +++ b/mod/lesson/tests/behat/lesson_practice.feature @@ -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 > answer" 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: diff --git a/mod/lesson/tests/behat/lesson_progress_bar.feature b/mod/lesson/tests/behat/lesson_progress_bar.feature index 8fba00a7219..b65adc13f04 100644 --- a/mod/lesson/tests/behat/lesson_progress_bar.feature +++ b/mod/lesson/tests/behat/lesson_progress_bar.feature @@ -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 > page" 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 > answer" 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" diff --git a/mod/lesson/tests/behat/lesson_question_attempts.feature b/mod/lesson/tests/behat/lesson_question_attempts.feature index 48721426b5c..7f0c32b5a1c 100644 --- a/mod/lesson/tests/behat/lesson_question_attempts.feature +++ b/mod/lesson/tests/behat/lesson_question_attempts.feature @@ -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 > page" 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 > answer" 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 diff --git a/mod/lesson/tests/behat/lesson_report.feature b/mod/lesson/tests/behat/lesson_report.feature index ee2b9074bc9..3d7f4ff9bbf 100644 --- a/mod/lesson/tests/behat/lesson_report.feature +++ b/mod/lesson/tests/behat/lesson_report.feature @@ -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 > page" 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 > answer" 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 > page" 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 > answer" 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" diff --git a/mod/lesson/tests/behat/lesson_report_detailed_statistics.feature b/mod/lesson/tests/behat/lesson_report_detailed_statistics.feature index 16f275ce328..f741b275a26 100644 --- a/mod/lesson/tests/behat/lesson_report_detailed_statistics.feature +++ b/mod/lesson/tests/behat/lesson_report_detailed_statistics.feature @@ -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 diff --git a/mod/lesson/tests/behat/lesson_review.feature b/mod/lesson/tests/behat/lesson_review.feature index 5fe06a81309..58012ab6603 100644 --- a/mod/lesson/tests/behat/lesson_review.feature +++ b/mod/lesson/tests/behat/lesson_review.feature @@ -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 > page" 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 > answer" 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: diff --git a/mod/lesson/tests/behat/lesson_student_resume.feature b/mod/lesson/tests/behat/lesson_student_resume.feature index 73be4605071..6a7f7f0b97d 100644 --- a/mod/lesson/tests/behat/lesson_student_resume.feature +++ b/mod/lesson/tests/behat/lesson_student_resume.feature @@ -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 > page" 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 > answer" 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 > page" 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 > answer" 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 > page" 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 > answer" 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 > page" 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 > answer" 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: diff --git a/mod/lesson/tests/behat/lesson_user_override.feature b/mod/lesson/tests/behat/lesson_user_override.feature index 47a33997384..6acdb3e9136 100644 --- a/mod/lesson/tests/behat/lesson_user_override.feature +++ b/mod/lesson/tests/behat/lesson_user_override.feature @@ -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 > answer" 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 diff --git a/mod/lesson/tests/behat/link_to_gradebook.feature b/mod/lesson/tests/behat/link_to_gradebook.feature index 6315265a45a..edbc17cd2b9 100644 --- a/mod/lesson/tests/behat/link_to_gradebook.feature +++ b/mod/lesson/tests/behat/link_to_gradebook.feature @@ -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 > page" 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 > answer" 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 | diff --git a/mod/lesson/tests/behat/password_protection.feature b/mod/lesson/tests/behat/password_protection.feature index 7e348eeaddf..63ffd65404f 100644 --- a/mod/lesson/tests/behat/password_protection.feature +++ b/mod/lesson/tests/behat/password_protection.feature @@ -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" diff --git a/mod/lesson/tests/behat/teacher_grade_essays.feature b/mod/lesson/tests/behat/teacher_grade_essays.feature index 2f169e81046..3f12eb5a245 100644 --- a/mod/lesson/tests/behat/teacher_grade_essays.feature +++ b/mod/lesson/tests/behat/teacher_grade_essays.feature @@ -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 |

Please write a story about a frog.

| + 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 |

Please write a story about a frog.

| - 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 "

Once upon a time there was a little green frog." And I press "Submit" diff --git a/mod/lesson/tests/behat/time_limit.feature b/mod/lesson/tests/behat/time_limit.feature index 420e91922b5..8024910d9be 100644 --- a/mod/lesson/tests/behat/time_limit.feature +++ b/mod/lesson/tests/behat/time_limit.feature @@ -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 diff --git a/mod/lesson/tests/behat/wrong_answer_continue.feature b/mod/lesson/tests/behat/wrong_answer_continue.feature index b9095b4e27c..c31c9b18517 100644 --- a/mod/lesson/tests/behat/wrong_answer_continue.feature +++ b/mod/lesson/tests/behat/wrong_answer_continue.feature @@ -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 > page" 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 > answer" 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 > page" 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 > answer" 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"