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 cae9de96d5c..f5e7c60cf13 100644 --- a/admin/tool/behat/tests/behat/get_and_set_fields.feature +++ b/admin/tool/behat/tests/behat/get_and_set_fields.feature @@ -133,8 +133,11 @@ 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 - Then I am on "Course 1" course homepage - And I navigate to "Users > Groups" in current page administration + Given the following "activities" exist: + | activity | course | name | + | lesson | C1 | Test lesson | + When I am on "Course 1" course homepage + Then I navigate to "Users > Groups" in current page administration # Select (multi-select & AJAX) - Checking "I set the field" and "select box should contain". And I set the field "groups" to "Group 2" And the "members" select box should contain "Student 2 (s2@example.com)" @@ -145,11 +148,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 09c5771479d..7f5648b0e1f 100644 --- a/grade/tests/behat/grade_to_pass.feature +++ b/grade/tests/behat/grade_to_pass.feature @@ -21,10 +21,8 @@ Feature: We can set the grade to pass value And the following "activity" exists: | activity | assign | | course | C1 | - | section | 1 | | idnumber | assign1 | | name | Test Assignment 1 | - | intro | Submit your online text | | assignsubmission_onlinetext_enabled | 1 | And I am on the "Course 1" course page logged in as teacher1 @@ -179,14 +177,9 @@ 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 | - And I am on "Course 1" course homepage with editing mode on - And I follow "Test Lesson 1" - And I navigate to "Edit settings" in current page administration - And I set the following fields to these values: - | Grade to pass | 90 | - And I press "Save and return to course" + | activity | name | course | idnumber | gradepass | + | lesson | Test Lesson 1 | C1 | lesson1 | 90 | + And I am on the "Test Lesson 1" "lesson activity" page And I navigate to "View > Grader report" in the course gradebook And I turn editing mode on And I click on "Edit lesson Test Lesson 1" "link" @@ -194,9 +187,7 @@ 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 follow "Test Lesson 1" - And I follow "Edit 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 database activity diff --git a/media/player/videojs/tests/behat/modules.feature b/media/player/videojs/tests/behat/modules.feature index 1412340860d..843d7cc3a0e 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 362386bc865..5576b7fd05d 100644 --- a/mod/lesson/tests/behat/all_other_answers_catch.feature +++ b/mod/lesson/tests/behat/all_other_answers_catch.feature @@ -16,14 +16,15 @@ Feature: Numeric and short answer questions have a section to catch all other st | 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 the following "activity" exists: + | activity | lesson | + | course | C1 | + | idnumber | 0001 | + | name | Test lesson name | + | maxattempts | 3 | + 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: - | Name | Test lesson name | - | Description | Test lesson description | | Provide option to try a question again | Yes | - | Maximum number of attempts | 3 | And I press "Save and display" Scenario: I can create a numerical question with an option to catch all student responses. @@ -45,10 +46,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" @@ -79,10 +77,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 ad540acd734..ed2576820ae 100644 --- a/mod/lesson/tests/behat/completion_condition_end_reached.feature +++ b/mod/lesson/tests/behat/completion_condition_end_reached.feature @@ -16,19 +16,23 @@ Feature: Set end of lesson reached as a completion condition for a lesson | user | course | role | | teacher1 | C1 | editingteacher | | student1 | C1 | student | + And the following "activity" exists: + | activity | lesson | + | course | C1 | + | idnumber | 0001 | + | name | Test lesson | And I log in as "teacher1" And I am on "Course 1" course homepage with editing mode on And I navigate to "Edit 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 add a "Lesson" to section "1" and I fill the form with: - | Name | Test lesson | - | Description | Test lesson description | - | Completion tracking | Show activity as complete when conditions are met | - | completionview | 0 | - | completionendreached | 1 | - And I follow "Test lesson" + 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 display" And I follow "Add a content page" And I set the following fields to these values: | Page title | First page name | @@ -45,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 "Test lesson" "lesson" activity with "auto" completion should be marked as not complete And I follow "Test lesson" And I press "Next page" And I am on "Course 1" course homepage Then the "Test lesson" "lesson" activity with "auto" completion should be marked as not complete - 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" @@ -62,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 Then the "Test lesson" "lesson" activity with "auto" completion should be marked as complete - 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 f2df0c0a5e0..2c01039d38c 100644 --- a/mod/lesson/tests/behat/completion_condition_time_spent.feature +++ b/mod/lesson/tests/behat/completion_condition_time_spent.feature @@ -16,20 +16,25 @@ Feature: Set time spent as a completion condition for a lesson | user | course | role | | teacher1 | C1 | editingteacher | | student1 | C1 | student | + And the following "activity" exists: + | activity | lesson | + | course | C1 | + | idnumber | 0001 | + | name | Test lesson | And I log in as "teacher1" And I am on "Course 1" course homepage with editing mode on And I navigate to "Edit 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 add a "Lesson" to section "1" and I fill the form with: - | Name | Test lesson | - | Description | Test lesson description | + 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 | + | completiontimespent[number] | 5 | + And I press "Save and display" And I follow "Test lesson" And I follow "Add a content page" And I set the following fields to these values: @@ -47,9 +52,7 @@ 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 + When I am on the "Course 1" course page logged in as student1 Then the "Test lesson" "lesson" activity with "auto" completion should be marked as not complete And I follow "Test lesson" And I press "Next page" @@ -57,18 +60,15 @@ Feature: Set time spent as a completion condition for a lesson 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 "Test lesson" "lesson" activity with "auto" completion should be marked as not complete - 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 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 "Test lesson" "lesson" activity with "auto" completion should be marked as complete - 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/date_availability.feature b/mod/lesson/tests/behat/date_availability.feature index dfdbda5fa09..26e0decb738 100644 --- a/mod/lesson/tests/behat/date_availability.feature +++ b/mod/lesson/tests/behat/date_availability.feature @@ -16,38 +16,34 @@ 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 I add a "Lesson" to section "1" - And I expand all fieldsets + 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: - | Name | Test lesson | - | Description | Test lesson description | | available[day] | 1 | | available[month] | January | | available[year] | 2030 | | available[hour] | 08 | | available[minute] | 00 | And I press "Save and display" - And I follow "Test lesson" 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 "This lesson will be open on Tuesday, 1 January 2030, 8:00" And I should not see "First page contents" Scenario: Forbidding lesson accesses until a specified date - Given I add a "Lesson" to section "1" + 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: | Name | Test lesson | @@ -58,16 +54,12 @@ Feature: A teacher can set available from and deadline dates to access a lesson | deadline[hour] | 08 | | deadline[minute] | 00 | And I press "Save and display" - And I follow "Test lesson" 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 "This lesson closed on 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 07b35409e6e..ca9c4152b61 100644 --- a/mod/lesson/tests/behat/display_lesson_description.feature +++ b/mod/lesson/tests/behat/display_lesson_description.feature @@ -14,23 +14,20 @@ Feature: Display the lesson description in the lesson and optionally in the cour And the following "course enrolments" exist: | user | course | role | | teacher1 | C1 | editingteacher | + And the following "activity" exists: + | activity | lesson | + | course | C1 | + | idnumber | 0001 | + | name | Test lesson name | + | intro | Test lesson description | 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 set the following fields to these values: - | Name | Test lesson | - | Description | Test lesson description | - And I click on "Save and display" "button" 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 "Edit 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: @@ -40,9 +37,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 "Edit 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_complete_report.feature b/mod/lesson/tests/behat/lesson_complete_report.feature index 8dd0cb39b0c..9c82e2136d3 100644 --- a/mod/lesson/tests/behat/lesson_complete_report.feature +++ b/mod/lesson/tests/behat/lesson_complete_report.feature @@ -15,15 +15,10 @@ Feature: Teachers can review student progress on all lessons in a course by view | 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 set the following fields to these values: - | Name | Test lesson name | - | Description | Test lesson description | - | Re-takes allowed | Yes | - And I press "Save and return to course" - And I follow "Test lesson name" + And the following "activities" exist: + | activity | name | course | idnumber | retake | + | lesson | Test lesson name | C1 | lesson1 | 1 | + And I am on the "Test lesson name" "lesson activity" page logged in as teacher1 Scenario: View student progress for lesson that was never attempted Given I follow "Add a content page" @@ -82,15 +77,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 "Complete report" @@ -141,10 +131,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" @@ -160,9 +147,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" @@ -188,17 +173,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_course_reset.feature b/mod/lesson/tests/behat/lesson_course_reset.feature index 15e8df34356..76ce22c1f08 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 > Overview" 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 37e9ddf9ba4..191be1db0ec 100644 --- a/mod/lesson/tests/behat/lesson_delete_answers.feature +++ b/mod/lesson/tests/behat/lesson_delete_answers.feature @@ -17,12 +17,10 @@ branch table contents | 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 name | - | Description | Test lesson description | - And I follow "Test lesson name" + And the following "activities" exist: + | activity | name | course | idnumber | + | lesson | Test lesson name | C1 | lesson1 | + And I am on the "Test lesson name" "lesson activity" page logged in as teacher1 And I follow "Add a 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 58c72091b6a..4871f6bdc92 100644 --- a/mod/lesson/tests/behat/lesson_edit_cluster.feature +++ b/mod/lesson/tests/behat/lesson_edit_cluster.feature @@ -16,12 +16,10 @@ Feature: In a lesson activity, teacher can edit a cluster page | 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 | Lesson with cluster | - | Description | Test lesson description | - And I follow "Lesson with cluster" + And the following "activities" exist: + | activity | name | course | idnumber | + | lesson | Lesson with cluster | C1 | lesson1 | + And I am on the "Lesson with cluster" "lesson activity" page logged in as teacher1 And I follow "Add a content page" And I set the following fields to these values: | Page title | First page name | @@ -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 188a6287c45..a8bbc2cfc6d 100644 --- a/mod/lesson/tests/behat/lesson_edit_pages.feature +++ b/mod/lesson/tests/behat/lesson_edit_pages.feature @@ -16,12 +16,10 @@ Feature: In a lesson activity, teacher can edit lesson's pages | 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 name | - | Description | Test lesson description | - And I follow "Test lesson name" + And the following "activities" exist: + | activity | name | course | idnumber | + | lesson | Test lesson name | C1 | lesson1 | + And I am on the "Test lesson name" "lesson activity" page logged in as teacher1 And I follow "Add a 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 e44d8532196..0edb8104d1b 100644 --- a/mod/lesson/tests/behat/lesson_essay_question.feature +++ b/mod/lesson/tests/behat/lesson_essay_question.feature @@ -15,13 +15,10 @@ Feature: In a lesson activity, teacher can add an essay question | 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 name | - | Description | Test lesson description | - | Use default feedback | Yes | - And I follow "Test lesson name" + And the following "activities" exist: + | activity | name | course | idnumber | feedback | + | lesson | Test lesson name | C1 | lesson1 | 1 | + And I am on the "Test lesson name" "lesson activity" page logged in as teacher1 And I follow "Add a question page" And I set the field "Select a question type" to "Essay" And I press "Add a question page" @@ -29,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" @@ -44,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 follow "Grade 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 216a95e0900..6def4a466c6 100644 --- a/mod/lesson/tests/behat/lesson_exit_enter_clusters.feature +++ b/mod/lesson/tests/behat/lesson_exit_enter_clusters.feature @@ -15,12 +15,10 @@ Feature: In a lesson activity, students can exit and re-enter the activity when | 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 | Lesson with cluster | - | Description | Cluster lesson description | - And I follow "Lesson with cluster" + And the following "activities" exist: + | activity | name | course | idnumber | + | lesson | Lesson with cluster | C1 | lesson1 | + And I am on the "Lesson with cluster" "lesson activity" page logged in as teacher1 And I follow "Add a content page" And I set the following fields to these values: | Page title | First page name | @@ -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 4a3f7f5640b..ddb9958474f 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 @@ -105,7 +104,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: @@ -116,7 +114,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: @@ -140,7 +137,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" @@ -156,7 +152,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" @@ -189,11 +184,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 I should see "This lesson closed on 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" @@ -219,11 +212,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 I should see "This lesson will be open on 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" @@ -239,7 +230,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: @@ -252,7 +242,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: @@ -298,13 +287,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 I should see "This lesson will be open on 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 I should see "This lesson will be open on 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 I should see "This lesson will be open on Tuesday, 1 January 2030, 8:00" @@ -341,8 +327,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 | @@ -367,7 +353,6 @@ Feature: Lesson group override | available[hour] | 08 | | available[minute] | 00 | And I press "Save" - And I log out And I am on the "Lesson 2" "lesson activity" page logged in as teacher1 And I navigate to "Group overrides" in current page administration Then I should see "Group 1" in the ".generaltable" "css_element" diff --git a/mod/lesson/tests/behat/lesson_informations_at_end.feature b/mod/lesson/tests/behat/lesson_informations_at_end.feature index 07a3c7d629c..bf6cdda2759 100644 --- a/mod/lesson/tests/behat/lesson_informations_at_end.feature +++ b/mod/lesson/tests/behat/lesson_informations_at_end.feature @@ -14,13 +14,10 @@ Feature: In a lesson activity, if custom scoring is not enabled, student should | 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 name | - | Description | Test lesson description | - | Custom scoring | No | - And I follow "Test lesson name" + And the following "activities" exist: + | activity | course | name | custom | + | lesson | C1 | Test lesson name | 0 | + And I am on the "Test lesson name" "lesson activity" page logged in as teacher1 And I follow "Add a content page" And I set the following fields to these values: | Page title | First page name | @@ -42,9 +39,7 @@ Feature: In a lesson activity, if custom scoring is not enabled, student should | 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 - 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 "1 + 1?" diff --git a/mod/lesson/tests/behat/lesson_navigation.feature b/mod/lesson/tests/behat/lesson_navigation.feature index 61892e3a199..51bdbaf8424 100644 --- a/mod/lesson/tests/behat/lesson_navigation.feature +++ b/mod/lesson/tests/behat/lesson_navigation.feature @@ -16,14 +16,14 @@ 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" And I am on "Course 1" course homepage with editing mode on Scenario: Student navigation with pages and questions - Given I add a "Lesson" to section "1" and I fill the form with: - | Name | Test lesson name | - | Description | Test lesson description | - 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 +56,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,12 +85,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 I add a "Lesson" to section "1" and I fill the form with: - | Name | Test lesson name | - | Description | Test lesson description | + 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 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 | @@ -104,10 +100,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 80e5cf8f381..c7027736e2b 100644 --- a/mod/lesson/tests/behat/lesson_no_calendar_capabilities.feature +++ b/mod/lesson/tests/behat/lesson_no_calendar_capabilities.feature @@ -14,20 +14,20 @@ Feature: Lesson with no calendar capabilites And the following "course enrolments" exist: | user | course | role | | teacher1 | C1 | editingteacher | - And I log in as "admin" - And I am on "Course 1" course homepage + And the following "activity" exists: + | activity | lesson | + | course | C1 | + | idnumber | 0001 | + | name | Test lesson name | + And I am on the "Course 1" course page logged in as admin And I navigate to "Users > Permissions" in current page administration 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 - When I add a "Lesson" to section "1" and I fill the form with: - | Name | Test lesson name | - | Description | Test lesson description | + Given I am on the "Test lesson name" "lesson activity editing" page + And I set the following fields to these values: | id_available_enabled | 1 | | id_available_day | 1 | | id_available_month | 1 | @@ -36,11 +36,7 @@ Feature: Lesson with no calendar capabilites | id_deadline_day | 1 | | id_deadline_month | 2 | | id_deadline_year | 2017 | - 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 "Edit 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 a3a732f824e..3de44f2328d 100644 --- a/mod/lesson/tests/behat/lesson_number_of_student_attempts.feature +++ b/mod/lesson/tests/behat/lesson_number_of_student_attempts.feature @@ -22,20 +22,22 @@ Feature: In Dashboard, teacher can see the number of student attempts to lessons And I am on "Course 1" course homepage with editing mode on Scenario: number of student attempts - Given I add a "Lesson" to section "1" + Given the following "activity" exists: + | activity | lesson | + | course | C1 | + | idnumber | 0001 | + | name | Test lesson name | + | retake | 1 | + 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: - | Name | Test lesson name | - | Description | Test lesson description | | id_deadline_enabled | 1 | | deadline[day] | 1 | | deadline[month] | January | | deadline[year] | 2030 | | deadline[hour] | 08 | | deadline[minute] | 00 | - | 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 "True/false" And I press "Add a question page" @@ -76,10 +78,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 | @@ -116,10 +115,7 @@ 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 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 | @@ -137,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 a3daa905bf0..e7647cfda96 100644 --- a/mod/lesson/tests/behat/lesson_numerical_question_with_locale.feature +++ b/mod/lesson/tests/behat/lesson_numerical_question_with_locale.feature @@ -16,13 +16,10 @@ Feature: In a lesson activity, I need to edit pages in the lesson taking into ac And the following "language customisations" exist: | component | stringid | value | | core_langconfig | decsep | # | - 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 name | - | Description | Test lesson description | - | Allow student review | Yes | - And I follow "Test lesson name" + And the following "activities" exist: + | activity | name | course | idnumber | modattempts | + | lesson | Test lesson name | C1 | lesson1 | 1 | + And I am on the "Test lesson name" "lesson activity" page logged in as teacher1 And I follow "Add a question page" And I set the field "Select a question type" to "Numerical" And I press "Add a question page" @@ -38,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 click on "Edit" "link" in the "region-main" "region" 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 click on "Edit" "link" in the "region-main" "region" And I click on "Expanded" "link" in the "region-main" "region" 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 | @@ -73,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 | @@ -88,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 | @@ -107,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" + And I am on the "Test lesson name" "lesson activity" page Then I click on "Edit" "link" in the "region-main" "region" 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 c4eea60cd58..d31470bb6b9 100644 --- a/mod/lesson/tests/behat/lesson_outline_report.feature +++ b/mod/lesson/tests/behat/lesson_outline_report.feature @@ -15,15 +15,13 @@ Feature: Teachers can review student progress on all lessons in a course by view | 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 set the following fields to these values: - | Name | Test lesson name | - | Description | Test lesson description | - | Re-takes allowed | Yes | - And I press "Save and return to course" - And I follow "Test lesson name" + And the following "activity" exists: + | activity | lesson | + | course | C1 | + | idnumber | 0001 | + | name | Test lesson name | + | retake | 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" @@ -82,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" @@ -126,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" @@ -140,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" @@ -165,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 ed7307fdfe6..e8e8c57b5b0 100644 --- a/mod/lesson/tests/behat/lesson_practice.feature +++ b/mod/lesson/tests/behat/lesson_practice.feature @@ -19,10 +19,12 @@ Feature: Practice mode in a lesson activity And I log in as "teacher1" And I am on "Course 1" course homepage with editing mode on # Setup a basic lesson, we'll adjust it in the scenarios later. - And I add a "Lesson" to section "1" and I fill the form with: - | Name | Test lesson name | - | Description | Lesson description | - And I follow "Test lesson name" + And the following "activity" exists: + | activity | lesson | + | course | C1 | + | idnumber | 0001 | + | name | Test lesson name | + And I am on the "Test lesson name" "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" @@ -34,17 +36,13 @@ Feature: Practice mode in a lesson activity And I press "Save page" Scenario: Non-practice lesson records grades in the gradebook - Given I follow "Test lesson name" - And I navigate to "Edit 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: | 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" @@ -54,17 +52,13 @@ 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 follow "Test lesson name" - And I navigate to "Edit 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: | 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" @@ -74,18 +68,14 @@ 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 follow "Test lesson name" - And I navigate to "Edit 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: | 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 8cdc5773b0a..2678a689bda 100644 --- a/mod/lesson/tests/behat/lesson_progress_bar.feature +++ b/mod/lesson/tests/behat/lesson_progress_bar.feature @@ -16,13 +16,13 @@ Feature: In a lesson activity, students can see their progress viewing a progres | 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 name | - | Description | Test lesson description | + And the following "activities" exist: + | activity | name | course | idnumber | + | lesson | Test lesson name | C1 | lesson1 | + And I am on the "Test lesson name" "lesson activity editing" page logged in as teacher1 + And I set the following fields to these values: | Progress bar | Yes | - 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 | @@ -55,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 c7ff38a7c95..74c305a2a14 100644 --- a/mod/lesson/tests/behat/lesson_report.feature +++ b/mod/lesson/tests/behat/lesson_report.feature @@ -16,15 +16,10 @@ Feature: In a lesson activity, teachers can review student attempts | 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 set the following fields to these values: - | Name | Test lesson name | - | Description | Test lesson description | - | Re-takes allowed | Yes | - And I press "Save and return to course" - And I follow "Test lesson name" + And the following "activities" exist: + | activity | name | course | idnumber | retake | + | lesson | Test lesson name | C1 | lesson1 | 1 | + And I am on the "Test lesson name" "lesson activity" page logged in as teacher1 Scenario: View student attempts in a lesson containing both content and question pages Given I follow "Add a content page" @@ -78,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" @@ -99,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 follow "Reports" And I should see "Student 1" And I should see "100%" @@ -145,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" @@ -157,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 follow "Reports" 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 d6c32475e00..515f0f35b16 100644 --- a/mod/lesson/tests/behat/lesson_review.feature +++ b/mod/lesson/tests/behat/lesson_review.feature @@ -16,11 +16,11 @@ Feature: In a lesson activity, students can review the answers they gave to ques | 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 name | - | Description | Test lesson description | + And the following "activities" exist: + | activity | name | course | idnumber | + | lesson | Test lesson name | C1 | lesson1 | + And I am on the "Test lesson name" "lesson activity editing" page logged in as teacher1 + And I set the following fields to these values: | Display ongoing score | Yes | | Slideshow | Yes | | Maximum number of answers | 10 | @@ -28,7 +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 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" @@ -55,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 3c19a49b81c..a2316a87c9e 100644 --- a/mod/lesson/tests/behat/lesson_student_dashboard.feature +++ b/mod/lesson/tests/behat/lesson_student_dashboard.feature @@ -17,8 +17,8 @@ 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 | + | activity | name | deadline | retake | course | idnumber | + | lesson | Test lesson name | 1893481200 | 1 | C1 | lesson1 | And I log in as "teacher1" And I am on "Course 1" course homepage with editing mode on @@ -50,10 +50,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 +64,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 "Edit 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: | Re-takes allowed | 0 | And I press "Save and display" @@ -98,10 +94,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,7 +106,6 @@ 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" @@ -133,19 +125,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 "Edit 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: | Re-takes allowed | 0 | And I press "Save and display" @@ -165,15 +152,11 @@ 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" @@ -203,16 +186,12 @@ 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" @@ -232,14 +211,10 @@ 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" @@ -269,7 +244,6 @@ 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" @@ -289,7 +263,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,9 +273,9 @@ 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 | + | 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 turn editing mode off And I follow "Test lesson name" And I follow "Add a question page" @@ -314,8 +287,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 +297,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 +316,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 2a66d6c1cca..a4546db99d9 100644 --- a/mod/lesson/tests/behat/lesson_student_resume.feature +++ b/mod/lesson/tests/behat/lesson_student_resume.feature @@ -14,15 +14,13 @@ Feature: In a lesson activity a student should | 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 set the following fields to these values: - | Name | Test lesson name | - | Description | Test lesson description | - | Re-takes allowed | Yes | - And I press "Save and return to course" - And I follow "Test lesson name" + And the following "activity" exists: + | activity | lesson | + | name | Test lesson name | + | course | C1 | + | idnumber | 0001 | + | retake | 1 | + And I am on the "Test lesson name" "lesson activity" page logged in as teacher1 Scenario: resume a lesson with both content then question pages Given I follow "Add a content page" @@ -76,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. @@ -152,10 +147,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" @@ -173,12 +165,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" @@ -260,10 +248,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 | @@ -375,10 +360,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 ee46854f93e..3135cb50616 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 I should see "This lesson closed on 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 I should see "This lesson will be open on 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: @@ -264,8 +253,8 @@ Feature: Lesson user 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 I am on the "Lesson 2" "lesson activity" page logged in as teacher1 And I navigate to "User overrides" in current page administration Then I should see "No groups you can access." @@ -276,8 +265,8 @@ Feature: Lesson user 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 "groups" exist: | name | course | idnumber | | Group 1 | C1 | G1 | @@ -299,8 +288,8 @@ Feature: Lesson user 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 "groups" exist: | name | course | idnumber | | Group 1 | C1 | G1 | @@ -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 "User 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 f2ecf79c43d..56d32b340e4 100644 --- a/mod/lesson/tests/behat/lesson_with_clusters.feature +++ b/mod/lesson/tests/behat/lesson_with_clusters.feature @@ -16,14 +16,13 @@ Feature: In a lesson activity, students can see questions in random order | user | course | role | | teacher1 | C1 | editingteacher | | student1 | C1 | student | + And the following "activities" exist: + | activity | name | course | idnumber | + | lesson | Lesson with clusters | C1 | lesson1 | And I log in as "teacher1" - And I am on "Course 1" course homepage with editing mode on Scenario: Lesson with two clusters - Given I add a "Lesson" to section "1" and I fill the form with: - | Name | Lesson with clusters | - | Description | Test lesson description | - 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 6a85581e79a..d26cfc7ae0a 100644 --- a/mod/lesson/tests/behat/lesson_with_subcluster.feature +++ b/mod/lesson/tests/behat/lesson_with_subcluster.feature @@ -16,14 +16,14 @@ 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" And I am on "Course 1" course homepage with editing mode on Scenario: Lesson with subcluster - Given I add a "Lesson" to section "1" and I fill the form with: - | Name | Lesson with subcluster | - | Description | Test lesson description | - 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 +139,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 87b45ef4ac4..ecdbedeff9c 100644 --- a/mod/lesson/tests/behat/link_to_gradebook.feature +++ b/mod/lesson/tests/behat/link_to_gradebook.feature @@ -17,11 +17,10 @@ Feature: link to gradebook on the end of lesson page | 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 | - And I follow "Test lesson" + And the following "activities" exist: + | activity | name | course | idnumber | + | lesson | Test lesson | C1 | lesson1 | + And I am on the "Test lesson" "lesson activity" page And I follow "Add a content page" And I set the following fields to these values: | Page title | First page name | @@ -40,10 +39,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" @@ -53,30 +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 follow "Test lesson" - And I navigate to "Edit 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 follow "Test lesson" - And I navigate to "Edit 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" @@ -88,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 057620e6573..7e348eeaddf 100644 --- a/mod/lesson/tests/behat/password_protection.feature +++ b/mod/lesson/tests/behat/password_protection.feature @@ -16,24 +16,21 @@ Feature: A teacher can password protect 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 | - | Password protected lesson | Yes | - | id_password | moodle_rules | - And I follow "Test lesson" + And the following "activity" exists: + | activity | lesson | + | course | C1 | + | idnumber | 0001 | + | name | Test lesson | + | usepassword | 1 | + | password | moodle_rules | + And I am on the "Test lesson" "lesson activity" page logged in as teacher1 And I follow "Add a content page" And I set the following fields to these values: | Page title | First page name | | Page contents | First page contents | | Description | The first one | And I press "Save page" - 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 48a7767c892..e4dc8d3caf6 100644 --- a/mod/lesson/tests/behat/questions_images.feature +++ b/mod/lesson/tests/behat/questions_images.feature @@ -76,7 +76,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 a2effe14ca7..41d887611cd 100644 --- a/mod/lesson/tests/behat/teacher_grade_essays.feature +++ b/mod/lesson/tests/behat/teacher_grade_essays.feature @@ -33,13 +33,13 @@ Feature: In a lesson activity, a non editing teacher can grade essay questions | student1 | G1 | | student2 | G2 | | student3 | G3 | - 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 name | - | Description | Test lesson description | + And the following "activities" exist: + | activity | name | course | idnumber | + | lesson | Test lesson name | C1 | lesson1 | + And I am on the "Test lesson name" "lesson activity editing" page logged in as teacher1 + And I set the following fields to these values: | Group mode | Separate groups | - 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" @@ -47,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 follow "Grade essays" And I should see "Student 1" @@ -84,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 follow "Grade 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 544d3eaa7da..b9095b4e27c 100644 --- a/mod/lesson/tests/behat/wrong_answer_continue.feature +++ b/mod/lesson/tests/behat/wrong_answer_continue.feature @@ -16,12 +16,11 @@ Feature: An incorrect response to an answer with multiple attempts show appropri | 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 the following "activities" exist: + | 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: - | Name | Test lesson name | - | Description | Test lesson description | | Provide option to try a question again | Yes | | Maximum number of attempts per question | 2 | And I press "Save and display" @@ -45,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" @@ -73,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"