From 776f4bd80cbb784c707a4f495e95d5f2a3e28a07 Mon Sep 17 00:00:00 2001 From: Andrew Nicols Date: Wed, 21 Jul 2021 11:36:34 +0800 Subject: [PATCH] MDL-72179 behat: Make use of page resolvers --- .../tests/behat/get_and_set_fields.feature | 39 +-- .../tests/behat/course_competencies.feature | 23 +- .../tests/behat/backup_user_data.feature | 4 +- .../tests/behat/conditional_bug.feature | 6 +- .../tests/behat/availability_grade.feature | 18 +- .../tests/behat/availability_profile.feature | 3 +- badges/tests/behat/criteria_activity.feature | 10 +- .../behat/block_myoverview_progress.feature | 8 +- .../block_private_files_activity.feature | 2 +- ...ck_recentlyaccesseditems_dashboard.feature | 20 +- .../behat/restrict_activity_by_date.feature | 11 +- .../behat/restrict_activity_by_grade.feature | 38 +-- .../restrict_section_availability.feature | 9 +- ...ivity_navigation_with_restrictions.feature | 6 +- course/tests/behat/course_creation.feature | 7 +- .../behat/view_subfolders_inline.feature | 14 +- .../displayh5p/tests/behat/h5p_filter.feature | 46 +-- .../form/guide/tests/behat/edit_guide.feature | 17 +- .../rubric/tests/behat/edit_rubric.feature | 30 +- .../tests/behat/reuse_own_rubrics.feature | 11 +- .../grader/tests/behat/switch_views.feature | 11 +- .../tests/behat/bulk_insert_grades.feature | 11 +- grade/tests/behat/grade_point_maximum.feature | 44 ++- .../grade_regrade_do_not_override.feature | 6 +- grade/tests/behat/grade_scales.feature | 5 +- .../behat/grade_single_item_scales.feature | 5 +- lib/behat/classes/behat_generator_base.php | 42 +++ .../atto/plugins/h5p/tests/behat/h5p.feature | 56 +--- ...aderescale_for_database_pointscale.feature | 15 +- .../graderescale_for_forum_pointscale.feature | 14 +- ...aderescale_for_glossary_pointscale.feature | 15 +- ...graderescale_for_lesson_pointscale.feature | 13 +- .../tests/behat/modgrade_validation.feature | 51 +-- lib/tests/behat/alpha_chooser.feature | 3 +- lib/tests/behat/datetime_any.feature | 4 +- lib/tests/behat/permissionmanager.feature | 11 +- .../behat/notification_popover_unread.feature | 26 +- .../behat/assign_activity_completion.feature | 53 +-- mod/assign/tests/behat/grading_status.feature | 79 ++--- .../tests/behat/outcome_grading.feature | 46 ++- .../tests/behat/submit_without_group.feature | 57 ++-- .../behat/book_activity_completion.feature | 42 +-- mod/book/tests/behat/edit_tags.feature | 8 +- mod/book/tests/behat/log_entries.feature | 11 +- .../tests/behat/show_hide_chapters.feature | 21 +- .../generator/behat_mod_book_generator.php | 58 ++++ ...activity_info_completion_automatic.feature | 15 +- .../activity_info_completion_manual.feature | 26 +- mod/choice/tests/behat/behat_mod_choice.php | 5 +- mod/choice/tests/behat/modify_choice.feature | 48 +-- mod/data/tests/behat/add_entries.feature | 13 +- mod/data/tests/behat/behat_mod_data.php | 33 +- .../behat/data_activity_completion.feature | 60 ++-- mod/data/tests/behat/manageapproved.feature | 59 ++-- mod/feedback/tests/behat/anonymous.feature | 39 +-- .../tests/behat/behat_mod_feedback.php | 3 +- .../tests/behat/export_import.feature | 14 +- .../feedback_activity_completion.feature | 34 +- mod/feedback/tests/behat/groups.feature | 58 +--- mod/feedback/tests/behat/multichoice.feature | 41 +-- .../tests/behat/non_anonymous.feature | 17 +- .../tests/behat/question_types.feature | 21 +- .../behat/question_types_non_anon.feature | 20 +- .../tests/behat/show_nonrespondents.feature | 10 +- mod/feedback/tests/behat/templates.feature | 52 +-- .../behat/folder_activity_completion.feature | 33 +- .../summary/tests/behat/bulk_message.feature | 16 +- .../tests/behat/summary_data_access.feature | 12 +- .../tests/behat/summary_filter_groups.feature | 30 +- mod/forum/tests/behat/add_forum.feature | 2 +- mod/forum/tests/behat/advanced_search.feature | 42 +-- mod/forum/tests/behat/behat_mod_forum.php | 12 +- .../tests/behat/discussion_display.feature | 27 +- mod/forum/tests/behat/discussion_lock.feature | 21 +- .../behat/discussion_subscriptions.feature | 49 +-- mod/forum/tests/behat/edit_tags.feature | 17 +- .../tests/behat/favourite_discussion.feature | 26 +- .../behat/forum_activity_completion.feature | 46 +-- mod/forum/tests/behat/forum_export.feature | 12 +- .../forum_subscriptions_availability.feature | 21 +- .../behat/forum_subscriptions_default.feature | 61 +--- .../tests/behat/grade_view_discussion.feature | 8 +- .../tests/behat/posts_ordering_blog.feature | 23 +- .../behat/posts_ordering_general.feature | 22 +- mod/glossary/tests/behat/categories.feature | 10 +- mod/glossary/tests/behat/edit_tags.feature | 19 +- .../behat/entries_require_approval.feature | 30 +- .../glossary_activity_completion.feature | 45 +-- .../tests/behat/import_entries.feature | 4 +- .../behat/prevent_duplicate_entries.feature | 14 +- .../behat/print_friendly_version.feature | 32 +- .../tests/behat/search_entries.feature | 12 +- .../tests/behat/attempt_options.feature | 20 +- .../tests/behat/display_result_types.feature | 64 +--- .../tests/behat/grading_attempts.feature | 44 ++- .../behat/h5pactivity_completion.feature | 30 +- .../behat/inline_editing_content.feature | 36 +-- mod/h5pactivity/tests/behat/locking.feature | 17 +- .../tests/behat/recent_activity.feature | 14 +- .../tests/behat/result_fillin.feature | 4 +- .../tests/behat/result_longfillin.feature | 4 +- .../tests/behat/sending_attempt.feature | 7 +- .../behat/display_imscp_description.feature | 12 +- .../behat/imscp_activity_completion.feature | 26 +- .../tests/behat/duplicate_lesson_page.feature | 14 +- .../import_fillintheblank_question.feature | 11 +- mod/lesson/tests/behat/import_images.feature | 11 +- .../behat/lesson_activity_completion.feature | 35 +- .../tests/behat/lesson_course_reset.feature | 25 +- .../tests/behat/lesson_group_override.feature | 120 ++----- .../behat/lesson_question_attempts.feature | 19 +- .../tests/behat/lesson_user_override.feature | 102 ++---- .../tests/behat/questions_images.feature | 14 +- mod/lesson/tests/behat/time_limit.feature | 6 +- mod/lti/tests/behat/addtype.feature | 43 ++- .../behat/lti_activity_completion.feature | 53 +-- .../behat/page_activity_completion.feature | 133 ++++---- mod/page/tests/behat/page_appearance.feature | 58 +--- .../report/overview/tests/behat/basic.feature | 8 +- .../overview/tests/behat/regrading.feature | 12 +- .../responses/tests/behat/basic.feature | 18 +- .../statistics/tests/behat/basic.feature | 4 +- mod/quiz/tests/behat/add_quiz.feature | 7 +- mod/quiz/tests/behat/behat_mod_quiz.php | 10 +- .../tests/behat/completion_manual.feature | 9 +- .../editing_set_marks_no_attempts.feature | 5 +- .../editing_set_marks_with_attempts.feature | 9 +- .../resource_activity_completion.feature | 10 +- mod/scorm/tests/behat/add_scorm.feature | 4 +- ...ompletion_condition_require_status.feature | 93 ++---- .../tests/behat/multisco_review_mode.feature | 48 +-- .../behat/scorm_activity_completion.feature | 63 ++-- .../scorm_no_calendar_capabilities.feature | 7 +- mod/scorm/tests/generator/lib.php | 3 + .../behat/url_activity_completion.feature | 306 +++++++++++------- .../behat/collaborative_individual.feature | 47 ++- mod/wiki/tests/behat/edit_tags.feature | 22 +- mod/wiki/tests/behat/page_history.feature | 23 +- mod/wiki/tests/behat/preview_page.feature | 5 +- .../reset_wiki_comments_tags_files.feature | 30 +- .../behat/wiki_activity_completion.feature | 33 +- mod/wiki/tests/behat/wiki_comments.feature | 28 +- mod/wiki/tests/behat/wiki_formats.feature | 14 +- mod/wiki/tests/behat/wiki_search.feature | 91 ++---- .../behat/behat_workshopallocation_manual.php | 2 +- .../tests/behat/behat_mod_workshop.php | 8 +- .../tests/behat/embedded_images.feature | 4 +- .../tests/behat/file_type_restriction.feature | 23 +- .../tests/behat/grade_to_pass.feature | 52 +-- .../tests/behat/submission_types.feature | 18 +- .../workshop_activity_completion.feature | 48 +-- .../tests/behat/workshop_assessment.feature | 27 +- .../behat/workshop_late_submission.feature | 25 +- .../behat/workshop_section_remembered.feature | 9 +- .../behat/delete_question_activities.feature | 22 +- question/tests/behat/delete_questions.feature | 26 +- .../tests/behat/file_type_restriction.feature | 11 +- .../tests/behat/clearanswers.feature | 12 +- .../tests/behat/loglive_report.feature | 11 +- .../tests/behat/filter_participation.feature | 39 ++- .../tests/behat/message_participants.feature | 4 +- .../behat/activity_completion_report.feature | 36 +-- .../tests/behat/file_update.feature | 19 +- .../tests/behat/search_content.feature | 24 +- .../tests/behat/select_content.feature | 28 +- search/tests/behat/search_query.feature | 13 +- .../behat/regionmainsettingsmenu.feature | 18 +- 167 files changed, 1652 insertions(+), 2901 deletions(-) create mode 100644 mod/book/tests/generator/behat_mod_book_generator.php 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 3e37c589c2e64..83cb7504dd111 100644 --- a/admin/tool/behat/tests/behat/get_and_set_fields.feature +++ b/admin/tool/behat/tests/behat/get_and_set_fields.feature @@ -48,7 +48,7 @@ Feature: Verify that all form fields values can be get and set And the "Unenrol users" select box should not contain "Baker" And the "Unenrol users" select box should not contain "President, Baker" And I am on "Course 1" course homepage with editing mode on - And I follow "Test this one" + And I am on the "Test this one" "wiki activity" page And I press "Create page" # Text (textarea & editor) & Select (multi-select) - Checking "I set the following fields to these values". When I set the following fields to these values: @@ -61,8 +61,7 @@ Feature: Verify that all form fields values can be get and set # Checkbox - Checking "I set the field" and "The field matches value" ticked. And I set the field "Force format" to "1" And I press "Save and return to course" - And I should see "Test this one" - And I follow "Test this one" + And I am on the "Test this one" "wiki activity" page And I navigate to "Edit settings" in current page administration And I expand all fieldsets And the field "Force format" matches value "1" @@ -70,8 +69,7 @@ Feature: Verify that all form fields values can be get and set # Checkbox - Checking "I set the field" and "The field matches value" unticked. And I set the field "Force format" to "" And I press "Save and return to course" - And I should see "Test this one" - And I follow "Test this one" + And I am on the "Test this one" "wiki activity" page And I navigate to "Edit settings" in current page administration And I expand all fieldsets And the field "Force format" matches value "" @@ -80,8 +78,7 @@ Feature: Verify that all form fields values can be get and set And I set the following fields to these values: | Force format | 1 | And I press "Save and return to course" - And I should see "Test this one" - And I follow "Test this one" + And I am on the "Test this one" "wiki activity" page And I navigate to "Edit settings" in current page administration And I expand all fieldsets And the following fields match these values: @@ -92,8 +89,7 @@ Feature: Verify that all form fields values can be get and set And I set the following fields to these values: | Force format | | And I press "Save and return to course" - And I should see "Test this one" - And I follow "Test this one" + And I am on the "Test this one" "wiki activity" page And I navigate to "Edit settings" in current page administration And I expand all fieldsets And the following fields match these values: @@ -126,14 +122,13 @@ Feature: Verify that all form fields values can be get and set | section | 1 | | allowupdate | 1 | And I am on "Course 1" course homepage - And I follow "Test choice name" - And I navigate to "Edit settings" in current page administration + And I am on the "Test choice name" "choice activity editing" page And I set the field "Option 1" to "one" And I set the field "Option 2" to "two" And I set the field "Option 3" to "three" And I press "Save and return to course" And I am on "Course 1" course homepage - And I follow "Test choice name" + And I am on the "Test choice name" "choice activity" page And I set the field "one" to "1" And I press "Save my choice" And the field "one" matches value "1" @@ -183,31 +178,23 @@ Feature: Verify that all form fields values can be get and set And I press "Cancel" # Advanced checkbox requires real browser to allow uncheck to work. MDL-58681. MDL-55386. # Advanced checkbox - Checking "I set the field" and "The field matches value" ticked. - And I am on "Course 1" course homepage - And I follow "Test this one" - And I navigate to "Edit settings" in current page administration + And I am on the "Test choice name" "choice activity editing" page And I set the field "Display description on course page" to "1" And I press "Save and return to course" - And I should see "Test this one" - And I follow "Test this one" - And I navigate to "Edit settings" in current page administration + And I am on the "Test choice name" "choice activity editing" page And the field "Display description on course page" matches value "1" And the field "Display description on course page" does not match value "" # Advanced checkbox - Checking "I set the field" and "The field matches value" unticked. And I set the field "Display description on course page" to "" And I press "Save and return to course" - And I should see "Test this one" - And I follow "Test this one" - And I navigate to "Edit settings" in current page administration + And I am on the "Test choice name" "choice activity editing" page And the field "Display description on course page" matches value "" And the field "Display description on course page" does not match value "1" # Advanced checkbox - Checking "I set the following fields to these values:" and "The following fields match these values" ticked. And I set the following fields to these values: | Display description on course page | 1 | And I press "Save and return to course" - And I should see "Test this one" - And I follow "Test this one" - And I navigate to "Edit settings" in current page administration + And I am on the "Test choice name" "choice activity editing" page And the following fields match these values: | Display description on course page | 1 | And the following fields do not match these values: @@ -216,9 +203,7 @@ Feature: Verify that all form fields values can be get and set And I set the following fields to these values: | Display description on course page | | And I press "Save and return to course" - And I should see "Test this one" - And I follow "Test this one" - And I navigate to "Edit settings" in current page administration + And I am on the "Test choice name" "choice activity editing" page And the following fields match these values: | Display description on course page | | And the following fields do not match these values: diff --git a/admin/tool/lp/tests/behat/course_competencies.feature b/admin/tool/lp/tests/behat/course_competencies.feature index b3caddc7aaed9..7d901c7a0adec 100644 --- a/admin/tool/lp/tests/behat/course_competencies.feature +++ b/admin/tool/lp/tests/behat/course_competencies.feature @@ -24,9 +24,7 @@ Feature: See the competencies for an activity on the course competencies page. | activity | name | intro | course | idnumber | completion | completionview | | page | PageName1 | PageDesc1 | C1 | PAGE1 | 1 | 1 | | page | PageName2 | PageDesc2 | C1 | PAGE2 | 1 | 1 | - And I log in as "admin" - And I am on site homepage - And I follow "Course 1" + And I am on the "Course 1" course page logged in as admin And I follow "Competencies" And I press "Add competencies to course" And "Competency picker" "dialogue" should be visible @@ -36,9 +34,7 @@ Feature: See the competencies for an activity on the course competencies page. And "Competency picker" "dialogue" should be visible And I select "Test-Comp2" of the competency tree And I click on "Add" "button" in the "Competency picker" "dialogue" - And I am on "Course 1" course homepage - And I follow "PageName1" - And I navigate to "Edit settings" in current page administration + And I am on the PageName1 "page activity editing" page And I follow "Expand all" And I set the field "Course competencies" to "Test-Comp1" And I press "Save and return to course" @@ -46,10 +42,8 @@ Feature: See the competencies for an activity on the course competencies page. @javascript Scenario: Go to the competency course competencies page. - When I log in as "student1" - And I am on site homepage - And I follow "Course 1" - And I follow "Competencies" + Given I am on the "Course 1" course page logged in as student1 + When I follow "Competencies" Then I should see "Test-Comp1" And I should see "Test-Comp2" And I set the field "Filter competencies by resource or activity" to "PageName1" @@ -64,12 +58,5 @@ Feature: See the competencies for an activity on the course competencies page. @javascript Scenario: None course competencies page. - When I log in as "student1" - And I am on site homepage - And I follow "Course 1" - And I follow "PageName1" - Then I should see "Test page content" - And I am on site homepage - And I follow "Course 1" - And I follow "PageName1" + When I am on the PageName1 "page activity" page logged in as student1 Then I should see "Test page content" diff --git a/admin/tool/recyclebin/tests/behat/backup_user_data.feature b/admin/tool/recyclebin/tests/behat/backup_user_data.feature index 90af9cb592133..c24900d85920e 100644 --- a/admin/tool/recyclebin/tests/behat/backup_user_data.feature +++ b/admin/tool/recyclebin/tests/behat/backup_user_data.feature @@ -42,9 +42,7 @@ Feature: Backup user data | Feedback for the response 'True'. | So you think it is true | | Feedback for the response 'False'. | So you think it is false | And I log out - And I log in as "student1" - And I am on "Course 1" course homepage - And I follow "Quiz 1" + When I am on the "Quiz 1" "quiz activity" page logged in as student1 And I press "Attempt quiz now" And I click on "True" "radio" in the "First question" "question" And I click on "False" "radio" in the "Second question" "question" diff --git a/availability/condition/completion/tests/behat/conditional_bug.feature b/availability/condition/completion/tests/behat/conditional_bug.feature index 918251efaef90..ac524dcfcd8bb 100644 --- a/availability/condition/completion/tests/behat/conditional_bug.feature +++ b/availability/condition/completion/tests/behat/conditional_bug.feature @@ -48,10 +48,10 @@ Feature: Confirm that conditions on completion no longer cause a bug And I click on "Activity completion" "button" in the "Add restriction..." "dialogue" And I set the field with xpath "//div[contains(concat(' ', normalize-space(@class), ' '), ' availability-item ')][preceding-sibling::div]//select[@name='cm']" to "Page2" And I press "Save and return to course" - And I should see "Not available unless:" in the ".activity.glossary" "css_element" + Then I should see "Not available unless:" in the ".activity.glossary" "css_element" And I should see "The activity Page1 is marked complete" in the ".activity.glossary" "css_element" And I should see "The activity Page2 is marked complete" in the ".activity.glossary" "css_element" - And I follow "TestGlossary" # Behat will automatically check there is no error on this page. - Then I should see "TestGlossary" + And I am on the TestGlossary "glossary activity" page + And I should see "TestGlossary" diff --git a/availability/condition/grade/tests/behat/availability_grade.feature b/availability/condition/grade/tests/behat/availability_grade.feature index 5ec09bd66fe01..fc35b9b386260 100644 --- a/availability/condition/grade/tests/behat/availability_grade.feature +++ b/availability/condition/grade/tests/behat/availability_grade.feature @@ -86,13 +86,12 @@ Feature: availability_grade And I set the field "Minimum grade percentage (inclusive)" to "10" And I press "Save and return to course" + And I log out + # Log in as student without a grade yet. - When I log out - And I log in as "student1" - And I am on "Course 1" course homepage + When I am on the "A1" "assign activity" page logged in as student1 # Do the assignment. - And I follow "A1" And I click on "Add submission" "button" And I set the field "Online text" to "Q" And I click on "Save changes" "button" @@ -103,25 +102,22 @@ Feature: availability_grade And I should not see "P3" in the "region-main" "region" And I should not see "P4" in the "region-main" "region" And I should see "A1" in the "region-main" "region" + And I log out # Log back in as teacher. - When I log out - And I log in as "teacher1" - And I am on "Course 1" course homepage + When I am on the "A1" "assign activity" page logged in as teacher1 # Give the assignment 40%. - And I follow "A1" And I navigate to "View all submissions" in current page administration # Pick the grade link in the row that has s@example.com in it. And I click on "Grade" "link" in the "s@example.com" "table_row" And I set the field "Grade out of 100" to "40" And I click on "Save changes" "button" And I click on "Edit settings" "link" + And I log out # Log back in as student. - And I log out - And I log in as "student1" - And I am on "Course 1" course homepage + And I am on the "Course 1" course page logged in as student1 # Check pages are visible. Then I should see "P2" in the "region-main" "region" diff --git a/availability/condition/profile/tests/behat/availability_profile.feature b/availability/condition/profile/tests/behat/availability_profile.feature index 690bcd8dc2797..b616033c2d729 100644 --- a/availability/condition/profile/tests/behat/availability_profile.feature +++ b/availability/condition/profile/tests/behat/availability_profile.feature @@ -96,8 +96,7 @@ Feature: availability_profile And I click on "Save and return to course" "button" # Edit it again and check the setting still works. - When I follow "P1" - And I navigate to "Edit settings" in current page administration + When I am on the P1 "page activity editing" page And I expand all fieldsets Then the field "User profile field" matches value "Super field" And the field "Value to compare against" matches value "Bananaman" diff --git a/badges/tests/behat/criteria_activity.feature b/badges/tests/behat/criteria_activity.feature index 96bb361fec0a6..42b16f33c1ccb 100644 --- a/badges/tests/behat/criteria_activity.feature +++ b/badges/tests/behat/criteria_activity.feature @@ -51,19 +51,19 @@ Feature: Award badges based on activity completion And I log out Scenario: Student earns a badge using activity completion, but does not get passing grade - When I log in as "student1" + Given I log in as "student1" And I am on "Course 1" course homepage And the "Receive a grade" completion condition of "Test quiz name" is displayed as "failed" And the "Receive a pass grade or complete all available attempts" completion condition of "Test quiz name" is displayed as "todo" - And I follow "Test quiz name" + When I am on the "Test quiz name" "quiz activity" page And I press "Re-attempt quiz" And I set the field "False" to "1" And I press "Finish attempt ..." And I press "Submit all and finish" And I click on "Submit all and finish" "button" in the "Confirmation" "dialogue" And I log out - Then I log in as "teacher1" - And I am on "Course 1" course homepage + + And I am on the "Course 1" course page logged in as teacher1 And I navigate to "Badges > Manage badges" in current page administration And I follow "Course Badge" - And I should see "Recipients (1)" + Then I should see "Recipients (1)" diff --git a/blocks/myoverview/tests/behat/block_myoverview_progress.feature b/blocks/myoverview/tests/behat/block_myoverview_progress.feature index 17ecfb647237e..00602ab7f48dc 100644 --- a/blocks/myoverview/tests/behat/block_myoverview_progress.feature +++ b/blocks/myoverview/tests/behat/block_myoverview_progress.feature @@ -27,9 +27,7 @@ Feature: Course overview block show users their progress on courses Then I should not see "0%" in the "Course overview" "block" Scenario: User complete activity and verify his progress - Given I log in as "teacher1" - And I am on "Course 1" course homepage with editing mode on - And I follow "Test choice 1" + Given I am on the "Test choice 1" "choice activity" page logged in as teacher1 And I navigate to "Edit settings" in current page administration And I set the following fields to these values: | Completion tracking | Show activity as complete when conditions are met | @@ -40,8 +38,8 @@ Feature: Course overview block show users their progress on courses And I click on "All (except removed from view)" "button" in the "Course overview" "block" Then I should see "Course 1" in the "Course overview" "block" And I should see "0%" in the "Course overview" "block" - And I am on "Course 1" course homepage - And I follow "Test choice 1" + + And I am on the "Test choice 1" "choice activity" page And I follow "Dashboard" in the user menu And I click on "All (except removed from view)" "button" in the "Course overview" "block" And I should see "100%" in the "Course overview" "block" diff --git a/blocks/private_files/tests/behat/block_private_files_activity.feature b/blocks/private_files/tests/behat/block_private_files_activity.feature index fb8437712f1fb..0486531a96efe 100644 --- a/blocks/private_files/tests/behat/block_private_files_activity.feature +++ b/blocks/private_files/tests/behat/block_private_files_activity.feature @@ -19,7 +19,7 @@ Feature: The private files block allows users to store files privately in moodle | page | C1 | page1 | Test page name | Test page description | And I log in as "teacher1" And I am on "Course 1" course homepage with editing mode on - And I follow "Test page name" + And I am on the "Test page name" "page activity" page And I add the "Private files" block And I should see "No files available" in the "Private files" "block" When I follow "Manage private files..." diff --git a/blocks/recentlyaccesseditems/tests/behat/block_recentlyaccesseditems_dashboard.feature b/blocks/recentlyaccesseditems/tests/behat/block_recentlyaccesseditems_dashboard.feature index ae73b426f4d5e..f635459c7ae6e 100644 --- a/blocks/recentlyaccesseditems/tests/behat/block_recentlyaccesseditems_dashboard.feature +++ b/blocks/recentlyaccesseditems/tests/behat/block_recentlyaccesseditems_dashboard.feature @@ -16,24 +16,20 @@ Feature: The recently accessed items block allows users to easily access their m | user | course | role | | student1 | C1 | student | | student1 | C2 | student | - And I log in as "admin" - And I am on "Course 1" course homepage - And I turn editing mode on - And I add a "Forum" to section "1" and I fill the form with: - | Forum name | Test forum name | - | Forum type | Standard forum for general use | - | Description | Test forum description | - And I log out + And the following "activity" exists: + | course | C1 | + | activity | forum | + | idnumber | Test forum name | + | name | Test forum name | And I log in as "student1" - When I press "Customise this page" + And I press "Customise this page" And I add the "Recently accessed items" block Scenario: User has not accessed any item Then I should see "No recent items" in the "Recently accessed items" "block" Scenario: User has accessed some items - Given I am on "Course 1" course homepage - When I follow "Test forum name" + Given I change window size to "large" + When I am on the "Test forum name" "forum activity" page And I follow "Dashboard" in the user menu - And I change window size to "large" Then I should see "Test forum name" in the "Recently accessed items" "block" diff --git a/completion/tests/behat/restrict_activity_by_date.feature b/completion/tests/behat/restrict_activity_by_date.feature index 551243d8e5d2a..211f643323eb0 100644 --- a/completion/tests/behat/restrict_activity_by_date.feature +++ b/completion/tests/behat/restrict_activity_by_date.feature @@ -36,12 +36,10 @@ Feature: Restrict activity availability through date conditions | x[year] | 2037 | And I press "Save and return to course" 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 I should see "Available from 31 December 2037" + And "Test assignment 1" "link" should not exist in the "page" "region" And "Test assignment 1" activity should be dimmed - And "Test assignment 1" "link" should not exist - And I log out @javascript Scenario: Show activity hidden to students when available until date is in past @@ -60,6 +58,5 @@ Feature: Restrict activity availability through date conditions And I click on ".availability-item .availability-eye img" "css_element" And I press "Save and return to course" And I log out - When I log in as "student1" - And I am on "Course 1" course homepage - Then I should not see "Test assignment 2" + When I am on the "Course 1" course page logged in as student1 + Then I should not see "Test assignment 2" in the "page" "region" diff --git a/completion/tests/behat/restrict_activity_by_grade.feature b/completion/tests/behat/restrict_activity_by_grade.feature index f7cd860340bf0..5dee506ca023d 100644 --- a/completion/tests/behat/restrict_activity_by_grade.feature +++ b/completion/tests/behat/restrict_activity_by_grade.feature @@ -17,13 +17,16 @@ Feature: Restrict activity availability through grade conditions | user | course | role | | teacher1 | C1 | editingteacher | | student1 | C1 | student | - And I log in as "teacher1" + And the following "activity" exists: + | course | C1 | + | activity | assign | + | idnumber | Grade assignment | + | name | Grade assignment | + | assignsubmission_onlinetext_enabled | 1 | + | assignsubmission_file_enabled | 0 | + | submissiondrafts | 0 | + And I am on the "Course 1" course page logged in as teacher1 And I am on "Course 1" course homepage with editing mode on - And I add a "Assignment" to section "1" and I fill the form with: - | Assignment name | Grade assignment | - | Description | Grade this assignment to revoke restriction on restricted assignment | - | assignsubmission_onlinetext_enabled | 1 | - | assignsubmission_file_enabled | 0 | # Adding the page like this because id_availableform_enabled needs to be clicked to trigger the action. And I add a "Page" to section "2" And I expand all fieldsets @@ -31,15 +34,15 @@ Feature: Restrict activity availability through grade conditions And I click on "Grade" "button" in the "Add restriction..." "dialogue" And I click on "min" "checkbox" And I set the following fields to these values: - | Name | Test page name | - | Description | Restricted page, till grades in Grade assignment is at least 20% | - | Page content | Test page contents | - | id | Grade assignment | - | minval | 20 | + | Name | Test page name | + | Description | Restricted page, till grades in Grade assignment is at least 20% | + | Page content | Test page contents | + | id | Grade assignment | + | minval | 20 | And I press "Save and return to course" 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 I should see "Not available unless: You achieve a required score in Grade assignment" And "Test page name" activity should be dimmed And "Test page name" "link" should not exist @@ -50,9 +53,8 @@ Feature: Restrict activity availability through grade conditions And I press "Save changes" And I should see "Submitted for grading" And I log out - And I log in as "teacher1" - And I am on "Course 1" course homepage - And I follow "Grade assignment" + + And I am on the "Grade assignment" "assign activity" page logged in as teacher1 And I navigate to "View all submissions" in current page administration And I click on "Grade" "link" in the "Student First" "table_row" And I set the following fields to these values: @@ -60,7 +62,7 @@ Feature: Restrict activity availability through grade conditions And I press "Save changes" And I follow "Edit settings" And I log out - And I log in as "student1" - And I am on "Course 1" course homepage + + And I am on the "Course 1" course page logged in as student1 And "Test page name" activity should be visible And I should not see "Not available unless: You achieve a required score in Grade assignment" diff --git a/completion/tests/behat/restrict_section_availability.feature b/completion/tests/behat/restrict_section_availability.feature index f1550de3a1f8a..9a525b982e8f7 100644 --- a/completion/tests/behat/restrict_section_availability.feature +++ b/completion/tests/behat/restrict_section_availability.feature @@ -76,16 +76,14 @@ Feature: Restrict sections availability through completion or grade conditions And I am on "Course 1" course homepage Then I should see "Not available unless: You achieve a required score in Grade assignment" And "Test page name" activity should be hidden - And I follow "Grade assignment" + And I am on the "Grade assignment" "assign activity" page And I press "Add submission" And I set the following fields to these values: | Online text | I'm the student submission | And I press "Save changes" And I should see "Submitted for grading" And I log out - And I log in as "teacher1" - And I am on "Course 1" course homepage - And I follow "Grade assignment" + And I am on the "Grade assignment" "assign activity" page logged in as teacher1 And I navigate to "View all submissions" in current page administration And I click on "Grade" "link" in the "Student First" "table_row" And I set the following fields to these values: @@ -93,7 +91,6 @@ Feature: Restrict sections availability through completion or grade conditions And I press "Save changes" And I follow "Edit settings" And I log out - And I log in as "student1" - And I am on "Course 1" course homepage + And I am on the "Course 1" Course page logged in as student1 And "Test page name" activity should be visible And I should not see "Not available unless: You achieve a required score in Grade assignment" diff --git a/course/tests/behat/activity_navigation_with_restrictions.feature b/course/tests/behat/activity_navigation_with_restrictions.feature index e8b44efb71ea4..5677c15dd69cc 100644 --- a/course/tests/behat/activity_navigation_with_restrictions.feature +++ b/course/tests/behat/activity_navigation_with_restrictions.feature @@ -45,9 +45,7 @@ Feature: Activity navigation involving activities with access restrictions @javascript Scenario: Activity navigation involving activities with access restrictions - Given I log in as "student1" - And I am on "Course 1" course homepage - When I follow "Page 1" + Given I am on the "Page 1" "page activity" page logged in as student1 Then I should see "Page 2" in the "#next-activity-link" "css_element" # Activity that has access restriction should not show up in the dropdown. And the "Jump to..." select box should not contain "Page 3" @@ -56,7 +54,7 @@ Feature: Activity navigation involving activities with access restrictions And I should see "Page 2" in the "#prev-activity-link" "css_element" And the "Jump to..." select box should not contain "Page 3" # Navigate to Page 2. - And I follow "Page 2" + And I click on "Page 2" "link" in the "page-content" "region" # Since Page 2 has now been viewed and deemed completed, Page 3 can now be accessed. And I should see "Page 3" in the "#next-activity-link" "css_element" And the "Jump to..." select box should contain "Page 3" diff --git a/course/tests/behat/course_creation.feature b/course/tests/behat/course_creation.feature index 859afcc8e0773..72eaf945e0503 100644 --- a/course/tests/behat/course_creation.feature +++ b/course/tests/behat/course_creation.feature @@ -20,15 +20,12 @@ Feature: Managers can create courses When I log in as "teacher1" And I am on "Course 1" course homepage with editing mode on And I add the "Latest announcements" block - Then "Latest announcements" "block" should exist - And I follow "Announcements" + And I am on the Announcements "forum activity" page And "Add a new topic" "link" should exist And "Subscription mode > Forced subscription" "link" should not exist in current page administration And "Subscription mode > Forced subscription" "text" should exist in current page administration And I log out - And I log in as "student1" - And I am on "Course 1" course homepage - And I follow "Announcements" + And I am on the Announcements "forum activity" page logged in as student1 And "Add a new topic" "link" should not exist And "Forced subscription" "text" should exist in current page administration diff --git a/course/tests/behat/view_subfolders_inline.feature b/course/tests/behat/view_subfolders_inline.feature index b620e70071046..edd547cdb591e 100644 --- a/course/tests/behat/view_subfolders_inline.feature +++ b/course/tests/behat/view_subfolders_inline.feature @@ -20,8 +20,7 @@ Feature: View subfolders in a course in-line | Name | Test folder | | Display folder contents | On a separate page | | Show subfolders expanded | | - And I should see "Test folder" - And I follow "Test folder" + And I am on the "Test folder" "folder activity" page And I press "Edit" And I press "Create folder" And I set the field "New folder name" to "Test subfolder 1" @@ -32,7 +31,7 @@ Feature: View subfolders in a course in-line Scenario: Add a folder with two subfolders - view on separate page Given I am on "Course 1" course homepage And I should not see "Test subfolder 1" - And I follow "Test folder" + And I am on the "Test folder" "folder activity" page And I should see "Test subfolder 1" And I press "Edit" And I press "Create folder" @@ -41,13 +40,13 @@ Feature: View subfolders in a course in-line And I press "Save changes" When I am on "Course 1" course homepage Then I should not see "Test subfolder 2" - And I follow "Test folder" + And I am on the "Test folder" "folder activity" page And I should see "Test subfolder 2" - Given I navigate to "Edit settings" in current page administration + And I am on the "Test folder" "folder activity editing" page And I set the field "Show subfolders expanded" to "1" When I am on "Course 1" course homepage Then I should not see "Test subfolder 2" - And I follow "Test folder" + And I am on the "Test folder" "folder activity" page And I should see "Test subfolder 2" @javascript @@ -63,8 +62,7 @@ Feature: View subfolders in a course in-line And I press "Save and return to course" Then I should see "Test subfolder 1" And I should not see "Test sub subfolder" - Given I open "Test folder" actions menu - When I click on "Edit settings" "link" in the "Test folder" activity + And I am on the "Test folder" "folder activity editing" page And I set the field "Show subfolders expanded" to "1" And I press "Save and return to course" Then I should see "Test subfolder 1" diff --git a/filter/displayh5p/tests/behat/h5p_filter.feature b/filter/displayh5p/tests/behat/h5p_filter.feature index 2a68e7902d42f..fe3fd469dd801 100644 --- a/filter/displayh5p/tests/behat/h5p_filter.feature +++ b/filter/displayh5p/tests/behat/h5p_filter.feature @@ -24,10 +24,7 @@ Feature: Render H5P content using filters @javascript @external Scenario: Render an external H5P content URL. - Given I log in as "teacher1" - And I am on "Course 1" course homepage - And I follow "PageName1" - And I navigate to "Edit settings" in current page administration + Given I am on the PageName1 "page activity editing" page logged in as teacher1 And I set the field "Page content" to "
Go for it
https://moodle.h5p.com/content/1290772960722742119/embed" When I click on "Save and display" "button" And I wait until the page is ready @@ -36,10 +33,7 @@ Feature: Render H5P content using filters @javascript Scenario: Add an external H5P content URL in a link with the URL. Should be rendered. - Given I log in as "teacher1" - And I am on "Course 1" course homepage - And I follow "PageName1" - And I navigate to "Edit settings" in current page administration + Given I am on the PageName1 "page activity editing" page logged in as teacher1 # This content won't be displayed, so this scenario shouldn't be labeled as external. And I set the field "Page content" to "https://moodle.h5p.com/content/1290772960722742119/embed" When I click on "Save and display" "button" @@ -48,10 +42,7 @@ Feature: Render H5P content using filters Then I should see "Lorum ipsum" Scenario: Add an external H5P content URL in a link with text. Shouldn't be rendered. - Given I log in as "teacher1" - And I am on "Course 1" course homepage - And I follow "PageName1" - And I navigate to "Edit settings" in current page administration + Given I am on the PageName1 "page activity editing" page logged in as teacher1 # This content won't be displayed, so this scenario shouldn't be labeled as external. And I set the field "Page content" to "Here you are the content" When I click on "Save and display" "button" @@ -67,8 +58,7 @@ Feature: Render H5P content using filters | Name | ipsumFile | And I upload "h5p/tests/fixtures/ipsums.h5p" file to "Select files" filemanager And I press "Save and return to course" - And I follow "PageName1" - And I navigate to "Edit settings" in current page administration + And I am on the PageName1 "page activity editing" page And I click on "Insert H5P" "button" in the "#fitem_id_page" "css_element" And I click on "Browse repositories..." "button" in the "Insert H5P" "dialogue" And I click on "Server files" "link" in the ".fp-repo-area" "css_element" @@ -85,9 +75,7 @@ Feature: Render H5P content using filters Then I should see "Lorum ipsum" And I switch to the main frame And I log out - And I log in as "student1" - And I am on "Course 1" course homepage - And I follow "PageName1" + And I am on the PageName1 "page activity" page logged in as student1 # Switch to iframe created by filter And I switch to "h5p-iframe" class iframe # Switch to iframe created by embed.php page @@ -104,8 +92,7 @@ Feature: Render H5P content using filters | Name | ipsumFile | And I upload "h5p/tests/fixtures/ipsums.h5p" file to "Select files" filemanager And I press "Save and return to course" - And I follow "PageName1" - And I navigate to "Edit settings" in current page administration + And I am on the PageName1 "page activity editing" page And I click on "Insert H5P" "button" in the "#fitem_id_page" "css_element" And I click on "Browse repositories..." "button" in the "Insert H5P" "dialogue" And I click on "Server files" "link" in the ".fp-repo-area" "css_element" @@ -129,8 +116,7 @@ Feature: Render H5P content using filters | Name | ipsumFileTeacher | And I upload "h5p/tests/fixtures/ipsums.h5p" file to "Select files" filemanager And I press "Save and return to course" - And I follow "PageName1" - And I navigate to "Edit settings" in current page administration + And I am on the PageName1 "page activity editing" page And I click on "Insert H5P" "button" in the "#fitem_id_page" "css_element" And I click on "Browse repositories..." "button" in the "Insert H5P" "dialogue" And I click on "Server files" "link" in the ".fp-repo-area" "css_element" @@ -153,8 +139,7 @@ Feature: Render H5P content using filters | Name | ipsumFile | And I upload "h5p/tests/fixtures/ipsums.h5p" file to "Select files" filemanager And I press "Save and return to course" - And I follow "PageName2" - And I navigate to "Edit settings" in current page administration + And I am on the PageName2 "page activity editing" page And I click on "Insert H5P" "button" in the "#fitem_id_page" "css_element" And I click on "Browse repositories..." "button" in the "Insert H5P" "dialogue" And I click on "Server files" "link" in the ".fp-repo-area" "css_element" @@ -172,9 +157,7 @@ Feature: Render H5P content using filters And I should see "Lorum ipsum" And I switch to the main frame And I log out - When I log in as "teacher1" - And I am on "Course 1" course homepage - And I follow "PageName1" + And I am on the PageName1 "page activity" page logged in as teacher1 # Switch to iframe created by filter And I switch to "h5p-iframe" class iframe # Switch to iframe created by embed.php page @@ -195,9 +178,8 @@ Feature: Render H5P content using filters And I click on "Upload H5P content types" "button" in the "#fitem_id_uploadlibraries" "css_element" And I click on "Disable" "link" in the "Accordion" "table_row" # Add H5P content to the page. - And I am on "Course 1" course homepage with editing mode on - And I follow "PageName1" - And I navigate to "Edit settings" in current page administration + And I am on "Course 1" course homepage + And I am on the PageName1 "page activity editing" page When I click on "Insert H5P" "button" in the "#fitem_id_page" "css_element" And I click on "Browse repositories..." "button" in the "Insert H5P" "dialogue" And I click on "Private files" "link" in the ".fp-repo-area" "css_element" @@ -212,9 +194,8 @@ Feature: Render H5P content using filters And I switch to the main frame And I navigate to "H5P > Manage H5P content types" in site administration And I click on "Enable" "link" in the "Accordion" "table_row" - And I am on "Course 1" course homepage # Content should be deployed now that main library is enabled. - And I follow "PageName1" + And I am on the PageName1 "page activity" page # Switch to iframe created by filter. And I switch to "h5p-iframe" class iframe # Switch to iframe created by embed.php page. @@ -224,9 +205,8 @@ Feature: Render H5P content using filters And I switch to the main frame And I navigate to "H5P > Manage H5P content types" in site administration And I click on "Disable" "link" in the "Accordion" "table_row" - And I am on "Course 1" course homepage # Library is disabled again, so an error should be displayed. - And I follow "PageName1" + And I am on the PageName1 "page activity" page And I switch to "h5p-iframe" class iframe And I should see "This file can't be displayed because its content type is disabled." And I should not see "Lorum ipsum" diff --git a/grade/grading/form/guide/tests/behat/edit_guide.feature b/grade/grading/form/guide/tests/behat/edit_guide.feature index 55e93eef85c62..3a1086b641932 100644 --- a/grade/grading/form/guide/tests/behat/edit_guide.feature +++ b/grade/grading/form/guide/tests/behat/edit_guide.feature @@ -20,7 +20,7 @@ Feature: Marking guides can be created and edited | activity | assign | | course | C1 | | idnumber | assign1 | - | name | Test assignment 1 name | + | name | Test assignment 1 name | | intro | Test assignment description | | section | 1 | | assignsubmission_file_enabled | 1 | @@ -30,10 +30,7 @@ Feature: Marking guides can be created and edited | assignfeedback_comments_enabled | 1 | | assignfeedback_file_enabled | 1 | | assignfeedback_comments_commentinline | 1 | - And I log in as "teacher1" - And I am on "Course 1" course homepage - And I follow "Test assignment 1 name" - And I navigate to "Edit settings" in current page administration + And I am on the "Test assignment 1 name" "assign activity editing" page logged in as teacher1 And I set the following fields to these values: | Grading method | Marking guide | And I press "Save and return to course" @@ -65,7 +62,8 @@ Feature: Marking guides can be created and edited @javascript Scenario: Deleting criterion and comment # Deleting criterion - When I go to "Test assignment 1 name" advanced grading definition page + When I am on "Course 1" course homepage + And I go to "Test assignment 1 name" advanced grading definition page And I click on "Delete criterion" "button" in the "Guide criterion B" "table_row" And I press "Yes" And I press "Save" @@ -74,7 +72,8 @@ Feature: Marking guides can be created and edited And I should see "WARNING: Your marking guide has a maximum grade of 70 points" But I should not see "Guide criterion B" # Deleting a frequently used comment - When I go to "Test assignment 1 name" advanced grading definition page + When I am on "Course 1" course homepage + And I go to "Test assignment 1 name" advanced grading definition page And I click on "Delete comment" "button" in the "Comment 3" "table_row" And I press "Yes" And I press "Save" @@ -105,9 +104,7 @@ Feature: Marking guides can be created and edited Then I should see "80" in the "Student 1" "table_row" And I log out # Viewing it as a student. - And I log in as "student1" - And I am on "Course 1" course homepage - And I follow "Test assignment 1 name" + And I am on the "Test assignment 1 name" "assign activity" page logged in as student1 And I should see "80" in the ".feedback" "css_element" And I should see "Marking guide test description" in the ".feedback" "css_element" And I should see "Very good" diff --git a/grade/grading/form/rubric/tests/behat/edit_rubric.feature b/grade/grading/form/rubric/tests/behat/edit_rubric.feature index 4fbde356c76c2..07f3d9adac150 100644 --- a/grade/grading/form/rubric/tests/behat/edit_rubric.feature +++ b/grade/grading/form/rubric/tests/behat/edit_rubric.feature @@ -70,9 +70,7 @@ Feature: Rubrics can be created and edited And I should see "35" in the "Student 1" "table_row" And I log out # Viewing it as a student. - And I log in as "student1" - And I am on "Course 1" course homepage - And I follow "Test assignment 1 name" + And I am on the "Test assignment 1 name" "assign activity" page logged in as student1 And I should see "35" in the ".feedback" "css_element" And I should see "Rubric test description" in the ".feedback" "css_element" And I should see "In general... work harder..." @@ -80,8 +78,7 @@ Feature: Rubrics can be created and edited And the level with "20" points is selected for the rubric criterion "Criterion 1" And the level with "5" points is selected for the rubric criterion "Criterion 3" 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 # Editing a rubric definition without regrading students. And I go to "Test assignment 1 name" advanced grading definition page And "Save as draft" "button" should not exist @@ -93,9 +90,7 @@ Feature: Rubrics can be created and edited And I press "Continue" And I log out # Check that the student still sees the grade. - And I log in as "student1" - And I am on "Course 1" course homepage - And I follow "Test assignment 1 name" + And I am on the "Test assignment 1 name" "assign activity" page logged in as student1 And I should see "35" in the ".feedback" "css_element" And the level with "20" points is selected for the rubric criterion "Criterion 1" And I log out @@ -110,30 +105,23 @@ Feature: Rubrics can be created and edited And I press "Continue" And I log out # Check that the student doesn't see the grade. - And I log in as "student1" - And I am on "Course 1" course homepage - And I follow "Test assignment 1 name" + And I am on the "Test assignment 1 name" "assign activity" page logged in as student1 And I should see "35" in the ".feedback" "css_element" And the level with "20" points is not selected for the rubric criterion "Criterion 1" And I log out # Regrade student. - And I log in as "teacher1" - And I am on "Course 1" course homepage - And I follow "Test assignment 1 name" + And I am on the "Test assignment 1 name" "assign activity" page logged in as teacher1 And I go to "Student 1" "Test assignment 1 name" activity advanced grading page And I should see "The rubric definition was changed after this student had been graded. The student can not see this rubric until you check the rubric and update the grade." And I save the advanced grading form And I log out # Check that the student sees the grade again. - And I log in as "student1" - And I am on "Course 1" course homepage - And I follow "Test assignment 1 name" + And I am on the "Test assignment 1 name" "assign activity" page logged in as student1 And I should see "31.82" in the ".feedback" "css_element" And the level with "20" points is not selected for the rubric criterion "Criterion 1" # Hide all rubric info for students 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 I go to "Test assignment 1 name" advanced grading definition page And I set the field "Allow users to preview rubric (otherwise it will only be displayed after grading)" to "" And I set the field "Display rubric description during evaluation" to "" @@ -145,9 +133,7 @@ Feature: Rubrics can be created and edited And I press "Continue" And I log out # Students should not see anything. - And I log in as "student1" - And I am on "Course 1" course homepage - And I follow "Test assignment 1 name" + And I am on the "Test assignment 1 name" "assign activity" page logged in as student1 And I should not see "Criterion 1" in the ".submissionstatustable" "css_element" And I should not see "Criterion 2" in the ".submissionstatustable" "css_element" And I should not see "Criterion 3" in the ".submissionstatustable" "css_element" diff --git a/grade/grading/form/rubric/tests/behat/reuse_own_rubrics.feature b/grade/grading/form/rubric/tests/behat/reuse_own_rubrics.feature index be777a00e28ad..7b23b33aa9205 100644 --- a/grade/grading/form/rubric/tests/behat/reuse_own_rubrics.feature +++ b/grade/grading/form/rubric/tests/behat/reuse_own_rubrics.feature @@ -18,10 +18,7 @@ Feature: Reuse my rubrics in other activities | activity | name | intro | course | section | idnumber | | assign | Test assignment 1 name | Test assignment 1 description | C1 | 1 | assign1 | | assign | Test assignment 2 name | Test assignment 2 description | C1 | 1 | assign1 | - And I log in as "teacher1" - And I am on "Course 1" course homepage - And I follow "Test assignment 1" - And I navigate to "Edit settings" in current page administration + And I am on the "Test assignment 1 name" "assign activity editing" page logged in as teacher1 And I set the following fields to these values: | Grading method | Rubric | And I press "Save and return to course" @@ -34,10 +31,7 @@ Feature: Reuse my rubrics in other activities | Criterion 2 | Level 21 | 21 | Level 22 | 22 | Level 3 | 23 | | Criterion 3 | Level 31 | 31 | Level 32 | 32 | | | And I press "Save rubric and make it ready" - And I am on "Course 1" course homepage - And I am on "Course 1" course homepage - And I follow "Test assignment 2" - And I navigate to "Edit settings" in current page administration + And I am on the "Test assignment 2 name" "assign activity editing" page And I set the following fields to these values: | Grading method | Rubric | And I press "Save and return to course" @@ -51,7 +45,6 @@ Feature: Reuse my rubrics in other activities And I should see "Criterion 1" And I should see "Criterion 2" And I should see "Criterion 3" - And I press "Cancel" @javascript Scenario: A teacher can reuse one of his/her previously created rubrics, with Javascript enabled diff --git a/grade/report/grader/tests/behat/switch_views.feature b/grade/report/grader/tests/behat/switch_views.feature index 7cd066a0a9856..388bdee64fd3c 100644 --- a/grade/report/grader/tests/behat/switch_views.feature +++ b/grade/report/grader/tests/behat/switch_views.feature @@ -28,16 +28,13 @@ Feature: We can change what we are viewing on the grader report | Description | Submit your online text | | assignsubmission_onlinetext_enabled | 1 | And I log out - And I log in as "student1" - And I am on "Course 1" course homepage - And I follow "Test assignment name 1" + And I am on the "Test assignment name 1" "assign activity" page logged in as student1 When I press "Add submission" And I set the following fields to these values: | Online text | This is a submission for assignment 1 | And I press "Save changes" Then I should see "Submitted for grading" - And I am on "Course 1" course homepage - And I follow "Test assignment name 2" + And I am on the "Test assignment name 2" "assign activity" page When I press "Add submission" And I set the following fields to these values: | Online text | This is a submission for assignment 2 | @@ -55,7 +52,7 @@ Feature: We can change what we are viewing on the grader report @javascript Scenario: View and minimise the grader report containing hidden activities - And I am on "Course 1" course homepage with editing mode on + When I am on "Course 1" course homepage with editing mode on And I open "Test assignment name 2" actions menu And I click on "Hide" "link" in the "Test assignment name 2" activity And I am on "Course 1" course homepage @@ -83,7 +80,7 @@ Feature: We can change what we are viewing on the grader report @javascript Scenario: View and minimise the grader report containing hidden activities without the 'moodle/grade:viewhidden' capability - And I am on "Course 1" course homepage with editing mode on + When I am on "Course 1" course homepage with editing mode on And I open "Test assignment name 2" actions menu And I click on "Hide" "link" in the "Test assignment name 2" activity And I log out diff --git a/grade/report/singleview/tests/behat/bulk_insert_grades.feature b/grade/report/singleview/tests/behat/bulk_insert_grades.feature index 6fd73ff077d88..ba2f55c0296ac 100644 --- a/grade/report/singleview/tests/behat/bulk_insert_grades.feature +++ b/grade/report/singleview/tests/behat/bulk_insert_grades.feature @@ -30,9 +30,7 @@ Feature: We can bulk insert grades for students in a course | assign | C1 | a4 | Test assignment four | Submit nothing! | Scenario: I can bulk insert grades and check their override flags for grade view. - Given I log in as "teacher1" - And I am on "Course 1" course homepage - And I follow "Test assignment one" + Given I am on the "Test assignment one" "assign activity" page logged in as teacher1 And I navigate to "View all submissions" in current page administration And I click on "Grade" "link" in the "Student 1" "table_row" And I set the following fields to these values: @@ -70,9 +68,7 @@ Feature: We can bulk insert grades for students in a course And the field "Override for Student 4" matches value "1" Scenario: I can bulk insert grades and check their override flags for user view. - Given I log in as "teacher1" - And I am on "Course 1" course homepage - And I follow "Test assignment two" + Given I am on the "Test assignment two" "assign activity" page logged in as teacher1 And I navigate to "View all submissions" in current page administration And I click on "Grade" "link" in the "Student 1" "table_row" And I set the following fields to these values: @@ -101,8 +97,7 @@ Feature: We can bulk insert grades for students in a course And the field "Override for Test assignment four" matches value "1" Scenario: I can not update grades if the value is out of bounds. - Given I log in as "teacher1" - And I am on "Course 1" course homepage + Given I am on the "Course 1" course page logged in as teacher1 And I navigate to "View > Grader report" in the course gradebook And I follow "Single view for Test assignment one" And I set the field "Perform bulk insert" to "1" diff --git a/grade/tests/behat/grade_point_maximum.feature b/grade/tests/behat/grade_point_maximum.feature index 3176f39702bc7..58e17e8e911d2 100644 --- a/grade/tests/behat/grade_point_maximum.feature +++ b/grade/tests/behat/grade_point_maximum.feature @@ -11,8 +11,8 @@ Feature: We can change the grading type and maximum grade point values | fullname | shortname | category | format | | Course 1 | C1 | 0 | topics | Given the following "activities" exist: - | activity | course | idnumber | name | intro | - | assign | C1 | assign1| Test Assignment 1 | Test Assignment 1 | + | activity | course | idnumber | name | intro | + | assign | C1 | assign1 | Test Assignment 1 | Test Assignment 1 | And I log in as "admin" And I navigate to "Grades > General settings" in site administration And I set the following fields to these values: @@ -23,9 +23,8 @@ Feature: We can change the grading type and maximum grade point values @javascript Scenario: Validate that switching the type of grading used correctly disables input form elements - When I follow "Test Assignment 1" - And I navigate to "Edit settings" in current page administration - And I expand all fieldsets + Given I am on the "Test Assignment 1" "assign activity editing" page + When I expand all fieldsets And I set the field "grade[modgrade_type]" to "Point" Then the "Scale" "select" should be disabled And the "Maximum grade" "field" should be enabled @@ -39,46 +38,42 @@ Feature: We can change the grading type and maximum grade point values @javascript Scenario: Create an activity with a maximum grade point value less than the system maximum - When I follow "Test Assignment 1" - And I navigate to "Edit settings" in current page administration - And I expand all fieldsets + Given I am on the "Test Assignment 1" "assign activity editing" page + When I expand all fieldsets And I set the field "grade[modgrade_type]" to "point" And I set the field "grade[modgrade_point]" to "600" And I press "Save and display" - And I navigate to "Edit settings" in current page administration + And I am on the "Test Assignment 1" "assign activity editing" page Then the field "grade[modgrade_point]" matches value "600" And the "Scale" "select" should be disabled And I press "Save and return to course" @javascript Scenario: Create an activity with a scale as the grade type - When I follow "Test Assignment 1" - And I navigate to "Edit settings" in current page administration - And I expand all fieldsets + Given I am on the "Test Assignment 1" "assign activity editing" page + When I expand all fieldsets And I set the field "grade[modgrade_type]" to "Scale" And I set the field "grade[modgrade_scale]" to "Separate and Connected ways of knowing" And I press "Save and display" - And I navigate to "Edit settings" in current page administration + And I am on the "Test Assignment 1" "assign activity editing" page Then the field "grade[modgrade_scale]" matches value "Separate and Connected ways of knowing" And the "Maximum grade" "field" should be disabled And I press "Save and return to course" @javascript Scenario: Create an activity with no grade as the grade type - When I follow "Test Assignment 1" - And I navigate to "Edit settings" in current page administration - And I expand all fieldsets + Given I am on the "Test Assignment 1" "assign activity editing" page + When I expand all fieldsets And I set the field "grade[modgrade_type]" to "None" And I press "Save and display" - And I navigate to "Edit settings" in current page administration + And I am on the "Test Assignment 1" "assign activity editing" page And the "Scale" "select" should be disabled And the "Maximum grade" "field" should be disabled And I press "Save and return to course" Scenario: Create an activity with a maximum grade point value higher than the system maximum - When I follow "Test Assignment 1" - And I navigate to "Edit settings" in current page administration - And I expand all fieldsets + Given I am on the "Test Assignment 1" "assign activity editing" page + When I expand all fieldsets And I set the field "grade[modgrade_type]" to "Point" And I set the field "grade[modgrade_point]" to "20000" And I press "Save and display" @@ -86,9 +81,8 @@ Feature: We can change the grading type and maximum grade point values And I press "Cancel" Scenario: Create an activity with a valid maximum grade point and then change the system maximum to be lower - When I follow "Test Assignment 1" - And I navigate to "Edit settings" in current page administration - And I expand all fieldsets + Given I am on the "Test Assignment 1" "assign activity editing" page + When I expand all fieldsets And I set the field "grade[modgrade_type]" to "point" And I set the field "grade[modgrade_point]" to "600" And I press "Save and display" @@ -96,9 +90,7 @@ Feature: We can change the grading type and maximum grade point values And I set the following fields to these values: | Grade point maximum | 100 | And I press "Save changes" - And I am on "Course 1" course homepage - And I follow "Test Assignment 1" - And I navigate to "Edit settings" in current page administration + And I am on the "Test Assignment 1" "assign activity editing" page And I press "Save and display" Then I should see "Invalid grade value. This must be an integer between 1 and 100" And I press "Cancel" diff --git a/grade/tests/behat/grade_regrade_do_not_override.feature b/grade/tests/behat/grade_regrade_do_not_override.feature index 6fa71b2cc293f..98f58d9bd0374 100644 --- a/grade/tests/behat/grade_regrade_do_not_override.feature +++ b/grade/tests/behat/grade_regrade_do_not_override.feature @@ -23,8 +23,7 @@ Feature: Regrading grades does not unnecessarily mark some as overriden And I navigate to "Grades > Grade category settings" in site administration And I set the field "Available aggregation types" to "Weighted mean of grades" And I press "Save changes" - And I am on "Course 1" course homepage - And I follow "Assignment 1" + And I am on the "Assignment 1" "assign activity" page And I navigate to "View all submissions" in current page administration And I click on "Grade" "link" in the "Student 1" "table_row" And I set the field "Grade out of 100" to "80" @@ -58,8 +57,7 @@ Feature: Regrading grades does not unnecessarily mark some as overriden @javascript Scenario: Confirm overridden course total does not get regraded when activity grade is changed - Given I am on "Course 1" course homepage - And I follow "Assignment 1" + Given I am on the "Assignment 1" "assign activity" page And I navigate to "View all submissions" in current page administration And I click on "Grade" "link" in the "Student 1" "table_row" And I set the field "Grade out of 100" to "90" diff --git a/grade/tests/behat/grade_scales.feature b/grade/tests/behat/grade_scales.feature index 5124594a34a2a..1492e1abd4187 100644 --- a/grade/tests/behat/grade_scales.feature +++ b/grade/tests/behat/grade_scales.feature @@ -43,10 +43,7 @@ Feature: View gradebook when scales are used And the following "activities" exist: | activity | course | idnumber | name | intro | gradecategory | | assign | C1 | a1 | Test assignment one | Submit something! | Sub category 1 | - And I log in as "teacher1" - And I am on "Course 1" course homepage - And I follow "Test assignment one" - And I navigate to "Edit settings" in current page administration + And I am on the "Test assignment one" "assign activity editing" page logged in as teacher1 And I expand all fieldsets And I set the field "grade[modgrade_type]" to "Scale" And I set the field "grade[modgrade_scale]" to "EN Letterscale" diff --git a/grade/tests/behat/grade_single_item_scales.feature b/grade/tests/behat/grade_single_item_scales.feature index dc78a79ee66bc..797d45ee3222f 100644 --- a/grade/tests/behat/grade_single_item_scales.feature +++ b/grade/tests/behat/grade_single_item_scales.feature @@ -39,10 +39,7 @@ Feature: View gradebook when single item scales are used | assign | C1 | a1 | Test assignment one | Submit something! | ENFR Sub category 1 | And the "multilang" filter is "on" And the "multilang" filter applies to "content and headings" - And I log in as "teacher1" - And I am on "Course 1" course homepage - And I follow "Test assignment one" - And I navigate to "Edit settings" in current page administration + And I am on the "Test assignment one" "assign activity editing" page logged in as teacher1 And I expand all fieldsets And I set the field "grade[modgrade_type]" to "Scale" And I set the field "grade[modgrade_scale]" to "EN Singleitem" diff --git a/lib/behat/classes/behat_generator_base.php b/lib/behat/classes/behat_generator_base.php index 95a7a3f48f66d..ca224cf3b3d92 100644 --- a/lib/behat/classes/behat_generator_base.php +++ b/lib/behat/classes/behat_generator_base.php @@ -531,4 +531,46 @@ protected function get_externalbackpack_id($backpackweburl) { } return $id; } + + /** + * Get a coursemodule from an activity name or idnumber. + * + * @param string $activity + * @param string $identifier + * @return cm_info + */ + protected function get_cm_by_activity_name(string $activity, string $identifier): cm_info { + global $DB; + + $coursetable = new \core\dml\table('course', 'c', 'c'); + $courseselect = $coursetable->get_field_select(); + $coursefrom = $coursetable->get_from_sql(); + + $cmtable = new \core\dml\table('course_modules', 'cm', 'cm'); + $cmfrom = $cmtable->get_from_sql(); + + $acttable = new \core\dml\table($activity, 'act', 'act'); + $actselect = $acttable->get_field_select(); + $actfrom = $acttable->get_from_sql(); + + $sql = <<get_record_sql($sql, [ + 'modname' => $activity, + 'idnumber' => $identifier, + 'name' => $identifier, + ], MUST_EXIST); + + $course = $coursetable->extract_from_result($result); + $instancedata = $acttable->extract_from_result($result); + + return get_fast_modinfo($course)->get_cm($result->cmid); + } } diff --git a/lib/editor/atto/plugins/h5p/tests/behat/h5p.feature b/lib/editor/atto/plugins/h5p/tests/behat/h5p.feature index 9205cc4e4e830..2eaa9bfb506f3 100644 --- a/lib/editor/atto/plugins/h5p/tests/behat/h5p.feature +++ b/lib/editor/atto/plugins/h5p/tests/behat/h5p.feature @@ -21,11 +21,8 @@ Feature: Add h5ps to Atto @javascript @external Scenario: Insert an embedded h5p - Given I log in as "admin" - And I change window size to "large" - And I am on "Course 1" course homepage - And I follow "PageName1" - And I navigate to "Edit settings" in current page administration + Given I change window size to "large" + And I am on the PageName1 "page activity editing" page logged in as admin And I click on "Insert H5P" "button" in the "#fitem_id_page" "css_element" And I set the field with xpath "//input[@data-region='h5pfile']" to "https://moodle.h5p.com/content/1290772960722742119" And I click on "Insert H5P" "button" in the "Insert H5P" "dialogue" @@ -42,9 +39,7 @@ Feature: Add h5ps to Atto And I follow "Manage private files..." And I upload "h5p/tests/fixtures/guess-the-answer.h5p" file to "Files" filemanager And I click on "Save changes" "button" - And I am on "Course 1" course homepage - And I follow "PageName1" - And I navigate to "Edit settings" in current page administration + And I am on the PageName1 "page activity editing" page And I click on "Insert H5P" "button" in the "#fitem_id_page" "css_element" And I click on "Browse repositories..." "button" in the "Insert H5P" "dialogue" And I click on "Private files" "link" in the ".fp-repo-area" "css_element" @@ -57,11 +52,8 @@ Feature: Add h5ps to Atto @javascript Scenario: Test an invalid url - Given I log in as "admin" - And I change window size to "large" - And I am on "Course 1" course homepage - And I follow "PageName1" - And I navigate to "Edit settings" in current page administration + Given I change window size to "large" + And I am on the PageName1 "page activity editing" page logged in as admin And I click on "Insert H5P" "button" in the "#fitem_id_page" "css_element" # This is not a real external URL, so this scenario shouldn't be labeled as external. And I set the field with xpath "//input[@data-region='h5pfile']" to "ftp://moodle.h5p.com/content/1290772960722742119" @@ -75,10 +67,7 @@ Feature: Add h5ps to Atto | capability | permission | role | contextlevel | reference | | atto/h5p:addembed | Prohibit | editingteacher | Course | C1 | | moodle/h5p:deploy | Prohibit | editingteacher | Course | C1 | - And I log in as "teacher1" - And I am on "Course 1" course homepage - And I follow "PageName1" - When I navigate to "Edit settings" in current page administration + When I am on the PageName1 "page activity editing" page logged in as teacher1 Then "Insert H5P" "button" should not exist @javascript @@ -86,10 +75,7 @@ Feature: Add h5ps to Atto Given the following "permission overrides" exist: | capability | permission | role | contextlevel | reference | | atto/h5p:addembed | Prohibit | editingteacher | Course | C1 | - And I log in as "teacher1" - And I am on "Course 1" course homepage - And I follow "PageName1" - When I navigate to "Edit settings" in current page administration + And I am on the PageName1 "page activity editing" page logged in as teacher1 And I click on "Insert H5P" "button" Then I should not see "H5P URL" in the "Insert H5P" "dialogue" And I should see "H5P file upload" in the "Insert H5P" "dialogue" @@ -100,10 +86,7 @@ Feature: Add h5ps to Atto Given the following "permission overrides" exist: | capability | permission | role | contextlevel | reference | | moodle/h5p:deploy | Prohibit | editingteacher | Course | C1 | - And I log in as "teacher1" - And I am on "Course 1" course homepage - And I follow "PageName1" - When I navigate to "Edit settings" in current page administration + When I am on the PageName1 "page activity editing" page logged in as teacher1 And I click on "Insert H5P" "button" Then I should not see "H5P file upload" in the "Insert H5P" "dialogue" And I should see "H5P URL" in the "Insert H5P" "dialogue" @@ -115,9 +98,7 @@ Feature: Add h5ps to Atto And I follow "Manage private files..." And I upload "lib/editor/atto/tests/fixtures/drag.h5p" file to "Files" filemanager And I click on "Save changes" "button" - And I am on "Course 1" course homepage - And I follow "PageName1" - And I navigate to "Edit settings" in current page administration + And I am on the PageName1 "page activity editing" page And I click on "Insert H5P" "button" in the "#fitem_id_page" "css_element" # H5P file content And I click on "Browse repositories..." "button" in the "Insert H5P" "dialogue" @@ -151,9 +132,7 @@ Feature: Add h5ps to Atto And I follow "Manage private files..." And I upload "h5p/tests/fixtures/guess-the-answer.h5p" file to "Files" filemanager And I click on "Save changes" "button" - And I am on "Course 1" course homepage - And I follow "PageName1" - And I navigate to "Edit settings" in current page administration + And I am on the PageName1 "page activity editing" page And I click on "Insert H5P" "button" in the "#fitem_id_page" "css_element" And I click on "Browse repositories..." "button" in the "Insert H5P" "dialogue" And I click on "Private files" "link" in the ".fp-repo-area" "css_element" @@ -205,11 +184,8 @@ Feature: Add h5ps to Atto @javascript @external Scenario: H5P options are ignored for H5P URLs - Given I log in as "admin" - And I change window size to "large" - And I am on "Course 1" course homepage - And I follow "PageName1" - And I navigate to "Edit settings" in current page administration + Given I change window size to "large" + And I am on the PageName1 "page activity editing" page logged in as admin And I click on "Insert H5P" "button" in the "#fitem_id_page" "css_element" And I set the field with xpath "//input[@data-region='h5pfile']" to "https://moodle.h5p.com/content/1291366510035871129" And I click on "H5P options" "link" @@ -239,9 +215,7 @@ Feature: Add h5ps to Atto And I follow "Manage private files..." And I upload "h5p/tests/fixtures/guess-the-answer.h5p" file to "Files" filemanager And I click on "Save changes" "button" - And I am on "Course 1" course homepage - And I follow "PageName1" - And I navigate to "Edit settings" in current page administration + And I am on the PageName1 "page activity editing" page And I click on "Insert H5P" "button" in the "#fitem_id_page" "css_element" And I click on "Browse repositories..." "button" in the "Insert H5P" "dialogue" And I click on "Private files" "link" in the ".fp-repo-area" "css_element" @@ -251,9 +225,7 @@ Feature: Add h5ps to Atto And I wait until the page is ready And I click on "Save and display" "button" And I log out - When I log in as "student1" - And I am on "Course 1" course homepage - And I follow "PageName1" + When I am on the PageName1 "page activity" page logged in as student1 Then I switch to "h5pcontent" iframe And I switch to "h5p-iframe" class iframe And I should see "reveal" diff --git a/lib/form/tests/behat/graderescale_for_database_pointscale.feature b/lib/form/tests/behat/graderescale_for_database_pointscale.feature index 97b363cdbf803..e2d8eb2393ab7 100644 --- a/lib/form/tests/behat/graderescale_for_database_pointscale.feature +++ b/lib/form/tests/behat/graderescale_for_database_pointscale.feature @@ -22,16 +22,13 @@ Feature: Using the database activities which support point scale @javascript Scenario: Database rescale grade should not be possible when users are graded - Given I log in as "teacher1" - And I am on "Course 1" course homepage + Given I am on the "Course 1" course page logged in as teacher1 And I add a "Text input" field to "Test database name" database and I fill the form with: | Field name | Test field name | | Field description | Test field description | And I follow "Templates" And I wait until the page is ready - And I am on "Course 1" course homepage - And I follow "Test database name" - And I navigate to "Edit settings" in current page administration + And I am on the "Test database name" "data activity editing" page And I expand all fieldsets And I set the field "Ratings > Aggregate type" to "Count of ratings" And I set the field "Ratings > Type" to "Point" @@ -44,13 +41,9 @@ Feature: Using the database activities which support point scale | Test field name | Student original entry 2 | And I press "Save and view" And I log out - And I log in as "teacher1" - And I am on "Course 1" course homepage - And I follow "Test database name" + And I am on the "Test database name" "data activity" page logged in as teacher1 And I follow "View single" And I set the field "rating" to "51" - And I am on "Course 1" course homepage - And I follow "Test database name" - When I navigate to "Edit settings" in current page administration + And I am on the "Test database name" "data activity editing" page And I expand all fieldsets Then the "Maximum grade" "field" should be disabled diff --git a/lib/form/tests/behat/graderescale_for_forum_pointscale.feature b/lib/form/tests/behat/graderescale_for_forum_pointscale.feature index ca2f4db1ca55e..ac52ffa79268b 100644 --- a/lib/form/tests/behat/graderescale_for_forum_pointscale.feature +++ b/lib/form/tests/behat/graderescale_for_forum_pointscale.feature @@ -25,25 +25,19 @@ Feature: Using the forum activities which support point scale @javascript Scenario: Forum rescale grade should not be possible when users are graded - Given I log in as "student1" - And I am on "Course 1" course homepage + Given I am on the "Course 1" course page logged in as student1 And I add a new discussion to "Test forum name" forum with: | Subject | Discussion subject | | Message | Test post in forum 1 | And I log out - And I log in as "teacher1" - And I am on "Course 1" course homepage - And I follow "Test forum name" - And I navigate to "Edit settings" in current page administration + And I am on the "Test forum name" "forum activity editing" page logged in as teacher1 And I expand all fieldsets And I set the field "Ratings > Aggregate type" to "Count of ratings" And I set the field "Ratings > Type" to "Point" And I press "Save and return to course" - And I follow "Test forum name" + And I am on the "Test forum name" "forum activity" page And I follow "Discussion subject" And I set the field "rating" to "30" - And I am on "Course 1" course homepage - And I follow "Test forum name" - When I navigate to "Edit settings" in current page administration + When I am on the "Test forum name" "forum activity editing" page And I expand all fieldsets Then the "Maximum grade" "field" should be disabled diff --git a/lib/form/tests/behat/graderescale_for_glossary_pointscale.feature b/lib/form/tests/behat/graderescale_for_glossary_pointscale.feature index 441d23373f7b4..5c182e7627e56 100644 --- a/lib/form/tests/behat/graderescale_for_glossary_pointscale.feature +++ b/lib/form/tests/behat/graderescale_for_glossary_pointscale.feature @@ -25,27 +25,20 @@ Feature: Using the glossary activities which support point scale @javascript Scenario: Glossary rescale grade should not be possible when users are graded - Given I log in as "student1" - And I am on "Course 1" course homepage - And I follow "Test glossary name" + Given I am on the "Test glossary name" "glossary activity" page logged in as student1 And I press "Add a new entry" And I set the following fields to these values: | Concept | Testing score | | Definition | Scoring high on tests | And I press "Save changes" And I log out - And I log in as "teacher1" - And I am on "Course 1" course homepage - And I follow "Test glossary name" - And I navigate to "Edit settings" in current page administration + And I am on the "Test glossary name" "glossary activity editing" page logged in as teacher1 And I expand all fieldsets And I set the field "Ratings > Aggregate type" to "Count of ratings" And I set the field "Ratings > Type" to "Point" And I press "Save and return to course" - And I follow "Test glossary name" + And I am on the "Test glossary name" "glossary activity" page And I set the field "rating" to "50" - And I am on "Course 1" course homepage - And I follow "Test glossary name" - When I navigate to "Edit settings" in current page administration + When I am on the "Test glossary name" "glossary activity editing" page And I expand all fieldsets Then the "Maximum grade" "field" should be disabled diff --git a/lib/form/tests/behat/graderescale_for_lesson_pointscale.feature b/lib/form/tests/behat/graderescale_for_lesson_pointscale.feature index f791014925b59..3ee479165b617 100644 --- a/lib/form/tests/behat/graderescale_for_lesson_pointscale.feature +++ b/lib/form/tests/behat/graderescale_for_lesson_pointscale.feature @@ -25,9 +25,7 @@ Feature: Using the lesson activities which support point scale @javascript Scenario: Lesson rescale grade should not be possible when users are graded - Given I log in as "teacher1" - 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 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" @@ -40,15 +38,10 @@ Feature: Using the lesson activities which support point scale | id_jumpto_6 | 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 - 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 log out - And I log in as "teacher1" - And I am on "Course 1" course homepage - And I follow "Test lesson name" - When I navigate to "Edit settings" in current page administration + And I am on the "Test lesson name" "lesson activity editing" page logged in as teacher1 And I expand all fieldsets Then the "Maximum grade" "field" should be disabled diff --git a/lib/form/tests/behat/modgrade_validation.feature b/lib/form/tests/behat/modgrade_validation.feature index 8464091326d24..7f33b5a4c5976 100644 --- a/lib/form/tests/behat/modgrade_validation.feature +++ b/lib/form/tests/behat/modgrade_validation.feature @@ -31,13 +31,10 @@ Feature: Using the activity grade form element | Scale | Disappointing, Good, Very good, Excellent | And I press "Save changes" And I log out - And I log in as "teacher1" And the following "activities" exist: | activity | name | intro | course | idnumber | | forum | Test forum name | Test forum description | C1 | forum1 | - And I am on "Course 1" course homepage - And I follow "Test forum name" - And I navigate to "Edit settings" in current page administration + And I am on the "Test forum name" "forum activity editing" page logged in as teacher1 And I set the following fields to these values: | Forum type | Standard forum for general use | | Aggregate type | Average of ratings | @@ -45,9 +42,7 @@ Feature: Using the activity grade form element | scale[modgrade_point] | 100 | | Group mode | No groups | And I press "Save and return to course" - And I am on "Course 1" course homepage - And I follow "Test forum name" - And I navigate to "Edit settings" in current page administration + And I am on the "Test forum name" "forum activity editing" page When I expand all fieldsets Then I should not see "Some grades have already been awarded, so the grade type" And I set the field "scale[modgrade_type]" to "Scale" @@ -94,21 +89,17 @@ Feature: Using the activity grade form element | scale[modgrade_scale] | ABCDEF | | Group mode | No groups | And I log out - And I log in as "student1" - And I am on "Course 1" course homepage - And I follow "Test forum name" + And I am on the "Test forum name" "forum activity" page logged in as student1 And I click on "Add a new discussion topic" "link" And I set the following fields to these values: | Subject | Discussion subject | | Message | Discussion message | And I press "Post to forum" And I log out - And I log in as "teacher1" - And I am on "Course 1" course homepage - And I follow "Test forum name" + And I am on the "Test forum name" "forum activity" page logged in as teacher1 And I follow "Discussion subject" And I set the field "rating" to "D" - And I follow "Test forum name" + And I am on the "Test forum name" "forum activity" page And I navigate to "Edit settings" in current page administration When I expand all fieldsets Then I should see "Some grades have already been awarded, so the grade type and scale cannot be changed" @@ -143,8 +134,7 @@ Feature: Using the activity grade form element | Description | Test assignment description | | grade[modgrade_type] | Scale | | grade[modgrade_scale] | ABCDEF | - And I am on "Course 1" course homepage - And I follow "Test assignment name" + And I am on the "Test assignment name" "assign activity" page And I navigate to "View all submissions" in current page administration And I click on "Grade" "link" in the "Student 1" "table_row" And I set the field "Grade" to "C" @@ -161,13 +151,10 @@ Feature: Using the activity grade form element @javascript Scenario: Attempting to change the maximum grade when ratings exist - Given I log in as "teacher1" - And the following "activities" exist: + Given the following "activities" exist: | activity | name | intro | course | idnumber | section | | forum | Test forum name | Test forum description | C1 | forum1 | 1 | - And I am on "Course 1" course homepage - And I follow "Test forum name" - And I navigate to "Edit settings" in current page administration + And I am on the "Test forum name" "forum activity editing" page logged in as teacher1 And I set the following fields to these values: | Forum type | Standard forum for general use | | Aggregate type | Average of ratings | @@ -176,21 +163,17 @@ Feature: Using the activity grade form element | Group mode | No groups | And I press "Save and return to course" And I log out - And I log in as "student1" - And I am on "Course 1" course homepage - And I follow "Test forum name" + And I am on the "Test forum name" "forum activity" page logged in as student1 And I click on "Add a new discussion topic" "link" And I set the following fields to these values: | Subject | Discussion subject | | Message | Discussion message | And I press "Post to forum" And I log out - And I log in as "teacher1" - And I am on "Course 1" course homepage - And I follow "Test forum name" + And I am on the "Test forum name" "forum activity" page logged in as teacher1 And I follow "Discussion subject" And I set the field "rating" to "100" - And I follow "Test forum name" + And I am on the "Test forum name" "forum activity" page And I navigate to "Edit settings" in current page administration When I expand all fieldsets Then I should see "You cannot change the type, as grades already exist for this item." @@ -198,13 +181,11 @@ Feature: Using the activity grade form element @javascript Scenario: Attempting to change the maximum grade when no rescaling option has been chosen - Given I log in as "teacher1" - And I am on "Course 1" course homepage with editing mode on - And I add a "Assignment" to section "1" and I fill the form with: - | Assignment name | Test assignment name | - | Description | Test assignment description | - And I am on "Course 1" course homepage - And I follow "Test assignment name" + Given the following "activity" exists: + | course | C1 | + | activity | assign | + | name | Test assign name | + And I am on the "Test assign name" "assign activity" page logged in as teacher1 And I navigate to "View all submissions" in current page administration And I click on "Grade" "link" in the "Student 1" "table_row" And I set the field "Grade out of 100" to "50" diff --git a/lib/tests/behat/alpha_chooser.feature b/lib/tests/behat/alpha_chooser.feature index 327ede9a26296..77063b1018ae8 100644 --- a/lib/tests/behat/alpha_chooser.feature +++ b/lib/tests/behat/alpha_chooser.feature @@ -240,8 +240,7 @@ Feature: Initials bar Given the following "activities" exist: | activity | course | idnumber | name | intro | assignsubmission_onlinetext_enabled | assignsubmission_file_enabled | | assign | C1 | assign1 | TestAssignment | Test assignment description | 0 | 0 | - And I am on the "assign1" "Activity" page logged in as "admin" - And I navigate to "Edit settings" in current page administration + And I am on the "assign1" "assign Activity editing" page logged in as "admin" And I expand all fieldsets And I set the field "Completion tracking" to "1" And I click on "Save and return to course" "button" diff --git a/lib/tests/behat/datetime_any.feature b/lib/tests/behat/datetime_any.feature index cfae8b17e528c..5e8c236c4f673 100644 --- a/lib/tests/behat/datetime_any.feature +++ b/lib/tests/behat/datetime_any.feature @@ -12,9 +12,7 @@ Feature: Any day / month / year combination in date form elements works ok. And the following "activity" exist: | activity | name | intro | course | idnumber | | assign | Assignment 01 | Assign activity to test some dates | C1 | assign01 | - Given I am on the "C1" "Course" page logged in as "admin" - And I follow "Assignment 01" - And I navigate to "Edit settings" in current page administration + And I am on the "Assignment 01" "assign activity editing" page logged in as admin And I expand all fieldsets And I set the field "Due date" to "" And I set the field "Due date" to "" diff --git a/lib/tests/behat/permissionmanager.feature b/lib/tests/behat/permissionmanager.feature index 3a69af170ede3..060a267ac574c 100644 --- a/lib/tests/behat/permissionmanager.feature +++ b/lib/tests/behat/permissionmanager.feature @@ -31,12 +31,11 @@ Feature: Override permissions on a context Then "Add announcementsmod/forum:addnews" row "Prohibited" column of "permissions" table should contain "Student" Scenario: Module capabilities overrides - Given I log in as "teacher1" - And I am on "Course 1" course homepage with editing mode on - And I add a "Forum" to section "1" and I fill the form with: - | Forum name | Forum 1 | - And I follow "Forum 1" - And I navigate to "Permissions" in current page administration + Given the following "activity" exists: + | course | C1 | + | activity | forum | + | name | Forum 1 | + And I am on the "Forum 1" "forum activity permissions" page logged in as admin When I click on "Allow" "icon" in the "mod/forum:addnews" "table_row" And I press "Student" Then "Add announcementsmod/forum:addnews" row "Roles with permission" column of "permissions" table should contain "Student" diff --git a/message/output/popup/tests/behat/notification_popover_unread.feature b/message/output/popup/tests/behat/notification_popover_unread.feature index bf1d8fd4e482b..0fbec12e49203 100644 --- a/message/output/popup/tests/behat/notification_popover_unread.feature +++ b/message/output/popup/tests/behat/notification_popover_unread.feature @@ -24,23 +24,17 @@ Feature: Notification popover unread notifications | 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 "Assignment" to section "1" and I fill the form with: - | Assignment name | Test assignment name | - | Description | Submit your online text | - | assignsubmission_onlinetext_enabled | 1 | - | assignsubmission_file_enabled | 0 | - And I log out - And I log in as "student1" - And I am on "Course 1" course homepage - And I follow "Test assignment name" - And I press "Add submission" + And the following "activity" exists: + | activity | assign | + | course | C1 | + | name | Test assignment name | + | assignsubmission_onlinetext_enabled | 1 | + | assignsubmission_file_enabled | 0 | + | submissiondrafts | 0 | # This should generate a notification. - And I set the following fields to these values: - | Online text | I'm the student first submission | - And I press "Save changes" - And I log out + And the following "mod_assign > submissions" exist: + | assign | user | onlinetext | + | Test assignment name | student1 | I'm the student1 submission | Scenario: Notification popover shows correct unread count When I log in as "student1" diff --git a/mod/assign/tests/behat/assign_activity_completion.feature b/mod/assign/tests/behat/assign_activity_completion.feature index afe4c9d3d33be..a902bb030d963 100644 --- a/mod/assign/tests/behat/assign_activity_completion.feature +++ b/mod/assign/tests/behat/assign_activity_completion.feature @@ -10,20 +10,12 @@ Feature: View activity completion in the assignment activity | student1 | Vinnie | Student1 | student1@example.com | | teacher1 | Darrell | Teacher1 | teacher1@example.com | And the following "courses" exist: - | fullname | shortname | category | - | Course 1 | C1 | 0 | + | fullname | shortname | enablecompletion | showcompletionconditions | + | Course 1 | C1 | 1 | 1 | And the following "course enrolments" exist: | user | course | role | | student1 | C1 | student | | teacher1 | C1 | editingteacher | - And I log in as "teacher1" - And I am on "Course 1" course homepage - And I navigate to "Edit settings" in current page administration - And I expand all fieldsets - And I set the following fields to these values: - | Enable completion tracking | Yes | - | Show activity completion conditions | Yes | - And I press "Save and display" And the following "activity" exists: | activity | assign | | course | C1 | @@ -36,7 +28,7 @@ Feature: View activity completion in the assignment activity @javascript Scenario: The manual completion button will be shown on the course page if the Show activity completion conditions is set to Yes - Given I am on "Course 1" course homepage + Given I am on the "Course 1" course page logged in as teacher1 # Teacher view. And the manual completion button for "Music history" should exist And the manual completion button for "Music history" should be disabled @@ -51,43 +43,37 @@ Feature: View activity completion in the assignment activity @javascript Scenario: The manual completion button will not be shown on the course page if the Show activity completion conditions is set to No - Given I am on "Course 1" course homepage with editing mode on + Given I am on the "Course 1" course page logged in as teacher1 And I navigate to "Edit settings" in current page administration And I expand all fieldsets And I set the field "Show activity completion conditions" to "No" And I press "Save and display" # Teacher view. And the manual completion button for "Music history" should not exist - And I follow "Music history" + And I am on the "Music history" "assign activity" page And the manual completion button for "Music history" should exist And the manual completion button for "Music history" should be disabled And I log out # Student view. - 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 manual completion button for "Music history" should not exist - And I follow "Music history" + And I am on the "Music history" "assign activity" page And the manual completion button for "Music history" should exist @javascript Scenario: Use manual completion from the activity page - Given I am on "Course 1" course homepage - And I follow "Music history" + Given I am on the "Music history" "assign activity" page logged in as teacher1 # Teacher view. And the manual completion button for "Music history" should be disabled And I log out # Student view. - When I log in as "student1" - And I am on "Course 1" course homepage - And I follow "Music history" + And I am on the "Music history" "assign activity" page logged in as student1 Then the manual completion button of "Music history" is displayed as "Mark as done" And I toggle the manual completion state of "Music history" And the manual completion button of "Music history" is displayed as "Done" Scenario: View automatic completion items as a teacher - Given I am on "Course 1" course homepage - And I follow "Music history" - And I navigate to "Edit settings" in current page administration + Given I am on the "Music history" "assign activity editing" page logged in as teacher1 And I expand all fieldsets And I set the following fields to these values: | Completion tracking | Show activity as complete when conditions are met | @@ -101,9 +87,7 @@ Feature: View activity completion in the assignment activity @javascript Scenario: View automatic completion items as a student - Given I am on "Course 1" course homepage - And I follow "Music history" - And I navigate to "Edit settings" in current page administration + Given I am on the "Music history" "assign activity editing" page logged in as teacher1 And I expand all fieldsets And I set the following fields to these values: | assignsubmission_onlinetext_enabled | 1 | @@ -113,14 +97,11 @@ Feature: View activity completion in the assignment activity | completionsubmit | 1 | And I press "Save and display" And I log out - And I log in as "student1" - And I am on "Course 1" course homepage - And I follow "Music history" + And I am on the "Music history" "assign activity" page logged in as student1 And the "View" completion condition of "Music history" is displayed as "done" And the "Make a submission" completion condition of "Music history" is displayed as "todo" And the "Receive a grade" completion condition of "Music history" is displayed as "todo" - And I am on "Course 1" course homepage - And I follow "Music history" + And I am on the "Music history" "assign activity" page And I press "Add submission" And I set the field "Online text" to "History of playing with drumsticks reversed" And I press "Save changes" @@ -130,9 +111,7 @@ Feature: View activity completion in the assignment activity And the "Make a submission" completion condition of "Music history" is displayed as "done" And the "Receive a grade" completion condition of "Music history" is displayed as "todo" And I log out - And I log in as "teacher1" - And I am on "Course 1" course homepage - And I follow "Music history" + And I am on the "Music history" "assign activity" page logged in as teacher1 And I navigate to "View all submissions" in current page administration And I click on "Grade" "link" in the "Vinnie Student1" "table_row" And I set the field "Grade out of 100" to "33" @@ -140,9 +119,7 @@ Feature: View activity completion in the assignment activity And I press "Save changes" And I follow "View all submissions" And I log out - When I log in as "student1" - And I am on "Course 1" course homepage - And I follow "Music history" + When I am on the "Music history" "assign activity" page logged in as student1 Then the "View" completion condition of "Music history" is displayed as "done" And the "Make a submission" completion condition of "Music history" is displayed as "done" And the "Receive a grade" completion condition of "Music history" is displayed as "done" diff --git a/mod/assign/tests/behat/grading_status.feature b/mod/assign/tests/behat/grading_status.feature index 90c1b19e6a99b..8a10bc7fe1bb9 100644 --- a/mod/assign/tests/behat/grading_status.feature +++ b/mod/assign/tests/behat/grading_status.feature @@ -23,7 +23,6 @@ Feature: View the grading status of an assignment Scenario: View the grading status for an assignment with marking workflow enabled Given the following "activity" exists: | activity | assign | - | idnumber | ass1 | | course | C1 | | name | Test assignment name | | intro | Submit your online text | @@ -32,20 +31,11 @@ Feature: View the grading status of an assignment | assignfeedback_comments_enabled | 1 | | assignsubmission_onlinetext_enabled | 1 | # Add a submission. - And I log in as "student1" - And I am on "Course 1" course homepage - When I follow "Test assignment name" - Then I should not see "Feedback" - And I should see "Not marked" in the "Grading status" "table_row" - And I press "Add submission" - And I set the following fields to these values: - | Online text | I'm the student's first submission | - And I press "Save changes" - And I log out + And the following "mod_assign > submissions" exist: + | assign | user | onlinetext | + | Test assignment name | student1 | I'm the student first submission | # Mark the submission. - And I log in as "teacher1" - And I am on "Course 1" course homepage - And I follow "Test assignment name" + And I am on the "Test assignment name" "assign activity" page logged in as teacher1 And I navigate to "View all submissions" in current page administration And I should see "Not marked" in the "Student 1" "table_row" And I click on "Grade" "link" in the "Student 1" "table_row" @@ -58,22 +48,17 @@ Feature: View the grading status of an assignment And I set the field "Feedback comments" to "Great job! Lol, not really." And I set the field "Notify students" to "0" And I press "Save changes" - And I click on "Edit settings" "link" - And I follow "Test assignment name" + And I am on the "Test assignment name" "assign activity" page And I navigate to "View all submissions" in current page administration And I should see "In review" in the "Student 1" "table_row" And I log out # View the grading status as a student. - And I log in as "student1" - And I am on "Course 1" course homepage - And I follow "Test assignment name" + And I am on the "Test assignment name" "assign activity" page logged in as student1 And I should see "In review" in the "Grading status" "table_row" And I should not see "Great job! Lol, not really." And I log out # Mark the submission again but set the marking workflow to 'Released'. - And I log in as "teacher1" - And I am on "Course 1" course homepage - And I follow "Test assignment name" + And I am on the "Test assignment name" "assign activity" page logged in as teacher1 And I navigate to "View all submissions" in current page administration And I should see "In review" in the "Student 1" "table_row" And I click on "Grade" "link" in the "Student 1" "table_row" @@ -86,16 +71,12 @@ Feature: View the grading status of an assignment And I should see "Released" in the "Student 1" "table_row" And I log out # View the grading status as a student. - And I log in as "student1" - And I am on "Course 1" course homepage - And I follow "Test assignment name" + And I am on the "Test assignment name" "assign activity" page logged in as student1 And I should see "Released" in the "Grading status" "table_row" And I should see "Great job! Lol, not really." And I log out # Now, change the status from 'Released' to 'In marking' (this will remove the grade from the gradebook). - And I log in as "teacher1" - And I am on "Course 1" course homepage - And I follow "Test assignment name" + And I am on the "Test assignment name" "assign activity" page logged in as teacher1 And I navigate to "View all submissions" in current page administration And I should see "Released" in the "Student 1" "table_row" And I click on "Grade" "link" in the "Student 1" "table_row" @@ -103,8 +84,7 @@ Feature: View the grading status of an assignment And I set the field "Marking workflow state" to "In marking" And I set the field "Notify students" to "0" And I press "Save changes" - And I click on "Edit settings" "link" - And I follow "Test assignment name" + And I am on the "Test assignment name" "assign activity" page And I navigate to "View all submissions" in current page administration And I should see "In marking" in the "Student 1" "table_row" # The grade should also remain displayed as it's stored in the assign DB tables, but the final grade should be empty. @@ -114,13 +94,11 @@ Feature: View the grading status of an assignment And I click on "Change filters" "link" And I set the field "Workflow filter" to "In review" And I should see "0 of 0" - And I follow "Test assignment name" @javascript Scenario: View the grading status for an assignment with marking workflow disabled Given the following "activity" exists: | activity | assign | - | idnumber | ass1 | | course | C1 | | name | Test assignment name | | intro | Submit your online text | @@ -129,20 +107,11 @@ Feature: View the grading status of an assignment | markingworkflow | 0 | | assignsubmission_onlinetext_enabled | 1 | # Add a submission. - And I log in as "student1" - And I am on "Course 1" course homepage - And I follow "Test assignment name" - And I should not see "Feedback" - And I should see "Not graded" in the "Grading status" "table_row" - And I press "Add submission" - And I set the following fields to these values: - | Online text | I'm the student's first submission | - And I press "Save changes" - And I log out + And the following "mod_assign > submissions" exist: + | assign | user | onlinetext | + | Test assignment name | student1 | I'm the student first submission | # Mark the submission. - And I log in as "teacher1" - And I am on "Course 1" course homepage - And I follow "Test assignment name" + And I am on the "Test assignment name" "assign activity" page logged in as teacher1 And I navigate to "View all submissions" in current page administration And I should not see "Graded" in the "Student 1" "table_row" And I click on "Grade" "link" in the "Student 1" "table_row" @@ -154,30 +123,24 @@ Feature: View the grading status of an assignment And I set the field "Feedback comments" to "Great job! Lol, not really." And I press "Save changes" And I click on "Edit settings" "link" - And I follow "Test assignment name" + And I am on the "Test assignment name" "assign activity" page And I navigate to "View all submissions" in current page administration And I should see "Graded" in the "Student 1" "table_row" And I log out # View the grading status as a student. - And I log in as "student1" - And I am on "Course 1" course homepage - And I follow "Test assignment name" + And I am on the "Test assignment name" "assign activity" page logged in as student1 And I should see "Graded" in the "Grading status" "table_row" And I should see "Great job! Lol, not really." And I log out # Student makes a subsequent submission. - And I log in as "student1" - And I am on "Course 1" course homepage - And I follow "Test assignment name" + And I am on the "Test assignment name" "assign activity" page logged in as student1 And I press "Edit submission" And I set the following fields to these values: | Online text | I'm the student's second submission | And I press "Save changes" And I log out # Teacher marks the submission again after noticing the 'Graded - follow-up submission received'. - And I log in as "teacher1" - And I am on "Course 1" course homepage - And I follow "Test assignment name" + And I am on the "Test assignment name" "assign activity" page logged in as teacher1 And I navigate to "View all submissions" in current page administration And I should see "Graded - follow-up submission received" in the "Student 1" "table_row" And I wait "10" seconds @@ -187,13 +150,11 @@ Feature: View the grading status of an assignment And I set the field "Feedback comments" to "Even better job! Really." And I press "Save changes" And I click on "Edit settings" "link" - And I follow "Test assignment name" + And I am on the "Test assignment name" "assign activity" page And I navigate to "View all submissions" in current page administration And I should see "Graded" in the "Student 1" "table_row" And I log out # View the grading status as a student again. - And I log in as "student1" - And I am on "Course 1" course homepage - And I follow "Test assignment name" + And I am on the "Test assignment name" "assign activity" page logged in as student1 And I should see "Graded" in the "Grading status" "table_row" And I should see "Even better job! Really." diff --git a/mod/assign/tests/behat/outcome_grading.feature b/mod/assign/tests/behat/outcome_grading.feature index 1e3b979f75aea..32d0df8870e14 100644 --- a/mod/assign/tests/behat/outcome_grading.feature +++ b/mod/assign/tests/behat/outcome_grading.feature @@ -44,29 +44,26 @@ Feature: Outcome grading Given I log in as "teacher1" And I am on "Course 1" course homepage with editing mode on And I add a "Assignment" to section "1" and I fill the form with: - | Assignment name | Test assignment name | - | Description | Test assignment description | - | assignsubmission_onlinetext_enabled | 1 | - | Outcome Test | 1 | + | Assignment name | Test assignment name | + | ID number | Test assignment name | + | Description | Test assignment description | + | assignsubmission_onlinetext_enabled | 1 | + | Outcome Test | 1 | And I log out - And I log in as "student1" - And I am on "Course 1" course homepage - And I follow "Test assignment name" + And I am on the "Test assignment name" "assign activity" page logged in as student1 And I press "Add submission" And I set the following fields to these values: | Online text | My online text | And I press "Save changes" And I log out - When I log in as "teacher1" - And I am on "Course 1" course homepage - And I follow "Test assignment name" + When I am on the "Test assignment name" "assign activity" page logged in as teacher1 And I navigate to "View all submissions" in current page administration And I click on "Grade" "link" in the "Student 0" "table_row" And I set the following fields to these values: | Outcome Test: | Excellent | And I press "Save changes" And I click on "Edit settings" "link" - And I follow "Test assignment name" + When I am on the "Test assignment name" "assign activity" page And I navigate to "View all submissions" in current page administration Then I should see "Outcome Test: Excellent" in the "Student 0" "table_row" And I should not see "Outcome Test: Excellent" in the "Student 1" "table_row" @@ -88,32 +85,28 @@ Feature: Outcome grading And I log in as "teacher1" And I am on "Course 1" course homepage with editing mode on And I add a "Assignment" to section "1" and I fill the form with: - | Assignment name | Test assignment name | - | Description | Test assignment description | - | assignsubmission_onlinetext_enabled | 1 | - | Students submit in groups | Yes | - | Group mode | No groups | - | Outcome Test | 1 | + | Assignment name | Test assignment name | + | Description | Test assignment description | + | ID number | Test assignment name | + | assignsubmission_onlinetext_enabled | 1 | + | Students submit in groups | Yes | + | Group mode | No groups | + | Outcome Test | 1 | And I log out - And I log in as "student1" - And I am on "Course 1" course homepage - And I follow "Test assignment name" + And I am on the "Test assignment name" "assign activity" page logged in as student1 And I press "Add submission" And I set the following fields to these values: | Online text | My online text | And I press "Save changes" And I log out - When I log in as "teacher1" - And I am on "Course 1" course homepage - And I follow "Test assignment name" + When I am on the "Test assignment name" "assign activity" page logged in as teacher1 And I navigate to "View all submissions" in current page administration And I click on "Grade" "link" in the "Student 0" "table_row" And I set the following fields to these values: | Outcome Test: | Excellent | | Apply grades and feedback to entire group | Yes | And I press "Save changes" - And I click on "Edit settings" "link" - And I follow "Test assignment name" + And I am on the "Test assignment name" "assign activity" page And I navigate to "View all submissions" in current page administration Then I should see "Outcome Test: Excellent" in the "Student 0" "table_row" And I should see "Outcome Test: Excellent" in the "Student 1" "table_row" @@ -123,8 +116,7 @@ Feature: Outcome grading | Outcome Test: | Disappointing | | Apply grades and feedback to entire group | No | And I press "Save changes" - And I click on "Edit settings" "link" - And I follow "Test assignment name" + And I am on the "Test assignment name" "assign activity" page And I navigate to "View all submissions" in current page administration And I should see "Outcome Test: Excellent" in the "Student 0" "table_row" And I should see "Outcome Test: Disappointing" in the "Student 1" "table_row" diff --git a/mod/assign/tests/behat/submit_without_group.feature b/mod/assign/tests/behat/submit_without_group.feature index 56c5a9a1573bd..93eeb4a0c0840 100644 --- a/mod/assign/tests/behat/submit_without_group.feature +++ b/mod/assign/tests/behat/submit_without_group.feature @@ -11,11 +11,11 @@ Feature: Submit assignment without group | Course 2 | C2 | 0 | 1 | | Course 3 | C3 | 0 | 1 | And the following "activities" exist: - | activity | course | idnumber | name | intro | assignsubmission_onlinetext_enabled | preventsubmissionnotingroup | teamsubmission | - | assign | C1 | assign1 | Allow default group | Test assignment description | 1 | 0 | 1 | - | assign | C1 | assign2 | Require group membership | Test assignment description | 1 | 1 | 1 | - | assign | C2 | assign2 | Require group membership | Test assignment description | 1 | 1 | 1 | - | assign | C3 | assign2 | Require group membership | Test assignment description | 1 | 1 | 1 | + | activity | course | idnumber | name | intro | assignsubmission_onlinetext_enabled | preventsubmissionnotingroup | teamsubmission | + | assign | C1 | c1assign1 | Allow default group | Test assignment description | 1 | 0 | 1 | + | assign | C1 | c1assign2 | Require group membership | Test assignment description | 1 | 1 | 1 | + | assign | C2 | c2assign1 | Require group membership | Test assignment description | 1 | 1 | 1 | + | assign | C3 | c3assign1 | Require group membership | Test assignment description | 1 | 1 | 1 | And the following "users" exist: | username | firstname | lastname | email | | teacher1 | Teacher | 1 | teacher1@example.com | @@ -44,9 +44,7 @@ Feature: Submit assignment without group | student3 | GC31 | | student3 | GC32 | # Student 1 can only submit assignment in course 2. - When I log in as "student1" - And I am on "Course 1" course homepage - And I follow "Allow default group" + When I am on the "c1assign1" "assign activity" page logged in as student1 Then I should not see "Not a member of any group" And I should not see "This assignment requires submission in groups. You are not a member of any group" And I should see "Nothing has been submitted for this assignment" @@ -57,14 +55,12 @@ Feature: Submit assignment without group And I press "Submit assignment" And I press "Continue" And I should see "Submitted for grading" - And I am on "Course 1" course homepage - And I follow "Require group membership" + And I am on the "c1assign2" "assign activity" page And I should see "Not a member of any group" And I should see "This assignment requires submission in groups. You are not a member of any group" And I should see "Nothing has been submitted for this assignment" And I should not see "Add submission" - And I am on "Course 2" course homepage - And I follow "Require group membership" + And I am on the "c2assign1" "assign activity" page And I should not see "Not a member of any group" And I should see "Nothing has been submitted for this assignment" And I press "Add submission" @@ -76,18 +72,13 @@ Feature: Submit assignment without group And I should see "Submitted for grading" And I log out # Student 2 should see submitted for grading. - And I log in as "student2" - And I am on "Course 1" course homepage - And I follow "Allow default group" + And I am on the "c1assign1" "assign activity" page logged in as student2 And I should see "Submitted for grading" - And I am on "Course 2" course homepage - And I follow "Require group membership" + And I am on the "c2assign1" "assign activity" page And I should see "Submitted for grading" And I log out # Teacher should see student 1 and student 2 has submitted assignment. - And I log in as "teacher1" - And I am on "Course 1" course homepage - And I follow "Allow default group" + And I am on the "c1assign1" "assign activity" page logged in as teacher1 And I should see "1" in the "Groups" "table_row" And I should not see "The setting 'Require group to make submission\' is enabled and some users are either not a member of any group, or are a member of more than one group, so are unable to make submissions." And I navigate to "View all submissions" in current page administration @@ -95,8 +86,7 @@ Feature: Submit assignment without group And I should see "Default group" in the "Student 2" "table_row" And I should see "Submitted for grading" in the "Student 1" "table_row" And I should see "Submitted for grading" in the "Student 2" "table_row" - And I am on "Course 1" course homepage - And I follow "Require group membership" + And I am on the "c1assign2" "assign activity" page And I should see "0" in the "Groups" "table_row" And I should see "The setting 'Require group to make submission' is enabled and some users are either not a member of any group, or are a member of more than one group, so are unable to make submissions." And I navigate to "View all submissions" in current page administration @@ -104,8 +94,7 @@ Feature: Submit assignment without group And I should see "Not a member of any group, so unable to make submissions." in the "Student 2" "table_row" And I should not see "Submitted for grading" in the "Student 1" "table_row" And I should not see "Submitted for grading" in the "Student 2" "table_row" - And I am on "Course 2" course homepage - And I follow "Require group membership" + And I am on the "c2assign1" "assign activity" page And I should see "1" in the "Groups" "table_row" And I should not see "The setting 'Require group to make submission' is enabled and some users are either not a member of any group, or are a member of more than one group, so are unable to make submissions." And I navigate to "View all submissions" in current page administration @@ -115,17 +104,13 @@ Feature: Submit assignment without group And I should see "Submitted for grading" in the "Student 2" "table_row" And I log out # Test student 3 (in multiple groups) should not be able to submit. - And I log in as "student3" - And I am on "Course 3" course homepage - And I follow "Require group membership" + And I am on the "c3assign1" "assign activity" page logged in as student3 And I should see "Member of more than one group" And I should see "The assignment requires submission in groups. You are a member of more than one group." And I should see "Nothing has been submitted for this assignment" And I should not see "Add submission" And I log out - And I log in as "teacher1" - And I am on "Course 3" course homepage - And I follow "Require group membership" + And I am on the "c3assign1" "assign activity" page logged in as teacher1 And I should see "The setting 'Require group to make submission' is enabled and some users are either not a member of any group, or are a member of more than one group, so are unable to make submissions." And I navigate to "View all submissions" in current page administration And I should see "Member of more than one group, so unable to make submissions." in the "Student 3" "table_row" @@ -155,9 +140,7 @@ Feature: Submit assignment without group | user | group | | student1 | G1 | | student2 | G2 | - When I log in as "teacher1" - And I am on "Course 1" course homepage - And I follow "Allow default group" + When I am on the "Allow default group" "assign activity" page logged in as teacher1 Then I should not see "The setting 'Require group to make submission\' is enabled and some users are either not a member of any group, or are a member of more than one group, so are unable to make submissions." And I should not see "The setting 'Students submit in groups' is enabled and some users are either not a member of any group, or are a member of more than one group. Please be aware that these students will submit as members of the 'Default group'." @@ -185,9 +168,7 @@ Feature: Submit assignment without group And the following "group members" exist: | user | group | | student1 | G1 | - When I log in as "teacher1" - And I am on "Course 1" course homepage - And I follow "Allow default group" + When I am on the "Allow default group" "assign activity" page logged in as teacher1 Then I should not see "The setting 'Require group to make submission\' is enabled and some users are either not a member of any group, or are a member of more than one group, so are unable to make submissions." And I should see "The setting 'Students submit in groups' is enabled and some users are either not a member of any group, or are a member of more than one group. Please be aware that these students will submit as members of the 'Default group'." @@ -217,8 +198,6 @@ Feature: Submit assignment without group | student1 | G1 | | student2 | G1 | | student2 | G2 | - When I log in as "teacher1" - And I am on "Course 1" course homepage - And I follow "Allow default group" + When I am on the "Allow default group" "assign activity" page logged in as teacher1 Then I should not see "The setting 'Require group to make submission\' is enabled and some users are either not a member of any group, or are a member of more than one group, so are unable to make submissions." And I should see "The setting 'Students submit in groups' is enabled and some users are either not a member of any group, or are a member of more than one group. Please be aware that these students will submit as members of the 'Default group'." diff --git a/mod/book/tests/behat/book_activity_completion.feature b/mod/book/tests/behat/book_activity_completion.feature index ad188c5f3938a..1f5534a7f8da9 100644 --- a/mod/book/tests/behat/book_activity_completion.feature +++ b/mod/book/tests/behat/book_activity_completion.feature @@ -10,20 +10,12 @@ Feature: View activity completion information in the book activity | student1 | Vinnie | Student1 | student1@example.com | | teacher1 | Darrell | Teacher1 | teacher1@example.com | And the following "courses" exist: - | fullname | shortname | category | - | Course 1 | C1 | 0 | + | fullname | shortname | enablecompletion | showcompletionconditions | + | Course 1 | C1 | 1 | 1 | And the following "course enrolments" exist: | user | course | role | | student1 | C1 | student | | teacher1 | C1 | editingteacher | - And I log in as "teacher1" - And I am on "Course 1" course homepage - And I navigate to "Edit settings" in current page administration - And I expand all fieldsets - And I set the following fields to these values: - | Enable completion tracking | Yes | - | Show activity completion conditions | Yes | - And I press "Save and display" And the following "activity" exists: | activity | book | | course | C1 | @@ -32,32 +24,22 @@ Feature: View activity completion information in the book activity | section | 1 | | completion | 2 | | completionview | 1 | - And I log out Scenario: View automatic completion items - Given I log in as "teacher1" - And I am on "Course 1" course homepage - And I follow "Music history" - And I set the following fields to these values: - | Chapter title | Drum theory | - | Content | Rudiments are important | - And I press "Save changes" - # Teacher view. - And I follow "Music history" + Given the following "mod_book > chapter" exists: + | book | Music history | + | title | Drum theory | + | content | Rudiments are important | + And I am on the "Music history" "book activity" page logged in as teacher1 And "Music history" should have the "View" completion condition And I log out # Student view. - When I log in as "student1" - And I am on "Course 1" course homepage - And I follow "Music history" + When I am on the "Music history" "book activity" page logged in as student1 Then the "View" completion condition of "Music history" is displayed as "done" @javascript Scenario: Use manual completion - Given I log in as "teacher1" - And I am on "Course 1" course homepage - And I follow "Music history" - And I navigate to "Edit settings" in current page administration + Given I am on the "Music history" "book activity editing" page logged in as teacher1 And I expand all fieldsets And I set the field "Completion tracking" to "Students can manually mark the activity as completed" And I press "Save and display" @@ -65,14 +47,12 @@ Feature: View activity completion information in the book activity | Chapter title | Drum theory | | Content | Rudiments are important | And I press "Save changes" - And I follow "Music history" + And I am on the "Music history" "book activity" page # Teacher view. And the manual completion button for "Music history" should be disabled And I log out # Student view. - When I log in as "student1" - And I am on "Course 1" course homepage - And I follow "Music history" + Given I am on the "Music history" "book activity" page logged in as student1 Then the manual completion button of "Music history" is displayed as "Mark as done" And I toggle the manual completion state of "Music history" And the manual completion button of "Music history" is displayed as "Done" diff --git a/mod/book/tests/behat/edit_tags.feature b/mod/book/tests/behat/edit_tags.feature index 7b2b8c70e60cc..d1b3cc2fa571e 100644 --- a/mod/book/tests/behat/edit_tags.feature +++ b/mod/book/tests/behat/edit_tags.feature @@ -24,9 +24,7 @@ Feature: Edited book chapters handle tags correctly | student1 | C1 | student | Scenario: Book chapter edition of custom tags works as expected - Given I log in as "teacher1" - And I am on "Course 1" course homepage - And I follow "Test book" + Given I am on the "Test book" "book activity" page logged in as teacher1 And I set the following fields to these values: | Chapter title | Dummy first chapter | | Content | Dream is the start of a journey | @@ -50,9 +48,7 @@ Feature: Edited book chapters handle tags correctly And I set the field "Enter comma-separated list of new tags" to "OT1, OT2, OT3" And I press "Continue" And I log out - And I log in as "teacher1" - And I am on "Course 1" course homepage - And I follow "Test book" + And I am on the "Test book" "book activity" page logged in as teacher1 And I open the autocomplete suggestions list And I should see "OT1" in the ".form-autocomplete-suggestions" "css_element" And I should see "OT2" in the ".form-autocomplete-suggestions" "css_element" diff --git a/mod/book/tests/behat/log_entries.feature b/mod/book/tests/behat/log_entries.feature index e6fed44deb67f..cfa4add8df18c 100644 --- a/mod/book/tests/behat/log_entries.feature +++ b/mod/book/tests/behat/log_entries.feature @@ -9,12 +9,13 @@ Feature: In a book, verify log entries Given the following "courses" exist: | fullname | shortname | category | groupmode | | Course 1 | C1 | 0 | 1 | - And I log in as "admin" + And the following "activity" exists: + | course | C1 | + | activity | book | + | name | Test book | + And I am on the "Course 1" course page logged in as admin And I am on "Course 1" course homepage with editing mode on - When I add a "Book" to section "1" and I fill the form with: - | Name | Test book | - | Description | A book about dreams! | - And I follow "Test book" + And I am on the "Test book" "book activity" page And I set the following fields to these values: | Chapter title | First chapter | | Content | First chapter | diff --git a/mod/book/tests/behat/show_hide_chapters.feature b/mod/book/tests/behat/show_hide_chapters.feature index 651de447cec65..ed5e5ec0db43d 100644 --- a/mod/book/tests/behat/show_hide_chapters.feature +++ b/mod/book/tests/behat/show_hide_chapters.feature @@ -16,16 +16,16 @@ Feature: Book activity chapter visibility management | 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 "Book" to section "1" and I fill the form with: - | Name | Test book | - | Description | A book about dreams! | - And I follow "Test book" + And the following "activity" exists: + | course | C1 | + | activity | book | + | name | Test book | + And I am on the "Test book" "book activity" page logged in as teacher1 And I set the following fields to these values: | Chapter title | First chapter | | Content | First chapter | And I press "Save changes" + And I turn editing mode on And I click on "Add new chapter after \"First chapter\"" "link" And I set the following fields to these values: | Chapter title | Second chapter | @@ -53,9 +53,8 @@ Feature: Book activity chapter visibility management Scenario: Show/hide chapters and subchapters When I follow "Hide chapter \"2. Second chapter\"" And I follow "Hide chapter \"2. Third chapter\"" + And I am on the "Test book" "book activity" page And I turn editing mode off - And I am on "Course 1" course homepage - And I follow "Test book" Then the "class" attribute of "a[title='Second chapter']" "css_element" should contain "dimmed_text" And the "class" attribute of "a[title='Third chapter']" "css_element" should contain "dimmed_text" And I turn editing mode on @@ -70,13 +69,11 @@ Feature: Book activity chapter visibility management And I should see "Fourth chapter" in the ".book_content" "css_element" And I follow "Exit book" And I log out - And I log in as "student1" - And I am on "Course 1" course homepage - And I follow "Test book" + And I am on the "Test book" "book activity" page logged in as student1 And I should not see "Second chapter" in the "Table of contents" "block" And I should not see "Third chapter" in the "Table of contents" "block" And I follow "Next" And I should see "Fourth chapter" in the ".book_content" "css_element" And I follow "Exit book" - And I follow "Test book" + And I am on the "Test book" "book activity" page And I should see "First chapter" in the ".book_content" "css_element" diff --git a/mod/book/tests/generator/behat_mod_book_generator.php b/mod/book/tests/generator/behat_mod_book_generator.php new file mode 100644 index 0000000000000..77601374f14cd --- /dev/null +++ b/mod/book/tests/generator/behat_mod_book_generator.php @@ -0,0 +1,58 @@ +. + +/** + * Behat data generator for mod_book. + * + * @package mod_book + * @category test + * @copyright 2021 Andrew Lyons + * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later + */ + +/** + * Behat data generator for mod_book. + * + * @copyright 2019 The Open University + * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later + */ +class behat_mod_book_generator extends behat_generator_base { + + protected function get_creatable_entities(): array { + return [ + 'chapters' => [ + 'singular' => 'chapter', + 'datagenerator' => 'chapter', + 'required' => ['book', 'title', 'content'], + 'switchids' => ['book' => 'bookid'], + ], + ]; + } + + /** + * Look up the id of a book from its name. + * + * @param string $bookname the book name, for example 'Test book'. + * @return int corresponding id. + */ + protected function get_book_id(string $bookname): int { + global $DB; + + $cm = $this->get_cm_by_activity_name('book', $bookname); + + return $cm->instance; + } +} diff --git a/mod/choice/tests/behat/activity_info_completion_automatic.feature b/mod/choice/tests/behat/activity_info_completion_automatic.feature index 6acd80966d5eb..de7111256bc39 100644 --- a/mod/choice/tests/behat/activity_info_completion_automatic.feature +++ b/mod/choice/tests/behat/activity_info_completion_automatic.feature @@ -29,9 +29,7 @@ Feature: Automatic completion in the choice activity | teacher1 | C1 | editingteacher | Scenario: Viewing a choice activity with automatic completion as a student - Given I log in as "student1" - And I am on "Course 1" course homepage - When I follow "What to drink?" + When I am on the "What to drink?" "choice activity" page logged in as student1 Then the "View" completion condition of "What to drink?" is displayed as "done" And the "Make a choice" completion condition of "What to drink?" is displayed as "todo" And I set the field "Beer" to "1" @@ -40,22 +38,17 @@ Feature: Automatic completion in the choice activity And the "Make a choice" completion condition of "What to drink?" is displayed as "done" Scenario: Viewing a choice activity with automatic completion as a teacher - Given I log in as "teacher1" - And I am on "Course 1" course homepage - When I follow "What to drink?" + When I am on the "What to drink?" "choice activity" page logged in as teacher1 Then "What to drink?" should have the "View" completion condition And "What to drink?" should have the "Make a choice" completion condition @javascript Scenario: Overriding automatic choice completion for a user - Given I log in as "teacher1" - And I am on "Course 1" course homepage + Given I am on the "Course 1" course page logged in as teacher1 And I navigate to "Reports > Activity completion" in current page administration And I click on "Student 1, What to drink?: Not completed" "link" And I press "Save changes" And I log out - And I log in as "student1" - And I am on "Course 1" course homepage - When I follow "What to drink?" + When I am on the "What to drink?" "choice activity" page logged in as student1 Then the "View" completion condition of "What to drink?" overridden by "Teacher 1" is displayed as "done" And the "Make a choice" completion condition of "What to drink?" overridden by "Teacher 1" is displayed as "done" diff --git a/mod/choice/tests/behat/activity_info_completion_manual.feature b/mod/choice/tests/behat/activity_info_completion_manual.feature index b44b9690d6e7f..92db49d5ad607 100644 --- a/mod/choice/tests/behat/activity_info_completion_manual.feature +++ b/mod/choice/tests/behat/activity_info_completion_manual.feature @@ -28,9 +28,7 @@ Feature: Manual completion in the choice activity @javascript Scenario: Toggle manual completion as a student - Given I log in as "student1" - And I am on "Course 1" course homepage - And I follow "What to drink?" + Given I am on the "What to drink?" "choice activity" page logged in as student1 And the manual completion button of "What to drink?" is displayed as "Mark as done" When I toggle the manual completion state of "What to drink?" Then the manual completion button of "What to drink?" is displayed as "Done" @@ -49,43 +47,33 @@ Feature: Manual completion in the choice activity But "Done" "button" should not exist Scenario: Viewing a choice activity with manual completion as a teacher - Given I log in as "teacher1" - And I am on "Course 1" course homepage - When I follow "What to drink?" + When I am on the "What to drink?" "choice activity" page logged in as teacher1 Then the manual completion button for "What to drink?" should be disabled @javascript Scenario: Overriding a manual choice completion for a user to done - Given I log in as "teacher1" - And I am on "Course 1" course homepage + Given I am on the "Course 1" course page logged in as teacher1 And I navigate to "Reports > Activity completion" in current page administration And I click on "Student 1, What to drink?: Not completed" "link" And I press "Save changes" And I log out - And I log in as "student1" - And I am on "Course 1" course homepage - When I follow "What to drink?" + When I am on the "What to drink?" "choice activity" page logged in as student1 Then the manual completion button of "What to drink?" overridden by "Teacher 1" is displayed as "Done" And I toggle the manual completion state of "What to drink?" And the manual completion button of "What to drink?" is displayed as "Mark as done" @javascript Scenario: Overriding a manual choice completion for a user to not done - Given I log in as "student1" - And I am on "Course 1" course homepage - And I follow "What to drink?" + Given I am on the "What to drink?" "choice activity" page logged in as student1 And I press "Mark as done" And I wait until the page is ready 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 I navigate to "Reports > Activity completion" in current page administration And I click on "Student 1, What to drink?: Completed" "link" And I press "Save changes" And I log out - And I log in as "student1" - And I am on "Course 1" course homepage - When I follow "What to drink?" + Given I am on the "What to drink?" "choice activity" page logged in as student1 Then the manual completion button of "What to drink?" overridden by "Teacher 1" is displayed as "Mark as done" And I toggle the manual completion state of "What to drink?" And the manual completion button of "What to drink?" is displayed as "Done" diff --git a/mod/choice/tests/behat/behat_mod_choice.php b/mod/choice/tests/behat/behat_mod_choice.php index a959c56fd8048..2ba915656b75c 100644 --- a/mod/choice/tests/behat/behat_mod_choice.php +++ b/mod/choice/tests/behat/behat_mod_choice.php @@ -46,8 +46,7 @@ class behat_mod_choice extends behat_base { * @return array */ public function I_choose_option_from_activity($option, $choiceactivity) { - - $this->execute("behat_general::click_link", $this->escape($choiceactivity)); + $this->execute("behat_navigation::i_am_on_page_instance", [$this->escape($choiceactivity), 'choice activity']); $this->execute('behat_forms::i_set_the_field_to', array( $this->escape($option), 1)); @@ -69,7 +68,7 @@ public function I_choose_options_from_activity($option, $choiceactivity) { $behatforms = behat_context_helper::get('behat_forms'); // Go to choice activity. - $behatgeneral->click_link($this->escape($choiceactivity)); + $this->execute("behat_navigation::i_am_on_page_instance", [$this->escape($choiceactivity), 'choice activity']); // Wait for page to be loaded. $this->wait_for_pending_js(); diff --git a/mod/choice/tests/behat/modify_choice.feature b/mod/choice/tests/behat/modify_choice.feature index 7f8e4c467c0ec..04cd52dc77ce4 100644 --- a/mod/choice/tests/behat/modify_choice.feature +++ b/mod/choice/tests/behat/modify_choice.feature @@ -26,10 +26,7 @@ Feature: Teacher can modify choices of the students @javascript Scenario: Delete students choice response as a teacher - When I log in as "teacher1" - And I am on "Course 1" course homepage - And I follow "Choice name" - And I navigate to "Edit settings" in current page administration + Given I am on the "Choice name" "choice activity editing" page logged in as teacher1 And I expand all fieldsets And I set the field "Show column for unanswered" to "Yes" And I press "Save and return to course" @@ -42,35 +39,27 @@ Feature: Teacher can modify choices of the students And I log out And I log in as "teacher1" And I change window size to "large" - And I am on "Course 1" course homepage - And I follow "Choice name" + And I am on the "Choice name" "choice activity" page And I navigate to "View 1 responses" in current page administration And I click on "Student 1 Option 1" "checkbox" And I select "Delete" from the "With selected" singleselect And "Student 1 Option 1" "checkbox" should not exist And "Student 1 Not answered yet" "checkbox" should exist - And I log out @javascript Scenario: Teacher set answers of students who did not respond or change existing answers - When I log in as "teacher1" - And I am on "Course 1" course homepage - And I follow "Choice name" - And I navigate to "Edit settings" in current page administration + Given I am on the "Choice name" "choice activity editing" page logged in as teacher1 And I expand all fieldsets And I set the field "Show column for unanswered" to "Yes" And I press "Save and return to course" And I log out - And I log in as "student1" - And I am on "Course 1" course homepage + And I am on the "Course 1" course page logged in as student1 And I choose "Option 1" from "Choice name" choice activity Then I should see "Your selection: Option 1" And I should see "Your choice has been saved" And I log out - And I log in as "teacher1" And I change window size to "large" - And I am on "Course 1" course homepage - And I follow "Choice name" + And I am on the "Choice name" "choice activity" page logged in as teacher1 And I navigate to "View 1 responses" in current page administration And I click on "Student 1 Option 1" "checkbox" And I click on "Student 2 Not answered yet" "checkbox" @@ -82,52 +71,38 @@ Feature: Teacher can modify choices of the students And "Student 1 Option 2" "checkbox" should exist And "Student 2 Option 2" "checkbox" should exist And "Student 3 Option 2" "checkbox" should exist - And I log out @javascript Scenario: Teacher can delete answers in the multiple answer choice - And I log in as "teacher1" - And I am on "Course 1" course homepage - And I follow "Choice name" - And I navigate to "Edit settings" in current page administration + Given I am on the "Choice name" "choice activity editing" page logged in as teacher1 And I set the field "Allow more than one choice to be selected" to "Yes" And I press "Save and return to course" And I log out - And I log in as "student1" - And I am on "Course 1" course homepage + And I am on the "Course 1" course page logged in as student1 And I choose options "Option 1","Option 2" from "Choice name" choice activity And I should see "Your selection: Option 1; Option 2" And I should see "Your choice has been saved" And I log out - And I log in as "teacher1" And I change window size to "large" - And I am on "Course 1" course homepage - And I follow "Choice name" + And I am on the "Choice name" "choice activity" page logged in as teacher1 And I navigate to "View 1 responses" in current page administration And I click on "Student 1 Option 2" "checkbox" And I select "Delete" from the "With selected" singleselect And I click on "Student 1 Option 1" "checkbox" And I select "Choose: Option 3" from the "With selected" singleselect And I log out - And I log in as "student1" - And I am on "Course 1" course homepage - And I follow "Choice name" + And I am on the "Choice name" "choice activity" page logged in as student1 And I should see "Your selection: Option 1; Option 3" - And I log out @javascript Scenario: Teacher can manage answers on view page if the names are displayed - When I log in as "student1" - And I am on "Course 1" course homepage + Given I am on the "Course 1" course page logged in as student1 And I choose "Option 1" from "Choice name" choice activity Then I should see "Your selection: Option 1" And I should see "Your choice has been saved" And I log out - And I log in as "teacher1" And I change window size to "large" - And I am on "Course 1" course homepage - And I follow "Choice name" - And I navigate to "Edit settings" in current page administration + And I am on the "Choice name" "choice activity editing" page logged in as teacher1 And I set the following fields to these values: | Publish results | Always show results to students | | Privacy of results | Publish full results, showing names and their choices | @@ -144,4 +119,3 @@ Feature: Teacher can modify choices of the students And I select "Delete" from the "With selected" singleselect And "Student 1 Option 3" "checkbox" should not exist And "Student 1 Not answered yet" "checkbox" should exist - And I log out diff --git a/mod/data/tests/behat/add_entries.feature b/mod/data/tests/behat/add_entries.feature index febc2e6406697..ccf21a1a73f80 100644 --- a/mod/data/tests/behat/add_entries.feature +++ b/mod/data/tests/behat/add_entries.feature @@ -22,8 +22,7 @@ Feature: Users can add entries to database activities @javascript Scenario: Students can add entries to a database - Given I log in as "teacher1" - And I am on "Course 1" course homepage + Given I am on the "Course 1" course page logged in as teacher1 And I add a "Text input" field to "Test database name" database and I fill the form with: | Field name | Test field name | | Field description | Test field description | @@ -34,8 +33,7 @@ Feature: Users can add entries to database activities And I follow "Templates" And I wait until the page is ready 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 And I add an entry to "Test database name" database with: | Test field name | Student original entry | | Test field 2 name | Student original entry 2 | @@ -71,9 +69,7 @@ Feature: Users can add entries to database activities And I should see "Student third entry" # Now I will bulk delete the rest of the entries. And I log out - And I log in as "teacher1" - And I am on "Course 1" course homepage - And I follow "Test database name" + And I am on the "Test database name" "data activity" page logged in as teacher1 And I press "Select all" And I press "Delete selected" And I press "Delete" @@ -81,8 +77,7 @@ Feature: Users can add entries to database activities @javascript @editor @editor_atto @atto @atto_h5p Scenario: If a new text area entry is added, the filepicker is displayed in the H5P Atto button - Given I log in as "teacher1" - And I am on "Course 1" course homepage + Given I am on the "Course 1" course page logged in as teacher1 And I add a "Text area" field to "Test database name" database and I fill the form with: | Field name | Textarea field name | When I add an entry to "Test database name" database with: diff --git a/mod/data/tests/behat/behat_mod_data.php b/mod/data/tests/behat/behat_mod_data.php index 7adbb282e43fb..1f59bc6cc5d77 100644 --- a/mod/data/tests/behat/behat_mod_data.php +++ b/mod/data/tests/behat/behat_mod_data.php @@ -48,8 +48,7 @@ class behat_mod_data extends behat_base { * @param TableNode $fielddata */ public function i_add_a_field_to_database_and_i_fill_the_form_with($fieldtype, $activityname, TableNode $fielddata) { - - $this->execute("behat_general::click_link", $this->escape($activityname)); + $this->execute('behat_navigation::i_am_on_page_instance', [$this->escape($activityname), 'data activity']); // Open "Fields" tab if it is not already open. $fieldsstr = get_string('fields', 'mod_data'); @@ -80,11 +79,33 @@ public function i_add_a_field_to_database_and_i_fill_the_form_with($fieldtype, $ * @param TableNode $entrydata */ public function i_add_an_entry_to_database_with($activityname, TableNode $entrydata) { + $this->execute('behat_navigation::i_am_on_page_instance', [$this->escape($activityname), 'mod_data > add entry']); + $this->execute("behat_forms::i_set_the_following_fields_to_these_values", $entrydata); + } + + /** + * Convert page names to URLs for steps like 'When I am on the "[identifier]" "[page type]" page'. + * + * Recognised page names are: + * | pagetype | name meaning | description | + * | Add entry | Database name | Add an entry page (view.php) | + * + * @param string $type identifies which type of page this is, e.g. 'Add entry'. + * @param string $identifier identifies the particular page, e.g. 'My database name'. + * @return moodle_url the corresponding URL. + * @throws Exception with a meaningful error message if the specified page cannot be found. + */ + protected function resolve_page_instance_url(string $type, string $identifier): moodle_url { + global $DB; - $this->execute("behat_general::click_link", $this->escape($activityname)); - $this->execute("behat_navigation::i_navigate_to_in_current_page_administration", - get_string('add', 'mod_data')); + switch (strtolower($type)) { + case 'add entry': + return new moodle_url('/mod/data/edit.php', [ + 'd' => $this->get_cm_by_activity_name('data', $identifier)->instance, + ]); - $this->execute("behat_forms::i_set_the_following_fields_to_these_values", $entrydata); + default: + throw new Exception("Unrecognised page type '{$type}'"); + } } } diff --git a/mod/data/tests/behat/data_activity_completion.feature b/mod/data/tests/behat/data_activity_completion.feature index 8a267721c3df3..a52d785ead115 100644 --- a/mod/data/tests/behat/data_activity_completion.feature +++ b/mod/data/tests/behat/data_activity_completion.feature @@ -10,29 +10,21 @@ Feature: View activity completion in the database activity | student1 | Vinnie | Student1 | student1@example.com | | teacher1 | Darrell | Teacher1 | teacher1@example.com | And the following "courses" exist: - | fullname | shortname | category | - | Course 1 | C1 | 0 | + | fullname | shortname | enablecompletion | showcompletionconditions | + | Course 1 | C1 | 1 | 1 | And the following "course enrolments" exist: | user | course | role | | student1 | C1 | student | | teacher1 | C1 | editingteacher | - And I log in as "teacher1" - And I am on "Course 1" course homepage - And I navigate to "Edit settings" in current page administration - And I expand all fieldsets - And I set the following fields to these values: - | Enable completion tracking | Yes | - | Show activity completion conditions | Yes | - And I press "Save and display" And the following "activity" exists: - | activity | data | - | course | C1 | - | idnumber | mh1 | - | name | Music history | - | section | 1 | - And I am on "Course 1" course homepage - And I follow "Music history" - And I navigate to "Edit settings" in current page administration + | activity | data | + | course | C1 | + | idnumber | mh1 | + | name | Music history | + | section | 1 | + | completionentriesenabled | 1 | + | completionentries | 2 | + Given I am on the "Music history" "data activity editing" page logged in as teacher1 And I expand all fieldsets And I set the following fields to these values: | Aggregate type | Average of ratings | @@ -41,8 +33,6 @@ Feature: View activity completion in the database activity | Completion tracking | Show activity as complete when conditions are met | | Require view | 1 | | Require grade | 1 | - | completionentriesenabled | 1 | - | completionentries | 2 | And I press "Save and display" And I add a "Text input" field to "Music history" database and I fill the form with: | Field name | Instrument types | @@ -51,9 +41,7 @@ Feature: View activity completion in the database activity And I log out Scenario: View automatic completion items as a teacher and confirm all tabs display conditions - Given I log in as "teacher1" - And I am on "Course 1" course homepage - When I follow "Music history" + Given I am on the "Music history" "data activity" page logged in as teacher1 Then "Music history" should have the "View" completion condition And "Music history" should have the "Make entries: 2" completion condition And "Music history" should have the "Receive a grade" completion condition @@ -87,9 +75,7 @@ Feature: View activity completion in the database activity And "Music history" should have the "Receive a grade" completion condition Scenario: View automatic completion items as a student - Given I log in as "student1" - And I am on "Course 1" course homepage - And I follow "Music history" + Given I am on the "Music history" "data activity" page logged in as student1 And the "View" completion condition of "Music history" is displayed as "done" And the "Make entries: 2" completion condition of "Music history" is displayed as "todo" And the "Receive a grade" completion condition of "Music history" is displayed as "todo" @@ -109,30 +95,24 @@ Feature: View activity completion in the database activity And the "Make entries: 2" completion condition of "Music history" is displayed as "done" And the "Receive a grade" completion condition of "Music history" is displayed as "todo" And I log out - And I log in as "teacher1" - And I am on "Course 1" course homepage - And I follow "Music history" + + And I am on the "Music history" "data activity" page logged in as teacher1 And I follow "View single" And I set the field "rating" to "3" And I press "Rate" And I log out - When I log in as "student1" - And I am on "Course 1" course homepage - And I follow "Music history" + + When I am on the "Music history" "data activity" page logged in as student1 Then the "View" completion condition of "Music history" is displayed as "done" And the "Make entries: 2" completion condition of "Music history" is displayed as "done" And the "Receive a grade" completion condition of "Music history" is displayed as "done" And I log out - And I log in as "teacher1" - And I am on "Course 1" course homepage + When I am on the "Course 1" course page logged in as teacher1 And "Vinnie Student1" user has completed "Music history" activity @javascript Scenario: Use manual completion - Given I log in as "teacher1" - And I am on "Course 1" course homepage - And I follow "Music history" - And I navigate to "Edit settings" in current page administration + Given I am on the "Music history" "data activity editing" page logged in as teacher1 And I expand all fieldsets And I set the field "Completion tracking" to "Students can manually mark the activity as completed" And I press "Save and display" @@ -140,9 +120,7 @@ Feature: View activity completion in the database activity And the manual completion button for "Music history" should be disabled And I log out # Student view. - When I log in as "student1" - And I am on "Course 1" course homepage - And I follow "Music history" + When I am on the "Music history" "data activity" page logged in as student1 Then the manual completion button of "Music history" is displayed as "Mark as done" And I toggle the manual completion state of "Music history" And the manual completion button of "Music history" is displayed as "Done" diff --git a/mod/data/tests/behat/manageapproved.feature b/mod/data/tests/behat/manageapproved.feature index 0d2166fd8b016..0f4f1bb847f4c 100644 --- a/mod/data/tests/behat/manageapproved.feature +++ b/mod/data/tests/behat/manageapproved.feature @@ -16,18 +16,17 @@ Feature: Users can edit approved entries in database activities | 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 @javascript Scenario: Students can manage their approved entries to a database - # Create database activity and allow editing of - # approved entries. - And I add a "Database" to section "1" and I fill the form with: - | Name | Test database name | - | Description | Test | - | id_approval | Yes | - | id_manageapproved | Yes | + Given the following "activity" exists: + | activity | data | + | course | C1 | + | idnumber | Test database name | + | name | Test database name | + | approval | 1 | + | manageapproved | 1 | + And I am on the "Test database name" "data activity" page logged in as teacher1 And I add a "Text input" field to "Test database name" database and I fill the form with: | Field name | Test field name | | Field description | Test field description | @@ -35,34 +34,31 @@ Feature: Users can edit approved entries in database activities And I follow "Templates" And I log out # Add an entry as a student. - And I log in as "student1" - And I am on "Course 1" course homepage + And I am on the "Test database name" "data activity" page logged in as student1 And I add an entry to "Test database name" database with: | Test field name | Student entry | And I press "Save and view" And I log out # Approve the student's entry as a teacher. - And I log in as "teacher1" - And I am on "Course 1" course homepage - And I follow "Test database name" + And I am on the "Test database name" "data activity" page logged in as teacher1 And I follow "Approve" And I log out # Make sure the student can still edit their entry after it's approved. - When I log in as "student1" - And I am on "Course 1" course homepage - And I follow "Test database name" + When I am on the "Test database name" "data activity" page logged in as student1 Then I should see "Student entry" And "Edit" "link" should exist @javascript Scenario: Students can not manage their approved entries to a database - # Create database activity and don't allow editing of - # approved entries. - And I add a "Database" to section "1" and I fill the form with: - | Name | Test database name | - | Description | Test | - | id_approval | Yes | - | id_manageapproved | No | + # Create database activity and don't allow editing of approved entries. + Given the following "activity" exists: + | activity | data | + | course | C1 | + | idnumber | Test database name | + | name | Test database name | + | approval | 1 | + | manageapproved | 0 | + And I am on the "Test database name" "data activity" page logged in as teacher1 And I add a "Text input" field to "Test database name" database and I fill the form with: | Field name | Test field name | | Field description | Test field description | @@ -70,21 +66,16 @@ Feature: Users can edit approved entries in database activities And I follow "Templates" And I log out # Add an entry as a student. - And I log in as "student1" - And I am on "Course 1" course homepage + And I am on the "Test database name" "data activity" page logged in as student1 And I add an entry to "Test database name" database with: | Test field name | Student entry | And I press "Save and view" And I log out # Approve the student's entry as a teacher. - And I log in as "teacher1" - And I am on "Course 1" course homepage - And I follow "Test database name" + And I am on the "Test database name" "data activity" page logged in as teacher1 And I follow "Approve" And I log out # Make sure the student isn't able to edit their entry after it's approved. - When I log in as "student1" - And I am on "Course 1" course homepage - And I follow "Test database name" - Then I should see "Student entry" - And "Edit" "link" should not exist + When I am on the "Test database name" "data activity" page logged in as student1 + Then "Edit" "link" should not exist + And I should see "Student entry" diff --git a/mod/feedback/tests/behat/anonymous.feature b/mod/feedback/tests/behat/anonymous.feature index 787bd217676fe..9e098efca049f 100644 --- a/mod/feedback/tests/behat/anonymous.feature +++ b/mod/feedback/tests/behat/anonymous.feature @@ -175,9 +175,7 @@ Feature: Anonymous feedback @javascript Scenario: Anonymous feedback in a course # Teacher can not - When I log in as "teacher" - And I am on "Course 1" course homepage - And I follow "Course feedback" + When I am on the "Course feedback" "feedback activity" page logged in as teacher And I click on "Edit questions" "link" in the "[role=main]" "css_element" And I add a "Multiple choice" question to the feedback with: | Question | Do you like this course? | @@ -186,9 +184,8 @@ Feature: Anonymous feedback | Hide the "Not selected" option | Yes | | Multiple choice values | Yes\nNo\nI don't know | And I log out - And I log in as "user1" - And I am on "Course 1" course homepage - And I follow "Course feedback" + + And I am on the "Course feedback" "feedback activity" page logged in as user1 And I follow "Preview" Then I should see "Do you like this course?" And I press "Continue" @@ -198,9 +195,7 @@ Feature: Anonymous feedback | Yes | 1 | And I press "Submit your answers" And I log out - And I log in as "user2" - And I am on "Course 1" course homepage - And I follow "Course feedback" + And I am on the "Course feedback" "feedback activity" page logged in as user2 And I follow "Preview" And I should see "Do you like this course?" And I press "Continue" @@ -218,9 +213,7 @@ Feature: Anonymous feedback And I should see "1 (50.00 %)" in the "Yes" "table_row" And I should see "1 (50.00 %)" in the "No" "table_row" And I log out - And I log in as "teacher" - And I am on "Course 1" course homepage - And I follow "Course feedback" + And I am on the "Course feedback" "feedback activity" page logged in as teacher And I follow "Preview" And I should see "Do you like this course?" And I press "Continue" @@ -243,12 +236,9 @@ Feature: Anonymous feedback And I should see "Anonymous entries (1)" And I should not see "Response number: 1" And I should see "Response number: 2" - And I log out Scenario: Collecting new non-anonymous feedback from a previously anonymous feedback activity - When I log in as "teacher" - And I am on "Course 1" course homepage - And I follow "Course feedback" + When I am on the "Course feedback" "feedback activity" page logged in as teacher And I navigate to "Edit settings" in current page administration And I set the following fields to these values: | Allow multiple submissions | Yes | @@ -259,36 +249,27 @@ Feature: Anonymous feedback | Label | shorttext | | Maximum characters accepted | 200 | And I log out - When I log in as "user1" - And I am on "Course 1" course homepage - And I follow "Course feedback" + When I am on the "Course feedback" "feedback activity" page logged in as user1 And I follow "Answer the questions" And I set the following fields to these values: | this is a short text answer | anontext | And I press "Submit your answers" And I log out # Switch to non-anon responses. - And I log in as "teacher" - And I am on "Course 1" course homepage - And I follow "Course feedback" - And I navigate to "Edit settings" in current page administration + And I am on the "Course feedback" "feedback activity editing" page logged in as teacher And I set the following fields to these values: | Record user names | User's name will be logged and shown with answers | And I press "Save and display" And I log out # Now leave a non-anon feedback as user1 - When I log in as "user1" - And I am on "Course 1" course homepage - And I follow "Course feedback" + And I am on the "Course feedback" "feedback activity" page logged in as user1 And I follow "Answer the questions" And I set the following fields to these values: | this is a short text answer | usertext | And I press "Submit your answers" And I log out # Now check the responses are correct. - When I log in as "teacher" - And I am on "Course 1" course homepage - And I follow "Course feedback" + And I am on the "Course feedback" "feedback activity" page logged in as teacher And I follow "Show responses" And I should see "Anonymous entries (1)" And I should see "Non anonymous entries (1)" diff --git a/mod/feedback/tests/behat/behat_mod_feedback.php b/mod/feedback/tests/behat/behat_mod_feedback.php index 23bf53a12f160..43e74ea8964ad 100644 --- a/mod/feedback/tests/behat/behat_mod_feedback.php +++ b/mod/feedback/tests/behat/behat_mod_feedback.php @@ -108,8 +108,7 @@ public function i_log_in_as_and_complete_feedback_in_course($username, $feedback $this->execute('behat_auth::i_log_in_as', $username); // Navigate to feedback complete form. - $this->execute('behat_navigation::i_am_on_course_homepage', $coursename); - $this->execute('behat_general::click_link', $feedbackname); + $this->execute('behat_navigation::i_am_on_page_instance', [$feedbackname, 'feedback activity']); $this->execute('behat_general::click_link', $completeform); // Fill form and submit. diff --git a/mod/feedback/tests/behat/export_import.feature b/mod/feedback/tests/behat/export_import.feature index 2157ca42d4ce9..4142369307178 100644 --- a/mod/feedback/tests/behat/export_import.feature +++ b/mod/feedback/tests/behat/export_import.feature @@ -21,9 +21,7 @@ Feature: Exporting and importing feedbacks | feedback | Learning experience | C1 | feedback0 | Scenario: Export sample feedback and compare with the fixture - When I log in as "teacher" - And I am on "Course 1" course homepage - And I follow "Learning experience" + When I am on the "Learning experience" "feedback activity" page logged in as teacher And I click on "Edit questions" "link" in the "[role=main]" "css_element" And I add a "Information" question to the feedback with: | Question | this is an information question | @@ -73,9 +71,7 @@ Feature: Exporting and importing feedbacks @javascript @_file_upload Scenario: Import feedback deleting old items - When I log in as "teacher" - And I am on "Course 1" course homepage - And I follow "Learning experience" + When I am on the "Learning experience" "feedback activity" page logged in as teacher And I click on "Edit questions" "link" in the "[role=main]" "css_element" And I add a "Numeric answer" question to the feedback with: | Question | Existing question | @@ -96,13 +92,10 @@ Feature: Exporting and importing feedbacks And I should see "this is a multiple choice rated" And I should see "this is a numeric answer" And I should see "this is a short text answer" - And I log out @javascript @_file_upload Scenario: Import feedback appending new items - When I log in as "teacher" - And I am on "Course 1" course homepage - And I follow "Learning experience" + When I am on the "Learning experience" "feedback activity" page logged in as teacher And I click on "Edit questions" "link" in the "[role=main]" "css_element" And I add a "Numeric answer" question to the feedback with: | Question | Existing question | @@ -125,4 +118,3 @@ Feature: Exporting and importing feedbacks And I should see "this is a multiple choice rated" And I should see "this is a numeric answer" And I should see "this is a short text answer" - And I log out diff --git a/mod/feedback/tests/behat/feedback_activity_completion.feature b/mod/feedback/tests/behat/feedback_activity_completion.feature index 559f8ab6dc7b8..023c19196a927 100644 --- a/mod/feedback/tests/behat/feedback_activity_completion.feature +++ b/mod/feedback/tests/behat/feedback_activity_completion.feature @@ -10,20 +10,12 @@ Feature: View activity completion in the feedback activity | student1 | Vinnie | Student1 | student1@example.com | | teacher1 | Darrell | Teacher1 | teacher1@example.com | And the following "courses" exist: - | fullname | shortname | category | - | Course 1 | C1 | 0 | + | fullname | shortname | enablecompletion | showcompletionconditions | + | Course 1 | C1 | 1 | 1 | And the following "course enrolments" exist: | user | course | role | | student1 | C1 | student | | teacher1 | C1 | editingteacher | - And I log in as "teacher1" - And I am on "Course 1" course homepage - And I navigate to "Edit settings" in current page administration - And I expand all fieldsets - And I set the following fields to these values: - | Enable completion tracking | Yes | - | Show activity completion conditions | Yes | - And I press "Save and display" And the following "activity" exists: | activity | feedback | | course | C1 | @@ -33,8 +25,7 @@ Feature: View activity completion in the feedback activity | completion | 2 | | completionview | 1 | | completionsubmit | 1 | - And I am on "Course 1" course homepage - And I follow "Music history" + And I am on the "Music history" "feedback activity" page logged in as teacher1 And I click on "Edit questions" "link" in the "[role=main]" "css_element" And I add a "Multiple choice" question to the feedback with: | Question | What is your favourite instrument | @@ -44,32 +35,25 @@ Feature: View activity completion in the feedback activity And I log out Scenario: View automatic completion items as a teacher - Given I log in as "teacher1" - And I am on "Course 1" course homepage - When I follow "Music history" + When I am on the "Music history" "feedback activity" page logged in as teacher1 Then "Music history" should have the "View" completion condition And "Music history" should have the "Submit feedback" completion condition Scenario: View automatic completion items as a student - Given I log in as "student1" - And I am on "Course 1" course homepage - And I follow "Music history" + Given I am on the "Music history" "feedback activity" page logged in as student1 And the "View" completion condition of "Music history" is displayed as "todo" And the "Submit feedback" completion condition of "Music history" is displayed as "todo" When I follow "Answer the questions" And I set the field "drums" to "1" And I press "Submit your answers" And I press "Continue" - And I follow "Music history" + And I am on the "Music history" "feedback activity" page Then the "View" completion condition of "Music history" is displayed as "done" And the "Submit feedback" completion condition of "Music history" is displayed as "done" @javascript Scenario: Use manual completion - Given I log in as "teacher1" - And I am on "Course 1" course homepage - And I follow "Music history" - And I navigate to "Edit settings" in current page administration + Given I am on the "Music history" "feedback activity editing" page logged in as teacher1 And I expand all fieldsets And I set the field "Completion tracking" to "Students can manually mark the activity as completed" And I press "Save and display" @@ -77,9 +61,7 @@ Feature: View activity completion in the feedback activity And the manual completion button for "Music history" should be disabled And I log out # Student view. - When I log in as "student1" - And I am on "Course 1" course homepage - And I follow "Music history" + When I am on the "Music history" "feedback activity" page logged in as student1 Then the manual completion button of "Music history" is displayed as "Mark as done" And I toggle the manual completion state of "Music history" And the manual completion button of "Music history" is displayed as "Done" diff --git a/mod/feedback/tests/behat/groups.feature b/mod/feedback/tests/behat/groups.feature index 96350d87813d0..b81e713998a72 100644 --- a/mod/feedback/tests/behat/groups.feature +++ b/mod/feedback/tests/behat/groups.feature @@ -50,9 +50,7 @@ Feature: Feedbacks in courses with groups | feedback | Site feedback | Acceptance test site | feedback0 | 2 | 1 | 1 | 1 | | feedback | Course feedback | C1 | feedback1 | 2 | 1 | 1 | 0 | | feedback | Course anon feedback | C1 | feedback2 | 1 | 1 | 1 | 0 | - When I log in as "manager" - And I am on site homepage - And I follow "Site feedback" + And I am on the "Site feedback" "feedback activity" page logged in as manager And I click on "Edit questions" "link" in the "[role=main]" "css_element" And I add a "Multiple choice" question to the feedback with: | Question | Do you like our site? | @@ -64,9 +62,7 @@ Feature: Feedbacks in courses with groups @javascript Scenario: Non anonymous feedback with groups in a course - When I log in as "teacher" - And I am on "Course 1" course homepage - And I follow "Course feedback" + Given I am on the "Course feedback" "feedback activity" page logged in as teacher And I click on "Edit questions" "link" in the "[role=main]" "css_element" And I add a "Multiple choice" question to the feedback with: | Question | Do you like this course? | @@ -90,9 +86,7 @@ Feature: Feedbacks in courses with groups And I log in as "user7" and complete feedback "Course feedback" in course "Course 1" with: | I don't know | 1 | # View analysis, user1 should only see one group - group 1 - And I log in as "user1" - And I am on "Course 1" course homepage - And I follow "Course feedback" + And I am on the "Course feedback" "feedback activity" page logged in as user1 And I follow "Submitted answers" And I should see "Separate groups: Group 1" And I show chart data for the "multichoice1" feedback @@ -100,9 +94,7 @@ Feature: Feedbacks in courses with groups And I should see "1 (25.00 %)" in the "Not at all" "table_row" And I log out # View analysis, user3 should only see one group - group 2 - And I log in as "user3" - And I am on "Course 1" course homepage - And I follow "Course feedback" + And I am on the "Course feedback" "feedback activity" page logged in as user3 And I follow "Submitted answers" And I should see "Separate groups: Group 2" And I show chart data for the "multichoice1" feedback @@ -110,9 +102,7 @@ Feature: Feedbacks in courses with groups And I should see "2 (66.67 %)" in the "Not at all" "table_row" And I log out # View analysis, user2 should see a group selector and be able to change the group but not view all. - And I log in as "user2" - And I am on "Course 1" course homepage - And I follow "Course feedback" + And I am on the "Course feedback" "feedback activity" page logged in as user2 And I follow "Submitted answers" And the field "Separate groups" matches value "Group 1" And I show chart data for the "multichoice1" feedback @@ -125,9 +115,7 @@ Feature: Feedbacks in courses with groups And the "Separate groups" select box should not contain "All participants" And I log out # User without group can see all participants only - And I log in as "user7" - And I am on "Course 1" course homepage - And I follow "Course feedback" + And I am on the "Course feedback" "feedback activity" page logged in as user7 And I follow "Submitted answers" And I should see "Separate groups: All participants" And I show chart data for the "multichoice1" feedback @@ -136,9 +124,7 @@ Feature: Feedbacks in courses with groups And I should see "2 (28.57 %)" in the "I don't know" "table_row" And I log out # Teacher can browse everybody - And I log in as "teacher" - And I am on "Course 1" course homepage - And I follow "Course feedback" + And I am on the "Course feedback" "feedback activity" page logged in as teacher And I navigate to "Analysis" in current page administration And the field "Separate groups" matches value "All participants" And I show chart data for the "multichoice1" feedback @@ -163,13 +149,10 @@ Feature: Feedbacks in courses with groups And I select "All participants" from the "Separate groups" singleselect And I should see "Username 1" And I should see "Username 3" - And I log out @javascript Scenario: Anonymous feedback with groups in a course - When I log in as "teacher" - And I am on "Course 1" course homepage - And I follow "Course anon feedback" + Given I am on the "Course anon feedback" "feedback activity" page logged in as teacher And I click on "Edit questions" "link" in the "[role=main]" "css_element" And I add a "Multiple choice" question to the feedback with: | Question | Do you like this course? | @@ -180,9 +163,7 @@ Feature: Feedbacks in courses with groups And I log out And I log in as "user1" and complete feedback "Course anon feedback" in course "Course 1" with: | Not at all | 1 | - And I log in as "user1" - And I am on "Course 1" course homepage - And I follow "Course anon feedback" + And I am on the "Course anon feedback" "feedback activity" page logged in as user1 And I follow "Submitted answers" And I should see "There are insufficient responses for this group" And I should not see "Yes of course" @@ -200,9 +181,7 @@ Feature: Feedbacks in courses with groups And I log in as "user7" and complete feedback "Course anon feedback" in course "Course 1" with: | I don't know | 1 | # View analysis, user1 should only see one group - group 1 - And I log in as "user1" - And I am on "Course 1" course homepage - And I follow "Course anon feedback" + And I am on the "Course anon feedback" "feedback activity" page logged in as user1 And I follow "Submitted answers" And I should see "Separate groups: Group 1" And I show chart data for the "multichoice1" feedback @@ -210,9 +189,7 @@ Feature: Feedbacks in courses with groups And I should see "1 (25.00 %)" in the "Not at all" "table_row" And I log out # View analysis, user3 should only see one group - group 2 - And I log in as "user3" - And I am on "Course 1" course homepage - And I follow "Course anon feedback" + And I am on the "Course anon feedback" "feedback activity" page logged in as user3 And I follow "Submitted answers" And I should see "Separate groups: Group 2" And I show chart data for the "multichoice1" feedback @@ -220,9 +197,7 @@ Feature: Feedbacks in courses with groups And I should see "2 (66.67 %)" in the "Not at all" "table_row" And I log out # View analysis, user2 should see a group selector and be able to change the group but not view all. - And I log in as "user2" - And I am on "Course 1" course homepage - And I follow "Course anon feedback" + And I am on the "Course anon feedback" "feedback activity" page logged in as user2 And I follow "Submitted answers" And the field "Separate groups" matches value "Group 1" And I show chart data for the "multichoice1" feedback @@ -235,9 +210,7 @@ Feature: Feedbacks in courses with groups And the "Separate groups" select box should not contain "All participants" And I log out # User without group can see all participants only - And I log in as "user7" - And I am on "Course 1" course homepage - And I follow "Course anon feedback" + And I am on the "Course anon feedback" "feedback activity" page logged in as user7 And I follow "Submitted answers" And I should see "Separate groups: All participants" And I show chart data for the "multichoice1" feedback @@ -246,9 +219,7 @@ Feature: Feedbacks in courses with groups And I should see "2 (28.57 %)" in the "I don't know" "table_row" And I log out # Teacher can browse everybody - And I log in as "teacher" - And I am on "Course 1" course homepage - And I follow "Course anon feedback" + And I am on the "Course anon feedback" "feedback activity" page logged in as teacher And I navigate to "Analysis" in current page administration And the field "Separate groups" matches value "All participants" And I show chart data for the "multichoice1" feedback @@ -274,4 +245,3 @@ Feature: Feedbacks in courses with groups And I select "All participants" from the "Separate groups" singleselect And "//tr[contains(@id,'_r6') and contains(.,'Response number')]" "xpath_element" should exist And "//tr[contains(@id,'_r7') and contains(@class,'emptyrow')]" "xpath_element" should exist - And I log out diff --git a/mod/feedback/tests/behat/multichoice.feature b/mod/feedback/tests/behat/multichoice.feature index b6da9c8aa3142..4db97d61ae532 100644 --- a/mod/feedback/tests/behat/multichoice.feature +++ b/mod/feedback/tests/behat/multichoice.feature @@ -21,9 +21,7 @@ Feature: Testing multichoice questions in feedback And the following "activities" exist: | activity | name | course | idnumber | | feedback | Learning experience | C1 | feedback0 | - And I log in as "teacher1" - And I am on "Course 1" course homepage - And I follow "Learning experience" + And I am on the "Learning experience" "feedback activity" page logged in as teacher1 And I click on "Edit questions" "link" in the "[role=main]" "css_element" @javascript @@ -56,9 +54,7 @@ Feature: Testing multichoice questions in feedback And I add a "Label" question to the feedback with: | Contents | this is the third page of the feedback | And I log out - And I log in as "student1" - And I am on "Course 1" course homepage - And I follow "Learning experience" + And I am on the "Learning experience" "feedback activity" page logged in as student1 And I follow "Answer the questions" # Examine the first page, select nothing, go to the next page Then the following fields match these values: @@ -123,9 +119,7 @@ Feature: Testing multichoice questions in feedback And I log out # Student 2 tries to trick - he answers the third question and then # goes back and changes dependency question. Analysis should not show this answer! - And I log in as "student2" - And I am on "Course 1" course homepage - And I follow "Learning experience" + And I am on the "Learning experience" "feedback activity" page logged in as student2 And I follow "Answer the questions" And I set the field "option a" to "1" And I press "Next page" @@ -138,9 +132,7 @@ Feature: Testing multichoice questions in feedback And I press "Submit your answers" And I log out # Login as teacher and check analysis - And I log in as "teacher1" - And I am on "Course 1" course homepage - And I follow "Learning experience" + And I am on the "Learning experience" "feedback activity" page logged in as teacher1 And I navigate to "Analysis" in current page administration And I should see "Submitted answers: 2" And I should see "Questions: 3" @@ -200,9 +192,7 @@ Feature: Testing multichoice questions in feedback | Contents | this is the third page of the feedback | And I log out # Login as the first student. - And I log in as "student1" - And I am on "Course 1" course homepage - And I follow "Learning experience" + And I am on the "Learning experience" "feedback activity" page logged in as student1 And I follow "Answer the questions" # Examine the first page, select nothing, go to the next page And I should not see "Not selected" @@ -265,9 +255,7 @@ Feature: Testing multichoice questions in feedback And I log out # Student 2 tries to trick - he answers the third question and then # goes back and changes dependency question. Analysis should not show this answer! - And I log in as "student2" - And I am on "Course 1" course homepage - And I follow "Learning experience" + And I am on the "Learning experience" "feedback activity" page logged in as student2 And I follow "Answer the questions" And I set the field "option a" to "1" And I set the field "option b" to "1" @@ -282,9 +270,7 @@ Feature: Testing multichoice questions in feedback And I press "Submit your answers" And I log out # Login as teacher and check analysis - And I log in as "teacher1" - And I am on "Course 1" course homepage - And I follow "Learning experience" + And I am on the "Learning experience" "feedback activity" page logged in as teacher1 And I navigate to "Analysis" in current page administration And I should see "Submitted answers: 2" And I should see "Questions: 3" @@ -342,9 +328,7 @@ Feature: Testing multichoice questions in feedback And I add a "Label" question to the feedback with: | Contents | this is the third page of the feedback | And I log out - And I log in as "student1" - And I am on "Course 1" course homepage - And I follow "Learning experience" + And I am on the "Learning experience" "feedback activity" page logged in as student1 And I follow "Answer the questions" # Examine the first page, select nothing, go to the next page Then the following fields match these values: @@ -390,9 +374,7 @@ Feature: Testing multichoice questions in feedback And I log out # Student 2 tries to trick - he answers the third question and then # goes back and changes dependency question. Analysis should not show this answer! - And I log in as "student2" - And I am on "Course 1" course homepage - And I follow "Learning experience" + And I am on the "Learning experience" "feedback activity" page logged in as student2 And I follow "Answer the questions" And I set the field "this is a multiple choice 1" to "option a" And I press "Next page" @@ -405,9 +387,7 @@ Feature: Testing multichoice questions in feedback And I press "Submit your answers" And I log out # Login as teacher and check analysis - And I log in as "teacher1" - And I am on "Course 1" course homepage - And I follow "Learning experience" + And I am on the "Learning experience" "feedback activity" page logged in as teacher1 And I navigate to "Analysis" in current page administration And I should see "Submitted answers: 2" And I should see "Questions: 3" @@ -434,4 +414,3 @@ Feature: Testing multichoice questions in feedback And I should see "1 (100.00 %)" in the "option a" "table_row" And I should not see "%" in the "option b" "table_row" And I should not see "%" in the "option c" "table_row" - And I log out diff --git a/mod/feedback/tests/behat/non_anonymous.feature b/mod/feedback/tests/behat/non_anonymous.feature index 72bd0e2556928..b360de1ab7e5f 100644 --- a/mod/feedback/tests/behat/non_anonymous.feature +++ b/mod/feedback/tests/behat/non_anonymous.feature @@ -108,9 +108,7 @@ Feature: Non anonymous feedback @javascript Scenario: Non anonymous feedback in a course - When I log in as "teacher" - And I am on "Course 1" course homepage - And I follow "Course feedback" + When I am on the "Course feedback" "feedback activity" page logged in as teacher And I click on "Edit questions" "link" in the "[role=main]" "css_element" And I add a "Multiple choice" question to the feedback with: | Question | Do you like this course? | @@ -119,18 +117,14 @@ Feature: Non anonymous feedback | Hide the "Not selected" option | Yes | | Multiple choice values | Yes of course\nNot at all\nI don't know | And I log out - And I log in as "user1" - And I am on "Course 1" course homepage - And I follow "Course feedback" + When I am on the "Course feedback" "feedback activity" page logged in as user1 And I follow "Answer the questions" And I should see "Do you like this course?" And I set the following fields to these values: | Yes of course | 1 | And I press "Submit your answers" And I log out - And I log in as "user2" - And I am on "Course 1" course homepage - And I follow "Course feedback" + When I am on the "Course feedback" "feedback activity" page logged in as user2 And I follow "Answer the questions" And I should see "Do you like this course?" And I set the following fields to these values: @@ -145,9 +139,7 @@ Feature: Non anonymous feedback And I should see "1 (50.00 %)" in the "Yes of course" "table_row" And I should see "1 (50.00 %)" in the "Not at all" "table_row" And I log out - And I log in as "teacher" - And I am on "Course 1" course homepage - And I follow "Course feedback" + When I am on the "Course feedback" "feedback activity" page logged in as teacher And I follow "Preview" And I should see "Do you like this course?" And I press "Continue" @@ -170,4 +162,3 @@ Feature: Non anonymous feedback And I should see "Non anonymous entries (1)" And I should not see "Username 1" And I should see "Username 2" - And I log out diff --git a/mod/feedback/tests/behat/question_types.feature b/mod/feedback/tests/behat/question_types.feature index 166ddd3823cbb..d5ad38021117f 100644 --- a/mod/feedback/tests/behat/question_types.feature +++ b/mod/feedback/tests/behat/question_types.feature @@ -22,9 +22,7 @@ Feature: Test creating different types of feedback questions for anonymous feedb And the following "activities" exist: | activity | name | course | idnumber | | feedback | Learning experience | C1 | feedback0 | - When I log in as "teacher1" - And I am on "Course 1" course homepage - And I follow "Learning experience" + When I am on the "Learning experience" "feedback activity" page logged in as teacher1 And I click on "Edit questions" "link" in the "[role=main]" "css_element" And I add a "Information" question to the feedback with: | Question | this is an information question | @@ -65,9 +63,7 @@ Feature: Test creating different types of feedback questions for anonymous feedb | Label | shorttext | | Maximum characters accepted | 200 | And I log out - And I log in as "student1" - And I am on "Course 1" course homepage - And I follow "Learning experience" + And I am on the "Learning experience" "feedback activity" page logged in as student1 And I follow "Answer the questions" And I set the following fields to these values: | this is a longer text answer | my long answer | @@ -80,9 +76,7 @@ Feature: Test creating different types of feedback questions for anonymous feedb | this is a short text answer | hello | And I press "Submit your answers" And I log out - And I log in as "student2" - And I am on "Course 1" course homepage - And I follow "Learning experience" + And I am on the "Learning experience" "feedback activity" page logged in as student2 And I follow "Answer the questions" And I set the following fields to these values: | this is a longer text answer | lots of feedbacks | @@ -95,16 +89,11 @@ Feature: Test creating different types of feedback questions for anonymous feedb | this is a short text answer | no way | And I press "Submit your answers" And I log out - When I log in as "teacher1" - And I am on "Course 1" course homepage - And I follow "Learning experience" + When I am on the "Learning experience" "feedback activity" page logged in as teacher1 And I navigate to "Analysis" in current page administration And I should see "Submitted answers: 2" And I should see "Questions: 8" - And I log out - And I log in as "teacher1" - And I am on "Course 1" course homepage - And I follow "Learning experience" + And I am on the "Learning experience" "feedback activity" page And I navigate to "Analysis" in current page administration And I should see "C1" in the "(info)" "table" And I should see "my long answer" in the "(longertext)" "table" diff --git a/mod/feedback/tests/behat/question_types_non_anon.feature b/mod/feedback/tests/behat/question_types_non_anon.feature index dbcfb606a09bb..5c99af4553c10 100644 --- a/mod/feedback/tests/behat/question_types_non_anon.feature +++ b/mod/feedback/tests/behat/question_types_non_anon.feature @@ -22,9 +22,7 @@ Feature: Test creating different types of feedback questions for non-anonymous f And the following "activities" exist: | activity | name | course | idnumber | anonymous | | feedback | Learning experience | C1 | feedback0 | 2 | - When I log in as "teacher1" - And I am on "Course 1" course homepage - And I follow "Learning experience" + When I am on the "Learning experience" "feedback activity" page logged in as teacher1 And I click on "Edit questions" "link" in the "[role=main]" "css_element" And I add a "Information" question to the feedback with: | Question | this is an information question | @@ -69,9 +67,7 @@ Feature: Test creating different types of feedback questions for non-anonymous f | Label | shorttext | | Maximum characters accepted | 200 | And I log out - And I log in as "student1" - And I am on "Course 1" course homepage - And I follow "Learning experience" + When I am on the "Learning experience" "feedback activity" page logged in as student1 And I follow "Answer the questions" And I set the following fields to these values: | this is a longer text answer | my long answer | @@ -84,9 +80,7 @@ Feature: Test creating different types of feedback questions for non-anonymous f | this is a short text answer | hello | And I press "Submit your answers" And I log out - And I log in as "student2" - And I am on "Course 1" course homepage - And I follow "Learning experience" + When I am on the "Learning experience" "feedback activity" page logged in as student2 And I follow "Answer the questions" And I set the following fields to these values: | this is a longer text answer | lots of feedbacks | @@ -99,16 +93,12 @@ Feature: Test creating different types of feedback questions for non-anonymous f | this is a short text answer | no way | And I press "Submit your answers" And I log out - When I log in as "teacher1" - And I am on "Course 1" course homepage - And I follow "Learning experience" + When I am on the "Learning experience" "feedback activity" page logged in as teacher1 And I navigate to "Analysis" in current page administration And I should see "Submitted answers: 2" And I should see "Questions: 9" And I log out - And I log in as "teacher1" - And I am on "Course 1" course homepage - And I follow "Learning experience" + And I am on the "Learning experience" "feedback activity" page logged in as teacher1 And I navigate to "Analysis" in current page administration And I should see "C1" in the "(info)" "table" And I should see "my long answer" in the "(longertext)" "table" diff --git a/mod/feedback/tests/behat/show_nonrespondents.feature b/mod/feedback/tests/behat/show_nonrespondents.feature index 40a658b130d3e..c558f31728c5d 100644 --- a/mod/feedback/tests/behat/show_nonrespondents.feature +++ b/mod/feedback/tests/behat/show_nonrespondents.feature @@ -44,7 +44,7 @@ Feature: Show users who have not responded to the feedback survey | Description | x | | Record user names | User's name will be logged and shown with answers | | Access restrictions | Grouping: GX1 | - And I follow "Frogs" + And I am on the Frogs "feedback activity" page And I click on "Edit questions" "link" in the "[role=main]" "css_element" And I set the field "Add question" to "Short text answer" And I set the following fields to these values: @@ -53,18 +53,14 @@ Feature: Show users who have not responded to the feedback survey And I log out # Go in as student 1 and do the feedback. - And I log in as "student1" - And I am on "Course 1" course homepage - And I follow "Frogs" + And I am on the Frogs "feedback activity" page logged in as student1 And I follow "Answer the questions" And I set the field "Y/N?" to "Y" And I press "Submit your answers" And I log out # Go in as teacher and check the users who haven't completed it. - And I log in as "teacher1" - And I am on "Course 1" course homepage - And I follow "Frogs" + And I am on the Frogs "feedback activity" page logged in as teacher1 And I navigate to "Show non-respondents" in current page administration # Should only show student 2; not student 1 (they did it) or 3 (not in grouping). diff --git a/mod/feedback/tests/behat/templates.feature b/mod/feedback/tests/behat/templates.feature index e5f9bed6377b1..93bc0af7efee3 100644 --- a/mod/feedback/tests/behat/templates.feature +++ b/mod/feedback/tests/behat/templates.feature @@ -25,9 +25,7 @@ Feature: Saving, using and deleting feedback templates | feedback | Learning experience course 1 | C1 | feedback1 | | feedback | Another feedback in course 1 | C1 | feedback2 | | feedback | Learning experience course 2 | C2 | feedback3 | - And I log in as "teacher" - And I am on "Course 1" course homepage - And I follow "Learning experience course 1" + And I am on the "Learning experience course 1" "feedback activity" page logged in as teacher And I click on "Edit questions" "link" in the "[role=main]" "css_element" And I add a "Multiple choice" question to the feedback with: | Question | this is a multiple choice 1 | @@ -38,9 +36,7 @@ Feature: Saving, using and deleting feedback templates Scenario: Teacher can save template and re-use it in the same course only # Go to feedback templates and make sure none exist yet - When I log in as "teacher" - And I am on "Course 1" course homepage - And I follow "Learning experience course 1" + When I am on the "Learning experience course 1" "feedback activity" page logged in as teacher And I follow "Templates" Then I should see "No templates available yet" And "Use a template" "field" should not exist @@ -55,8 +51,7 @@ Feature: Saving, using and deleting feedback templates And I should see "Template saved" And the "Use a template" select box should contain "My first template" # Create a feedback from this template in the same course - And I am on "Course 1" course homepage - And I follow "Another feedback in course 1" + And I am on the "Another feedback in course 1" "feedback activity" page And I follow "Templates" And I set the field "Use a template" to "My first template" And I press "Use this template" @@ -65,24 +60,19 @@ Feature: Saving, using and deleting feedback templates And I follow "Edit questions" And I should see "this is a multiple choice 1" # Make sure this template is not available in another course - And I am on "Course 2" course homepage - And I follow "Learning experience course 2" + And I am on the "Learning experience course 2" "feedback activity" page And I follow "Templates" - And I should see "No templates available yet" And "Use a template" "field" should not exist - And I log out + And I should see "No templates available yet" Scenario: Teacher can append template to existing questions or remove them # Save feedback as a course template - When I log in as "teacher" - And I am on "Course 1" course homepage - And I follow "Learning experience course 1" + When I am on the "Learning experience course 1" "feedback activity" page logged in as teacher And I follow "Templates" And I set the field "Name" to "My first template" And I press "Save as new template" # Add questions to another feedback - And I am on "Course 1" course homepage - And I follow "Another feedback in course 1" + And I am on the "Another feedback in course 1" "feedback activity" page And I click on "Edit questions" "link" in the "[role=main]" "css_element" And I add a "Multiple choice" question to the feedback with: | Question | What is your favourite subject | @@ -104,22 +94,17 @@ Feature: Saving, using and deleting feedback templates And I set the field "Delete old items" to "1" And I press "Save changes" And I follow "Edit questions" - And I should see "this is a multiple choice 1" And I should not see "What is your favourite subject" - And I log out + And I should see "this is a multiple choice 1" Scenario: Manager can save template as public and it will be available in any course - When I log in as "manager" - And I am on "Course 1" course homepage - And I follow "Learning experience course 1" + When I am on the "Learning experience course 1" "feedback activity" page logged in as manager And I follow "Templates" And I set the field "Name" to "My first template" And I set the field "Public" to "1" And I press "Save as new template" And I log out - And I log in as "teacher" - And I am on "Course 2" course homepage - And I follow "Learning experience course 2" + And I am on the "Learning experience course 2" "feedback activity" page logged in as teacher And I follow "Templates" And I set the field "Use a template" to "My first template" And I press "Use this template" @@ -127,13 +112,10 @@ Feature: Saving, using and deleting feedback templates And I press "Save changes" And I follow "Edit questions" And I should see "this is a multiple choice 1" - And I log out Scenario: Teacher can delete course templates but can not delete public templates # Save feedback as both public and course template - When I log in as "manager" - And I am on "Course 1" course homepage - And I follow "Learning experience course 1" + When I am on the "Learning experience course 1" "feedback activity" page logged in as manager And I follow "Templates" And I set the field "Name" to "My public template" And I set the field "Public" to "1" @@ -142,9 +124,7 @@ Feature: Saving, using and deleting feedback templates And I press "Save as new template" And I log out # Login as teacher and try to delete templates - And I log in as "teacher" - And I am on "Course 1" course homepage - And I follow "Another feedback in course 1" + And I am on the "Another feedback in course 1" "feedback activity" page logged in as teacher And I follow "Templates" And I follow "Delete template..." Then I should not see "My public template" @@ -157,14 +137,11 @@ Feature: Saving, using and deleting feedback templates And I press "Back" And the "Use a template" select box should not contain "My course template" And the "Use a template" select box should contain "My public template" - And I log out @javascript Scenario: Manager can delete both course and public templates # Save feedback as both public and course template - When I log in as "manager" - And I am on "Course 1" course homepage - And I follow "Learning experience course 1" + When I am on the "Learning experience course 1" "feedback activity" page logged in as manager And I click on "Templates" "link" in the "[role=main]" "css_element" And I set the field "Name" to "My public template" And I set the field "Public" to "1" @@ -190,6 +167,5 @@ Feature: Saving, using and deleting feedback templates And "My public template" "text" should not exist in the ".publictemplates" "css_element" And "No templates available yet" "text" should exist in the ".publictemplates" "css_element" And I press "Back" - And I should see "No templates available yet" And "Use a template" "field" should not exist - And I log out + And I should see "No templates available yet" diff --git a/mod/folder/tests/behat/folder_activity_completion.feature b/mod/folder/tests/behat/folder_activity_completion.feature index 1a6f9b0d3ebd7..1cbe278b0dd19 100644 --- a/mod/folder/tests/behat/folder_activity_completion.feature +++ b/mod/folder/tests/behat/folder_activity_completion.feature @@ -10,25 +10,15 @@ Feature: View activity completion information in the folder activity | student1 | Vinnie | Student1 | student1@example.com | | teacher1 | Darrell | Teacher1 | teacher1@example.com | And the following "courses" exist: - | fullname | shortname | category | - | Course 1 | C1 | 0 | + | fullname | shortname | enablecompletion | showcompletionconditions | + | Course 1 | C1 | 1 | 1 | And the following "course enrolments" exist: | user | course | role | | student1 | C1 | student | | teacher1 | C1 | editingteacher | - And I log in as "teacher1" - And I am on "Course 1" course homepage - And I navigate to "Edit settings" in current page administration - And I expand all fieldsets - And I set the following fields to these values: - | Enable completion tracking | Yes | - | Show activity completion conditions | Yes | - And I press "Save and display" - And I log out Scenario: View automatic completion items - Given I log in as "teacher1" - And the following "activity" exists: + Given the following "activity" exists: | activity | folder | | course | C1 | | idnumber | mh1 | @@ -36,36 +26,29 @@ Feature: View activity completion information in the folder activity | section | 1 | | completion | 2 | | completionview | 1 | - And I am on "Course 1" course homepage # Teacher view. - And I follow "Music history" + And I am on the "Music history" "folder activity" page logged in as teacher1 And "Music history" should have the "View" completion condition And I log out # Student view. - When I log in as "student1" - And I am on "Course 1" course homepage - And I follow "Music history" + When I am on the "Music history" "folder activity" page logged in as student1 Then the "View" completion condition of "Music history" is displayed as "done" @javascript Scenario: Use manual completion - Given I log in as "teacher1" - And the following "activity" exists: + Given the following "activity" exists: | activity | folder | | course | C1 | | idnumber | mh1 | | name | Music history | | section | 1 | | completion | 1 | - And I am on "Course 1" course homepage - And I follow "Music history" + And I am on the "Music history" "folder activity" page logged in as teacher1 # Teacher view. And the manual completion button for "Music history" should be disabled And I log out # Student view. - When I log in as "student1" - And I am on "Course 1" course homepage - And I follow "Music history" + When I am on the "Music history" "folder activity" page logged in as student1 Then the manual completion button of "Music history" is displayed as "Mark as done" And I toggle the manual completion state of "Music history" And the manual completion button of "Music history" is displayed as "Done" diff --git a/mod/forum/report/summary/tests/behat/bulk_message.feature b/mod/forum/report/summary/tests/behat/bulk_message.feature index 86fb4bbbb55df..e9332b7a410b5 100644 --- a/mod/forum/report/summary/tests/behat/bulk_message.feature +++ b/mod/forum/report/summary/tests/behat/bulk_message.feature @@ -40,9 +40,7 @@ Feature: Message users in the summary report And the following "course enrolments" exist: | user | course | role | | student3 | C1 | student | - When I log in as "teacher1" - And I am on "Course 1" course homepage - And I follow "forum1" + When I am on the forum1 "forum activity" page logged in as teacher1 And I navigate to "Forum summary report" in current page administration And I click on "Select 'Student 1'" "checkbox" And I click on "Select 'Student 3'" "checkbox" @@ -62,9 +60,7 @@ Feature: Message users in the summary report @javascript Scenario: Message all users - When I log in as "teacher1" - And I am on "Course 1" course homepage - And I follow "forum1" + When I am on the forum1 "forum activity" page logged in as teacher1 And I navigate to "Forum summary report" in current page administration And I click on "Select all" "checkbox" And I set the field "With selected users..." to "Send a message" @@ -72,13 +68,9 @@ Feature: Message users in the summary report @javascript Scenario: Ensure no message options when messaging is disabled - Given I log in as "admin" - And I set the following administration settings values: + Given the following config values are set as admin: | messaging | 0 | - And I log out - And I log in as "teacher1" - And I am on "Course 1" course homepage - And I follow "forum1" + When I am on the forum1 "forum activity" page logged in as teacher1 And I navigate to "Forum summary report" in current page administration Then I should not see "With selected users..." And I should not see "Select all" diff --git a/mod/forum/report/summary/tests/behat/summary_data_access.feature b/mod/forum/report/summary/tests/behat/summary_data_access.feature index 0fed1f2b4725a..21ee76967dcdd 100644 --- a/mod/forum/report/summary/tests/behat/summary_data_access.feature +++ b/mod/forum/report/summary/tests/behat/summary_data_access.feature @@ -33,9 +33,7 @@ Feature: Report relevant content availability @javascript Scenario: Teachers can access report data about other users by default - Given I log in as "teacher1" - When I am on "Course 1" course homepage - And I follow "forum1" + Given I am on the "forum1" "forum activity" page logged in as teacher1 And I navigate to "Forum summary report" in current page administration Then the following should exist in the "forumreport_summary_table" table: | -2- | -3- | -4- | -5- | -6- | -7- | -8- | @@ -57,9 +55,7 @@ Feature: Report relevant content availability And "Export posts" "link" should not exist Scenario: Students cannot access the summary report by default - Given I log in as "student1" - When I am on "Course 1" course homepage - And I follow "forum1" + Given I am on the "forum1" "forum activity" page logged in as student1 Then "Forum summary report" "link" should not exist in current page administration @javascript @@ -67,9 +63,7 @@ Feature: Report relevant content availability Given the following "permission overrides" exist: | capability | permission | role | contextlevel | reference | | forumreport/summary:view | Allow | student | Course | C1 | - When I log in as "student1" - And I am on "Course 1" course homepage - And I follow "forum1" + When I am on the "forum1" "forum activity" page logged in as student1 And I navigate to "Forum summary report" in current page administration Then the following should exist in the "forumreport_summary_table" table: | -1- | -2- | -3- | -4- | -5- | -6- | -7- | diff --git a/mod/forum/report/summary/tests/behat/summary_filter_groups.feature b/mod/forum/report/summary/tests/behat/summary_filter_groups.feature index 90393fa26702b..323230e4d43d2 100644 --- a/mod/forum/report/summary/tests/behat/summary_filter_groups.feature +++ b/mod/forum/report/summary/tests/behat/summary_filter_groups.feature @@ -35,9 +35,9 @@ Feature: Groups report filter is available if groups exist | student1 | G3 | And the following "activities" exist: | activity | name | description | course | idnumber | groupmode | - | forum | forum1 | C1 first forum | C1 | forum1 | 1 | - | forum | forum2 | C1 second forum | C1 | forum2 | 2 | - | forum | forum1 | C2 first forum | C2 | forum1 | 0 | + | forum | forum1 | C1 first forum | C1 | c1forum1 | 1 | + | forum | forum2 | C1 second forum | C1 | c1forum2 | 2 | + | forum | forum1 | C2 first forum | C2 | c2forum1 | 0 | And the following forum discussions exist in course "Course 1": | user | forum | name | message | group | created | | teacher1 | forum1 | discussion1 | D1 message | G1 | ## 1 month ago ## | @@ -62,9 +62,7 @@ Feature: Groups report filter is available if groups exist @javascript Scenario: All groups can be selected or cleared together in the groups filter, and are unchecked by default - When I log in as "teacher1" - And I am on "Course 1" course homepage - And I follow "forum1" + When I am on the "c1forum1" "forum activity" page logged in as teacher1 And I navigate to "Forum summary report" in current page administration Then "Groups" "button" should exist And the following should exist in the "forumreport_summary_table" table: @@ -112,9 +110,7 @@ Feature: Groups report filter is available if groups exist @javascript Scenario: The summary report can be filtered by a subset of groups, and re-ordering the results retains the filter - When I log in as "teacher1" - And I am on "Course 1" course homepage - And I follow "forum1" + When I am on the "c1forum1" "forum activity" page logged in as teacher1 And I navigate to "Forum summary report" in current page administration Then "Groups" "button" should exist And the following should exist in the "forumreport_summary_table" table: @@ -148,9 +144,7 @@ Feature: Groups report filter is available if groups exist @javascript Scenario: The summary report can be filtered as a mixture of groups and no groups - When I log in as "teacher1" - And I am on "Course 1" course homepage - And I follow "forum2" + When I am on the "c1forum2" "forum activity" page logged in as teacher1 And I navigate to "Forum summary report" in current page administration Then "Groups" "button" should exist And the following should exist in the "forumreport_summary_table" table: @@ -174,9 +168,7 @@ Feature: Groups report filter is available if groups exist @javascript Scenario: The summary report can be filtered by no groups only - When I log in as "teacher1" - And I am on "Course 1" course homepage - And I follow "forum2" + When I am on the "c1forum2" "forum activity" page logged in as teacher1 And I navigate to "Forum summary report" in current page administration Then the following should exist in the "forumreport_summary_table" table: # | | Discussions | Replies | @@ -199,9 +191,7 @@ Feature: Groups report filter is available if groups exist @javascript Scenario: Filtering by a group containing no users still allows the page to render # Log in as admin so Teacher 1 not existing on page can be confirmed. - When I log in as "admin" - And I am on "Course 1" course homepage - And I follow "forum1" + When I am on the "c1forum1" "forum activity" page logged in as admin And I navigate to "Forum summary report" in current page administration Then "Groups" "button" should exist And the following should exist in the "forumreport_summary_table" table: @@ -224,9 +214,7 @@ Feature: Groups report filter is available if groups exist @javascript Scenario: Course forum summary report can be filtered by group - When I log in as "teacher1" - And I am on "Course 1" course homepage - And I follow "forum2" + When I am on the "c1forum2" "forum activity" page logged in as teacher1 And I navigate to "Forum summary report" in current page administration And I select "All forums in course" from the "Forum selected" singleselect And I click on "Groups" "button" diff --git a/mod/forum/tests/behat/add_forum.feature b/mod/forum/tests/behat/add_forum.feature index 2d13f3824046f..f3cfed05696bd 100644 --- a/mod/forum/tests/behat/add_forum.feature +++ b/mod/forum/tests/behat/add_forum.feature @@ -39,7 +39,7 @@ Feature: Add forum activities and discussions | Attachment | lib/tests/fixtures/upload_users.csv | Then I should see "Reply with attachment" And I should see "upload_users.csv" - And I follow "Test forum name" + And I am on the "Test forum name" "forum activity" page And I follow "Post with attachment" And I should see "empty.txt" And I follow "Edit" diff --git a/mod/forum/tests/behat/advanced_search.feature b/mod/forum/tests/behat/advanced_search.feature index b26e61a97dcd0..6717412cb0958 100644 --- a/mod/forum/tests/behat/advanced_search.feature +++ b/mod/forum/tests/behat/advanced_search.feature @@ -38,9 +38,7 @@ Feature: The forum search allows users to perform advanced searches for forum po And I log out Scenario: Perform an advanced search using any term - Given I log in as "student1" - And I am on "Course 1" course homepage - And I follow "Announcements" + Given I am on the "Announcements" "forum activity" page logged in as student1 And I press "Search forums" And I should see "Advanced search" And I set the field "words" to "subject" @@ -49,9 +47,7 @@ Feature: The forum search allows users to perform advanced searches for forum po And I should see "Your subjective" Scenario: Perform an advanced search avoiding words - Given I log in as "student1" - And I am on "Course 1" course homepage - And I follow "Announcements" + Given I am on the "Announcements" "forum activity" page logged in as student1 And I press "Search forums" And I should see "Advanced search" And I set the field "words" to "My" @@ -62,11 +58,9 @@ Feature: The forum search allows users to perform advanced searches for forum po Scenario: Perform an advanced search using whole words Given database family used is one of the following: - | mysql | + | mysql | | postgres | - And I log in as "student1" - And I am on "Course 1" course homepage - And I follow "Announcements" + And I am on the "Announcements" "forum activity" page logged in as student1 And I press "Search forums" And I should see "Advanced search" And I set the field "fullwords" to "subject" @@ -75,9 +69,7 @@ Feature: The forum search allows users to perform advanced searches for forum po And I should not see "Your subjective" Scenario: Perform an advanced search matching the subject - Given I log in as "student1" - And I am on "Course 1" course homepage - And I follow "Announcements" + Given I am on the "Announcements" "forum activity" page logged in as student1 And I press "Search forums" And I should see "Advanced search" And I set the field "subject" to "subjective" @@ -92,9 +84,7 @@ Feature: The forum search allows users to perform advanced searches for forum po | Subject | My Subjects | | Message | My message | And I log out - When I log in as "student1" - And I am on "Course 1" course homepage - And I follow "Announcements" + When I am on the "Announcements" "forum activity" page logged in as student1 And I press "Search forums" And I should see "Advanced search" And I set the field "user" to "TWO" @@ -103,9 +93,7 @@ Feature: The forum search allows users to perform advanced searches for forum po And I should not see "Teacher ONE" Scenario: Perform an advanced search with multiple words - Given I log in as "student1" - And I am on "Course 1" course homepage - And I follow "Announcements" + Given I am on the "Announcements" "forum activity" page logged in as student1 And I press "Search forums" And I should see "Advanced search" And I set the field "subject" to "your subjective" @@ -115,18 +103,14 @@ Feature: The forum search allows users to perform advanced searches for forum po @javascript Scenario: Perform an advanced search using tags - Given I log in as "teacher1" - And I am on "Course 1" course homepage - And I follow "Announcements" + Given I am on the "Announcements" "forum activity" page logged in as teacher1 And I follow "My subject" And I follow "Edit" And I set the following fields to these values: | Tags | SearchedTag | And I press "Save changes" And I log out - And I log in as "student1" - And I am on "Course 1" course homepage - And I follow "Announcements" + And I am on the "Announcements" "forum activity" page logged in as student1 And I press "Search forums" And I should see "Advanced search" And I set the field "Is tagged with" to "SearchedTag" @@ -136,9 +120,7 @@ Feature: The forum search allows users to perform advanced searches for forum po @javascript Scenario: Perform an advanced search on starred discussions without text - Given I log in as "student1" - And I am on "Course 1" course homepage - And I follow "Announcements" + Given I am on the "Announcements" "forum activity" page logged in as student1 And I click on "Your subjective" action menu And I follow "Star this discussion" And I press "Search forums" @@ -150,9 +132,7 @@ Feature: The forum search allows users to perform advanced searches for forum po @javascript Scenario: Perform an advanced search on starred discussions with text - Given I log in as "student1" - And I am on "Course 1" course homepage - And I follow "Announcements" + Given I am on the "Announcements" "forum activity" page logged in as student1 And I click on "Your subjective" action menu And I follow "Star this discussion" And I press "Search forums" diff --git a/mod/forum/tests/behat/behat_mod_forum.php b/mod/forum/tests/behat/behat_mod_forum.php index a45c0ab475753..f6025b6ec6242 100644 --- a/mod/forum/tests/behat/behat_mod_forum.php +++ b/mod/forum/tests/behat/behat_mod_forum.php @@ -112,9 +112,8 @@ public function i_reply_post_from_forum_with($postsubject, $forumname, TableNode * @param TableNode $table */ public function i_reply_post_from_forum_using_an_inpage_reply_with($postsubject, $forumname, TableNode $table) { - // Navigate to forum. - $this->execute('behat_general::click_link', $this->escape($forumname)); + $this->execute('behat_navigation::i_am_on_page_instance', [$this->escape($forumname), 'forum activity']); $this->execute('behat_general::click_link', $this->escape($postsubject)); $this->execute('behat_general::click_link', get_string('reply', 'forum')); @@ -132,9 +131,8 @@ public function i_reply_post_from_forum_using_an_inpage_reply_with($postsubject, * @param string $forumname The forum name */ public function i_navigate_to_post_in_forum($postsubject, $forumname) { - // Navigate to forum discussion. - $this->execute('behat_general::click_link', $this->escape($forumname)); + $this->execute('behat_navigation::i_am_on_page_instance', [$this->escape($forumname), 'forum activity']); $this->execute('behat_general::click_link', $this->escape($postsubject)); } @@ -475,9 +473,8 @@ protected function create_post_attachments(int $postid, int $userid, array $atta * @param string $buttonstr */ protected function add_new_discussion($forumname, TableNode $table, $buttonstr) { - // Navigate to forum. - $this->execute('behat_general::click_link', $this->escape($forumname)); + $this->execute('behat_navigation::i_am_on_page_instance', [$this->escape($forumname), 'forum activity']); $this->execute('behat_general::click_link', $buttonstr); $this->execute('behat_forms::press_button', get_string('showadvancededitor')); @@ -495,9 +492,8 @@ protected function add_new_discussion($forumname, TableNode $table, $buttonstr) * @param string $buttonstr */ protected function add_new_discussion_inline($forumname, TableNode $table, $buttonstr) { - // Navigate to forum. - $this->execute('behat_general::click_link', $this->escape($forumname)); + $this->execute('behat_navigation::i_am_on_page_instance', [$this->escape($forumname), 'forum activity']); $this->execute('behat_general::click_link', $buttonstr); $this->fill_new_discussion_form($table); } diff --git a/mod/forum/tests/behat/discussion_display.feature b/mod/forum/tests/behat/discussion_display.feature index 7ef29379e417e..252f396ae2692 100644 --- a/mod/forum/tests/behat/discussion_display.feature +++ b/mod/forum/tests/behat/discussion_display.feature @@ -14,17 +14,18 @@ Feature: Students can choose from 4 discussion display options and their choice And the following "course enrolments" exist: | user | course | role | | student1 | C1 | student | - And I log in as "admin" - And I am on "Course 1" course homepage with editing mode on - And I add a "Forum" to section "1" and I fill the form with: - | Forum name | Test forum name | - | Description | Test forum description | + And the following "activity" exists: + | course | C1 | + | activity | forum | + | name | Test forum name | + And I am on the "Course 1" course page logged in as admin And I add a new discussion to "Test forum name" forum with: | Subject | Discussion 1 | | Message | Discussion contents 1, first message | And I reply "Discussion 1" post from "Test forum name" forum with: | Subject | Reply 1 to discussion 1 | | Message | Discussion contents 1, second message | + And I am on the "Course 1" course page And I add a new discussion to "Test forum name" forum with: | Subject | Discussion 2 | | Message | Discussion contents 2, first message | @@ -32,11 +33,10 @@ Feature: Students can choose from 4 discussion display options and their choice | Subject | Reply 1 to discussion 2 | | Message | Discussion contents 2, second message | And I log out - And I log in as "student1" - And I am on "Course 1" course homepage Scenario: Display replies flat, with oldest first - Given I reply "Discussion 1" post from "Test forum name" forum with: + Given I am on the "Course 1" course page logged in as student1 + And I reply "Discussion 1" post from "Test forum name" forum with: | Subject | Reply 2 to discussion 1 | | Message | Discussion contents 1, third message | When I select "Display replies flat, with oldest first" from the "mode" singleselect @@ -50,7 +50,8 @@ Feature: Students can choose from 4 discussion display options and their choice And I should see "Discussion contents 2, second message" in the "//div[contains(concat(' ', normalize-space(@class), ' '), ' forumpost ') and not(contains(@class, 'starter'))]" "xpath_element" Scenario: Display replies flat, with newest first - Given I reply "Discussion 1" post from "Test forum name" forum with: + Given I am on the "Course 1" course page logged in as student1 + And I reply "Discussion 1" post from "Test forum name" forum with: | Subject | Reply 2 to discussion 1 | | Message | Discussion contents 1, third message | When I select "Display replies flat, with newest first" from the "mode" singleselect @@ -64,24 +65,24 @@ Feature: Students can choose from 4 discussion display options and their choice And I should see "Discussion contents 2, third message" in the "//div[contains(concat(' ', normalize-space(@class), ' '), ' forumpost ') and not(contains(@class, 'starter'))]" "xpath_element" Scenario: Display replies in threaded form - Given I follow "Test forum name" + Given I am on the "Test forum name" "forum activity" page logged in as student1 And I follow "Discussion 1" When I select "Display replies in threaded form" from the "mode" singleselect Then I should see "Discussion contents 1, first message" And I should see "Reply 1 to discussion 1" in the "div.forumthread" "css_element" - And I follow "Test forum name" + And I click on "Test forum name" "link" in the "page-header" "region" And I follow "Discussion 2" And the field "Display mode" matches value "Display replies in threaded form" And I should see "Discussion contents 2, first message" And I should see "Reply 1 to discussion 2" in the "div.forumthread" "css_element" Scenario: Display replies in nested form - Given I follow "Test forum name" + Given I am on the "Test forum name" "forum activity" page logged in as student1 And I follow "Discussion 1" When I select "Display replies in nested form" from the "mode" singleselect Then I should see "Discussion contents 1, first message" in the "div.firstpost.starter" "css_element" And I should see "Discussion contents 1, second message" in the "div.indent div.forumpost" "css_element" - And I follow "Test forum name" + And I click on "Test forum name" "link" in the "page-header" "region" And I follow "Discussion 2" And the field "Display mode" matches value "Display replies in nested form" And I should see "Discussion contents 2, first message" in the "div.firstpost.starter" "css_element" diff --git a/mod/forum/tests/behat/discussion_lock.feature b/mod/forum/tests/behat/discussion_lock.feature index 2b3265f9ffe34..1f06b51d1eb38 100644 --- a/mod/forum/tests/behat/discussion_lock.feature +++ b/mod/forum/tests/behat/discussion_lock.feature @@ -11,11 +11,11 @@ Feature: As a teacher, you can manually lock individual discussions when viewing And the following "course enrolments" exist: | user | course | role | | student1 | C1 | student | - And I log in as "admin" - And I am on "Course 1" course homepage with editing mode on - And I add a "Forum" to section "1" and I fill the form with: - | Forum name | Test forum name | - | Description | Test forum description | + And the following "activity" exists: + | course | C1 | + | activity | forum | + | name | Test forum name | + And I am on the "Course 1" course page logged in as admin And I add a new discussion to "Test forum name" forum with: | Subject | Discussion 1 | | Message | Discussion contents 1, first message | @@ -28,11 +28,9 @@ Feature: As a teacher, you can manually lock individual discussions when viewing And I reply "Discussion 2" post from "Test forum name" forum with: | Subject | Reply 1 to discussion 2 | | Message | Discussion contents 2, second message | - And I log out Scenario: Lock a discussion and view - Given I log in as "admin" - And I am on "Course 1" course homepage + Given I am on the "Course 1" course page And I navigate to post "Discussion 1" in "Test forum name" forum And I press "Settings" Then "Lock this discussion" "link" should be visible @@ -53,8 +51,7 @@ Feature: As a teacher, you can manually lock individual discussions when viewing @accessibility Scenario: A locked discussion must be accessible - Given I log in as "admin" - And I am on "Course 1" course homepage + Given I am on the "Course 1" course page And I navigate to post "Discussion 1" in "Test forum name" forum When I reply "Discussion 1" post from "Test forum name" forum with: | Subject | Discussion 1: Hello world! | @@ -66,9 +63,7 @@ Feature: As a teacher, you can manually lock individual discussions when viewing # Check discussion view accessibility with info notification shown when discussion is locked. And the page should meet accessibility standards with "wcag143" extra tests And I log out - And I log in as "student1" - And I am on "Course 1" course homepage - And I follow "Test forum name" + And I am on the "Test forum name" "forum activity" page logged in as student1 # Check discussion list accessibility with danger pill shown when discussion is locked. And the page should meet accessibility standards with "wcag143" extra tests And I follow "Preferences" in the user menu diff --git a/mod/forum/tests/behat/discussion_subscriptions.feature b/mod/forum/tests/behat/discussion_subscriptions.feature index 31b02d8bbae43..8bf50661194b0 100644 --- a/mod/forum/tests/behat/discussion_subscriptions.feature +++ b/mod/forum/tests/behat/discussion_subscriptions.feature @@ -34,9 +34,7 @@ Feature: A user can control their own subscription preferences for a discussion | Subject | Test post subject two | | Message | Test post message two | And I log out - When I log in as "student1" - And I am on "Course 1" course homepage - And I follow "Test forum name" + When I am on the "Test forum name" "forum activity" page logged in as student1 Then I can subscribe to this forum And "Subscribe to this discussion" "checkbox" should exist in the "Test post subject one" "table_row" And "Subscribe to this discussion" "checkbox" should exist in the "Test post subject two" "table_row" @@ -81,9 +79,7 @@ Feature: A user can control their own subscription preferences for a discussion | Subject | Test post subject two | | Message | Test post message two | And I log out - When I log in as "student1" - And I am on "Course 1" course homepage - And I follow "Test forum name" + When I am on the "Test forum name" "forum activity" page logged in as student1 Then I can unsubscribe from this forum And "Unsubscribe from this discussion" "checkbox" should exist in the "Test post subject one" "table_row" And "Unsubscribe from this discussion" "checkbox" should exist in the "Test post subject two" "table_row" @@ -128,9 +124,7 @@ Feature: A user can control their own subscription preferences for a discussion | Subject | Test post subject two | | Message | Test post message two | And I log out - And I log in as "student1" - And I am on "Course 1" course homepage - And I follow "Test forum name" + And I am on the "Test forum name" "forum activity" page logged in as student1 And I can subscribe to this forum And "Subscribe to this discussion" "checkbox" should exist in the "Test post subject one" "table_row" And "Subscribe to this discussion" "checkbox" should exist in the "Test post subject two" "table_row" @@ -139,17 +133,13 @@ Feature: A user can control their own subscription preferences for a discussion And "Unsubscribe from this discussion" "checkbox" should exist in the "Test post subject one" "table_row" And "Subscribe to this discussion" "checkbox" should exist in the "Test post subject two" "table_row" And I log out - And I log in as "admin" - And I am on "Course 1" course homepage - And I follow "Test forum name" + And I am on the "Test forum name" "forum activity" page logged in as admin And I navigate to "Edit settings" in current page administration And I set the following fields to these values: | Subscription mode | Auto subscription | And I press "Save and return to course" And I log out - And I log in as "student1" - And I am on "Course 1" course homepage - And I follow "Test forum name" + And I am on the "Test forum name" "forum activity" page logged in as student1 And I can unsubscribe from this forum And "Unsubscribe from this discussion" "checkbox" should exist in the "Test post subject one" "table_row" And "Unsubscribe from this discussion" "checkbox" should exist in the "Test post subject two" "table_row" @@ -177,9 +167,7 @@ Feature: A user can control their own subscription preferences for a discussion | Subject | Test post subject two | | Message | Test post message two | And I log out - And I log in as "student1" - And I am on "Course 1" course homepage - And I follow "Test forum name" + And I am on the "Test forum name" "forum activity" page logged in as student1 And I can subscribe to this forum And "Subscribe to this discussion" "checkbox" should exist in the "Test post subject one" "table_row" And "Subscribe to this discussion" "checkbox" should exist in the "Test post subject two" "table_row" @@ -189,16 +177,13 @@ Feature: A user can control their own subscription preferences for a discussion And "Subscribe to this discussion" "checkbox" should exist in the "Test post subject two" "table_row" And I log out And I log in as "admin" - And I am on "Course 1" course homepage - And I follow "Test forum name" + And I am on the "Test forum name" "forum activity" page And I navigate to "Edit settings" in current page administration And I set the following fields to these values: | Subscription mode | Auto subscription | And I press "Save and return to course" And I log out - And I log in as "student1" - And I am on "Course 1" course homepage - And I follow "Test forum name" + And I am on the "Test forum name" "forum activity" page logged in as student1 And I can unsubscribe from this forum And "Unsubscribe from this discussion" "checkbox" should exist in the "Test post subject one" "table_row" And "Unsubscribe from this discussion" "checkbox" should exist in the "Test post subject two" "table_row" @@ -225,9 +210,7 @@ Feature: A user can control their own subscription preferences for a discussion | Subject | Test post subject two | | Message | Test post message two | And I log out - When I log in as "student1" - And I am on "Course 1" course homepage - And I follow "Test forum name" + When I am on the "Test forum name" "forum activity" page logged in as student1 And I should see "Subscribe to this forum" And I reply "Test post subject one" post from "Test forum name" forum with: | Subject | Reply 1 to discussion 1 | @@ -237,7 +220,7 @@ Feature: A user can control their own subscription preferences for a discussion | Subject | Reply 1 to discussion 1 | | Message | Discussion contents 1, second message | | Discussion subscription | 0 | - And I follow "Test forum name" + And I am on the "Test forum name" "forum activity" page Then "Unsubscribe from this discussion" "checkbox" should exist in the "Test post subject one" "table_row" And "Subscribe to this discussion" "checkbox" should exist in the "Test post subject two" "table_row" And I follow "Test post subject one" @@ -265,9 +248,7 @@ Feature: A user can control their own subscription preferences for a discussion | Subject | Test post subject two | | Message | Test post message two | And I log out - When I log in as "student1" - And I am on "Course 1" course homepage - And I follow "Test forum name" + When I am on the "Test forum name" "forum activity" page logged in as student1 And I should see "Unsubscribe from this forum" And I reply "Test post subject one" post from "Test forum name" forum with: | Subject | Reply 1 to discussion 1 | @@ -277,13 +258,13 @@ Feature: A user can control their own subscription preferences for a discussion | Subject | Reply 1 to discussion 1 | | Message | Discussion contents 1, second message | | Discussion subscription | 0 | - And I follow "Test forum name" + And I am on the "Test forum name" "forum activity" page Then "Unsubscribe from this discussion" "checkbox" should exist in the "Test post subject one" "table_row" And "Subscribe to this discussion" "checkbox" should exist in the "Test post subject two" "table_row" And I follow "Test post subject one" And I follow "Reply" And the field "Discussion subscription" matches value "Send me notifications of new posts in this discussion" - And I follow "Test forum name" + And I am on the "Test forum name" "forum activity" page And I follow "Test post subject two" And I follow "Reply" And the field "Discussion subscription" matches value "I don't want to be notified of new posts in this discussion" @@ -337,9 +318,7 @@ Feature: A user can control their own subscription preferences for a discussion | Subject | Test post subject one | | Message | Test post message one | And I log out - And I log in as "student1" - And I am on "Course 1" course homepage - When I follow "Test forum name" + When I am on the "Test forum name" "forum activity" page logged in as student1 Then "Subscribe to this forum" "link" should exist in current page administration And I follow "Test post subject one" And "You are not subscribed to this discussion. Click to subscribe" "link" should exist diff --git a/mod/forum/tests/behat/edit_tags.feature b/mod/forum/tests/behat/edit_tags.feature index 8c87286e918bd..20a1ccf6c42e2 100644 --- a/mod/forum/tests/behat/edit_tags.feature +++ b/mod/forum/tests/behat/edit_tags.feature @@ -16,11 +16,11 @@ Feature: Edited forum posts handle tags correctly | 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 "Forum" to section "1" and I fill the form with: - | Forum name | Test forum name | - | Description | Test forum description | + And the following "activity" exists: + | course | C1 | + | activity | forum | + | name | Test forum name | + And I am on the "Course 1" Course page logged in as teacher1 And I add a new discussion to "Test forum name" forum with: | Subject | Teacher post subject | | Message | Teacher post message | @@ -28,8 +28,7 @@ Feature: Edited forum posts handle tags correctly @javascript Scenario: Forum post edition of custom tags works as expected - Given I log in as "student1" - And I am on "Course 1" course homepage + Given I am on the "Course 1" Course page logged in as student1 And I reply "Teacher post subject" post from "Test forum name" forum with: | Subject | Student post subject | | Message | Student post message | @@ -47,9 +46,7 @@ Feature: Edited forum posts handle tags correctly And I set the field "Enter comma-separated list of new tags" to "OT1, OT2, OT3" And I press "Continue" And I log out - And I log in as "teacher1" - And I am on "Course 1" course homepage - And I follow "Test forum" + And I am on the "Test forum name" "forum activity" page logged in as teacher1 And I click on "Add a new discussion topic" "link" And I click on "Advanced" "button" And I expand all fieldsets diff --git a/mod/forum/tests/behat/favourite_discussion.feature b/mod/forum/tests/behat/favourite_discussion.feature index fa6f640cf1c9c..8ff9650ef1579 100644 --- a/mod/forum/tests/behat/favourite_discussion.feature +++ b/mod/forum/tests/behat/favourite_discussion.feature @@ -9,13 +9,13 @@ Feature: A student can favourite a discussion via the forum settings menu | fullname | shortname | category | | Course 1 | C1 | 0 | And the following "course enrolments" exist: - | user | course | role | - | student1 | C1 | student | - And I log in as "admin" - And I am on "Course 1" course homepage with editing mode on - And I add a "Forum" to section "1" and I fill the form with: - | Forum name | Test forum name | - | Description | Test forum description | + | user | course | role | + | student1 | C1 | student | + And the following "activity" exists: + | course | C1 | + | activity | forum | + | name | Test forum name | + And I am on the "Course 1" Course page logged in as admin And I add a new discussion to "Test forum name" forum with: | Subject | Discussion 1 | | Message | Discussion contents 1, first message | @@ -23,25 +23,25 @@ Feature: A student can favourite a discussion via the forum settings menu | Subject | Reply 1 to discussion 1 | | Message | Discussion contents 1, second message | And I log out - And I log in as "student1" - And I am on "Course 1" course homepage Scenario: Student can favourite a discussion from within an individual discussion - Given I reply "Discussion 1" post from "Test forum name" forum with: + Given I am on the "Course 1" Course page logged in as student1 + And I reply "Discussion 1" post from "Test forum name" forum with: | Subject | Reply 2 to discussion 1 | | Message | Discussion contents 1, third message | And I wait until the page is ready - And I open the action menu in "[data-container='discussion-tools']" "css_element" + When I open the action menu in "[data-container='discussion-tools']" "css_element" And I click on "[title='Star this discussion']" "css_element" And I wait "3" seconds And I open the action menu in "[data-container='discussion-tools']" "css_element" And I click on "[title='Unstar this discussion']" "css_element" Scenario: Student can favourite a discussion from the discussion list - Given I reply "Discussion 1" post from "Test forum name" forum with: + Given I am on the "Course 1" Course page logged in as student1 + And I reply "Discussion 1" post from "Test forum name" forum with: | Subject | Reply 2 to discussion 1 | | Message | Discussion contents 1, third message | - And I follow "Test forum name" + When I am on the "Test forum name" "forum activity" page And I click on "Discussion 1" action menu And I click on "[title='Star this discussion']" "css_element" And I click on "Discussion 1" action menu diff --git a/mod/forum/tests/behat/forum_activity_completion.feature b/mod/forum/tests/behat/forum_activity_completion.feature index 3f82a86de8f12..9fb6f809415f5 100644 --- a/mod/forum/tests/behat/forum_activity_completion.feature +++ b/mod/forum/tests/behat/forum_activity_completion.feature @@ -10,29 +10,19 @@ Feature: View activity completion in the forum activity | student1 | Vinnie | Student1 | student1@example.com | | teacher1 | Darrell | Teacher1 | teacher1@example.com | And the following "courses" exist: - | fullname | shortname | category | - | Course 1 | C1 | 0 | + | fullname | shortname | enablecompletion | showcompletionconditions | + | Course 1 | C1 | 1 | 1 | And the following "course enrolments" exist: | user | course | role | | student1 | C1 | student | | teacher1 | C1 | editingteacher | - And I log in as "teacher1" - And I am on "Course 1" course homepage - And I navigate to "Edit settings" in current page administration - And I expand all fieldsets - And I set the following fields to these values: - | Enable completion tracking | Yes | - | Show activity completion conditions | Yes | - And I press "Save and display" And the following "activity" exists: | activity | forum | | course | C1 | | idnumber | mh1 | | name | Music history | | section | 1 | - And I am on "Course 1" course homepage - And I follow "Music history" - And I navigate to "Edit settings" in current page administration + And I am on the "Music history" "forum activity editing" page logged in as teacher1 And I expand all fieldsets And I set the following fields to these values: | Whole forum grading > Type | Point | @@ -49,9 +39,7 @@ Feature: View activity completion in the forum activity And I log out Scenario: View automatic completion items as a teacher - Given I log in as "teacher1" - And I am on "Course 1" course homepage - When I follow "Music history" + When I am on the "Music history" "forum activity" page logged in as teacher1 Then "Music history" should have the "View" completion condition And "Music history" should have the "Start discussions: 1" completion condition And "Music history" should have the "Make forum posts: 2" completion condition @@ -60,9 +48,7 @@ Feature: View activity completion in the forum activity @javascript Scenario: View automatic completion items as a student - Given I log in as "student1" - And I am on "Course 1" course homepage - And I follow "Music history" + Given I am on the "Music history" "forum activity" page logged in as student1 And the "View" completion condition of "Music history" is displayed as "done" And the "Start discussions: 1" completion condition of "Music history" is displayed as "todo" And the "Make forum posts: 2" completion condition of "Music history" is displayed as "todo" @@ -71,8 +57,7 @@ Feature: View activity completion in the forum activity And I add a new discussion to "Music history" forum with: | Subject | Fun instruments | | Message | I like drums | - And I am on "Course 1" course homepage - And I follow "Music history" + And I am on the "Music history" "forum activity" page And the "View" completion condition of "Music history" is displayed as "done" And the "Start discussions: 1" completion condition of "Music history" is displayed as "done" And the "Make forum posts: 2" completion condition of "Music history" is displayed as "todo" @@ -81,8 +66,7 @@ Feature: View activity completion in the forum activity And I reply "Fun instruments" post from "Music history" forum with: | Subject | Reply 1 to Fun instruments | | Message | Guitar is also Fun | - And I am on "Course 1" course homepage - And I follow "Music history" + And I am on the "Music history" "forum activity" page And the "View" completion condition of "Music history" is displayed as "done" And the "Start discussions: 1" completion condition of "Music history" is displayed as "done" And the "Make forum posts: 2" completion condition of "Music history" is displayed as "done" @@ -90,18 +74,14 @@ Feature: View activity completion in the forum activity And the "Receive a grade" completion condition of "Music history" is displayed as "todo" And I log out # Grade the student - And I log in as "teacher1" - And I am on "Course 1" course homepage - And I follow "Music history" + And I am on the "Music history" "forum activity" page logged in as teacher1 And I press "Grade users" And I set the field "grade" to "33" And I press "Save" And I press "Close grader" And I log out # All conditions should now be completed. - When I log in as "student1" - And I am on "Course 1" course homepage - And I follow "Music history" + When I am on the "Music history" "forum activity" page logged in as student1 Then the "View" completion condition of "Music history" is displayed as "done" And the "Start discussions: 1" completion condition of "Music history" is displayed as "done" And the "Make forum posts: 2" completion condition of "Music history" is displayed as "done" @@ -110,9 +90,7 @@ Feature: View activity completion in the forum activity @javascript Scenario: Use manual completion - Given I log in as "teacher1" - And I am on "Course 1" course homepage - And I follow "Music history" + Given I am on the "Music history" "forum activity" page logged in as teacher1 And I navigate to "Edit settings" in current page administration And I expand all fieldsets And I set the field "Completion tracking" to "Students can manually mark the activity as completed" @@ -121,9 +99,7 @@ Feature: View activity completion in the forum activity And the manual completion button for "Music history" should be disabled And I log out # Student view. - When I log in as "student1" - And I am on "Course 1" course homepage - And I follow "Music history" + When I am on the "Music history" "forum activity" page logged in as student1 Then the manual completion button of "Music history" is displayed as "Mark as done" And I toggle the manual completion state of "Music history" And the manual completion button of "Music history" is displayed as "Done" diff --git a/mod/forum/tests/behat/forum_export.feature b/mod/forum/tests/behat/forum_export.feature index 0fc6c544f5059..12d71f84e6c57 100644 --- a/mod/forum/tests/behat/forum_export.feature +++ b/mod/forum/tests/behat/forum_export.feature @@ -22,9 +22,7 @@ Feature: Export forum | forum | Test forum 1 | Test forum 1 description | general | C1 | 123 | Scenario: Teacher can export forum - Given I log in as "teacher1" - And I am on "Course 1" course homepage - When I follow "Test forum 1" + Given I am on the "Test forum 1" "forum activity" page logged in as teacher1 And I navigate to "Export" in current page administration And I open the autocomplete suggestions list And I should see "Student 1" in the ".form-autocomplete-suggestions" "css_element" @@ -35,9 +33,7 @@ Feature: Export forum And I log out Scenario: Students cannot export forum by default - Given I log in as "student1" - And I am on "Course 1" course homepage - When I follow "Test forum 1" + Given I am on the "Test forum 1" "forum activity" page logged in as student1 Then "Export" "link" should not exist in current page administration And I log out @@ -45,9 +41,7 @@ Feature: Export forum Given the following "permission overrides" exist: | capability | permission | role | contextlevel | reference | | mod/forum:exportforum | Allow | student | Course | C1 | - When I log in as "student1" - And I am on "Course 1" course homepage - And I follow "Test forum 1" + When I am on the "Test forum 1" "forum activity" page logged in as student1 And I navigate to "Export" in current page administration And I open the autocomplete suggestions list And I should see "Student 1" in the ".form-autocomplete-suggestions" "css_element" diff --git a/mod/forum/tests/behat/forum_subscriptions_availability.feature b/mod/forum/tests/behat/forum_subscriptions_availability.feature index 1d8deba5dae39..1a9f7a09104a1 100644 --- a/mod/forum/tests/behat/forum_subscriptions_availability.feature +++ b/mod/forum/tests/behat/forum_subscriptions_availability.feature @@ -44,14 +44,13 @@ Feature: As a teacher I need to see an accurate list of subscribed users | Forum type | Standard forum for general use | | Description | Test forum description | | Subscription mode | Forced subscription | - And I follow "Forced Forum 1" + And I am on the "Forced Forum 1" "forum activity" page And I navigate to "Show/edit current subscribers" in current page administration Then I should see "Student 1" And I should see "Teacher Teacher" And I should see "Student 2" And I should see "Student 3" - And I follow "Forced Forum 1" - And I navigate to "Edit settings" in current page administration + And I am on the "Forced Forum 1" "forum activity editing" page And I expand all fieldsets And I click on "Add restriction..." "button" And I click on "Grouping" "button" in the "Add restriction..." "dialogue" @@ -72,14 +71,13 @@ Feature: As a teacher I need to see an accurate list of subscribed users | course | C1 | | idnumber | 0001 | | section | 1 | - And I am on "Course 1" course homepage - And I follow "Forced Forum 2" + And I am on the "Forced Forum 2" "forum activity" page And I navigate to "Edit settings" in current page administration And I set the following fields to these values: | Subscription mode | Forced subscription | | Availability | Show on course page | And I press "Save and return to course" - And I follow "Forced Forum 2" + And I am on the "Forced Forum 2" "forum activity" page And I navigate to "Show/edit current subscribers" in current page administration Then I should see "Teacher Teacher" And I should see "Student 1" @@ -97,13 +95,12 @@ Feature: As a teacher I need to see an accurate list of subscribed users | idnumber | 0001 | | section | 1 | And I am on "Course 1" course homepage - And I follow "Forced Forum 2" - And I navigate to "Edit settings" in current page administration + And I am on the "Forced Forum 2" "forum activity editing" page And I set the following fields to these values: | Subscription mode | Forced subscription | | Availability | Hide from students | And I press "Save and return to course" - And I follow "Forced Forum 2" + And I am on the "Forced Forum 2" "forum activity" page And I navigate to "Show/edit current subscribers" in current page administration Then I should see "Teacher Teacher" And I should not see "Student 1" @@ -117,14 +114,14 @@ Feature: As a teacher I need to see an accurate list of subscribed users | Forum type | Standard forum for general use | | Description | Test forum description | | Subscription mode | Auto subscription | - And I follow "Forced Forum 1" + And I am on the "Forced Forum 1" "forum activity" page And I navigate to "Show/edit current subscribers" in current page administration Then I should see "Student 1" And I should see "Teacher Teacher" And I should see "Student 2" And I should see "Student 3" - And I follow "Forced Forum 1" - And I navigate to "Edit settings" in current page administration + And I am on "Course 1" course homepage + And I am on the "Forced Forum 1" "forum activity editing" page And I expand all fieldsets And I click on "Add restriction..." "button" And I click on "Grouping" "button" in the "Add restriction..." "dialogue" diff --git a/mod/forum/tests/behat/forum_subscriptions_default.feature b/mod/forum/tests/behat/forum_subscriptions_default.feature index 07b898e972a9c..c350aa6b84bc3 100644 --- a/mod/forum/tests/behat/forum_subscriptions_default.feature +++ b/mod/forum/tests/behat/forum_subscriptions_default.feature @@ -19,75 +19,57 @@ Feature: A user can control their default discussion subscription settings And the following "activities" exist: | activity | name | intro | course | idnumber | type | section | | forum | Test forum name | Test forum description | C1 | forump1 | general | 1 | - And I log in as "admin" - And I am on "Course 1" course homepage - And I follow "Test forum name" - And I navigate to "Edit settings" in current page administration + And I am on the "Test forum name" "forum activity editing" page logged in as admin And I set the following fields to these values: | Subscription mode | Optional subscription | And I press "Save and return to course" - And I am on "Course 1" course homepage with editing mode on + And I log out Scenario: Creating a new discussion in an optional forum follows user preferences - Given I log out - And I log in as "student1" - And I am on "Course 1" course homepage - And I follow "Test forum name" + Given I am on the "Test forum name" "forum activity" page logged in as student1 When I click on "Add a new discussion topic" "link" And I click on "Advanced" "button" Then "input[name=discussionsubscribe][checked=checked]" "css_element" should exist And I log out - And I log in as "student2" - And I am on "Course 1" course homepage - And I follow "Test forum name" + And I am on the "Test forum name" "forum activity" page logged in as student2 And I click on "Add a new discussion topic" "link" And I click on "Advanced" "button" And "input[name=discussionsubscribe]:not([checked=checked])" "css_element" should exist Scenario: Replying to an existing discussion in an optional forum follows user preferences - Given I add a new discussion to "Test forum name" forum with: + Given I am on the "Test forum name" "forum activity" page logged in as admin + And I add a new discussion to "Test forum name" forum with: | Subject | Test post subject | | Message | Test post message | And I log out - And I log in as "student1" - And I am on "Course 1" course homepage - And I follow "Test forum name" + And I am on the "Test forum name" "forum activity" page logged in as student1 And I follow "Test post subject" When I follow "Reply" Then "input[name=discussionsubscribe][checked=checked]" "css_element" should exist And I log out - And I log in as "student2" - And I am on "Course 1" course homepage - And I follow "Test forum name" + And I am on the "Test forum name" "forum activity" page logged in as student2 And I follow "Test post subject" And I follow "Reply" And "input[name=discussionsubscribe]:not([checked=checked])" "css_element" should exist Scenario: Creating a new discussion in an automatic forum follows forum subscription - Given I follow "Test forum name" - And I navigate to "Edit settings" in current page administration + Given I am on the "Test forum name" "forum activity editing" page logged in as admin And I set the following fields to these values: | Subscription mode | Auto subscription | And I press "Save and return to course" And I log out - And I log in as "student1" - And I am on "Course 1" course homepage - And I follow "Test forum name" + And I am on the "Test forum name" "forum activity" page logged in as student1 When I click on "Add a new discussion topic" "link" And I click on "Advanced" "button" Then "input[name=discussionsubscribe][checked=checked]" "css_element" should exist And I log out - And I log in as "student2" - And I am on "Course 1" course homepage - And I follow "Test forum name" + And I am on the "Test forum name" "forum activity" page logged in as student2 And I click on "Add a new discussion topic" "link" And I click on "Advanced" "button" And "input[name=discussionsubscribe][checked=checked]" "css_element" should exist Scenario: Replying to an existing discussion in an automatic forum follows forum subscription - Given I am on "Course 1" course homepage - And I follow "Test forum name" - And I navigate to "Edit settings" in current page administration + Given I am on the "Test forum name" "forum activity editing" page logged in as admin And I set the following fields to these values: | Subscription mode | Optional subscription | And I press "Save and return to course" @@ -95,24 +77,19 @@ Feature: A user can control their default discussion subscription settings | Subject | Test post subject | | Message | Test post message | And I log out - And I log in as "student1" - And I am on "Course 1" course homepage - And I follow "Test forum name" + And I am on the "Test forum name" "forum activity" page logged in as student1 And I follow "Test post subject" When I follow "Reply" Then "input[name=discussionsubscribe][checked=checked]" "css_element" should exist And I log out - And I log in as "student2" - And I am on "Course 1" course homepage - And I follow "Test forum name" + And I am on the "Test forum name" "forum activity" page logged in as student2 And I follow "Test post subject" And I follow "Reply" And "input[name=discussionsubscribe]:not([checked=checked])" "css_element" should exist @javascript Scenario: Replying to an existing discussion in an automatic forum which has been unsubscribed from follows user preferences - Given I follow "Test forum name" - And I navigate to "Edit settings" in current page administration + Given I am on the "Test forum name" "forum activity editing" page logged in as admin And I set the following fields to these values: | Subscription mode | Auto subscription | And I press "Save and return to course" @@ -120,18 +97,14 @@ Feature: A user can control their default discussion subscription settings | Subject | Test post subject | | Message | Test post message | And I log out - And I log in as "student1" - And I am on "Course 1" course homepage - And I follow "Test forum name" + And I am on the "Test forum name" "forum activity" page logged in as student1 And I click on "input[id^=subscription-toggle]" "css_element" in the "Test post subject" "table_row" And I follow "Test post subject" When I follow "Reply" And I click on "Advanced" "button" And "input[name=discussionsubscribe][checked]" "css_element" should exist And I log out - And I log in as "student2" - And I am on "Course 1" course homepage - And I follow "Test forum name" + And I am on the "Test forum name" "forum activity" page logged in as student2 And I click on "input[id^=subscription-toggle]" "css_element" in the "Test post subject" "table_row" And I follow "Test post subject" And I follow "Reply" diff --git a/mod/forum/tests/behat/grade_view_discussion.feature b/mod/forum/tests/behat/grade_view_discussion.feature index 4cafd08762c09..e992a6c5ba9a8 100644 --- a/mod/forum/tests/behat/grade_view_discussion.feature +++ b/mod/forum/tests/behat/grade_view_discussion.feature @@ -37,9 +37,7 @@ Feature: View discussion while grading in a forum | Gradable forum | student2 | My topic | I disagree | Scenario: Viewing a discussion - Given I log in as "teacher" - And I am on "Course 1" course homepage - And I follow "Gradable forum" + Given I am on the "Gradable forum" "forum activity" page logged in as teacher And I press "Grade users" When I press "View discussion" Then I should see "I disagree" in the "My topic" "dialogue" @@ -47,9 +45,7 @@ Feature: View discussion while grading in a forum And I should not see "I disagree" Scenario: Viewing a discussion while grading is fullscreen - Given I log in as "teacher" - And I am on "Course 1" course homepage - And I follow "Gradable forum" + Given I am on the "Gradable forum" "forum activity" page logged in as teacher And I press "Grade users" # Uses the aria-label for the menu in in the grading interface. And I press "Actions for the grader interface" diff --git a/mod/forum/tests/behat/posts_ordering_blog.feature b/mod/forum/tests/behat/posts_ordering_blog.feature index 719273b59c1b7..e8be1ba16def5 100644 --- a/mod/forum/tests/behat/posts_ordering_blog.feature +++ b/mod/forum/tests/behat/posts_ordering_blog.feature @@ -16,13 +16,11 @@ Feature: Blog posts are always displayed in reverse chronological order | 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 "Forum" to section "1" and I fill the form with: - | Forum name | Course blog forum | - | Description | Single discussion forum description | - | Forum type | Standard forum displayed in a blog-like format | - And I log out + And the following "activity" exists: + | course | C1 | + | activity | forum | + | name | Course blog forum | + | type | blog | # # We need javascript/wait to prevent creation of the posts in the same second. The threads @@ -31,9 +29,7 @@ Feature: Blog posts are always displayed in reverse chronological order # @javascript Scenario: Replying to a blog post or editing it does not affect its display order - Given I log in as "student1" - And I am on "Course 1" course homepage - And I follow "Course blog forum" + Given I am on the "Course blog forum" "forum activity" page logged in as student1 # # Add three posts into the blog. # @@ -58,14 +54,11 @@ Feature: Blog posts are always displayed in reverse chronological order # # Reply to another blog post. # - And I log in as "teacher1" - And I am on "Course 1" course homepage - And I follow "Course blog forum" + And I am on the "Course blog forum" "forum activity" page logged in as teacher1 And I click on "Discuss this topic" "link" in the "//div[@aria-label='Blog post 1 by Student 1']" "xpath_element" And I reply "Blog post 1" post from "Course blog forum" forum with: | Message | Reply to the first post | - And I am on "Course 1" course homepage - And I follow "Course blog forum" + And I am on the "Course blog forum" "forum activity" page # # Make sure the order of the blog posts is still reverse chronological. # diff --git a/mod/forum/tests/behat/posts_ordering_general.feature b/mod/forum/tests/behat/posts_ordering_general.feature index fb3c2320b312c..ba74c7e41a175 100644 --- a/mod/forum/tests/behat/posts_ordering_general.feature +++ b/mod/forum/tests/behat/posts_ordering_general.feature @@ -16,13 +16,10 @@ Feature: New discussions and discussions with recently added replies are display | 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 "Forum" to section "1" and I fill the form with: - | Forum name | Course general forum | - | Description | Single discussion forum description | - | Forum type | Standard forum for general use | - And I log out + And the following "activity" exists: + | course | C1 | + | activity | forum | + | name | Course general forum | # # We need javascript/wait to prevent creation of the posts in the same second. The threads @@ -31,9 +28,7 @@ Feature: New discussions and discussions with recently added replies are display # @javascript Scenario: Replying to a forum post or editing it puts the discussion to the front - Given I log in as "student1" - And I am on "Course 1" course homepage - And I follow "Course general forum" + Given I am on the "Course general forum" "forum activity" page logged in as student1 # # Add three posts into the forum. # @@ -59,14 +54,11 @@ Feature: New discussions and discussions with recently added replies are display # # Reply to another forum post. # - And I log in as "teacher1" - And I am on "Course 1" course homepage - And I follow "Course general forum" + And I am on the "Course general forum" "forum activity" page logged in as teacher1 And I follow "Forum post 1" And I reply "Forum post 1" post from "Course general forum" forum with: | Message | Reply to the first post | - And I am on "Course 1" course homepage - And I follow "Course general forum" + And I am on the "Course general forum" "forum activity" page # # Make sure the order of the forum posts is as expected, with most recent new participation first (ie excluding edits). # diff --git a/mod/glossary/tests/behat/categories.feature b/mod/glossary/tests/behat/categories.feature index 2154e7b13f109..14b49a460a9e4 100644 --- a/mod/glossary/tests/behat/categories.feature +++ b/mod/glossary/tests/behat/categories.feature @@ -25,13 +25,12 @@ Feature: Glossary entries can be organised in categories | label | name | check autolinking of CategoryAutoLinks and CategoryNoLinks text | C1 | label1 | And the "glossary" filter is "on" # Log in as a teacher and make sure nothing is yet autolinked - And I log in as "teacher1" - When I am on "Course 1" course homepage + When I am on the "Course 1" course page logged in as teacher1 Then I should see "CategoryAutoLinks" And I should see "CategoryNoLinks" And "a.glossary.autolink" "css_element" should not exist # Create, edit and delete categories - And I follow "MyGlossary" + And I am on the MyGlossary "glossary activity" page And I follow "Browse by category" And I press "Edit categories" And I press "Add category" @@ -97,8 +96,7 @@ Feature: Glossary entries can be organised in categories And I should see "CategoryNoLinks" And "//a[contains(.,'CategoryNoLinks')]" "xpath_element" should not exist # Delete a category with entries - And I am on "Course 1" course homepage - And I follow "MyGlossary" + And I am on the MyGlossary "glossary activity" page And I follow "Browse by category" And I press "Edit categories" And I should see "2 Entries" in the "CategoryNoLinks" "table_row" @@ -106,7 +104,7 @@ Feature: Glossary entries can be organised in categories And I click on "Delete" "link" in the "CategoryAutoLinks" "table_row" And I press "Yes" And I wait to be redirected - And I follow "MyGlossary" + And I am on the MyGlossary "glossary activity" page And I follow "Browse by category" And I should see "EntryCategoryNL" And I should not see "EntryNoCategory" diff --git a/mod/glossary/tests/behat/edit_tags.feature b/mod/glossary/tests/behat/edit_tags.feature index 3812acee73100..e26859a887051 100644 --- a/mod/glossary/tests/behat/edit_tags.feature +++ b/mod/glossary/tests/behat/edit_tags.feature @@ -16,17 +16,14 @@ Feature: Edited glossary entries handle tags correctly | 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 "Glossary" to section "1" and I fill the form with: - | Name | Test glossary | - | Description | A glossary about dreams! | - And I log out + And the following "activity" exists: + | course | C1 | + | activity | glossary | + | name | Test glossary | + | intro | A glossary about dreams! | Scenario: Glossary entry edition of custom tags works as expected - Given I log in as "teacher1" - And I am on "Course 1" course homepage - And I follow "Test glossary" + Given I am on the "Test glossary" "glossary activity" page logged in as teacher1 And I press "Add a new entry" And I set the following fields to these values: | Concept | Dummy first entry | @@ -50,9 +47,7 @@ Feature: Edited glossary entries handle tags correctly And I set the field "Enter comma-separated list of new tags" to "OT1, OT2, OT3" And I press "Continue" And I log out - And I log in as "teacher1" - And I am on "Course 1" course homepage - And I follow "Test glossary" + Given I am on the "Test glossary" "glossary activity" page logged in as teacher1 And I press "Add a new entry" And I expand all fieldsets And I open the autocomplete suggestions list diff --git a/mod/glossary/tests/behat/entries_require_approval.feature b/mod/glossary/tests/behat/entries_require_approval.feature index 6eb1f2c603ac0..cc04cb760a206 100644 --- a/mod/glossary/tests/behat/entries_require_approval.feature +++ b/mod/glossary/tests/behat/entries_require_approval.feature @@ -28,53 +28,39 @@ Feature: A teacher can choose whether glossary entries require approval | defaultapproval | 0 | Scenario: Approve and undo approve glossary entries - Given I log in as "student1" - And I am on "Course 1" course homepage - And I follow "Test glossary name" + Given I am on the "Test glossary name" "glossary activity" page logged in as student1 When I add a glossary entry with the following data: | Concept | Just a test concept | | Definition | Concept definition | | Keyword(s) | Black | And I log out # Test that students can not see the unapproved entry. - And I log in as "student2" - And I am on "Course 1" course homepage - And I follow "Test glossary name" + And I am on the "Test glossary name" "glossary activity" page logged in as student2 Then I should see "No entries found in this section" And I log out # Approve the entry. - And I log in as "teacher1" - And I am on "Course 1" course homepage - And I follow "Test glossary name" + And I am on the "Test glossary name" "glossary activity" page logged in as teacher1 And I follow "Waiting approval" Then I should see "(this entry is currently hidden)" And I follow "Approve" - And I follow "Test glossary name" + And I click on "Test glossary name" "link" in the "page-header" "region" Then I should see "Concept definition" And I log out # Check that the entry can now be viewed by students. - And I log in as "student2" - And I am on "Course 1" course homepage - And I follow "Test glossary name" + And I am on the "Test glossary name" "glossary activity" page logged in as student2 Then I should see "Concept definition" And I log out # Undo the approval of the previous entry. - And I log in as "teacher1" - And I am on "Course 1" course homepage - And I follow "Test glossary name" + And I am on the "Test glossary name" "glossary activity" page logged in as teacher1 And I follow "Undo approval" And I log out # Check that the entry is no longer visible by students. - And I log in as "student2" - And I am on "Course 1" course homepage - And I follow "Test glossary name" + And I am on the "Test glossary name" "glossary activity" page logged in as student2 Then I should see "No entries found in this section" @javascript Scenario: View pending approval glossary items - Given I log in as "student1" - And I am on "Course 1" course homepage - And I follow "Test glossary name" + Given I am on the "Test glossary name" "glossary activity" page logged in as student1 When I add a glossary entry with the following data: | Concept | Just a test concept | | Definition | Concept definition | diff --git a/mod/glossary/tests/behat/glossary_activity_completion.feature b/mod/glossary/tests/behat/glossary_activity_completion.feature index fa1a8b969e9b2..a2eeff3bd1124 100644 --- a/mod/glossary/tests/behat/glossary_activity_completion.feature +++ b/mod/glossary/tests/behat/glossary_activity_completion.feature @@ -10,29 +10,18 @@ Feature: View activity completion in the glossary activity | student1 | Vinnie | Student1 | student1@example.com | | teacher1 | Darrell | Teacher1 | teacher1@example.com | And the following "courses" exist: - | fullname | shortname | category | - | Course 1 | C1 | 0 | + | fullname | shortname | enablecompletion | showcompletionconditions | + | Course 1 | C1 | 1 | 1 | And the following "course enrolments" exist: | user | course | role | | student1 | C1 | student | | teacher1 | C1 | editingteacher | - And I log in as "teacher1" - And I am on "Course 1" course homepage - And I navigate to "Edit settings" in current page administration - And I expand all fieldsets - And I set the following fields to these values: - | Enable completion tracking | Yes | - | Show activity completion conditions | Yes | - And I press "Save and display" And the following "activity" exists: | activity | glossary | | course | C1 | - | idnumber | mh1 | | name | Music history | | section | 1 | - And I am on "Course 1" course homepage - And I follow "Music history" - And I navigate to "Edit settings" in current page administration + And I am on the "Music history" "glossary activity editing" page logged in as teacher1 And I expand all fieldsets And I set the following fields to these values: | Aggregate type | Average of ratings | @@ -47,22 +36,17 @@ Feature: View activity completion in the glossary activity And I log out Scenario: View automatic completion items as a teacher - Given I log in as "teacher1" - And I am on "Course 1" course homepage - When I follow "Music history" + Given I am on the "Music history" "glossary activity" page logged in as teacher1 Then "Music history" should have the "View" completion condition And "Music history" should have the "Make entries: 1" completion condition And "Music history" should have the "Receive a grade" completion condition Scenario: View automatic completion items as a student - Given I log in as "student1" - And I am on "Course 1" course homepage - And I follow "Music history" + Given I am on the "Music history" "glossary activity" page logged in as student1 And the "View" completion condition of "Music history" is displayed as "done" And the "Make entries: 1" completion condition of "Music history" is displayed as "todo" And the "Receive a grade" completion condition of "Music history" is displayed as "todo" - When I am on "Course 1" course homepage - And I follow "Music history" + And I am on the "Music history" "glossary activity" page And I press "Add a new entry" And I set the following fields to these values: | Concept | Blast beats | @@ -72,25 +56,18 @@ Feature: View activity completion in the glossary activity And the "Make entries: 1" completion condition of "Music history" is displayed as "done" And the "Receive a grade" completion condition of "Music history" is displayed as "todo" And I log out - And I log in as "teacher1" - And I am on "Course 1" course homepage - And I follow "Music history" + And I am on the "Music history" "glossary activity" page logged in as teacher1 And I set the field "rating" to "3" And I press "Rate" And I log out - When I log in as "student1" - And I am on "Course 1" course homepage - And I follow "Music history" + When I am on the "Music history" "glossary activity" page logged in as student1 Then the "View" completion condition of "Music history" is displayed as "done" And the "Make entries: 1" completion condition of "Music history" is displayed as "done" And the "Receive a grade" completion condition of "Music history" is displayed as "done" @javascript Scenario: Use manual completion - Given I log in as "teacher1" - And I am on "Course 1" course homepage - And I follow "Music history" - And I navigate to "Edit settings" in current page administration + Given I am on the "Music history" "glossary activity editing" page logged in as teacher1 And I expand all fieldsets And I set the field "Completion tracking" to "Students can manually mark the activity as completed" And I press "Save and display" @@ -98,9 +75,7 @@ Feature: View activity completion in the glossary activity And the manual completion button for "Music history" should be disabled And I log out # Student view. - When I log in as "student1" - And I am on "Course 1" course homepage - And I follow "Music history" + When I am on the "Music history" "glossary activity" page logged in as student1 Then the manual completion button of "Music history" is displayed as "Mark as done" And I toggle the manual completion state of "Music history" And the manual completion button of "Music history" is displayed as "Done" diff --git a/mod/glossary/tests/behat/import_entries.feature b/mod/glossary/tests/behat/import_entries.feature index 8bb84b9119ef8..38cfbafb7bfe5 100644 --- a/mod/glossary/tests/behat/import_entries.feature +++ b/mod/glossary/tests/behat/import_entries.feature @@ -23,7 +23,7 @@ Feature: Importing glossary entries Given I log in as "teacher1" And I am on "Course 1" course homepage with editing mode on And I add the "Recent activity" block - And I follow "Glossary 1" + And I am on the "Glossary 1" "glossary activity" page And I navigate to "Import entries" in current page administration And I upload "mod/glossary/tests/fixtures/texfilter_glossary_en.xml" file to "File to import" filemanager When I press "Submit" @@ -38,7 +38,7 @@ Feature: Importing glossary entries Given I log in as "teacher1" And I am on "Course 1" course homepage with editing mode on And I add the "Tags" block - And I follow "Glossary 1" + And I am on the "Glossary 1" "glossary activity" page And I navigate to "Import entries" in current page administration And I upload "mod/glossary/tests/fixtures/musicians.xml" file to "File to import" filemanager When I press "Submit" diff --git a/mod/glossary/tests/behat/prevent_duplicate_entries.feature b/mod/glossary/tests/behat/prevent_duplicate_entries.feature index a8d083b56e481..d9f42a210bac8 100644 --- a/mod/glossary/tests/behat/prevent_duplicate_entries.feature +++ b/mod/glossary/tests/behat/prevent_duplicate_entries.feature @@ -15,13 +15,13 @@ Feature: A teacher can choose whether to allow duplicate entries in a glossary And the following "course enrolments" exist: | user | course | role | | teacher1 | C1 | editingteacher | - And I log in as "teacher1" - And I am on "Course 1" course homepage with editing mode on - And I add a "Glossary" to section "1" and I fill the form with: - | Name | Test glossary name | - | Description | Test glossary description | - | Duplicate entries allowed | No | - And I follow "Test glossary name" + And the following "activity" exists: + | course | C1 | + | activity | glossary | + | name | Test glossary name | + | intro | Test glossary description | + | allowduplicatedentries | 0 | + And I am on the "Test glossary name" "glossary activity" page logged in as teacher1 And I add a glossary entry with the following data: | Concept | Unique concept | | Definition | I'm the definition of an unique concept | diff --git a/mod/glossary/tests/behat/print_friendly_version.feature b/mod/glossary/tests/behat/print_friendly_version.feature index 1eb4bf3d64e79..63dc6731577ea 100644 --- a/mod/glossary/tests/behat/print_friendly_version.feature +++ b/mod/glossary/tests/behat/print_friendly_version.feature @@ -16,19 +16,16 @@ Feature: A teacher can choose whether to provide a printer-friendly glossary ent | 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 @javascript Scenario: Printer-friendly glossary view enabled - Given I add a "Glossary" to section "1" and I fill the form with: - | Name | Test glossary name | - | Description | Test glossary description | - | Allow print view | Yes | - And I log out - And I log in as "student1" - And I am on "Course 1" course homepage - And I follow "Test glossary name" + Given the following "activity" exists: + | course | C1 | + | activity | glossary | + | name | Test glossary name | + | intro | Test glossary description | + | allowprintview | 1 | + And I am on the "Test glossary name" "glossary activity" page logged in as student1 When I add a glossary entry with the following data: | Concept | Just a test concept | | Definition | Concept definition | @@ -39,14 +36,13 @@ Feature: A teacher can choose whether to provide a printer-friendly glossary ent @javascript Scenario: Printer-friendly glossary view disabled - Given I add a "Glossary" to section "1" and I fill the form with: - | Name | Test glossary name | - | Description | Test glossary description | - | Allow print view | No | - And I log out - And I log in as "student1" - And I am on "Course 1" course homepage - And I follow "Test glossary name" + Given the following "activity" exists: + | course | C1 | + | activity | glossary | + | name | Test glossary name | + | intro | Test glossary description | + | allowprintview | 0 | + And I am on the "Test glossary name" "glossary activity" page logged in as student1 When I add a glossary entry with the following data: | Concept | Just a test concept | | Definition | Concept definition | diff --git a/mod/glossary/tests/behat/search_entries.feature b/mod/glossary/tests/behat/search_entries.feature index fca9d3a1db1d4..b403a0f1b1008 100644 --- a/mod/glossary/tests/behat/search_entries.feature +++ b/mod/glossary/tests/behat/search_entries.feature @@ -19,9 +19,7 @@ Feature: Glossary entries can be searched or browsed by alphabet, category, date And the following "activities" exist: | activity | name | intro | displayformat | course | idnumber | | glossary | Test glossary name | Test glossary description | fullwithauthor | C1 | g1 | - And I log in as "teacher1" - And I am on "Course 1" course homepage - And I follow "Test glossary name" + And I am on the "Test glossary name" "glossary activity" page logged in as teacher1 And I add a glossary entries category named "The ones I like" And I add a glossary entries category named "All for you" And I add a glossary entry with the following data: @@ -29,17 +27,13 @@ Feature: Glossary entries can be searched or browsed by alphabet, category, date | Definition | Sour eggplants | | Categories | All for you | And I log out - And I log in as "student1" - And I am on "Course 1" course homepage - And I follow "Test glossary name" + And I am on the "Test glossary name" "glossary activity" page logged in as student1 And I add a glossary entry with the following data: | Concept | Cucumber | | Definition | Sweet cucumber | | Categories | The ones I like | And I log out - And I log in as "teacher1" - And I am on "Course 1" course homepage - And I follow "Test glossary name" + And I am on the "Test glossary name" "glossary activity" page logged in as teacher1 @javascript Scenario: Search by keyword and browse by alphabet diff --git a/mod/h5pactivity/tests/behat/attempt_options.feature b/mod/h5pactivity/tests/behat/attempt_options.feature index ae63b9cbaf4ec..83206ad67a914 100644 --- a/mod/h5pactivity/tests/behat/attempt_options.feature +++ b/mod/h5pactivity/tests/behat/attempt_options.feature @@ -36,9 +36,7 @@ Feature: Attempts review settings. | duration | 4 | | completion | 1 | | success | 1 | - When I log in as "student1" - And I am on "Course 1" course homepage - And I follow "H5P package" + When I am on the "H5P package" "h5pactivity activity" page logged in as student1 Then I should see "View my attempts" And I should not see "This content is displayed in preview mode" @@ -61,9 +59,7 @@ Feature: Attempts review settings. | duration | 4 | | completion | 1 | | success | 1 | - When I log in as "student1" - And I am on "Course 1" course homepage - And I follow "H5P package" + When I am on the "H5P package" "h5pactivity activity" page logged in as student1 Then I should not see "View my attempts" And I should not see "This content is displayed in preview mode" @@ -85,9 +81,7 @@ Feature: Attempts review settings. | duration | 4 | | completion | 1 | | success | 1 | - When I log in as "student1" - And I am on "Course 1" course homepage - And I follow "H5P package" + When I am on the "H5P package" "h5pactivity activity" page logged in as student1 Then I should not see "View my attempts" And I should see "This content is displayed in preview mode" @@ -110,9 +104,7 @@ Feature: Attempts review settings. | duration | 4 | | completion | 1 | | success | 1 | - When I log in as "teacher1" - And I am on "Course 1" course homepage - And I follow "H5P package" + When I am on the "H5P package" "h5pactivity activity" page logged in as teacher1 Then I should see "View all attempts (1 submitted)" And I should see "This content is displayed in preview mode" @@ -135,8 +127,6 @@ Feature: Attempts review settings. | duration | 4 | | completion | 1 | | success | 1 | - When I log in as "teacher1" - And I am on "Course 1" course homepage - And I follow "H5P package" + When I am on the "H5P package" "h5pactivity activity" page logged in as teacher1 Then I should see "View all attempts (1 submitted)" And I should see "This content is displayed in preview mode" diff --git a/mod/h5pactivity/tests/behat/display_result_types.feature b/mod/h5pactivity/tests/behat/display_result_types.feature index e59c72207dde5..83cad58931b2b 100644 --- a/mod/h5pactivity/tests/behat/display_result_types.feature +++ b/mod/h5pactivity/tests/behat/display_result_types.feature @@ -23,9 +23,7 @@ Feature: Report different types of interactions. Given the following "mod_h5pactivity > attempts" exist: | user | h5pactivity | attempt | interactiontype | rawscore | maxscore | duration | completion | success | | student1 | H5P package | 1 | compound | 2 | 2 | 4 | 1 | 1 | - When I log in as "student1" - And I am on "Course 1" course homepage - And I follow "H5P package" + When I am on the "H5P package" "h5pactivity activity" page logged in as student1 And I follow "View my attempts" And I follow "View report" Then I should see "2 out of 2" @@ -37,9 +35,7 @@ Feature: Report different types of interactions. Given the following "mod_h5pactivity > attempts" exist: | user | h5pactivity | attempt | interactiontype | rawscore | maxscore | duration | completion | success | | student1 | H5P package | 1 | compound | 0 | 2 | 4 | 1 | 0 | - When I log in as "student1" - And I am on "Course 1" course homepage - And I follow "H5P package" + When I am on the "H5P package" "h5pactivity activity" page logged in as student1 And I follow "View my attempts" And I follow "View report" Then I should see "0 out of 2" @@ -52,9 +48,7 @@ Feature: Report different types of interactions. | user | h5pactivity | attempt | interactiontype | rawscore | maxscore | duration | completion | success | | student1 | H5P package | 1 | choice | 2 | 2 | 1 | 1 | 1 | | student1 | H5P package | 1 | compound | 2 | 2 | 4 | 1 | 1 | - When I log in as "student1" - And I am on "Course 1" course homepage - And I follow "H5P package" + When I am on the "H5P package" "h5pactivity activity" page logged in as student1 And I follow "View my attempts" And I follow "View report" Then I should see "Select the correct answers" @@ -66,9 +60,7 @@ Feature: Report different types of interactions. | user | h5pactivity | attempt | interactiontype | rawscore | maxscore | duration | completion | success | | student1 | H5P package | 1 | choice | 0 | 2 | 1 | 1 | 0 | | student1 | H5P package | 1 | compound | 0 | 2 | 4 | 1 | 0 | - When I log in as "student1" - And I am on "Course 1" course homepage - And I follow "H5P package" + When I am on the "H5P package" "h5pactivity activity" page logged in as student1 And I follow "View my attempts" And I follow "View report" Then I should see "Select the correct answers" @@ -80,9 +72,7 @@ Feature: Report different types of interactions. | user | h5pactivity | attempt | interactiontype | rawscore | maxscore | duration | completion | success | | student1 | H5P package | 1 | matching | 2 | 2 | 1 | 1 | 1 | | student1 | H5P package | 1 | compound | 2 | 2 | 4 | 1 | 1 | - When I log in as "student1" - And I am on "Course 1" course homepage - And I follow "H5P package" + When I am on the "H5P package" "h5pactivity activity" page logged in as student1 And I follow "View my attempts" And I follow "View report" Then I should see "Drag and Drop example 1" @@ -94,9 +84,7 @@ Feature: Report different types of interactions. | user | h5pactivity | attempt | interactiontype | rawscore | maxscore | duration | completion | success | | student1 | H5P package | 1 | matching | 0 | 2 | 1 | 1 | 1 | | student1 | H5P package | 1 | compound | 0 | 2 | 4 | 1 | 1 | - When I log in as "student1" - And I am on "Course 1" course homepage - And I follow "H5P package" + When I am on the "H5P package" "h5pactivity activity" page logged in as student1 And I follow "View my attempts" And I follow "View report" Then I should see "Drag and Drop example 1" @@ -108,9 +96,7 @@ Feature: Report different types of interactions. | user | h5pactivity | attempt | interactiontype | rawscore | maxscore | duration | completion | success | | student1 | H5P package | 1 | true-false | 2 | 2 | 1 | 1 | 1 | | student1 | H5P package | 1 | compound | 2 | 2 | 4 | 1 | 1 | - When I log in as "student1" - And I am on "Course 1" course homepage - And I follow "H5P package" + When I am on the "H5P package" "h5pactivity activity" page logged in as student1 And I follow "View my attempts" And I follow "View report" Then I should see "The correct answer is true" @@ -122,9 +108,7 @@ Feature: Report different types of interactions. | user | h5pactivity | attempt | interactiontype | rawscore | maxscore | duration | completion | success | | student1 | H5P package | 1 | true-false | 0 | 2 | 1 | 1 | 0 | | student1 | H5P package | 1 | compound | 0 | 2 | 4 | 1 | 0 | - When I log in as "student1" - And I am on "Course 1" course homepage - And I follow "H5P package" + When I am on the "H5P package" "h5pactivity activity" page logged in as student1 And I follow "View my attempts" And I follow "View report" Then I should see "The correct answer is true" @@ -136,9 +120,7 @@ Feature: Report different types of interactions. | user | h5pactivity | attempt | interactiontype | rawscore | maxscore | duration | completion | success | | student1 | H5P package | 1 | fill-in | 2 | 2 | 1 | 1 | 1 | | student1 | H5P package | 1 | compound | 2 | 2 | 4 | 1 | 1 | - When I log in as "student1" - And I am on "Course 1" course homepage - And I follow "H5P package" + When I am on the "H5P package" "h5pactivity activity" page logged in as student1 And I follow "View my attempts" And I follow "View report" Then I should see "This an example of missing word text" @@ -153,9 +135,7 @@ Feature: Report different types of interactions. | user | h5pactivity | attempt | interactiontype | rawscore | maxscore | duration | completion | success | | student1 | H5P package | 1 | fill-in | 0 | 2 | 1 | 1 | 0 | | student1 | H5P package | 1 | compound | 0 | 2 | 4 | 1 | 0 | - When I log in as "student1" - And I am on "Course 1" course homepage - And I follow "H5P package" + When I am on the "H5P package" "h5pactivity activity" page logged in as student1 And I follow "View my attempts" And I follow "View report" Then I should see "This an example of missing word text" @@ -172,9 +152,7 @@ Feature: Report different types of interactions. | user | h5pactivity | attempt | interactiontype | rawscore | maxscore | duration | completion | success | | student1 | H5P package | 1 | long-fill-in | 2 | 2 | 1 | 1 | 1 | | student1 | H5P package | 1 | compound | 2 | 2 | 4 | 1 | 1 | - When I log in as "student1" - And I am on "Course 1" course homepage - And I follow "H5P package" + When I am on the "H5P package" "h5pactivity activity" page logged in as student1 And I follow "View my attempts" And I follow "View report" Then I should see "Please describe the novel The Hobbit" @@ -187,9 +165,7 @@ Feature: Report different types of interactions. | user | h5pactivity | attempt | interactiontype | rawscore | maxscore | duration | completion | success | | student1 | H5P package | 1 | long-fill-in | 0 | 2 | 1 | 1 | 0 | | student1 | H5P package | 1 | compound | 0 | 2 | 4 | 1 | 0 | - When I log in as "student1" - And I am on "Course 1" course homepage - And I follow "H5P package" + When I am on the "H5P package" "h5pactivity activity" page logged in as student1 And I follow "View my attempts" And I follow "View report" Then I should see "Please describe the novel The Hobbit" @@ -204,9 +180,7 @@ Feature: Report different types of interactions. | user | h5pactivity | attempt | interactiontype | rawscore | maxscore | duration | completion | success | | student1 | H5P package | 1 | sequencing | 2 | 2 | 1 | 1 | 1 | | student1 | H5P package | 1 | compound | 2 | 2 | 4 | 1 | 1 | - When I log in as "student1" - And I am on "Course 1" course homepage - And I follow "H5P package" + When I am on the "H5P package" "h5pactivity activity" page logged in as student1 And I follow "View my attempts" And I follow "View report" Then I should see "This interaction (sequencing) does not provide tracking information" @@ -220,9 +194,7 @@ Feature: Report different types of interactions. | user | h5pactivity | attempt | interactiontype | rawscore | maxscore | duration | completion | success | | student1 | H5P package | 1 | sequencing | 2 | 2 | 1 | 1 | 0 | | student1 | H5P package | 1 | compound | 0 | 2 | 4 | 1 | 0 | - When I log in as "student1" - And I am on "Course 1" course homepage - And I follow "H5P package" + When I am on the "H5P package" "h5pactivity activity" page logged in as student1 And I follow "View my attempts" And I follow "View report" Then I should see "This interaction (sequencing) does not provide tracking information" @@ -236,9 +208,7 @@ Feature: Report different types of interactions. | user | h5pactivity | attempt | interactiontype | rawscore | maxscore | duration | completion | success | | student1 | H5P package | 1 | other | 2 | 2 | 1 | 1 | 1 | | student1 | H5P package | 1 | compound | 2 | 2 | 4 | 1 | 1 | - When I log in as "student1" - And I am on "Course 1" course homepage - And I follow "H5P package" + When I am on the "H5P package" "h5pactivity activity" page logged in as student1 And I follow "View my attempts" And I follow "View report" Then I should see "This interaction (other) does not provide tracking information" @@ -252,9 +222,7 @@ Feature: Report different types of interactions. | user | h5pactivity | attempt | interactiontype | rawscore | maxscore | duration | completion | success | | student1 | H5P package | 1 | other | 2 | 2 | 1 | 1 | 0 | | student1 | H5P package | 1 | compound | 0 | 2 | 4 | 1 | 0 | - When I log in as "student1" - And I am on "Course 1" course homepage - And I follow "H5P package" + When I am on the "H5P package" "h5pactivity activity" page logged in as student1 And I follow "View my attempts" And I follow "View report" Then I should see "This interaction (other) does not provide tracking information" diff --git a/mod/h5pactivity/tests/behat/grading_attempts.feature b/mod/h5pactivity/tests/behat/grading_attempts.feature index a3818911ca920..48647607eb8d3 100644 --- a/mod/h5pactivity/tests/behat/grading_attempts.feature +++ b/mod/h5pactivity/tests/behat/grading_attempts.feature @@ -28,9 +28,7 @@ Feature: Change grading options in an H5P activity And I upload "h5p/tests/fixtures/multiple-choice-2-6.h5p" file to "Package file" filemanager And I click on "Save and display" "button" And I log out - And I log in as "student1" - And I am on "Course 1" course homepage - And I follow "Awesome H5P package" + And I am on the "Awesome H5P package" "h5pactivity activity" page logged in as student1 And I switch to "h5p-player" class iframe And I switch to "h5p-iframe" class iframe And I click on "Wrong one" "text" in the ".h5p-question-content" "css_element" @@ -47,12 +45,10 @@ Feature: Change grading options in an H5P activity And I click on "Check" "button" in the ".h5p-question-buttons" "css_element" And I switch to the main frame And I log out - And I log in as "teacher1" - And I am on "Course 1" course homepage - And I follow "Awesome H5P package" @javascript Scenario: Default grading is max attempt grade + Given I am on the "Awesome H5P package" "h5pactivity activity" page logged in as teacher1 When I navigate to "View > User report" in the course gradebook And I set the field "Select all or one user" to "Student 1" Then the following should exist in the "user-grade" table: @@ -61,8 +57,8 @@ Feature: Change grading options in an H5P activity @javascript Scenario: Change setting to first attempt - When I navigate to "Edit settings" in current page administration - And I set the following fields to these values: + Given I am on the "Awesome H5P package" "h5pactivity activity editing" page logged in as teacher1 + When I set the following fields to these values: | Grading method | First attempt | And I click on "Save and return to course" "button" And I navigate to "View > User report" in the course gradebook @@ -73,8 +69,8 @@ Feature: Change grading options in an H5P activity @javascript Scenario: Change setting to first attempt - When I navigate to "Edit settings" in current page administration - And I set the following fields to these values: + Given I am on the "Awesome H5P package" "h5pactivity activity editing" page logged in as teacher1 + When I set the following fields to these values: | Grading method | Last attempt | And I click on "Save and return to course" "button" And I navigate to "View > User report" in the course gradebook @@ -85,8 +81,8 @@ Feature: Change grading options in an H5P activity @javascript Scenario: Change setting to average attempt - When I navigate to "Edit settings" in current page administration - And I set the following fields to these values: + Given I am on the "Awesome H5P package" "h5pactivity activity editing" page logged in as teacher1 + When I set the following fields to these values: | Grading method | Average grade | And I click on "Save and return to course" "button" And I navigate to "View > User report" in the course gradebook @@ -97,8 +93,8 @@ Feature: Change grading options in an H5P activity @javascript Scenario: Change setting to manual grading - When I navigate to "Edit settings" in current page administration - And I set the following fields to these values: + Given I am on the "Awesome H5P package" "h5pactivity activity editing" page logged in as teacher1 + When I set the following fields to these values: | Grading method | Don't calculate a grade | And I click on "Save and return to course" "button" And I navigate to "View > User report" in the course gradebook @@ -109,8 +105,8 @@ Feature: Change grading options in an H5P activity @javascript Scenario: Disable tracking - When I navigate to "Edit settings" in current page administration - And I set the following fields to these values: + Given I am on the "Awesome H5P package" "h5pactivity activity editing" page logged in as teacher1 + When I set the following fields to these values: | Enable attempt tracking | No | And I click on "Save and return to course" "button" And I navigate to "View > User report" in the course gradebook @@ -122,8 +118,8 @@ Feature: Change grading options in an H5P activity @javascript Scenario: Reescale existing grades changing the maximum grade # First we set to average and recalculate grades. - When I navigate to "Edit settings" in current page administration - And I set the following fields to these values: + Given I am on the "Awesome H5P package" "h5pactivity activity editing" page logged in as teacher1 + When I set the following fields to these values: | Grading method | Average grade | And I click on "Save and return to course" "button" And I navigate to "View > User report" in the course gradebook @@ -133,9 +129,7 @@ Feature: Change grading options in an H5P activity | Awesome H5P package | 33.33 | 0–100 | 33.33 % | # Now we modify the maximum grade with rescaling. - When I am on "Course 1" course homepage - And I follow "Awesome H5P package" - And I navigate to "Edit settings" in current page administration + And I am on the "Awesome H5P package" "h5pactivity activity editing" page And I set the following fields to these values: | Rescale existing grades | Yes | | Maximum grade | 50 | @@ -149,8 +143,8 @@ Feature: Change grading options in an H5P activity @javascript Scenario: Change maximum grade without rescaling grade # First we set to average and recalculate grades. - When I navigate to "Edit settings" in current page administration - And I set the following fields to these values: + Given I am on the "Awesome H5P package" "h5pactivity activity editing" page logged in as teacher1 + When I set the following fields to these values: | Grading method | Average grade | And I click on "Save and return to course" "button" And I navigate to "View > User report" in the course gradebook @@ -160,9 +154,7 @@ Feature: Change grading options in an H5P activity | Awesome H5P package | 33.33 | 0–100 | 33.33 % | # Now we modify the maximum grade with rescaling. - When I am on "Course 1" course homepage - And I follow "Awesome H5P package" - And I navigate to "Edit settings" in current page administration + When I am on the "Awesome H5P package" "h5pactivity activity editing" page And I set the following fields to these values: | Rescale existing grades | No | | Maximum grade | 50 | diff --git a/mod/h5pactivity/tests/behat/h5pactivity_completion.feature b/mod/h5pactivity/tests/behat/h5pactivity_completion.feature index 891af6e223830..9787de78d108a 100644 --- a/mod/h5pactivity/tests/behat/h5pactivity_completion.feature +++ b/mod/h5pactivity/tests/behat/h5pactivity_completion.feature @@ -10,20 +10,13 @@ Feature: View activity completion information in the h5p activity | student1 | Vinnie | Student1 | student1@example.com | | teacher1 | Darrell | Teacher1 | teacher1@example.com | And the following "courses" exist: - | fullname | shortname | category | - | Course 1 | C1 | 0 | + | fullname | shortname | enablecompletion | showcompletionconditions | + | Course 1 | C1 | 1 | 1 | And the following "course enrolments" exist: | user | course | role | | student1 | C1 | student | | teacher1 | C1 | editingteacher | And I log in as "admin" - And I am on "Course 1" course homepage - And I navigate to "Edit settings" in current page administration - And I expand all fieldsets - And I set the following fields to these values: - | Enable completion tracking | Yes | - | Show activity completion conditions | Yes | - And I press "Save and display" And I am on "Course 1" course homepage with editing mode on And I add a "H5P" to section "1" And I set the following fields to these values: @@ -36,17 +29,13 @@ Feature: View activity completion information in the h5p activity And I log out Scenario: View automatic completion items - Given I log in as "teacher1" - And I am on "Course 1" course homepage + Given I am on the "Music history" "h5pactivity activity" page logged in as teacher1 # Teacher view. - And I follow "Music history" And "Music history" should have the "View" completion condition And "Music history" should have the "Receive a grade" completion condition And I log out # Student view. - When I log in as "student1" - And I am on "Course 1" course homepage - And I follow "Music history" + When I am on the "Music history" "h5pactivity activity" page logged in as student1 And I switch to "h5p-player" class iframe And I switch to "h5p-iframe" class iframe And I click on "Check" "button" in the ".h5p-question-buttons" "css_element" @@ -55,21 +44,16 @@ Feature: View activity completion information in the h5p activity And the "Receive a grade" completion condition of "Music history" is displayed as "done" Scenario: Use manual completion - Given I log in as "teacher1" - And I am on "Course 1" course homepage - And I follow "Music history" - And I navigate to "Edit settings" in current page administration + Given I am on the "Music history" "h5pactivity activity editing" page logged in as teacher1 And I expand all fieldsets And I set the field "Completion tracking" to "Students can manually mark the activity as completed" And I press "Save and display" - And I follow "Music history" # Teacher view. + And I am on the "Music history" "h5pactivity activity" page And the manual completion button for "Music history" should be disabled And I log out # Student view. - When I log in as "student1" - And I am on "Course 1" course homepage - And I follow "Music history" + When I am on the "Music history" "h5pactivity activity" page logged in as student1 Then the manual completion button of "Music history" is displayed as "Mark as done" And I toggle the manual completion state of "Music history" And the manual completion button of "Music history" is displayed as "Done" diff --git a/mod/h5pactivity/tests/behat/inline_editing_content.feature b/mod/h5pactivity/tests/behat/inline_editing_content.feature index 7dd070d1bb102..d83ee83304db1 100644 --- a/mod/h5pactivity/tests/behat/inline_editing_content.feature +++ b/mod/h5pactivity/tests/behat/inline_editing_content.feature @@ -71,21 +71,15 @@ Feature: Inline editing H5P content And I switch to the main frame And I log out # Check teacher1 can see the Edit button (because she is the author of this file in the content bank). - And I log in as "teacher1" - And I am on "Course 1" course homepage with editing mode on - And I follow "H5P package added as link to content bank" + And I am on the "H5P package added as link to content bank" "h5pactivity activity" page logged in as teacher1 And I should see "Edit H5P content" And I log out # Check teacher2 can't see the Edit button (because the file was created by the teacher1). - And I log in as "teacher2" - And I am on "Course 1" course homepage with editing mode on - When I follow "H5P package added as link to content bank" + When I am on the "H5P package added as link to content bank" "h5pactivity activity" page logged in as teacher2 Then I should not see "Edit H5P content" And I log out # Check student1 can't see the Edit button. - And I log in as "student1" - And I am on "Course 1" course homepage with editing mode on - And I follow "H5P package added as link to content bank" + And I am on the "H5P package added as link to content bank" "h5pactivity activity" page logged in as student1 And I should not see "Edit H5P content" @javascript @@ -137,21 +131,15 @@ Feature: Inline editing H5P content And I switch to the main frame And I log out # Check teacher1 can see the Edit button (because the file is a copy). - And I log in as "teacher1" - And I am on "Course 1" course homepage with editing mode on - And I follow "H5P package added as copy to content bank" + And I am on the "H5P package added as copy to content bank" "h5pactivity activity" page logged in as teacher1 And I should see "Edit H5P content" And I log out # Check teacher2 can also see the Edit button (because the file is a copy). - And I log in as "teacher2" - And I am on "Course 1" course homepage with editing mode on - When I follow "H5P package added as copy to content bank" + When I am on the "H5P package added as copy to content bank" "h5pactivity activity" page logged in as teacher2 Then I should see "Edit H5P content" And I log out # Check student1 can't see the Edit button. - And I log in as "student1" - And I am on "Course 1" course homepage with editing mode on - And I follow "H5P package added as copy to content bank" + And I am on the "H5P package added as copy to content bank" "h5pactivity activity" page logged in as student1 And I should not see "Edit H5P content" @javascript @@ -192,19 +180,13 @@ Feature: Inline editing H5P content And I switch to the main frame And I log out # Check admin can't see the Edit button (because the file belongs to teacher1). - And I log in as "admin" - And I am on "Course 1" course homepage with editing mode on - And I follow "H5P package added as private user file" + And I am on the "H5P package added as private user file" "h5pactivity activity" page logged in as admin And I should not see "Edit H5P content" And I log out # Check teacher2 can't see the Edit button (because the file belongs to teacher1). - And I log in as "teacher2" - And I am on "Course 1" course homepage with editing mode on - When I follow "H5P package added as private user file" + When I am on the "H5P package added as private user file" "h5pactivity activity" page logged in as teacher2 Then I should not see "Edit H5P content" And I log out # Check student1 can't see the Edit button. - And I log in as "student1" - And I am on "Course 1" course homepage with editing mode on - And I follow "H5P package added as private user file" + And I am on the "H5P package added as private user file" "h5pactivity activity" page logged in as student1 And I should not see "Edit H5P content" diff --git a/mod/h5pactivity/tests/behat/locking.feature b/mod/h5pactivity/tests/behat/locking.feature index bac16b6f170d2..76993aabe37bf 100644 --- a/mod/h5pactivity/tests/behat/locking.feature +++ b/mod/h5pactivity/tests/behat/locking.feature @@ -40,8 +40,7 @@ Feature: Add H5P activity context locking Scenario: Access participants report on a freeze context Given the "h5ppackage" "Activity module" is context frozen - And I am on the "C1" "Course" page logged in as "admin" - And I follow "H5P package" + And I am on the "H5P package" "h5pactivity activity" page logged in as admin When I follow "View all attempts (1 submitted)" Then I should see "Student 1" And I should see "View user attempts (1)" in the "Student 1" "table_row" @@ -50,8 +49,7 @@ Feature: Add H5P activity context locking Scenario: Access own attempts on a freeze context Given the "h5ppackage" "Activity module" is context frozen - When I am on the "C1" "Course" page logged in as "student1" - And I follow "H5P package" + And I am on the "H5P package" "h5pactivity activity" page logged in as student1 When I follow "View my attempts" And I follow "View report" Then I should see "Attempt #1: Student 1" @@ -61,8 +59,7 @@ Feature: Add H5P activity context locking Given the following "permission overrides" exist: | capability | permission | role | contextlevel | reference | | mod/h5pactivity:submit | Prohibit | student | System | | - And I am on the "C1" "Course" page logged in as "admin" - And I follow "H5P package" + And I am on the "H5P package" "h5pactivity activity" page logged in as admin When I follow "View all attempts (1 submitted)" Then I should see "Student 1" And I should see "View user attempts (1)" in the "Student 1" "table_row" @@ -73,8 +70,7 @@ Feature: Add H5P activity context locking Given the following "permission overrides" exist: | capability | permission | role | contextlevel | reference | | mod/h5pactivity:view | Prohibit | student | System | | - When I am on the "C1" "Course" page logged in as "admin" - And I follow "H5P package" + And I am on the "H5P package" "h5pactivity activity" page logged in as admin When I follow "View all attempts (0 submitted)" Then I should see "No participants to display" @@ -83,8 +79,7 @@ Feature: Add H5P activity context locking | capability | permission | role | contextlevel | reference | | mod/h5pactivity:submit | Prohibit | student | System | | | mod/h5pactivity:view | Prohibit | student | System | | - When I am on the "C1" "Course" page logged in as "admin" - And I follow "H5P package" + And I am on the "H5P package" "h5pactivity activity" page logged in as admin When I follow "View all attempts (0 submitted)" Then I should see "No participants to display" @@ -92,7 +87,7 @@ Feature: Add H5P activity context locking Given I log in as "admin" And I am on "Course 1" course homepage with editing mode on And I click on "Hide" "link" in the "H5P package" activity - When I follow "H5P package" + When I am on the "H5P package" "h5pactivity activity" page And I follow "View all attempts (1 submitted)" Then I should see "Student 1" And I should see "View user attempts (1)" diff --git a/mod/h5pactivity/tests/behat/recent_activity.feature b/mod/h5pactivity/tests/behat/recent_activity.feature index 05b44268375f3..e53ca2844ad42 100644 --- a/mod/h5pactivity/tests/behat/recent_activity.feature +++ b/mod/h5pactivity/tests/behat/recent_activity.feature @@ -31,18 +31,14 @@ Feature: Users can see the H5P recent activity from the recent activity block And I click on "Save and return to course" "button" And I add the "Recent activity" block And I log out - And I log in as "student1" - And I am on "Course 1" course homepage - And I follow "Awesome H5P package" + And I am on the "Awesome H5P package" "h5pactivity activity" page logged in as student1 And I switch to "h5p-player" class iframe And I switch to "h5p-iframe" class iframe And I click on "Wrong one" "text" in the ".h5p-question-content" "css_element" And I click on "Check" "button" in the ".h5p-question-buttons" "css_element" And I switch to the main frame And I log out - And I log in as "student2" - And I am on "Course 1" course homepage - And I follow "Awesome H5P package" + And I am on the "Awesome H5P package" "h5pactivity activity" page logged in as student2 And I switch to "h5p-player" class iframe And I switch to "h5p-iframe" class iframe And I click on "Correct one" "text" in the ".h5p-question-content" "css_element" @@ -52,8 +48,7 @@ Feature: Users can see the H5P recent activity from the recent activity block @javascript Scenario: Student see only his own activity - Given I log in as "student1" - And I am on "Course 1" course homepage + Given I am on the "Course 1" course page logged in as student1 And I should see "H5P submitted:" in the "Recent activity" "block" And I should see "Student 1" in the "Recent activity" "block" And I should not see "Grade:" in the "Recent activity" "block" @@ -66,8 +61,7 @@ Feature: Users can see the H5P recent activity from the recent activity block @javascript Scenario: Teacher see each student activity - Given I log in as "teacher1" - And I am on "Course 1" course homepage + Given I am on the "Course 1" course page logged in as teacher1 And I should see "H5P submitted:" in the "Recent activity" "block" And I should see "Student 1" in the "Recent activity" "block" And I should not see "Grade:" in the "Recent activity" "block" diff --git a/mod/h5pactivity/tests/behat/result_fillin.feature b/mod/h5pactivity/tests/behat/result_fillin.feature index 24c3e6fee2f84..bfba4c0ba5f72 100644 --- a/mod/h5pactivity/tests/behat/result_fillin.feature +++ b/mod/h5pactivity/tests/behat/result_fillin.feature @@ -29,10 +29,8 @@ Feature: View fill the blanks attempt report And I log out Scenario: View attempt in a fill the blanks content + Given I am on the "Awesome H5P package" "h5pactivity activity" page logged in as student1 # Do an attempt. - Given I log in as "student1" - And I am on "Course 1" course homepage - And I follow "Awesome H5P package" And I switch to "h5p-player" class iframe And I switch to "h5p-iframe" class iframe And I set the field with xpath "//input[contains(@aria-label,\"Blank input 1 of 4\")]" to "Brigadoon" diff --git a/mod/h5pactivity/tests/behat/result_longfillin.feature b/mod/h5pactivity/tests/behat/result_longfillin.feature index 8bf89bddcf994..de37562accede 100644 --- a/mod/h5pactivity/tests/behat/result_longfillin.feature +++ b/mod/h5pactivity/tests/behat/result_longfillin.feature @@ -30,9 +30,7 @@ Feature: View essay attempt report Scenario: View attempt essay content # Do an attempt. - Given I log in as "student1" - And I am on "Course 1" course homepage - And I follow "Awesome H5P package" + Given I am on the "Awesome H5P package" "h5pactivity activity" page logged in as student1 And I change window size to "large" And I switch to "h5p-player" class iframe And I switch to "h5p-iframe" class iframe diff --git a/mod/h5pactivity/tests/behat/sending_attempt.feature b/mod/h5pactivity/tests/behat/sending_attempt.feature index 929c77b9b4f25..37ce18ac5f6f7 100644 --- a/mod/h5pactivity/tests/behat/sending_attempt.feature +++ b/mod/h5pactivity/tests/behat/sending_attempt.feature @@ -37,9 +37,7 @@ Feature: Do a H5P attempt Scenario: To an attempts and check on course log report When I click on "Save and return to course" "button" And I log out - And I log in as "student1" - And I am on "Course 1" course homepage - And I follow "Awesome H5P package" + Given I am on the "Awesome H5P package" "h5pactivity activity" page logged in as student1 And I wait until the page is ready And I should not see "This content is displayed in preview mode" And I switch to "h5p-player" class iframe @@ -48,8 +46,7 @@ Feature: Do a H5P attempt And I click on "Check" "button" in the ".h5p-question-buttons" "css_element" And I switch to the main frame 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 I navigate to course participants And I follow "Student 1" Then I follow "Today's logs" diff --git a/mod/imscp/tests/behat/display_imscp_description.feature b/mod/imscp/tests/behat/display_imscp_description.feature index 8046f2a7c4fdd..929821b782752 100644 --- a/mod/imscp/tests/behat/display_imscp_description.feature +++ b/mod/imscp/tests/behat/display_imscp_description.feature @@ -25,9 +25,7 @@ Feature: Display the IMS content package description in the IMSCP and optionally | Description | Test IMS content package description | And I upload "mod/imscp/tests/packages/singlescobasic.zip" file to "Package file" filemanager And I click on "Save and display" "button" - And I am on "Course 1" course homepage - And I should see "Test IMS content package" - When I follow "Test IMS content package" + When I am on the "Test IMS content package" "imscp activity" page Then I should see "Test IMS content package description" @javascript @_file_upload @@ -40,9 +38,7 @@ Feature: Display the IMS content package description in the IMSCP and optionally | Description | Test IMS content package description | And I upload "mod/imscp/tests/packages/singlescobasic.zip" file to "Package file" filemanager And I click on "Save and display" "button" - And I am on "Course 1" course homepage - And I follow "Test IMS content package" - And I navigate to "Edit settings" in current page administration + When I am on the "Test IMS content package" "imscp activity editing" page And the following fields match these values: | Display description on course page | | And I set the following fields to these values: @@ -61,9 +57,7 @@ Feature: Display the IMS content package description in the IMSCP and optionally | Description | Test IMS content package description | And I upload "mod/imscp/tests/packages/singlescobasic.zip" file to "Package file" filemanager And I click on "Save and display" "button" - And I am on "Course 1" course homepage - And I follow "Test IMS content package" - And I navigate to "Edit settings" in current page administration + When I am on the "Test IMS content package" "imscp 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/imscp/tests/behat/imscp_activity_completion.feature b/mod/imscp/tests/behat/imscp_activity_completion.feature index 452ed55b4cbae..ece52d2f66b01 100644 --- a/mod/imscp/tests/behat/imscp_activity_completion.feature +++ b/mod/imscp/tests/behat/imscp_activity_completion.feature @@ -10,21 +10,12 @@ Feature: View activity completion information in the IMS content package activit | student1 | Vinnie | Student1 | student1@example.com | | teacher1 | Darrell | Teacher1 | teacher1@example.com | And the following "courses" exist: - | fullname | shortname | category | - | Course 1 | C1 | 0 | + | fullname | shortname | category | enablecompletion | showcompletionconditions | + | Course 1 | C1 | 0 | 1 | 1 | And the following "course enrolments" exist: | user | course | role | | student1 | C1 | student | | teacher1 | C1 | editingteacher | - And I log in as "teacher1" - And I am on "Course 1" course homepage - And I navigate to "Edit settings" in current page administration - And I expand all fieldsets - And I set the following fields to these values: - | Enable completion tracking | Yes | - | Show activity completion conditions | Yes | - And I press "Save and display" - And I log out Scenario: View automatic completion items Given I log in as "teacher1" @@ -38,13 +29,10 @@ Feature: View activity completion information in the IMS content package activit And I click on "Save and display" "button" And I am on "Course 1" course homepage # Teacher view. - And I follow "Music history" - And "Music history" should have the "View" completion condition + And I am on the "Music history" "imscp activity" page And I log out # Student view. - When I log in as "student1" - And I am on "Course 1" course homepage - And I follow "Music history" + When I am on the "Music history" "imscp activity" page logged in as student1 Then the "View" completion condition of "Music history" is displayed as "done" Scenario: Use manual completion @@ -56,14 +44,12 @@ Feature: View activity completion information in the IMS content package activit | Completion tracking | Students can manually mark the activity as completed | And I upload "mod/imscp/tests/packages/singlescobasic.zip" file to "Package file" filemanager And I click on "Save and display" "button" - And I follow "Music history" + And I am on the "Music history" "imscp activity" page # Teacher view. And the manual completion button for "Music history" should be disabled And I log out # Student view. - When I log in as "student1" - And I am on "Course 1" course homepage - And I follow "Music history" + When I am on the "Music history" "imscp activity" page logged in as student1 Then the manual completion button of "Music history" is displayed as "Mark as done" And I toggle the manual completion state of "Music history" And the manual completion button of "Music history" is displayed as "Done" diff --git a/mod/lesson/tests/behat/duplicate_lesson_page.feature b/mod/lesson/tests/behat/duplicate_lesson_page.feature index c822eb3c48ef4..56887dc1b7f4c 100644 --- a/mod/lesson/tests/behat/duplicate_lesson_page.feature +++ b/mod/lesson/tests/behat/duplicate_lesson_page.feature @@ -16,18 +16,18 @@ Feature: In a lesson activity, a teacher can duplicate a lesson page | user | course | role | | teacher1 | C1 | editingteacher | | student1 | C1 | student | + And the following "activity" exists: + | course | C1 | + | activity | lesson | + | name | Test lesson name | And I log in as "teacher1" And I follow "Manage private files" And I upload "mod/lesson/tests/fixtures/moodle_logo.jpg" file to "Files" filemanager And I click on "Save changes" "button" - When 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 | @javascript @_file_upload Scenario: Duplicate content page with an image. - Given 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 | @@ -57,7 +57,7 @@ Feature: In a lesson activity, a teacher can duplicate a lesson page @javascript @_file_upload Scenario: Duplicate question page with image in answer. - Given I follow "Test lesson name" + Given 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" @@ -94,7 +94,7 @@ Feature: In a lesson activity, a teacher can duplicate a lesson page @javascript @_file_upload Scenario: Duplicate question page with image in feedback. - Given I follow "Test lesson name" + Given 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" diff --git a/mod/lesson/tests/behat/import_fillintheblank_question.feature b/mod/lesson/tests/behat/import_fillintheblank_question.feature index 70323b489caea..eaf2e7d60ad69 100644 --- a/mod/lesson/tests/behat/import_fillintheblank_question.feature +++ b/mod/lesson/tests/behat/import_fillintheblank_question.feature @@ -16,12 +16,11 @@ Feature: In a lesson activity, teacher can import blackboard fill in the blank q | user | course | role | | teacher1 | C1 | editingteacher | | student1 | C1 | student | - And I log in as "teacher1" - When 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 "activity" exists: + | course | C1 | + | activity | lesson | + | name | Test lesson name | + When I am on the "Test lesson name" "lesson activity" page logged in as teacher1 And I follow "Import questions" And I set the field "File format" to "Blackboard" And I upload "mod/lesson/tests/fixtures/sample_blackboard_fib_qti.dat" file to "Upload" filemanager diff --git a/mod/lesson/tests/behat/import_images.feature b/mod/lesson/tests/behat/import_images.feature index 88adddcbdc855..8056e0ba9954e 100644 --- a/mod/lesson/tests/behat/import_images.feature +++ b/mod/lesson/tests/behat/import_images.feature @@ -16,12 +16,11 @@ Feature: In a lesson activity, teacher can import embedded images in questions a | user | course | role | | teacher1 | C1 | editingteacher | | student1 | C1 | student | - And I log in as "teacher1" - When 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 "activity" exists: + | course | C1 | + | activity | lesson | + | name | Test lesson name | + When I am on the "Test lesson name" "lesson activity" page logged in as teacher1 And I follow "Import questions" And I set the field "File format" to "Moodle XML format" And I upload "mod/lesson/tests/fixtures/multichoice.xml" file to "Upload" filemanager diff --git a/mod/lesson/tests/behat/lesson_activity_completion.feature b/mod/lesson/tests/behat/lesson_activity_completion.feature index 19eb4a3480cba..6747e18469e29 100644 --- a/mod/lesson/tests/behat/lesson_activity_completion.feature +++ b/mod/lesson/tests/behat/lesson_activity_completion.feature @@ -10,20 +10,12 @@ Feature: View activity completion in the lesson activity | student1 | Vinnie | Student1 | student1@example.com | | teacher1 | Darrell | Teacher1 | teacher1@example.com | And the following "courses" exist: - | fullname | shortname | category | - | Course 1 | C1 | 0 | + | fullname | shortname | enablecompletion | showcompletionconditions | + | Course 1 | C1 | 1 | 1 | And the following "course enrolments" exist: | user | course | role | | student1 | C1 | student | | teacher1 | C1 | editingteacher | - And I log in as "teacher1" - And I am on "Course 1" course homepage - And I navigate to "Edit settings" in current page administration - And I expand all fieldsets - And I set the following fields to these values: - | Enable completion tracking | Yes | - | Show activity completion conditions | Yes | - And I press "Save and display" And the following "activity" exists: | activity | lesson | | course | C1 | @@ -36,8 +28,7 @@ Feature: View activity completion in the lesson activity | completionendreached | 1 | | completiontimespentenabled | 1 | | completiontimespent | 1 | - And I am on "Course 1" course homepage - And I follow "Music history" + And I am on the "Music history" "lesson activity" page logged in as teacher1 And I follow "Add a content page" And I set the following fields to these values: | Page title | Music history part 1 | @@ -56,24 +47,19 @@ Feature: View activity completion in the lesson activity And I log out Scenario: View automatic completion items as a teacher - Given I log in as "teacher1" - And I am on "Course 1" course homepage - When I follow "Music history" + When I am on the "Music history" "lesson activity" page logged in as teacher1 Then "Music history" should have the "View" completion condition And "Music history" should have the "Spend at least 1 sec on this activity" completion condition And "Music history" should have the "Go through the activity to the end" completion condition And "Music history" should have the "Receive a grade" completion condition Scenario: View automatic completion items as a student - Given I log in as "student1" - And I am on "Course 1" course homepage - And I follow "Music history" + Given I am on the "Music history" "lesson activity" page logged in as student1 And the "View" completion condition of "Music history" is displayed as "done" And the "Spend at least 1 sec on this activity" completion condition of "Music history" is displayed as "todo" And the "Go through the activity to the end" completion condition of "Music history" is displayed as "todo" And the "Receive a grade" completion condition of "Music history" is displayed as "todo" - When I am on "Course 1" course homepage - And I follow "Music history" + When I am on the "Music history" "lesson activity" page And I wait "2" seconds And I reload the page And the "View" completion condition of "Music history" is displayed as "done" @@ -90,10 +76,7 @@ Feature: View activity completion in the lesson activity @javascript Scenario: Use manual completion - Given I log in as "teacher1" - And I am on "Course 1" course homepage - And I follow "Music history" - And I navigate to "Edit settings" in current page administration + Given I am on the "Music history" "lesson activity editing" page logged in as teacher1 And I expand all fieldsets And I set the field "Completion tracking" to "Students can manually mark the activity as completed" And I press "Save and display" @@ -101,9 +84,7 @@ Feature: View activity completion in the lesson activity And the manual completion button for "Music history" should be disabled And I log out # Student view. - When I log in as "student1" - And I am on "Course 1" course homepage - And I follow "Music history" + When I am on the "Music history" "lesson activity" page logged in as student1 Then the manual completion button of "Music history" is displayed as "Mark as done" And I toggle the manual completion state of "Music history" And the manual completion button of "Music history" is displayed as "Done" diff --git a/mod/lesson/tests/behat/lesson_course_reset.feature b/mod/lesson/tests/behat/lesson_course_reset.feature index 59d70b3dc530d..15e8df34356f7 100644 --- a/mod/lesson/tests/behat/lesson_course_reset.feature +++ b/mod/lesson/tests/behat/lesson_course_reset.feature @@ -25,9 +25,7 @@ Feature: Lesson reset And the following "activities" exist: | activity | name | intro | course | idnumber | | lesson | Test lesson name | Test lesson description | C1 | lesson1 | - And I log in as "teacher1" - And I am on "Course 1" course homepage with editing mode on - And I follow "Test lesson name" + And I am on the "Test lesson name" "lesson activity" page logged in as teacher1 And I follow "Add a question page" And I set the field "Select a question type" to "True/false" And I press "Add a question page" @@ -44,9 +42,7 @@ Feature: Lesson reset Scenario: Use course reset to clear all attempt data When 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 | @@ -54,9 +50,7 @@ Feature: Lesson reset And I press "Continue" And I should see "Congratulations - end of lesson reached" 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 navigate to "Reports > Overview" in current page administration And I should see "Sam1 Student1" And I am on "Course 1" course homepage @@ -65,14 +59,13 @@ Feature: Lesson reset | Delete all lesson attempts | 1 | And I press "Reset course" And I press "Continue" - And I am on "Course 1" course homepage - And I follow "Test lesson name" + And I am on the "Test lesson name" "lesson activity" page And I navigate to "Reports > Overview" in current page administration Then I should see "No attempts have been made on this lesson" @javascript Scenario: Use course reset to remove user overrides. - When I follow "Test lesson name" + When I am on the "Test lesson name" "lesson activity" page And I navigate to "User overrides" in current page administration And I press "Add user override" And I set the following fields to these values: @@ -86,13 +79,12 @@ Feature: Lesson reset | Delete all user overrides | 1 | And I press "Reset course" And I press "Continue" - And I am on "Course 1" course homepage - And I follow "Test lesson name" + And I am on the "Test lesson name" "lesson activity" page And I navigate to "User overrides" in current page administration Then I should not see "Sam1 Student1" Scenario: Use course reset to remove group overrides. - When I follow "Test lesson name" + When I am on the "Test lesson name" "lesson activity" page And I navigate to "Group overrides" in current page administration And I press "Add group override" And I set the following fields to these values: @@ -106,7 +98,6 @@ Feature: Lesson reset | Delete all group overrides | 1 | And I press "Reset course" And I press "Continue" - And I am on "Course 1" course homepage - And I follow "Test lesson name" + And I am on the "Test lesson name" "lesson activity" page And I navigate to "Group overrides" in current page administration Then I should not see "Group 1" diff --git a/mod/lesson/tests/behat/lesson_group_override.feature b/mod/lesson/tests/behat/lesson_group_override.feature index 970bd77505912..3327b13426829 100644 --- a/mod/lesson/tests/behat/lesson_group_override.feature +++ b/mod/lesson/tests/behat/lesson_group_override.feature @@ -32,9 +32,7 @@ Feature: Lesson group override And the following "activities" exist: | activity | name | intro | groupmode | course | idnumber | | lesson | Test lesson name | Test lesson description | 1 | C1 | lesson1 | - And I log in as "teacher1" - And I am on "Course 1" course homepage with editing mode on - And I follow "Test lesson name" + And I am on the "Test lesson name" "lesson activity" page logged in as teacher1 And I follow "Add a question page" And I set the field "Select a question type" to "True/false" And I press "Add a question page" @@ -51,9 +49,7 @@ Feature: Lesson group override And I log out Scenario: Add, modify then delete a group override - Given I log in as "teacher1" - And I am on "Course 1" course homepage with editing mode on - When I follow "Test lesson name" + Given I am on the "Test lesson name" "lesson activity" page logged in as teacher1 And I navigate to "Group overrides" in current page administration And I press "Add group override" And I set the following fields to these values: @@ -76,9 +72,7 @@ Feature: Lesson group override And I should not see "Group 1" Scenario: Duplicate a user override - Given I log in as "teacher1" - And I am on "Course 1" course homepage with editing mode on - When I follow "Test lesson name" + Given I am on the "Test lesson name" "lesson activity" page logged in as teacher1 And I navigate to "Group overrides" in current page administration And I press "Add group override" And I set the following fields to these values: @@ -100,10 +94,7 @@ Feature: Lesson group override And I should see "Group 2" Scenario: Allow a single group to have re-take the lesson - Given I log in as "teacher1" - And I am on "Course 1" course homepage with editing mode on - When 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 logged in as teacher1 And I set the following fields to these values: | Re-takes allowed | 0 | And I press "Save and display" @@ -115,36 +106,29 @@ Feature: Lesson group override And I press "Save" And I should see "Re-takes allowed" And I log out - And 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 "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 follow "Test lesson name" + 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 - And I log in as "student2" - 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 student2 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 follow "Test lesson name" + And I am on the "Test lesson name" "lesson activity" page And I should see "You are not allowed to retake this lesson." Scenario: Allow a single group to have a different password - Given I log in as "teacher1" - And I am on "Course 1" course homepage with editing mode on - When 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 logged in as teacher1 And I set the following fields to these values: | Password protected lesson | Yes | | id_password | moodle_rules | @@ -157,9 +141,7 @@ Feature: Lesson group override And I press "Save" And I should see "Password protected 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 Then I should see "Test lesson name is a password protected lesson" And I should not see "Cat is an amphibian" And I set the field "userpassword" to "moodle_rules" @@ -175,9 +157,7 @@ Feature: Lesson group override And I press "Continue" And I should see "Congratulations - end of lesson reached" 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 "Test lesson name is a password protected lesson" And I should not see "Cat is an amphibian" And I set the field "userpassword" to "12345" @@ -188,10 +168,7 @@ Feature: Lesson group override And I press "Continue" Scenario: Allow a group to have a different due date - Given I log in as "teacher1" - And I am on "Course 1" course homepage with editing mode on - When 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 logged in as teacher1 And I set the following fields to these values: | id_deadline_enabled | 1 | | deadline[day] | 1 | @@ -213,22 +190,15 @@ Feature: Lesson group override And I press "Save" And I should see "Lesson closes" 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 Then the activity date in "Test lesson name" should contain "Closed: Saturday, 1 January 2000, 8:00" And I should not see "Cat is an amphibian" And I log out - And I 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" Scenario: Allow a group to have a different start date - Given I log in as "teacher1" - And I am on "Course 1" course homepage with editing mode on - When 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 logged in as teacher1 And I set the following fields to these values: | id_available_enabled | 1 | | available[day] | 1 | @@ -250,22 +220,15 @@ Feature: Lesson group override And I press "Save" And I should see "Lesson opens" 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 Then the activity date in "Test lesson name" should contain "Opens: Tuesday, 1 January 2030, 8:00" And I should not see "Cat is an amphibian" And I log out - And I 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" Scenario: Allow a single group to have multiple attempts at each question - Given I log in as "teacher1" - And I am on "Course 1" course homepage with editing mode on - When 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 logged in as teacher1 And I set the following fields to these values: | Re-takes allowed | 1 | And I press "Save and display" @@ -277,9 +240,7 @@ Feature: Lesson group override And I press "Save" And I should see "Maximum number of attempts per question" 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: | True | 1 | @@ -292,9 +253,7 @@ Feature: Lesson group override And I press "Continue" And I should see "Congratulations - end of lesson reached" 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 | @@ -304,11 +263,8 @@ Feature: Lesson group override @javascript Scenario: Add both a user and group override and verify that both are applied correctly - Given I log in as "teacher1" - And I am on "Course 1" course homepage with editing mode on - When I follow "Test lesson name" - And I navigate to "Edit settings" in current page administration - And I set the following fields to these values: + Given I am on the "Test lesson name" "lesson activity editing" page logged in as teacher1 + When I set the following fields to these values: | id_available_enabled | 1 | | available[day] | 1 | | available[month] | January | @@ -316,7 +272,7 @@ Feature: Lesson group override | available[hour] | 08 | | available[minute] | 00 | And I press "Save and display" - And I follow "Test lesson name" + And I am on the "Test lesson name" "lesson activity" page And I navigate to "Group overrides" in current page administration And I press "Add group override" And I set the following fields to these values: @@ -329,7 +285,7 @@ Feature: Lesson group override | available[minute] | 00 | And I press "Save" And I should see "Tuesday, 1 January 2030, 8:00" - And I follow "Test lesson name" + And I am on the "Test lesson name" "lesson activity" page And I navigate to "User overrides" in current page administration And I press "Add user override" And I set the following fields to these values: @@ -343,19 +299,13 @@ Feature: Lesson group override And I press "Save" And I should see "Wednesday, 1 January 2031, 8:00" And I log out - Then 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 the activity date in "Test lesson name" should contain "Opens: Wednesday, 1 January 2031, 8:00" 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 the activity date in "Test lesson name" should contain "Opens: Sunday, 1 January 2040, 8:00" And I log out - And I log in as "student3" - 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 student3 And the activity date in "Test lesson name" should contain "Opens: Tuesday, 1 January 2030, 8:00" Scenario: Override a group when teacher is in no group, and does not have accessallgroups permission, and the activity's group mode is 'separate groups' @@ -365,9 +315,7 @@ Feature: Lesson group override And the following "activities" exist: | activity | name | intro | course | idnumber | groupmode | | lesson | Lesson 2 | Lesson 2 description | C1 | lesson2 | 1 | - When I log in as "teacher1" - And I am on "Course 1" course homepage - And I follow "Lesson 2" + When 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 "No groups you can access." And the "Add group override" "button" should be disabled @@ -382,9 +330,7 @@ Feature: Lesson group override And the following "group members" exist: | user | group | | teacher1 | G1 | - When I log in as "teacher1" - And I am on "Course 1" course homepage - And I follow "Lesson 2" + And I am on the "Lesson 2" "lesson activity" page logged in as teacher1 And I navigate to "Group overrides" in current page administration And I press "Add group override" Then the "Override group" select box should contain "Group 1" @@ -400,9 +346,7 @@ Feature: Lesson group override And the following "group members" exist: | user | group | | teacher1 | G1 | - And I log in as "admin" - And I am on "Course 1" course homepage - And I follow "Lesson 2" + And I am on the "Lesson 2" "lesson activity" page logged in as admin And I navigate to "Group overrides" in current page administration And I press "Add group override" And I set the following fields to these values: @@ -424,9 +368,7 @@ Feature: Lesson group override | available[minute] | 00 | And I press "Save" And I log out - When I log in as "teacher1" - And I am on "Course 1" course homepage - And I follow "Lesson 2" + 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" And I should not see "Group 2" in the ".generaltable" "css_element" diff --git a/mod/lesson/tests/behat/lesson_question_attempts.feature b/mod/lesson/tests/behat/lesson_question_attempts.feature index a98ab003593b7..602eae7b14585 100644 --- a/mod/lesson/tests/behat/lesson_question_attempts.feature +++ b/mod/lesson/tests/behat/lesson_question_attempts.feature @@ -24,9 +24,7 @@ Feature: In a lesson activity, students can not re-attempt a question more than | retake | 1 | | minquestions | 3 | | section | 1 | - And I log in as "teacher1" - And I am on "Course 1" course homepage with editing mode on - And I follow "Test lesson name" + And I am on the "Test lesson name" "lesson activity" page logged in as teacher1 And I follow "Add a content page" And I set the following fields to these values: | Page title | First page name | @@ -94,9 +92,7 @@ Feature: In a lesson activity, students can not re-attempt a question more than 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 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 "First page contents" And I press "Next page" And I should see "The earth is round" @@ -104,8 +100,7 @@ Feature: In a lesson activity, students can not re-attempt a question more than | False| 1 | And I press "Submit" And I should see "Wrong" - And I am on "Course 1" course homepage - And I follow "Test lesson name" + And I am on the "Test lesson name" "lesson activity" page And I should see "Do you want to start at the last page you saw?" And I click on "No" "link" in the "#page-content" "css_element" And I should see "First page contents" @@ -118,9 +113,7 @@ Feature: In a lesson activity, students can not re-attempt a question more than @javascript @_bug_phantomjs Scenario: Check that we can not click back on the browser at the last quiz result page and re-attempt the last question to get full marks - 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 "First page contents" And I press "Next page" And I should see "The earth is round" @@ -162,9 +155,7 @@ Feature: In a lesson activity, students can not re-attempt a question more than @javascript Scenario: Check that we can not click back on the browser and re-attempt a question - 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 "First page contents" And I press "Next page" And I should see "The earth is round" diff --git a/mod/lesson/tests/behat/lesson_user_override.feature b/mod/lesson/tests/behat/lesson_user_override.feature index 6251c4693694f..9823c88117a7d 100644 --- a/mod/lesson/tests/behat/lesson_user_override.feature +++ b/mod/lesson/tests/behat/lesson_user_override.feature @@ -21,9 +21,7 @@ Feature: Lesson user override And the following "activities" exist: | activity | name | intro | course | idnumber | | lesson | Test lesson name | Test lesson description | C1 | lesson1 | - And I log in as "teacher1" - And I am on "Course 1" course homepage with editing mode on - And I follow "Test lesson name" + And I am on the "Test lesson name" "lesson activity" page logged in as teacher1 And I follow "Add a question page" And I set the field "Select a question type" to "True/false" And I press "Add a question page" @@ -41,9 +39,7 @@ Feature: Lesson user override @javascript Scenario: Add, modify then delete a user override - Given I log in as "teacher1" - And I am on "Course 1" course homepage with editing mode on - When I follow "Test lesson name" + Given I am on the "Test lesson name" "lesson activity" page logged in as teacher1 And I navigate to "User overrides" in current page administration And I press "Add user override" And I set the following fields to these values: @@ -67,9 +63,7 @@ Feature: Lesson user override @javascript Scenario: Duplicate a user override - Given I log in as "teacher1" - And I am on "Course 1" course homepage with editing mode on - When I follow "Test lesson name" + Given I am on the "Test lesson name" "lesson activity" page logged in as teacher1 And I navigate to "User overrides" in current page administration And I press "Add user override" And I set the following fields to these values: @@ -92,10 +86,7 @@ Feature: Lesson user override @javascript Scenario: Allow a single user to have re-take the lesson - Given I log in as "teacher1" - And I am on "Course 1" course homepage with editing mode on - When 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 logged in as teacher1 And I set the following fields to these values: | Re-takes allowed | 0 | And I press "Save and display" @@ -107,37 +98,30 @@ Feature: Lesson user override And I press "Save" And I should see "Re-takes allowed" 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 should see "Congratulations - end of lesson reached" - And I follow "Test lesson name" + 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 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: | False | 1 | And I press "Submit" And I press "Continue" And I should see "Congratulations - end of lesson reached" - And I follow "Test lesson name" + And I am on the "Test lesson name" "lesson activity" page And I should see "You are not allowed to retake this lesson." @javascript Scenario: Allow a single user to have a different password - Given I log in as "teacher1" - And I am on "Course 1" course homepage with editing mode on - When 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 logged in as teacher1 And I set the following fields to these values: | Password protected lesson | Yes | | id_password | moodle_rules | @@ -150,9 +134,7 @@ Feature: Lesson user override And I press "Save" And I should see "Password protected 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 Then I should see "Test lesson name is a password protected lesson" And I should not see "Cat is an amphibian" And I set the field "userpassword" to "moodle_rules" @@ -168,9 +150,7 @@ Feature: Lesson user override And I press "Continue" And I should see "Congratulations - end of lesson reached" 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 "Test lesson name is a password protected lesson" And I should not see "Cat is an amphibian" And I set the field "userpassword" to "12345" @@ -182,10 +162,7 @@ Feature: Lesson user override @javascript Scenario: Allow a user to have a different due date - Given I log in as "teacher1" - And I am on "Course 1" course homepage with editing mode on - When 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 logged in as teacher1 And I set the following fields to these values: | id_deadline_enabled | 1 | | deadline[day] | 1 | @@ -207,24 +184,17 @@ Feature: Lesson user override And I press "Save" And I should see "Lesson closes" 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 wait until the page is ready Then the activity date in "Test lesson name" should contain "Closed: Saturday, 1 January 2000, 8:00" And I should not see "Cat is an amphibian" And I log out - And I 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" @javascript Scenario: Allow a user to have a different start date - Given I log in as "teacher1" - And I am on "Course 1" course homepage with editing mode on - When 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 logged in as teacher1 And I set the following fields to these values: | id_available_enabled | 1 | | available[day] | 1 | @@ -246,24 +216,17 @@ Feature: Lesson user override And I press "Save" And I should see "Lesson opens" 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 wait until the page is ready Then the activity date in "Test lesson name" should contain "Opens: Tuesday, 1 January 2030, 8:00" And I should not see "Cat is an amphibian" And I log out - And I 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" @javascript Scenario: Allow a single user to have multiple attempts at each question - Given I log in as "teacher1" - And I am on "Course 1" course homepage with editing mode on - When 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 logged in as teacher1 And I set the following fields to these values: | Re-takes allowed | 1 | And I press "Save and display" @@ -275,9 +238,7 @@ Feature: Lesson user override And I press "Save" And I should see "Maximum number of attempts per question" 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: | True | 1 | @@ -290,9 +251,7 @@ Feature: Lesson user override And I press "Continue" And I should see "Congratulations - end of lesson reached" 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 | @@ -307,9 +266,7 @@ Feature: Lesson user override And the following "activities" exist: | activity | name | intro | course | idnumber | groupmode | | lesson | Lesson 2 | Lesson 2 description | C1 | lesson2 | 1 | - When I log in as "teacher1" - And I am on "Course 1" course homepage - And I follow "Lesson 2" + 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." And the "Add user override" "button" should be disabled @@ -330,9 +287,7 @@ Feature: Lesson user override | teacher1 | G1 | | student1 | G1 | | student2 | G2 | - When I log in as "teacher1" - And I am on "Course 1" course homepage - And I follow "Lesson 2" + When I am on the "Lesson 2" "lesson activity" page logged in as teacher1 And I navigate to "User overrides" in current page administration And I press "Add user override" Then the "Override user" select box should contain "Sam1 Student1, student1@example.com" @@ -355,9 +310,7 @@ Feature: Lesson user override | teacher1 | G1 | | student1 | G1 | | student2 | G2 | - And I log in as "admin" - And I am on "Course 1" course homepage - And I follow "Lesson 2" + And I am on the "Lesson 2" "lesson activity" page logged in as admin And I navigate to "User overrides" in current page administration And I press "Add user override" And I set the following fields to these values: @@ -379,19 +332,14 @@ Feature: Lesson user override | deadline[minute] | 00 | And I press "Save" And I log out - When I log in as "teacher1" - And I am on "Course 1" course homepage - And I follow "Lesson 2" + 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" And I should not see "Student2" in the ".generaltable" "css_element" @javascript Scenario: Create a user override when the lesson is not available to the student - Given 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 + Given I am on the "Test lesson name" "lesson activity editing" page logged in as teacher1 And I expand all fieldsets And I set the field "Availability" to "Hide from students" And I click on "Save and display" "button" diff --git a/mod/lesson/tests/behat/questions_images.feature b/mod/lesson/tests/behat/questions_images.feature index 1fbd8c8037846..ee45b3ec37204 100644 --- a/mod/lesson/tests/behat/questions_images.feature +++ b/mod/lesson/tests/behat/questions_images.feature @@ -16,15 +16,15 @@ Feature: In a lesson activity, teacher can add embedded images in questions answ | user | course | role | | teacher1 | C1 | editingteacher | | student1 | C1 | student | + And the following "activity" exists: + | course | C1 | + | activity | lesson | + | name | Test lesson name | And I log in as "teacher1" And I follow "Manage private files" And I upload "mod/lesson/tests/fixtures/moodle_logo.jpg" file to "Files" filemanager And I click on "Save changes" "button" - When 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" + When 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 "Multichoice" And I press "Add a question page" @@ -76,9 +76,7 @@ Feature: In a lesson activity, teacher can add embedded images in questions answ And I click on "Save image" "button" 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 "What animal is an amphibian?" And "//*[contains(@class, 'answeroption')]//img[contains(@src, 'pluginfile.php')]" "xpath_element" should exist And "//*[contains(@class, 'answeroption')]//img[contains(@src, 'moodle_logo.jpg')]" "xpath_element" should exist diff --git a/mod/lesson/tests/behat/time_limit.feature b/mod/lesson/tests/behat/time_limit.feature index dc013126262d7..0b27b6a957879 100644 --- a/mod/lesson/tests/behat/time_limit.feature +++ b/mod/lesson/tests/behat/time_limit.feature @@ -25,7 +25,7 @@ Feature: A teacher can set a time limit for a lesson | timelimit[enabled] | 1 | | timelimit[timeunit] | 60 | | timelimit[number] | 1 | - And I follow "Test lesson" + 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 | Lesson page name | @@ -33,9 +33,7 @@ Feature: A teacher can set a time limit for a lesson | Description | Single button | 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 "You have 1 min to finish the lesson." And I wait "3" seconds And I should see "Time remaining" diff --git a/mod/lti/tests/behat/addtype.feature b/mod/lti/tests/behat/addtype.feature index aefff91e7c3a7..27e0752adacf6 100644 --- a/mod/lti/tests/behat/addtype.feature +++ b/mod/lti/tests/behat/addtype.feature @@ -17,16 +17,14 @@ Feature: Add preconfigured tools via teacher interface @javascript Scenario: Add a tool from a cartridge - When I log in as "teacher1" - And I am on "Course 1" course homepage with editing mode on - And I add a "External tool" to section "1" and I fill the form with: - | Activity name | Test tool activity 1 | - And I open "Test tool activity 1" actions menu - And I choose "Edit settings" in the open action menu + Given the following "activity" exists: + | course | C1 | + | activity | lti | + | name | Test tool activity | + When I am on the "Test tool activity" "lti activity editing" page logged in as teacher1 And I set the field "Tool URL" to local url "/mod/lti/tests/fixtures/ims_cartridge_basic_lti_link.xml" And I press "Save and return to course" - And I open "Test tool activity 1" actions menu - And I choose "Edit settings" in the open action menu + And I am on the "Test tool activity" "lti activity editing" page And I expand all fieldsets Then the field "Tool URL" matches value "http://www.example.com/lti/provider.php" And the field "Secure tool URL" matches value "https://www.example.com/lti/provider.php" @@ -35,12 +33,11 @@ Feature: Add preconfigured tools via teacher interface @javascript @_switch_window Scenario: Add a preconfigured tool from a cartridge - When I log in as "teacher1" - And I am on "Course 1" course homepage with editing mode on - And I add a "External tool" to section "1" and I fill the form with: - | Activity name | Test tool activity 1 | - And I open "Test tool activity 1" actions menu - And I choose "Edit settings" in the open action menu + Given the following "activity" exists: + | course | C1 | + | activity | lti | + | name | Test tool activity 1 | + When I am on the "Test tool activity 1" "lti activity editing" page logged in as teacher1 And I follow "Add preconfigured tool" And I switch to "add_tool" window And I set the field "Tool name" to "Placeholder" @@ -56,20 +53,18 @@ Feature: Add preconfigured tools via teacher interface And I press "Cancel" And I switch to the main window And I press "Save and return to course" - And I open "Test tool activity 1" actions menu - And I choose "Edit settings" in the open action menu + And I am on the "Test tool activity 1" "lti activity editing" page And the field "Preconfigured tool" matches value "Placeholder" @javascript @_switch_window Scenario: Add and use a preconfigured tool - When I log in as "teacher1" - And I am on "Course 1" course homepage with editing mode on - And I add a "External tool" to section "1" and I fill the form with: - | Activity name | Test tool activity 1 | - And I open "Test tool activity 1" actions menu - And I choose "Edit settings" in the open action menu + Given the following "activity" exists: + | course | C1 | + | activity | lti | + | name | Test tool activity | + When I am on the "Test tool activity" "lti activity editing" page logged in as teacher1 And I set the field "Tool URL" to local url "/mod/lti/tests/fixtures/tool_provider.php" And I press "Save and return to course" - And I follow "Test tool activity 1" + And I am on the "Test tool activity" "lti activity" page And I switch to "contentframe" iframe - And I should see "This represents a tool provider" + Then I should see "This represents a tool provider" diff --git a/mod/lti/tests/behat/lti_activity_completion.feature b/mod/lti/tests/behat/lti_activity_completion.feature index 5281ef437e57c..73d0aaafde90c 100644 --- a/mod/lti/tests/behat/lti_activity_completion.feature +++ b/mod/lti/tests/behat/lti_activity_completion.feature @@ -10,76 +10,47 @@ Feature: View activity completion information in the LTI activity | student1 | Vinnie | Student1 | student1@example.com | | teacher1 | Darrell | Teacher1 | teacher1@example.com | And the following "courses" exist: - | fullname | shortname | category | - | Course 1 | C1 | 0 | + | fullname | shortname | category | enablecompletion | showcompletionconditions | + | Course 1 | C1 | 0 | 1 | 1 | And the following "course enrolments" exist: | user | course | role | | student1 | C1 | student | | teacher1 | C1 | editingteacher | And the following "activities" exist: - | activity | name | course | idnumber | - | lti | Music history | C1 | lti1 | - And I log in as "teacher1" - And I am on "Course 1" course homepage - And I navigate to "Edit settings" in current page administration - And I expand all fieldsets - And I set the following fields to these values: - | Enable completion tracking | Yes | - | Show activity completion conditions | Yes | - And I press "Save and display" - And I turn editing mode on - When I open "Music history" actions menu - And I click on "Edit settings" "link" in the "Music history" activity - And I set the following fields to these values: - | Completion tracking | Show activity as complete when conditions are met | - | Require view | 1 | - | Require grade | 1 | - And I press "Save and return to course" - And I log out + | activity | name | course | idnumber | completion | completionview | completionusegrade | + | lti | Music history | C1 | lti1 | 2 | 1 | 1 | Scenario: View automatic completion items as a teacher - Given I log in as "teacher1" - And I am on "Course 1" course homepage - When I follow "Music history" + Given I am on the "Music history" "lti activity" page logged in as teacher1 Then "Music history" should have the "Receive a grade" completion condition And "Music history" should have the "View" completion condition Scenario: View automatic completion items as a student - Given I log in as "student1" - And I am on "Course 1" course homepage - And I follow "Music history" + Given I am on the "Music history" "lti activity" page logged in as student1 And the "View" completion condition of "Music history" is displayed as "done" And the "Receive a grade" completion condition of "Music history" is displayed as "todo" 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 I navigate to "View > Grader report" in the course gradebook And I turn editing mode on And I give the grade "90.00" to the user "Vinnie Student1" for the grade item "Music history" And I press "Save changes" And I log out - When I log in as "student1" - And I am on "Course 1" course homepage - And I follow "Music history" + When I am on the "Music history" "lti activity" page logged in as student1 Then the "Receive a grade" completion condition of "Music history" is displayed as "done" And the "View" completion condition of "Music history" is displayed as "done" Scenario: Use manual completion - Given I log in as "teacher1" - And I am on "Course 1" course homepage with editing mode on - And I open "Music history" actions menu - And I click on "Edit settings" "link" in the "Music history" activity + Given I am on the "Music history" "lti activity editing" page logged in as teacher1 And I expand all fieldsets And I set the field "Completion tracking" to "Students can manually mark the activity as completed" - And I press "Save and display" + And I press "Save and return to course" # Teacher view. - And I follow "Music history" + Given I am on the "Music history" "lti activity" page And the manual completion button for "Music history" should be disabled And I log out # Student view. - When I log in as "student1" - And I am on "Course 1" course homepage - And I follow "Music history" + When I am on the "Music history" "lti activity" page logged in as student1 Then the manual completion button of "Music history" is displayed as "Mark as done" And I toggle the manual completion state of "Music history" And the manual completion button of "Music history" is displayed as "Done" diff --git a/mod/page/tests/behat/page_activity_completion.feature b/mod/page/tests/behat/page_activity_completion.feature index 3ca642ef195ad..c9265abdcb92d 100644 --- a/mod/page/tests/behat/page_activity_completion.feature +++ b/mod/page/tests/behat/page_activity_completion.feature @@ -10,82 +10,83 @@ Feature: View activity completion information in the Page resource | student1 | Vinnie | Student1 | student1@example.com | | teacher1 | Darrell | Teacher1 | teacher1@example.com | And the following "courses" exist: - | fullname | shortname | category | - | Course 1 | C1 | 0 | + | fullname | shortname | category | enablecompletion | showcompletionconditions | + | Course 1 | C1 | 0 | 1 | 1 | + | Course 2 | C2 | 0 | 1 | 0 | And the following "course enrolments" exist: | user | course | role | | student1 | C1 | student | | teacher1 | C1 | editingteacher | - And the following "activity" exists: - | activity | page | - | course | C1 | - | idnumber | page1 | - | name | Music history | - | intro | A lesson learned in life | - And I log in as "teacher1" - And I am on "Course 1" course homepage - And I navigate to "Edit settings" in current page administration - And I expand all fieldsets - And I set the following fields to these values: - | Enable completion tracking | Yes | - | Show activity completion conditions | Yes | - And I press "Save and display" - Scenario: View automatic completion items - Given I am on "Course 1" course homepage with editing mode on - And I follow "Music history" - And I navigate to "Edit settings" in current page administration - And I set the following fields to these values: - | Completion tracking | Show activity as complete when conditions are met | - | completionview | 1 | - And I press "Save and return to course" - # Teacher view. - And I follow "Music history" - And "Music history" should have the "View" completion condition - And I log out - # Student view. - When I log in as "student1" - And I am on "Course 1" course homepage - And I follow "Music history" + Scenario: View automatic completion items as teacher + Given the following "activity" exists: + | activity | page | + | course | C1 | + | idnumber | page1 | + | name | Music history | + | intro | A lesson learned in life | + | completion | 2 | + | completionview | 1 | + When I am on the "Music history" "page activity" page logged in as teacher1 + Then "Music history" should have the "View" completion condition + + Scenario: View automatic completion items as student + Given the following "activity" exists: + | activity | page | + | course | C1 | + | idnumber | page1 | + | name | Music history | + | intro | A lesson learned in life | + | completion | 2 | + | completionview | 1 | + When I am on the "Music history" "page activity" page logged in as student1 Then the "View" completion condition of "Music history" is displayed as "done" @javascript - Scenario: Use manual completion - Given I am on "Course 1" course homepage with editing mode on - And I follow "Music history" - And I navigate to "Edit settings" in current page administration - And I set the following fields to these values: - | Completion tracking | Students can manually mark the activity as completed | - And I press "Save and return to course" + Scenario: Use manual completion as teacher + Given the following "activity" exists: + | activity | page | + | course | C1 | + | idnumber | page1 | + | name | Music history | + | intro | A lesson learned in life | + | completion | 1 | + # Teacher view. + When I am on the "Music history" "page activity" page logged in as teacher1 + Then the manual completion button for "Music history" should be disabled + + @javascript + Scenario: Use manual completion as student + Given the following "activity" exists: + | activity | page | + | course | C1 | + | idnumber | page1 | + | name | Music history | + | intro | A lesson learned in life | + | completion | 1 | # Teacher view. - And I follow "Music history" - And the manual completion button for "Music history" should be disabled - And I log out - # Student view. - When I log in as "student1" - And I am on "Course 1" course homepage - And I follow "Music history" - Then the manual completion button of "Music history" is displayed as "Mark as done" + When I am on the "Music history" "page activity" page logged in as student1 And I toggle the manual completion state of "Music history" And the manual completion button of "Music history" is displayed as "Done" - Scenario: The manual completion button will not be shown on the course page if the Show activity completion conditions is set to No - Given I am on "Course 1" course homepage with editing mode on - And I navigate to "Edit settings" in current page administration - And I expand all fieldsets - And I set the following fields to these values: - | Enable completion tracking | Yes | - | Show activity completion conditions | No | - And I press "Save and display" - And I follow "Music history" - And I navigate to "Edit settings" in current page administration - And I set the following fields to these values: - | Completion tracking | Students can manually mark the activity as completed | - And I press "Save and return to course" - # Teacher view. - And the manual completion button for "Music history" should not exist - And I log out - # Student view. - When I log in as "student1" - And I am on "Course 1" course homepage + Scenario: The manual completion button will not be shown on the course page if the Show activity completion conditions is set to No as teacher + Given the following "activity" exists: + | activity | page | + | course | C2 | + | idnumber | page1 | + | name | Music history | + | intro | A lesson learned in life | + | completion | 1 | + When I am on the "Music history" "page activity" page logged in as teacher1 + Then the manual completion button for "Music history" should not exist + + Scenario: The manual completion button will not be shown on the course page if the Show activity completion conditions is set to No as student + Given the following "activity" exists: + | activity | page | + | course | C2 | + | idnumber | page1 | + | name | Music history | + | intro | A lesson learned in life | + | completion | 1 | + When I am on the "Music history" "page activity" page logged in as student1 Then the manual completion button for "Music history" should not exist diff --git a/mod/page/tests/behat/page_appearance.feature b/mod/page/tests/behat/page_appearance.feature index efcee45417bdf..c7c2fe80bbaee 100644 --- a/mod/page/tests/behat/page_appearance.feature +++ b/mod/page/tests/behat/page_appearance.feature @@ -11,52 +11,20 @@ Feature: Configure page appearance And the following "activities" exist: | activity | name | intro | course | idnumber | | page | PageName1 | PageDesc1 | C1 | PAGE1 | - And I log in as "admin" @javascript - Scenario: Hide and display the page name - Given I am on "Course 1" course homepage - When I follow "PageName1" - Then I should see "PageName1" in the "region-main" "region" - And I navigate to "Edit settings" in current page administration - And I follow "Appearance" - When I click on "Display page name" "checkbox" + Scenario Outline: Hide and display page features + Given I am on the "PageName1" "page activity editing" page logged in as admin + And I expand all fieldsets + And I set the field "Display page name" to "" And I press "Save and display" - Then I should not see "PageName1" in the "region-main" "region" - And I navigate to "Edit settings" in current page administration - And I follow "Appearance" - When I click on "Display page name" "checkbox" - And I press "Save and display" - Then I should see "PageName1" in the "region-main" "region" - - @javascript - Scenario: Display and hide the page description - Given I am on "Course 1" course homepage - When I follow "PageName1" - Then I should not see "PageDesc1" in the "region-main" "region" - And I navigate to "Edit settings" in current page administration - And I follow "Appearance" - When I click on "Display page description" "checkbox" - And I press "Save and display" - Then I should see "PageDesc1" in the "region-main" "region" - And I navigate to "Edit settings" in current page administration - And I follow "Appearance" - When I click on "Display page description" "checkbox" - And I press "Save and display" - Then I should not see "PageDesc1" in the "region-main" "region" + Then I see "PageName1" in the "region-main" "region" - @javascript - Scenario: Display and hide the last modified date - Given I am on "Course 1" course homepage - When I follow "PageName1" - Then I should see "Last modified:" in the "region-main" "region" - And I navigate to "Edit settings" in current page administration - And I follow "Appearance" - When I click on "Display last modified date" "checkbox" - And I press "Save and display" - Then I should not see "Last modified:" in the "region-main" "region" - And I navigate to "Edit settings" in current page administration - And I follow "Appearance" - When I click on "Display last modified date" "checkbox" - And I press "Save and display" - Then I should see "Last modified:" in the "region-main" "region" + Examples: + | feature | lookfor | value | shouldornot | + | Display page name | PageName1 | 1 | should | + | Display page name | PageName1 | 0 | should not | + | Display page description | PageDesc1 | 1 | should | + | Display page description | PageDesc1 | 0 | should not | + | Display last modified date | Last modified: | 1 | should | + | Display last modified date | Last modified: | 0 | should not | diff --git a/mod/quiz/report/overview/tests/behat/basic.feature b/mod/quiz/report/overview/tests/behat/basic.feature index d0c665ed7b702..5ee1d0f562748 100644 --- a/mod/quiz/report/overview/tests/behat/basic.feature +++ b/mod/quiz/report/overview/tests/behat/basic.feature @@ -49,9 +49,7 @@ Feature: Basic use of the Grades report @javascript Scenario: Using the Grades report # Basic check of the Grades report - When I log in as "teacher1" - And I am on "Course 1" course homepage - And I follow "Quiz 1" + When I am on the "Quiz 1" "quiz activity" page logged in as teacher1 And I navigate to "Results > Grades" in current page administration Then I should see "Attempts: 2" # Check student1's grade @@ -86,9 +84,7 @@ Feature: Basic use of the Grades report Scenario: View custom user profile fields in the grades report Given the following config values are set as admin: | showuseridentity | email,profile_field_fruit | - When I log in as "teacher1" - And I am on "Course 1" course homepage - And I follow "Quiz 1" + And I am on the "Quiz 1" "quiz activity" page logged in as teacher1 And I navigate to "Results > Grades" in current page administration Then I should see "Apple" in the "S1 Student1" "table_row" And I should see "Banana" in the "S2 Student2" "table_row" diff --git a/mod/quiz/report/overview/tests/behat/regrading.feature b/mod/quiz/report/overview/tests/behat/regrading.feature index 5aba26eb663c0..6645f0b59d2fe 100644 --- a/mod/quiz/report/overview/tests/behat/regrading.feature +++ b/mod/quiz/report/overview/tests/behat/regrading.feature @@ -42,9 +42,7 @@ Feature: Regrading quiz attempts using the Grades report | 2 | toad | Scenario: Regrade all attempts - Given I log in as "teacher" - And I am on "Course 1" course homepage - And I follow "Quiz for testing regrading" + Given I am on the "Quiz for testing regrading" "quiz activity" page logged in as teacher And I navigate to "Results > Grades" in current page administration When I press "Regrade all" @@ -61,9 +59,7 @@ Feature: Regrading quiz attempts using the Grades report And I should see "Overall number of students achieving grade ranges" Scenario: Regrade selected attempts - Given I log in as "teacher" - And I am on "Course 1" course homepage - And I follow "Quiz for testing regrading" + Given I am on the "Quiz for testing regrading" "quiz activity" page logged in as teacher And I navigate to "Results > Grades" in current page administration When I click on "Select attempt" "checkbox" in the "Student Two" "table_row" @@ -78,9 +74,7 @@ Feature: Regrading quiz attempts using the Grades report And I should see "Overall number of students achieving grade ranges" Scenario: Dry-run a full regrade, then regrade the attempts that will need it. - Given I log in as "teacher" - And I am on "Course 1" course homepage - And I follow "Quiz for testing regrading" + Given I am on the "Quiz for testing regrading" "quiz activity" page logged in as teacher When I navigate to "Edit quiz" in current page administration And I follow "Edit question SA" And I set the field "id_fraction_1" to "50%" diff --git a/mod/quiz/report/responses/tests/behat/basic.feature b/mod/quiz/report/responses/tests/behat/basic.feature index dc1570df05d36..1b4d1a845c274 100644 --- a/mod/quiz/report/responses/tests/behat/basic.feature +++ b/mod/quiz/report/responses/tests/behat/basic.feature @@ -33,14 +33,11 @@ Feature: Basic use of the Responses report @javascript Scenario: Report works when there are no attempts - When I log in as "teacher" - And I am on "Course 1" course homepage - And I follow "Quiz 1" - And I navigate to "Results > Responses" in current page administration + Given I am on the "Quiz 1" "quiz activity" page logged in as teacher + When I navigate to "Results > Responses" in current page administration Then I should see "Attempts: 0" And I should see "Nothing to display" And I set the field "Attempts from" to "enrolled users who have not attempted the quiz" - And I log out @javascript Scenario: Report works when there are attempts @@ -55,9 +52,8 @@ Feature: Basic use of the Responses report | slot | response | | 1 | 3.14 | And user "student1" has finished an attempt at quiz "Quiz 1" - When I log in as "teacher" - And I am on "Course 1" course homepage - And I follow "Quiz 1" + + And I am on the "Quiz 1" "quiz activity" page logged in as teacher And I navigate to "Results > Responses" in current page administration Then I should see "Attempts: 1" And I should see "Student One" @@ -74,10 +70,8 @@ Feature: Basic use of the Responses report @javascript Scenario: Report does not allow strange combinations of options - When I log in as "teacher" - And I am on "Course 1" course homepage - And I follow "Quiz 1" + Given I am on the "Quiz 1" "quiz activity" page logged in as teacher And I navigate to "Results > Responses" in current page administration And the "Which tries" "select" should be enabled - And I set the field "Attempts from" to "enrolled users who have not attempted the quiz" + When I set the field "Attempts from" to "enrolled users who have not attempted the quiz" Then the "Which tries" "select" should be disabled diff --git a/mod/quiz/report/statistics/tests/behat/basic.feature b/mod/quiz/report/statistics/tests/behat/basic.feature index 73b9988e6085f..0d315cf02005e 100644 --- a/mod/quiz/report/statistics/tests/behat/basic.feature +++ b/mod/quiz/report/statistics/tests/behat/basic.feature @@ -39,9 +39,7 @@ Feature: Basic use of the Statistics report @javascript Scenario: Report works when there are no attempts - When I log in as "teacher1" - And I am on "Course 1" course homepage - And I follow "Quiz 1" + Given I am on the "Quiz 1" "quiz activity" page logged in as teacher1 And I navigate to "Results > Statistics" in current page administration Then I should see "No attempts have been made at this quiz, or all attempts have questions that need manual grading." And I should not see "Statistics for question positions" diff --git a/mod/quiz/tests/behat/add_quiz.feature b/mod/quiz/tests/behat/add_quiz.feature index bac363abccc34..becf17f7bfcab 100644 --- a/mod/quiz/tests/behat/add_quiz.feature +++ b/mod/quiz/tests/behat/add_quiz.feature @@ -34,9 +34,8 @@ Feature: Add a quiz | Feedback for the response 'True'. | So you think it is true | | Feedback for the response 'False'. | So you think it is false | And I log out - And I log in as "student1" - And I am on "Course 1" course homepage - And I follow "Test quiz name" + + And I am on the "Test quiz name" "quiz activity" page logged in as student1 And I press "Attempt quiz now" Then I should see "Question 1" And I should see "Answer the first question" @@ -53,7 +52,6 @@ Feature: Add a quiz And I should see "The correct answer is 'False'." And I follow "Finish review" And I should see "Highest grade: 0.00 / 10.00." - And I log out Scenario: Add and configure small quiz and perform an attempt as a student with Javascript disabled Then I should see "So you think it is true" @@ -61,4 +59,3 @@ Feature: Add a quiz And I should see "The correct answer is 'False'." And I follow "Finish review" And I should see "Highest grade: 0.00 / 10.00." - And I log out diff --git a/mod/quiz/tests/behat/behat_mod_quiz.php b/mod/quiz/tests/behat/behat_mod_quiz.php index f937457d76c72..add61fdcda83e 100644 --- a/mod/quiz/tests/behat/behat_mod_quiz.php +++ b/mod/quiz/tests/behat/behat_mod_quiz.php @@ -364,14 +364,12 @@ public function quiz_contains_the_following_sections($quizname, TableNode $data) */ public function i_add_question_to_the_quiz_with($questiontype, $quizname, TableNode $questiondata) { $quizname = $this->escape($quizname); - $editquiz = $this->escape(get_string('editquiz', 'quiz')); - $quizadmin = $this->escape(get_string('pluginadministration', 'quiz')); $addaquestion = $this->escape(get_string('addaquestion', 'quiz')); - $this->execute('behat_general::click_link', $quizname); - - $this->execute("behat_navigation::i_navigate_to_in_current_page_administration", - $quizadmin . ' > ' . $editquiz); + $this->execute('behat_navigation::i_am_on_page_instance', [ + $quizname, + 'mod_quiz > Edit', + ]); if ($this->running_javascript()) { $this->execute("behat_action_menu::i_open_the_action_menu_in", array('.slots', "css_element")); diff --git a/mod/quiz/tests/behat/completion_manual.feature b/mod/quiz/tests/behat/completion_manual.feature index de63ece55fa58..a34f3518313e6 100644 --- a/mod/quiz/tests/behat/completion_manual.feature +++ b/mod/quiz/tests/behat/completion_manual.feature @@ -33,16 +33,11 @@ Feature: Manually complete a quiz @javascript Scenario: Use manual completion - When I log in as "teacher1" - # Teacher view. - And I am on "Course 1" course homepage - And I follow "Test quiz name" + Given I am on the "Test quiz name" "quiz activity" page logged in as teacher1 And the manual completion button for "Test quiz name" should be disabled And I log out # Student view. - And I log in as "student1" - And I am on "Course 1" course homepage - And I follow "Test quiz name" + When I am on the "Test quiz name" "quiz activity" page logged in as student1 Then the manual completion button of "Test quiz name" is displayed as "Mark as done" And I toggle the manual completion state of "Test quiz name" And the manual completion button of "Test quiz name" is displayed as "Done" diff --git a/mod/quiz/tests/behat/editing_set_marks_no_attempts.feature b/mod/quiz/tests/behat/editing_set_marks_no_attempts.feature index 47a382f176279..11543c36c7b19 100644 --- a/mod/quiz/tests/behat/editing_set_marks_no_attempts.feature +++ b/mod/quiz/tests/behat/editing_set_marks_no_attempts.feature @@ -64,9 +64,8 @@ Feature: Edit quiz marks with no attempts And I should not see "2.000" And I should not see "3.000" And I should not see "Total of marks: 5.000" - And I follow "Quiz 1" - When I navigate to "Edit settings" in current page administration - And I set the following fields to these values: + And I am on the "Quiz 1" "quiz activity editing" page + When I set the following fields to these values: | Decimal places in grades | 3 | | Decimal places in question grades | 5 | And I press "Save and display" diff --git a/mod/quiz/tests/behat/editing_set_marks_with_attempts.feature b/mod/quiz/tests/behat/editing_set_marks_with_attempts.feature index 36c2edd02e90f..5af074bdbb447 100644 --- a/mod/quiz/tests/behat/editing_set_marks_with_attempts.feature +++ b/mod/quiz/tests/behat/editing_set_marks_with_attempts.feature @@ -30,9 +30,7 @@ Feature: Edit quiz marks with attempts | Question text | Answer again | | Default mark | 3.0 | And I log out - And I log in as "student1" - And I am on "Course 1" course homepage - And I follow "Quiz 1" + And I am on the "Quiz 1" "mod_quiz > View" page logged in as "student1" And I press "Attempt quiz now" And I log out And I log in as "teacher1" @@ -64,15 +62,14 @@ Feature: Edit quiz marks with attempts @javascript Scenario: Verify the number of decimal places shown is what the quiz settings say it should be. # Then the field "maxgrade" matches value "20.00" -- with exact match on decimal places. - Then "//input[@name = 'maxgrade' and @value = '20.00']" "xpath_element" should exist + Given "//input[@name = 'maxgrade' and @value = '20.00']" "xpath_element" should exist And I should see "2.00" And I should see "3.00" And I should see "Total of marks: 5.00" And I should not see "2.000" And I should not see "3.000" And I should not see "Total of marks: 5.000" - And I follow "Quiz 1" - When I navigate to "Edit settings" in current page administration + When I am on the "Quiz 1" "quiz activity editing" page And I set the following fields to these values: | Decimal places in grades | 3 | | Decimal places in question grades | 5 | diff --git a/mod/resource/tests/behat/resource_activity_completion.feature b/mod/resource/tests/behat/resource_activity_completion.feature index 125768b501433..bfaae1a667f32 100644 --- a/mod/resource/tests/behat/resource_activity_completion.feature +++ b/mod/resource/tests/behat/resource_activity_completion.feature @@ -73,11 +73,11 @@ Feature: View activity completion information for file resources | id_display | Embed | | Completion tracking | Students can manually mark the activity as completed | And I upload "mod/resource/tests/fixtures/samplefile.txt" file to "Select files" filemanager - And I click on "Save and display" "button" + And I click on "Save and return to course" "button" # Teacher view. And the manual completion button for "Myfile" should exist And the manual completion button for "Myfile" should be disabled - And I follow "Myfile" + And I am on the "Myfile" "resource activity" page And the manual completion button for "Myfile" should exist And the manual completion button for "Myfile" should be disabled And I log out @@ -85,7 +85,7 @@ Feature: View activity completion information for file resources When I log in as "student1" And I am on "Course 1" course homepage Then the manual completion button for "Myfile" should exist - And I follow "Myfile" + And I am on the "Myfile" "resource activity" page And the manual completion button of "Myfile" is displayed as "Mark as done" And I toggle the manual completion state of "Myfile" And the manual completion button of "Myfile" is displayed as "Done" @@ -107,11 +107,11 @@ Feature: View activity completion information for file resources And I press "Save and display" And I am on "Course 1" course homepage # Teacher view. - And I follow "Myfile" + And I am on the "Myfile" "resource activity" page And "Myfile" should have the "View" completion condition And I log out # Student view. When I log in as "student1" And I am on "Course 1" course homepage - And I follow "Myfile" + And I am on the "Myfile" "resource activity" page Then the "View" completion condition of "Myfile" is displayed as "done" diff --git a/mod/scorm/tests/behat/add_scorm.feature b/mod/scorm/tests/behat/add_scorm.feature index e6778481accbc..c60c1f1ea29b6 100644 --- a/mod/scorm/tests/behat/add_scorm.feature +++ b/mod/scorm/tests/behat/add_scorm.feature @@ -29,9 +29,7 @@ Feature: Add scorm activity And I should see "Normal" And I should see "Preview" And I log out - And I log in as "student1" - And I am on "Course 1" course homepage - And I follow "Awesome SCORM package" + And I am on the "Awesome SCORM package" "scorm activity" page logged in as student1 And I should see "Normal" And I press "Enter" And I switch to "scorm_object" iframe diff --git a/mod/scorm/tests/behat/completion_condition_require_status.feature b/mod/scorm/tests/behat/completion_condition_require_status.feature index cfadd0dfade27..3341f22e23de9 100644 --- a/mod/scorm/tests/behat/completion_condition_require_status.feature +++ b/mod/scorm/tests/behat/completion_condition_require_status.feature @@ -8,36 +8,27 @@ Feature: Scorm multi-sco completion | username | firstname | lastname | email | | teacher1 | Teacher | 1 | teacher1@example.com | | student1 | Student | 1 | student1@example.com | - And the following "courses" exist: - | fullname | shortname | category | - | Course 1 | C1 | 0 | + And the following "course" exists: + | fullname | Course 1 | + | shortname | C1 | + | enablecompletion | 1 | And the following "course enrolments" exist: - | user | course | role | - | teacher1 | C1 | editingteacher | - | student1 | C1 | student | + | user | course | role | + | teacher1 | C1 | editingteacher | + | student1 | C1 | student | @javascript Scenario: Test completion with a single sco completion. - When 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 "SCORM package" to section "1" - And I set the following fields to these values: - | Name | Basic Multi-sco SCORM package | - | Description | Description | - | Completion tracking | Show activity as complete when conditions are met | - | Require all scos to return completion status | 0 | - And I set the field "Completed" to "1" - And I upload "mod/scorm/tests/packages/RuntimeMinimumCalls_SCORM12.zip" file to "Package file" filemanager - And I click on "Save and display" "button" - Then I should see "Basic Multi-sco SCORM package" - And I log out - And I log in as "student1" - And I am on "Course 1" course homepage - And I follow "Basic Multi-sco SCORM package" + Given the following "activity" exists: + | activity | scorm | + | course | C1 | + | name | Basic Multi-sco SCORM package | + | completion | 2 | + # Show activity as complete when conditions are met + | completionstatusallscos | 0 | + | packagefilepath | mod/scorm/tests/packages/RuntimeMinimumCalls_SCORM12.zip | + | completionstatusrequired | 4 | + And I am on the "Basic Multi-sco SCORM package" "scorm activity" page logged in as student1 And I should see "Normal" And I press "Enter" And I switch to "scorm_object" iframe @@ -45,35 +36,23 @@ Feature: Scorm multi-sco completion And I switch to the main frame And I follow "Exit activity" And I wait until the page is ready - Then I should see "Basic Multi-sco SCORM package" + Then I should see "Basic Multi-sco SCORM package" in the "page" "region" And I am on homepage 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 Then "Student 1" user has completed "Basic Multi-sco SCORM package" activity @javascript Scenario: Test completion with all scos and correct sco load on re-entry. - When 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 "SCORM package" to section "1" - And I set the following fields to these values: - | Name | ADV Multi-sco SCORM package | - | Description | Description | - | Completion tracking | Show activity as complete when conditions are met | - | Require all scos to return completion status | 1 | - And I set the field "Completed" to "1" - And I upload "mod/scorm/tests/packages/RuntimeMinimumCalls_SCORM12.zip" file to "Package file" filemanager - And I click on "Save and display" "button" - Then I should see "ADV Multi-sco SCORM package" - And I log out - And I log in as "student1" - And I am on "Course 1" course homepage - And I follow "ADV Multi-sco SCORM package" + Given the following "activity" exists: + | activity | scorm | + | course | C1 | + | name | ADV Multi-sco SCORM package | + | completion | 2 | + # Show activity as complete when conditions are met + | packagefilepath | mod/scorm/tests/packages/RuntimeMinimumCalls_SCORM12.zip | + | completionstatusallscos | 1 | + And I am on the "ADV Multi-sco SCORM package" "scorm activity" page logged in as student1 And I should see "Normal" And I press "Enter" And I switch to "scorm_object" iframe @@ -81,16 +60,14 @@ Feature: Scorm multi-sco completion And I switch to the main frame And I follow "Exit activity" And I wait until the page is ready - Then I should see "ADV Multi-sco SCORM package" + Then I should see "ADV Multi-sco SCORM package" in the "page" "region" And I am on homepage 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 Then "Student 1" user has not completed "ADV Multi-sco SCORM package" activity And I log out - And I log in as "student1" - And I am on "Course 1" course homepage - And I follow "ADV Multi-sco SCORM package" + And I am on the "ADV Multi-sco SCORM package" "scorm activity" page logged in as student1 And I should see "Normal" And I press "Enter" And I switch to "scorm_object" iframe @@ -178,9 +155,7 @@ Feature: Scorm multi-sco completion And I switch to the main frame And I follow "Exit activity" And I wait until the page is ready - Then I should see "ADV Multi-sco SCORM package" - And I am on homepage + Then I should see "ADV Multi-sco SCORM package" in the "page" "region" 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 "ADV Multi-sco SCORM package" activity diff --git a/mod/scorm/tests/behat/multisco_review_mode.feature b/mod/scorm/tests/behat/multisco_review_mode.feature index 7daa5dc31bc21..69ec15cfb4157 100644 --- a/mod/scorm/tests/behat/multisco_review_mode.feature +++ b/mod/scorm/tests/behat/multisco_review_mode.feature @@ -32,9 +32,7 @@ Feature: Scorm multi-sco review mode. And I click on "Save and display" "button" And I should see "Basic Multi-sco SCORM package" And I log out - And I log in as "student1" - And I am on "Course 1" course homepage - And I follow "Basic Multi-sco SCORM package" + And I am on the "Basic Multi-sco SCORM package" "scorm activity" page logged in as student1 And I should see "Normal" And I press "Enter" And I switch to "scorm_object" iframe @@ -43,8 +41,7 @@ Feature: Scorm multi-sco review mode. And I follow "Exit activity" And I wait until the page is ready And I should see "Basic Multi-sco SCORM package" - And I am on "Course 1" course homepage - And I follow "Basic Multi-sco SCORM package" + And I am on the "Basic Multi-sco SCORM package" "scorm activity" page And I should see "Normal" And I press "Enter" Then I should not see "Review mode" @@ -69,9 +66,7 @@ Feature: Scorm multi-sco review mode. And I click on "Save and display" "button" And I should see "ADV Multi-sco SCORM package" And I log out - And I log in as "student1" - And I am on "Course 1" course homepage - And I follow "ADV Multi-sco SCORM package" + And I am on the "ADV Multi-sco SCORM package" "scorm activity" page logged in as student1 And I should see "Normal" And I press "Enter" And I switch to "scorm_object" iframe @@ -165,8 +160,7 @@ Feature: Scorm multi-sco review mode. And I follow "Exit activity" And I wait until the page is ready And I should see "ADV Multi-sco SCORM package" - And I am on "Course 1" course homepage - And I follow "ADV Multi-sco SCORM package" + And I am on the "ADV Multi-sco SCORM package" "scorm activity" page And I should see "Normal" And I press "Enter" Then I should see "Review mode" @@ -184,9 +178,7 @@ Feature: Scorm multi-sco review mode. And I click on "Save and display" "button" And I should see "Basic Multi-sco SCORM package" And I log out - And I log in as "student1" - And I am on "Course 1" course homepage - And I follow "Basic Multi-sco SCORM package" + And I am on the "Basic Multi-sco SCORM package" "scorm activity" page logged in as student1 And I should see "Normal" And I press "Enter" And I switch to "scorm_object" iframe @@ -195,8 +187,7 @@ Feature: Scorm multi-sco review mode. And I follow "Exit activity" And I wait until the page is ready And I should see "Basic Multi-sco SCORM package" - And I am on "Course 1" course homepage - And I follow "Basic Multi-sco SCORM package" + And I am on the "Basic Multi-sco SCORM package" "scorm activity" page And I should see "Normal" And I should not see "Start a new attempt" And I press "Enter" @@ -217,9 +208,7 @@ Feature: Scorm multi-sco review mode. And I click on "Save and display" "button" And I should see "Basic Multi-sco SCORM package" And I log out - And I log in as "student1" - And I am on "Course 1" course homepage - And I follow "Basic Multi-sco SCORM package" + And I am on the "Basic Multi-sco SCORM package" "scorm activity" page logged in as student1 And I should see "Normal" And I press "Enter" And I switch to "scorm_object" iframe @@ -228,8 +217,7 @@ Feature: Scorm multi-sco review mode. And I follow "Exit activity" And I wait until the page is ready And I should see "Basic Multi-sco SCORM package" - And I am on "Course 1" course homepage - And I follow "Basic Multi-sco SCORM package" + And I am on the "Basic Multi-sco SCORM package" "scorm activity" page And I should see "Normal" And I should not see "Start a new attempt" And I press "Enter" @@ -275,8 +263,7 @@ Feature: Scorm multi-sco review mode. And I follow "Exit activity" And I wait until the page is ready And I should see "Basic Multi-sco SCORM package" - And I am on "Course 1" course homepage - And I follow "Basic Multi-sco SCORM package" + And I am on the "Basic Multi-sco SCORM package" "scorm activity" page And I should see "Normal" And I press "Enter" Then I should not see "Review mode" @@ -297,17 +284,14 @@ Feature: Scorm multi-sco review mode. And I click on "Save and display" "button" And I should see "Basic Multi-sco SCORM package" And I log out - And I log in as "student1" - And I am on "Course 1" course homepage - And I follow "Basic Multi-sco SCORM package" + And I am on the "Basic Multi-sco SCORM package" "scorm activity" page logged in as student1 And I switch to "scorm_object" iframe And I should see "Play of the game" And I switch to the main frame And I follow "Exit activity" And I wait until the page is ready And I should see "Basic Multi-sco SCORM package" - And I am on "Course 1" course homepage - And I follow "Basic Multi-sco SCORM package" + And I am on the "Basic Multi-sco SCORM package" "scorm activity" page Then I should not see "Review mode" And I switch to "scorm_object" iframe And I should see "Play of the game" @@ -326,17 +310,14 @@ Feature: Scorm multi-sco review mode. And I click on "Save and display" "button" And I should see "Basic Multi-sco SCORM package" And I log out - And I log in as "student1" - And I am on "Course 1" course homepage - And I follow "Basic Multi-sco SCORM package" + And I am on the "Basic Multi-sco SCORM package" "scorm activity" page logged in as student1 And I switch to "scorm_object" iframe And I should see "Play of the game" And I switch to the main frame And I follow "Exit activity" And I wait until the page is ready And I should see "Basic Multi-sco SCORM package" - And I am on "Course 1" course homepage - And I follow "Basic Multi-sco SCORM package" + And I am on the "Basic Multi-sco SCORM package" "scorm activity" page And I should not see "Review mode" And I switch to "scorm_object" iframe And I should see "Par" @@ -379,8 +360,7 @@ Feature: Scorm multi-sco review mode. And I follow "Exit activity" And I wait until the page is ready And I should see "Basic Multi-sco SCORM package" - And I am on "Course 1" course homepage - And I follow "Basic Multi-sco SCORM package" + And I am on the "Basic Multi-sco SCORM package" "scorm activity" page Then I should not see "Review mode" And I switch to "scorm_object" iframe And I should see "Play of the game" diff --git a/mod/scorm/tests/behat/scorm_activity_completion.feature b/mod/scorm/tests/behat/scorm_activity_completion.feature index 77e562e59f42b..f8b5883bfd079 100644 --- a/mod/scorm/tests/behat/scorm_activity_completion.feature +++ b/mod/scorm/tests/behat/scorm_activity_completion.feature @@ -10,42 +10,31 @@ Feature: View activity completion in the SCORM activity | student1 | Vinnie | Student1 | student1@example.com | | teacher1 | Darrell | Teacher1 | teacher1@example.com | And the following "courses" exist: - | fullname | shortname | category | - | Course 1 | C1 | 0 | + | fullname | shortname | enablecompletion | + | Course 1 | C1 | 1 | And the following "course enrolments" exist: | user | course | role | | student1 | C1 | student | | teacher1 | C1 | editingteacher | - And I log in as "teacher1" - And I am on "Course 1" course homepage - And I navigate to "Edit settings" in current page administration - And I expand all fieldsets - And I set the following fields to these values: - | Enable completion tracking | Yes | - | Show activity completion conditions | Yes | - And I press "Save and display" - And I turn editing mode on - And I add a "SCORM package" to section "1" - And I set the following fields to these values: - | Name | Music history | - | Number of attempts | 1 attempt | - | Completion tracking | Show activity as complete when conditions are met | - | Require view | 1 | - | Require grade | 1 | - | completionscoredisabled | 0 | - | completionscorerequired | 3 | - | completionstatusrequired[2] | 1 | - | completionstatusrequired[4] | 1 | - | completionstatusallscos | 1 | - And I upload "mod/scorm/tests/packages/RuntimeMinimumCalls_SCORM12-mini.zip" file to "Package file" filemanager - And I click on "Save and display" "button" - And I log out + And the following "activity" exists: + | activity | scorm | + | course | C1 | + | name | Music history | + | completion | 2 | + | completionstatusallscos | 0 | + # Show activity as complete when conditions are met + | packagefilepath | mod/scorm/tests/packages/RuntimeMinimumCalls_SCORM12-mini.zip | + | completionstatusrequired | 6 | + | completionscorerequired | 3 | + | completionstatusrequired | 6 | + | completionstatusallscos | 1 | + | maxattempt | 1 | + | completionview | 1 | + | completionusegrade | 1 | @javascript Scenario: View automatic completion items as a teacher - Given I log in as "teacher1" - And I am on "Course 1" course homepage - When I follow "Music history" + Given I am on the "Music history" "scorm activity" page logged in as teacher1 Then "Music history" should have the "View" completion condition And "Music history" should have the "Receive a score of 3 or more" completion condition And "Music history" should have the "Do all parts of this activity" completion condition @@ -54,9 +43,7 @@ Feature: View activity completion in the SCORM activity @javascript Scenario: View automatic completion items as a student - Given I log in as "student1" - And I am on "Course 1" course homepage - And I follow "Music history" + Given I am on the "Music history" "scorm activity" page logged in as student1 And the "View" completion condition of "Music history" is displayed as "todo" And the "Receive a score of 3 or more" completion condition of "Music history" is displayed as "todo" And the "Do all parts of this activity" completion condition of "Music history" is displayed as "todo" @@ -87,8 +74,8 @@ Feature: View activity completion in the SCORM activity And I press "Submit Answers" And I switch to the main frame And I follow "Exit activity" - And I follow "Music history" - And the "View" completion condition of "Music history" is displayed as "done" + When I am on the "Music history" "scorm activity" page + Then the "View" completion condition of "Music history" is displayed as "done" # Conditions that are not possible to achieve (eg score below requirement but all attempts used) are marked as failed. And the "Receive a score of 3 or more" completion condition of "Music history" is displayed as "failed" And the "Do all parts of this activity" completion condition of "Music history" is displayed as "done" @@ -97,9 +84,7 @@ Feature: View activity completion in the SCORM activity @javascript Scenario: Use manual completion - Given I log in as "teacher1" - And I am on "Course 1" course homepage - And I follow "Music history" + Given I am on the "Music history" "scorm activity" page logged in as teacher1 And I navigate to "Edit settings" in current page administration And I expand all fieldsets And I set the field "Completion tracking" to "Students can manually mark the activity as completed" @@ -108,9 +93,7 @@ Feature: View activity completion in the SCORM activity And the manual completion button for "Music history" should be disabled And I log out # Student view. - When I log in as "student1" - And I am on "Course 1" course homepage - And I follow "Music history" + When I am on the "Music history" "scorm activity" page logged in as student1 Then the manual completion button of "Music history" is displayed as "Mark as done" And I toggle the manual completion state of "Music history" And the manual completion button of "Music history" is displayed as "Done" diff --git a/mod/scorm/tests/behat/scorm_no_calendar_capabilities.feature b/mod/scorm/tests/behat/scorm_no_calendar_capabilities.feature index 77cd7a036c5f8..4d8e7362b9efc 100644 --- a/mod/scorm/tests/behat/scorm_no_calendar_capabilities.feature +++ b/mod/scorm/tests/behat/scorm_no_calendar_capabilities.feature @@ -23,7 +23,7 @@ Feature: Scorm with no calendar capabilites And I log out @javascript @_file_upload @_switch_iframe - Scenario: Editing a chat + Scenario: Editing a scorm activity without calendar permission Given I log in as "admin" And I am on "Course 1" course homepage with editing mode on When I add a "SCORM package" to section "1" @@ -41,10 +41,7 @@ Feature: Scorm with no calendar capabilites And I upload "mod/scorm/tests/packages/singlesco_scorm12.zip" file to "Package file" filemanager And I click on "Save and display" "button" 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 scorm name" - And I navigate to "Edit settings" in current page administration + When I am on the "Test scorm name" "scorm activity editing" page logged in as teacher1 And I set the following fields to these values: | id_timeopen_year | 2018 | | id_timeclose_year | 2018 | diff --git a/mod/scorm/tests/generator/lib.php b/mod/scorm/tests/generator/lib.php index 2828a02fefadd..d5225674bad9b 100644 --- a/mod/scorm/tests/generator/lib.php +++ b/mod/scorm/tests/generator/lib.php @@ -74,6 +74,9 @@ public function create_instance($record = null, array $options = null) { if (empty($record['packagefilepath'])) { $record['packagefilepath'] = $CFG->dirroot.'/mod/scorm/tests/packages/singlescobasic.zip'; } + if (strpos($record['packagefilepath'], $CFG->dirroot) !== 0) { + $record['packagefilepath'] = "{$CFG->dirroot}/{$record['packagefilepath']}"; + } // The 'packagefile' value corresponds to the draft file area ID. If not specified, create from packagefilepath. if (empty($record['packagefile']) && $record['scormtype'] === SCORM_TYPE_LOCAL) { diff --git a/mod/url/tests/behat/url_activity_completion.feature b/mod/url/tests/behat/url_activity_completion.feature index a65ea9459c6f2..b2da6473ff3d1 100644 --- a/mod/url/tests/behat/url_activity_completion.feature +++ b/mod/url/tests/behat/url_activity_completion.feature @@ -10,151 +10,211 @@ Feature: View activity completion information in the URL resource | student1 | Vinnie | Student1 | student1@example.com | | teacher1 | Darrell | Teacher1 | teacher1@example.com | And the following "courses" exist: - | fullname | shortname | category | - | Course 1 | C1 | 0 | + | fullname | shortname | category | enablecompletion | showcompletionconditions | + | Course 1 | C1 | 0 | 1 | 1 | And the following "course enrolments" exist: - | user | course | role | - | student1 | C1 | student | - | teacher1 | C1 | editingteacher | + | user | course | role | + | student1 | C1 | student | + | teacher1 | C1 | editingteacher | And the following config values are set as admin: | displayoptions | 0,1,2,3,4,5,6 | url | - And the following "activities" exist: - | activity | name | description | course | idnumber | externalurl | - | url | Music history | URL description | C1 | url1 | https://moodle.org/ | - And I log in as "teacher1" - And I am on "Course 1" course homepage - And I navigate to "Edit settings" in current page administration - And I expand all fieldsets - And I set the following fields to these values: - | Enable completion tracking | Yes | - | Show activity completion conditions | Yes | - And I press "Save and display" - Scenario: View automatic completion items in automatic display mode - Given I am on "Course 1" course homepage with editing mode on - And I follow "Music history" - And I navigate to "Edit settings" in current page administration - And I set the following fields to these values: - | Display | Automatic | - | Completion tracking | Show activity as complete when conditions are met | - | Require view | 1 | - And I press "Save and return to course" - # Teacher view. - And I follow "Music history" - And "Music history" should have the "View" completion condition - And I log out - # Student view. - When I log in as "student1" - And I am on "Course 1" course homepage - And I follow "Music history" + Scenario: View automatic completion items in automatic display mode as teacher + Given the following "activity" exists: + | activity | url | + | course | C1 | + | idnumber | Music history | + | name | Music history | + | intro | URL description | + | externalurl | https://moodle.org/ | + | completion | 2 | + | completionview | 1 | + | display | 0 | + When I am on the "Music history" "url activity" page logged in as teacher1 + Then "Music history" should have the "View" completion condition + + Scenario: View automatic completion items in automatic display mode as student + Given the following "activity" exists: + | activity | url | + | course | C1 | + | idnumber | Music history | + | name | Music history | + | intro | URL description | + | externalurl | https://moodle.org/ | + | completion | 2 | + | completionview | 1 | + | display | 0 | + When I am on the "Music history" "url activity" page logged in as student1 Then the "View" completion condition of "Music history" is displayed as "done" - Scenario: View automatic completion items in embed display mode - Given I am on "Course 1" course homepage with editing mode on - And I follow "Music history" - And I navigate to "Edit settings" in current page administration - And I set the following fields to these values: - | Display | Embed | - | Completion tracking | Show activity as complete when conditions are met | - | Require view | 1 | - And I press "Save and return to course" - # Teacher view. - And I follow "Music history" - And "Music history" should have the "View" completion condition - And I log out - # Student view. - When I log in as "student1" - And I am on "Course 1" course homepage - And I follow "Music history" + Scenario: View automatic completion items in embed display mode as teacher + Given the following "activity" exists: + | activity | url | + | course | C1 | + | idnumber | Music history | + | name | Music history | + | intro | URL description | + | externalurl | https://moodle.org/ | + | completion | 2 | + | completionview | 1 | + | display | 1 | + When I am on the "Music history" "url activity" page logged in as teacher1 + Then "Music history" should have the "View" completion condition + + Scenario: View automatic completion items in embed display mode as student + Given the following "activity" exists: + | activity | url | + | course | C1 | + | idnumber | Music history | + | name | Music history | + | intro | URL description | + | externalurl | https://moodle.org/ | + | completion | 2 | + | completionview | 1 | + | display | 1 | + When I am on the "Music history" "url activity" page logged in as student1 Then the "View" completion condition of "Music history" is displayed as "done" - Scenario: View automatic completion items in open display mode - Given I am on "Course 1" course homepage with editing mode on - And I follow "Music history" - And I navigate to "Edit settings" in current page administration - And I set the following fields to these values: - | Display | Open | - | Completion tracking | Show activity as complete when conditions are met | - | Require view | 1 | - And I press "Save and return to course" - # Teacher view. - And I follow "Music history" - And "Music history" should have the "View" completion condition - And I log out - # Student view. - When I log in as "student1" - And I am on "Course 1" course homepage - And I follow "Music history" + Scenario: View automatic completion items in open display mode as teacher + Given the following "activity" exists: + | activity | url | + | course | C1 | + | idnumber | Music history | + | name | Music history | + | intro | URL description | + | externalurl | https://moodle.org/ | + | completion | 2 | + | completionview | 1 | + | display | 5 | + When I am on the "Music history" "url activity" page logged in as teacher1 + And I am on the "Course 1" course page + Then "Music history" should have the "View" completion condition + + Scenario: View automatic completion items in open display mode as student + Given the following "activity" exists: + | activity | url | + | course | C1 | + | idnumber | Music history | + | name | Music history | + | intro | URL description | + | externalurl | https://moodle.org/ | + | completion | 2 | + | completionview | 1 | + | display | 5 | + When I am on the "Music history" "url activity" page logged in as student1 + And I am on the "Course 1" course page Then the "View" completion condition of "Music history" is displayed as "done" - Scenario: View automatic completion items in pop-up display mode - Given I am on "Course 1" course homepage with editing mode on - And I follow "Music history" - And I navigate to "Edit settings" in current page administration - And I set the following fields to these values: - | Display | In pop-up | - | Completion tracking | Show activity as complete when conditions are met | - | Require view | 1 | - And I press "Save and return to course" - # Teacher view. - And I follow "Music history" - And "Music history" should have the "View" completion condition - And I log out - # Student view. - When I log in as "student1" - And I am on "Course 1" course homepage - And I follow "Music history" + Scenario: View automatic completion items in pop-up display mode as teacher + Given the following "activity" exists: + | activity | url | + | course | C1 | + | idnumber | Music history | + | name | Music history | + | intro | URL description | + | externalurl | https://moodle.org/ | + | completion | 2 | + | completionview | 1 | + | display | 6 | + | popupwidth | 620 | + | popupheight | 450 | + When I am on the "Music history" "url activity" page logged in as student1 + Then "Music history" should have the "View" completion condition + + Scenario: View automatic completion items in pop-up display mode as student + Given the following "activity" exists: + | activity | url | + | course | C1 | + | idnumber | Music history | + | name | Music history | + | intro | URL description | + | externalurl | https://moodle.org/ | + | completion | 2 | + | completionview | 1 | + | display | 6 | + | popupwidth | 620 | + | popupheight | 450 | + When I am on the "Music history" "url activity" page logged in as student1 Then the "View" completion condition of "Music history" is displayed as "done" @javascript - Scenario: Use manual completion - Given I am on "Course 1" course homepage with editing mode on - And I follow "Music history" - And I navigate to "Edit settings" in current page administration - And I set the following fields to these values: - | Display | Automatic | - | Completion tracking | Students can manually mark the activity as completed | - And I press "Save and return to course" - # Teacher view. - And I follow "Music history" - And the manual completion button for "Music history" should be disabled - And I log out - # Student view. - When I log in as "student1" - And I am on "Course 1" course homepage - And I follow "Music history" + Scenario: Use manual completion with automatic URL as teacher + Given the following "activity" exists: + | activity | url | + | course | C1 | + | idnumber | Music history | + | name | Music history | + | intro | URL description | + | externalurl | https://moodle.org/ | + | completion | 1 | + | completionview | 1 | + | display | 0 | + When I am on the "Music history" "url activity" page logged in as teacher1 + Then the manual completion button for "Music history" should be disabled + + @javascript + Scenario: Use manual completion with automatic URL as student + Given the following "activity" exists: + | activity | url | + | course | C1 | + | idnumber | Music history | + | name | Music history | + | intro | URL description | + | externalurl | https://moodle.org/ | + | completion | 1 | + | completionview | 1 | + | display | 0 | + When I am on the "Course 1" course page logged in as student1 Then the manual completion button of "Music history" is displayed as "Mark as done" And I toggle the manual completion state of "Music history" And the manual completion button of "Music history" is displayed as "Done" @javascript - Scenario Outline: The manual completion button will be shown on the course page for Open, In pop-up and New window display mode if the Show activity completion conditions is set to No - Given I am on "Course 1" course homepage with editing mode on - And I navigate to "Edit settings" in current page administration - And I expand all fieldsets - And I set the following fields to these values: - | Enable completion tracking | Yes | - | Show activity completion conditions | No | - And I press "Save and display" - And I add a "URL" to section "1" and I fill the form with: - | Name | Music history | - | External URL | https://moodle.org/ | - | id_display | | - | Completion tracking | Students can manually mark the activity as completed | - # Teacher view. - And the manual completion button for "Music history" should exist + Scenario Outline: The manual completion button will be shown on the course page for Open, In pop-up and New window display mode if the Show activity completion conditions is set to No as teacher + Given the following "activity" exists: + | activity | url | + | course | C1 | + | idnumber | Music history | + | name | Music history | + | intro | URL description | + | externalurl | https://moodle.org/ | + | completion | 1 | + | completionview | 1 | + | display | | + | popupwidth | 620 | + | popupheight | 450 | + When I am on the "Course 1" course page logged in as teacher1 + Then the manual completion button for "Music history" should exist And the manual completion button for "Music history" should be disabled - And I log out - # Student view. - When I log in as "student1" - And I am on "Course 1" course homepage + + Examples: + | display | description | + | 0 | Auto | + | 6 | Popup | + | 3 | New | + + @javascript + Scenario Outline: The manual completion button will be shown on the course page for Open, In pop-up and New window display mode if the Show activity completion conditions is set to No as student + Given the following "activity" exists: + | activity | url | + | course | C1 | + | idnumber | Music history | + | name | Music history | + | intro | URL description | + | externalurl | https://moodle.org/ | + | completion | 1 | + | completionview | 1 | + | display | | + | popupwidth | 620 | + | popupheight | 450 | + When I am on the "Course 1" course page logged in as student1 Then the manual completion button for "Music history" should exist And the manual completion button of "Music history" is displayed as "Mark as done" And I toggle the manual completion state of "Music history" And the manual completion button of "Music history" is displayed as "Done" Examples: - | display | - | Open | - | In pop-up | - | New window | + | display | description | + | 0 | Auto | + | 6 | Popup | + | 3 | New | diff --git a/mod/wiki/tests/behat/collaborative_individual.feature b/mod/wiki/tests/behat/collaborative_individual.feature index 9bedf03e4c0c6..380763bb860db 100644 --- a/mod/wiki/tests/behat/collaborative_individual.feature +++ b/mod/wiki/tests/behat/collaborative_individual.feature @@ -19,33 +19,30 @@ Feature: A teacher can set a wiki to be collaborative or individual | teacher1 | C1 | editingteacher | | student1 | C1 | student | | student2 | C1 | student | - And I log in as "teacher1" - And I am on "Course 1" course homepage with editing mode on - And I add a "Wiki" to section "1" and I fill the form with: - | Wiki name | Collaborative wiki name | - | Description | Collaborative wiki description | - | First page name | Collaborative index | - | Wiki mode | Collaborative wiki | - And I follow "Collaborative wiki name" + And the following "activity" exists: + | course | C1 | + | activity | wiki | + | name | Collaborative wiki name | + | firstpagetitle | Collaborative index | + | wikimode | collaborative | + And the following "activity" exists: + | course | C1 | + | activity | wiki | + | name | Individual wiki name | + | firstpagetitle | Individual index | + | wikimode | individual | + And I am on the "Collaborative wiki name" "wiki activity" page logged in as teacher1 And I press "Create page" And I set the following fields to these values: | HTML format | Collaborative teacher1 edition | And I press "Save" - And I am on "Course 1" course homepage - And I add a "Wiki" to section "1" and I fill the form with: - | Wiki name | Individual wiki name | - | Description | Individual wiki description | - | First page name | Individual index | - | Wiki mode | Individual wiki | - And I follow "Individual wiki name" + And I am on the "Individual wiki name" "wiki activity" page And I press "Create page" And I set the following fields to these values: | HTML format | Individual teacher1 edition | And I press "Save" And I log out - And I log in as "student1" - And I am on "Course 1" course homepage - When I follow "Collaborative wiki name" + And I am on the "Collaborative wiki name" "wiki activity" page logged in as student1 Then I should see "Collaborative teacher1 edition" And I follow "Edit" And I set the following fields to these values: @@ -53,17 +50,14 @@ Feature: A teacher can set a wiki to be collaborative or individual And I press "Save" And I should not see "Collaborative teacher1 edition" And I should see "Collaborative student1 edition" - And I am on "Course 1" course homepage - And I follow "Individual wiki name" + And I am on the "Individual wiki name" "wiki activity" page And I should not see "Individual teacher1 edition" And I press "Create page" And I set the following fields to these values: | HTML format | Individual student1 edition | And I press "Save" And I log out - And I log in as "student2" - And I am on "Course 1" course homepage - And I follow "Individual wiki name" + And I am on the "Individual wiki name" "wiki activity" page logged in as student2 And I should not see "Individual teacher1 edition" And I should not see "Individual student1 edition" And I press "Create page" @@ -71,12 +65,9 @@ Feature: A teacher can set a wiki to be collaborative or individual | HTML format | Individual student2 edition | And I press "Save" And I log out - And I log in as "teacher1" - And I am on "Course 1" course homepage - And I follow "Collaborative wiki name" + And I am on the "Collaborative wiki name" "wiki activity" page logged in as teacher1 And I should see "Collaborative student1 edition" - And I am on "Course 1" course homepage - And I follow "Individual wiki name" + And I am on the "Individual wiki name" "wiki activity" page And I should see "Individual teacher1 edition" And I should not see "Individual student1 edition" And I set the field "uid" to "Student 1" diff --git a/mod/wiki/tests/behat/edit_tags.feature b/mod/wiki/tests/behat/edit_tags.feature index 9fe515ab28f8e..fa242ca40b8e6 100644 --- a/mod/wiki/tests/behat/edit_tags.feature +++ b/mod/wiki/tests/behat/edit_tags.feature @@ -16,19 +16,15 @@ Feature: Edited wiki pages handle tags correctly | 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 "Wiki" to section "1" and I fill the form with: - | Wiki name | Test wiki name | - | Description | Test wiki description | - | First page name | First page | - | Wiki mode | Collaborative wiki | - And I log out + And the following "activity" exists: + | course | C1 | + | activity | wiki | + | name | Test wiki name | + | firstpagetitle | First page | + | wikimode | collaborative | Scenario: Wiki page edition of custom tags works as expected - Given I log in as "student1" - And I am on "Course 1" course homepage - And I follow "Test wiki name" + Given I am on the "Test wiki name" "wiki activity" page logged in as student1 And I press "Create page" When I set the following fields to these values: | HTML format | Student page contents to be tagged | @@ -52,9 +48,7 @@ Feature: Edited wiki pages handle tags correctly And I set the field "Enter comma-separated list of new tags" to "OT1, OT2, OT3" And I press "Continue" And I log out - And I log in as "student1" - And I am on "Course 1" course homepage - And I follow "Test wiki name" + Given I am on the "Test wiki name" "wiki activity" page logged in as student1 And I press "Create page" And I open the autocomplete suggestions list And I should see "OT1" in the ".form-autocomplete-suggestions" "css_element" diff --git a/mod/wiki/tests/behat/page_history.feature b/mod/wiki/tests/behat/page_history.feature index 4e4d2ff64f475..638e692289b67 100644 --- a/mod/wiki/tests/behat/page_history.feature +++ b/mod/wiki/tests/behat/page_history.feature @@ -19,30 +19,25 @@ Feature: A history of each wiki page is available | teacher1 | C1 | editingteacher | | student1 | C1 | student | | student2 | C1 | student | - And I log in as "teacher1" - And I am on "Course 1" course homepage with editing mode on - And I add a "Wiki" to section "1" and I fill the form with: - | Wiki name | Test wiki name | - | Description | Test wiki description | - | First page name | First page | - | Wiki mode | Collaborative wiki | - And I follow "Test wiki name" + And the following "activity" exists: + | course | C1 | + | activity | wiki | + | name | Test wiki name | + | firstpagetitle | First page | + | wikimode | collaborative | + And I am on the "Test wiki name" "wiki activity" page logged in as teacher1 And I press "Create page" And I set the following fields to these values: | HTML format | First edition | And I press "Save" And I log out - When I log in as "student1" - And I am on "Course 1" course homepage - And I follow "Test wiki name" + When I am on the "Test wiki name" "wiki activity" page logged in as student1 And I follow "Edit" And I set the following fields to these values: | HTML format | Second edition | And I press "Save" And I log out - And I log in as "student2" - And I am on "Course 1" course homepage - And I follow "Test wiki name" + When I am on the "Test wiki name" "wiki activity" page logged in as student2 And I follow "Edit" And I set the following fields to these values: | HTML format | Third edition | diff --git a/mod/wiki/tests/behat/preview_page.feature b/mod/wiki/tests/behat/preview_page.feature index 554a9b45bc933..df69c2a914351 100644 --- a/mod/wiki/tests/behat/preview_page.feature +++ b/mod/wiki/tests/behat/preview_page.feature @@ -19,13 +19,10 @@ Feature: Edited wiki pages may be previewed before saving And the following "activity" exists: | activity | wiki | | course | C1 | - | idnumber | 0001 | | name | Test wiki name | | intro | Test wiki description | | wikimode | collaborative | - And I log in as "student1" - And I am on "Course 1" course homepage - And I follow "Test wiki name" + And I am on the "Test wiki name" "wiki activity" page logged in as student1 When I press "Create page" And I set the following fields to these values: | HTML format | Student page contents to be previewed | diff --git a/mod/wiki/tests/behat/reset_wiki_comments_tags_files.feature b/mod/wiki/tests/behat/reset_wiki_comments_tags_files.feature index 5d83c9dd9f391..998c4e8a8a6af 100644 --- a/mod/wiki/tests/behat/reset_wiki_comments_tags_files.feature +++ b/mod/wiki/tests/behat/reset_wiki_comments_tags_files.feature @@ -14,13 +14,13 @@ Feature: Teachers can reset wiki pages, tags and files And the following "course enrolments" exist: | user | course | role | | teacher1 | C1 | editingteacher | - And I log in as "teacher1" - And I am on "Course 1" course homepage with editing mode on - And I add a "Wiki" to section "1" and I fill the form with: - | Wiki name | Test wiki | - | Description | Test wiki description | - | First page name | Test wiki page | - And I follow "Test wiki" + And the following "activity" exists: + | activity | wiki | + | course | C1 | + | name | Test wiki name | + | intro | Test wiki description | + | wikimode | collaborative | + And I am on the "Test wiki name" "wiki activity" page logged in as teacher1 And I press "Create page" And I set the following fields to these values: | HTML format | Test wiki content | @@ -43,7 +43,7 @@ Feature: Teachers can reset wiki pages, tags and files And I navigate to "Reset" in current page administration Scenario: Reset page, tags and files - And I set the following fields to these values: + Given I set the following fields to these values: | Delete all wiki pages | 1 | | Remove all wiki tags | 1 | | reset_wiki_comments | 1 | @@ -52,7 +52,7 @@ Feature: Teachers can reset wiki pages, tags and files And I should see "Wiki tags have been deleted" And I should see "Delete all comments" And I press "Continue" - And I follow "Test wiki" + And I am on the "Test wiki name" "wiki activity" page And I press "Create page" When I follow "View" Then I should not see "Test tag 1" @@ -63,14 +63,14 @@ Feature: Teachers can reset wiki pages, tags and files And I should not see "empty.txt" Scenario: Reset only tags - And I set the following fields to these values: + Given I set the following fields to these values: | Remove all wiki tags | 1 | - And I press "Reset course" + When I press "Reset course" And I should not see "Delete all wiki pages" And I should see "Wiki tags have been deleted" And I should not see "Delete all comments" And I press "Continue" - And I follow "Test wiki" + And I am on the "Test wiki name" "wiki activity" page Then I should not see "Test tag 1" And I should not see "Test tag 2" And I follow "Comments" @@ -79,14 +79,14 @@ Feature: Teachers can reset wiki pages, tags and files And I should see "empty.txt" Scenario: Reset only comments - And I set the following fields to these values: + Given I set the following fields to these values: | reset_wiki_comments | 1 | - And I press "Reset course" + When I press "Reset course" And I should not see "Delete all wiki pages" And I should not see "Wiki tags have been deleted" And I should see "Delete all comments" And I press "Continue" - When I follow "Test wiki" + And I am on the "Test wiki name" "wiki activity" page Then I should see "Test tag 1" And I should see "Test tag 2" And I follow "Comments" diff --git a/mod/wiki/tests/behat/wiki_activity_completion.feature b/mod/wiki/tests/behat/wiki_activity_completion.feature index 7b80b394c3151..e4eb48bd38a23 100644 --- a/mod/wiki/tests/behat/wiki_activity_completion.feature +++ b/mod/wiki/tests/behat/wiki_activity_completion.feature @@ -10,20 +10,12 @@ Feature: View activity completion information in the Wiki activity | student1 | Vinnie | Student1 | student1@example.com | | teacher1 | Darrell | Teacher1 | teacher1@example.com | And the following "courses" exist: - | fullname | shortname | category | - | Course 1 | C1 | 0 | + | fullname | shortname | enablecompletion | showcompletionconditions | + | Course 1 | C1 | 1 | 1 | And the following "course enrolments" exist: | user | course | role | | student1 | C1 | student | | teacher1 | C1 | editingteacher | - And I log in as "teacher1" - And I am on "Course 1" course homepage - And I navigate to "Edit settings" in current page administration - And I expand all fieldsets - And I set the following fields to these values: - | Enable completion tracking | Yes | - | Show activity completion conditions | Yes | - And I press "Save and display" And the following "activity" exists: | activity | wiki | | course | C1 | @@ -32,15 +24,12 @@ Feature: View activity completion information in the Wiki activity | section | 1 | | completion | 2 | | completionview | 1 | - And I am on "Course 1" course homepage - And I follow "Music history" + And I am on the "Music history" "wiki activity" page logged in as teacher1 And I click on "Create page" "button" And I log out Scenario: View automatic completion items as a teacher and confirm all tabs display conditions - Given I log in as "teacher1" - And I am on "Course 1" course homepage - When I follow "Music history" + When I am on the "Music history" "wiki activity" page logged in as teacher1 Then "Music history" should have the "View" completion condition And I click on "Edit" "link" in the "region-main" "region" And "Music history" should have the "View" completion condition @@ -54,17 +43,13 @@ Feature: View activity completion information in the Wiki activity And "Music history" should have the "View" completion condition Scenario: View automatic completion items as a student - Given I log in as "student1" - When I am on "Course 1" course homepage - And I follow "Music history" + When I am on the "Music history" "wiki activity" page logged in as student1 Then the "View" completion condition of "Music history" is displayed as "done" @javascript Scenario: Use manual completion - Given I log in as "teacher1" - And I am on "Course 1" course homepage - And I follow "Music history" - And I navigate to "Edit settings" in current page administration + Given I am on the "Music history" "wiki activity" page logged in as teacher1 + And I am on the "Music history" "wiki activity editing" page And I expand all fieldsets And I press "Unlock completion options" And I set the field "Completion tracking" to "Students can manually mark the activity as completed" @@ -73,9 +58,7 @@ Feature: View activity completion information in the Wiki activity And the manual completion button for "Music history" should be disabled And I log out # Student view. - When I log in as "student1" - And I am on "Course 1" course homepage - And I follow "Music history" + When I am on the "Music history" "wiki activity" page logged in as student1 Then the manual completion button of "Music history" is displayed as "Mark as done" And I toggle the manual completion state of "Music history" And the manual completion button of "Music history" is displayed as "Done" diff --git a/mod/wiki/tests/behat/wiki_comments.feature b/mod/wiki/tests/behat/wiki_comments.feature index 6391e9fc1761b..2f397512cd5ec 100644 --- a/mod/wiki/tests/behat/wiki_comments.feature +++ b/mod/wiki/tests/behat/wiki_comments.feature @@ -18,22 +18,20 @@ Feature: Users can comment on wiki pages | teacher1 | C1 | editingteacher | | student1 | C1 | student | | student2 | C1 | student | - And I log in as "teacher1" - And I am on "Course 1" course homepage with editing mode on - And I add a "Wiki" to section "1" and I fill the form with: - | Wiki name | Test wiki name | - | Description | Test wiki description | - | First page name | First page | - | Wiki mode | Collaborative wiki | - And I follow "Test wiki name" + And the following "activity" exists: + | activity | wiki | + | course | C1 | + | name | Test wiki name | + | intro | Test wiki description | + | firstpagetitle | First page | + | wikimode | collaborative | + And I am on the "Test wiki name" "wiki activity" page logged in as teacher1 And I press "Create page" And I set the following fields to these values: | HTML format | First edition | And I press "Save" And I log out - And I log in as "student1" - And I am on "Course 1" course homepage - And I follow "Test wiki name" + And I am on the "Test wiki name" "wiki activity" page logged in as student1 And I follow "Comments" And I follow "Add comment" And I set the following fields to these values: @@ -57,9 +55,7 @@ Feature: Users can comment on wiki pages @javascript Scenario: Student cannot edit another student's comment When I log out - And I log in as "student2" - And I am on "Course 1" course homepage - And I follow "Test wiki name" + And I am on the "Test wiki name" "wiki activity" page logged in as student2 And I follow "Comments" Then "Edit" "link" should not exist in the "wiki-comments" "table" And "Delete" "link" should not exist in the "wiki-comments" "table" @@ -67,9 +63,7 @@ Feature: Users can comment on wiki pages @javascript Scenario: Teacher can delete a student comment When I log out - And I log in as "teacher1" - And I am on "Course 1" course homepage - And I follow "Test wiki name" + And I am on the "Test wiki name" "wiki activity" page logged in as teacher1 And I follow "Comments" Then "Edit" "link" should not exist in the "wiki-comments" "table" And "Delete" "link" should exist in the "wiki-comments" "table" diff --git a/mod/wiki/tests/behat/wiki_formats.feature b/mod/wiki/tests/behat/wiki_formats.feature index 2c06b82631965..d8fc2f6074231 100644 --- a/mod/wiki/tests/behat/wiki_formats.feature +++ b/mod/wiki/tests/behat/wiki_formats.feature @@ -14,13 +14,13 @@ Feature: There is a choice of formats for editing a wiki page And the following "course enrolments" exist: | user | course | role | | teacher1 | C1 | editingteacher | - And I log in as "teacher1" - And I am on "Course 1" course homepage with editing mode on - And I add a "Wiki" to section "1" and I fill the form with: - | Wiki name | Test wiki name | - | Description | Test wiki description | - | First page name | First page | - And I follow "Test wiki name" + And the following "activity" exists: + | activity | wiki | + | course | C1 | + | name | Test wiki name | + | wikimode | collaborative | + | firstpagetitle | First page | + And I am on the "Test wiki name" "wiki activity" page logged in as teacher1 @javascript Scenario: Creole format diff --git a/mod/wiki/tests/behat/wiki_search.feature b/mod/wiki/tests/behat/wiki_search.feature index e71436f1f60d1..47d10cd91082b 100644 --- a/mod/wiki/tests/behat/wiki_search.feature +++ b/mod/wiki/tests/behat/wiki_search.feature @@ -21,23 +21,20 @@ Feature: Users can search wikis @javascript Scenario: Searching collaborative wiki - Given I log in as "teacher1" - And I am on "Course 1" course homepage with editing mode on - And I add a "Wiki" to section "1" and I fill the form with: - | Wiki name | Collaborative wiki name | - | Description | Collaborative wiki description | - | First page name | Collaborative index | - | Wiki mode | Collaborative wiki | - And I follow "Collaborative wiki name" + Given the following "activity" exists: + | activity | wiki | + | course | C1 | + | name | Collaborative wiki name | + | wikimode | collaborative | + | firstpagetitle | First page | + And I am on the "Collaborative wiki name" "wiki activity" page logged in as teacher1 And I press "Create page" And I set the following fields to these values: | HTML format | Collaborative teacher1 page [[new page]] | And I press "Save" And I am on "Course 1" course homepage And I log out - And I log in as "student1" - And I am on "Course 1" course homepage - And I follow "Collaborative wiki name" + And I am on the "Collaborative wiki name" "wiki activity" page logged in as student1 And I follow "new page" And I press "Create page" And I set the following fields to these values: @@ -55,26 +52,22 @@ Feature: Users can search wikis And I press "Search wikis" And I should not see "New page created by student1" And I should see "Collaborative teacher1 page" - And I log out @javascript Scenario: Searching individual wiki - Given I log in as "teacher1" - And I am on "Course 1" course homepage with editing mode on - And I add a "Wiki" to section "1" and I fill the form with: - | Wiki name | Individual wiki name | - | Description | Individual wiki description | - | First page name | Individual index | - | Wiki mode | Individual wiki | - And I follow "Individual wiki name" + Given the following "activity" exists: + | activity | wiki | + | course | C1 | + | name | Individual wiki name | + | wikimode | individual | + | firstpagetitle | First page | + And I am on the "Individual wiki name" "wiki activity" page logged in as teacher1 And I press "Create page" And I set the following fields to these values: | HTML format | Individual teacher1 page | And I press "Save" And I log out - And I log in as "student1" - And I am on "Course 1" course homepage - And I follow "Individual wiki name" + And I am on the "Individual wiki name" "wiki activity" page logged in as student1 And I press "Create page" And I set the following fields to these values: | HTML format | Individual student1 page | @@ -84,9 +77,7 @@ Feature: Users can search wikis Then I should see "Individual student1 page" And I should not see "Individual teacher1 page" And I log out - And I log in as "student2" - And I am on "Course 1" course homepage - And I follow "Individual wiki name" + And I am on the "Individual wiki name" "wiki activity" page logged in as student2 And I press "Create page" And I set the following fields to these values: | HTML format | Individual student2 page | @@ -97,9 +88,7 @@ Feature: Users can search wikis And I should not see "Individual student1 page" And I should not see "Individual teacher1 page" And I log out - And I log in as "teacher1" - And I am on "Course 1" course homepage - And I follow "Individual wiki name" + And I am on the "Individual wiki name" "wiki activity" page logged in as teacher1 And I set the field "searchstring" to "page" And I press "Search wikis" And I should see "Individual teacher1 page" @@ -113,27 +102,25 @@ Feature: Users can search wikis And I should not see "Individual teacher1 page" And I should not see "Individual student1 page" And I should see "Individual student2 page" - And I log out @javascript Scenario: Searching group wiki Given the following "groups" exist: - | name | course | idnumber | - | Group1 | C1 | G1 | - | Group2 | C1 | G2 | + | name | course | idnumber | + | Group1 | C1 | G1 | + | Group2 | C1 | G2 | And the following "group members" exist: - | user | group | - | student1 | G1 | - | student2 | G2 | - And I log in as "teacher1" - And I am on "Course 1" course homepage with editing mode on - And I add a "Wiki" to section "1" and I fill the form with: - | Wiki name | Group wiki name | - | Description | Wiki description | - | First page name | Groups index | - | Wiki mode | Collaborative wiki | - | Group mode | Separate groups | - And I follow "Group wiki name" + | user | group | + | student1 | G1 | + | student2 | G2 | + Given the following "activity" exists: + | activity | wiki | + | course | C1 | + | name | Group wiki name | + | wikimode | collaborative | + | firstpagetitle | Groups pag | + | groupmode | 1 | + And I am on the "Group wiki name" "wiki activity" page logged in as teacher1 And I set the field "Group" to "All participants" And I press "Create page" And I set the following fields to these values: @@ -150,9 +137,7 @@ Feature: Users can search wikis | HTML format | Group2 teacher1 page [[new page2]] | And I press "Save" And I log out - And I log in as "student1" - And I am on "Course 1" course homepage - And I follow "Group wiki name" + And I am on the "Group wiki name" "wiki activity" page logged in as student1 And I follow "new page1" And I press "Create page" And I set the following fields to these values: @@ -165,9 +150,7 @@ Feature: Users can search wikis And I should see "Group1 student1 new page" And I should not see "All participants teacher1 page" And I log out - And I log in as "student2" - And I am on "Course 1" course homepage - And I follow "Group wiki name" + And I am on the "Group wiki name" "wiki activity" page logged in as student2 And I follow "new page2" And I press "Create page" And I set the following fields to these values: @@ -178,9 +161,5 @@ Feature: Users can search wikis And I should not see "Group1 teacher1 page" And I should see "Group2 teacher1 page" And I should not see "Group1 student1 new page" - And I should see "Group2 student2 new page" And I should not see "All participants teacher1 page" - And I log out - And I log in as "teacher1" - And I am on "Course 1" course homepage - And I follow "Group wiki name" + And I should see "Group2 student2 new page" diff --git a/mod/workshop/allocation/manual/tests/behat/behat_workshopallocation_manual.php b/mod/workshop/allocation/manual/tests/behat/behat_workshopallocation_manual.php index 668d27fc48b42..4ad7fd94bf19c 100644 --- a/mod/workshop/allocation/manual/tests/behat/behat_workshopallocation_manual.php +++ b/mod/workshop/allocation/manual/tests/behat/behat_workshopallocation_manual.php @@ -87,7 +87,7 @@ public function i_add_a_reviewer_for_workshop_participant($reviewername, $partic * @param TableNode $table should have one column with title 'Reviewer' and another with title 'Participant' (or 'Reviewee') */ public function i_allocate_submissions_in_workshop_as($workshopname, TableNode $table) { - $this->execute('behat_general::i_click_on', [$workshopname, 'link']); + $this->execute("behat_general::i_click_on_in_the", [$this->escape($workshopname), 'link', 'page', 'region']); $this->execute('behat_navigation::i_navigate_to_in_current_page_administration', get_string('allocate', 'workshop')); $rows = $table->getRows(); $reviewer = $participant = null; diff --git a/mod/workshop/tests/behat/behat_mod_workshop.php b/mod/workshop/tests/behat/behat_mod_workshop.php index 1d62d6b45342b..734bb8c49f3a8 100644 --- a/mod/workshop/tests/behat/behat_mod_workshop.php +++ b/mod/workshop/tests/behat/behat_mod_workshop.php @@ -52,7 +52,7 @@ public function i_change_phase_in_workshop_to($workshopname, $phase) { $xpath = "//*[@class='userplan']/descendant::div[./span[contains(.,$phaseliteral)]]"; $continue = $this->escape(get_string('continue')); - $this->execute('behat_general::click_link', $workshopname); + $this->execute("behat_general::i_click_on_in_the", [$this->escape($workshopname), 'link', 'page', 'region']); $this->execute('behat_general::i_click_on_in_the', array('a.action-icon', "css_element", $this->escape($xpath), "xpath_element") @@ -73,7 +73,7 @@ public function i_add_a_submission_in_workshop_as($workshopname, $table) { $savechanges = $this->escape(get_string('savechanges')); $xpath = "//div[contains(concat(' ', normalize-space(@class), ' '), ' ownsubmission ')]/descendant::*[@type='submit']"; - $this->execute('behat_general::click_link', $workshopname); + $this->execute("behat_navigation::i_am_on_page_instance", [$this->escape($workshopname), 'workshop activity']); $this->execute("behat_general::i_click_on", array($xpath, "xpath_element")); @@ -90,7 +90,7 @@ public function i_add_a_submission_in_workshop_as($workshopname, $table) { * @param TableNode $table data to fill the submission form with, must contain 'Title' */ public function i_edit_assessment_form_in_workshop_as($workshopname, $table) { - $this->execute('behat_general::click_link', $workshopname); + $this->execute("behat_navigation::i_am_on_page_instance", [$this->escape($workshopname), 'workshop activity']); $this->execute('behat_navigation::i_navigate_to_in_current_page_administration', get_string('editassessmentform', 'workshop')); @@ -116,7 +116,7 @@ public function i_assess_submission_in_workshop_as($submission, $workshopname, T $assess = $this->escape(get_string('assess', 'workshop')); $saveandclose = $this->escape(get_string('saveandclose', 'workshop')); - $this->execute('behat_general::click_link', $workshopname); + $this->execute("behat_navigation::i_am_on_page_instance", [$workshopname, 'workshop activity']); $this->execute('behat_general::i_click_on_in_the', array($assess, "button", $xpath, "xpath_element") diff --git a/mod/workshop/tests/behat/embedded_images.feature b/mod/workshop/tests/behat/embedded_images.feature index 44eb15ba427f4..177c1caad29e3 100644 --- a/mod/workshop/tests/behat/embedded_images.feature +++ b/mod/workshop/tests/behat/embedded_images.feature @@ -23,9 +23,7 @@ Feature: Teachers can embed images into instructions and conclusion fields # Create and edit the workshop. When I add a "Workshop" to section "1" and I fill the form with: | Workshop name | Workshop with embedded images | - And I follow "Workshop with embedded images" - # Embed the image into Instructions for submission. - And I navigate to "Edit settings" in current page administration + And I am on the "Workshop with embedded images" "workshop activity editing" page And I expand all fieldsets And I set the field "Instructions for submission" to "

Image test

" And I select the text in the "Instructions for submission" Atto editor diff --git a/mod/workshop/tests/behat/file_type_restriction.feature b/mod/workshop/tests/behat/file_type_restriction.feature index 0992e783f3f32..bde4d7ebf29c3 100644 --- a/mod/workshop/tests/behat/file_type_restriction.feature +++ b/mod/workshop/tests/behat/file_type_restriction.feature @@ -25,9 +25,7 @@ Feature: File types of the submission and feedback attachments can be limitted @_file_upload @javascript Scenario: Student submission attachments obey the list of allowed file types # Define workshop to accept only images as submission attachments. - Given I log in as "teacher1" - And I am on "Course1" course homepage - And I follow "TestWorkshop" + Given I am on the TestWorkshop "workshop activity" page logged in as teacher1 And I navigate to "Edit settings" in current page administration And I expand all fieldsets And I set the field "Submission attachment allowed file types" to "image" @@ -35,9 +33,7 @@ Feature: File types of the submission and feedback attachments can be limitted And I change phase in workshop "TestWorkshop" to "Submission phase" And I log out # As a student, attempt to attach a non-image file. - And I log in as "student1" - And I am on "Course1" course homepage - And I follow "TestWorkshop" + And I am on the TestWorkshop "workshop activity" page logged in as student1 And I press "Add submission" And I set the following fields to these values: | Title | Submission1 | @@ -68,8 +64,7 @@ Feature: File types of the submission and feedback attachments can be limitted | id_description__idx_0_editor | Aspect1 | | id_description__idx_1_editor | Aspect2 | | id_description__idx_2_editor | | - And I follow "TestWorkshop" - And I navigate to "Edit settings" in current page administration + And I am on the TestWorkshop "workshop activity editing" page And I expand all fieldsets And I set the field "Maximum number of overall feedback attachments" to "2" And I set the field "Feedback attachment allowed file types" to "PHP" @@ -77,26 +72,20 @@ Feature: File types of the submission and feedback attachments can be limitted And I change phase in workshop "TestWorkshop" to "Submission phase" And I log out # As a student, attempt to attach an invalid file. - And I log in as "student1" - And I am on "Course1" course homepage - And I follow "TestWorkshop" + And I am on the TestWorkshop "workshop activity" page logged in as student1 And I add a submission in workshop "TestWorkshop" as:" | Title | Submission1 | | Submission content | Some content | And I log out # As a teacher, allocate that submission to be assessed by another student. - And I log in as "teacher1" - And I am on "Course1" course homepage - And I follow "TestWorkshop" + And I am on the TestWorkshop "workshop activity" page logged in as teacher1 And I allocate submissions in workshop "TestWorkshop" as:" | Participant | Reviewer | | Sam1 Student1 | Sam2 Student2 | And I change phase in workshop "TestWorkshop" to "Assessment phase" And I log out # As the other student, assess the assigned submission. - And I log in as "student2" - And I am on "Course1" course homepage - And I follow "TestWorkshop" + And I am on the TestWorkshop "workshop activity" page logged in as student2 And I follow "Submission1" And I press "Assess" And I set the following fields to these values: diff --git a/mod/workshop/tests/behat/grade_to_pass.feature b/mod/workshop/tests/behat/grade_to_pass.feature index 25a42b76930bf..91fb3ecbd5625 100644 --- a/mod/workshop/tests/behat/grade_to_pass.feature +++ b/mod/workshop/tests/behat/grade_to_pass.feature @@ -16,20 +16,15 @@ Feature: Setting grades to pass via workshop editing form | teacher1 | c1 | editingteacher | Scenario: Adding a new workshop with grade to pass field set - Given I log in as "teacher1" - And the following "activities" exist: + Given the following "activities" exist: | activity | name | intro | course | idnumber | section | | workshop | Awesome workshop | Grades to pass are set here | c1 | workshop1 | 1 | - And I am on "Course1" course homepage - And I follow "Awesome workshop" - And I navigate to "Edit settings" in current page administration + When I am on the "Awesome workshop" "workshop activity editing" page logged in as teacher1 And I set the field "Submission grade to pass" to "45" And I set the field "Assessment grade to pass" to "10.5" And I press "Save and return to course" - And I am on "Course1" course homepage - And I follow "Awesome workshop" - And I navigate to "Edit settings" in current page administration - And the field "Submission grade to pass" matches value "45.00" + And I am on the "Awesome workshop" "workshop activity editing" page + Then the field "Submission grade to pass" matches value "45.00" And the field "Assessment grade to pass" matches value "10.50" @javascript @@ -43,69 +38,54 @@ Feature: Setting grades to pass via workshop editing form | Assessment grade to pass | 10.1 | | submissiontypetextavailable | 0 | Then I should not see "Adding a new Workshop" - And I follow "Another workshop" - And I navigate to "Edit settings" in current page administration + And I am on the "Another workshop" "workshop activity editing" page And the field "Submission grade to pass" matches value "42.00" And the field "Assessment grade to pass" matches value "10.10" Scenario: Adding a new workshop with grade to pass fields left empty - Given I log in as "teacher1" - And the following "activities" exist: + Given the following "activities" exist: | activity | name | intro | course | idnumber | section | | workshop | Another awesome workshop | No grades to pass are set here | c1 | workshop1 | 1 | - And I am on "Course1" course homepage with editing mode on - And I follow "Another awesome workshop" - And I navigate to "Edit settings" in current page administration - And the field "Submission grade to pass" matches value "0.00" + When I am on the "Another awesome workshop" "workshop activity editing" page logged in as teacher1 + Then the field "Submission grade to pass" matches value "0.00" And the field "Assessment grade to pass" matches value "0.00" Scenario: Adding a new workshop with non-numeric value of a grade to pass - Given I log in as "teacher1" - And the following "activities" exist: + Given the following "activities" exist: | activity | name | intro | course | idnumber | section | | workshop | Another awesome workshop | Invalid grade to pass is set here | c1 | workshop1 | 1 | - And I am on "Course1" course homepage - And I follow "Another awesome workshop" - And I navigate to "Edit settings" in current page administration + When I am on the "Another awesome workshop" "workshop activity editing" page logged in as teacher1 And I set the field "Assessment grade to pass" to "You shall not pass!" And I press "Save and return to course" Then I should see "Updating Workshop in Topic 1" And I should see "You must enter a number here" Scenario: Adding a new workshop with invalid value of a grade to pass - Given I log in as "teacher1" - And the following "activities" exist: + Given the following "activities" exist: | activity | name | intro | course | idnumber | section | | workshop | Almost awesome workshop | Invalid grade to pass is set here | c1 | workshop1 | 1 | - And I am on "Course1" course homepage - And I follow "Almost awesome workshop" - And I navigate to "Edit settings" in current page administration + When I am on the "Almost awesome workshop" "workshop activity editing" page logged in as teacher1 And I set the field "Assessment grade to pass" to "10000000" And I press "Save and return to course" Then I should see "Updating Workshop in Topic 1" And I should see "The grade to pass can not be greater than the maximum possible grade" Scenario: Emptying grades to pass fields sets them to zero - Given I log in as "teacher1" - And the following "activities" exist: + Given the following "activities" exist: | activity | name | intro | course | idnumber | section | | workshop | Super awesome workshop | Grade to pass are set and then unset here | c1 | workshop1 | 1 | - And I am on "Course1" course homepage - And I follow "Super awesome workshop" - And I navigate to "Edit settings" in current page administration + When I am on the "Super awesome workshop" "workshop activity editing" page logged in as teacher1 And I set the field "Submission grade to pass" to "59.99" And I set the field "Assessment grade to pass" to "0.000" And I press "Save and return to course" And I should not see "Updating Workshop in Topic 1" - And I follow "Super awesome workshop" - And I navigate to "Edit settings" in current page administration + And I am on the "Super awesome workshop" "workshop activity editing" page And the field "Submission grade to pass" matches value "59.99" And the field "Assessment grade to pass" matches value "0.00" When I set the field "Submission grade to pass" to "" And I set the field "Assessment grade to pass" to "" And I press "Save and display" Then I should not see "Adding a new Workshop" - And I follow "Super awesome workshop" - And I navigate to "Edit settings" in current page administration + And I am on the "Super awesome workshop" "workshop activity editing" page And the field "Submission grade to pass" matches value "0.00" And the field "Assessment grade to pass" matches value "0.00" diff --git a/mod/workshop/tests/behat/submission_types.feature b/mod/workshop/tests/behat/submission_types.feature index 36280231a662b..dbdcf603d941f 100644 --- a/mod/workshop/tests/behat/submission_types.feature +++ b/mod/workshop/tests/behat/submission_types.feature @@ -69,8 +69,7 @@ Feature: Submission types Given the following "activities" exist: | activity | name | intro | course | idnumber | submissiontypetext | submissiontypefile | | workshop | All required | Test workshop description | TEST | workshop1 | 2 | 2 | - And I am on "Test" course homepage - And I follow "All required" + And I am on the "All required" "workshop activity" page And I follow "Switch to the submission phase" And I press "Continue" And I press "Add submission" @@ -91,8 +90,7 @@ Feature: Submission types Given the following "activities" exist: | activity | name | intro | course | idnumber | submissiontypetext | submissiontypefile | | workshop | Optional file | Test workshop description | TEST | workshop1 | 2 | 1 | - And I am on "Test" course homepage - And I follow "Optional file" + And I am on the "Optional file" "workshop activity" page And I follow "Switch to the submission phase" And I press "Continue" And I press "Add submission" @@ -111,8 +109,7 @@ Feature: Submission types Given the following "activities" exist: | activity | name | intro | course | idnumber | submissiontypetext | submissiontypefile | | workshop | Optional text | Test workshop description | TEST | workshop1 | 1 | 2 | - And I am on "Test" course homepage - And I follow "Optional text" + And I am on the "Optional text" "workshop activity" page And I follow "Switch to the submission phase" And I press "Continue" And I press "Add submission" @@ -130,8 +127,7 @@ Feature: Submission types Given the following "activities" exist: | activity | name | intro | course | idnumber | submissiontypetext | submissiontypefile | | workshop | Only text | Test workshop description | TEST | workshop1 | 2 | 0 | - And I am on "Test" course homepage - And I follow "Only text" + And I am on the "Only text" "workshop activity" page And I follow "Switch to the submission phase" And I press "Continue" When I press "Add submission" @@ -151,8 +147,7 @@ Feature: Submission types Given the following "activities" exist: | activity | name | intro | course | idnumber | submissiontypetext | submissiontypefile | | workshop | Only file | Test workshop description | TEST | workshop1 | 0 | 2 | - And I am on "Test" course homepage - And I follow "Only file" + And I am on the "Only file" "workshop activity" page And I follow "Switch to the submission phase" And I press "Continue" When I press "Add submission" @@ -173,8 +168,7 @@ Feature: Submission types Given the following "activities" exist: | activity | name | intro | course | idnumber | | workshop | Neither required | Test workshop description | TEST | workshop1 | - And I am on "Test" course homepage - And I follow "Neither required" + And I am on the "Neither required" "workshop activity" page And I follow "Switch to the submission phase" And I press "Continue" And I press "Add submission" diff --git a/mod/workshop/tests/behat/workshop_activity_completion.feature b/mod/workshop/tests/behat/workshop_activity_completion.feature index 39b698531e819..56758adf269ee 100644 --- a/mod/workshop/tests/behat/workshop_activity_completion.feature +++ b/mod/workshop/tests/behat/workshop_activity_completion.feature @@ -11,30 +11,18 @@ Feature: View activity completion information in the Workshop activity | student2 | Rex | Student2 | student2@example.com | | teacher1 | Darrell | Teacher1 | teacher1@example.com | And the following "courses" exist: - | fullname | shortname | category | - | Course 1 | C1 | 0 | + | fullname | shortname | enablecompletion | showcompletionconditions | + | Course 1 | C1 | 1 | 1 | And the following "course enrolments" exist: | user | course | role | | student1 | C1 | student | | student2 | C1 | student | | teacher1 | C1 | editingteacher | And the following "activities" exist: - | activity | name | intro | course | idnumber | submissiontypefile | - | workshop | Music history | Test workshop description | C1 | workshop1 | 1 | - And I log in as "teacher1" - And I am on "Course 1" course homepage - And I navigate to "Edit settings" in current page administration - And I expand all fieldsets + | activity | name | intro | course | submissiontypefile | completion | completionview | + | workshop | Music history | Test workshop description | C1 | 1 | 2 | 1 | + And I am on the "Music history" "workshop activity editing" page logged in as teacher1 And I set the following fields to these values: - | Enable completion tracking | Yes | - | Show activity completion conditions | Yes | - And I press "Save and display" - And I turn editing mode on - And I follow "Music history" - And I navigate to "Edit settings" in current page administration - And I set the following fields to these values: - | Completion tracking | Show activity as complete when conditions are met | - | Require view | 1 | | Require grade | Submission | And I press "Save and return to course" And I edit assessment form in workshop "Music history" as:" @@ -43,16 +31,12 @@ Feature: View activity completion information in the Workshop activity And I log out Scenario: View automatic completion items as a teacher - Given I log in as "teacher1" - And I am on "Course 1" course homepage - When I follow "Music history" + Given I am on the "Music history" "workshop activity" page logged in as teacher1 Then "Music history" should have the "Receive a grade" completion condition And "Music history" should have the "View" completion condition Scenario: View automatic completion items as a student - Given I log in as "student1" - And I am on "Course 1" course homepage - And I follow "Music history" + Given I am on the "Music history" "workshop activity" page logged in as student1 And the "View" completion condition of "Music history" is displayed as "done" And the "Receive a grade" completion condition of "Music history" is displayed as "todo" # Add a submission. @@ -69,9 +53,7 @@ Feature: View activity completion information in the Workshop activity | Vinnie Student1 | Rex Student2 | And I log out # Assess the submission. - And I log in as "student2" - And I am on "Course 1" course homepage - And I follow "Music history" + And I am on the "Music history" "workshop activity" page logged in as student2 And I assess submission "Pinch harmonics" in workshop "Music history" as:" | grade__idx_0 | 9 / 10 | | peercomment__idx_0 | Well done | @@ -85,18 +67,14 @@ Feature: View activity completion information in the Workshop activity And I change phase in workshop "Music history" to "Closed" And I log out # Confirm completion condition is updated. - When I log in as "student1" - And I am on "Course 1" course homepage - And I follow "Music history" + When I am on the "Music history" "workshop activity" page logged in as student1 Then the "View" completion condition of "Music history" is displayed as "done" And the "Receive a grade" completion condition of "Music history" is displayed as "done" @javascript Scenario: Use manual completion - Given I log in as "teacher1" - And I am on "Course 1" course homepage - And I follow "Music history" - And I navigate to "Edit settings" in current page administration + Given I am on the "Music history" "workshop activity" page logged in as teacher1 + And I am on the "Music history" "workshop activity editing" page And I expand all fieldsets And I set the field "Completion tracking" to "Students can manually mark the activity as completed" And I press "Save and display" @@ -104,9 +82,7 @@ Feature: View activity completion information in the Workshop activity And the manual completion button for "Music history" should be disabled And I log out # Student view. - When I log in as "student1" - And I am on "Course 1" course homepage - And I follow "Music history" + When I am on the "Music history" "workshop activity" page logged in as student1 Then the manual completion button of "Music history" is displayed as "Mark as done" And I toggle the manual completion state of "Music history" And the manual completion button of "Music history" is displayed as "Done" diff --git a/mod/workshop/tests/behat/workshop_assessment.feature b/mod/workshop/tests/behat/workshop_assessment.feature index 69e4fcb6b9fc7..c8951c4e0546b 100644 --- a/mod/workshop/tests/behat/workshop_assessment.feature +++ b/mod/workshop/tests/behat/workshop_assessment.feature @@ -35,9 +35,7 @@ Feature: Workshop submission and assessment And I change phase in workshop "TestWorkshop" to "Submission phase" And I log out # student1 submits - And I log in as "student1" - And I am on "Course1" course homepage - And I follow "TestWorkshop" + And I am on the TestWorkshop "workshop activity" page logged in as student1 Then I should see "Submit your work" And I add a submission in workshop "TestWorkshop" as:" | Title | Submission1 | @@ -59,9 +57,7 @@ Feature: Workshop submission and assessment | Submission content | Some content | And I log out # teacher1 allocates reviewers and changes the phase to assessment - And I log in as "teacher1" - And I am on "Course1" course homepage - And I follow "TestWorkshop" + And I am on the TestWorkshop "workshop activity" page logged in as teacher1 And I should see "to allocate: 3" And I should see "There is at least one author who has not yet submitted their work" Then I should see "Workshop submissions report" @@ -76,14 +72,12 @@ Feature: Workshop submission and assessment | Sam2 Student2 | Sam1 Student1 | | Sam3 Student3 | Sam1 Student1 | | Sam2 Student2 | Sam4 Student4 | - And I follow "TestWorkshop" + And I am on the TestWorkshop "workshop activity" page And I should see "to allocate: 0" And I change phase in workshop "TestWorkshop" to "Assessment phase" And I log out # student1 assesses work of student2 and student3 - And I log in as "student1" - And I am on "Course1" course homepage - And I follow "TestWorkshop" + And I am on the TestWorkshop "workshop activity" page logged in as student1 And "//ul[@class='tasks']/li[div[@class='title' and contains(.,'Assess peers')]]/div[@class='details' and contains(.,'pending: 2') and contains(.,'total: 2')]" "xpath_element" should exist And I assess submission "Sam2" in workshop "TestWorkshop" as:" | grade__idx_0 | 5 / 10 | @@ -102,9 +96,7 @@ Feature: Workshop submission and assessment And "//ul[@class='tasks']/li[div[@class='title' and contains(.,'Assess peers')]]/div[@class='details' and contains(.,'pending: 0') and contains(.,'total: 2')]" "xpath_element" should exist And I log out # student2 assesses work of student1 - And I log in as "student2" - And I am on "Course1" course homepage - And I follow "TestWorkshop" + And I am on the TestWorkshop "workshop activity" page logged in as student2 And "//ul[@class='tasks']/li[div[@class='title' and contains(.,'Assess peers')]]/div[@class='details' and contains(.,'pending: 1') and contains(.,'total: 1')]" "xpath_element" should exist And I assess submission "Sam1" in workshop "TestWorkshop" as:" | grade__idx_0 | 6 / 10 | @@ -115,9 +107,7 @@ Feature: Workshop submission and assessment And "//ul[@class='tasks']/li[div[@class='title' and contains(.,'Assess peers')]]/div[@class='details' and contains(.,'pending: 0') and contains(.,'total: 1')]" "xpath_element" should exist And I log out # teacher1 makes sure he can see all peer grades - And I log in as "teacher1" - And I am on "Course1" course homepage - And I follow "TestWorkshop" + And I am on the TestWorkshop "workshop activity" page logged in as teacher1 And I should see grade "52" for workshop participant "Sam1" set by peer "Sam2" And I should see grade "60" for workshop participant "Sam2" set by peer "Sam1" And I should see grade "-" for workshop participant "Sam2" set by peer "Sam4" @@ -152,11 +142,8 @@ Feature: Workshop submission and assessment And I log out # student1 looks at the activity - And I log in as "student1" - And I am on "Course1" course homepage - And I follow "TestWorkshop" + And I am on the TestWorkshop "workshop activity" page logged in as student1 Then I should see "Your submission with assessments" - And I log out @javascript Scenario: Add and assess submissions in workshop with javascript enabled diff --git a/mod/workshop/tests/behat/workshop_late_submission.feature b/mod/workshop/tests/behat/workshop_late_submission.feature index e09ffbdafe960..314451f368238 100644 --- a/mod/workshop/tests/behat/workshop_late_submission.feature +++ b/mod/workshop/tests/behat/workshop_late_submission.feature @@ -22,9 +22,7 @@ Feature: Workshop 'Late submissions are allowed' task | activity | name | intro | course | idnumber | latesubmissions | submisstionstart | submissionend | | workshop | TestWorkshop1 | TW3 with Submission deadline in future (1 Jan 2030)| c1 | workshop1 | 1 | 1514904308 | 1893369600 | # Teacher sets up assessment form and changes the phase to submission. - And I log in as "teacher1" - And I am on "Course1" course homepage - And I follow "TestWorkshop1" + And I am on the "TestWorkshop1" "workshop activity" page logged in as teacher1 And I edit assessment form in workshop "TestWorkshop1" as:" | id_description__idx_0_editor | Aspect1 | | id_description__idx_1_editor | Aspect2 | @@ -35,9 +33,7 @@ Feature: Workshop 'Late submissions are allowed' task @javascript Scenario: Student1 add his submission to TestWorkshop1 before submission deadline, but student2 does not submitt # Student1 submits. - Given I log in as "student1" - And I am on "Course1" course homepage - When I follow "TestWorkshop1" + When I am on the "TestWorkshop1" "workshop activity" page logged in as student1 Then I should see "Submissions deadline:" And I should not see "Late submissions are allowed" And I add a submission in workshop "TestWorkshop1" as:" @@ -46,9 +42,7 @@ Feature: Workshop 'Late submissions are allowed' task And I log out # Teacher modifies submission deadline. - Given I log in as "teacher1" - And I am on "Course1" course homepage - When I follow "TestWorkshop1" + When I am on the "TestWorkshop1" "workshop activity" page logged in as teacher1 Then I should see "Late submissions are allowed" And I navigate to "Edit settings" in current page administration And I follow "Expand all" @@ -60,27 +54,20 @@ Feature: Workshop 'Late submissions are allowed' task And I log out # Student1 has already submitted and cannot see 'Late submissions are allowed'. - Given I log in as "student1" - And I am on "Course1" course homepage - When I follow "TestWorkshop1" + When I am on the "TestWorkshop1" "workshop activity" page logged in as student1 Then I should see "Submissions deadline:" And I should not see "Late submissions are allowed" And I log out # Student2 has not submitted yet who can see 'Late submissions are allowed' text after the submission deadline. - Given I log in as "student2" - And I am on "Course1" course homepage - When I follow "TestWorkshop1" + When I am on the "TestWorkshop1" "workshop activity" page logged in as student2 Then I should see "Submissions deadline:" And I should see "Monday, 1 January 2018" And I should see "Late submissions are allowed" And I log out # Teacher can see 'Late submissions are allowed' text after submission deadline. - Given I log in as "teacher1" - And I am on "Course1" course homepage - When I follow "TestWorkshop1" + When I am on the "TestWorkshop1" "workshop activity" page logged in as teacher1 Then I should see "Submissions deadline:" And I should see "Monday, 1 January 2018" And I should see "Late submissions are allowed" - And I log out diff --git a/mod/workshop/tests/behat/workshop_section_remembered.feature b/mod/workshop/tests/behat/workshop_section_remembered.feature index d4e4b323de4e9..b44b76dc02f7e 100644 --- a/mod/workshop/tests/behat/workshop_section_remembered.feature +++ b/mod/workshop/tests/behat/workshop_section_remembered.feature @@ -22,15 +22,12 @@ Feature: Workshop should remember collapsed/expanded sections in view page. @javascript Scenario: Check section in view page can be remembered. - Given I log in as "teacher1" - And I am on "Course1" course homepage - And I follow "Workshop 1" + Given I am on the "Workshop 1" "workshop activity" page logged in as teacher1 When I change phase in workshop "Workshop 1" to "Submission phase" And I wait until the page is ready And I log out - And I log in as "student1" - And I am on "Course1" course homepage - And I follow "Workshop 1" + + And I am on the "Workshop 1" "workshop activity" page logged in as student1 Then I should see "You have not submitted your work yet" And I click on "Your submission" "link" And I should not see "You have not submitted your work yet" diff --git a/question/tests/behat/delete_question_activities.feature b/question/tests/behat/delete_question_activities.feature index 34c02575eca29..54519ffa39fcb 100644 --- a/question/tests/behat/delete_question_activities.feature +++ b/question/tests/behat/delete_question_activities.feature @@ -19,14 +19,20 @@ Feature: An activity module instance with questions in its context can be delete Scenario: Synchronously deleting a quiz with existing questions in its context Given the following config values are set as admin: | coursebinenable | 0 | tool_recyclebin | - And I log in as "teacher1" + And the following "activity" exists: + | activity | quiz | + | course | C1 | + | name | Test quiz Q001 | + And the following "question categories" exist: + | contextlevel | reference | name | + | Activity module | Test quiz Q001 | Default for Test quiz Q001 | + And the following "questions" exist: + | questioncategory | qtype | name | questiontext | + | Default for Test quiz Q001 | truefalse | Test used question to be deleted | Write about whatever you want | + And quiz "Test quiz Q001" contains the following questions: + | question | page | + | Test used question to be deleted | 1 | + And I am on the "Course 1" course page logged in as teacher1 And I am on "Course 1" course homepage with editing mode on - And I add a "Quiz" to section "1" and I fill the form with: - | Name | Test quiz Q001 | - And I add a "True/False" question to the "Test quiz" quiz with: - | Category | Default for Test quiz Q001 | - | Question name | Test used question to be deleted | - | Question text | Write about whatever you want | - And I am on "Course 1" course homepage When I delete "Test quiz Q001" activity Then I should not see "Test quiz Q001" diff --git a/question/tests/behat/delete_questions.feature b/question/tests/behat/delete_questions.feature index 26d340c056dd0..aef5bd72c683c 100644 --- a/question/tests/behat/delete_questions.feature +++ b/question/tests/behat/delete_questions.feature @@ -39,21 +39,27 @@ Feature: A teacher can delete questions in the question bank @javascript Scenario: Delete a question used in a quiz - Given I am on "Course 1" course homepage with editing mode on - And I add a "Quiz" to section "1" and I fill the form with: - | Name | Test quiz | - And I add a "True/False" question to the "Test quiz" quiz with: - | Question name | Test used question to be deleted | - | Question text | Write about whatever you want | - And I am on "Course 1" course homepage + Given the following "activity" exists: + | course | C1 | + | activity | quiz | + | idnumber | Test quiz | + | name | Test quiz | + And the following "question" exists: + | questioncategory | Test questions | + | qtype | truefalse | + | name | Test used question to be deleted | + | questiontext | Write about whatever you want | + And quiz "Test quiz" contains the following questions: + | question | page | requireprevious | + | Test used question to be deleted | 1 | 0 | + When I am on "Course 1" course homepage And I navigate to "Question bank > Questions" in current page administration - When I choose "Delete" action for "Test used question to be deleted" in the question bank + And I choose "Delete" action for "Test used question to be deleted" in the question bank And I press "Delete" Then I should not see "Test used question to be deleted" And I click on "Also show old questions" "checkbox" And I should see "Test used question to be deleted" - And I am on "Course 1" course homepage - And I follow "Test quiz" + And I am on the "Test quiz" "quiz activity" page And I click on "Preview quiz now" "button" And I should see "Write about whatever you want" diff --git a/question/type/essay/tests/behat/file_type_restriction.feature b/question/type/essay/tests/behat/file_type_restriction.feature index a8a476f032aa5..de5e78912b7e9 100644 --- a/question/type/essay/tests/behat/file_type_restriction.feature +++ b/question/type/essay/tests/behat/file_type_restriction.feature @@ -28,10 +28,7 @@ I need to limit the submittable file types And quiz "Quiz 1" contains the following questions: | question | page | | TF1 | 1 | - Given I log in as "teacher1" - And I am on "Course 1" course homepage - And I follow "Quiz 1" - And I navigate to "Edit quiz" in current page administration + Given I am on the "Quiz 1" "mod_quiz > edit" page logged in as teacher1 And I click on "Edit question TF1" "link" And I set the field "Allow attachments" to "1" And I set the field "Response format" to "No online text" @@ -46,8 +43,7 @@ I need to limit the submittable file types And I follow "Manage private files" And I upload "lib/tests/fixtures/empty.txt" file to "Files" filemanager And I press "Save changes" - And I am on "Course 1" course homepage - And I follow "Quiz 1" + And I am on the "Quiz 1" "quiz activity" page And I press "Attempt quiz now" And I should see "First question" And I should see "You can drag and drop files here to add them." @@ -65,8 +61,7 @@ I need to limit the submittable file types And I follow "Manage private files" And I upload "lib/tests/fixtures/upload_users.csv" file to "Files" filemanager And I press "Save changes" - And I am on "Course 1" course homepage - And I follow "Quiz 1" + And I am on the "Quiz 1" "quiz activity" page And I press "Attempt quiz now" And I should see "First question" And I should see "You can drag and drop files here to add them." diff --git a/question/type/multichoice/tests/behat/clearanswers.feature b/question/type/multichoice/tests/behat/clearanswers.feature index 214446fb46be2..95c7c5d27dfee 100644 --- a/question/type/multichoice/tests/behat/clearanswers.feature +++ b/question/type/multichoice/tests/behat/clearanswers.feature @@ -39,10 +39,8 @@ Feature: Clear my answers @javascript Scenario: Attempt a quiz and reset my chosen answer. - When I log in as "student1" - And I am on "Course 1" course homepage - And I follow "Quiz 1" - And I press "Attempt quiz now" + Given I am on the "Quiz 1" "quiz activity" page logged in as student1 + When I press "Attempt quiz now" And I should see "Question One" And I click on "Four" "qtype_multichoice > Answer" in the "Question One" "question" And I should see "Clear my choice" @@ -53,10 +51,8 @@ Feature: Clear my answers @javascript Scenario: Attempt a quiz and revisit a cleared answer. - When I log in as "student1" - And I am on "Course 1" course homepage - And I follow "Quiz 1" - And I press "Attempt quiz now" + Given I am on the "Quiz 1" "quiz activity" page logged in as student1 + When I press "Attempt quiz now" And I should see "Question One" And I click on "Four" "qtype_multichoice > Answer" in the "Question One" "question" And I follow "Finish attempt ..." diff --git a/report/loglive/tests/behat/loglive_report.feature b/report/loglive/tests/behat/loglive_report.feature index b6ce06e2503e3..9b231d0da8b06 100644 --- a/report/loglive/tests/behat/loglive_report.feature +++ b/report/loglive/tests/behat/loglive_report.feature @@ -36,7 +36,6 @@ Feature: In a report, admin can see loglive data And I set the field "reader" to "Legacy log" And I wait to be redirected And I should see "course_add mod" - And I log out @javascript @_switch_window Scenario: Check loglive report entries and make sure the pause/resume button works for standard reader along with ajax calls @@ -58,7 +57,6 @@ Feature: In a report, admin can see loglive data And I press "Resume live updates" And I wait "8" seconds And I should see "Test name2" - And I log out @javascript @_switch_window Scenario: Check loglive report entries and make sure the pause/resume button works for legacy reader along with ajax calls @@ -80,17 +78,13 @@ Feature: In a report, admin can see loglive data And I press "Resume live updates" And I wait "8" seconds And I should see "Test name2" - And I log out @javascript Scenario: Check course loglive report entries for a user Given I log out - And I log in as "student1" - And I am on "Course 1" course homepage - And I follow "Test name" + And I am on the "Test name" "data activity" page logged in as student1 And I log out - And I log in as "admin" - And I am on "Course 1" course homepage + And I am on the "Course 1" Course page logged in as admin And I navigate to "Reports > Live logs" in site administration When I set the field "reader" to "Standard log" Then I should see "Course module viewed" @@ -101,4 +95,3 @@ Feature: In a report, admin can see loglive data And I should see "course_add mod" And I wait "8" seconds And I should see "Test name" - And I log out diff --git a/report/participation/tests/behat/filter_participation.feature b/report/participation/tests/behat/filter_participation.feature index ade87ab1895b8..dbabdf9c03b63 100644 --- a/report/participation/tests/behat/filter_participation.feature +++ b/report/participation/tests/behat/filter_participation.feature @@ -16,12 +16,13 @@ Feature: In a participation report, admin can filter student actions | 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 "Book" to section "1" and I fill the form with: - | Name | Test book name | - | Description | Test book | - And I follow "Test book name" + And the following "activity" exists: + | course | C1 | + | activity | book | + | name | Test book name | + | description | Test book | + | idnumber | book1 | + And I am on the "Test book name" "book activity" page logged in as teacher1 And I set the following fields to these values: | Chapter title | Test chapter | | Content | Test chapter content | @@ -36,12 +37,11 @@ Feature: In a participation report, admin can filter student actions And the following config values are set as admin: | loglegacy | 1 | logstore_legacy | And I log out - And I log in as "student1" - And I am on "Course 1" course homepage - And I follow "Test book name" + + And I am on the "Test book name" "book activity" page logged in as student1 And I log out - When I log in as "admin" - And I am on "Course 1" course homepage + + When I am on the "Course 1" course page logged in as admin When I navigate to "Reports > Course participation" in current page administration And I set the field "instanceid" to "Test book name" And I set the field "roleid" to "Student" @@ -57,18 +57,18 @@ Feature: In a participation report, admin can filter student actions And the following config values are set as admin: | loglegacy | 1 | logstore_legacy | And I log out - And I log in as "student1" - And I am on "Course 1" course homepage - And I follow "Test book name" + + And I am on the "Test book name" "book activity" page logged in as student1 And I log out + And I log in as "admin" And I navigate to "Plugins > Logging > Manage log stores" in site administration And I click on "Enable" "link" in the "Standard log" "table_row" And I log out - And I log in as "student1" - And I am on "Course 1" course homepage - And I follow "Test book name" + + And I am on the "Test book name" "book activity" page logged in as student1 And I log out + And I log in as "admin" And I am on "Course 1" course homepage When I navigate to "Reports > Course participation" in current page administration @@ -79,10 +79,9 @@ Feature: In a participation report, admin can filter student actions @javascript Scenario: Filter participation report when only standard log reader is enabled by default - Given I log in as "student1" - And I am on "Course 1" course homepage - And I follow "Test book name" + Given I am on the "Test book name" "book activity" page logged in as student1 And I log out + And I log in as "admin" And I am on "Course 1" course homepage When I navigate to "Reports > Course participation" in current page administration diff --git a/report/participation/tests/behat/message_participants.feature b/report/participation/tests/behat/message_participants.feature index 3ed310cc399ec..2f0bac9d61ada 100644 --- a/report/participation/tests/behat/message_participants.feature +++ b/report/participation/tests/behat/message_participants.feature @@ -26,9 +26,7 @@ Feature: Use the particiaption report to message groups of students | name | Test book name | | description | Test book | | idnumber | book1 | - And I log in as "student1" - And I am on "Course 1" course homepage - And I follow "Test book name" + And I am on the "Test book name" "book activity" page logged in as student1 And I log out Scenario: Message all students from the participation report diff --git a/report/progress/tests/behat/activity_completion_report.feature b/report/progress/tests/behat/activity_completion_report.feature index 62e4d63fabda8..3757ebd2d835b 100644 --- a/report/progress/tests/behat/activity_completion_report.feature +++ b/report/progress/tests/behat/activity_completion_report.feature @@ -31,18 +31,16 @@ Feature: Teacher can view and override users' activity completion data via the p @javascript Scenario: Given the status has been overridden, when a student tries to complete it again, completion can still occur. # Student completes the activities, manual and automatic completion. - Given I log in as "student1" - And I am on "Course 1" course homepage + Given I am on the "Course 1" course page logged in as student1 And the manual completion button of "my assignment" is displayed as "Mark as done" And I toggle the manual completion state of "my assignment" And the manual completion button of "my assignment" is displayed as "Done" - And I click on "my assignment 2" "link" - And I am on "Course 1" course homepage + And I am on the "my assignment 2" "assign activity" page And the "View" completion condition of "my assignment 2" is displayed as "done" And I log out + # Teacher overrides the activity completion statuses to incomplete. - When I log in as "teacher1" - And I am on "Course 1" course homepage + When I am on the "Course 1" course page logged in as teacher1 And I navigate to "Reports > Activity completion" in current page administration And "Ann, Jill, Grainne, Beauchamp, my assignment: Completed" "icon" should exist in the "Ann, Jill, Grainne, Beauchamp" "table_row" And "Ann, Jill, Grainne, Beauchamp, my assignment 2: Completed" "icon" should exist in the "Ann, Jill, Grainne, Beauchamp" "table_row" @@ -53,20 +51,21 @@ Feature: Teacher can view and override users' activity completion data via the p And I click on "Save changes" "button" And "Ann, Jill, Grainne, Beauchamp, my assignment 2: Not completed (set by Teacher)" "icon" should exist in the "Ann, Jill, Grainne, Beauchamp" "table_row" And I log out + # Student can now complete the activities again, via normal means. - Then I log in as "student1" - And I am on "Course 1" course homepage - And the manual completion button of "my assignment" overridden by "Teacher" is displayed as "Mark as done" + And I am on the "Course 1" course page logged in as student1 + Then the manual completion button of "my assignment" overridden by "Teacher" is displayed as "Mark as done" And the "View" completion condition of "my assignment 2" overridden by "Teacher" is displayed as "todo" And I toggle the manual completion state of "my assignment" And the manual completion button of "my assignment" is displayed as "Done" - And I click on "my assignment 2" "link" + And I am on the "my assignment 2" "assign activity" page + And I am on "Course 1" course homepage And the "View" completion condition of "my assignment 2" is displayed as "done" And I log out + # And the activity completion report should show the same. - When I log in as "teacher1" - And I am on "Course 1" course homepage + And I am on the "Course 1" Course page logged in as teacher1 And I navigate to "Reports > Activity completion" in current page administration And "Ann, Jill, Grainne, Beauchamp, my assignment: Completed" "icon" should exist in the "Ann, Jill, Grainne, Beauchamp" "table_row" And "Ann, Jill, Grainne, Beauchamp, my assignment 2: Completed" "icon" should exist in the "Ann, Jill, Grainne, Beauchamp" "table_row" @@ -77,8 +76,7 @@ Feature: Teacher can view and override users' activity completion data via the p @javascript Scenario: Given the status has been overridden to complete, when a student triggers completion updates, the status remains fixed. # When the teacher overrides the activity completion statuses to complete. - When I log in as "teacher1" - And I am on "Course 1" course homepage + When I am on the "Course 1" Course page logged in as teacher1 And I navigate to "Reports > Activity completion" in current page administration And "Ann, Jill, Grainne, Beauchamp, my assignment: Not completed" "icon" should exist in the "Ann, Jill, Grainne, Beauchamp" "table_row" And "Ann, Jill, Grainne, Beauchamp, my assignment 3: Not completed" "icon" should exist in the "Ann, Jill, Grainne, Beauchamp" "table_row" @@ -89,11 +87,12 @@ Feature: Teacher can view and override users' activity completion data via the p And I click on "Save changes" "button" And "Ann, Jill, Grainne, Beauchamp, my assignment 3: Completed (set by Teacher)" "icon" should exist in the "Ann, Jill, Grainne, Beauchamp" "table_row" And I log out + # Then as a student, confirm that automatic completion checks are no longer triggered (such as after an assign submission). - Then I log in as "student1" - And I am on "Course 1" course homepage - And the "Receive a grade" completion condition of "my assignment 3" overridden by "Teacher" is displayed as "done" - And I click on "my assignment 3" "link" + And I am on the "Course 1" course page logged in as student1 + Then the "Receive a grade" completion condition of "my assignment 3" overridden by "Teacher" is displayed as "done" + + And I am on the "my assignment 3" "assign activity" page And I press "Add submission" And I set the following fields to these values: | Online text | I'm the student first submission | @@ -106,4 +105,3 @@ Feature: Teacher can view and override users' activity completion data via the p And the manual completion button of "my assignment" overridden by "Teacher" is displayed as "Done" And I toggle the manual completion state of "my assignment" And the manual completion button of "my assignment" is displayed as "Mark as done" - And I log out diff --git a/repository/contentbank/tests/behat/file_update.feature b/repository/contentbank/tests/behat/file_update.feature index e0c750edab32e..c2c6c12674aaa 100644 --- a/repository/contentbank/tests/behat/file_update.feature +++ b/repository/contentbank/tests/behat/file_update.feature @@ -17,12 +17,9 @@ Feature: Updating a file in the content bank after using in a course And the following "activities" exist: | activity | name | intro | introformat | course | content | contentformat | idnumber | | page | PageName1 | PageDesc1 | 1 | C1 | H5Ptest | 1 | 1 | - And I log in as "admin" Scenario: Referenced files is the default option and updates alias as well - Given I am on "Course1" course homepage - And I follow "PageName1" - And I navigate to "Edit settings" in current page administration + Given I am on the PageName1 "Page activity editing" page logged in as admin And I click on "Insert H5P" "button" in the "#fitem_id_page" "css_element" And I click on "Browse repositories..." "button" in the "Insert H5P" "dialogue" And I select "Content bank" repository in file picker @@ -53,17 +50,14 @@ Feature: Updating a file in the content bank after using in a course And I should see "This is a new text" And I switch to the main frame # Check the course page is updated. - Then I am on "Course1" course homepage - And I follow "PageName1" + When I am on the PageName1 "Page activity" page And I switch to "h5p-iframe" class iframe And I switch to "h5p-iframe" class iframe - And I should see "This is a new text" + Then I should see "This is a new text" And I switch to the main frame Scenario: Copied files should not be updated if the original is edited - Given I am on "Course1" course homepage - And I follow "PageName1" - And I navigate to "Edit settings" in current page administration + Given I am on the PageName1 "Page activity editing" page logged in as admin And I click on "Insert H5P" "button" in the "#fitem_id_page" "css_element" And I click on "Browse repositories..." "button" in the "Insert H5P" "dialogue" And I select "Content bank" repository in file picker @@ -95,9 +89,8 @@ Feature: Updating a file in the content bank after using in a course And I should see "This is a new text" And I switch to the main frame # Check the course page is not updated. - Then I am on "Course1" course homepage - And I follow "PageName1" + When I am on the PageName1 "Page activity" page And I switch to "h5p-iframe" class iframe And I switch to "h5p-iframe" class iframe - And I should see "Press here to reveal answer" + Then I should see "Press here to reveal answer" And I switch to the main frame diff --git a/repository/contentbank/tests/behat/search_content.feature b/repository/contentbank/tests/behat/search_content.feature index a975751a81de7..bd5882e441558 100644 --- a/repository/contentbank/tests/behat/search_content.feature +++ b/repository/contentbank/tests/behat/search_content.feature @@ -32,9 +32,7 @@ Feature: Search content bank files using the content bank files repository | teacher | C1 | editingteacher | Scenario: User can see a search field and reset search button in the content bank files repository - Given I log in as "admin" - And I am on "Course1" course homepage - And I follow "Folder" + Given I am on the Folder "Folder activity" page logged in as admin And I click on "Edit" "button" And I click on "Add..." "button" And I should see "Content bank" in the ".fp-repo-area" "css_element" @@ -43,9 +41,7 @@ Feature: Search content bank files using the content bank files repository And "Refresh" "link" should be visible Scenario: User can see search results when there is content that matches the search criteria - Given I log in as "admin" - And I am on "Course1" course homepage - And I follow "Folder" + Given I am on the Folder "Folder activity" page logged in as admin And I click on "Edit" "button" And I click on "Add..." "button" And I should see "Content bank" in the ".fp-repo-area" "css_element" @@ -60,9 +56,7 @@ Feature: Search content bank files using the content bank files repository And I should see "coursecontent2.h5p" "file" in repository content area Scenario: User can see search results when there is content that matches the search criteria ignoring case sensitivity - Given I log in as "admin" - And I am on "Course1" course homepage - And I follow "Folder" + Given I am on the Folder "Folder activity" page logged in as admin And I click on "Edit" "button" And I click on "Add..." "button" And I should see "Content bank" in the ".fp-repo-area" "css_element" @@ -74,9 +68,7 @@ Feature: Search content bank files using the content bank files repository And I should see "coursecontent2.h5p" "file" in repository content area Scenario: User can not see any search results when there is not a content that matches the search criteria - Given I log in as "admin" - And I am on "Course1" course homepage - And I follow "Folder" + Given I am on the Folder "Folder activity" page logged in as admin And I click on "Edit" "button" And I click on "Add..." "button" And I should see "Content bank" in the ".fp-repo-area" "css_element" @@ -87,9 +79,7 @@ Feature: Search content bank files using the content bank files repository And I should see "No files available" in the ".filepicker .fp-content" "css_element" Scenario: User can reset search criteria and see all content displayed prior the search action - Given I log in as "admin" - And I am on "Course1" course homepage - And I follow "Folder" + Given I am on the Folder "Folder activity" page logged in as admin And I click on "Edit" "button" And I click on "Add..." "button" And I should see "Content bank" in the ".fp-repo-area" "css_element" @@ -106,9 +96,7 @@ Feature: Search content bank files using the content bank files repository And I should see "coursecontent1.h5p" "file" in repository content area Scenario: Editing teacher can see search results when the content is available to him and matches the search criteria - Given I log in as "teacher" - And I am on "Course1" course homepage - And I follow "Folder" + Given I am on the Folder "Folder activity" page logged in as teacher And I click on "Edit" "button" And I click on "Add..." "button" And I should see "Content bank" in the ".fp-repo-area" "css_element" diff --git a/repository/contentbank/tests/behat/select_content.feature b/repository/contentbank/tests/behat/select_content.feature index 0bb7adc47de84..4c1d6278f5a15 100644 --- a/repository/contentbank/tests/behat/select_content.feature +++ b/repository/contentbank/tests/behat/select_content.feature @@ -39,9 +39,7 @@ Feature: Select content bank files using the content bank files repository | student | mscC1 | student | Scenario: Admin can navigate and see all existing content bank files using the content bank repository - Given I log in as "admin" - And I am on "MiscellaneousCourse1" course homepage - And I follow "Folder" + Given I am on the Folder "Folder activity" page logged in as admin And I click on "Edit" "button" And I click on "Add..." "button" And I should see "Content bank" in the ".fp-repo-area" "css_element" @@ -81,9 +79,7 @@ Feature: Select content bank files using the content bank files repository And I should see "greeting-card-887.h5p" "file" in repository content area Scenario: Admin can select and re-use content bank files using the content bank repository - Given I log in as "admin" - And I am on "MiscellaneousCourse1" course homepage - And I follow "Folder" + Given I am on the Folder "Folder activity" page logged in as admin And I click on "Edit" "button" And I click on "Add..." "button" And I should see "Content bank" in the ".fp-repo-area" "css_element" @@ -99,9 +95,7 @@ Feature: Select content bank files using the content bank files repository And I should see "ipsums.h5p" in the ".fp-content .fp-file" "css_element" Scenario: Editing teacher can navigate and see content bank files available to him using the content bank repository - Given I log in as "teacher1" - And I am on "MiscellaneousCourse1" course homepage - And I follow "Folder" + Given I am on the Folder "Folder activity" page logged in as teacher1 And I click on "Edit" "button" And I click on "Add..." "button" And I should see "Content bank" in the ".fp-repo-area" "css_element" @@ -120,9 +114,7 @@ Feature: Select content bank files using the content bank files repository And I should see "Miscellaneous" "folder" in repository content area Scenario: Editing teacher can select and re-use content bank files available to him using the content bank repository - Given I log in as "teacher1" - And I am on "MiscellaneousCourse1" course homepage - And I follow "Folder" + Given I am on the Folder "Folder activity" page logged in as teacher1 And I click on "Edit" "button" And I click on "Add..." "button" And I should see "Content bank" in the ".fp-repo-area" "css_element" @@ -137,18 +129,14 @@ Feature: Select content bank files using the content bank files repository And I should see "filltheblanks.h5p" in the ".fp-content .fp-file" "css_element" Scenario: Non-editing teacher can not see the content bank repository - Given I log in as "teacher2" - And I am on "MiscellaneousCourse1" course homepage - And I follow "Forum" + Given I am on the Forum "Forum activity" page logged in as teacher2 And I click on "Add a new discussion topic" "link" And I click on "Link" "button" When I click on "Browse repositories..." "button" Then I should not see "Content bank" in the ".fp-repo-area" "css_element" Scenario: Student can not see the content bank repository - Given I log in as "student" - And I am on "MiscellaneousCourse1" course homepage - And I follow "Forum" + Given I am on the Forum "Forum activity" page logged in as student And I click on "Add a new discussion topic" "link" And I click on "Link" "button" When I click on "Browse repositories..." "button" @@ -158,9 +146,7 @@ Feature: Select content bank files using the content bank files repository Given the following "contentbank content" exist: | contextlevel | reference | contenttype | user | contentname | filepath | | Course | mscC1 | contenttype_h5p | admin | My content | /h5p/tests/fixtures/ipsums.h5p | - And I log in as "admin" - And I am on "MiscellaneousCourse1" course homepage - And I follow "Folder" + And I am on the Folder "Folder activity" page logged in as admin And I click on "Edit" "button" And I click on "Add..." "button" And I should see "Content bank" in the ".fp-repo-area" "css_element" diff --git a/search/tests/behat/search_query.feature b/search/tests/behat/search_query.feature index 1d7c87af489fb..64b36e9414d36 100644 --- a/search/tests/behat/search_query.feature +++ b/search/tests/behat/search_query.feature @@ -64,10 +64,9 @@ Feature: Use global search interface @javascript Scenario: Search starting from forum context (within option lists course and forum) - When I am on "Amphibians" course homepage - And I follow "ForumName1" - And I search for "frogs" using the header global search box - And I expand all fieldsets + Given I am on the "ForumName1 toads amphibians" "Forum activity" page + When I search for "frogs" using the header global search box + Then I expand all fieldsets And I should see "Search within" And I select "Everywhere you can access" from the "Search within" singleselect And I should see "Courses" in the "region-main" "region" @@ -88,8 +87,7 @@ Feature: Use global search interface And the following "activities" exist: | activity | name | intro | course | idnumber | groupmode | | forum | ForumSG | ForumDesc1 | F1 | FORUM2 | 1 | - When I am on "Amphibians" course homepage - And I follow "ForumSG" + When I am on the ForumSG "Forum activity" page And global search expects the query "frogs" and will return: | type | idnumber | | activity | PAGE1 | @@ -101,8 +99,7 @@ Feature: Use global search interface And I set the field "Groups" to "A Group" And I select "Forum: ForumSG" from the "Search within" singleselect And I should see "A Group" in the "region-main" "region" - And I am on "Amphibians" course homepage - And I follow "ForumName1" + And I am on the "ForumName1 toads amphibians" "Forum activity" page And global search expects the query "frogs" and will return: | type | idnumber | | activity | PAGE1 | diff --git a/theme/boost/tests/behat/regionmainsettingsmenu.feature b/theme/boost/tests/behat/regionmainsettingsmenu.feature index 37fd45046e35b..a27fcc00a3070 100644 --- a/theme/boost/tests/behat/regionmainsettingsmenu.feature +++ b/theme/boost/tests/behat/regionmainsettingsmenu.feature @@ -19,10 +19,10 @@ Feature: Region main settings menu | choice | Choice name | Test choice description | C1 | choice1 | Option 1, Option 2, Option 3 | Scenario: Teacher can use the region main settings menu - And I log in as "teacher1" - And I am on "Course 1" course homepage - And "#region-main-settings-menu [role=button]" "css_element" should not exist - And I follow "Choice name" + Given I log in as "teacher1" + When I am on "Course 1" course homepage + Then "#region-main-settings-menu [role=button]" "css_element" should not exist + And I am on the "Choice name" "Choice activity" page And I click on "#region-main-settings-menu [role=button]" "css_element" And I choose "Edit settings" in the open action menu And I should see "Updating: Choice" @@ -30,12 +30,10 @@ Feature: Region main settings menu And I click on "#region-main-settings-menu [role=button]" "css_element" And I choose "Enrolment methods" in the open action menu And I should see "Enrolment methods" - And I log out Scenario: Student cannot use all options in the region main settings menu - And I log in as "student1" - And I am on "Course 1" course homepage - And "#region-main-settings-menu [role=button]" "css_element" should not exist - And I follow "Choice name" + Given I log in as "student1" + When I am on "Course 1" course homepage + Then "#region-main-settings-menu [role=button]" "css_element" should not exist + And I am on the "Choice name" "Choice activity" page And "#region-main-settings-menu [role=button]" "css_element" should not exist - And I log out