From 09792257fda95a8b8b952220e2ee577361123fcd Mon Sep 17 00:00:00 2001 From: Angelia Dela Cruz Date: Fri, 9 Jun 2023 12:56:11 +0800 Subject: [PATCH] MDL-78158 behat: Behat cleanup and optimisation --- .../util/ui/tests/behat/import_course.feature | 6 +- .../behat/addunsupportedactivity.feature | 3 +- .../tests/behat/defaultsettings.feature | 2 - .../behat/block_badges_frontpage.feature | 7 +- .../behat/block_blog_menu_activity.feature | 69 +++++-------------- .../behat/block_blog_menu_course.feature | 35 +++------- .../behat/block_blog_recent_activity.feature | 8 +-- .../behat/block_blog_recent_course.feature | 6 +- .../tests/behat/block_calendar_month.feature | 14 ++-- .../comments/tests/behat/add_comment.feature | 3 +- .../behat/block_comment_activity.feature | 9 +-- .../tests/behat/block_comment_course.feature | 7 +- .../tests/behat/delete_comment.feature | 7 +- ...lock_completionstatus_manual_other.feature | 38 +++------- ...block_completionstatus_manual_self.feature | 7 +- .../behat/block_course_summary_course.feature | 6 +- .../behat/block_search_forums_course.feature | 28 +++----- .../tests/behat/show_section_name.feature | 7 +- .../tests/behat/edit_activities.feature | 5 +- calendar/tests/behat/calendar.feature | 28 +++----- .../activity_completion_criteria.feature | 43 +++--------- ...ourse_completion_activity_criteria.feature | 22 +----- .../behat/teacher_manual_completion.feature | 15 ++-- .../tests/behat/group_submission.feature | 6 -- .../tests/behat/set_availability.feature | 3 +- mod/data/tests/behat/data_activities.feature | 8 +-- mod/forum/tests/behat/advanced_search.feature | 10 +-- .../tests/behat/edit_post_student.feature | 2 - mod/forum/tests/behat/recent_activity.feature | 2 - .../tests/behat/import_entries.feature | 9 +-- .../tests/behat/recent_activity.feature | 2 - my/tests/behat/reset_all_pages.feature | 20 ++---- .../tests/behat/user_grade_navigation.feature | 3 +- .../tests/behat/view_preferences_page.feature | 2 - 34 files changed, 117 insertions(+), 325 deletions(-) diff --git a/backup/util/ui/tests/behat/import_course.feature b/backup/util/ui/tests/behat/import_course.feature index 29e70f8cadb..c0f1a00f755 100644 --- a/backup/util/ui/tests/behat/import_course.feature +++ b/backup/util/ui/tests/behat/import_course.feature @@ -20,9 +20,9 @@ Feature: Import course's contents into another course Scenario: Import course's contents to another course Given I log in as "teacher1" And the following "activities" exist: - | 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 | + | activity | name | course | idnumber | + | data | Test database name | C1 | database1 | + | forum | Test forum name | C1 | forum1 | And the following "blocks" exist: | blockname | contextlevel | reference | pagetypepattern | defaultregion | | comments | Course | C1 | course-view-* | side-pre | diff --git a/blocks/activity_results/tests/behat/addunsupportedactivity.feature b/blocks/activity_results/tests/behat/addunsupportedactivity.feature index c59522ca1b6..41a3e892d83 100644 --- a/blocks/activity_results/tests/behat/addunsupportedactivity.feature +++ b/blocks/activity_results/tests/behat/addunsupportedactivity.feature @@ -32,8 +32,7 @@ Feature: The activity results block doesn't display student scores for unsupport | config_gradeformat | Percentages | | config_nameformat | Display full names | And I press "Save changes" - When I follow "Test assignment" - And I navigate to "Settings" in current page administration + When I am on the "Test assignment" "assign activity editing" page And I set the following fields to these values: | id_grade_modgrade_type | None | And I press "Save and return to course" diff --git a/blocks/activity_results/tests/behat/defaultsettings.feature b/blocks/activity_results/tests/behat/defaultsettings.feature index f37391ac793..2ff1decdd2e 100644 --- a/blocks/activity_results/tests/behat/defaultsettings.feature +++ b/blocks/activity_results/tests/behat/defaultsettings.feature @@ -21,8 +21,6 @@ Feature: The activity results block can have administrator set defaults | course | C1 | | idnumber | 0001 | | name | Test assignment | - | 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 diff --git a/blocks/badges/tests/behat/block_badges_frontpage.feature b/blocks/badges/tests/behat/block_badges_frontpage.feature index 1e9ea2158be..f5710414887 100644 --- a/blocks/badges/tests/behat/block_badges_frontpage.feature +++ b/blocks/badges/tests/behat/block_badges_frontpage.feature @@ -17,8 +17,7 @@ Feature: Enable Block Badges on the frontpage and view awarded badges 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 + And I am on the "Course 1" course page logged in as teacher1 # Issue badge 1 of 2 And I navigate to "Badges > Add a new badge" in current page administration And I set the following fields to these values: @@ -35,7 +34,5 @@ Feature: Enable Block Badges on the frontpage and view awarded badges And I press "Award badge" And I set the field "potentialrecipients[]" to "Teacher 1 (teacher1@example.com)" And I press "Award badge" - And I log out - When I log in as "teacher1" - And I am on site homepage + When I am on site homepage Then I should see "Badge 1" in the "Latest badges" "block" 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 5c3ec0b44ce..00aaf132cbc 100644 --- a/blocks/blog_menu/tests/behat/block_blog_menu_activity.feature +++ b/blocks/blog_menu/tests/behat/block_blog_menu_activity.feature @@ -31,9 +31,7 @@ Feature: Enable Block blog menu in an activity | 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" - And I am on "Course 1" course homepage - And I follow "Test assignment 1" + Given I am on the "Test assignment 1" "assign activity" page logged in as student1 And I follow "Add a new entry" When I set the following fields to these values: | Entry title | S1 First Blog | @@ -41,16 +39,13 @@ Feature: Enable Block blog menu in an activity And I press "Save changes" Then I should see "S1 First Blog" And I should see "This is my awesome blog!" - And I am on "Course 1" course homepage - And I follow "Test assignment 1" + And I am on the "Test assignment 1" "assign activity" page And I follow "Blog entries" And I should see "S1 First Blog" And I should see "This is my awesome blog!" Scenario: Students use the blog menu block to view their blogs about the activity - Given I log in as "student1" - And I am on "Course 1" course homepage - And I follow "Test assignment 1" + Given I am on the "Test assignment 1" "assign activity" page logged in as student1 And I follow "Add an entry about this Assignment" And I set the following fields to these values: | Entry title | S1 First Blog | @@ -59,10 +54,7 @@ Feature: Enable Block blog menu in an activity And I should see "S1 First Blog" And I should see "This is my awesome blog about this Assignment!" And I should see "Associated Assignment: Test assignment 1" - And I log out - And I log in as "student2" - And I am on "Course 1" course homepage - And I follow "Test assignment 1" + And I am on the "Test assignment 1" "assign activity" page logged in as student2 And I follow "Add a new entry" And I set the following fields to these values: | Entry title | S2 Second Blog | @@ -71,8 +63,7 @@ Feature: Enable Block blog menu in an activity And I should see "S2 Second Blog" And I should see "My unrelated blog!" And I should not see "Associated Assignment: Test assignment 1" - And I am on "Course 1" course homepage - And I follow "Test assignment 1" + And I am on the "Test assignment 1" "assign activity" page And I follow "Add an entry about this Assignment" And I set the following fields to these values: | Entry title | S2 First Blog | @@ -81,17 +72,14 @@ Feature: Enable Block blog menu in an activity And I should see "S2 First Blog" And I should see "My course blog is better!" And I should see "Associated Assignment: Test assignment 1" - And I am on "Course 1" course homepage - And I follow "Test assignment 1" + And I am on the "Test assignment 1" "assign activity" page When I follow "View my entries about this Assignment" Then I should see "S2 First Blog" And I should not see "S2 Second Blog" And I should not see "S1 First Blog" Scenario: Students use the blog menu block to view all blogs about the assignment - Given I log in as "student1" - And I am on "Course 1" course homepage - And I follow "Test assignment 1" + Given I am on the "Test assignment 1" "assign activity" page logged in as student1 And I follow "Add an entry about this Assignment" And I set the following fields to these values: | Entry title | S1 First Blog | @@ -100,10 +88,7 @@ Feature: Enable Block blog menu in an activity And I should see "S1 First Blog" And I should see "This is my awesome blog about this Assignment!" And I should see "Associated Assignment: Test assignment 1" - And I log out - And I log in as "student2" - And I am on "Course 1" course homepage - And I follow "Test assignment 1" + And I am on the "Test assignment 1" "assign activity" page logged in as student2 And I follow "Add a new entry" And I set the following fields to these values: | Entry title | S2 Second Blog | @@ -112,8 +97,7 @@ Feature: Enable Block blog menu in an activity And I should see "S2 Second Blog" And I should see "My unrelated blog!" And I should not see "Associated Assignment: Test assignment 1" - And I am on "Course 1" course homepage - And I follow "Test assignment 1" + And I am on the "Test assignment 1" "assign activity" page And I follow "Add an entry about this Assignment" And I set the following fields to these values: | Entry title | S2 First Blog | @@ -122,17 +106,14 @@ Feature: Enable Block blog menu in an activity And I should see "S2 First Blog" And I should see "My course blog is better!" And I should see "Associated Assignment: Test assignment 1" - And I am on "Course 1" course homepage - And I follow "Test assignment 1" + And I am on the "Test assignment 1" "assign activity" page When I follow "View all entries about this Assignment" Then I should see "S1 First Blog" And I should see "S2 First Blog" And I should not see "S2 Second Blog" Scenario: Students use the blog menu block to view all their blog entries - Given I log in as "student1" - And I am on "Course 1" course homepage - And I follow "Test assignment 1" + Given I am on the "Test assignment 1" "assign activity" page logged in as student1 And I follow "Add an entry about this Assignment" And I set the following fields to these values: | Entry title | S1 First Blog | @@ -141,10 +122,7 @@ Feature: Enable Block blog menu in an activity And I should see "S1 First Blog" And I should see "This is my awesome blog about this Assignment!" And I should see "Associated Assignment: Test assignment 1" - And I log out - And I log in as "student2" - And I am on "Course 1" course homepage - And I follow "Test assignment 1" + And I am on the "Test assignment 1" "assign activity" page logged in as student2 And I follow "Add a new entry" And I set the following fields to these values: | Entry title | S2 Second Blog | @@ -153,8 +131,7 @@ Feature: Enable Block blog menu in an activity And I should see "S2 Second Blog" And I should see "My unrelated blog!" And I should not see "Associated Assignment: Test assignment 1" - And I am on "Course 1" course homepage - And I follow "Test assignment 1" + And I am on the "Test assignment 1" "assign activity" page And I follow "Add an entry about this Assignment" And I set the following fields to these values: | Entry title | S2 First Blog | @@ -163,17 +140,14 @@ Feature: Enable Block blog menu in an activity And I should see "S2 First Blog" And I should see "My course blog is better!" And I should see "Associated Assignment: Test assignment 1" - And I am on "Course 1" course homepage - And I follow "Test assignment 1" + And I am on the "Test assignment 1" "assign activity" page When I follow "Blog entries" Then I should see "S2 First Blog" And I should see "S2 Second Blog" And I should not see "S1 First Blog" Scenario: Teacher searches for student blogs - Given I log in as "student1" - And I am on "Course 1" course homepage - And I follow "Test assignment 1" + Given I am on the "Test assignment 1" "assign activity" page logged in as student1 And I follow "Add an entry about this Assignment" And I set the following fields to these values: | Entry title | S1 First Blog | @@ -182,10 +156,7 @@ Feature: Enable Block blog menu in an activity And I should see "S1 First Blog" And I should see "This is my awesome blog about this Assignment!" And I should see "Associated Assignment: Test assignment 1" - And I log out - And I log in as "student2" - And I am on "Course 1" course homepage - And I follow "Test assignment 1" + And I am on the "Test assignment 1" "assign activity" page logged in as student2 And I follow "Add a new entry" And I set the following fields to these values: | Entry title | S2 Second Blog | @@ -194,8 +165,7 @@ Feature: Enable Block blog menu in an activity And I should see "S2 Second Blog" And I should see "My unrelated blog!" And I should not see "Associated Assignment: Test assignment 1" - And I am on "Course 1" course homepage - And I follow "Test assignment 1" + And I am on the "Test assignment 1" "assign activity" page And I follow "Add an entry about this Assignment" And I set the following fields to these values: | Entry title | S2 First Blog | @@ -204,10 +174,7 @@ Feature: Enable Block blog menu in an activity And I should see "S2 First Blog" And I should see "My course blog is better!" And I should see "Associated Assignment: Test assignment 1" - And I log out - When I log in as "teacher1" - And I am on "Course 1" course homepage - And I follow "Test assignment 1" + When I am on the "Test assignment 1" "assign activity" page logged in as teacher1 And I set the field "Search" to "First" And I press "Search" Then I should see "S1 First Blog" 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 534ba358917..ba9c1fd2a07 100644 --- a/blocks/blog_menu/tests/behat/block_blog_menu_course.feature +++ b/blocks/blog_menu/tests/behat/block_blog_menu_course.feature @@ -23,8 +23,7 @@ Feature: Students can use block blog menu in a course | blog_menu | Course | C1 | course-view-* | side-pre | Scenario: Students use the blog menu block to post blogs - 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 follow "Add a new entry" When I set the following fields to these values: | Entry title | S1 First Blog | @@ -38,8 +37,7 @@ Feature: Students can use block blog menu in a course And I should see "This is my awesome blog!" Scenario: Students use the blog menu block to view their blogs about the course - 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 follow "Add an entry about this course" And I set the following fields to these values: | Entry title | S1 First Blog | @@ -48,9 +46,7 @@ Feature: Students can use block blog menu in a course And I should see "S1 First Blog" And I should see "This is my awesome blog about this course!" And I should see "Associated Course: C1" - And I log out - And I log in as "student2" - And I am on "Course 1" course homepage + And I am on the "Course 1" course page logged in as student2 And I follow "Add a new entry" And I set the following fields to these values: | Entry title | S2 Second Blog | @@ -75,8 +71,7 @@ Feature: Students can use block blog menu in a course And I should not see "S1 First Blog" Scenario: Students use the blog menu block to view all blogs about the course - 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 follow "Add an entry about this course" And I set the following fields to these values: | Entry title | S1 First Blog | @@ -85,9 +80,7 @@ Feature: Students can use block blog menu in a course And I should see "S1 First Blog" And I should see "This is my awesome blog about this course!" And I should see "Associated Course: C1" - And I log out - And I log in as "student2" - And I am on "Course 1" course homepage + And I am on the "Course 1" course page logged in as student2 And I follow "Add a new entry" And I set the following fields to these values: | Entry title | S2 Second Blog | @@ -112,8 +105,7 @@ Feature: Students can use block blog menu in a course And I should not see "S2 Second Blog" Scenario: Students use the blog menu block to view all their blog entries - 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 follow "Add an entry about this course" And I set the following fields to these values: | Entry title | S1 First Blog | @@ -122,9 +114,7 @@ Feature: Students can use block blog menu in a course And I should see "S1 First Blog" And I should see "This is my awesome blog about this course!" And I should see "Associated Course: C1" - And I log out - And I log in as "student2" - And I am on "Course 1" course homepage + And I am on the "Course 1" course page logged in as student2 And I follow "Add a new entry" And I set the following fields to these values: | Entry title | S2 Second Blog | @@ -149,8 +139,7 @@ Feature: Students can use block blog menu in a course And I should not see "S1 First Blog" Scenario: Teacher searches for student blogs - 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 follow "Add an entry about this course" And I set the following fields to these values: | Entry title | S1 First Blog | @@ -159,9 +148,7 @@ Feature: Students can use block blog menu in a course And I should see "S1 First Blog" And I should see "This is my awesome blog about this course!" And I should see "Associated Course: C1" - And I log out - And I log in as "student2" - And I am on "Course 1" course homepage + And I am on the "Course 1" course page logged in as student2 And I follow "Add a new entry" And I set the following fields to these values: | Entry title | S2 Second Blog | @@ -179,9 +166,7 @@ Feature: Students can use block blog menu in a course And I should see "S2 First Blog" And I should see "My course blog is better!" And I should see "Associated Course: C1" - And I log out - 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 set the field "Search" to "First" And I press "Search" Then I should see "S1 First Blog" 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 59bfe27c812..a9296b2e2ec 100644 --- a/blocks/blog_recent/tests/behat/block_blog_recent_activity.feature +++ b/blocks/blog_recent/tests/behat/block_blog_recent_activity.feature @@ -32,9 +32,7 @@ Feature: Students can use the recent blog entries block to view recent entries o | 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" - And I am on "Course 1" course homepage - And I follow "Test assignment 1" + Given I am on the "Test assignment 1" "assign activity" page logged in as student1 And I follow "Add an entry about this Assignment" When I set the following fields to these values: | Entry title | S1 First Blog | @@ -48,9 +46,7 @@ Feature: Students can use the recent blog entries block to view recent entries o And I should see "This is my awesome blog!" Scenario: Students only see a few entries in the recent blog entries block - Given I log in as "student1" - And I am on "Course 1" course homepage - And I follow "Test assignment 1" + Given I am on the "Test assignment 1" "assign activity" page logged in as student1 And I follow "Add an entry about this Assignment" # Blog 1 of 5 And I set the following fields to these values: 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 2307204bc40..8d0ba25ee47 100644 --- a/blocks/blog_recent/tests/behat/block_blog_recent_course.feature +++ b/blocks/blog_recent/tests/behat/block_blog_recent_course.feature @@ -24,8 +24,7 @@ Feature: Students can use the recent blog entries block to view recent entries o And the "multilang" filter applies to "content and headings" Scenario: Students use the recent blog entries block to view blogs - 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 follow "Add an entry about this course" When I set the following fields to these values: | Entry title | S1 First Blog RUSSIANENGLISH | @@ -39,8 +38,7 @@ Feature: Students can use the recent blog entries block to view recent entries o And I should see "This is my awesome blog!" Scenario: Students only see a few entries in the recent blog entries block - 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 follow "Add an entry about this course" # Blog 1 of 5 And I set the following fields to these values: diff --git a/blocks/calendar_month/tests/behat/block_calendar_month.feature b/blocks/calendar_month/tests/behat/block_calendar_month.feature index 983d0bf17f5..0c937332c6d 100644 --- a/blocks/calendar_month/tests/behat/block_calendar_month.feature +++ b/blocks/calendar_month/tests/behat/block_calendar_month.feature @@ -73,9 +73,7 @@ Feature: Enable the calendar block in a course and test it's functionality | user | group | | student1 | G1 | | student2 | G2 | - When I log in as "teacher1" - And I am on "Course 1" course homepage - And I navigate to "Settings" in current page administration + When I am on the "Course 1" "course editing" page logged in as teacher1 And I set the following fields to these values: | id_groupmode | Separate groups | | id_groupmodeforce | Yes | @@ -88,12 +86,8 @@ Feature: Enable the calendar block in a course and test it's functionality | Type of event | group | | Group | Group 1 | | Event title | Group Event | - And I log out - Then 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 hover over today in the mini-calendar block - And I should see "Group Event" - And I log out - And I log in as "student2" - And I am on "Course 1" course homepage + Then I should see "Group Event" + And I am on the "Course 1" course page logged in as student2 And I should not see "Group Event" diff --git a/blocks/comments/tests/behat/add_comment.feature b/blocks/comments/tests/behat/add_comment.feature index 3665d1f6ad2..5baf6d2d985 100644 --- a/blocks/comments/tests/behat/add_comment.feature +++ b/blocks/comments/tests/behat/add_comment.feature @@ -19,8 +19,7 @@ Feature: Add a comment to the comments block 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 am on the "Course 1" course page logged in as student1 @javascript Scenario: Add a comment with Javascript enabled diff --git a/blocks/comments/tests/behat/block_comment_activity.feature b/blocks/comments/tests/behat/block_comment_activity.feature index 95ee8277352..49c6dcbf37b 100644 --- a/blocks/comments/tests/behat/block_comment_activity.feature +++ b/blocks/comments/tests/behat/block_comment_activity.feature @@ -22,14 +22,9 @@ Feature: Enable Block comments on an activity page and view comments 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 am on the "Test page name" "page activity" page logged in as teacher1 And I follow "Show comments" And I add "I'm a comment from the teacher" comment to comments block - And I log out - When I log in as "student1" - And I am on "Course 1" course homepage - And I follow "Test page name" + When I am on the "Test page name" "page activity" page logged in as student1 And I follow "Show comments" Then I should see "I'm a comment from the teacher" diff --git a/blocks/comments/tests/behat/block_comment_course.feature b/blocks/comments/tests/behat/block_comment_course.feature index d23809b7eaa..f4cfe01156e 100644 --- a/blocks/comments/tests/behat/block_comment_course.feature +++ b/blocks/comments/tests/behat/block_comment_course.feature @@ -19,12 +19,9 @@ Feature: Enable Block comments on a course page and view comments 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 am on the "Course 1" course page logged in as teacher1 And I follow "Show comments" And I add "I'm a comment from the teacher" comment to comments block - 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 follow "Show comments" Then I should see "I'm a comment from the teacher" diff --git a/blocks/comments/tests/behat/delete_comment.feature b/blocks/comments/tests/behat/delete_comment.feature index 29288e7449e..c3a86f325cd 100644 --- a/blocks/comments/tests/behat/delete_comment.feature +++ b/blocks/comments/tests/behat/delete_comment.feature @@ -20,12 +20,9 @@ Feature: Delete comment block messages 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 am on the "Course 1" course page logged in as student1 And I add "Comment from student1" comment to comments block - 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 add "Comment from teacher1" comment to comments block When I delete "Comment from student1" comment from comments block Then I should not see "Comment from student1" diff --git a/blocks/completionstatus/tests/behat/block_completionstatus_manual_other.feature b/blocks/completionstatus/tests/behat/block_completionstatus_manual_other.feature index d32e00ad883..e4060f722ba 100644 --- a/blocks/completionstatus/tests/behat/block_completionstatus_manual_other.feature +++ b/blocks/completionstatus/tests/behat/block_completionstatus_manual_other.feature @@ -23,21 +23,16 @@ Feature: Enable Block Completion in a course using manual completion by others | 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 + Given I am on the "Course 1" course page logged in as teacher1 And I navigate to "Course completion" in current page administration And I expand all fieldsets And I set the following fields to these values: | Teacher | 1 | And I press "Save changes" - 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 should see "Status: Not yet started" in the "Course completion status" "block" And I should see "No" in the "Teacher" "table_row" - 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" in current page administration And I click on "Course completion" "link" in the "region-main" "region" And I follow "Click to mark user complete" @@ -46,17 +41,14 @@ Feature: Enable Block Completion in a course using manual completion by others And I wait "1" seconds And I run the scheduled task "core\task\completion_regular_task" And I am on site homepage - 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 Then I should see "Status: Complete" in the "Course completion status" "block" And I should see "Yes" in the "Teacher" "table_row" And I follow "More details" And I should see "Yes" in the "Marked complete by Teacher" "table_row" 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 + Given I am on the "Course 1" course page logged in as teacher1 And I navigate to "Course completion" in current page administration And I expand all fieldsets And I set the following fields to these values: @@ -64,30 +56,22 @@ Feature: Enable Block Completion in a course using manual completion by others | Non-editing teacher | 1 | | id_role_aggregation | ALL selected roles to mark when the condition is met | And I press "Save changes" - 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 should see "Status: Not yet started" in the "Course completion status" "block" And I should see "No" in the "Teacher" "table_row" And I should see "No" in the "Non-editing teacher" "table_row" - 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" in current page administration And I click on "Course completion" "link" in the "region-main" "region" And I follow "Click to mark user complete" - 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 should see "Status: In progress" in the "Course completion status" "block" And I should see "Yes" in the "Teacher" "table_row" And I should see "No" in the "Non-editing teacher" "table_row" And I follow "More details" And I should see "Yes" in the "Marked complete by Teacher" "table_row" And I should see "No" in the "Marked complete by Non-editing teacher" "table_row" - And I log out - And I log in as "teacher2" - And I am on "Course 1" course homepage + And I am on the "Course 1" course page logged in as teacher2 And I navigate to "Reports" in current page administration And I click on "Course completion" "link" in the "region-main" "region" And I follow "Click to mark user complete" @@ -96,9 +80,7 @@ Feature: Enable Block Completion in a course using manual completion by others And I wait "1" seconds And I run the scheduled task "core\task\completion_regular_task" And I am on site homepage - 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 Then I should see "Status: Complete" in the "Course completion status" "block" And I should see "Yes" in the "Teacher" "table_row" And I should see "Yes" in the "Non-editing teacher" "table_row" diff --git a/blocks/completionstatus/tests/behat/block_completionstatus_manual_self.feature b/blocks/completionstatus/tests/behat/block_completionstatus_manual_self.feature index 171040880aa..193c8e5e2fa 100644 --- a/blocks/completionstatus/tests/behat/block_completionstatus_manual_self.feature +++ b/blocks/completionstatus/tests/behat/block_completionstatus_manual_self.feature @@ -21,16 +21,13 @@ Feature: Enable Block Completion in a course using manual self completion | 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 am on the "Course 1" course page logged in as teacher1 And I navigate to "Course completion" in current page administration And I expand all fieldsets And I set the following fields to these values: | id_criteria_self | 1 | And I press "Save changes" - 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 should see "Status: Not yet started" in the "Course completion status" "block" And I should see "No" in the "Self completion" "table_row" And I follow "Complete course" 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 4b35eff50d9..85f0c3bd1fe 100644 --- a/blocks/course_summary/tests/behat/block_course_summary_course.feature +++ b/blocks/course_summary/tests/behat/block_course_summary_course.feature @@ -22,15 +22,13 @@ Feature: Course summary block used in a course | course_summary | Course | C101 | course-view-* | side-pre | Scenario: Student can view course summary - 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 "Course summary" "block" should exist And I should see "Course summary" in the "Course summary" "block" And I should see "Proved the course summary block works!" in the "Course summary" "block" Scenario: Teacher can not see edit icon when edit mode is off - 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 Then I should see "Proved the course summary block works!" in the "Course summary" "block" And I should see "Course summary" in the "Course summary" "block" And "Edit" "link" should not exist in the "Course summary" "block" 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 73128e43f3c..0cc4f02b875 100644 --- a/blocks/search_forums/tests/behat/block_search_forums_course.feature +++ b/blocks/search_forums/tests/behat/block_search_forums_course.feature @@ -20,24 +20,18 @@ Feature: The search forums block allows users to search for forum posts on cours | 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 am on the "Course 1" "course editing" page logged in as teacher1 And I set the field "id_newsitems" to "1" And I press "Save and display" - And I log out Scenario: Use the search forum block in a course without any forum posts - 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 When I set the field "Search" to "Moodle" And I press "Search" Then I should see "No posts" Scenario: Use the search forum block in a course with a hidden forum and search for posts - Given I log in as "teacher1" - And I am on "Course 1" course homepage - And I add a new topic to "Announcements" forum with: + Given I add a new topic to "Announcements" forum with: | Subject | My subject | | Message | My message | And I am on "Course 1" course homepage with editing mode on @@ -46,24 +40,18 @@ Feature: The search forums block allows users to search for forum posts on cours And I expand all fieldsets And I set the field "id_visible" to "0" 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 And "Search forums" "block" should exist - When I set the field "Search" to "message" + And I set the field "Search" to "message" And I press "Search" Then I should see "No posts" Scenario: Use the search forum block in a course and search for posts - Given I log in as "teacher1" - And I am on "Course 1" course homepage - And I add a new topic to "Announcements" forum with: + Given I add a new topic to "Announcements" forum with: | Subject | My subject | | Message | My message | - 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 "Search forums" "block" should exist - When I set the field "Search" to "message" + And I set the field "Search" to "message" And I press "Search" Then I should see "My subject" diff --git a/blocks/section_links/tests/behat/show_section_name.feature b/blocks/section_links/tests/behat/show_section_name.feature index e121c5dad74..d1a2fdd959d 100644 --- a/blocks/section_links/tests/behat/show_section_name.feature +++ b/blocks/section_links/tests/behat/show_section_name.feature @@ -18,18 +18,13 @@ Feature: The Section links block can be configured to display section name in ad | student1 | C1 | student | And the following config values are set as admin: | showsectionname | 1 | block_section_links | - And I log in as "admin" - 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 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 - Given I log in as "student1" - When I am on "Course 1" course homepage + When I am on the "Course 1" course page logged in as student1 Then I should see "7: Topic 7" in the "Section links" "block" And I follow "7: Topic 7" And I should see "First assignment" diff --git a/blocks/social_activities/tests/behat/edit_activities.feature b/blocks/social_activities/tests/behat/edit_activities.feature index 9ee9c77acd8..2b37eeb7209 100644 --- a/blocks/social_activities/tests/behat/edit_activities.feature +++ b/blocks/social_activities/tests/behat/edit_activities.feature @@ -76,8 +76,7 @@ Feature: Edit activities in social activities block And "My forum name" activity in social activities block should be available but hidden from course page And I log out # Student will not see the module on the course page but can access it from other reports and blocks: - And I log in as "student1" - And I am on "Course 1" course homepage - And I should not see "My forum name" in the "Social activities" "block" + When I am on the "Course 1" course page logged in as student1 + Then I should not see "My forum name" in the "Social activities" "block" And I click on "My forum name" "link" in the "Recent activity" "block" And I should see "My forum name" in the ".breadcrumb" "css_element" diff --git a/calendar/tests/behat/calendar.feature b/calendar/tests/behat/calendar.feature index e012048148d..6ac8103b152 100644 --- a/calendar/tests/behat/calendar.feature +++ b/calendar/tests/behat/calendar.feature @@ -43,14 +43,13 @@ Feature: Perform basic calendar functionality | Event title | Really awesome event! | | Description | Come join this awesome event, sucka! | And I log out - And 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 follow "Full calendar" And I should see "Really awesome event!" And I log out And I log in as "student2" And I follow "Full calendar" - And I should see "Really awesome event!" + Then I should see "Really awesome event!" @javascript Scenario: Create a course event @@ -61,8 +60,7 @@ Feature: Perform basic calendar functionality | Event title | Really awesome event! | | Description | Come join this awesome event, sucka! | And I log out - And I log in as "student1" - When I am on "Course 1" course homepage + When I am on the "Course 1" course page logged in as student1 And I follow "Full calendar" And I click on "Really awesome event!" "link" And "Course 1" "link" should exist in the "Really awesome event!" "dialogue" @@ -83,8 +81,7 @@ Feature: Perform basic calendar functionality | Event title | Really awesome event! | | Description | Come join this awesome event | And I log out - And I log in as "student1" - When I am on "Course 1" course homepage + When I am on the "Course 1" course page logged in as student1 And I follow "Full calendar" Then I follow "Really awesome event!" @@ -96,8 +93,7 @@ Feature: Perform basic calendar functionality | Event title | Really awesome event! | | Description | Come join this awesome event, sucka! | And I log out - And I log in as "student1" - When I am on "Course 1" course homepage + When I am on the "Course 1" course page logged in as student1 And I follow "Full calendar" Then I should not see "Really awesome event!" @@ -180,8 +176,7 @@ Feature: Perform basic calendar functionality @javascript Scenario: Attempt to create event without fill required fields should display validation errors - 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 follow "Full calendar" And I click on "New event" "button" When I click on "Save" "button" @@ -191,7 +186,7 @@ Feature: Perform basic calendar functionality And I click on "New event" "button" And I set the field "Event title" to "Really awesome event!" And I set the field "Type of event" to "Course" - When I click on "Save" "button" + And I click on "Save" "button" And I should see "Select a course" in the "Course" "form_row" @javascript @@ -207,8 +202,7 @@ Feature: Perform basic calendar functionality @javascript Scenario: Admin can only see all courses if calendar_adminseesall setting is enabled. - Given I log in as "admin" - And I am on "Course 1" course homepage + Given I am on the "Course 1" course page logged in as admin And I am viewing site calendar And I click on "New event" "button" And I set the field "Type of event" to "Course" @@ -264,8 +258,7 @@ Feature: Perform basic calendar functionality @javascript @accessibility Scenario: The calendar page must be accessible - 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 When I follow "Full calendar" Then the page should meet accessibility standards And the page should meet "wcag131, wcag143, wcag412" accessibility standards @@ -308,8 +301,7 @@ Feature: Perform basic calendar functionality @javascript Scenario: Changing the event type should clear previous data - Given I log in as "admin" - And I am on "Course 1" course homepage + Given I am on the "Course 1" course page logged in as admin And I follow "Full calendar" And I set the field "course" to "C1" And I press "New event" diff --git a/completion/tests/behat/activity_completion_criteria.feature b/completion/tests/behat/activity_completion_criteria.feature index 14d99da2341..beb6ce8eaf8 100644 --- a/completion/tests/behat/activity_completion_criteria.feature +++ b/completion/tests/behat/activity_completion_criteria.feature @@ -26,9 +26,7 @@ Feature: Allow to mark course as completed without cron for activity completion 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 + And I am on the "Completion course" "course editing" page logged in as admin And I expand all fieldsets And I set the field "Enable completion tracking" to "Yes" And I click on "Save and display" "button" @@ -48,9 +46,7 @@ Feature: Allow to mark course as completed without cron for activity completion And I follow "Expand all" And I set the field "Completion tracking" to "Students can manually mark the activity as completed" And I press "Save and return to course" - And I log out - When I log in as "student1" - And I am on "Completion course" course homepage + When I am on the "Completion course" course page logged in as student1 And I should see "Status: Not yet started" And I press "Mark as done" And I wait until "Done" "button" exists @@ -66,9 +62,7 @@ Feature: Allow to mark course as completed without cron for activity completion And I set the field "Grade out of 100" to "40" And I click on "Save changes" "button" And I am on "Completion course" course homepage - And I log out - And I log in as "student1" - When I am on "Completion course" course homepage + When I am on the "Completion course" course page logged in as student1 Then I should see "Status: Complete" @javascript @@ -78,7 +72,6 @@ Feature: Allow to mark course as completed without cron for activity completion | course | CC1 | | name | Test assignment name2 | | idnumber | assign2 | - | description | Test assignment description | And I am on the "Test assignment name2" "assign activity editing" page logged in as admin And I follow "Expand all" And I set the field "Completion tracking" to "Show activity as complete when conditions are met" @@ -95,33 +88,25 @@ Feature: Allow to mark course as completed without cron for activity completion And I set the field "Grade out of 100" to "40" And I click on "Save changes" "button" And I am on "Completion course" course homepage - And I log out - And I log in as "student1" - And I am on "Completion course" course homepage + And I am on the "Completion course" course page logged in as student1 And I should see "Status: In progress" - And I log out And I am on the "Test assignment name2" "assign activity" page logged in as teacher1 And I follow "View all submissions" And I click on "Grade" "link" in the "student1@example.com" "table_row" And I set the field "Grade out of 100" to "40" And I click on "Save changes" "button" And I am on "Completion course" course homepage - And I log out - And I log in as "student1" - And I am on "Completion course" course homepage + When I am on the "Completion course" course page logged in as student1 Then I should see "Status: Complete" @javascript Scenario: Course completion should not be updated when teacher grades assignment on course grader report page - Given I log in as "teacher1" - And I am on "Completion course" course homepage + Given I am on the "Completion course" 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 "57" to the user "Student First" for the grade item "Test assignment name" And I press "Save changes" - And I log out - And I log in as "student1" - When I am on "Completion course" course homepage + When I am on the "Completion course" course page logged in as student1 Then I should see "Status: Pending" And I run the scheduled task "core\task\completion_regular_task" And I wait "1" seconds @@ -131,8 +116,7 @@ Feature: Allow to mark course as completed without cron for activity completion @javascript Scenario: Course completion should not be updated when teacher grades assignment on activity grader report page - Given I log in as "teacher1" - And I am on "Completion course" course homepage + Given I am on the "Completion course" course page logged in as teacher1 And I navigate to "View > Single view" in the course gradebook And I click on "Users" "link" in the ".page-toggler" "css_element" And I turn editing mode on @@ -142,9 +126,7 @@ Feature: Allow to mark course as completed without cron for activity completion | Grade for Test assignment name | 10.00 | | Feedback for Test assignment name | test data | And I press "Save" - And I log out - And I log in as "student1" - And I am on "Completion course" course homepage + When I am on the "Completion course" course page logged in as student1 And I should see "Status: Pending" And I run the scheduled task "core\task\completion_regular_task" And I wait "1" seconds @@ -154,8 +136,7 @@ Feature: Allow to mark course as completed without cron for activity completion @javascript @_file_upload Scenario: Course completion should not be updated when teacher imports grades with csv file - Given I log in as "teacher1" - And I am on "Completion course" course homepage + Given I am on the "Completion course" course page logged in as teacher1 And I navigate to "CSV file" import page in the course gradebook And I upload "lib/tests/fixtures/upload_grades.csv" file to "File" filemanager And I press "Upload grades" @@ -164,9 +145,7 @@ Feature: Allow to mark course as completed without cron for activity completion And I press "Upload grades" And I press "Continue" And I should see "10.00" in the "Student First" "table_row" - And I log out - And I log in as "student1" - And I am on "Completion course" course homepage + And I am on the "Completion course" course page logged in as student1 And I should see "Status: Pending" When I run the scheduled task "core\task\completion_regular_task" And I wait "1" seconds diff --git a/completion/tests/behat/course_completion_activity_criteria.feature b/completion/tests/behat/course_completion_activity_criteria.feature index 95e7889011a..5b3fd415432 100644 --- a/completion/tests/behat/course_completion_activity_criteria.feature +++ b/completion/tests/behat/course_completion_activity_criteria.feature @@ -21,9 +21,7 @@ Feature: Course completion state should match completion criteria And the following "activity" exists: | activity | assign | | course | C1 | - | section | 1 | | name | Test assignment name | - | intro | Submit your online text | | completion | 1 | | assignsubmission_onlinetext_enabled | 1 | | grade[modgrade_type] | Point | @@ -31,21 +29,18 @@ Feature: Course completion state should match completion criteria 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 am on the "Course 1" course page logged in as teacher1 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 am on the "Test assignment name" "assign activity" page - And I navigate to "Settings" in current page administration + And I am on the "Test assignment name" "assign activity editing" page And I set the following fields to these values: | Completion tracking | Show activity as complete when conditions are met | | completionusegrade | 1 | | completionpassgrade | 1 | | gradepass | 70 | And I press "Save and return to course" - And I log out Scenario: Completion status show match completion criteria when passgrage condition is set. Given I am on the "Course 1" course page logged in as "student1" @@ -59,7 +54,6 @@ Feature: Course completion state should match completion criteria And I press "Save changes" And I press "Submit assignment" And I press "Continue" - And I log out And I am on the "Test assignment name" "assign activity" page logged in as teacher1 And I follow "View all submissions" And I click on "Grade" "link" in the "Student 1" "table_row" @@ -74,14 +68,12 @@ Feature: Course completion state should match completion criteria And I click on "Course completion" "link" in the "region-main" "region" And "Student 1, Test assignment name: Completed (did not achieve pass grade)" "icon" should exist in the "Student 1" "table_row" And "Student 1, Course complete: Not completed" "icon" should exist in the "Student 1" "table_row" - And I log out When I am on the "Course 1" course page logged in as "student1" And I should see "Status: Pending" in the "Course completion status" "block" And the "Receive a grade" completion condition of "Test assignment name" is displayed as "done" And the "Receive a passing grade" completion condition of "Test assignment name" is displayed as "failed" And I am on the "My courses" page And I should not see "100%" in the "Course overview" "block" - And I log out And I am on the "Test assignment name" "assign activity" page logged in as teacher1 And I follow "View all submissions" And I click on "Grade" "link" in the "Student 1" "table_row" @@ -96,7 +88,6 @@ Feature: Course completion state should match completion criteria And I click on "Course completion" "link" in the "region-main" "region" And "Student 1, Test assignment name: Completed (achieved pass grade)" "icon" should exist in the "Student 1" "table_row" And "Student 1, Course complete: Completed" "icon" should exist in the "Student 1" "table_row" - And I log out And I am on the "Course 1" course page logged in as "student1" And I should see "Status: Complete" in the "Course completion status" "block" And the "Receive a grade" completion condition of "Test assignment name" is displayed as "done" @@ -105,16 +96,13 @@ Feature: Course completion state should match completion criteria Then I should see "100%" in the "Course overview" "block" Scenario: Completion status show match completion criteria when passgrage condition is not set. - Given I am on the "Course 1" course page logged in as "teacher1" - And I am on the "Test assignment name" "assign activity" page - And I navigate to "Settings" in current page administration + Given I am on the "Test assignment name" "assign activity editing" page logged in as teacher1 And I set the following fields to these values: | Completion tracking | Show activity as complete when conditions are met | | completionusegrade | 1 | | completionpassgrade | 0 | | gradepass | 70 | And I press "Save and return to course" - And I log out And I am on the "Course 1" course page logged in as "student1" And the "Receive a grade" completion condition of "Test assignment name" is displayed as "todo" And I should see "Status: Not yet started" in the "Course completion status" "block" @@ -125,7 +113,6 @@ Feature: Course completion state should match completion criteria And I press "Save changes" And I press "Submit assignment" And I press "Continue" - And I log out And I am on the "Test assignment name" "assign activity" page logged in as teacher1 And I follow "View all submissions" And I click on "Grade" "link" in the "Student 1" "table_row" @@ -140,14 +127,12 @@ Feature: Course completion state should match completion criteria And I click on "Course completion" "link" in the "region-main" "region" And "Student 1, Test assignment name: Completed (did not achieve pass grade)" "icon" should exist in the "Student 1" "table_row" And "Student 1, Course complete: Completed" "icon" should exist in the "Student 1" "table_row" - And I log out When I am on the "Course 1" course page logged in as "student1" And I should see "Status: Complete" in the "Course completion status" "block" # Once MDL-75582 is fixed "failed" should be changed to "done" And the "Receive a grade" completion condition of "Test assignment name" is displayed as "failed" And I am on the "My courses" page And I should see "100%" in the "Course overview" "block" - And I log out And I am on the "Test assignment name" "assign activity" page logged in as teacher1 And I follow "View all submissions" And I click on "Grade" "link" in the "Student 1" "table_row" @@ -162,7 +147,6 @@ Feature: Course completion state should match completion criteria And I click on "Course completion" "link" in the "region-main" "region" And "Student 1, Test assignment name: Completed (achieved pass grade)" "icon" should exist in the "Student 1" "table_row" And "Student 1, Course complete: Completed" "icon" should exist in the "Student 1" "table_row" - And I log out And I am on the "Course 1" course page logged in as "student1" And I should see "Status: Complete" in the "Course completion status" "block" And the "Receive a grade" completion condition of "Test assignment name" is displayed as "done" diff --git a/completion/tests/behat/teacher_manual_completion.feature b/completion/tests/behat/teacher_manual_completion.feature index 3ff267c4187..947321531c0 100644 --- a/completion/tests/behat/teacher_manual_completion.feature +++ b/completion/tests/behat/teacher_manual_completion.feature @@ -19,18 +19,13 @@ Feature: Allow teachers to manually mark users as complete when configured 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 am on the "Completion course" course page logged in as admin 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 log out - And I log in as "student1" - And I am on "Completion course" course homepage + And I am on the "Completion course" course page logged in as student1 And I should see "Status: Not yet started" - And I log out - When I log in as "teacher1" - And I am on "Completion course" course homepage + When I am on the "Completion course" course page logged in as teacher1 And I follow "View course report" And I should see "Student First" And I follow "Click to mark user complete" @@ -39,7 +34,5 @@ Feature: Allow teachers to manually mark users as complete when configured And I wait "1" seconds And I run the scheduled task "core\task\completion_regular_task" And I am on site homepage - And I log out - Then I log in as "student1" - And I am on "Completion course" course homepage + Then I am on the "Completion course" course page logged in as student1 And I should see "Status: Complete" diff --git a/mod/assign/tests/behat/group_submission.feature b/mod/assign/tests/behat/group_submission.feature index 367c9f14e49..8bccbe0086e 100644 --- a/mod/assign/tests/behat/group_submission.feature +++ b/mod/assign/tests/behat/group_submission.feature @@ -291,24 +291,18 @@ Feature: Group assignment submissions | preventsubmissionnotingroup | 0 | | submissiondrafts | 0 | | teamsubmission | 1 | - And the following "mod_assign > submissions" exist: | assign | user | onlinetext | | Test assignment name | student1 | I'm the student's first submission | 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" And I should see "Submitted for grading" - And I log out - And I am on the "C1" Course page logged in as student2 And I click on "Assignments" "link" in the "Activities" "block" And I should see "Submitted for grading" - And I log out - And I am on the "Test assignment name" Activity page logged in as teacher1 When I follow "View all submissions" Then "Student 1" row "Status" column of "generaltable" table should contain "Submitted for grading" diff --git a/mod/assign/tests/behat/set_availability.feature b/mod/assign/tests/behat/set_availability.feature index 043911f452f..1255c6afa8d 100644 --- a/mod/assign/tests/behat/set_availability.feature +++ b/mod/assign/tests/behat/set_availability.feature @@ -1,4 +1,4 @@ -@mod @mod_assign @javascript +@mod @mod_assign Feature: Set availability dates for an assignment In order to control when a student can upload an assignment As a teacher @@ -33,6 +33,7 @@ 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/data/tests/behat/data_activities.feature b/mod/data/tests/behat/data_activities.feature index bbd900fc096..2354f149eaa 100644 --- a/mod/data/tests/behat/data_activities.feature +++ b/mod/data/tests/behat/data_activities.feature @@ -22,8 +22,7 @@ Feature: Users can view the list of data activities and their formatted descript | 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" - And I am on "Course 1" course homepage + Given I am on the "Course 1" course page logged in as teacher1 When I follow "Databases" Then I should see "Test database 1" And I should see "Test database 2" @@ -31,11 +30,9 @@ Feature: Users can view the list of data activities and their formatted descript And I should see "This is an intro with an image: " And "//img[contains(@src, 'some_image.jpg')]" "xpath_element" should exist And "//img[contains(@src, '@@PLUGINFILE@@/some_image.jpg')]" "xpath_element" should not exist - And I log out Scenario: Students can view the list of data activities and their formatted descriptions - 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 When I follow "Databases" Then I should see "Test database 1" And I should see "Test database 2" @@ -43,4 +40,3 @@ Feature: Users can view the list of data activities and their formatted descript And I should see "This is an intro with an image: " And "//img[contains(@src, 'some_image.jpg')]" "xpath_element" should exist And "//img[contains(@src, '@@PLUGINFILE@@/some_image.jpg')]" "xpath_element" should not exist - And I log out diff --git a/mod/forum/tests/behat/advanced_search.feature b/mod/forum/tests/behat/advanced_search.feature index cb29436e89d..3b032263b9a 100644 --- a/mod/forum/tests/behat/advanced_search.feature +++ b/mod/forum/tests/behat/advanced_search.feature @@ -24,9 +24,7 @@ Feature: The forum search allows users to perform advanced searches for forum po 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 navigate to "Settings" in current page administration + And I am on the "Course 1" "course editing" page logged in as teacher1 And I expand all fieldsets And I set the field "id_newsitems" to "1" And I press "Save and display" @@ -37,7 +35,6 @@ Feature: The forum search allows users to perform advanced searches for forum po And I add a new topic to "Announcements" forum with: | Subject | Your subjective| | Message | Your long message | - And I log out Scenario: Perform an advanced search using any term Given I am on the "Announcements" "forum activity" page logged in as student1 @@ -80,12 +77,10 @@ Feature: The forum search allows users to perform advanced searches for forum po And I should see "Your subjective" Scenario: Perform an advanced search matching the author - Given I log in as "teacher2" - And I am on "Course 1" course homepage + Given I am on the "Course 1" course page logged in as teacher2 And I add a new topic to "Announcements" forum with: | Subject | My Subjects | | Message | My message | - And I log out When I am on the "Announcements" "forum activity" page logged in as student1 And I press "Search" And I should see "Please enter search terms into one or more of the following fields" @@ -111,7 +106,6 @@ Feature: The forum search allows users to perform advanced searches for forum po And I set the following fields to these values: | Tags | SearchedTag | And I press "Save changes" - And I log out And I am on the "Announcements" "forum activity" page logged in as student1 And I press "Search" And I should see "Please enter search terms into one or more of the following fields" diff --git a/mod/forum/tests/behat/edit_post_student.feature b/mod/forum/tests/behat/edit_post_student.feature index eac8124f87d..1e866bc520e 100644 --- a/mod/forum/tests/behat/edit_post_student.feature +++ b/mod/forum/tests/behat/edit_post_student.feature @@ -44,8 +44,6 @@ Feature: Students can edit or delete their forum posts within a set time limit 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 the "Course 1" course page logged in as student1 diff --git a/mod/forum/tests/behat/recent_activity.feature b/mod/forum/tests/behat/recent_activity.feature index 7b98860f2ba..86574b8e6c2 100644 --- a/mod/forum/tests/behat/recent_activity.feature +++ b/mod/forum/tests/behat/recent_activity.feature @@ -95,8 +95,6 @@ Feature: Users can see the relevant recent forum posts from the recent activity And I am on "Course 1" course homepage And I should see "The egg vs the chicken" in the "Recent activity" "block" And I should see "Student 1's answer" in the "Recent activity" "block" - And I log out - And I log in as "admin" And the following config values are set as admin: | maxeditingtime | 1 | When I am on the "Course 1" course page logged in as student2 diff --git a/mod/glossary/tests/behat/import_entries.feature b/mod/glossary/tests/behat/import_entries.feature index 7f7e6739d83..e3499044d98 100644 --- a/mod/glossary/tests/behat/import_entries.feature +++ b/mod/glossary/tests/behat/import_entries.feature @@ -21,12 +21,11 @@ Feature: Importing glossary entries | blockname | contextlevel | reference | pagetypepattern | defaultregion | | recent_activity | Course | C1 | course-view-* | side-pre | | tags | Course | C1 | course-view-* | side-pre | + And I am on the "Glossary 1" "glossary activity" page logged in as teacher1 @javascript @block_recent_activity Scenario: Importing glossary entries and checking the Recent activity block - Given I log in as "teacher1" - And I am on the "Glossary 1" "glossary activity" page - And I press "Import entries" + Given I press "Import entries" And I upload "mod/glossary/tests/fixtures/texfilter_glossary_en.xml" file to "File to import" filemanager When I press "Submit" Then I should see "103" in the "Total entries:" "table_row" @@ -37,9 +36,7 @@ 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 the "Glossary 1" "glossary activity" page - And I press "Import entries" + Given I press "Import entries" And I upload "mod/glossary/tests/fixtures/musicians.xml" file to "File to import" filemanager When I press "Submit" And I am on "Course 1" course homepage diff --git a/mod/h5pactivity/tests/behat/recent_activity.feature b/mod/h5pactivity/tests/behat/recent_activity.feature index 0d4b47f63ef..a8b562c462f 100644 --- a/mod/h5pactivity/tests/behat/recent_activity.feature +++ b/mod/h5pactivity/tests/behat/recent_activity.feature @@ -36,7 +36,6 @@ Feature: Users can see the H5P recent activity from the recent activity block 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 am on the "Awesome H5P package" "h5pactivity activity" page logged in as student2 # 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 @@ -44,7 +43,6 @@ Feature: Users can see the H5P recent activity from the recent activity block And I click on "Correct 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 Scenario: Student see only his own activity Given I am on the "Course 1" course page logged in as student1 diff --git a/my/tests/behat/reset_all_pages.feature b/my/tests/behat/reset_all_pages.feature index 98ad9b38352..7956720d5a6 100644 --- a/my/tests/behat/reset_all_pages.feature +++ b/my/tests/behat/reset_all_pages.feature @@ -46,13 +46,11 @@ Feature: Reset all personalised pages to default And I log out And I log in as "student1" - And I follow "Dashboard" And I should not see "Latest announcements" And I should see "Timeline" And I log out And I log in as "student3" - And I follow "Dashboard" And I should not see "Latest announcements" And I should see "Timeline" And I log out @@ -64,21 +62,18 @@ Feature: Reset all personalised pages to default And I log out And I log in as "student1" - And I follow "Dashboard" Then I should see "Latest announcements" And I should not see "Comments" And I should not see "Timeline" And I log out And I log in as "student3" - And I follow "Dashboard" And I should see "Latest announcements" And I should not see "Timeline" And I log out # Check that this did not affect the customised profiles. - And I log in as "student2" - And I follow "Profile" in the user menu + And I am on the "student2" "user > profile" page logged in as student2 And I should see "Logged in user" And I should not see "Latest announcements" @@ -89,13 +84,11 @@ Feature: Reset all personalised pages to default And I add the "Latest announcements" block And I log out - And I log in as "student2" - And I follow "Profile" in the user menu + And I am on the "student2" "user > profile" page logged in as student2 And I should not see "Latest announcements" And I log out - And I log in as "student3" - And I follow "Profile" in the user menu + And I am on the "student3" "user > profile" page logged in as student3 And I should not see "Latest announcements" And I log out @@ -105,19 +98,16 @@ Feature: Reset all personalised pages to default And I should see "All profile pages have been reset to default." And I log out - And I log in as "student2" - And I follow "Profile" in the user menu + And I am on the "student2" "user > profile" page logged in as student2 Then I should see "Latest announcements" And I should not see "Logged in user" And I log out - And I log in as "student3" - And I follow "Profile" in the user menu + And I am on the "student3" "user > profile" page logged in as student3 And I should see "Latest announcements" And I log out # Check that this did not affect the customised dashboards. And I log in as "student1" - And I follow "Dashboard" And I should see "Comments" And I should not see "Latest announcements" diff --git a/user/tests/behat/user_grade_navigation.feature b/user/tests/behat/user_grade_navigation.feature index d57f3093ce3..83036308a5c 100644 --- a/user/tests/behat/user_grade_navigation.feature +++ b/user/tests/behat/user_grade_navigation.feature @@ -27,8 +27,7 @@ Feature: The student can navigate to their grades page and user grade report. | assign | C1 | a2 | Test assignment two | Submit something! | 100 | | assign | C1 | a3 | Test assignment three | Submit something! | 150 | | assign | C2 | a4 | Test assignment four | Submit something! | 150 | - 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 "150.00" to the user "Student 1" for the grade item "Test assignment one" diff --git a/user/tests/behat/view_preferences_page.feature b/user/tests/behat/view_preferences_page.feature index 747009cc2b6..d5c8e389d14 100644 --- a/user/tests/behat/view_preferences_page.feature +++ b/user/tests/behat/view_preferences_page.feature @@ -64,8 +64,6 @@ Feature: Access to preferences page | 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 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"