From 0d5b8d1337655d416ccc58efe3884a262e3950eb Mon Sep 17 00:00:00 2001 From: Angelia Dela Cruz Date: Mon, 22 May 2023 12:51:50 +0800 Subject: [PATCH] MDL-78158 Behat: Use data generators to add blocks --- .../util/ui/tests/behat/import_course.feature | 8 ++--- .../behat/restore_moodle2_courses.feature | 4 ++- .../behat/addunsupportedactivity.feature | 4 ++- .../tests/behat/defaultsettings.feature | 4 ++- .../behat/block_badges_frontpage.feature | 8 ++--- .../behat/block_blog_menu_activity.feature | 8 ++--- .../behat/block_blog_menu_course.feature | 7 ++-- .../behat/block_blog_menu_frontpage.feature | 8 ++--- .../behat/block_blog_recent_activity.feature | 10 +++--- .../behat/block_blog_recent_course.feature | 9 +++-- .../behat/block_blog_recent_frontpage.feature | 8 +++-- .../tests/behat/block_calendar_month.feature | 7 ++-- .../block_calendar_month_frontpage.feature | 6 ++-- .../block_calendar_upcoming_frontpage.feature | 6 ++-- .../comments/tests/behat/add_comment.feature | 7 ++-- .../behat/block_comment_activity.feature | 4 ++- .../tests/behat/block_comment_course.feature | 4 ++- .../behat/block_comment_frontpage.feature | 5 +-- .../tests/behat/delete_comment.feature | 7 ++-- ...lock_completionstatus_manual_other.feature | 5 +-- ...block_completionstatus_manual_self.feature | 6 ++-- .../behat/block_course_summary_course.feature | 7 ++-- .../block_course_summary_frontpage.feature | 5 +-- blocks/login/tests/behat/login_block.feature | 11 +++--- .../mnet_hosts_addblock_disabled.feature | 11 +++--- .../behat/block_myprofile_activity.feature | 8 ++--- .../behat/block_myprofile_frontpage.feature | 8 ++--- .../tests/behat/display_news.feature | 21 ++++++----- .../block_private_files_activity.feature | 8 ++--- .../behat/block_private_files_course.feature | 4 ++- .../block_private_files_frontpage.feature | 8 ++--- .../behat/block_search_forums_course.feature | 7 ++-- .../block_search_forums_frontpage.feature | 8 ++--- .../tests/behat/show_section_name.feature | 4 ++- .../tests/behat/add_url.feature | 35 +++++++------------ .../tests/behat/edit_activities.feature | 4 ++- .../tests/behat/edit_activities.feature | 4 ++- blocks/tests/behat/delete_block.feature | 5 +-- .../tests/behat/hidden_block_region.feature | 10 +++--- blocks/tests/behat/hide_blocks.feature | 8 +++-- blocks/tests/behat/manage_blocks.feature | 4 ++- blocks/tests/behat/move_blocks.feature | 4 ++- calendar/tests/behat/calendar.feature | 9 +++-- .../tests/behat/calendar_lookahead.feature | 6 ++-- .../activity_completion_criteria.feature | 6 ++-- ...ourse_completion_activity_criteria.feature | 4 ++- .../behat/teacher_manual_completion.feature | 12 +++---- .../behat/activities_visibility_icons.feature | 5 +-- .../tests/behat/group_submission.feature | 8 ++--- .../tests/behat/set_availability.feature | 1 - mod/choice/tests/behat/block_editing.feature | 12 +++++-- mod/data/tests/behat/data_activities.feature | 7 ++-- .../tests/behat/coursemapping.feature | 13 +++---- mod/forum/tests/behat/advanced_search.feature | 4 ++- .../tests/behat/edit_post_student.feature | 7 ++-- mod/forum/tests/behat/recent_activity.feature | 5 +-- .../tests/behat/import_entries.feature | 8 ++--- .../tests/behat/recent_activity.feature | 7 ++-- my/tests/behat/reset_all_pages.feature | 13 +++---- .../tests/behat/custom_profile_fields.feature | 8 ++--- .../tests/behat/user_grade_navigation.feature | 6 ++-- .../tests/behat/view_preferences_page.feature | 4 ++- 62 files changed, 235 insertions(+), 229 deletions(-) diff --git a/backup/util/ui/tests/behat/import_course.feature b/backup/util/ui/tests/behat/import_course.feature index 964001cbea0..29e70f8cadb 100644 --- a/backup/util/ui/tests/behat/import_course.feature +++ b/backup/util/ui/tests/behat/import_course.feature @@ -23,10 +23,10 @@ Feature: Import course's contents into another course | activity | name | intro | course | idnumber | section | | data | Test database name | Test database description | C1 | database1 | 2 | | forum | Test forum name | Test forum name description | C1 | forum1 | 1 | - And I am on "Course 1" course homepage with editing mode on - And I add the "Comments" block - And I add the "Recent blog entries" block - And I turn editing mode off + And the following "blocks" exist: + | blockname | contextlevel | reference | pagetypepattern | defaultregion | + | comments | Course | C1 | course-view-* | side-pre | + | blog_recent | Course | C1 | course-view-* | side-pre | When I import "Course 1" course into "Course 2" course using this options: Then I should see "Test database name" And I should see "Test forum name" diff --git a/backup/util/ui/tests/behat/restore_moodle2_courses.feature b/backup/util/ui/tests/behat/restore_moodle2_courses.feature index e04c22c73ff..15628289139 100644 --- a/backup/util/ui/tests/behat/restore_moodle2_courses.feature +++ b/backup/util/ui/tests/behat/restore_moodle2_courses.feature @@ -17,9 +17,11 @@ Feature: Restore Moodle 2 course backups | data | C3 | data1 | Test database name | Database description | 2 | | | forum | C1 | 0001 | Test forum name | | 1 | | | url | C1 | url1 | Test URL name | Test URL description | 3 | http://www.moodle.org | + And the following "blocks" exist: + | blockname | contextlevel | reference | pagetypepattern | defaultregion | + | activity_modules | Course | C1 | course-view-* | side-pre | And I log in as "admin" And I am on "Course 1" course homepage with editing mode on - And I add the "Activities" block @javascript Scenario: Restore a course in another existing course diff --git a/blocks/activity_results/tests/behat/addunsupportedactivity.feature b/blocks/activity_results/tests/behat/addunsupportedactivity.feature index f5b045b1426..c59522ca1b6 100644 --- a/blocks/activity_results/tests/behat/addunsupportedactivity.feature +++ b/blocks/activity_results/tests/behat/addunsupportedactivity.feature @@ -21,8 +21,10 @@ Feature: The activity results block doesn't display student scores for unsupport Given the following "activities" exist: | activity | name | intro | course | section | idnumber | assignsubmission_file_enabled | | assign | Test assignment | Offline text | C1 | 1 | assign1 | 0 | + And the following "blocks" exist: + | blockname | contextlevel | reference | pagetypepattern | defaultregion | + | activity_results | Course | C1 | course-view-* | side-pre | And I am on "Course 1" course homepage - And I add the "Activity results" block And I configure the "Activity results" block And I set the following fields to these values: | config_showbest | 1 | diff --git a/blocks/activity_results/tests/behat/defaultsettings.feature b/blocks/activity_results/tests/behat/defaultsettings.feature index 7ea25451c25..f37391ac793 100644 --- a/blocks/activity_results/tests/behat/defaultsettings.feature +++ b/blocks/activity_results/tests/behat/defaultsettings.feature @@ -50,8 +50,10 @@ Feature: The activity results block can have administrator set defaults | config_showbest_locked | 1 | block_activity_results | | config_showworst | 0 | block_activity_results | | config_showworst_locked | 1 | block_activity_results | + And the following "blocks" exist: + | blockname | contextlevel | reference | pagetypepattern | defaultregion | + | activity_results | Course | C1 | course-view-* | side-pre | And I am on "Course 1" course homepage - And I add the "Activity results" block When I configure the "Activity results" block And the following fields match these values: | config_showbest | 0 | diff --git a/blocks/badges/tests/behat/block_badges_frontpage.feature b/blocks/badges/tests/behat/block_badges_frontpage.feature index db59cfde393..1e9ea2158be 100644 --- a/blocks/badges/tests/behat/block_badges_frontpage.feature +++ b/blocks/badges/tests/behat/block_badges_frontpage.feature @@ -14,11 +14,9 @@ Feature: Enable Block Badges on the frontpage and view awarded badges And the following "course enrolments" exist: | user | course | role | | teacher1 | C1 | editingteacher | - And I log in as "admin" - And I am on site homepage - And I turn editing mode on - And I add the "Latest badges" block - And I log out + And the following "blocks" exist: + | blockname | contextlevel | reference | pagetypepattern | defaultregion | + | badges | System | 1 | site-index | side-pre | And I log in as "teacher1" And I am on "Course 1" course homepage # Issue badge 1 of 2 diff --git a/blocks/blog_menu/tests/behat/block_blog_menu_activity.feature b/blocks/blog_menu/tests/behat/block_blog_menu_activity.feature index 40e676f6bb7..5c3ec0b44ce 100644 --- a/blocks/blog_menu/tests/behat/block_blog_menu_activity.feature +++ b/blocks/blog_menu/tests/behat/block_blog_menu_activity.feature @@ -26,11 +26,9 @@ Feature: Enable Block blog menu in an activity | idnumber | 0001 | | section | 1 | | assignsubmission_file_enabled | 0 | - And I log in as "teacher1" - And I am on "Course 1" course homepage with editing mode on - And I follow "Test assignment 1" - And I add the "Blog menu" block - And I log out + And the following "blocks" exist: + | blockname | contextlevel | reference | pagetypepattern | defaultregion | + | blog_menu | Activity module | 0001 | mod-assign-view | side-pre | Scenario: Students use the blog menu block to post blogs Given I log in as "student1" diff --git a/blocks/blog_menu/tests/behat/block_blog_menu_course.feature b/blocks/blog_menu/tests/behat/block_blog_menu_course.feature index 11d9625b02e..534ba358917 100644 --- a/blocks/blog_menu/tests/behat/block_blog_menu_course.feature +++ b/blocks/blog_menu/tests/behat/block_blog_menu_course.feature @@ -18,10 +18,9 @@ Feature: Students can use block blog menu in a course | 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 the "Blog menu" block - And I log out + And the following "blocks" exist: + | blockname | contextlevel | reference | pagetypepattern | defaultregion | + | blog_menu | Course | C1 | course-view-* | side-pre | Scenario: Students use the blog menu block to post blogs Given I log in as "student1" diff --git a/blocks/blog_menu/tests/behat/block_blog_menu_frontpage.feature b/blocks/blog_menu/tests/behat/block_blog_menu_frontpage.feature index f20b2e5c17f..85ce327be03 100644 --- a/blocks/blog_menu/tests/behat/block_blog_menu_frontpage.feature +++ b/blocks/blog_menu/tests/behat/block_blog_menu_frontpage.feature @@ -8,11 +8,9 @@ Feature: Enable Block blog menu on the frontpage Given the following "users" exist: | username | firstname | lastname | email | idnumber | | student1 | Student | 1 | student1@example.com | S1 | - And I log in as "admin" - And I am on site homepage - And I turn editing mode on - And I add the "Blog menu" block - And I log out + And the following "blocks" exist: + | blockname | contextlevel | reference | pagetypepattern | defaultregion | + | blog_menu | System | 1 | site-index | side-pre | Scenario: Students use the blog menu block to post blogs Given I log in as "student1" diff --git a/blocks/blog_recent/tests/behat/block_blog_recent_activity.feature b/blocks/blog_recent/tests/behat/block_blog_recent_activity.feature index 01e75d39314..59bfe27c812 100644 --- a/blocks/blog_recent/tests/behat/block_blog_recent_activity.feature +++ b/blocks/blog_recent/tests/behat/block_blog_recent_activity.feature @@ -26,12 +26,10 @@ Feature: Students can use the recent blog entries block to view recent entries o | intro | Offline text | | section | 1 | | assignsubmission_file_enabled | 0 | - And I log in as "teacher1" - And I am on "Course 1" course homepage with editing mode on - And I follow "Test assignment 1" - And I add the "Blog menu" block - And I add the "Recent blog entries" block - And I log out + And the following "blocks" exist: + | blockname | contextlevel | reference | pagetypepattern | defaultregion | + | blog_menu | Activity module | 0001 | mod-assign-view | side-pre | + | blog_recent | Activity module | 0001 | mod-assign-view | side-pre | Scenario: Students use the recent blog entries block to view blogs Given I log in as "student1" diff --git a/blocks/blog_recent/tests/behat/block_blog_recent_course.feature b/blocks/blog_recent/tests/behat/block_blog_recent_course.feature index e8c7fccc577..2307204bc40 100644 --- a/blocks/blog_recent/tests/behat/block_blog_recent_course.feature +++ b/blocks/blog_recent/tests/behat/block_blog_recent_course.feature @@ -16,13 +16,12 @@ Feature: Students can use the recent blog entries block to view recent entries o | user | course | role | | teacher1 | C1 | editingteacher | | student1 | C1 | student | + And the following "blocks" exist: + | blockname | contextlevel | reference | pagetypepattern | defaultregion | + | blog_menu | Course | C1 | course-view-* | side-pre | + | blog_recent | Course | C1 | course-view-* | side-pre | 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 with editing mode on - And I add the "Blog menu" block - And I add the "Recent blog entries" block - And I log out Scenario: Students use the recent blog entries block to view blogs Given I log in as "student1" diff --git a/blocks/blog_recent/tests/behat/block_blog_recent_frontpage.feature b/blocks/blog_recent/tests/behat/block_blog_recent_frontpage.feature index 00cb9472c8d..013a9ea5c51 100644 --- a/blocks/blog_recent/tests/behat/block_blog_recent_frontpage.feature +++ b/blocks/blog_recent/tests/behat/block_blog_recent_frontpage.feature @@ -8,12 +8,14 @@ Feature: Feature: Students can use the recent blog entries block to view recent Given the following "users" exist: | username | firstname | lastname | email | idnumber | | student1 | Student | 1 | student1@example.com | S1 | + And the following "blocks" exist: + | blockname | contextlevel | reference | pagetypepattern | defaultregion | + | blog_recent | System | 1 | site-index | side-pre | + And the following config values are set as admin: + | unaddableblocks | | theme_boost| And I log in as "admin" And I am on site homepage And I turn editing mode on - And I add the "Recent blog entries" block - And the following config values are set as admin: - | unaddableblocks | | theme_boost| # TODO MDL-57120 site "Blogs" link not accessible without navigation block. And I add the "Navigation" block if not present And I log out diff --git a/blocks/calendar_month/tests/behat/block_calendar_month.feature b/blocks/calendar_month/tests/behat/block_calendar_month.feature index df6ed1cb38b..983d0bf17f5 100644 --- a/blocks/calendar_month/tests/behat/block_calendar_month.feature +++ b/blocks/calendar_month/tests/behat/block_calendar_month.feature @@ -52,9 +52,10 @@ Feature: Enable the calendar block in a course and test it's functionality @javascript Scenario: View a user event in the calendar block - Given I log in as "teacher1" - And I am on "Course 1" course homepage with editing mode on - And I add the "Calendar" block + Given the following "blocks" exist: + | blockname | contextlevel | reference | pagetypepattern | defaultregion | + | calendar_month | Course | C1 | course-view-* | side-pre | + And I log in as "teacher1" And I create a calendar event with form data: | id_eventtype | User | | id_name | User Event | diff --git a/blocks/calendar_month/tests/behat/block_calendar_month_frontpage.feature b/blocks/calendar_month/tests/behat/block_calendar_month_frontpage.feature index fc9329e68c0..c74f2b6d98a 100644 --- a/blocks/calendar_month/tests/behat/block_calendar_month_frontpage.feature +++ b/blocks/calendar_month/tests/behat/block_calendar_month_frontpage.feature @@ -9,10 +9,10 @@ Feature: Enable the calendar block on the site front page Given the following "users" exist: | username | firstname | lastname | email | idnumber | | student1 | Student | 1 | student1@example.com | S1 | + And the following "blocks" exist: + | blockname | contextlevel | reference | pagetypepattern | defaultregion | + | calendar_month | System | 1 | site-index | side-pre | And I log in as "admin" - And I am on site homepage - And I turn editing mode on - And I add the "Calendar" block And I create a calendar event with form data: | id_eventtype | Site | | id_name | Site Event | diff --git a/blocks/calendar_upcoming/tests/behat/block_calendar_upcoming_frontpage.feature b/blocks/calendar_upcoming/tests/behat/block_calendar_upcoming_frontpage.feature index b2d956011d1..ad4ace1699a 100644 --- a/blocks/calendar_upcoming/tests/behat/block_calendar_upcoming_frontpage.feature +++ b/blocks/calendar_upcoming/tests/behat/block_calendar_upcoming_frontpage.feature @@ -8,6 +8,9 @@ Feature: View a site event on the frontpage Given the following "users" exist: | username | firstname | lastname | email | idnumber | | teacher1 | Teacher | 1 | teacher1@example.com | T1 | + And the following "blocks" exist: + | blockname | contextlevel | reference | pagetypepattern | defaultregion | + | calendar_upcoming | System | 1 | site-index | side-pre | @javascript Scenario: View a site event in the upcoming events block on the frontpage @@ -15,9 +18,6 @@ Feature: View a site event on the frontpage And I create a calendar event with form data: | id_eventtype | Site | | id_name | My Site Event | - And I am on site homepage - And I turn editing mode on - And I add the "Upcoming events" block And I log out When I log in as "teacher1" And I am on site homepage diff --git a/blocks/comments/tests/behat/add_comment.feature b/blocks/comments/tests/behat/add_comment.feature index 83eb6f44109..3665d1f6ad2 100644 --- a/blocks/comments/tests/behat/add_comment.feature +++ b/blocks/comments/tests/behat/add_comment.feature @@ -16,10 +16,9 @@ Feature: Add a comment to the comments block | 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 the "Comments" block - And I log out + And the following "blocks" exist: + | blockname | contextlevel | reference | pagetypepattern | defaultregion | + | comments | Course | C1 | course-view-* | side-pre | And I log in as "student1" And I am on "Course 1" course homepage diff --git a/blocks/comments/tests/behat/block_comment_activity.feature b/blocks/comments/tests/behat/block_comment_activity.feature index 4aa94bdded0..95ee8277352 100644 --- a/blocks/comments/tests/behat/block_comment_activity.feature +++ b/blocks/comments/tests/behat/block_comment_activity.feature @@ -19,10 +19,12 @@ Feature: Enable Block comments on an activity page and view comments And the following "activities" exist: | activity | course | idnumber | name | intro | | page | C1 | page1 | Test page name | Test page description | + And the following "blocks" exist: + | blockname | contextlevel | reference | pagetypepattern | defaultregion | + | comments | Activity module | page1 | mod-page-* | side-pre | 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 add the "Comments" block And I follow "Show comments" And I add "I'm a comment from the teacher" comment to comments block And I log out diff --git a/blocks/comments/tests/behat/block_comment_course.feature b/blocks/comments/tests/behat/block_comment_course.feature index 3589da498e0..d23809b7eaa 100644 --- a/blocks/comments/tests/behat/block_comment_course.feature +++ b/blocks/comments/tests/behat/block_comment_course.feature @@ -16,9 +16,11 @@ Feature: Enable Block comments on a course page and view comments | user | course | role | | teacher1 | C1 | editingteacher | | student1 | C1 | student | + And the following "blocks" exist: + | blockname | contextlevel | reference | pagetypepattern | defaultregion | + | comments | Course | C1 | course-view-* | side-pre | And I log in as "teacher1" And I am on "Course 1" course homepage with editing mode on - And I add the "Comments" block And I follow "Show comments" And I add "I'm a comment from the teacher" comment to comments block And I log out diff --git a/blocks/comments/tests/behat/block_comment_frontpage.feature b/blocks/comments/tests/behat/block_comment_frontpage.feature index cb8d76dd036..ada60b7d5f7 100644 --- a/blocks/comments/tests/behat/block_comment_frontpage.feature +++ b/blocks/comments/tests/behat/block_comment_frontpage.feature @@ -8,10 +8,11 @@ Feature: Enable Block comments on the frontpage and view comments Given the following "users" exist: | username | firstname | lastname | email | idnumber | | teacher1 | Teacher | 1 | teacher1@example.com | T1 | + And the following "blocks" exist: + | blockname | contextlevel | reference | pagetypepattern | defaultregion | + | comments | System | 1 | site-index | side-pre | And I log in as "admin" And I am on site homepage - And I turn editing mode on - And I add the "Comments" block And I follow "Show comments" And I add "I'm a comment from admin" comment to comments block And I log out diff --git a/blocks/comments/tests/behat/delete_comment.feature b/blocks/comments/tests/behat/delete_comment.feature index f8939f42ae3..29288e7449e 100644 --- a/blocks/comments/tests/behat/delete_comment.feature +++ b/blocks/comments/tests/behat/delete_comment.feature @@ -17,10 +17,9 @@ Feature: Delete comment block messages | 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 the "Comments" block - And I log out + And the following "blocks" exist: + | blockname | contextlevel | reference | pagetypepattern | defaultregion | + | comments | Course | C1 | course-view-* | side-pre | And I log in as "student1" And I am on "Course 1" course homepage And I add "Comment from student1" comment to comments block diff --git a/blocks/completionstatus/tests/behat/block_completionstatus_manual_other.feature b/blocks/completionstatus/tests/behat/block_completionstatus_manual_other.feature index dfe5f224273..d32e00ad883 100644 --- a/blocks/completionstatus/tests/behat/block_completionstatus_manual_other.feature +++ b/blocks/completionstatus/tests/behat/block_completionstatus_manual_other.feature @@ -18,11 +18,13 @@ Feature: Enable Block Completion in a course using manual completion by others | teacher1 | C1 | editingteacher | | teacher2 | C1 | teacher | | student1 | C1 | student | + And the following "blocks" exist: + | blockname | contextlevel | reference | pagetypepattern | defaultregion | + | completionstatus | Course | C1 | course-view-* | side-pre | Scenario: Add the block to a the course and mark a student complete. Given I log in as "teacher1" And I am on "Course 1" course homepage with editing mode on - And I add the "Course completion status" block And I navigate to "Course completion" in current page administration And I expand all fieldsets And I set the following fields to these values: @@ -55,7 +57,6 @@ Feature: Enable Block Completion in a course using manual completion by others Scenario: Add the block to a the course and require multiple roles to mark a student complete. Given I log in as "teacher1" And I am on "Course 1" course homepage with editing mode on - And I add the "Course completion status" block And I navigate to "Course completion" in current page administration And I expand all fieldsets And I set the following fields to these values: diff --git a/blocks/completionstatus/tests/behat/block_completionstatus_manual_self.feature b/blocks/completionstatus/tests/behat/block_completionstatus_manual_self.feature index 5165716e15a..171040880aa 100644 --- a/blocks/completionstatus/tests/behat/block_completionstatus_manual_self.feature +++ b/blocks/completionstatus/tests/behat/block_completionstatus_manual_self.feature @@ -17,10 +17,12 @@ Feature: Enable Block Completion in a course using manual self completion | teacher1 | C1 | editingteacher | | student1 | C1 | student | And I enable "selfcompletion" "block" plugin + And the following "blocks" exist: + | blockname | contextlevel | reference | pagetypepattern | defaultregion | + | completionstatus | Course | C1 | course-view-* | side-pre | + | selfcompletion | Course | C1 | course-view-* | side-pre | And I log in as "teacher1" And I am on "Course 1" course homepage with editing mode on - And I add the "Course completion status" block - And I add the "Self completion" block And I navigate to "Course completion" in current page administration And I expand all fieldsets And I set the following fields to these values: diff --git a/blocks/course_summary/tests/behat/block_course_summary_course.feature b/blocks/course_summary/tests/behat/block_course_summary_course.feature index 5edee88900e..4b35eff50d9 100644 --- a/blocks/course_summary/tests/behat/block_course_summary_course.feature +++ b/blocks/course_summary/tests/behat/block_course_summary_course.feature @@ -17,10 +17,9 @@ Feature: Course summary block used in a course | student1 | C101 | student | | teacher1 | C101 | editingteacher | And I enable "course_summary" "block" plugin - And I log in as "teacher1" - And I am on "Course 1" course homepage with editing mode on - And I add the "Course/site summary" block - And I log out + And the following "blocks" exist: + | blockname | contextlevel | reference | pagetypepattern | defaultregion | + | course_summary | Course | C101 | course-view-* | side-pre | Scenario: Student can view course summary When I log in as "student1" diff --git a/blocks/course_summary/tests/behat/block_course_summary_frontpage.feature b/blocks/course_summary/tests/behat/block_course_summary_frontpage.feature index 7d476e9e4c6..afb11ee744e 100644 --- a/blocks/course_summary/tests/behat/block_course_summary_frontpage.feature +++ b/blocks/course_summary/tests/behat/block_course_summary_frontpage.feature @@ -7,9 +7,10 @@ Feature: Course summary block used on the frontpage Background: Given I log in as "admin" And I enable "course_summary" "block" plugin + And the following "blocks" exist: + | blockname | contextlevel | reference | pagetypepattern | defaultregion | + | course_summary | System | 1 | site-index | side-pre | And I am on site homepage - And I turn editing mode on - And I add the "Course/site summary" block And I navigate to "Site home > Site home settings" in site administration And I set the following fields to these values: | summary | Proved the summary block works! | diff --git a/blocks/login/tests/behat/login_block.feature b/blocks/login/tests/behat/login_block.feature index b06547a5ccf..1648a74c068 100644 --- a/blocks/login/tests/behat/login_block.feature +++ b/blocks/login/tests/behat/login_block.feature @@ -8,19 +8,16 @@ Feature: Login from a block Given the following "users" exist: | username | password | firstname | lastname | email | | testuser | testpass | Test | User | student1@example.com | - And I log in as "admin" - And I am on site homepage - And I turn editing mode on - And I add the "Login" block + And the following "blocks" exist: + | blockname | contextlevel | reference | pagetypepattern | defaultregion | + | login | System | 1 | site-index | side-pre | Scenario: Login block visible to non-logged in users - Given I log out When I am on homepage Then "Login" "block" should exist Scenario: Login as student through login block - Given I log out - And I am on homepage + Given I am on homepage When I set the field "Username" to "testuser" And I set the field "Password" to "testpass" And I click on "Log in" "button" in the "Login" "block" diff --git a/blocks/mnet_hosts/tests/behat/mnet_hosts_addblock_disabled.feature b/blocks/mnet_hosts/tests/behat/mnet_hosts_addblock_disabled.feature index b084fa2a269..6ee26848fdf 100644 --- a/blocks/mnet_hosts/tests/behat/mnet_hosts_addblock_disabled.feature +++ b/blocks/mnet_hosts/tests/behat/mnet_hosts_addblock_disabled.feature @@ -8,9 +8,9 @@ Feature: Add the network servers block when main feature is disabled Given I log in as "admin" And I navigate to "Plugins > Authentication > Manage authentication" in site administration And I click on "Enable" "icon" in the "MNet authentication" "table_row" - And I am on site homepage - And I turn editing mode on - And I add the "Network servers" block + And the following "blocks" exist: + | blockname | contextlevel | reference | pagetypepattern | defaultregion | + | mnet_hosts | System | 1 | site-index | side-pre | When I navigate to "Plugins > Authentication > Manage authentication" in site administration And I click on "Disable" "icon" in the "MNet authentication" "table_row" And I am on site homepage @@ -21,10 +21,11 @@ Feature: Add the network servers block when main feature is disabled Given I log in as "admin" And I navigate to "Plugins > Authentication > Manage authentication" in site administration And I click on "Enable" "icon" in the "MNet authentication" "table_row" + And the following "blocks" exist: + | blockname | contextlevel | reference | pagetypepattern | defaultregion | + | mnet_hosts | System | 1 | site-index | side-pre | And I am on site homepage And I turn editing mode on - And I add the "Network servers" block - And I turn editing mode on And I open the "Network servers" blocks action menu And I click on "Delete Network servers block" "link" in the "Network servers" "block" And "Delete block?" "dialogue" should exist diff --git a/blocks/myprofile/tests/behat/block_myprofile_activity.feature b/blocks/myprofile/tests/behat/block_myprofile_activity.feature index bc0f704946e..0109119171a 100644 --- a/blocks/myprofile/tests/behat/block_myprofile_activity.feature +++ b/blocks/myprofile/tests/behat/block_myprofile_activity.feature @@ -17,8 +17,8 @@ Feature: The logged in user block allows users to view their profile information And the following "activities" exist: | activity | course | idnumber | name | intro | | 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" - When I add the "Logged in user" block + And the following "blocks" exist: + | blockname | contextlevel | reference | pagetypepattern | defaultregion | + | myprofile | Activity module | page1 | mod-page-* | side-pre | + When I am on the "Test page name" "page activity" page logged in as teacher1 Then I should see "Teacher One" in the "Logged in user" "block" diff --git a/blocks/myprofile/tests/behat/block_myprofile_frontpage.feature b/blocks/myprofile/tests/behat/block_myprofile_frontpage.feature index c7d5e37a071..1870b3dcb5b 100644 --- a/blocks/myprofile/tests/behat/block_myprofile_frontpage.feature +++ b/blocks/myprofile/tests/behat/block_myprofile_frontpage.feature @@ -8,11 +8,9 @@ Feature: The logged in user block allows users to view their profile information Given the following "users" exist: | username | firstname | lastname | email | idnumber | | teacher1 | Teacher | One | teacher1@example.com | T1 | - And I log in as "admin" - And I am on site homepage - And I turn editing mode on - And I add the "Logged in user" block - And I log out + And the following "blocks" exist: + | blockname | contextlevel | reference | pagetypepattern | defaultregion | + | myprofile | System | 1 | site-index | side-pre | Scenario: Try to view the logged in user block as a guest Given I log in as "guest" diff --git a/blocks/news_items/tests/behat/display_news.feature b/blocks/news_items/tests/behat/display_news.feature index be5e1b011df..e976ed829f8 100644 --- a/blocks/news_items/tests/behat/display_news.feature +++ b/blocks/news_items/tests/behat/display_news.feature @@ -9,17 +9,16 @@ Feature: Latest announcements block displays the course latest news Given the following "users" exist: | username | firstname | lastname | email | | teacher1 | Teacher | 1 | teacher1@example.com | - And I log in as "admin" - And I create a course with: - | Course full name | Course 1 | - | Course short name | C1 | - | Number of announcements | 5 | - And I enrol "Teacher 1" user as "Teacher" - And I log out - And I log in as "teacher1" - And I am on "Course 1" course homepage with editing mode on - And I add the "Latest announcements" block - And I turn editing mode off + And the following "courses" exist: + | fullname | shortname | category | newsitems | + | Course 1 | C1 | 0 | 5 | + And the following "course enrolments" exist: + | user | course | role | + | teacher1 | C1 | editingteacher | + And the following "blocks" exist: + | blockname | contextlevel | reference | pagetypepattern | defaultregion | + | news_items | Course | C1 | course-view-* | side-pre | + And I am on the "Course 1" Course page logged in as teacher1 When I add a new topic to "Announcements" forum with: | Subject | Discussion One | | Message | Not important | 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 0486531a96e..f88bb751175 100644 --- a/blocks/private_files/tests/behat/block_private_files_activity.feature +++ b/blocks/private_files/tests/behat/block_private_files_activity.feature @@ -17,10 +17,10 @@ Feature: The private files block allows users to store files privately in moodle And the following "activities" exist: | activity | course | idnumber | name | intro | | 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 am on the "Test page name" "page activity" page - And I add the "Private files" block + And the following "blocks" exist: + | blockname | contextlevel | reference | pagetypepattern | defaultregion | + | private_files | Activity module | page1 | mod-page-* | side-pre | + And I am on the "Test page name" "page activity" page logged in as teacher1 And I should see "No files available" in the "Private files" "block" When I follow "Manage private files..." And I upload "blocks/private_files/tests/fixtures/testfile.txt" file to "Files" filemanager diff --git a/blocks/private_files/tests/behat/block_private_files_course.feature b/blocks/private_files/tests/behat/block_private_files_course.feature index 35a4e9629cc..7261d6d55df 100644 --- a/blocks/private_files/tests/behat/block_private_files_course.feature +++ b/blocks/private_files/tests/behat/block_private_files_course.feature @@ -14,9 +14,11 @@ Feature: The private files block allows users to store files privately in moodle And the following "course enrolments" exist: | user | course | role | | teacher1 | C1 | editingteacher | + And the following "blocks" exist: + | blockname | contextlevel | reference | pagetypepattern | defaultregion | + | private_files | Course | C1 | course-view-* | side-pre | And I log in as "teacher1" And I am on "Course 1" course homepage with editing mode on - 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..." And I upload "blocks/private_files/tests/fixtures/testfile.txt" file to "Files" filemanager diff --git a/blocks/private_files/tests/behat/block_private_files_frontpage.feature b/blocks/private_files/tests/behat/block_private_files_frontpage.feature index cd3ef3b1665..93509fd1432 100644 --- a/blocks/private_files/tests/behat/block_private_files_frontpage.feature +++ b/blocks/private_files/tests/behat/block_private_files_frontpage.feature @@ -11,11 +11,9 @@ Feature: The private files block allows users to store files privately in moodle And the following "users" exist: | username | firstname | lastname | email | | teacher1 | Teacher | 1 | teacher1@example.com | - And I log in as "admin" - And I am on site homepage - And I turn editing mode on - And I add the "Private files" block - And I log out + And the following "blocks" exist: + | blockname | contextlevel | reference | pagetypepattern | defaultregion | + | private_files | System | 1 | site-index | side-pre | Scenario: Try to view the private files block as a guest Given I log in as "guest" diff --git a/blocks/search_forums/tests/behat/block_search_forums_course.feature b/blocks/search_forums/tests/behat/block_search_forums_course.feature index 8ad1d9fcd71..73128e43f3c 100644 --- a/blocks/search_forums/tests/behat/block_search_forums_course.feature +++ b/blocks/search_forums/tests/behat/block_search_forums_course.feature @@ -16,14 +16,15 @@ Feature: The search forums block allows users to search for forum posts on cours | user | course | role | | teacher1 | C1 | editingteacher | | student1 | C1 | student | + And the following "blocks" exist: + | blockname | contextlevel | reference | pagetypepattern | defaultregion | + | news_items | Course | C1 | course-view-* | side-pre | + | search_forums | Course | C1 | course-view-* | side-pre | And I log in as "teacher1" And I am on "Course 1" course homepage And I navigate to "Settings" in current page administration And I set the field "id_newsitems" to "1" And I press "Save and display" - And I turn editing mode on - And I add the "Latest announcements" block - And I add the "Search forums" block And I log out Scenario: Use the search forum block in a course without any forum posts diff --git a/blocks/search_forums/tests/behat/block_search_forums_frontpage.feature b/blocks/search_forums/tests/behat/block_search_forums_frontpage.feature index 53d09348b57..952a0357bc4 100644 --- a/blocks/search_forums/tests/behat/block_search_forums_frontpage.feature +++ b/blocks/search_forums/tests/behat/block_search_forums_frontpage.feature @@ -8,11 +8,9 @@ Feature: The search forums block allows users to search for forum posts on front Given the following "users" exist: | username | firstname | lastname | email | idnumber | | student1 | Student | 1 | student1@example.com | S1 | - And I log in as "admin" - And I am on site homepage - And I turn editing mode on - And I add the "Search forums" block - And I log out + And the following "blocks" exist: + | blockname | contextlevel | reference | pagetypepattern | defaultregion | + | search_forums | System | 1 | site-index | side-pre | Scenario: Use the search forum block on the frontpage and search for posts as a user Given I log in as "student1" diff --git a/blocks/section_links/tests/behat/show_section_name.feature b/blocks/section_links/tests/behat/show_section_name.feature index 7d3b3d3a51e..e121c5dad74 100644 --- a/blocks/section_links/tests/behat/show_section_name.feature +++ b/blocks/section_links/tests/behat/show_section_name.feature @@ -22,7 +22,9 @@ Feature: The Section links block can be configured to display section name in ad And I am on "Course 1" course homepage with editing mode on And the following config values are set as admin: | unaddableblocks | | theme_boost| - And I add the "Section links" block + And the following "blocks" exist: + | blockname | contextlevel | reference | pagetypepattern | defaultregion | + | section_links | Course | C1 | course-view-* | side-pre | And I log out Scenario: Student can see section name under the Section links block diff --git a/blocks/site_main_menu/tests/behat/add_url.feature b/blocks/site_main_menu/tests/behat/add_url.feature index cd4483cf748..b8f697d5750 100644 --- a/blocks/site_main_menu/tests/behat/add_url.feature +++ b/blocks/site_main_menu/tests/behat/add_url.feature @@ -4,12 +4,19 @@ Feature: Add URL to main menu block As a admin I need to add URLs to the main menu block and check it works. + Background: + Given the following "courses" exist: + | fullname | shortname | category | enablecompletion | + | Course 1 | C1 | 0 | 1 | + | Course 2 | C2 | 0 | | + And the following "blocks" exist: + | blockname | contextlevel | reference | pagetypepattern | defaultregion | + | site_main_menu | System | 1 | site-index | side-pre | + @javascript Scenario: Add a URL in menu block and ensure it appears Given I log in as "admin" And I am on site homepage - And I turn editing mode on - And I add the "Main menu" block And the following "activity" exists: | activity | url | | course | Acceptance test site | @@ -22,20 +29,15 @@ Feature: Add URL to main menu block And I set the following fields to these values: | id_display | In pop-up | And I press "Save and return to course" + And I turn editing mode on Then "reference link" "link" should exist in the "Main menu" "block" And "Add an activity or resource" "button" should exist in the "Main menu" "block" @javascript Scenario: Add a URL in menu block can appear in the entire site - Given the following "course" exists: - | fullname | Course 1 | - | shortname | C1 | - | category | 0 | - | enablecompletion | 1 | When I log in as "admin" And I am on site homepage And I turn editing mode on - And I add the "Main menu" block And I configure the "Main menu" block And I set the following fields to these values: | Page contexts | Display throughout the entire site | @@ -61,15 +63,9 @@ Feature: Add URL to main menu block @javascript Scenario: Add a URL in menu block can appear in any front page - Given the following "course" exists: - | fullname | Course 1 | - | shortname | C1 | - | category | 0 | - | enablecompletion | 1 | When I log in as "admin" And I am on site homepage And I turn editing mode on - And I add the "Main menu" block And I configure the "Main menu" block And I set the following fields to these values: | Page contexts | Display on the site home and any pages added to the site home. | @@ -95,22 +91,17 @@ Feature: Add URL to main menu block @javascript Scenario: When the "Main Menu" block is displayed throrought the entire site, adding an URL in a course - results in adding it in the course and not in the frontpage - Given the following "course" exists: - | fullname | Course 1 | - | shortname | C1 | - | category | 0 | - And I log in as "admin" + results in adding it in the course and not in the frontpage + Given I log in as "admin" And I am on site homepage And I turn editing mode on - And I add the "Main menu" block And I configure the "Main menu" block And I set the following fields to these values: | Page contexts | Display throughout the entire site | And I press "Save changes" When the following "activity" exists: | activity | url | - | course | C1 | + | course | C2 | | name | reference link | | intro | mooooooooodle | | externalurl | http://www.moodle.com | diff --git a/blocks/site_main_menu/tests/behat/edit_activities.feature b/blocks/site_main_menu/tests/behat/edit_activities.feature index 45d50143408..9ead1093b07 100644 --- a/blocks/site_main_menu/tests/behat/edit_activities.feature +++ b/blocks/site_main_menu/tests/behat/edit_activities.feature @@ -11,10 +11,12 @@ Feature: Edit activities in main menu block | course | Acceptance test site | | name | My forum name | | idnumber | forum | + And the following "blocks" exist: + | blockname | contextlevel | reference | pagetypepattern | defaultregion | + | site_main_menu | System | 1 | site-index | side-pre | And I log in as "admin" And I am on site homepage And I turn editing mode on - And I add the "Main menu" block When I set the field "Edit title" in the "My forum name" "block_site_main_menu > Activity" to "New forum name" Then I should not see "My forum name" And I should see "New forum name" diff --git a/blocks/social_activities/tests/behat/edit_activities.feature b/blocks/social_activities/tests/behat/edit_activities.feature index 8a63dd36fc8..9ee9c77acd8 100644 --- a/blocks/social_activities/tests/behat/edit_activities.feature +++ b/blocks/social_activities/tests/behat/edit_activities.feature @@ -35,9 +35,11 @@ Feature: Edit activities in social activities block Scenario: Activities in social activities block can be made available but not visible on a course page Given the following config values are set as admin: | allowstealth | 1 | + And the following "blocks" exist: + | blockname | contextlevel | reference | pagetypepattern | defaultregion | + | recent_activity | Course | C1 | course-view-* | side-pre | And I log in as "user1" And I am on "Course 1" course homepage with editing mode on - And I add the "Recent activity" block And I press "Add an activity or resource" And I click on "Add a new Forum" "link" in the "Add an activity or resource" "dialogue" And I set the field "Forum name" to "My forum name" diff --git a/blocks/tests/behat/delete_block.feature b/blocks/tests/behat/delete_block.feature index 963cadfae0f..f324827e3cc 100644 --- a/blocks/tests/behat/delete_block.feature +++ b/blocks/tests/behat/delete_block.feature @@ -8,10 +8,11 @@ Feature: Block removal via modal Given the following "courses" exist: | fullname | shortname | category | | Course 1 | C1 | 0 | + And the following "blocks" exist: + | blockname | contextlevel | reference | pagetypepattern | defaultregion | + | search_forums | Course | C1 | course-view-* | side-pre | And I log in as "admin" And I am on "Course 1" course homepage with editing mode on - And I add the "Search forums" block - And "Search forums" "block" should exist @javascript Scenario: Removing a block via modal should remove the block on the page diff --git a/blocks/tests/behat/hidden_block_region.feature b/blocks/tests/behat/hidden_block_region.feature index e41f9f26917..50221740da7 100644 --- a/blocks/tests/behat/hidden_block_region.feature +++ b/blocks/tests/behat/hidden_block_region.feature @@ -11,12 +11,14 @@ Feature: Show hidden blocks in a docked block region when editing And the following "course enrolments" exist: | user | course | role | | admin | C1 | editingteacher | + And the following "blocks" exist: + | blockname | contextlevel | reference | pagetypepattern | defaultregion | + | search_forums | Course | C1 | course-view-* | side-pre | + | news_items | Course | C1 | course-view-* | side-pre | + | calendar_upcoming | Course | C1 | course-view-* | side-pre | + | recent_activity | Course | C1 | course-view-* | side-pre | And I log in as "admin" And I am on "Course 1" course homepage with editing mode on - And I add the "Search forums" block - And I add the "Latest announcements" block - And I add the "Upcoming events" block - And I add the "Recent activity" block # Hide all the blocks in the non-default region And I configure the "Search forums" block And I set the following fields to these values: diff --git a/blocks/tests/behat/hide_blocks.feature b/blocks/tests/behat/hide_blocks.feature index 0a4f9fae911..abd1499f48a 100644 --- a/blocks/tests/behat/hide_blocks.feature +++ b/blocks/tests/behat/hide_blocks.feature @@ -8,18 +8,20 @@ Feature: Block visibility Given the following "courses" exist: | fullname | shortname | category | | Course 1 | C1 | 0 | + And the following "blocks" exist: + | blockname | contextlevel | reference | pagetypepattern | defaultregion | + | search_forums | Course | C1 | course-view-* | side-pre | And I log in as "admin" And I am on "Course 1" course homepage with editing mode on @javascript Scenario: Hiding all blocks on the page should remove the column they're in - Given I add the "Search forums" block - And I open the "Search forums" blocks action menu + When I open the "Search forums" blocks action menu And I click on "Configure Search forums block" "link" in the "Search forums" "block" And I set the field "Region" to "Right" And I press "Save changes" And I turn editing mode off - And ".empty-region-side-post" "css_element" should not exist in the "body" "css_element" + Then ".empty-region-side-post" "css_element" should not exist in the "body" "css_element" And I turn editing mode on And I open the "Search forums" blocks action menu And I click on "Hide Search forums block" "link" in the "Search forums" "block" diff --git a/blocks/tests/behat/manage_blocks.feature b/blocks/tests/behat/manage_blocks.feature index 1a86e24df6e..7e33803d719 100644 --- a/blocks/tests/behat/manage_blocks.feature +++ b/blocks/tests/behat/manage_blocks.feature @@ -22,9 +22,11 @@ Feature: Block appearances | book | Test book name | | title | Book title | | content | Book content test test | + And the following "blocks" exist: + | blockname | contextlevel | reference | pagetypepattern | defaultregion | + | comments | Course | C1 | course-view-* | side-pre | And I am on the "Course 1" course page logged in as teacher1 And I turn editing mode on - And I add the "Comments" block And I configure the "Comments" block And I set the following fields to these values: | Display on page types | Any page | diff --git a/blocks/tests/behat/move_blocks.feature b/blocks/tests/behat/move_blocks.feature index c16b6fe0896..f7201d7a21b 100644 --- a/blocks/tests/behat/move_blocks.feature +++ b/blocks/tests/behat/move_blocks.feature @@ -22,9 +22,11 @@ Feature: Block region moving | book | Test book name | | title | Book title | | content | Book content test test | + And the following "blocks" exist: + | blockname | contextlevel | reference | pagetypepattern | defaultregion | + | comments | Course | C1 | course-view-* | side-pre | And I log in as "teacher1" And I am on "Course 1" course homepage with editing mode on - And I add the "Comments" block And I configure the "Comments" block And I set the following fields to these values: | Display on page types | Any page | diff --git a/calendar/tests/behat/calendar.feature b/calendar/tests/behat/calendar.feature index 8f2c46fe50c..f1eba428232 100644 --- a/calendar/tests/behat/calendar.feature +++ b/calendar/tests/behat/calendar.feature @@ -30,10 +30,10 @@ Feature: Perform basic calendar functionality | user | group | | student1 | G1 | | teacher1 | G1 | - And I log in as "admin" - And I am on "Course 1" course homepage with editing mode on - And I add the "Calendar" block - And I log out + And the following "blocks" exist: + | blockname | contextlevel | reference | pagetypepattern | defaultregion | + | calendar_month | Course | C1 | course-view-* | side-pre | + | calendar_upcoming | Course | C4 | course-view-* | side-pre | @javascript Scenario: Create a site event @@ -294,7 +294,6 @@ Feature: Perform basic calendar functionality And the following config values are set as admin: | calendar_adminseesall | 0 | And I am on "Course 4" course homepage with editing mode on - And I add the "Upcoming events" block And I click on "Go to calendar..." "link" in the "Upcoming events" "block" And I click on "New event" "button" And I should see "Course" in the "Type of event" "select" diff --git a/calendar/tests/behat/calendar_lookahead.feature b/calendar/tests/behat/calendar_lookahead.feature index 0b174ae77b4..6a538cba458 100644 --- a/calendar/tests/behat/calendar_lookahead.feature +++ b/calendar/tests/behat/calendar_lookahead.feature @@ -14,12 +14,14 @@ Feature: Limit displayed upcoming events And the following "course enrolments" exist: | user | course | role | | teacher1 | C1 | editingteacher | + And the following "blocks" exist: + | blockname | contextlevel | reference | pagetypepattern | defaultregion | + | calendar_month | Course | C1 | course-view-* | side-pre | + | calendar_upcoming | Course | C1 | course-view-* | side-pre | And I log in as "teacher1" Scenario: I view calendar details for a future event Given I am on "Course 1" course homepage with editing mode on - And I add the "Calendar" block - And I add the "Upcoming events" block And I follow "Full calendar" And I click on "a.next" "css_element" And I click on "a.next" "css_element" diff --git a/completion/tests/behat/activity_completion_criteria.feature b/completion/tests/behat/activity_completion_criteria.feature index 34d114649ab..14d99da2341 100644 --- a/completion/tests/behat/activity_completion_criteria.feature +++ b/completion/tests/behat/activity_completion_criteria.feature @@ -23,6 +23,9 @@ Feature: Allow to mark course as completed without cron for activity completion | name | Test assignment name | | idnumber | assign1 | | description | Test assignment description | + And the following "blocks" exist: + | blockname | contextlevel | reference | pagetypepattern | defaultregion | + | completionstatus | Course | CC1 | course-view-* | side-pre | And I log in as "admin" And I am on "Completion course" course homepage And I navigate to "Settings" in current page administration @@ -38,9 +41,6 @@ Feature: Allow to mark course as completed without cron for activity completion And I expand all fieldsets And I set the field "Assignment - Test assignment name" to "1" And I press "Save changes" - And I turn editing mode on - And I add the "Course completion status" block - And I log out @javascript Scenario: Update course completion when student marks activity as complete diff --git a/completion/tests/behat/course_completion_activity_criteria.feature b/completion/tests/behat/course_completion_activity_criteria.feature index 998fd1656ef..95e7889011a 100644 --- a/completion/tests/behat/course_completion_activity_criteria.feature +++ b/completion/tests/behat/course_completion_activity_criteria.feature @@ -28,13 +28,15 @@ Feature: Course completion state should match completion criteria | assignsubmission_onlinetext_enabled | 1 | | grade[modgrade_type] | Point | | grade[modgrade_point] | 100 | + And the following "blocks" exist: + | blockname | contextlevel | reference | pagetypepattern | defaultregion | + | completionstatus | Course | C1 | course-view-* | side-pre | And I log in as "teacher1" And I am on "Course 1" course homepage with editing mode on And I navigate to "Course completion" in current page administration And I click on "Condition: Activity completion" "link" And I set the field "Assignment - Test assignment name" to "1" And I press "Save changes" - And I add the "Course completion status" block And I am on the "Test assignment name" "assign activity" page And I navigate to "Settings" in current page administration And I set the following fields to these values: diff --git a/completion/tests/behat/teacher_manual_completion.feature b/completion/tests/behat/teacher_manual_completion.feature index 13810f37546..3ff267c4187 100644 --- a/completion/tests/behat/teacher_manual_completion.feature +++ b/completion/tests/behat/teacher_manual_completion.feature @@ -6,8 +6,8 @@ Feature: Allow teachers to manually mark users as complete when configured Scenario: Mark a student as complete using the completion report Given the following "courses" exist: - | fullname | shortname | category | - | Completion course | CC1 | 0 | + | fullname | shortname | category | enablecompletion | + | Completion course | CC1 | 0 | 1 | And the following "users" exist: | username | firstname | lastname | email | | student1 | Student | First | student1@example.com | @@ -16,14 +16,14 @@ Feature: Allow teachers to manually mark users as complete when configured | user | course | role | | student1 | CC1 | student | | teacher1 | CC1 | editingteacher | + And the following "blocks" exist: + | blockname | contextlevel | reference | pagetypepattern | defaultregion | + | completionstatus | Course | CC1 | course-view-* | side-pre | And I log in as "admin" And I am on "Completion course" course homepage - And completion tracking is "Enabled" in current course - And I follow "Course completion" + And I navigate to "Course completion" in current page administration And I set the field "Teacher" to "1" And I press "Save changes" - And I turn editing mode on - And I add the "Course completion status" block And I log out And I log in as "student1" And I am on "Completion course" course homepage diff --git a/course/tests/behat/activities_visibility_icons.feature b/course/tests/behat/activities_visibility_icons.feature index acb3c69ce61..ea6afc03ef5 100644 --- a/course/tests/behat/activities_visibility_icons.feature +++ b/course/tests/behat/activities_visibility_icons.feature @@ -19,6 +19,9 @@ Feature: Toggle activities visibility from the course page And the following "activities" exist: | activity | course | section | idnumber | name | intro | id_visible | | assign | C1 | 1 | 1 | Test assignment name | Test assignment description | 1 | + And the following "blocks" exist: + | blockname | contextlevel | reference | pagetypepattern | defaultregion | + | recent_activity | Course | C1 | course-view-* | side-pre | @javascript Scenario: Hide/Show toggle with javascript enabled @@ -77,7 +80,6 @@ Feature: Toggle activities visibility from the course page | visible | 1 | And I log in as "teacher1" And I am on "Course 1" course homepage with editing mode on - And I add the "Recent activity" block When I hide section "2" Then "Test forum name" activity should be hidden And I open "Test forum name" actions menu @@ -117,7 +119,6 @@ Feature: Toggle activities visibility from the course page | allowstealth | 1 | And I log in as "teacher1" And I am on "Course 1" course homepage with editing mode on - And I add the "Recent activity" block When I open "Test assignment name" actions menu Then "Test assignment name" actions menu should not have "Show" item And "Test assignment name" actions menu should have "Hide" item diff --git a/mod/assign/tests/behat/group_submission.feature b/mod/assign/tests/behat/group_submission.feature index 93325c17931..8fe6df14f36 100644 --- a/mod/assign/tests/behat/group_submission.feature +++ b/mod/assign/tests/behat/group_submission.feature @@ -295,11 +295,9 @@ Feature: Group assignment submissions And the following "mod_assign > submissions" exist: | assign | user | onlinetext | | Test assignment name | student1 | I'm the student's first submission | - - And I log in as "teacher1" - And I am on "Course 1" course homepage with editing mode on - And I add the "Activities" block - And I log out + And the following "blocks" exist: + | blockname | contextlevel | reference | pagetypepattern | defaultregion | + | activity_modules | Course | C1 | course-view-* | side-pre | And I am on the "C1" Course page logged in as student1 And I click on "Assignments" "link" in the "Activities" "block" diff --git a/mod/assign/tests/behat/set_availability.feature b/mod/assign/tests/behat/set_availability.feature index ef77d244b00..051ad836ea7 100644 --- a/mod/assign/tests/behat/set_availability.feature +++ b/mod/assign/tests/behat/set_availability.feature @@ -33,7 +33,6 @@ Feature: Set availability dates for an assignment And the activity date in "Assignment name" should contain "Opens:" And the activity date in "Assignment name" should contain "##tomorrow noon##%A, %d %B %Y, %I:%M##" - @javascript Scenario: Student can see the assignment's due date in the course calendar Given the following "activity" exists: | activity | assign | diff --git a/mod/choice/tests/behat/block_editing.feature b/mod/choice/tests/behat/block_editing.feature index 70de2df758e..41ee7b4dc9c 100644 --- a/mod/choice/tests/behat/block_editing.feature +++ b/mod/choice/tests/behat/block_editing.feature @@ -17,10 +17,12 @@ Feature: Editing choice block | intro | Choice Description 1 | | section | 1 | | option | Option 1, Option 2 | + And the following "blocks" exist: + | blockname | contextlevel | reference | pagetypepattern | defaultregion | + | blog_menu | Activity module | choice1 | mod-choice-* | side-pre | And I log in as "admin" And I am on "Course 1" course homepage with editing mode on And I follow "Choice name 1" - And I add the "Blog menu" block And I should see "View all entries about this Choice" When I configure the "Blog menu" block And I press "Save changes" @@ -51,10 +53,12 @@ Feature: Editing choice block | intro | Choice Description 1 | | section | 1 | | option | Option 1, Option 2 | + And the following "blocks" exist: + | blockname | contextlevel | reference | pagetypepattern | defaultregion | + | blog_menu | Activity module | choice1 | mod-choice-* | side-pre | And I log in as "teacher1" And I am on "Course 1" course homepage with editing mode on And I follow "Choice name 1" - And I add the "Blog menu" block And I should see "View all entries about this Choice" When I configure the "Blog menu" block And I press "Save changes" @@ -84,10 +88,12 @@ Feature: Editing choice block | intro | Choice Description 1 | | section | 1 | | option | Option 1, Option 2 | + And the following "blocks" exist: + | blockname | contextlevel | reference | pagetypepattern | defaultregion | + | blog_menu | Activity module | choice1 | mod-choice-* | side-pre | And I log in as "teacher1" And I am on "Course 1" course homepage with editing mode on And I follow "Choice name 1" - And I add the "Blog menu" block And I should see "View all entries about this Choice" When I configure the "Blog menu" block And I press "Save changes" diff --git a/mod/data/tests/behat/data_activities.feature b/mod/data/tests/behat/data_activities.feature index 5274cffa7e7..bbd900fc096 100644 --- a/mod/data/tests/behat/data_activities.feature +++ b/mod/data/tests/behat/data_activities.feature @@ -17,10 +17,9 @@ Feature: Users can view the list of data activities and their formatted descript | activity | name | intro | course | idnumber | | data | Test database 1 | This is an intro without an image | C1 | data1 | | data | Test database 2 | This is an intro with an image: | C1 | data2 | - And I log in as "admin" - And I am on "Course 1" course homepage with editing mode on - And I add the "Activities" block - And I log out + And the following "blocks" exist: + | blockname | contextlevel | reference | pagetypepattern | defaultregion | + | activity_modules | Course | C1 | course-view-* | side-pre | Scenario: Teachers can view the list of data activities and their formatted descriptions Given I log in as "teacher1" diff --git a/mod/feedback/tests/behat/coursemapping.feature b/mod/feedback/tests/behat/coursemapping.feature index ae68aa53c7c..5cdd2c7f5c2 100644 --- a/mod/feedback/tests/behat/coursemapping.feature +++ b/mod/feedback/tests/behat/coursemapping.feature @@ -35,6 +35,11 @@ Feature: Mapping courses in a feedback | feedback | Course feedback | Acceptance test site | feedback0 | 1 | 1 | 1 | | feedback | Another feedback | C1 | feedback1 | 1 | 1 | 0 | And I enable "feedback" "block" plugin + And the following "blocks" exist: + | blockname | contextlevel | reference | pagetypepattern | defaultregion | + | feedback | Course | C1 | course-view-* | side-pre | + | feedback | Course | C2 | course-view-* | side-pre | + | feedback | Course | C3 | course-view-* | side-pre | When I log in as "manager" And I am on site homepage And I follow "Course feedback" @@ -54,14 +59,6 @@ Feature: Mapping courses in a feedback | Multiple choice type | Multiple choice - single answer allowed (drop-down menu) | | Multiple choice values | option d\noption e\noption f | And I log out - And I log in as "teacher" - And I am on "Course 1" course homepage with editing mode on - And I add the "Feedback" block - And I am on "Course 2" course homepage - And I add the "Feedback" block - And I am on "Course 3" course homepage - And I add the "Feedback" block - And I log out Scenario: Course feedback can not be mapped And I log in as "manager" diff --git a/mod/forum/tests/behat/advanced_search.feature b/mod/forum/tests/behat/advanced_search.feature index 77c003e5c88..cb29436e89d 100644 --- a/mod/forum/tests/behat/advanced_search.feature +++ b/mod/forum/tests/behat/advanced_search.feature @@ -21,9 +21,11 @@ Feature: The forum search allows users to perform advanced searches for forum po And the following "tags" exist: | name | isstandard | | SearchedTag | 1 | + And the following "blocks" exist: + | blockname | contextlevel | reference | pagetypepattern | defaultregion | + | news_items | Course | C1 | course-view-* | side-pre | And I log in as "teacher1" And I am on "Course 1" course homepage with editing mode on - And I add the "Latest announcements" block And I navigate to "Settings" in current page administration And I expand all fieldsets And I set the field "id_newsitems" to "1" diff --git a/mod/forum/tests/behat/edit_post_student.feature b/mod/forum/tests/behat/edit_post_student.feature index d4c1bfbbee3..eac8124f87d 100644 --- a/mod/forum/tests/behat/edit_post_student.feature +++ b/mod/forum/tests/behat/edit_post_student.feature @@ -41,12 +41,13 @@ Feature: Students can edit or delete their forum posts within a set time limit @javascript @block_recent_activity Scenario: Time limit expires - Given I log out + Given the following "blocks" exist: + | blockname | contextlevel | reference | pagetypepattern | defaultregion | + | recent_activity | Course | C1 | course-view-* | side-pre | + And I log out And I log in as "admin" And the following config values are set as admin: | maxeditingtime | 1 | - And I am on "Course 1" course homepage with editing mode on - And I add the "Recent activity" block And I am on the "Course 1" course page logged in as student1 And I should see "New forum posts:" in the "Recent activity" "block" And I should see "Forum post subject" in the "Recent activity" "block" diff --git a/mod/forum/tests/behat/recent_activity.feature b/mod/forum/tests/behat/recent_activity.feature index 693c2ab762c..7b98860f2ba 100644 --- a/mod/forum/tests/behat/recent_activity.feature +++ b/mod/forum/tests/behat/recent_activity.feature @@ -35,9 +35,10 @@ Feature: Users can see the relevant recent forum posts from the recent activity | forum | Standard forum | C1 | forum3 | general | 0 | 1 | | forum | Hidden forum | C1 | forum4 | general | 0 | 0 | | forum | Q&A forum | C1 | forum5 | qanda | 0 | 1 | + And the following "blocks" exist: + | blockname | contextlevel | reference | pagetypepattern | defaultregion | + | recent_activity | Course | C1 | course-view-* | side-pre | And I log in as "teacher1" - And I am on "Course 1" course homepage with editing mode on - And I add the "Recent activity" block Scenario: Recent forum activity with separate group discussion Given I add a new discussion to "Separate groups forum" forum with: diff --git a/mod/glossary/tests/behat/import_entries.feature b/mod/glossary/tests/behat/import_entries.feature index 7d6daf8e937..7f7e6739d83 100644 --- a/mod/glossary/tests/behat/import_entries.feature +++ b/mod/glossary/tests/behat/import_entries.feature @@ -17,12 +17,14 @@ Feature: Importing glossary entries And the following "activities" exist: | activity | course | idnumber | name | | glossary | C1 | glossary1 | Glossary 1 | + And the following "blocks" exist: + | blockname | contextlevel | reference | pagetypepattern | defaultregion | + | recent_activity | Course | C1 | course-view-* | side-pre | + | tags | Course | C1 | course-view-* | side-pre | @javascript @block_recent_activity Scenario: Importing glossary entries and checking the Recent activity block 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 am on the "Glossary 1" "glossary activity" page And I press "Import entries" And I upload "mod/glossary/tests/fixtures/texfilter_glossary_en.xml" file to "File to import" filemanager @@ -36,8 +38,6 @@ Feature: Importing glossary entries @javascript @block_tags Scenario: Importing glossary entries and checking Tags block 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 am on the "Glossary 1" "glossary activity" page And I press "Import entries" And I upload "mod/glossary/tests/fixtures/musicians.xml" file to "File to import" filemanager diff --git a/mod/h5pactivity/tests/behat/recent_activity.feature b/mod/h5pactivity/tests/behat/recent_activity.feature index d2250f85d2f..0d4b47f63ef 100644 --- a/mod/h5pactivity/tests/behat/recent_activity.feature +++ b/mod/h5pactivity/tests/behat/recent_activity.feature @@ -26,10 +26,9 @@ Feature: Users can see the H5P recent activity from the recent activity block | course | C1 | | name | Awesome H5P package | | packagefilepath | h5p/tests/fixtures/multiple-choice-2-6.h5p | - And 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 log out + And the following "blocks" exist: + | blockname | contextlevel | reference | pagetypepattern | defaultregion | + | recent_activity | Course | C1 | course-view-* | side-pre | And I am on the "Awesome H5P package" "h5pactivity activity" page logged in as student1 # The H5P content needs some time to be displayed (so better to wait for 1 second to avoid random errors). And I switch to "h5p-player" class iframe diff --git a/my/tests/behat/reset_all_pages.feature b/my/tests/behat/reset_all_pages.feature index a321ac039f2..98ad9b38352 100644 --- a/my/tests/behat/reset_all_pages.feature +++ b/my/tests/behat/reset_all_pages.feature @@ -14,26 +14,21 @@ Feature: Reset all personalised pages to default | role | user | | moodle/block:edit | allow | | block/myprofile:addinstance | allow | + And the following "blocks" exist: + | blockname | contextlevel | reference | pagetypepattern | defaultregion | + | comments | User | student1 | my-index | side-pre | + | myprofile | User | student2 | user-profile | side-pre | And I log in as "student1" - And I follow "Dashboard" - And I turn editing mode on - And I add the "Comments" block - And I turn editing mode off And I should see "Comments" And I log out And I log in as "student2" And I follow "Profile" in the user menu - And I should not see "Logged in user" - And I turn editing mode on - And I add the "Logged in user" block - And I turn editing mode off And I should see "Logged in user" And I log out And I log in as "student3" - And I follow "Dashboard" And I should not see "Comments" And I follow "Profile" in the user menu And I should not see "Logged in user" diff --git a/user/tests/behat/custom_profile_fields.feature b/user/tests/behat/custom_profile_fields.feature index 3e80ae21ea7..1a1856683e7 100644 --- a/user/tests/behat/custom_profile_fields.feature +++ b/user/tests/behat/custom_profile_fields.feature @@ -223,11 +223,9 @@ Feature: Custom profile fields should be visible and editable by those with the | moodle/user:viewalldetails | Allow | parent | User | userwithinformation | | moodle/user:viewdetails | Allow | parent | User | userwithinformation | | moodle/user:editprofile | Allow | parent | User | userwithinformation | - Given I log in as "admin" - And I am on site homepage - And I turn editing mode on - And I add the "Mentees" block - And I log out + And the following "blocks" exist: + | blockname | contextlevel | reference | pagetypepattern | defaultregion | + | mentees | System | 1 | site-index | side-pre | And I log in as "parent" And I am on site homepage When I follow "userwithinformation" diff --git a/user/tests/behat/user_grade_navigation.feature b/user/tests/behat/user_grade_navigation.feature index 02a1e11d21f..d57f3093ce3 100644 --- a/user/tests/behat/user_grade_navigation.feature +++ b/user/tests/behat/user_grade_navigation.feature @@ -67,10 +67,10 @@ Feature: The student can navigate to their grades page and user grade report. | moodle/user:viewalldetails | allow | | moodle/user:viewuseractivitiesreport | allow | | moodle/user:viewdetails | allow | + And the following "blocks" exist: + | blockname | contextlevel | reference | pagetypepattern | defaultregion | + | mentees | System | 1 | site-index | side-pre | When I log in as "admin" - And I am on site homepage - And I turn editing mode on - And I add the "Mentees" block And I am on the "student1" "user > profile" page And I click on "Preferences" "link" in the ".profile_tree" "css_element" And I follow "Assign roles relative to this user" diff --git a/user/tests/behat/view_preferences_page.feature b/user/tests/behat/view_preferences_page.feature index 35bac5f7048..747009cc2b6 100644 --- a/user/tests/behat/view_preferences_page.feature +++ b/user/tests/behat/view_preferences_page.feature @@ -60,10 +60,12 @@ Feature: Access to preferences page | moodle/user:viewalldetails | allow | | moodle/user:viewuseractivitiesreport | allow | | moodle/user:viewdetails | allow | + And the following "blocks" exist: + | blockname | contextlevel | reference | pagetypepattern | defaultregion | + | mentees | System | 1 | site-index | side-pre | When I log in as "admin" And I am on site homepage And I turn editing mode on - And I add the "Mentees" block And I am on the "student1" "user > profile" page And I click on "Preferences" "link" in the ".profile_tree" "css_element" And I follow "Assign roles relative to this user"