From 367027f97971d99700d482ff6c6a37e302996862 Mon Sep 17 00:00:00 2001 From: Angelia Dela Cruz Date: Mon, 8 Aug 2022 15:41:42 +0800 Subject: [PATCH] MDL-75230 behat: Lesson Behat tests optimised Replace steps that manually add Lesson instances via the UI and use Behat generators. This improves the speed of the Behat test runs. --- .../tests/behat/get_and_set_fields.feature | 8 +- grade/tests/behat/grade_to_pass.feature | 22 ++--- ...graderescale_for_lesson_pointscale.feature | 3 - .../videojs/tests/behat/modules.feature | 8 +- .../behat/all_other_answers_catch.feature | 20 +---- .../completion_condition_end_reached.feature | 19 ++--- .../completion_condition_time_spent.feature | 34 +++----- .../tests/behat/date_availability.feature | 33 ++----- .../behat/display_lesson_description.feature | 13 +-- .../behat/lesson_activity_completion.feature | 2 - .../behat/lesson_complete_report.feature | 34 ++------ .../lesson_completion_pass_grade.feature | 20 ++--- .../tests/behat/lesson_course_reset.feature | 8 +- .../tests/behat/lesson_delete_answers.feature | 22 ++--- .../tests/behat/lesson_edit_cluster.feature | 13 +-- .../tests/behat/lesson_edit_pages.feature | 18 ++-- .../tests/behat/lesson_essay_question.feature | 18 ++-- .../behat/lesson_exit_enter_clusters.feature | 13 +-- .../tests/behat/lesson_group_override.feature | 31 ++----- .../behat/lesson_informations_at_end.feature | 19 ++--- .../tests/behat/lesson_navigation.feature | 54 +++--------- .../lesson_no_calendar_capabilities.feature | 14 +-- .../lesson_number_of_student_attempts.feature | 19 +---- ...son_numerical_question_with_locale.feature | 44 +++------- .../tests/behat/lesson_outline_report.feature | 32 ++----- .../tests/behat/lesson_practice.feature | 31 ++----- .../tests/behat/lesson_progress_bar.feature | 17 ++-- .../behat/lesson_question_attempts.feature | 3 - mod/lesson/tests/behat/lesson_report.feature | 28 ++---- mod/lesson/tests/behat/lesson_review.feature | 17 ++-- .../behat/lesson_student_dashboard.feature | 85 ++++++------------- .../tests/behat/lesson_student_resume.feature | 32 ++----- .../tests/behat/lesson_user_override.feature | 16 +--- .../tests/behat/lesson_with_clusters.feature | 12 +-- .../behat/lesson_with_subcluster.feature | 14 ++- .../tests/behat/link_to_gradebook.feature | 40 +++------ .../tests/behat/password_protection.feature | 11 +-- .../tests/behat/questions_images.feature | 1 - .../tests/behat/teacher_grade_essays.feature | 33 ++----- mod/lesson/tests/behat/time_limit.feature | 24 +++--- .../tests/behat/wrong_answer_continue.feature | 22 ++--- 41 files changed, 248 insertions(+), 659 deletions(-) diff --git a/admin/tool/behat/tests/behat/get_and_set_fields.feature b/admin/tool/behat/tests/behat/get_and_set_fields.feature index 3fd8eaa3cf0..3306a753913 100644 --- a/admin/tool/behat/tests/behat/get_and_set_fields.feature +++ b/admin/tool/behat/tests/behat/get_and_set_fields.feature @@ -139,6 +139,9 @@ Feature: Verify that all form fields values can be get and set @javascript Scenario: with JS enabled all form fields getters and setters works as expected + Given the following "activities" exist: + | activity | course | name | + | lesson | C1 | Test lesson | Then I am on the "Course 1" "groups" page # Select (multi-select & AJAX) - Checking "I set the field" and "select box should contain". And I set the field "groups" to "Group 2" @@ -150,11 +153,8 @@ Feature: Verify that all form fields values can be get and set And the "members" select box should contain "Student 2 (s2@example.com)" And the "members" select box should not contain "Student 3 (s3@example.com)" # Checkbox (AJAX) - Checking "I set the field" and "I set the following fields to these values". - And I am on "Course 1" course homepage - And I add a "Lesson" to section "1" + And I am on the "Test lesson" "lesson activity editing" page And I set the following fields to these values: - | Name | Test lesson | - | Description | Test lesson description | | available[enabled] | 1 | And I set the field "deadline[enabled]" to "1" # Checkbox (AJAX) - Checking "the field matches value" before saving. diff --git a/grade/tests/behat/grade_to_pass.feature b/grade/tests/behat/grade_to_pass.feature index 18effa6a508..bc3d223ee9e 100644 --- a/grade/tests/behat/grade_to_pass.feature +++ b/grade/tests/behat/grade_to_pass.feature @@ -170,11 +170,10 @@ Feature: We can set the grade to pass value Scenario: Set a valid grade to pass for lesson activity Given the following "activities" exist: - | activity | name | intro | course | section | idnumber | - | lesson | Test Lesson 1 | Test | C1 | 1 | lesson1 | + | activity | name | course | idnumber | + | lesson | Test Lesson 1 | C1 | lesson1 | And I am on "Course 1" course homepage with editing mode on - And I am on the "Test Lesson 1" "lesson activity" page - And I navigate to "Settings" in current page administration + And I am on the "Test Lesson 1" "lesson activity editing" page And I set the following fields to these values: | Grade to pass | 90 | And I press "Save and return to course" @@ -184,21 +183,18 @@ Feature: We can set the grade to pass value Then the field "Grade to pass" matches value "90" And I set the field "Grade to pass" to "80" And I press "Save changes" - And I am on "Course 1" course homepage - And I am on the "Test Lesson 1" "lesson activity" page - And I follow "Settings" + And I am on the "Test Lesson 1" "lesson activity editing" page And the field "Grade to pass" matches value "80" Scenario: Set a valid grade to pass for lesson activity with custom decimal separator Given the following "activities" exist: - | activity | name | intro | course | section | idnumber | - | lesson | Test Lesson 1 | Test | C1 | 1 | lesson1 | + | activity | name | course | idnumber | + | lesson | Test Lesson 1 | C1 | lesson1 | And the following "language customisations" exist: | component | stringid | value | | core_langconfig | decsep | # | And I am on "Course 1" course homepage with editing mode on - And I am on the "Test Lesson 1" "lesson activity" page - And I navigate to "Settings" in current page administration + And I am on the "Test Lesson 1" "lesson activity editing" page And I set the following fields to these values: | Grade to pass | 90#50 | And I press "Save and return to course" @@ -208,9 +204,7 @@ Feature: We can set the grade to pass value Then the field "Grade to pass" matches value "90#50" And I set the field "Grade to pass" to "80" And I press "Save changes" - And I am on "Course 1" course homepage - And I am on the "Test Lesson 1" "lesson activity" page - And I follow "Settings" + And I am on the "Test Lesson 1" "lesson activity editing" page And the field "Grade to pass" matches value "80#00" Scenario: Set a valid grade to pass for database activity diff --git a/lib/form/tests/behat/graderescale_for_lesson_pointscale.feature b/lib/form/tests/behat/graderescale_for_lesson_pointscale.feature index 3ee479165b6..f000b747894 100644 --- a/lib/form/tests/behat/graderescale_for_lesson_pointscale.feature +++ b/lib/form/tests/behat/graderescale_for_lesson_pointscale.feature @@ -20,7 +20,6 @@ Feature: Using the lesson activities which support point scale | course | C1 | | activity | lesson | | name | Test lesson name | - | intro | Test forum description | | idnumber | lesson1 | @javascript @@ -37,11 +36,9 @@ Feature: Using the lesson activities which support point scale | id_enableotheranswers | 1 | | id_jumpto_6 | Next page | And I press "Save page" - And I log out 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" - And I log out And I am on the "Test lesson name" "lesson activity editing" page logged in as teacher1 And I expand all fieldsets Then the "Maximum grade" "field" should be disabled diff --git a/media/player/videojs/tests/behat/modules.feature b/media/player/videojs/tests/behat/modules.feature index 36c900f67b5..90da7466d20 100644 --- a/media/player/videojs/tests/behat/modules.feature +++ b/media/player/videojs/tests/behat/modules.feature @@ -34,10 +34,10 @@ Feature: Embed videos without the media filter @javascript Scenario: Add a video as content to a lesson. Make sure media filters work - When I add a "Lesson" to section "1" - And I set the following fields to these values: - | Name | Lesson with video | - | Description | Example of a video in a lesson | + Given the following "activities" exist: + | activity | course | section | name | + | lesson | Acceptance test site | 1 | Lesson with video | + When I am on the "Lesson with video" "lesson activity editing" page And I expand all fieldsets And I upload "media/player/videojs/tests/fixtures/test.mov" file to "Linked media" filemanager And I press "Save and display" diff --git a/mod/lesson/tests/behat/all_other_answers_catch.feature b/mod/lesson/tests/behat/all_other_answers_catch.feature index 4897ec5feaa..a4d1595613b 100644 --- a/mod/lesson/tests/behat/all_other_answers_catch.feature +++ b/mod/lesson/tests/behat/all_other_answers_catch.feature @@ -21,18 +21,12 @@ Feature: Numeric and short answer questions have a section to catch all other st | course | C1 | | idnumber | 0001 | | name | Test lesson name | - | intro | Test lesson description | - | section | 1 | | maxattempts | 3 | - And I log in as "teacher1" - And I am on "Course 1" course homepage - And I follow "Test lesson name" - When I navigate to "Settings" in current page administration + And I am on the "Test lesson name" "lesson activity editing" page logged in as teacher1 And I expand all fieldsets And I set the following fields to these values: | Provide option to try a question again | Yes | - And I press "Save and return to course" - And I follow "Test lesson name" + And I press "Save and display" Scenario: I can create a numerical question with an option to catch all student responses. Given I follow "Add a question page" @@ -53,10 +47,7 @@ Feature: Numeric and short answer questions have a section to catch all other st | id_answer_editor_0 | End this lesson | | id_jumpto_0 | End of lesson | And I press "Save page" - And I log out - And I log in as "student1" - And I am on "Course 1" course homepage - And I follow "Test lesson name" + 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" And I should see "That's the wrong answer" @@ -87,10 +78,7 @@ Feature: Numeric and short answer questions have a section to catch all other st | id_answer_editor_0 | End this lesson | | id_jumpto_0 | End of lesson | And I press "Save page" - And I log out - And I log in as "student1" - And I am on "Course 1" course homepage - And I follow "Test lesson name" + And I am on the "Test lesson name" "lesson activity" page logged in as student1 And I set the field "Your answer" to "dog" And I press "Submit" And I should see "That's the wrong answer" diff --git a/mod/lesson/tests/behat/completion_condition_end_reached.feature b/mod/lesson/tests/behat/completion_condition_end_reached.feature index 391ab6be394..8e03ff3cfca 100644 --- a/mod/lesson/tests/behat/completion_condition_end_reached.feature +++ b/mod/lesson/tests/behat/completion_condition_end_reached.feature @@ -21,22 +21,18 @@ Feature: Set end of lesson reached as a completion condition for a lesson | course | C1 | | idnumber | 0001 | | name | Test lesson | - | intro | Test lesson description | - | section | 1 | 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 follow "Test lesson" - And I navigate to "Settings" in current page administration + And I am on the "Test lesson" "lesson activity editing" page And I set the following fields to these values: | Completion tracking | Show activity as complete when conditions are met | | completionview | 0 | | completionendreached | 1 | - And I press "Save and return to course" - And I follow "Test lesson" + 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 | @@ -53,16 +49,13 @@ Feature: Set end of lesson reached as a completion condition for a lesson | id_answer_editor_1 | Next page | | id_jumpto_1 | Next page | And I press "Save page" - And I log out - When I log in as "student1" - And I am on "Course 1" course homepage + 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" And I press "Next page" And I am on "Course 1" course homepage And the "Go through the activity to the end" completion condition of "Test lesson" is displayed as "todo" - And I am on "Course 1" course homepage - And I follow "Test lesson" + And I am on the "Test lesson" "lesson activity" page 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 click on "No" "link" in the "#page-content" "css_element" @@ -70,7 +63,5 @@ Feature: Set end of lesson reached as a completion condition for a lesson And I press "Next page" And I am on "Course 1" course homepage And the "Go through the activity to the end" completion condition of "Test lesson" is displayed as "done" - And I log out - And I log in as "teacher1" - And I am on "Course 1" course homepage + And I am on the "Course 1" course page logged in as teacher1 And "Student 1" user has completed "Test lesson" activity diff --git a/mod/lesson/tests/behat/completion_condition_time_spent.feature b/mod/lesson/tests/behat/completion_condition_time_spent.feature index e3eabcf9ed8..54d50c61e6f 100644 --- a/mod/lesson/tests/behat/completion_condition_time_spent.feature +++ b/mod/lesson/tests/behat/completion_condition_time_spent.feature @@ -21,24 +21,19 @@ Feature: Set time spent as a completion condition for a lesson | course | C1 | | idnumber | 0001 | | name | Test lesson | - | intro | Test lesson description | - And I log in as "teacher1" - And I am on "Course 1" course homepage + 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 follow "Test lesson" - And I navigate to "Settings" in current page administration + And I am on the "Test lesson" "lesson activity editing" page And I set the following fields to these values: | Completion tracking | Show activity as complete when conditions are met | | completionview | 0 | | completiontimespentenabled | 1 | | completiontimespent[timeunit] | 1 | - | completiontimespent[number] | 10 | - And I press "Save and return to course" - And I am on "Course 1" course homepage - And I follow "Test lesson" + | 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 | @@ -55,28 +50,23 @@ Feature: Set time spent as a completion condition for a lesson | id_answer_editor_1 | Next page | | id_jumpto_1 | Next page | And I press "Save page" - And I log out - When I log in as "student1" - And I am on "Course 1" course homepage - Then the "Spend at least 10 secs on this activity" completion condition of "Test lesson" is displayed as "todo" + 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" And I press "Next page" # Add 1 sec delay so lesson knows a valid attempt has been made in past. And I wait "1" seconds And I press "Next page" And I should see "You completed this lesson in" - And I should see ", which is less than the required time of 10 secs. You might need to attempt the lesson again." + And I should see ", which is less than the required time of 5 secs. You might need to attempt the lesson again." And I am on "Course 1" course homepage - And the "Spend at least 10 secs on this activity" completion condition of "Test lesson" is displayed as "todo" - And I am on "Course 1" course homepage - And I follow "Test lesson" + And the "Spend at least 5 secs on this activity" completion condition of "Test lesson" is displayed as "todo" + And I am on the "Test lesson" "lesson activity" page And I press "Next page" - And I wait "11" seconds + And I wait "5" seconds And I press "Next page" And I should not see "You might need to attempt the lesson again." And I am on "Course 1" course homepage - And the "Spend at least 10 secs on this activity" completion condition of "Test lesson" is displayed as "done" - And I log out - And I log in as "teacher1" - And I am on "Course 1" course homepage + And the "Spend at least 5 secs on this activity" completion condition of "Test lesson" is displayed as "done" + And I am on the "Course 1" course page logged in as teacher1 And "Student 1" user has completed "Test lesson" activity diff --git a/mod/lesson/tests/behat/date_availability.feature b/mod/lesson/tests/behat/date_availability.feature index 88d3ed850dd..b9d6627a23c 100644 --- a/mod/lesson/tests/behat/date_availability.feature +++ b/mod/lesson/tests/behat/date_availability.feature @@ -16,16 +16,14 @@ Feature: A teacher can set available from and deadline dates to access a lesson | user | course | role | | teacher1 | C1 | editingteacher | | student1 | C1 | student | + 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 Scenario: Forbidding lesson accesses until a specified date - Given the following "activities" exist: - | activity | name | intro | course | section | idnumber | - | lesson | Test lesson | Test lesson description | C1 | 1 | lesson1 | - And I am on "Course 1" course homepage - And I follow "Test lesson" - And I navigate to "Settings" in current page administration + Given I am on the "Test lesson" "lesson activity editing" page And I set the field "id_available_enabled" to "1" And I set the following fields to these values: | available[day] | 1 | @@ -33,28 +31,19 @@ Feature: A teacher can set available from and deadline dates to access a lesson | available[year] | 2030 | | available[hour] | 08 | | available[minute] | 00 | - And I press "Save and return to course" - And I follow "Test lesson" + 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" - And I log out - And I log in as "student1" - And I am on "Course 1" course homepage - When I follow "Test lesson" + 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 the following "activities" exist: - | activity | name | intro | course | section | idnumber | - | lesson | Test lesson | Test lesson description | C1 | 1 | lesson1 | - And I am on "Course 1" course homepage - And I follow "Test lesson" - And I navigate to "Settings" in current page administration + Given I am on the "Test lesson" "lesson activity editing" page And I set the field "id_deadline_enabled" to "1" And I set the following fields to these values: | deadline[day] | 1 | @@ -62,17 +51,13 @@ Feature: A teacher can set available from and deadline dates to access a lesson | deadline[year] | 2000 | | deadline[hour] | 08 | | deadline[minute] | 00 | - And I press "Save and return to course" - And I follow "Test lesson" + 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" - And I log out - And I log in as "student1" - And I am on "Course 1" course homepage - When I follow "Test lesson" + 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 d57af44bc1b..10b4254c3be 100644 --- a/mod/lesson/tests/behat/display_lesson_description.feature +++ b/mod/lesson/tests/behat/display_lesson_description.feature @@ -20,7 +20,6 @@ Feature: Display the lesson description in the lesson and optionally in the cour | idnumber | 0001 | | name | Test lesson name | | intro | Test lesson description | - | section | 1 | 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: @@ -28,17 +27,13 @@ Feature: Display the lesson description in the lesson and optionally in the cour | Description | Lesson part 1 description | | Jump | Next page | And I click on "Save page" "button" - And I log in as "teacher1" Scenario: Description is displayed in the Lesson - Given I am on "Course 1" course homepage - When I follow "Test lesson" + When I am on the "Test lesson name" "lesson activity" page Then I should see "Test lesson description" Scenario: Show lesson description in the course homepage - Given I am on "Course 1" course homepage - And I follow "Test lesson" - And I navigate to "Settings" in current page administration + Given I am on the "Test lesson name" "lesson activity editing" page And the following fields match these values: | Display description on course page | | And I set the following fields to these values: @@ -48,9 +43,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 "Course 1" course homepage - And I follow "Test lesson" - And I navigate to "Settings" in current page administration + Given I am on the "Test lesson name" "lesson activity editing" page 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 fb53a4e9abc..e1d594b3687 100644 --- a/mod/lesson/tests/behat/lesson_activity_completion.feature +++ b/mod/lesson/tests/behat/lesson_activity_completion.feature @@ -44,7 +44,6 @@ Feature: View activity completion in the lesson activity | Jump | End of lesson | | Score | 1 | And I press "Save page" - And I log out Scenario: View automatic completion items as a teacher When I am on the "Music history" "lesson activity" page logged in as teacher1 @@ -82,7 +81,6 @@ Feature: View activity completion in the lesson activity And I press "Save and display" # Teacher view. And the manual completion button for "Music history" should be disabled - And I log out # Student view. When I am on the "Music history" "lesson activity" page logged in as student1 Then the manual completion button of "Music history" is displayed as "Mark as done" diff --git a/mod/lesson/tests/behat/lesson_complete_report.feature b/mod/lesson/tests/behat/lesson_complete_report.feature index 052015f2737..76d1a37b9a6 100644 --- a/mod/lesson/tests/behat/lesson_complete_report.feature +++ b/mod/lesson/tests/behat/lesson_complete_report.feature @@ -16,11 +16,9 @@ Feature: Teachers can review student progress on all lessons in a course by view | teacher1 | C1 | editingteacher | | student1 | C1 | student | And the following "activities" exist: - | activity | name | intro | course | idnumber | retake | - | lesson | Test lesson name | Test lesson description | C1 | lesson1 | 1 | - And I log in as "teacher1" - And I am on "Course 1" course homepage - And I follow "Test lesson name" + | 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" @@ -80,14 +78,10 @@ Feature: Teachers can review student progress on all lessons in a course by view | id_jumpto_1 | Next page | And I press "Save page" And I log out - When I log in as "student1" - And I am on "Course 1" course homepage - And I follow "Test lesson name" + 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" - And I log out - Then I log in as "teacher1" - And I am on "Course 1" course homepage + Then I am on the "Course 1" course page logged in as teacher1 And I navigate to course participants And I follow "Student 1" And I follow "Complete report" @@ -138,10 +132,7 @@ Feature: Teachers can review student progress on all lessons in a course by view | id_answer_editor_1 | Next page | | id_jumpto_1 | Next page | And I press "Save page" - And I log out - When I log in as "student1" - And I am on "Course 1" course homepage - And I follow "Test lesson name" + 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" And I should see "Second page contents" @@ -157,9 +148,7 @@ Feature: Teachers can review student progress on all lessons in a course by view And I press "Submit" And I press "Continue" And I should see "Congratulations - end of lesson reached" - And I log out - Then I log in as "teacher1" - And I am on "Course 1" course homepage + Then I am on the "Course 1" course page logged in as teacher1 And I navigate to course participants And I follow "Student 1" And I follow "Complete report" @@ -185,17 +174,12 @@ Feature: Teachers can review student progress on all lessons in a course by view | id_answer_editor_1 | End of lesson | | id_jumpto_1 | End of lesson | And I press "Save page" - And I log out - When I log in as "student1" - And I am on "Course 1" course homepage - And I follow "Test lesson name" + 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" And I should see "Second page contents" And I press "End of lesson" - And I log out - Then I log in as "teacher1" - And I am on "Course 1" course homepage + Then I am on the "Course 1" course page logged in as teacher1 And I navigate to course participants And I follow "Student 1" And I follow "Complete report" diff --git a/mod/lesson/tests/behat/lesson_completion_pass_grade.feature b/mod/lesson/tests/behat/lesson_completion_pass_grade.feature index 9065df3d09b..b631bfa3a9d 100644 --- a/mod/lesson/tests/behat/lesson_completion_pass_grade.feature +++ b/mod/lesson/tests/behat/lesson_completion_pass_grade.feature @@ -17,8 +17,7 @@ Feature: Pass grade activity completion in the lesson activity | student2 | C1 | student | | student3 | C1 | student | | teacher1 | C1 | editingteacher | - And I log in as "teacher1" - And I am on "Course 1" course homepage + 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: @@ -30,13 +29,11 @@ Feature: Pass grade activity completion in the lesson activity | course | C1 | | idnumber | mh1 | | name | Music history | - | section | 1 | | gradepass | 50 | | completion | 2 | | completionusegrade | 1 | | completionpassgrade | 1 | - And I am on "Course 1" course homepage - And I follow "Music history" + 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" @@ -48,12 +45,9 @@ Feature: Pass grade activity completion in the lesson activity | id_enableotheranswers | 1 | | id_jumpto_6 | Next page | And I press "Save page" - And I log out Scenario: View automatic completion items as a teacher - Given I log in as "teacher1" - And I am on "Course 1" course homepage - When I follow "Music history" + When I am on the "Music history" "lesson activity" page logged in as teacher1 And "Music history" should have the "Receive a grade" completion condition And "Music history" should have the "Receive a passing grade" completion condition @@ -61,21 +55,17 @@ Feature: Pass grade activity completion in the lesson activity Given I am on the "Music history" "lesson activity" page logged in as student1 And the "Receive a grade" completion condition of "Music history" is displayed as "todo" And the "Receive a passing grade" completion condition of "Music history" is displayed as "todo" - When I am on "Course 1" course homepage - And I follow "Music history" + When I am on the "Music history" "lesson activity" page And I set the field "Your answer" to "3" And I press "Submit" And the "Receive a grade" completion condition of "Music history" is displayed as "done" And the "Receive a passing grade" completion condition of "Music history" is displayed as "done" - And I log out And I am on the "Music history" "lesson activity" page logged in as student2 And I set the field "Your answer" to "0" And I press "Submit" And the "Receive a grade" completion condition of "Music history" is displayed as "done" And the "Receive a passing grade" completion condition of "Music history" is displayed as "failed" - And I log out - And I log in as "teacher1" - And I am on "Course 1" course homepage + And I am on the "Course 1" course page logged in as teacher1 And "Vinnie Student1" user has completed "Music history" activity And "Vinnie Student2" user has completed "Music history" activity And "Vinnie Student3" user has not completed "Music history" activity diff --git a/mod/lesson/tests/behat/lesson_course_reset.feature b/mod/lesson/tests/behat/lesson_course_reset.feature index ba622f731eb..5b647e54fb3 100644 --- a/mod/lesson/tests/behat/lesson_course_reset.feature +++ b/mod/lesson/tests/behat/lesson_course_reset.feature @@ -23,8 +23,8 @@ Feature: Lesson reset | Group 1 | C1 | G1 | | Group 2 | C1 | G2 | And the following "activities" exist: - | activity | name | intro | course | idnumber | - | lesson | Test lesson name | Test lesson description | C1 | lesson1 | + | 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" @@ -41,15 +41,13 @@ Feature: Lesson reset And I press "Save page" Scenario: Use course reset to clear all attempt data - When I log out - 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 | And I press "Submit" And I press "Continue" And I should see "Congratulations - end of lesson reached" - And I log out And I am on the "Test lesson name" "lesson activity" page logged in as teacher1 And I navigate to "Reports" in current page administration And I should see "Sam1 Student1" diff --git a/mod/lesson/tests/behat/lesson_delete_answers.feature b/mod/lesson/tests/behat/lesson_delete_answers.feature index 2bf44c979b2..571d4fca3cc 100644 --- a/mod/lesson/tests/behat/lesson_delete_answers.feature +++ b/mod/lesson/tests/behat/lesson_delete_answers.feature @@ -18,11 +18,9 @@ branch table contents | teacher1 | C1 | editingteacher | | student1 | C1 | student | And the following "activities" exist: - | activity | name | intro | course | idnumber | - | lesson | Test lesson name | Test lesson description | C1 | lesson1 | - And I log in as "teacher1" - And I am on "Course 1" course homepage - And I follow "Test lesson name" + | 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 content page" And I set the following fields to these values: | Page title | First page name | @@ -55,11 +53,8 @@ branch table contents | id_answer_editor_1 | | And I press "Save page" And I should not see "Previous page" - And I log out - And I log in as "student1" - And I am on "Course 1" course homepage - And I follow "Test lesson name" - And I should see "First page contents" + And I am on the "Test lesson name" "lesson activity" page logged in as student1 + Then I should see "First page contents" And I should not see "Previous page" And I press "Next page" And I should see "1 + 1?" @@ -78,11 +73,8 @@ branch table contents | id_answer_editor_1 | | And I press "Save page" And I should not see "Incorrect answer" - And I log out - And I log in as "student1" - And I am on "Course 1" course homepage - And I follow "Test lesson name" - And I should see "First page contents" + And 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" And I should see "1 + 1?" And I set the following fields to these values: diff --git a/mod/lesson/tests/behat/lesson_edit_cluster.feature b/mod/lesson/tests/behat/lesson_edit_cluster.feature index 14f8598488a..49c55542d0f 100644 --- a/mod/lesson/tests/behat/lesson_edit_cluster.feature +++ b/mod/lesson/tests/behat/lesson_edit_cluster.feature @@ -17,11 +17,9 @@ Feature: In a lesson activity, teacher can edit a cluster page | teacher1 | C1 | editingteacher | | student1 | C1 | student | And the following "activities" exist: - | activity | name | intro | course | idnumber | section | - | lesson | Lesson with cluster | Test lesson description | C1 | lesson1 | 1 | - And I log in as "teacher1" - And I am on "Course 1" course homepage with editing mode on - And I follow "Lesson with cluster" + | activity | name | course | idnumber | + | lesson | Lesson with cluster | C1 | lesson1 | + And I am on the "Lesson with cluster" "lesson activity" page logged in as teacher1 And I follow "Add a content page" And I set the following fields to these values: | Page title | First page name | @@ -87,10 +85,7 @@ Feature: In a lesson activity, teacher can edit a cluster page | id_jumpto_0 | Second page name | And I press "Save page" And I should see "Modified end" - And I log out - And I log in as "student1" - And I am on "Course 1" course homepage - And I follow "Lesson with cluster" + And I am on the "Lesson with cluster" "lesson activity" page logged in as student1 And I should see "First page contents" And I press "Next page" And I should see "Question from cluster" diff --git a/mod/lesson/tests/behat/lesson_edit_pages.feature b/mod/lesson/tests/behat/lesson_edit_pages.feature index c0b2582ddcf..26a957c4ba8 100644 --- a/mod/lesson/tests/behat/lesson_edit_pages.feature +++ b/mod/lesson/tests/behat/lesson_edit_pages.feature @@ -17,11 +17,9 @@ Feature: In a lesson activity, teacher can edit lesson's pages | teacher1 | C1 | editingteacher | | student1 | C1 | student | And the following "activities" exist: - | activity | name | intro | course | idnumber | section | - | lesson | Test lesson name | Test lesson description | C1 | lesson1 | 1 | - And I log in as "teacher1" - And I am on "Course 1" course homepage - And I follow "Test lesson name" + | 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 content page" And I set the following fields to these values: | Page title | First page name | @@ -67,10 +65,7 @@ Feature: In a lesson activity, teacher can edit lesson's pages And I press "Save page" Then I should see "Modified second page" And I should not see "Second page name" - And I log out - And I log in as "student1" - And I am on "Course 1" course homepage - And I follow "Test lesson name" + And I am on the "Test lesson name" "lesson activity" page logged in as student1 And I should see "First page contents" And I press "Next page" And I should see "Modified contents" @@ -106,10 +101,7 @@ Feature: In a lesson activity, teacher can edit lesson's pages And I press "Save page" Then I should see "New hardest question" And I should not see "Hardest question ever" - And I log out - And I log in as "student1" - And I am on "Course 1" course homepage - And I follow "Test lesson name" + And I am on the "Test lesson name" "lesson activity" page logged in as student1 And I should see "First page contents" And I press "Next page" And I should see "Second page contents" diff --git a/mod/lesson/tests/behat/lesson_essay_question.feature b/mod/lesson/tests/behat/lesson_essay_question.feature index ae745bde134..3175432d23f 100644 --- a/mod/lesson/tests/behat/lesson_essay_question.feature +++ b/mod/lesson/tests/behat/lesson_essay_question.feature @@ -16,11 +16,9 @@ Feature: In a lesson activity, teacher can add an essay question | teacher1 | C1 | editingteacher | | student1 | C1 | student | And the following "activities" exist: - | activity | name | intro | course | idnumber | section | feedback | - | lesson | Test lesson name | Test lesson description | C1 | lesson1 | 1 | 1 | - And I log in as "teacher1" - And I am on "Course 1" course homepage with editing mode on - And I follow "Test lesson name" + | 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" @@ -28,10 +26,7 @@ Feature: In a lesson activity, teacher can add an essay question | Page title | Essay question | | Page contents |

Please write a story about a frog.

| And I press "Save page" - And I log out - And I log in as "student1" - And I am on "Course 1" course homepage - When I follow "Test lesson name" + 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." And I press "Submit" @@ -43,10 +38,7 @@ Feature: In a lesson activity, teacher can add an essay question And I should see "You earned 0 out of 0 for the automatically graded questions." And I should see "Your 1 essay question(s) will be graded and added into your final score at a later date." And I should see "Your current grade without the essay question(s) is 0 out of 1." - And I log out - And I log in as "teacher1" - And I am on "Course 1" course homepage - And I follow "Test lesson name" + And I am on the "Test lesson name" "lesson activity" page logged in as teacher1 And I grade lesson essays And I should see "Student 1" And I should see "Essay question" diff --git a/mod/lesson/tests/behat/lesson_exit_enter_clusters.feature b/mod/lesson/tests/behat/lesson_exit_enter_clusters.feature index 98179496ea3..761e3963d75 100644 --- a/mod/lesson/tests/behat/lesson_exit_enter_clusters.feature +++ b/mod/lesson/tests/behat/lesson_exit_enter_clusters.feature @@ -16,11 +16,9 @@ Feature: In a lesson activity, students can exit and re-enter the activity when | teacher1 | C1 | editingteacher | | student1 | C1 | student | And the following "activities" exist: - | activity | name | intro | course | idnumber | - | lesson | Lesson with cluster | Cluster lesson description | C1 | lesson1 | - And I log in as "teacher1" - And I am on "Course 1" course homepage with editing mode on - And I follow "Lesson with cluster" + | activity | name | course | idnumber | + | lesson | Lesson with cluster | C1 | lesson1 | + And I am on the "Lesson with cluster" "lesson activity" page logged in as teacher1 And I follow "Add a content page" And I set the following fields to these values: | Page title | First page name | @@ -185,12 +183,9 @@ Feature: In a lesson activity, students can exit and re-enter the activity when | id_score_1 | 0 | And I press "Save page" And I click on "Add an end of cluster" "link" in the "//div[contains(concat(' ', normalize-space(@class), ' '), ' addlinks ')][16]" "xpath_element" - And I log out Scenario: Accessing as student to a cluster only lesson - Given I log in as "student1" - And I am on "Course 1" course homepage - And I follow "Lesson with cluster" + Given I am on the "Lesson with cluster" "lesson activity" page logged in as student1 And I should see "First page contents" And I press "Next page" And I should see "Correct answer" diff --git a/mod/lesson/tests/behat/lesson_group_override.feature b/mod/lesson/tests/behat/lesson_group_override.feature index ed26e068a80..8b574db9ae4 100644 --- a/mod/lesson/tests/behat/lesson_group_override.feature +++ b/mod/lesson/tests/behat/lesson_group_override.feature @@ -30,8 +30,8 @@ Feature: Lesson group override | student2 | G2 | | student3 | G1 | And the following "activities" exist: - | activity | name | intro | groupmode | course | idnumber | - | lesson | Test lesson name | Test lesson description | 1 | C1 | lesson1 | + | 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" @@ -46,7 +46,6 @@ Feature: Lesson group override | id_response_editor_1 | Wrong | | id_jumpto_1 | This page | And I press "Save page" - And I log out Scenario: Add, modify then delete a group override Given I am on the "Test lesson name" "lesson activity" page logged in as teacher1 @@ -108,7 +107,6 @@ Feature: Lesson group override | Re-takes allowed | 1 | And I press "Save" And I should see "Re-takes allowed" - And I log out Given 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: @@ -119,7 +117,6 @@ Feature: Lesson group override And I am on the "Test lesson name" "lesson activity" page Then I should not see "You are not allowed to retake this lesson." And I should see "Cat is an amphibian" - And I log out Given I am on the "Test lesson name" "lesson activity" page logged in as student2 And I should see "Cat is an amphibian" And I set the following fields to these values: @@ -144,7 +141,6 @@ Feature: Lesson group override | Password protected lesson | 12345 | And I press "Save" And I should see "Password protected lesson" - And I log out And I am on the "Test lesson name" "lesson activity" page logged in as student1 Then I should see "Test lesson name is a password protected lesson" And I should not see "Cat is an amphibian" @@ -160,7 +156,6 @@ Feature: Lesson group override And I press "Submit" And I press "Continue" And I should see "Congratulations - end of lesson reached" - And I log out And I am on the "Test lesson name" "lesson activity" page logged in as student2 And I should see "Test lesson name is a password protected lesson" And I should not see "Cat is an amphibian" @@ -194,11 +189,9 @@ Feature: Lesson group override | deadline[minute] | 00 | And I press "Save" And I should see "Lesson closes" - And I log out And I am on the "Test lesson name" "lesson activity" page logged in as student2 Then the activity date in "Test lesson name" should contain "Closed: Saturday, 1 January 2000, 8:00" And I should not see "Cat is an amphibian" - And I log out And I am on the "Test lesson name" "lesson activity" page logged in as student1 And I should see "Cat is an amphibian" @@ -225,11 +218,9 @@ Feature: Lesson group override | available[minute] | 00 | And I press "Save" And I should see "Lesson opens" - And I log out And I am on the "Test lesson name" "lesson activity" page logged in as student2 Then the activity date in "Test lesson name" should contain "Opens: Tuesday, 1 January 2030, 8:00" And I should not see "Cat is an amphibian" - And I log out And I am on the "Test lesson name" "lesson activity" page logged in as student1 And I should see "Cat is an amphibian" @@ -246,7 +237,6 @@ Feature: Lesson group override | Maximum number of attempts per question | 2 | And I press "Save" And I should see "Maximum number of attempts per question" - And I log out And I am on the "Test lesson name" "lesson activity" page logged in as student1 And I should see "Cat is an amphibian" And I set the following fields to these values: @@ -259,7 +249,6 @@ Feature: Lesson group override And I press "Submit" And I press "Continue" And I should see "Congratulations - end of lesson reached" - And I log out And I am on the "Test lesson name" "lesson activity" page logged in as student2 And I should see "Cat is an amphibian" And I set the following fields to these values: @@ -306,13 +295,10 @@ Feature: Lesson group override | available[minute] | 00 | And I press "Save" And I should see "Wednesday, 1 January 2031, 8:00" - And I log out And I am on the "Test lesson name" "lesson activity" page logged in as student1 And the activity date in "Test lesson name" should contain "Opens: Wednesday, 1 January 2031, 8:00" - And I log out And I am on the "Test lesson name" "lesson activity" page logged in as student2 And the activity date in "Test lesson name" should contain "Opens: Sunday, 1 January 2040, 8:00" - And I log out And I am on the "Test lesson name" "lesson activity" page logged in as student3 And the activity date in "Test lesson name" should contain "Opens: Tuesday, 1 January 2030, 8:00" @@ -321,8 +307,8 @@ Feature: Lesson group override | capability | permission | role | contextlevel | reference | | moodle/site:accessallgroups | Prevent | editingteacher | Course | C1 | And the following "activities" exist: - | activity | name | intro | course | idnumber | groupmode | - | lesson | Lesson 2 | Lesson 2 description | C1 | lesson2 | 1 | + | activity | name | course | idnumber | groupmode | + | lesson | Lesson 2 | C1 | lesson2 | 1 | When I am on the "Lesson 2" "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 @@ -334,8 +320,8 @@ Feature: Lesson group override | capability | permission | role | contextlevel | reference | | moodle/site:accessallgroups | Prevent | editingteacher | Course | C1 | And the following "activities" exist: - | activity | name | intro | course | idnumber | groupmode | - | lesson | Lesson 2 | Lesson 2 description | C1 | lesson2 | 1 | + | activity | name | course | idnumber | groupmode | + | lesson | Lesson 2 | C1 | lesson2 | 1 | And the following "group members" exist: | user | group | | teacher1 | G1 | @@ -351,8 +337,8 @@ Feature: Lesson group override | capability | permission | role | contextlevel | reference | | moodle/site:accessallgroups | Prevent | editingteacher | Course | C1 | And the following "activities" exist: - | activity | name | intro | course | idnumber | groupmode | - | lesson | Lesson 2 | Lesson 2 description | C1 | lesson2 | 1 | + | activity | name | course | idnumber | groupmode | + | lesson | Lesson 2 | C1 | lesson2 | 1 | And the following "group members" exist: | user | group | | teacher1 | G1 | @@ -378,7 +364,6 @@ Feature: Lesson group override | available[hour] | 08 | | available[minute] | 00 | And I press "Save" - And I log out When I am on the "Lesson 2" "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 diff --git a/mod/lesson/tests/behat/lesson_informations_at_end.feature b/mod/lesson/tests/behat/lesson_informations_at_end.feature index 5856e5fd22b..22c499f2ac1 100644 --- a/mod/lesson/tests/behat/lesson_informations_at_end.feature +++ b/mod/lesson/tests/behat/lesson_informations_at_end.feature @@ -18,15 +18,13 @@ Feature: In a lesson activity, if custom scoring is not enabled, student should | teacher1 | C1 | editingteacher | | student1 | C1 | student | And the following "activities" exist: - | activity | name | intro | course | section | idnumber | - | lesson | Test lesson name | Test lesson description | C1 | 1 | lesson1 | - And I log in as "teacher1" - And I am on the "Test lesson name" "lesson activity editing" page + | activity | name | course | idnumber | + | lesson | Test lesson name | C1 | lesson1 | + 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 return to course" - And I follow "Test lesson name" + 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 | @@ -59,8 +57,7 @@ Feature: In a lesson activity, if custom scoring is not enabled, student should And I log in as "student1" Scenario: Informations at end of lesson if custom scoring not enabled - Given I am on "Course 1" course homepage - And I follow "Test lesson name" + Given I am on the "Test lesson name" "lesson activity" page And I should see "First page contents" When I press "Next page" And I should see "1 + 1?" @@ -79,8 +76,7 @@ Feature: In a lesson activity, if custom scoring is not enabled, student should Given the following "language customisations" exist: | component | stringid | value | | core_langconfig | decsep | # | - And I am on "Course 1" course homepage - And I follow "Test lesson name" + And I am on the "Test lesson name" "lesson activity" page And I should see "First page contents" When I press "Next page" And I should see "1 + 1?" @@ -96,8 +92,7 @@ Feature: In a lesson activity, if custom scoring is not enabled, student should And I should see "Your current grade is 0#0 out of 75" Scenario: Current grade is displayed at end of lesson when grade type is set to scale - Given I am on "Course 1" course homepage - And I follow "Test lesson name 2" + Given I am on the "Test lesson name 2" "lesson activity" page When I press "Next page" And I should see "1 + 1?" And I set the following fields to these values: diff --git a/mod/lesson/tests/behat/lesson_navigation.feature b/mod/lesson/tests/behat/lesson_navigation.feature index 7de0b715166..0f197c55ebf 100644 --- a/mod/lesson/tests/behat/lesson_navigation.feature +++ b/mod/lesson/tests/behat/lesson_navigation.feature @@ -16,14 +16,13 @@ Feature: In a lesson activity, students can navigate through a series of pages i | user | course | role | | teacher1 | C1 | editingteacher | | student1 | C1 | student | + 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 the following "activities" exist: - | activity | name | intro | course | idnumber | - | lesson | Test lesson name | Test lesson description | C1 | lesson1 | - And I am on "Course 1" course homepage - And I follow "Test lesson name" + 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 | @@ -56,10 +55,7 @@ Feature: In a lesson activity, students can navigate through a series of pages i | id_jumpto_1 | Second page name | | id_score_1 | 0 | And I press "Save page" - And I log out - And I log in as "student1" - And I am on "Course 1" course homepage - When I follow "Test lesson name" + 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" And I should see "Second page contents" @@ -88,17 +84,11 @@ 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 the following "activities" exist: - | activity | name | intro | course | idnumber | - | lesson | Test lesson name | Test lesson description | C1 | lesson1 | - And I am on "Course 1" course homepage - And I follow "Test lesson name" - And I navigate to "Settings" in current page administration + Given I am on the "Test lesson name" "lesson activity editing" page And I set the following fields to these values: | id_review | Yes | | id_maxattempts | 3 | - And I press "Save and return to course" - And I follow "Test lesson name" + 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 | @@ -109,10 +99,7 @@ Feature: In a lesson activity, students can navigate through a series of pages i | id_answer_editor_0 | right | | id_answer_editor_1 | wrong | And I press "Save page" - And I log out - And I log in as "student1" - And I am on "Course 1" course homepage - When I follow "Test lesson name" + 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: | wrong | 1 | @@ -134,16 +121,11 @@ 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 the following "activities" exist: - | activity | name | intro | course | idnumber | - | lesson | Test lesson name | Test lesson description | C1 | lesson1 | - And I am on the "Test lesson name" "lesson activity" page - And I navigate to "Settings" in current page administration + Given I am on the "Test lesson name" "lesson activity editing" page And I set the following fields to these values: | id_review | Yes | | id_maxattempts | 3 | - And I press "Save and return to course" - And I follow "Test lesson name" + 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 | @@ -165,7 +147,6 @@ Feature: In a lesson activity, students can navigate through a series of pages i | id_answer_editor_1 | wrong | | id_jumpto_1 | Test question | And I press "Save page" - And I log out 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: @@ -192,17 +173,11 @@ 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 the following "activities" exist: - | activity | name | intro | course | idnumber | - | lesson | Test lesson name | Test lesson description | C1 | lesson1 | - And I am on "Course 1" course homepage - And I follow "Test lesson name" - And I navigate to "Settings" in current page administration + Given I am on the "Test lesson name" "lesson activity editing" page And I set the following fields to these values: | id_review | Yes | | id_maxattempts | 0 | - And I press "Save and return to course" - And I follow "Test lesson name" + 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 | @@ -213,10 +188,7 @@ Feature: In a lesson activity, students can navigate through a series of pages i | id_answer_editor_0 | right | | id_answer_editor_1 | wrong | And I press "Save page" - And I log out - And I log in as "student1" - And I am on "Course 1" course homepage - When I follow "Test lesson name" + 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: | wrong | 1 | diff --git a/mod/lesson/tests/behat/lesson_no_calendar_capabilities.feature b/mod/lesson/tests/behat/lesson_no_calendar_capabilities.feature index 0ca2bc91b93..ce44986079e 100644 --- a/mod/lesson/tests/behat/lesson_no_calendar_capabilities.feature +++ b/mod/lesson/tests/behat/lesson_no_calendar_capabilities.feature @@ -19,20 +19,14 @@ Feature: Lesson with no calendar capabilites | course | C1 | | idnumber | 0001 | | name | Test lesson name | - | intro | Test lesson description | - | section | 1 | And I log in as "admin" And I am on the "Course 1" "permissions" page And I override the system permissions of "Teacher" role with: | capability | permission | | moodle/calendar:manageentries | Prohibit | - And I log out Scenario: Editing a lesson - Given I log in as "admin" - And I am on "Course 1" course homepage with editing mode on - And I follow "Test lesson name" - And I navigate to "Settings" in current page administration + Given I am on the "Test lesson name" "lesson activity editing" page logged in as admin And I set the following fields to these values: | id_available_enabled | 1 | | id_available_day | 1 | @@ -43,11 +37,7 @@ Feature: Lesson with no calendar capabilites | id_deadline_month | 2 | | id_deadline_year | 2017 | And I press "Save and return to course" - And I log out - When I log in as "teacher1" - And I am on "Course 1" course homepage with editing mode on - And I follow "Test lesson name" - And I navigate to "Settings" in current page administration + When 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_available_year | 2018 | | id_deadline_year | 2018 | 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 f39a0dd8edc..310052d1d0a 100644 --- a/mod/lesson/tests/behat/lesson_number_of_student_attempts.feature +++ b/mod/lesson/tests/behat/lesson_number_of_student_attempts.feature @@ -26,12 +26,8 @@ Feature: In Dashboard, teacher can see the number of student attempts to lessons | course | C1 | | idnumber | 0001 | | name | Test lesson name | - | intro | Test lesson description | | retake | 1 | - | section | 1 | - And I am on "Course 1" course homepage - And I follow "Test lesson name" - When I navigate to "Settings" in current page administration + When 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 | @@ -40,8 +36,7 @@ Feature: In Dashboard, teacher can see the number of student attempts to lessons | deadline[year] | 2030 | | deadline[hour] | 08 | | deadline[minute] | 00 | - And I press "Save and return to course" - And I follow "Test lesson name" + 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" @@ -82,10 +77,7 @@ Feature: In Dashboard, teacher can see the number of student attempts to lessons | id_response_editor_1 | Wrong | | id_jumpto_1 | This page | And I press "Save page" - And I log out - And I log in as "student1" - And I am on "Course 1" course homepage - And I follow "Test lesson name" + And I am on the "Test lesson name" "lesson activity" page logged in as student1 And I should see "Cat is an amphibian" And I set the following fields to these values: | False | 1 | @@ -123,9 +115,7 @@ Feature: In Dashboard, teacher can see the number of student attempts to lessons And I should see "Congratulations - end of lesson reached" And I should see "Your score is 3 (out of 3)." And I log out - And I log in as "student2" - And I am on "Course 1" course homepage - And I follow "Test lesson name" + And I am on the "Test lesson name" "lesson activity" page logged in as student2 And I should see "Cat is an amphibian" And I set the following fields to these values: | True | 1 | @@ -143,4 +133,3 @@ Feature: In Dashboard, teacher can see the number of student attempts to lessons And I press "Continue" And I should see "Congratulations - end of lesson reached" And I should see "Your score is 2 (out of 3)." - And I log out 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 384ff8ff2bb..aa18fc5b38f 100644 --- a/mod/lesson/tests/behat/lesson_numerical_question_with_locale.feature +++ b/mod/lesson/tests/behat/lesson_numerical_question_with_locale.feature @@ -17,11 +17,9 @@ Feature: In a lesson activity, I need to edit pages in the lesson taking into ac | component | stringid | value | | core_langconfig | decsep | # | And the following "activities" exist: - | activity | name | intro | course | idnumber | section | modattempts | - | lesson | Test lesson name | Test lesson description | C1 | lesson1 | 1 | 1 | - And I log in as "teacher1" - And I am on "Course 1" course homepage - And I follow "Test lesson name" + | 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 I set the field "Select a question type" to "Numerical" And I press "Add a question page" @@ -37,32 +35,23 @@ Feature: In a lesson activity, I need to edit pages in the lesson taking into ac | id_jumpto_1 | This page | | id_score_1 | 0 | And I press "Save page" - And I log out Scenario: Edit a numerical question with the locale specific variables - Given I log in as "teacher1" - And I am on "Course 1" course homepage with editing mode on - And I follow "Test lesson name" + Given I am on the "Test lesson name" "lesson activity" page logged in as teacher1 And I edit the lesson And I follow "Hardest question ever" Then I should see "2#87" And I should see "2#1:2#8" - And I log out Scenario: View the detailed page of lesson - Given I log in as "teacher1" - And I am on "Course 1" course homepage with editing mode on - And I follow "Test lesson name" + Given I am on the "Test lesson name" "lesson activity" page logged in as teacher1 And I edit the lesson And I select edit type "Expanded" Then I should see "2#87" And I should see "2#1:2#8" - And I log out Scenario: Attempt the lesson successfully as a student - Given I log in as "student1" - And I am on "Course 1" course homepage - And I follow "Test lesson name" + Given I am on the "Test lesson name" "lesson activity" page logged in as student1 And I should see "1 + 1?" And I set the following fields to these values: | Your answer | 2#87 | @@ -72,12 +61,9 @@ Feature: In a lesson activity, I need to edit pages in the lesson taking into ac And I press "Continue" And I should see "Congratulations - end of lesson reached" And I should see "Your score is 1 (out of 1)." - And I log out Scenario: Attempt the lesson unsuccessfully as a student - Given I log in as "student1" - And I am on "Course 1" course homepage - And I follow "Test lesson name" + Given I am on the "Test lesson name" "lesson activity" page logged in as student1 And I should see "1 + 1?" And I set the following fields to these values: | Your answer | 2#7 | @@ -87,12 +73,9 @@ Feature: In a lesson activity, I need to edit pages in the lesson taking into ac And I press "Continue" And I should see "Congratulations - end of lesson reached" And I should see "Your score is 0 (out of 1)." - And I log out Scenario: Attempt the lesson successfully as a student and review - Given I log in as "student1" - And I am on "Course 1" course homepage - And I follow "Test lesson name" + Given I am on the "Test lesson name" "lesson activity" page logged in as student1 And I should see "1 + 1?" And I set the following fields to these values: | Your answer | 2#87 | @@ -106,23 +89,18 @@ Feature: In a lesson activity, I need to edit pages in the lesson taking into ac Then I should see "1 + 1?" And the following fields match these values: | Your answer | 2#87 | - And I log out Scenario: Edit lesson question page with updated locale setting and wrong answer Given I log in as "teacher1" And the following "language customisations" exist: | component | stringid | value | | core_langconfig | decsep | , | - And I am on "Course 1" course homepage with editing mode on - And I follow "Test lesson name" - Then I edit the lesson + When I am on the "Test lesson name" "lesson activity" page + And I edit the lesson And I follow "Hardest question ever" Then I should see "2,87" And I should see "2,1:2,8" - And I log out - And I log in as "student1" - And I am on "Course 1" course homepage - And I follow "Test lesson name" + And I am on the "Test lesson name" "lesson activity" page logged in as student1 And I should see "1 + 1?" And I set the following fields to these values: | Your answer | 2,7 | diff --git a/mod/lesson/tests/behat/lesson_outline_report.feature b/mod/lesson/tests/behat/lesson_outline_report.feature index a852831acca..d31470bb6b9 100644 --- a/mod/lesson/tests/behat/lesson_outline_report.feature +++ b/mod/lesson/tests/behat/lesson_outline_report.feature @@ -20,11 +20,8 @@ Feature: Teachers can review student progress on all lessons in a course by view | course | C1 | | idnumber | 0001 | | name | Test lesson name | - | intro | Test lesson description | | retake | 1 | - And I log in as "teacher1" - And I am on "Course 1" course homepage - And I follow "Test lesson name" + 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" @@ -83,15 +80,10 @@ Feature: Teachers can review student progress on all lessons in a course by view | id_answer_editor_1 | Next page | | id_jumpto_1 | Next page | And I press "Save page" - And I log out - When I log in as "student1" - And I am on "Course 1" course homepage - And I follow "Test lesson name" + 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" - And I log out - Then I log in as "teacher1" - And I am on "Course 1" course homepage + Then I am on the "Course 1" course page logged in as teacher1 And I navigate to course participants And I follow "Student 1" And I follow "Outline report" @@ -127,10 +119,7 @@ Feature: Teachers can review student progress on all lessons in a course by view | id_answer_editor_1 | Next page | | id_jumpto_1 | Next page | And I press "Save page" - And I log out - When I log in as "student1" - And I am on "Course 1" course homepage - And I follow "Test lesson name" + 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" And I should see "Second page contents" @@ -141,9 +130,7 @@ Feature: Teachers can review student progress on all lessons in a course by view And I press "Submit" And I press "Continue" And I should see "Congratulations - end of lesson reached" - And I log out - Then I log in as "teacher1" - And I am on "Course 1" course homepage + Then I am on the "Course 1" course page logged in as teacher1 And I navigate to course participants And I follow "Student 1" And I follow "Outline report" @@ -166,17 +153,12 @@ Feature: Teachers can review student progress on all lessons in a course by view | id_answer_editor_1 | End of lesson | | id_jumpto_1 | End of lesson | And I press "Save page" - And I log out - When I log in as "student1" - And I am on "Course 1" course homepage - And I follow "Test lesson name" + 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" And I should see "Second page contents" And I press "End of lesson" - And I log out - Then I log in as "teacher1" - And I am on "Course 1" course homepage + Then I am on the "Course 1" course page logged in as teacher1 And I navigate to course participants And I follow "Student 1" And I follow "Outline report" diff --git a/mod/lesson/tests/behat/lesson_practice.feature b/mod/lesson/tests/behat/lesson_practice.feature index bf86e1d84e5..38beffc38d7 100644 --- a/mod/lesson/tests/behat/lesson_practice.feature +++ b/mod/lesson/tests/behat/lesson_practice.feature @@ -21,11 +21,7 @@ Feature: Practice mode in a lesson activity | course | C1 | | idnumber | 0001 | | name | Test lesson name | - | intro | Lesson description | - | section | 1 | - And I log in as "teacher1" - And I am on "Course 1" course homepage with editing mode on - And I follow "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" @@ -35,18 +31,15 @@ Feature: Practice mode in a lesson activity | 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 Scenario: Non-practice lesson records grades in the gradebook - Given I navigate to "Settings" in current page administration - And I set the following fields to these values: + Given I set the following fields to these values: | Name | Non-practice lesson | | Description | This lesson will affect your course grade | | Practice lesson | No | And I press "Save and display" - And I log out - When I log in as "student1" - And I am on "Course 1" course homepage - And I follow "Non-practice lesson" + When I am on the "Non-practice lesson" "lesson activity" page logged in as student1 And I set the following fields to these values: | True | 1 | And I press "Submit" @@ -56,16 +49,12 @@ Feature: Practice mode in a lesson activity And I should see "Non-practice lesson" Scenario: Practice lesson doesn't record grades in the gradebook - Given I navigate to "Settings" in current page administration - And I set the following fields to these values: + Given I set the following fields to these values: | Name | Practice lesson | | Description | This lesson will NOT affect your course grade | | Practice lesson | Yes | And I press "Save and display" - And I log out - When I log in as "student1" - And I am on "Course 1" course homepage - And I follow "Practice lesson" + When I am on the "Practice lesson" "lesson activity" page logged in as student1 And I set the following fields to these values: | True | 1 | And I press "Submit" @@ -75,17 +64,13 @@ Feature: Practice mode in a lesson activity And I should not see "Practice lesson" Scenario: Practice lesson with scale doesn't record grades in the gradebook - Given I navigate to "Settings" in current page administration - And I set the following fields to these values: + Given I set the following fields to these values: | Name | Practice lesson with scale | | Description | This lesson will NOT affect your course grade | | Practice lesson | Yes | | Type | Scale | And I press "Save and display" - And I log out - When I log in as "student1" - And I am on "Course 1" course homepage - And I follow "Practice lesson with scale" + When I am on the "Practice lesson with scale" "lesson activity" page logged in as student1 And I set the following fields to these values: | True | 1 | And I press "Submit" diff --git a/mod/lesson/tests/behat/lesson_progress_bar.feature b/mod/lesson/tests/behat/lesson_progress_bar.feature index 7c14d2a69fd..8fba00a7219 100644 --- a/mod/lesson/tests/behat/lesson_progress_bar.feature +++ b/mod/lesson/tests/behat/lesson_progress_bar.feature @@ -17,16 +17,12 @@ Feature: In a lesson activity, students can see their progress viewing a progres | teacher1 | C1 | editingteacher | | student1 | C1 | student | And the following "activities" exist: - | activity | name | intro | course | section | idnumber | - | lesson | Test lesson name | Test lesson description | C1 | 1 | lesson1 | - And I log in as "teacher1" - And I am on "Course 1" course homepage - And I follow "Test lesson name" - And I navigate to "Settings" in current page administration + | activity | name | course | idnumber | + | lesson | Test lesson name | C1 | lesson1 | + 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 return to course" - And I follow "Test lesson name" + 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 | @@ -59,10 +55,7 @@ Feature: In a lesson activity, students can see their progress viewing a progres | id_jumpto_1 | Second page name | | id_score_1 | 0 | And I press "Save page" - And I log out - And I log in as "student1" - And I am on "Course 1" course homepage - When I follow "Test lesson name" + 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" And I press "Next page" diff --git a/mod/lesson/tests/behat/lesson_question_attempts.feature b/mod/lesson/tests/behat/lesson_question_attempts.feature index 602eae7b145..48721426b5c 100644 --- a/mod/lesson/tests/behat/lesson_question_attempts.feature +++ b/mod/lesson/tests/behat/lesson_question_attempts.feature @@ -20,10 +20,8 @@ Feature: In a lesson activity, students can not re-attempt a question more than | course | C1 | | idnumber | 0001 | | name | Test lesson name | - | intro | Test lesson description | | retake | 1 | | minquestions | 3 | - | section | 1 | 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: @@ -89,7 +87,6 @@ Feature: In a lesson activity, students can not re-attempt a question more than | id_response_editor_1 | Wrong | | id_jumpto_1 | This page | And I press "Save page" - And I log out 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 d316c27f012..ee2b9074bc9 100644 --- a/mod/lesson/tests/behat/lesson_report.feature +++ b/mod/lesson/tests/behat/lesson_report.feature @@ -17,11 +17,9 @@ Feature: In a lesson activity, teachers can review student attempts | teacher1 | C1 | editingteacher | | student1 | C1 | student | And the following "activities" exist: - | activity | name | intro | course | section | idnumber | retake | - | lesson | Test lesson name | Test | C1 | 1 | lesson1 | 1 | - And I log in as "teacher1" - And I am on "Course 1" course homepage - And I follow "Test lesson name" + | 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" @@ -75,10 +73,7 @@ Feature: In a lesson activity, teachers can review student attempts | id_answer_editor_1 | Next page | | id_jumpto_1 | Next page | And I press "Save page" - And I log out - When I log in as "student1" - And I am on "Course 1" course homepage - And I follow "Test lesson name" + 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" And I should see "Second page contents" @@ -96,10 +91,7 @@ Feature: In a lesson activity, teachers can review student attempts And I press "Submit" And I press "Continue" And I should see "Congratulations - end of lesson reached" - And I log out - Then I log in as "teacher1" - And I am on "Course 1" course homepage - And I follow "Test lesson name" + Then I am on the "Test lesson name" "lesson activity" page logged in as teacher1 And I navigate to "Reports" in current page administration And I should see "Student 1" And I should see "100%" @@ -142,10 +134,7 @@ Feature: In a lesson activity, teachers can review student attempts | id_answer_editor_1 | Next page | | id_jumpto_1 | Next page | And I press "Save page" - And I log out - When I log in as "student1" - And I am on "Course 1" course homepage - And I follow "Test lesson name" + 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" And I should see "Second page contents" @@ -154,10 +143,7 @@ Feature: In a lesson activity, teachers can review student attempts And I press "Next page" And I should see "Fourth page contents" And I press "End of lesson" - And I log out - Then I log in as "teacher1" - And I am on "Course 1" course homepage - And I follow "Test lesson name" + Then I am on the "Test lesson name" "lesson activity" page logged in as teacher1 And I navigate to "Reports" in current page administration And I should see "Student 1" And I should not see "High score" diff --git a/mod/lesson/tests/behat/lesson_review.feature b/mod/lesson/tests/behat/lesson_review.feature index 4fb06569f52..5fe06a81309 100644 --- a/mod/lesson/tests/behat/lesson_review.feature +++ b/mod/lesson/tests/behat/lesson_review.feature @@ -17,12 +17,9 @@ Feature: In a lesson activity, students can review the answers they gave to ques | teacher1 | C1 | editingteacher | | student1 | C1 | student | Given the following "activities" exist: - | activity | name | intro | course | section | idnumber | - | lesson | Test lesson name | Test lesson description | C1 | 1 | lesson1 | - And I log in as "teacher1" - And I am on "Course 1" course homepage - And I follow "Test lesson name" - And I navigate to "Settings" in current page administration + | activity | name | course | idnumber | + | lesson | Test lesson name | C1 | lesson1 | + 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 | | Slideshow | Yes | @@ -31,8 +28,7 @@ Feature: In a lesson activity, students can review the answers they gave to ques | Maximum number of attempts per question | 3 | | Custom scoring | No | | Re-takes allowed | Yes | - And I press "Save and return to course" - And I follow "Test lesson name" + 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" @@ -59,10 +55,7 @@ Feature: In a lesson activity, students can review the answers they gave to ques | id_response_editor_1 | Wrong | | id_jumpto_1 | This page | And I press "Save page" - And I log out - And I log in as "student1" - And I am on "Course 1" course homepage - And I follow "Test lesson name" + 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: | Your answer | 1 | diff --git a/mod/lesson/tests/behat/lesson_student_dashboard.feature b/mod/lesson/tests/behat/lesson_student_dashboard.feature index 60228382560..1ca18de2304 100644 --- a/mod/lesson/tests/behat/lesson_student_dashboard.feature +++ b/mod/lesson/tests/behat/lesson_student_dashboard.feature @@ -17,13 +17,11 @@ Feature: In Dashboard, a student can see their current status on all lessons wit | teacher1 | C1 | editingteacher | | student1 | C1 | student | And the following "activities" exist: - | activity | name | intro | deadline | retake | course | idnumber | - | lesson | Test lesson name | Test lesson description | 1893481200 | 1 | C1 | lesson1 | - And I log in as "teacher1" - And I am on "Course 1" course homepage with editing mode on + | activity | name | deadline | retake | course | idnumber | + | lesson | Test lesson name | 1893481200 | 1 | C1 | lesson1 | Scenario: A completed lesson with only questions that allows multiple attempts - Given I follow "Test lesson name" + Given I am on the "Test lesson name" "lesson activity" page logged in as teacher1 And I follow "Add a question page" And I set the field "Select a question type" to "True/false" And I press "Add a question page" @@ -50,10 +48,7 @@ Feature: In Dashboard, a student can see their current status on all lessons wit | id_response_editor_1 | Wrong | | id_jumpto_1 | This page | And I press "Save page" - And I log out - And I log in as "student1" - And I am on "Course 1" course homepage - And I follow "Test lesson name" + And I am on the "Test lesson name" "lesson activity" page logged in as student1 And I should see "Cat is an amphibian" And I set the following fields to these values: | False | 1 | @@ -67,8 +62,7 @@ Feature: In Dashboard, a student can see their current status on all lessons wit And I should see "Congratulations - end of lesson reached" Scenario: A completed lesson with only questions that does not allow multiple attempts - Given I follow "Test lesson name" - And I navigate to "Settings" in current page administration + Given I am on the "Test lesson name" "lesson activity editing" page logged in as teacher1 And I set the following fields to these values: | Re-takes allowed | 0 | And I press "Save and display" @@ -98,10 +92,7 @@ Feature: In Dashboard, a student can see their current status on all lessons wit | id_response_editor_1 | Wrong | | id_jumpto_1 | This page | And I press "Save page" - And I log out - And I log in as "student1" - And I am on "Course 1" course homepage - And I follow "Test lesson name" + And I am on the "Test lesson name" "lesson activity" page logged in as student1 And I should see "Cat is an amphibian" And I set the following fields to these values: | False | 1 | @@ -113,10 +104,9 @@ Feature: In Dashboard, a student can see their current status on all lessons wit And I press "Submit" And I press "Continue" And I should see "Congratulations - end of lesson reached" - And I log out Scenario: A completed lesson with only content pages that allows multiple attempts - Given I follow "Test lesson name" + Given I am on the "Test lesson name" "lesson activity" page logged in as teacher1 And I follow "Add a content page" And I set the following fields to these values: | Page title | First page name | @@ -133,19 +123,14 @@ Feature: In Dashboard, a student can see their current status on all lessons wit | id_answer_editor_1 | End of lesson | | id_jumpto_1 | End of lesson | And I press "Save page" - And I log out - And I log in as "student1" - And I am on "Course 1" course homepage - And I follow "Test lesson name" + And I am on the "Test lesson name" "lesson activity" page logged in as student1 And I should see "First page contents" And I press "Next page" And I should see "Second page contents" And I press "End of lesson" - And I log out Scenario: A completed lesson with only content pages that does not allow multiple attempts - Given I follow "Test lesson name" - And I navigate to "Settings" in current page administration + Given I am on the "Test lesson name" "lesson activity editing" page logged in as teacher1 And I set the following fields to these values: | Re-takes allowed | 0 | And I press "Save and display" @@ -165,18 +150,14 @@ Feature: In Dashboard, a student can see their current status on all lessons wit | id_answer_editor_1 | End of lesson | | id_jumpto_1 | End of lesson | And I press "Save page" - And I log out - And I log in as "student1" - And I am on "Course 1" course homepage - And I follow "Test lesson name" + And I am on the "Test lesson name" "lesson activity" page logged in as student1 And I should see "First page contents" And I press "Next page" And I should see "Second page contents" And I press "End of lesson" - And I log out Scenario: An incomplete lesson with only questions. - Given I follow "Test lesson name" + Given I am on the "Test lesson name" "lesson activity" page logged in as teacher1 And I follow "Add a question page" And I set the field "Select a question type" to "True/false" And I press "Add a question page" @@ -203,19 +184,15 @@ Feature: In Dashboard, a student can see their current status on all lessons wit | id_response_editor_1 | Wrong | | id_jumpto_1 | This page | And I press "Save page" - And I log out - And I log in as "student1" - And I am on "Course 1" course homepage - And I follow "Test lesson name" + And I am on the "Test lesson name" "lesson activity" page logged in as student1 And I should see "Cat is an amphibian" And I set the following fields to these values: | False | 1 | And I press "Submit" And I press "Continue" - And I log out Scenario: An incomplete lesson with only content pages. - Given I follow "Test lesson name" + Given I am on the "Test lesson name" "lesson activity" page logged in as teacher1 And I follow "Add a content page" And I set the following fields to these values: | Page title | First page name | @@ -232,17 +209,13 @@ Feature: In Dashboard, a student can see their current status on all lessons wit | id_answer_editor_1 | End of lesson | | id_jumpto_1 | End of lesson | And I press "Save page" - And I log out - And I log in as "student1" - And I am on "Course 1" course homepage - And I follow "Test lesson name" + And I am on the "Test lesson name" "lesson activity" page logged in as student1 And I should see "First page contents" And I press "Next page" And I should see "Second page contents" - And I log out Scenario: A lesson with only questions that has not been started. - Given I follow "Test lesson name" + Given I am on the "Test lesson name" "lesson activity" page logged in as teacher1 And I follow "Add a question page" And I set the field "Select a question type" to "True/false" And I press "Add a question page" @@ -269,10 +242,9 @@ Feature: In Dashboard, a student can see their current status on all lessons wit | id_response_editor_1 | Wrong | | id_jumpto_1 | This page | And I press "Save page" - And I log out Scenario: A lesson with only content pages that has not been started. - Given I follow "Test lesson name" + Given I am on the "Test lesson name" "lesson activity" page logged in as teacher1 And I follow "Add a content page" And I set the following fields to these values: | Page title | First page name | @@ -289,7 +261,6 @@ Feature: In Dashboard, a student can see their current status on all lessons wit | id_answer_editor_1 | End of lesson | | id_jumpto_1 | End of lesson | And I press "Save page" - And I log out Scenario: Viewing the status for multiple lessons in multiple courses Given the following "courses" exist: @@ -300,11 +271,10 @@ Feature: In Dashboard, a student can see their current status on all lessons wit | teacher1 | C2 | editingteacher | | student1 | C2 | student | And the following "activities" exist: - | activity | name | intro | deadline | retake | course | idnumber | - | lesson | Test lesson name 2 | Test lesson description | 1893481200 | 1 | C1 | lesson1 | - | lesson | Test lesson name 3 | Test lesson description | 1893481200 | 1 | C2 | lesson1 | - And I turn editing mode off - And I follow "Test lesson name" + | activity | name | deadline | retake | course | idnumber | + | lesson | Test lesson name 2 | 1893481200 | 1 | C1 | lesson1 | + | lesson | Test lesson name 3 | 1893481200 | 1 | C2 | lesson1 | + And I am on the "Test lesson name" "lesson activity" page logged in as teacher1 And I follow "Add a question page" And I set the field "Select a question type" to "True/false" And I press "Add a question page" @@ -314,8 +284,7 @@ Feature: In Dashboard, a student can see their current status on all lessons wit | id_answer_editor_0 | True | | id_answer_editor_1 | False | And I press "Save page" - And I am on "Course 1" course homepage - And I follow "Test lesson name 2" + And I am on the "Test lesson name 2" "lesson activity" page And I follow "Add a question page" And I set the field "Select a question type" to "True/false" And I press "Add a question page" @@ -325,8 +294,7 @@ Feature: In Dashboard, a student can see their current status on all lessons wit | id_answer_editor_0 | True | | id_answer_editor_1 | False | And I press "Save page" - And I am on "Course 2" course homepage - And I follow "Test lesson name 3" + And I am on the "Test lesson name 3" "lesson activity" page And I follow "Add a question page" And I set the field "Select a question type" to "True/false" And I press "Add a question page" @@ -345,18 +313,13 @@ Feature: In Dashboard, a student can see their current status on all lessons wit | id_answer_editor_0 | True | | id_answer_editor_1 | False | And I press "Save page" - And I log out - And I log in as "student1" - And I am on "Course 1" course homepage - And I follow "Test lesson name" + And I am on the "Test lesson name" "lesson activity" page logged in as student1 And I should see "D035 M00d13 r0x0rz j00 b0x0rs?" And I set the following fields to these values: | True | 1 | And I press "Submit" - And I am on "Course 2" course homepage - And I follow "Test lesson name 3" + And I am on the "Test lesson name 3" "lesson activity" page And I should see "D035 M00d13 r0x0rz j00 b0x0rs?" And I set the following fields to these values: | True | 1 | And I press "Submit" - And I log out diff --git a/mod/lesson/tests/behat/lesson_student_resume.feature b/mod/lesson/tests/behat/lesson_student_resume.feature index 8e207dfedcb..73be4605071 100644 --- a/mod/lesson/tests/behat/lesson_student_resume.feature +++ b/mod/lesson/tests/behat/lesson_student_resume.feature @@ -17,14 +17,10 @@ Feature: In a lesson activity a student should And the following "activity" exists: | activity | lesson | | name | Test lesson name | - | intro | Test lesson description | | course | C1 | | idnumber | 0001 | - | section | 1 | | retake | 1 | - And I log in as "teacher1" - And I am on "Course 1" course homepage - And I follow "Test lesson name" + 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" @@ -78,10 +74,7 @@ Feature: In a lesson activity a student should | id_answer_editor_1 | Next page | | id_jumpto_1 | Next page | And I press "Save page" - And I log out - When I log in as "student1" - And I am on "Course 1" course homepage - And I follow "Test lesson name" + 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" # Add 1 sec delay so lesson knows a valid attempt has been made in past. @@ -157,10 +150,7 @@ Feature: In a lesson activity a student should | id_answer_editor_1 | Next page | | id_jumpto_1 | Next page | And I press "Save page" - And I log out - When I log in as "student1" - And I am on "Course 1" course homepage - And I follow "Test lesson name" + 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" And I should see "Second page contents" @@ -179,12 +169,8 @@ Feature: In a lesson activity a student should # Add 1 sec delay so lesson knows a valid attempt has been made in past. And I wait "1" seconds And I press "End of lesson" - And I log out - And I log in as "student1" - And I am on "Course 1" course homepage - And I follow "Test lesson name" + And I am on the "Test lesson name" "lesson activity" page logged in as student1 And I should see "First page contents" - And I log out Scenario: resume a lesson with both question then content pages Given I follow "Add a question page" @@ -266,10 +252,7 @@ Feature: In a lesson activity a student should | id_answer_editor_0 | Next page | | id_jumpto_0 | Next page | And I press "Save page" - And I log out - When I log in as "student1" - And I am on "Course 1" course homepage - And I follow "Test lesson name" + 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 | @@ -383,10 +366,7 @@ Feature: In a lesson activity a student should | id_response_editor_1 | Wrong | | id_jumpto_1 | This page | And I press "Save page" - And I log out - When I log in as "student1" - And I am on "Course 1" course homepage - And I follow "Test lesson name" + 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_user_override.feature b/mod/lesson/tests/behat/lesson_user_override.feature index 7ab48d28706..7a331f5ca25 100644 --- a/mod/lesson/tests/behat/lesson_user_override.feature +++ b/mod/lesson/tests/behat/lesson_user_override.feature @@ -19,8 +19,8 @@ Feature: Lesson user override | student1 | C1 | student | | student2 | C1 | student | And the following "activities" exist: - | activity | name | intro | course | idnumber | - | lesson | Test lesson name | Test lesson description | C1 | lesson1 | + | 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" @@ -35,7 +35,6 @@ Feature: Lesson user override | id_response_editor_1 | Wrong | | id_jumpto_1 | This page | And I press "Save page" - And I log out @javascript Scenario: Add, modify then delete a user override @@ -97,7 +96,6 @@ Feature: Lesson user override | Re-takes allowed | 1 | And I press "Save" And I should see "Re-takes allowed" - And I log out And I am on the "Test lesson name" "lesson activity" page logged in as student1 And I should see "Cat is an amphibian" And I set the following fields to these values: @@ -108,7 +106,6 @@ Feature: Lesson user override When I am on the "Test lesson name" "lesson activity" page Then I should not see "You are not allowed to retake this lesson." And I should see "Cat is an amphibian" - And I log out And I am on the "Test lesson name" "lesson activity" page logged in as student2 And I should see "Cat is an amphibian" And I set the following fields to these values: @@ -133,7 +130,6 @@ Feature: Lesson user override | Password protected lesson | 12345 | And I press "Save" And I should see "Password protected lesson" - And I log out And I am on the "Test lesson name" "lesson activity" page logged in as student1 Then I should see "Test lesson name is a password protected lesson" And I should not see "Cat is an amphibian" @@ -149,7 +145,6 @@ Feature: Lesson user override And I press "Submit" And I press "Continue" And I should see "Congratulations - end of lesson reached" - And I log out And I am on the "Test lesson name" "lesson activity" page logged in as student2 And I should see "Test lesson name is a password protected lesson" And I should not see "Cat is an amphibian" @@ -183,12 +178,10 @@ Feature: Lesson user override | deadline[minute] | 00 | And I press "Save" And I should see "Lesson closes" - And I log out And I am on the "Test lesson name" "lesson activity" page logged in as student2 And I wait until the page is ready Then the activity date in "Test lesson name" should contain "Closed: Saturday, 1 January 2000, 8:00" And I should not see "Cat is an amphibian" - And I log out And I am on the "Test lesson name" "lesson activity" page logged in as student1 And I should see "Cat is an amphibian" @@ -215,12 +208,10 @@ Feature: Lesson user override | available[minute] | 00 | And I press "Save" And I should see "Lesson opens" - And I log out And I am on the "Test lesson name" "lesson activity" page logged in as student2 And I wait until the page is ready Then the activity date in "Test lesson name" should contain "Opens: Tuesday, 1 January 2030, 8:00" And I should not see "Cat is an amphibian" - And I log out And I am on the "Test lesson name" "lesson activity" page logged in as student1 And I should see "Cat is an amphibian" @@ -237,7 +228,6 @@ Feature: Lesson user override | Maximum number of attempts per question | 2 | And I press "Save" And I should see "Maximum number of attempts per question" - And I log out And I am on the "Test lesson name" "lesson activity" page logged in as student1 And I should see "Cat is an amphibian" And I set the following fields to these values: @@ -250,7 +240,6 @@ Feature: Lesson user override And I press "Submit" And I press "Continue" And I should see "Congratulations - end of lesson reached" - And I log out And I am on the "Test lesson name" "lesson activity" page logged in as student2 And I should see "Cat is an amphibian" And I set the following fields to these values: @@ -331,7 +320,6 @@ Feature: Lesson user override | deadline[hour] | 08 | | deadline[minute] | 00 | And I press "Save" - And I log out When I am on the "Lesson 2" "lesson activity" page logged in as teacher1 And I navigate to "Overrides" in current page administration Then I should see "Student1" in the ".generaltable" "css_element" diff --git a/mod/lesson/tests/behat/lesson_with_clusters.feature b/mod/lesson/tests/behat/lesson_with_clusters.feature index fe75ae5fbc8..ee5f1ce1b3d 100644 --- a/mod/lesson/tests/behat/lesson_with_clusters.feature +++ b/mod/lesson/tests/behat/lesson_with_clusters.feature @@ -17,13 +17,12 @@ Feature: In a lesson activity, students can see questions in random order | teacher1 | C1 | editingteacher | | student1 | C1 | student | And the following "activities" exist: - | activity | name | intro | course | idnumber | section | - | lesson | Lesson with clusters | Test lesson description | C1 | lesson1 | 1 | + | activity | name | course | idnumber | + | lesson | Lesson with clusters | C1 | lesson1 | And I log in as "teacher1" Scenario: Lesson with two clusters - Given I am on "Course 1" course homepage with editing mode on - And I follow "Lesson with clusters" + Given I am on the "Lesson with clusters" "lesson activity" page And I follow "Add a content page" And I set the following fields to these values: | Page title | First page name | @@ -119,10 +118,7 @@ Feature: In a lesson activity, students can see questions in random order | id_answer_editor_0 | Next page | | id_jumpto_0 | Next page | And I press "Save page" - And I log out - And I log in as "student1" - And I am on "Course 1" course homepage - When I follow "Lesson with clusters" + When I am on the "Lesson with clusters" "lesson activity" page logged in as student1 Then I should see "First page contents" And I press "Next page" And I should see "Second page contents" diff --git a/mod/lesson/tests/behat/lesson_with_subcluster.feature b/mod/lesson/tests/behat/lesson_with_subcluster.feature index 3c6e3a942b4..006c491afcf 100644 --- a/mod/lesson/tests/behat/lesson_with_subcluster.feature +++ b/mod/lesson/tests/behat/lesson_with_subcluster.feature @@ -16,14 +16,13 @@ Feature: In a lesson activity, students can see questions in random order and a | user | course | role | | teacher1 | C1 | editingteacher | | student1 | C1 | student | + And the following "activities" exist: + | activity | name | course | idnumber | + | lesson | Lesson with subcluster | C1 | lesson1 | And I log in as "teacher1" Scenario: Lesson with subcluster - Given the following "activities" exist: - | activity | name | intro | course | idnumber | section | - | lesson | Lesson with subcluster | Test lesson description | C1 | lesson1 | 1 | - And I am on "Course 1" course homepage - And I follow "Lesson with subcluster" + Given I am on the "Lesson with subcluster" "lesson activity" page And I follow "Add a content page" And I set the following fields to these values: | Page title | First page name | @@ -139,10 +138,7 @@ Feature: In a lesson activity, students can see questions in random order and a | id_answer_editor_0 | Next page | | id_jumpto_0 | Next page | And I press "Save page" - And I log out - And I log in as "student1" - And I am on "Course 1" course homepage - When I follow "Lesson with subcluster" + When I am on the "Lesson with subcluster" "lesson activity" page logged in as student1 Then I should see "First page contents" And I press "Next page" And I should see "Question from cluster" diff --git a/mod/lesson/tests/behat/link_to_gradebook.feature b/mod/lesson/tests/behat/link_to_gradebook.feature index 37904f953aa..e428bea9534 100644 --- a/mod/lesson/tests/behat/link_to_gradebook.feature +++ b/mod/lesson/tests/behat/link_to_gradebook.feature @@ -16,12 +16,10 @@ Feature: link to gradebook on the end of lesson page | user | course | role | | teacher1 | C1 | editingteacher | | student1 | C1 | student | - And I log in as "teacher1" And the following "activities" exist: - | activity | name | intro | course | idnumber | - | lesson | Test lesson | Test lesson description | C1 | lesson1 | - And I am on "Course 1" course homepage - And I follow "Test lesson" + | 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 | @@ -40,10 +38,7 @@ Feature: link to gradebook on the end of lesson page And I press "Save page" Scenario: Link to gradebook for non practice lesson - Given I log out - When I log in as "student1" - And I am on "Course 1" course homepage - And I follow "Test lesson" + When I am on the "Test lesson" "lesson activity" page logged in as student1 And I press "Next page" And I press "Next page" Then I should see "Congratulations - end of lesson reached" @@ -54,28 +49,22 @@ 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 navigate to "Settings" in current page administration + Given I am on the "Test lesson" "lesson activity editing" page And I set the following fields to these values: | Type | None | And I press "Save and display" - And I log out - When I log in as "student1" - And I am on "Course 1" course homepage - And I follow "Test lesson" + When I am on the "Test lesson" "lesson activity" page logged in as student1 And I press "Next page" And I press "Next page" Then I should see "Congratulations - end of lesson reached" And I should not see "View grades" Scenario: No link to gradebook for practice lesson - Given I navigate to "Settings" in current page administration + Given I am on the "Test lesson" "lesson activity editing" page And I set the following fields to these values: | Practice lesson | Yes | And I press "Save and display" - And I log out - When I log in as "student1" - And I am on "Course 1" course homepage - And I follow "Test lesson" + When I am on the "Test lesson" "lesson activity" page logged in as student1 And I press "Next page" And I press "Next page" Then I should see "Congratulations - end of lesson reached" @@ -87,25 +76,18 @@ Feature: link to gradebook on the end of lesson page And I set the following fields to these values: | Show gradebook to students | No | And I press "Save and display" - And I log out - When I log in as "student1" - And I am on "Course 1" course homepage - And I follow "Test lesson" + When I am on the "Test lesson" "lesson activity" page logged in as student1 And I press "Next page" And I press "Next page" Then I should see "Congratulations - end of lesson reached" And I should not see "View grades" Scenario: No link to gradebook if no gradereport/user:view capability - Given I log out - And I log in as "admin" + Given I log in as "admin" And I set the following system permissions of "Student" role: | capability | permission | | gradereport/user:view | Prevent | - And I log out - When I log in as "student1" - And I am on "Course 1" course homepage - And I follow "Test lesson" + When I am on the "Test lesson" "lesson activity" page logged in as student1 And I press "Next page" And I press "Next page" Then I should see "Congratulations - end of lesson reached" diff --git a/mod/lesson/tests/behat/password_protection.feature b/mod/lesson/tests/behat/password_protection.feature index 467d0b0d05c..7e348eeaddf 100644 --- a/mod/lesson/tests/behat/password_protection.feature +++ b/mod/lesson/tests/behat/password_protection.feature @@ -21,23 +21,16 @@ Feature: A teacher can password protect a lesson | course | C1 | | idnumber | 0001 | | name | Test lesson | - | intro | Test lesson description | - | section | 1 | | usepassword | 1 | | password | moodle_rules | - And I log in as "teacher1" - And I am on "Course 1" course homepage - And I follow "Test lesson" + 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" - And I log out - And I log in as "student1" - And I am on "Course 1" course homepage - When I follow "Test lesson" + 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" And I set the field "userpassword" to "moodle" diff --git a/mod/lesson/tests/behat/questions_images.feature b/mod/lesson/tests/behat/questions_images.feature index ee9b7eace23..c461f9f6fd7 100644 --- a/mod/lesson/tests/behat/questions_images.feature +++ b/mod/lesson/tests/behat/questions_images.feature @@ -79,7 +79,6 @@ Feature: In a lesson activity, teacher can add embedded images in questions answ And I set the field "Describe this image for someone who cannot see it" to "It's the logo" And I click on "Save image" "button" And I press "Save page" - And I log out When I am on the "Test lesson name" "lesson activity" page logged in as student1 Then I should see "What animal is an amphibian?" And "//*[contains(@class, 'answeroption')]//img[contains(@src, 'pluginfile.php')]" "xpath_element" should exist diff --git a/mod/lesson/tests/behat/teacher_grade_essays.feature b/mod/lesson/tests/behat/teacher_grade_essays.feature index 3f518d322b5..896488a0e27 100644 --- a/mod/lesson/tests/behat/teacher_grade_essays.feature +++ b/mod/lesson/tests/behat/teacher_grade_essays.feature @@ -34,17 +34,12 @@ Feature: In a lesson activity, a non editing teacher can grade essay questions | student2 | G2 | | student3 | G3 | And the following "activities" exist: - | activity | name | intro | course | idnumber | section | - | lesson | Test lesson name | Test lesson description | C1 | lesson1 | 1 | - And I log in as "teacher1" - And I am on "Course 1" course homepage - And I follow "Test lesson name" - And I navigate to "Settings" in current page administration + | activity | name | course | idnumber | + | lesson | Test lesson name | C1 | lesson1 | + 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 return to course" - And I am on "Course 1" course homepage with editing mode on - And I follow "Test lesson name" + 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" @@ -52,22 +47,13 @@ Feature: In a lesson activity, a non editing teacher can grade essay questions | Page title | Essay question | | Page contents |

Please write a story about a frog.

| And I press "Save page" - And I log out - And I log in as "student1" - And I am on "Course 1" course homepage - And I follow "Test lesson name" + 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" - And I log out - And I log in as "student2" - And I am on "Course 1" course homepage - And I follow "Test lesson name" + And I am on the "Test lesson name" "lesson activity" page logged in as student2 And I set the field "Your answer" to "

Once upon a time there were two little green frogs." And I press "Submit" - And I log out - When I log in as "teacher1" - And I am on "Course 1" course homepage - And I follow "Test lesson name" + When I am on the "Test lesson name" "lesson activity" page logged in as teacher1 Then I should see "Grade essays" And I grade lesson essays And I should see "Student 1" @@ -89,10 +75,7 @@ Feature: In a lesson activity, a non editing teacher can grade essay questions And I should not see "Student 1" And I select "Group C" from the "Separate groups" singleselect And I should see "No one in Group C has answered an essay question yet." - And I log out - And I log in as "teacher2" - And I am on "Course 1" course homepage - And I follow "Test lesson name" + And I am on the "Test lesson name" "lesson activity" page logged in as teacher2 Then I should see "Grade essays" And I grade lesson essays And I should not see "Student 1" diff --git a/mod/lesson/tests/behat/time_limit.feature b/mod/lesson/tests/behat/time_limit.feature index 0b27b6a9578..420e91922b5 100644 --- a/mod/lesson/tests/behat/time_limit.feature +++ b/mod/lesson/tests/behat/time_limit.feature @@ -17,30 +17,30 @@ Feature: A teacher can set a time limit for a lesson | user | course | role | | teacher1 | C1 | editingteacher | | student1 | C1 | student | - And I log in as "teacher1" - And I am on "Course 1" course homepage with editing mode on - And I add a "Lesson" to section "1" and I fill the form with: - | Name | Test lesson | - | Description | Test lesson description | - | timelimit[enabled] | 1 | - | timelimit[timeunit] | 60 | - | timelimit[number] | 1 | - And I am on the "Test lesson" "lesson activity" page + And the following "activities" exist: + | activity | course | name | + | lesson | C1 | Test lesson | + 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: + | timelimit[enabled] | 1 | + | 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" - And I log out When I am on the "Test lesson" "lesson activity" page logged in as student1 - Then I should see "You have 1 min to finish the lesson." + Then I should see "You have 10 secs to finish the lesson." And I wait "3" seconds And I should see "Time remaining" And I press "Single button" And I should see "0:00:" And I should see "Warning: You have 1 minute or less to finish the lesson." - And I wait "60" seconds + And I wait "10" seconds And I press "Single button" And I should see "You ran out of time for this lesson." And I should see "Your last answer may not have counted if it was answered after the time was up." diff --git a/mod/lesson/tests/behat/wrong_answer_continue.feature b/mod/lesson/tests/behat/wrong_answer_continue.feature index d4f6808b8fa..b9095b4e27c 100644 --- a/mod/lesson/tests/behat/wrong_answer_continue.feature +++ b/mod/lesson/tests/behat/wrong_answer_continue.feature @@ -17,17 +17,13 @@ Feature: An incorrect response to an answer with multiple attempts show appropri | teacher1 | C1 | editingteacher | | student1 | C1 | student | And the following "activities" exist: - | activity | name | intro | course | section | idnumber | - | lesson | Test lesson name | Test lesson description | C1 | 1 | lesson1 | - And I log in as "teacher1" - And I am on "Course 1" course homepage - And I follow "Test lesson name" - And I navigate to "Settings" in current page administration + | activity | name | course | idnumber | + | lesson | Test lesson name | C1 | lesson1 | + 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: | Provide option to try a question again | Yes | | Maximum number of attempts per question | 2 | - And I press "Save and return to course" - And I follow "Test lesson name" + 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" @@ -48,10 +44,7 @@ Feature: An incorrect response to an answer with multiple attempts show appropri | id_answer_editor_0 | End this lesson | | id_jumpto_0 | End of lesson | And I press "Save page" - And I log out - And I log in as "student1" - And I am on "Course 1" course homepage - And I follow "Test lesson name" + 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" And I should see "That's the wrong answer" @@ -76,10 +69,7 @@ Feature: An incorrect response to an answer with multiple attempts show appropri | id_answer_editor_0 | End this lesson | | id_jumpto_0 | End of lesson | And I press "Save page" - And I log out - And I log in as "student1" - And I am on "Course 1" course homepage - And I follow "Test lesson name" + 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" And I should see "That's the wrong answer"