From c483bc57e819e40aff8437cbf36cf088f664744f Mon Sep 17 00:00:00 2001 From: Andrew Nicols Date: Mon, 9 Nov 2020 17:15:32 +0800 Subject: [PATCH 1/3] MDL-70152 forum: Create behat data generator * Convert track_read_posts.feature to use activity and discussion data generators as exmaple. Co-authored-by: Jun Pataleta --- .../tests/behat/track_read_posts.feature | 183 ++++++++++-------- 1 file changed, 99 insertions(+), 84 deletions(-) diff --git a/mod/forum/tests/behat/track_read_posts.feature b/mod/forum/tests/behat/track_read_posts.feature index 6787a2ae220..82d45fee68c 100644 --- a/mod/forum/tests/behat/track_read_posts.feature +++ b/mod/forum/tests/behat/track_read_posts.feature @@ -16,37 +16,41 @@ Feature: A teacher can set one of 3 possible options for tracking read forum pos | user | course | role | | student1 | C1 | student | | student2 | C1 | student | - And I log in as "admin" - And I am on "Course 1" course homepage with editing mode on Scenario: Tracking forum posts off - Given I add a "Forum" to section "1" and I fill the form with: - | Forum name | Test forum name | - | Forum type | Standard forum for general use | - | Description | Test forum description | - | Read tracking | Off | - And I add a new discussion to "Test forum name" forum with: - | Subject | Test post subject | - | Message | Test post message | - And I log out - When I log in as "student1" - And I am on "Course 1" course homepage + Given the following "activity" exists: + | activity | forum | + | course | C1 | + | idnumber | forum1 | + | type | general | + | name | Test forum name | + | trackingtype | 0 | + And the following "mod_forum > discussion" exists: + | forum | forum1 | + | course | C1 | + | user | admin | + | name | Test post subject | + | message | Test post message | + When I am on the "Course 1" course page logged in as student1 Then I should not see "1 unread post" And I follow "Test forum name" And I should not see "Track unread posts" Scenario: Tracking forum posts optional with user tracking on - Given I add a "Forum" to section "1" and I fill the form with: - | Forum name | Test forum name | - | Forum type | Standard forum for general use | - | Description | Test forum description | - | Read tracking | Optional | - And I add a new discussion to "Test forum name" forum with: - | Subject | Test post subject | - | Message | Test post message | - And I log out - When I log in as "student1" - And I am on "Course 1" course homepage + Given the following "activity" exists: + | activity | forum | + | course | C1 | + | idnumber | forum1 | + | name | Test forum name | + | type | general | + | trackingtype | 1 | + And the following "mod_forum > discussion" exists: + | forum | forum1 | + | course | C1 | + | user | admin | + | name | Test post subject | + | message | Test post message | + When I am on the "Course 1" course page logged in as student1 Then I should see "1 unread post" And I follow "Test forum name" And I follow "Don't track unread posts" @@ -61,17 +65,20 @@ Feature: A teacher can set one of 3 possible options for tracking read forum pos And I should not see "1 unread post" Scenario: Tracking forum posts optional with user tracking off - Given I add a "Forum" to section "1" and I fill the form with: - | Forum name | Test forum name | - | Forum type | Standard forum for general use | - | Description | Test forum description | - | Read tracking | Optional | - And I add a new discussion to "Test forum name" forum with: - | Subject | Test post subject | - | Message | Test post message | - And I log out - When I log in as "student2" - And I am on "Course 1" course homepage + Given the following "activity" exists: + | activity | forum | + | course | C1 | + | idnumber | 00001 | + | name | Test forum name | + | type | general | + | trackingtype | 1 | + And the following "mod_forum > discussion" exists: + | forum | 00001 | + | course | C1 | + | user | admin | + | name | Test post subject | + | message | Test post message | + When I am on the "Course 1" course page logged in as student2 Then I should not see "1 unread post" And I follow "Test forum name" And I should not see "Track unread posts" @@ -79,18 +86,20 @@ Feature: A teacher can set one of 3 possible options for tracking read forum pos Scenario: Tracking forum posts forced with user tracking on Given the following config values are set as admin: | forum_allowforcedreadtracking | 1 | - And I am on "Course 1" course homepage - Given I add a "Forum" to section "1" and I fill the form with: - | Forum name | Test forum name | - | Forum type | Standard forum for general use | - | Description | Test forum description | - | Read tracking | Force | - And I add a new discussion to "Test forum name" forum with: - | Subject | Test post subject | - | Message | Test post message | - And I log out - When I log in as "student1" - And I am on "Course 1" course homepage + And the following "activity" exists: + | activity | forum | + | course | C1 | + | idnumber | 00001 | + | name | Test forum name | + | type | general | + | trackingtype | 2 | + And the following "mod_forum > discussion" exists: + | forum | 00001 | + | course | C1 | + | user | admin | + | name | Test post subject | + | message | Test post message | + When I am on the "Course 1" course page logged in as student1 Then I should see "1 unread post" And I follow "1 unread post" And I should not see "Don't track unread posts" @@ -101,18 +110,20 @@ Feature: A teacher can set one of 3 possible options for tracking read forum pos Scenario: Tracking forum posts forced with user tracking off Given the following config values are set as admin: | forum_allowforcedreadtracking | 1 | - And I am on "Course 1" course homepage - Given I add a "Forum" to section "1" and I fill the form with: - | Forum name | Test forum name | - | Forum type | Standard forum for general use | - | Description | Test forum description | - | Read tracking | Force | - And I add a new discussion to "Test forum name" forum with: - | Subject | Test post subject | - | Message | Test post message | - And I log out - When I log in as "student2" - And I am on "Course 1" course homepage + And the following "activity" exists: + | activity | forum | + | course | C1 | + | idnumber | 00001 | + | name | Test forum name | + | type | general | + | trackingtype | 2 | + And the following "mod_forum > discussion" exists: + | forum | 00001 | + | course | C1 | + | user | admin | + | name | Test post subject | + | message | Test post message | + When I am on the "Course 1" course page logged in as student2 Then I should see "1 unread post" And I follow "1 unread post" And I should not see "Don't track unread posts" @@ -123,20 +134,22 @@ Feature: A teacher can set one of 3 possible options for tracking read forum pos Scenario: Tracking forum posts forced (with force disabled) with user tracking on Given the following config values are set as admin: | forum_allowforcedreadtracking | 1 | - And I am on "Course 1" course homepage - Given I add a "Forum" to section "1" and I fill the form with: - | Forum name | Test forum name | - | Forum type | Standard forum for general use | - | Description | Test forum description | - | Read tracking | Force | - And I add a new discussion to "Test forum name" forum with: - | Subject | Test post subject | - | Message | Test post message | + And the following "activity" exists: + | activity | forum | + | course | C1 | + | idnumber | 00001 | + | name | Test forum name | + | type | general | + | trackingtype | 2 | + And the following "mod_forum > discussion" exists: + | forum | 00001 | + | course | C1 | + | user | admin | + | name | Test post subject | + | message | Test post message | And the following config values are set as admin: | forum_allowforcedreadtracking | 0 | - And I log out - When I log in as "student1" - And I am on "Course 1" course homepage + When I am on the "Course 1" course page logged in as student1 Then I should see "1 unread post" And I follow "Test forum name" And I follow "Don't track unread posts" @@ -153,20 +166,22 @@ Feature: A teacher can set one of 3 possible options for tracking read forum pos Scenario: Tracking forum posts forced (with force disabled) with user tracking off Given the following config values are set as admin: | forum_allowforcedreadtracking | 1 | - And I am on "Course 1" course homepage - Given I add a "Forum" to section "1" and I fill the form with: - | Forum name | Test forum name | - | Forum type | Standard forum for general use | - | Description | Test forum description | - | Read tracking | Force | - And I add a new discussion to "Test forum name" forum with: - | Subject | Test post subject | - | Message | Test post message | + And the following "activity" exists: + | activity | forum | + | course | C1 | + | idnumber | 00001 | + | name | Test forum name | + | type | general | + | trackingtype | 2 | + And the following "mod_forum > discussion" exists: + | forum | 00001 | + | course | C1 | + | user | admin | + | name | Test post subject | + | message | Test post message | And the following config values are set as admin: | forum_allowforcedreadtracking | 0 | - And I log out - When I log in as "student2" - And I am on "Course 1" course homepage + When I am on the "Course 1" course page logged in as student2 Then I should not see "1 unread post" And I follow "Test forum name" - And I should not see "Track unread posts" + And I should not see "Track unread posts" \ No newline at end of file From ab54adb83939d288ba5ada8eaa889a881be98f7a Mon Sep 17 00:00:00 2001 From: Angelia Dela Cruz Date: Mon, 17 Jan 2022 17:47:48 +0800 Subject: [PATCH 2/3] MDL-70152 behat: Forum behat generators use UI Replace steps that manually add forum and forum post instances via the UI and use Behat generators. This improves the speed of Behat test runs. --- .../tests/behat/edit_availability.feature | 13 ++- .../behat/restore_moodle2_courses.feature | 19 ++-- .../tests/behat/edit_activities.feature | 12 ++- .../behat/enable_manual_complete_mark.feature | 14 ++- course/tests/behat/course_controls.feature | 10 +- course/tests/behat/move_activities.feature | 15 +-- .../tests/behat/modgrade_validation.feature | 102 ++++++------------ mod/forum/tests/behat/add_forum.feature | 26 ++--- .../tests/behat/add_forum_inline.feature | 24 +++-- .../tests/behat/edit_post_teacher.feature | 38 +++---- .../tests/behat/forum_subscriptions.feature | 69 ++++-------- .../forum_subscriptions_availability.feature | 44 ++------ mod/forum/tests/behat/grade_forum.feature | 28 ++--- mod/forum/tests/behat/inpage_reply.feature | 23 ++-- .../behat/split_forum_discussion.feature | 37 +++---- 15 files changed, 187 insertions(+), 287 deletions(-) diff --git a/availability/tests/behat/edit_availability.feature b/availability/tests/behat/edit_availability.feature index 3c352278d60..ba769e090ff 100644 --- a/availability/tests/behat/edit_availability.feature +++ b/availability/tests/behat/edit_availability.feature @@ -27,6 +27,12 @@ Feature: edit_availability | user | course | role | | teacher1 | C1 | editingteacher | | student1 | C1 | student | + And the following "activity" exists: + | activity | forum | + | course | C1 | + | section | 1 | + | name | MyForum | + | intro | x | Scenario: Confirm the 'enable availability' option is working Given the following config values are set as admin: @@ -164,7 +170,7 @@ Feature: edit_availability | enableavailability | 0 | And I log in as "admin" And I am on "Course 1" course homepage with editing mode on - And I add a "Forum" to section "1" + And I am on the "MyForum" "forum activity editing" page When I expand all fieldsets Then "Add group/grouping access restriction" "button" should not exist @@ -176,10 +182,7 @@ Feature: edit_availability | GX1 | C1 | GXI1 | And I log in as "admin" And I am on "Course 1" course homepage with editing mode on - And I add a "Forum" to section "1" - And I set the following fields to these values: - | Forum name | MyForum | - | Description | x | + And I am on the "MyForum" "forum activity editing" page When I expand all fieldsets Then the "Add group/grouping access restriction" "button" should be disabled diff --git a/backup/util/ui/tests/behat/restore_moodle2_courses.feature b/backup/util/ui/tests/behat/restore_moodle2_courses.feature index 7cbdcb971e9..0fde152b248 100644 --- a/backup/util/ui/tests/behat/restore_moodle2_courses.feature +++ b/backup/util/ui/tests/behat/restore_moodle2_courses.feature @@ -12,10 +12,11 @@ Feature: Restore Moodle 2 course backups | Course 3 | C3 | 0 | topics | 2 | 0 | | Course 4 | C4 | 0 | topics | 20 | 0 | And the following "activities" exist: - | activity | course | idnumber | name | intro | section | externalurl | - | assign | C3 | assign1 | Test assign name | Assign description | 1 | | - | data | C3 | data1 | Test database name | Database description | 2 | | - | url | C1 | url1 | Test URL name | Test URL description | 3 | http://www.moodle.org | + | activity | course | idnumber | name | intro | section | externalurl | + | assign | C3 | assign1 | Test assign name | Assign description | 1 | | + | data | C3 | data1 | Test database name | Database description | 2 | | + | forum | C1 | 0001 | Test forum name | Test forum description | 1 | | + | url | C1 | url1 | Test URL name | Test URL description | 3 | http://www.moodle.org | And I log in as "admin" And I am on "Course 1" course homepage with editing mode on And I add a "Forum" to section "1" and I fill the form with: @@ -63,10 +64,12 @@ Feature: Restore Moodle 2 course backups Scenario: Restore a backup into the same course removing it's contents before that When I backup "Course 1" course using this options: | Confirmation | Filename | test_backup.mbz | - And I am on "Course 1" course homepage - And I add a "Forum" to section "1" and I fill the form with: - | Forum name | Test forum post backup name | - | Description | Test forum post backup description | + And the following "activity" exists: + | activity | forum | + | course | C1 | + | section | 1 | + | name | Test forum post backup name | + | intro | Test forum post backup description | And I navigate to "Restore" in current page administration And I merge "test_backup.mbz" backup into the current course after deleting it's contents using this options: | Schema | Section 3 | 0 | diff --git a/blocks/site_main_menu/tests/behat/edit_activities.feature b/blocks/site_main_menu/tests/behat/edit_activities.feature index e8aa3315c9a..493cda4bf6f 100644 --- a/blocks/site_main_menu/tests/behat/edit_activities.feature +++ b/blocks/site_main_menu/tests/behat/edit_activities.feature @@ -26,14 +26,16 @@ Feature: Edit activities in main menu block Scenario: Activities in main menu 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 | + | site_main_menu | System | 1 | site-index | side-post | + And the following "activities" exist: + | activity | course | section | name | + | forum | Acceptance test site | 0 | Visible forum | + | forum | Acceptance test site | 0 | My forum name | And I log in as "admin" And I am on site homepage And I navigate to "Turn editing on" in current page administration - And I add the "Main menu" block - When I add a "Forum" to section "0" and I fill the form with: - | Forum name | Visible forum | - When I add a "Forum" to section "0" and I fill the form with: - | Forum name | My forum name | And "My forum name" activity in site main menu block should have "Hide" editing icon And "My forum name" activity in site main menu block should not have "Show" editing icon And "My forum name" activity in site main menu block should not have "Make available" editing icon diff --git a/completion/tests/behat/enable_manual_complete_mark.feature b/completion/tests/behat/enable_manual_complete_mark.feature index f6b08268298..906d213951d 100644 --- a/completion/tests/behat/enable_manual_complete_mark.feature +++ b/completion/tests/behat/enable_manual_complete_mark.feature @@ -17,16 +17,22 @@ Feature: Allow students to manually mark an activity as complete | user | course | role | | teacher1 | C1 | editingteacher | | student1 | C1 | student | + And the following "activity" exists: + | activity | forum | + | course | C1 | + | section | 1 | + | name | Test forum name | + | intro | Test forum description | And I log in as "teacher1" And I am on "Course 1" course homepage with editing mode on And I navigate to "Edit settings" in current page administration And I set the following fields to these values: | Enable completion tracking | Yes | And I press "Save and display" - And I add a "Forum" to section "1" and I fill the form with: - | Forum name | Test forum name | - | Description | Test forum description | - | Completion tracking | Students can manually mark the activity as completed | + And I am on the "Test forum name" "forum activity editing" page + And I set the following fields to these values: + | completion | 1 | + And I press "Save and return to course" And "Student First" user has not completed "Test forum name" activity And I log out And I log in as "student1" diff --git a/course/tests/behat/course_controls.feature b/course/tests/behat/course_controls.feature index 0cb64fed9fe..fb542d43b16 100644 --- a/course/tests/behat/course_controls.feature +++ b/course/tests/behat/course_controls.feature @@ -26,6 +26,10 @@ Feature: Course activity controls works as expected And the following "course enrolments" exist: | user | course | role | | teacher1 | C1 | editingteacher | + And the following "activities" exist: + | activity | course | section | name | intro | + | forum | C1 | 1 | Test forum name 1 | Test forum description 1 | + | forum | C1 | 1 | Test forum name 2 | Test forum description 2 | And I log in as "teacher1" And I am on "Course 1" course homepage When I follow @@ -35,12 +39,6 @@ Feature: Course activity controls works as expected And I click on "Delete Recent activity block" "link" And I press "Yes" And "section" exist - And I add a "Forum" to section "1" and I fill the form with: - | Forum name | Test forum name 1 | - | Description | Test forum description 1 | - And I add a "Forum" to section "1" and I fill the form with: - | Forum name | Test forum name 2 | - | Description | Test forum description 2 | And "section" exist And I indent right "Test forum name 1" activity And "section" exist diff --git a/course/tests/behat/move_activities.feature b/course/tests/behat/move_activities.feature index b06c7f6a73b..7e69e7e3258 100644 --- a/course/tests/behat/move_activities.feature +++ b/course/tests/behat/move_activities.feature @@ -14,14 +14,12 @@ Feature: Activities can be moved between sections And the following "course enrolments" exist: | user | course | role | | teacher1 | C1 | editingteacher | + And the following "activities" exist: + | activity | name | course | idnumber | section | + | forum | Test forum name | C1 | 00001 | 1 | + | forum | Second forum name | C1 | 00002 | 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 - And I follow "Delete Recent activity block" - And I press "Yes" - And I add a "Forum" to section "1" and I fill the form with: - | Forum name | Test forum name | - | Description | Test forum description | Scenario: Move activities in a single page course with Javascript disabled When I move "Test forum name" activity to section "2" @@ -42,9 +40,6 @@ Feature: Activities can be moved between sections And I set the following fields to these values: | Course layout | Show one section per page | And I press "Save and display" - And I add a "Forum" to section "1" and I fill the form with: - | Forum name | Second forum name | - | Description | Second forum description | And I follow "Topic 1" When I move "Second forum name" activity to section "1" - Then "Second forum name" "link" should appear before "Test forum name" "link" + Then "Second forum name" "link" should appear before "Test forum name" "link" \ No newline at end of file diff --git a/lib/form/tests/behat/modgrade_validation.feature b/lib/form/tests/behat/modgrade_validation.feature index bcdf8326fc8..686b2f9b8ae 100644 --- a/lib/form/tests/behat/modgrade_validation.feature +++ b/lib/form/tests/behat/modgrade_validation.feature @@ -20,73 +20,54 @@ Feature: Using the activity grade form element | name | scale | | ABCDEF | F,E,D,C,B,A | | Letter scale | Disappointing, Good, Very good, Excellent | - And the following "activity" exists: - | activity | assign | - | course | C1 | - | section | 1 | - | name | Test assignment name | - | intro | Test assignment description | - - Scenario: Being able to change the grade type, scale and maximum grade when there are no grades - Given I log in as "admin" And the following "activities" exist: - | activity | name | intro | course | idnumber | - | forum | Test forum name | Test forum description | C1 | forum1 | - And I am on the "Test forum name" "forum activity editing" page logged in as teacher1 + | activity | course | section | name | intro | idnumber | type | groupmode | + | assign | C1 | 1 | Test assignment name | Test assignment description | | | | + | forum | C1 | 1 | Test forum name | | forum1 | general | 0 | + And the following forum discussions exist in course "Course 1": + | user | forum | name | message | + | student1 | Test forum name | Discussion subject | Discussion message | + + @javascript + Scenario: Being able to change the grade type, scale and maximum grade when there are no grades + Given I am on the "Test forum name" "forum activity editing" page logged in as teacher1 And I set the following fields to these values: - | Forum type | Standard forum for general use | - | Description | Test forum description | - | Aggregate type | Average of ratings | - | scale[modgrade_type] | Point | - | scale[modgrade_point] | 100 | - | Group mode | No groups | + | Ratings > Aggregate type | Average of ratings | + | id_scale_modgrade_type | Point | + | Ratings > scale[modgrade_point] | 60 | And I press "Save and return to course" And I am on the "Test forum name" "forum activity editing" page When I expand all fieldsets Then I should not see "Some grades have already been awarded, so the grade type" - And I set the field "scale[modgrade_type]" to "Scale" - And I set the field "scale[modgrade_scale]" to "ABCDEF" + And I set the field "id_scale_modgrade_type" to "Scale" + And I set the field "Ratings > scale[modgrade_scale]" to "ABCDEF" And I press "Save and display" And I should not see "You cannot change the type, as grades already exist for this item" And I navigate to "Edit settings" in current page administration And I expand all fieldsets And I should not see "Some grades have already been awarded, so the grade type" - And I set the field "scale[modgrade_scale]" to "Letter scale" + And I set the field "Ratings > scale[modgrade_scale]" to "Letter scale" And I press "Save and display" And I should not see "You cannot change the scale, as grades already exist for this item" And I navigate to "Edit settings" in current page administration And I expand all fieldsets And I should not see "Some grades have already been awarded, so the grade type" - And I set the field "scale[modgrade_type]" to "Point" - And I set the field "Maximum grade" to "50" + And I set the field "id_scale_modgrade_type" to "Point" + And I set the field "Ratings > Maximum grade" to "50" And I press "Save and display" And I should not see "You must choose whether to rescale existing grades or not" @javascript Scenario: Attempting to change the scale when grades already exist in rating activity - Given I log in as "teacher1" - And I am on "Course 1" course homepage with editing mode on - And I add a "Forum" to section "1" and I fill the form with: - | Forum name | Test forum name | - | Forum type | Standard forum for general use | - | Description | Test forum description | - | Aggregate type | Average of ratings | - | scale[modgrade_type] | Scale | - | scale[modgrade_scale] | ABCDEF | - | Group mode | No groups | - And I log out - And I am on the "Test forum name" "forum activity" page logged in as student1 - And I click on "Add a new discussion topic" "link" + Given I am on the "Test forum name" "forum activity editing" page logged in as teacher1 And I set the following fields to these values: - | Subject | Discussion subject | - | Message | Discussion message | - And I press "Post to forum" - And I log out - And I am on the "Test forum name" "forum activity" page logged in as teacher1 + | Ratings > Aggregate type | Average of ratings | + | id_scale_modgrade_type | Scale | + | Ratings > scale[modgrade_scale] | ABCDEF | + And I press "Save and display" And I follow "Discussion subject" And I set the field "rating" to "D" - And I am on the "Test forum name" "forum activity" page - And I navigate to "Edit settings" in current page administration + And I am on the "Test forum name" "forum activity editing" page When I expand all fieldsets Then I should see "Some grades have already been awarded, so the grade type and scale cannot be changed" # Try saving the form and visiting it back to verify that everything is working ok. @@ -94,9 +75,9 @@ Feature: Using the activity grade form element And I should not see "When selecting a ratings aggregate type you must also select" And I navigate to "Edit settings" in current page administration And I expand all fieldsets - And the field "Aggregate type" matches value "Average of ratings" - And the field "scale[modgrade_type]" matches value "Scale" - And the field "scale[modgrade_scale]" matches value "ABCDEF" + And the field "Ratings > Aggregate type" matches value "Average of ratings" + And the field "id_scale_modgrade_type" matches value "Scale" + And the field "Ratings > scale[modgrade_scale]" matches value "ABCDEF" @javascript Scenario: Attempting to change the scale when grades already exist in non-rating activity @@ -123,31 +104,16 @@ Feature: Using the activity grade form element And the field "grade[modgrade_scale]" matches value "ABCDEF" Scenario: Attempting to change the maximum grade when ratings exist - Given the following "activities" exist: - | activity | name | intro | course | idnumber | section | - | forum | Test forum name | Test forum description | C1 | forum1 | 1 | - And I am on the "Test forum name" "forum activity editing" page logged in as teacher1 + Given I am on the "Test forum name" "forum activity editing" page logged in as teacher1 And I set the following fields to these values: - | Forum type | Standard forum for general use | - | Aggregate type | Average of ratings | - | scale[modgrade_type] | Point | - | scale[modgrade_point] | 100 | - | Group mode | No groups | - And I press "Save and return to course" - And I log out - And I am on the "Test forum name" "forum activity" page logged in as student1 - And I click on "Add a new discussion topic" "link" - And I set the following fields to these values: - | Subject | Discussion subject | - | Message | Discussion message | - And I press "Post to forum" - And I log out - And I am on the "Test forum name" "forum activity" page logged in as teacher1 + | Ratings > Aggregate type | Average of ratings | + | id_scale_modgrade_type | Point | + | Ratings > scale[modgrade_point] | 100 | + And I press "Save and display" And I follow "Discussion subject" And I set the field "rating" to "100" And I press "Rate" - And I am on the "Test forum name" "forum activity" page - And I navigate to "Edit settings" in current page administration + And I am on the "Test forum name" "forum activity editing" page When I expand all fieldsets Then I should see "You cannot change the type, as grades already exist for this item." And I set the field "Ratings > Maximum grade" to "50" @@ -164,4 +130,4 @@ Feature: Using the activity grade form element And I press "OK" And I follow "Edit settings" When I expand all fieldsets - Then I should see "Some grades have already been awarded, so the grade type cannot be changed. If you wish to change the maximum grade, you must first choose whether or not to rescale existing grades." + Then I should see "Some grades have already been awarded, so the grade type cannot be changed. If you wish to change the maximum grade, you must first choose whether or not to rescale existing grades." \ No newline at end of file diff --git a/mod/forum/tests/behat/add_forum.feature b/mod/forum/tests/behat/add_forum.feature index f3cfed05696..38816fed316 100644 --- a/mod/forum/tests/behat/add_forum.feature +++ b/mod/forum/tests/behat/add_forum.feature @@ -17,22 +17,18 @@ Feature: Add forum activities and discussions | user | course | role | | teacher1 | C1 | editingteacher | | student1 | C1 | student | - And I log in as "teacher1" - And I am on "Course 1" course homepage with editing mode on - And I add a "Forum" to section "1" and I fill the form with: - | Forum name | Test forum name | - | Forum type | Standard forum for general use | - | Description | Test forum description | - And I add a new discussion to "Test forum name" forum with: - | Subject | Forum post 1 | - | Message | This is the body | - And I log out + And the following "activity" exists: + | activity | forum | + | course | C1 | + | section | 1 | + | name | Test forum name | + | type | general | + | description | Test forum description | + And the following forum discussions exist in course "Course 1": + | user | forum | name | message | attachments | + | teacher1 | Test forum name | Forum post 1 | this is the body | | + | student1 | Test forum name | Post with attachment | this is the body | empty.txt | And I log in as "student1" - And I am on "Course 1" course homepage - When I add a new discussion to "Test forum name" forum with: - | Subject | Post with attachment | - | Message | This is the body | - | Attachment | lib/tests/fixtures/empty.txt | And I reply "Forum post 1" post from "Test forum name" forum with: | Subject | Reply with attachment | | Message | This is the body | diff --git a/mod/forum/tests/behat/add_forum_inline.feature b/mod/forum/tests/behat/add_forum_inline.feature index 74eeaef6d53..1510c281038 100644 --- a/mod/forum/tests/behat/add_forum_inline.feature +++ b/mod/forum/tests/behat/add_forum_inline.feature @@ -13,16 +13,20 @@ Feature: Add forum activities and discussions utilizing the inline add discussio | user | course | role | | teacher1 | C1 | editingteacher | | student1 | C1 | student | - And I log in as "teacher1" - And I am on "Course 1" course homepage with editing mode on - And I add a "Forum" to section "1" and I fill the form with: - | Forum name | Test forum name | - | Forum type | Standard forum for general use | - | Description | Test forum description | - And I add a new discussion to "Test forum name" forum with: - | Subject | Forum post 1 | - | Message | This is the body | - And I log out + And the following "activity" exists: + | activity | forum | + | course | C1 | + | section | 1 | + | idnumber | 0001 | + | name | Test forum name | + | description | Test forum description | + | type | general | + And the following "mod_forum > discussion" exists: + | forum | 0001 | + | course | C1 | + | user | teacher1 | + | name | Forum post 1 | + | message | This is the body | Scenario: Student can add a discussion via the inline form Given I log in as "student1" diff --git a/mod/forum/tests/behat/edit_post_teacher.feature b/mod/forum/tests/behat/edit_post_teacher.feature index 5afcd968630..df9b2802c18 100644 --- a/mod/forum/tests/behat/edit_post_teacher.feature +++ b/mod/forum/tests/behat/edit_post_teacher.feature @@ -16,26 +16,18 @@ Feature: Teachers can edit or delete any forum post | user | course | role | | teacher1 | C1 | editingteacher | | student1 | C1 | student | - And I log in as "teacher1" - And I am on "Course 1" course homepage with editing mode on - And I add a "Forum" to section "1" and I fill the form with: - | Forum name | Test forum name | - | Description | Test forum description | - And I add a new discussion to "Test forum name" forum with: - | Subject | Teacher post subject | - | Message | Teacher post message | - And I log out - And I log in as "student1" - And I am on "Course 1" course homepage - And I reply "Teacher post subject" post from "Test forum name" forum with: - | Subject | Student post subject | - | Message | Student post message | + And the following "activities" exist: + | activity | name | course | idnumber | + | forum | Test forum name | C1 | forum1 | + And the following "mod_forum > discussions" exist: + | forum | course | user | name | message | + | forum1 | C1 | teacher1 | Teacher post subject | Teacher post message | + And the following "mod_forum > posts" exist: + | user | parentsubject | subject | message | + | student1 | Teacher post subject | Student post subject | Student post message | Scenario: A teacher can delete another user's posts - Given I log out - And I log in as "teacher1" - When I am on "Course 1" course homepage - And I follow "Test forum name" + When I am on the "Test forum name" "forum activity" page logged in as teacher1 And I follow "Teacher post subject" And I click on "Delete" "link" in the "//div[contains(concat(' ', normalize-space(@class), ' '), ' forumpost ')][contains(., 'Student post subject')]" "xpath_element" And I press "Continue" @@ -43,10 +35,7 @@ Feature: Teachers can edit or delete any forum post And I should not see "Student post message" Scenario: A teacher can edit another user's posts - Given I log out - And I log in as "teacher1" - When I am on "Course 1" course homepage - And I follow "Test forum name" + When I am on the "Test forum name" "forum activity" page logged in as teacher1 And I follow "Teacher post subject" And I click on "Edit" "link" in the "//div[contains(concat(' ', normalize-space(@class), ' '), ' forumpost ')][contains(., 'Student post subject')]" "xpath_element" And I set the following fields to these values: @@ -57,6 +46,7 @@ Feature: Teachers can edit or delete any forum post And I should see "Edited by Teacher 1 - original submission" Scenario: A student can't edit or delete another user's posts - When I follow "Teacher post subject" + When I am on the "Test forum name" "forum activity" page logged in as student1 + And I follow "Teacher post subject" Then I should not see "Edit" in the "//div[contains(concat(' ', normalize-space(@class), ' '), ' forumpost ')][contains(., 'Teacher post subject')]" "xpath_element" - And I should not see "Delete" in the "//div[contains(concat(' ', normalize-space(@class), ' '), ' forumpost ')][contains(., 'Teacher post subject')]" "xpath_element" + And I should not see "Delete" in the "//div[contains(concat(' ', normalize-space(@class), ' '), ' forumpost ')][contains(., 'Teacher post subject')]" "xpath_element" \ No newline at end of file diff --git a/mod/forum/tests/behat/forum_subscriptions.feature b/mod/forum/tests/behat/forum_subscriptions.feature index 74ad6b09b87..17b035f88a9 100644 --- a/mod/forum/tests/behat/forum_subscriptions.feature +++ b/mod/forum/tests/behat/forum_subscriptions.feature @@ -14,58 +14,42 @@ Feature: A user can control their own subscription preferences for a forum And the following "course enrolments" exist: | user | course | role | | student1 | C1 | student | + And the following "activities" exist: + | activity | course | idnumber | name | intro | type | section | + | forum | C1 | forum1 | Test forum name | Test forum description | general | 1 | + And the following "mod_forum > discussions" exist: + | forum | course | user | name | message | + | forum1 | C1 | admin | Test post subject | Test post message | And I log in as "admin" - And I am on "Course 1" course homepage with editing mode on Scenario: A disallowed subscription forum cannot be subscribed to - Given I add a "Forum" to section "1" and I fill the form with: - | Forum name | Test forum name | - | Forum type | Standard forum for general use | - | Description | Test forum description | + Given I am on the "Test forum name" "forum activity editing" page + And I set the following fields to these values: | Subscription mode | Subscription disabled | - And I add a new discussion to "Test forum name" forum with: - | Subject | Test post subject | - | Message | Test post message | - And I log out - When I log in as "student1" - And I am on "Course 1" course homepage - And I follow "Test forum name" + And I press "Save and return to course" + When I am on the "Test forum name" "forum activity" page logged in as student1 Then I should not see "Subscribe to this forum" And I should not see "Unsubscribe from this forum" And "You are subscribed to this discussion. Click to unsubscribe." "link" should not exist in the "Test post subject" "table_row" And "You are not subscribed to this discussion. Click to subscribe." "link" should not exist in the "Test post subject" "table_row" Scenario: A forced subscription forum cannot be subscribed to - Given I add a "Forum" to section "1" and I fill the form with: - | Forum name | Test forum name | - | Forum type | Standard forum for general use | - | Description | Test forum description | + Given I am on the "Test forum name" "forum activity editing" page + And I set the following fields to these values: | Subscription mode | Forced subscription | - And I add a new discussion to "Test forum name" forum with: - | Subject | Test post subject | - | Message | Test post message | - And I log out - When I log in as "student1" - And I am on "Course 1" course homepage - And I follow "Test forum name" + And I press "Save and return to course" + When I am on the "Test forum name" "forum activity" page logged in as student1 Then I should not see "Subscribe to this forum" And I should not see "Unsubscribe from this forum" And "You are subscribed to this discussion. Click to unsubscribe." "link" should not exist in the "Test post subject" "table_row" And "You are not subscribed to this discussion. Click to subscribe." "link" should not exist in the "Test post subject" "table_row" Scenario: An optional forum can be subscribed to - Given I add a "Forum" to section "1" and I fill the form with: - | Forum name | Test forum name | - | Forum type | Standard forum for general use | - | Description | Test forum description | + Given I am on the "Test forum name" "forum activity editing" page + And I set the following fields to these values: | Subscription mode | Optional subscription | - And I add a new discussion to "Test forum name" forum with: - | Subject | Test post subject | - | Message | Test post message | - And I log out - When I log in as "student1" - And I am on "Course 1" course homepage - And I follow "Test forum name" + And I press "Save and return to course" + When I am on the "Test forum name" "forum activity" page logged in as student1 Then I should see "Subscribe to this forum" And I should not see "Unsubscribe from this forum" And I follow "Subscribe to this forum" @@ -74,21 +58,14 @@ Feature: A user can control their own subscription preferences for a forum And I should not see "Subscribe to this forum" Scenario: An Automatic forum can be unsubscribed from - Given I add a "Forum" to section "1" and I fill the form with: - | Forum name | Test forum name | - | Forum type | Standard forum for general use | - | Description | Test forum description | + Given I am on the "Test forum name" "forum activity editing" page + And I set the following fields to these values: | Subscription mode | Auto subscription | - And I add a new discussion to "Test forum name" forum with: - | Subject | Test post subject | - | Message | Test post message | - And I log out - When I log in as "student1" - And I am on "Course 1" course homepage - And I follow "Test forum name" + And I press "Save and return to course" + When I am on the "Test forum name" "forum activity" page logged in as student1 Then I should see "Unsubscribe from this forum" And I should not see "Subscribe to this forum" And I follow "Unsubscribe from this forum" And I should see "Student One will NOT be notified of new posts in 'Test forum name'" And I should see "Subscribe to this forum" - And I should not see "Unsubscribe from this forum" + And I should not see "Unsubscribe from this forum" \ No newline at end of file diff --git a/mod/forum/tests/behat/forum_subscriptions_availability.feature b/mod/forum/tests/behat/forum_subscriptions_availability.feature index 1a9f7a09104..4796674b5b5 100644 --- a/mod/forum/tests/behat/forum_subscriptions_availability.feature +++ b/mod/forum/tests/behat/forum_subscriptions_availability.feature @@ -34,17 +34,17 @@ Feature: As a teacher I need to see an accurate list of subscribed users And the following "grouping groups" exist: | grouping | group | | GG1 | G1 | + And the following "activities" exist: + | activity | course | idnumber | section | type | name | description | forcesubscribe | + | forum | C1 | 1 | 1 | general | Forced Forum 1 | Test forum description | 1 | + | forum | C1 | 0001 | 1 | general | Forced Forum 2 | Test forum description | | + | forum | C1 | 0002 | 1 | general | Forced Forum 3 | Test forum description | 2 | And I log in as "teacher" And I am on "Course 1" course homepage with editing mode on @javascript Scenario: A forced forum lists all subscribers - When I add a "Forum" to section "1" and I fill the form with: - | Forum name | Forced Forum 1 | - | Forum type | Standard forum for general use | - | Description | Test forum description | - | Subscription mode | Forced subscription | - And I am on the "Forced Forum 1" "forum activity" page + When I am on the "Forced Forum 1" "forum activity" page And I navigate to "Show/edit current subscribers" in current page administration Then I should see "Student 1" And I should see "Teacher Teacher" @@ -63,16 +63,8 @@ Feature: As a teacher I need to see an accurate list of subscribed users And I should not see "Student 3" Scenario: A forced forum does not allow to edit the subscribers - Given the following "activity" exists: - | activity | forum | - | name | Forced Forum 2 | - | intro | Test forum description | - | type | general | - | course | C1 | - | idnumber | 0001 | - | section | 1 | - And I am on the "Forced Forum 2" "forum activity" page - And I navigate to "Edit settings" in current page administration + Given I am on the "Forced Forum 2" "forum activity" page + And I navigate to "Settings" in current page administration And I set the following fields to these values: | Subscription mode | Forced subscription | | Availability | Show on course page | @@ -86,16 +78,7 @@ Feature: As a teacher I need to see an accurate list of subscribed users And I should not see "Manage subscribers" Scenario: A forced and hidden forum lists only teachers - Given the following "activity" exists: - | activity | forum | - | name | Forced Forum 2 | - | intro | Test forum description | - | type | general | - | course | C1 | - | idnumber | 0001 | - | section | 1 | - And I am on "Course 1" course homepage - And I am on the "Forced Forum 2" "forum activity editing" page + Given I am on the "Forced Forum 2" "forum activity editing" page And I set the following fields to these values: | Subscription mode | Forced subscription | | Availability | Hide from students | @@ -109,19 +92,14 @@ Feature: As a teacher I need to see an accurate list of subscribed users @javascript Scenario: An automatic forum lists all subscribers - When I add a "Forum" to section "1" and I fill the form with: - | Forum name | Forced Forum 1 | - | Forum type | Standard forum for general use | - | Description | Test forum description | - | Subscription mode | Auto subscription | - And I am on the "Forced Forum 1" "forum activity" page + When I am on the "Forced Forum 3" "forum activity" page And I navigate to "Show/edit current subscribers" in current page administration Then I should see "Student 1" And I should see "Teacher Teacher" And I should see "Student 2" And I should see "Student 3" And I am on "Course 1" course homepage - And I am on the "Forced Forum 1" "forum activity editing" page + And I am on the "Forced Forum 3" "forum activity editing" page And I expand all fieldsets And I click on "Add restriction..." "button" And I click on "Grouping" "button" in the "Add restriction..." "dialogue" diff --git a/mod/forum/tests/behat/grade_forum.feature b/mod/forum/tests/behat/grade_forum.feature index adc10362cd9..3e78a9846f2 100644 --- a/mod/forum/tests/behat/grade_forum.feature +++ b/mod/forum/tests/behat/grade_forum.feature @@ -23,18 +23,19 @@ Feature: I can grade a students interaction across a forum And the following "scales" exist: | name | scale | | Test Scale 1 | Disappointing, Good, Very good, Excellent | + And the following "activity" exists: + | activity | forum | + | course | C1 | + | idnumber | 0001 | + | name | Test Forum 1 | And I log in as "teacher1" And I change window size to "large" - And I am on "Course 1" course homepage - And I turn editing mode on + And I am on "Course 1" course homepage with editing mode on @javascript Scenario: Ensure that forum grade settings do not leak to Ratings - Given I add a "Forum" to section "1" + Given I am on the "Test Forum 1" "forum activity editing" page And I expand all fieldsets - And I set the following fields to these values: - | Forum name | Test Forum 1 | - | Description | Test | # Fields should be hidden when grading is not set. When I set the field "Whole forum grading > Type" to "None" @@ -75,11 +76,8 @@ Feature: I can grade a students interaction across a forum @javascript Scenario: Ensure that Ratings settings do not leak to Forum grading - Given I add a "Forum" to section "1" + Given I am on the "Test Forum 1" "forum activity editing" page And I expand all fieldsets - And I set the following fields to these values: - | Forum name | Test Forum 1 | - | Description | Test | # Fields should be hidden when grading is not set. When I set the field "Ratings > Aggregate type" to "No ratings" @@ -131,13 +129,9 @@ Feature: I can grade a students interaction across a forum And I should see "Tutor" in the "Parent category" "fieldset" Scenario: Setting both a rating and a whole forum grade does not bleed - Given I add a "Forum" to section "1" - And I expand all fieldsets - And I set the following fields to these values: - | Forum name | Test Forum 1 | - | Description | Test | + Given I am on the "Test Forum 1" "forum activity editing" page - When I set the field "Ratings > Aggregate type" to "Count of ratings" + And I set the field "Ratings > Aggregate type" to "Count of ratings" And I set the field "Ratings > Type" to "Point" And I set the field "Ratings > Maximum grade" to "100" And I set the field "Ratings > Grade category" to "Peers" @@ -166,4 +160,4 @@ Feature: I can grade a students interaction across a forum When I expand all fieldsets Then the field "Maximum grade" matches value "10" Then the field "Grade to pass" matches value "4" - And I should see "Tutor" in the "Parent category" "fieldset" + And I should see "Tutor" in the "Parent category" "fieldset" \ No newline at end of file diff --git a/mod/forum/tests/behat/inpage_reply.feature b/mod/forum/tests/behat/inpage_reply.feature index 20be8aed86d..9dc90a1c949 100644 --- a/mod/forum/tests/behat/inpage_reply.feature +++ b/mod/forum/tests/behat/inpage_reply.feature @@ -13,18 +13,17 @@ Feature: Students can reply to a discussion in page. | user | course | role | | student1 | C1 | student | | teacher1 | C1 | editingteacher | - And I log in as "teacher1" - And I am on "Course 1" course homepage with editing mode on - And I add a "Forum" to section "1" and I fill the form with: - | Forum name | Test forum name | - | Description | Test forum description | - And I add a new discussion to "Test forum name" forum with: - | Subject | Discussion 1 | - | Message | Discussion contents 1, first message | - And I add a new discussion to "Test forum name" forum with: - | Subject | Discussion 2 | - | Message | Discussion contents 2, first message | - And I log out + And the following "activity" exists: + | activity | forum | + | course | C1 | + | section | 1 | + | idnumber | 0001 | + | name | Test forum name | + | description | Test forum description | + And the following "mod_forum > discussions" exist: + | forum | course | user | name | message | + | 0001 | C1 | teacher1 | Discussion 1 | Discussion contents 1, first message | + | 0001 | C1 | teacher1 | Discussion 2 | Discussion contents 2, first message | Scenario: Confirm inpage replies work Given I log in as "student1" diff --git a/mod/forum/tests/behat/split_forum_discussion.feature b/mod/forum/tests/behat/split_forum_discussion.feature index 0cbd00dcf33..869e2d816be 100644 --- a/mod/forum/tests/behat/split_forum_discussion.feature +++ b/mod/forum/tests/behat/split_forum_discussion.feature @@ -18,40 +18,29 @@ Feature: Forum discussions can be split | teacher1 | C1 | editingteacher | | student1 | C1 | student | | student2 | C1 | student | - And I log in as "teacher1" - And I am on "Science 101" course homepage with editing mode on - And I add a "Forum" to section "1" and I fill the form with: - | Forum name | Study discussions | - | Forum type | Standard forum for general use | - | Description | Forum to discuss your coursework. | - And I add a new discussion to "Study discussions" forum with: - | Subject | Photosynthesis discussion | - | Message | Lets discuss our learning about Photosynthesis this week in this thread. | - And I log out - And I log in as "student1" - And I am on "Science 101" course homepage - And I reply "Photosynthesis discussion" post from "Study discussions" forum with: - | Message | Can anyone tell me which number is the mass number in the periodic table? | - And I log out - And I log in as "student2" - And I am on "Science 101" course homepage - And I follow "Study discussions" + And the following "activities" exist: + | activity | name | course | idnumber | type | + | forum | Study discussions | C1 | forump1 | general | + And the following "mod_forum > discussions" exist: + | forum | course | user | name | message | + | forump1 | C1 | teacher1 | Photosynthesis discussion | Lets discuss our learning about Photosynthesis this week in this thread. | + And the following "mod_forum > posts" exist: + | user | parentsubject | message | + | student1 | Photosynthesis discussion | Can anyone tell me which number is the mass number in the periodic table? | + And I am on the "Study discussions" "forum activity" page logged in as student2 And I follow "Photosynthesis discussion" And I click on "Reply" "link" in the "//div[contains(concat(' ', normalize-space(@class), ' '), ' forumpost ')][contains(., 'Can anyone tell me which number is the mass number in the periodic table?')]" "xpath_element" And I wait to be redirected And I set the following fields to these values: | Message | I would also like to know this | And I press "Post to forum" - And I log out Scenario: Split a forum discussion - Given I log in as "teacher1" - And I am on "Science 101" course homepage - And I follow "Study discussions" + Given I am on the "Study discussions" "forum activity" page logged in as teacher1 And I follow "Photosynthesis discussion" When I follow "Split" And I set the following fields to these values: - | Discussion name | Mass number in periodic table | + | Discussion name | Mass number in periodic table | And I press "Split" Then I should see "Mass number in periodic table" And I follow "Study discussions" @@ -59,4 +48,4 @@ Feature: Forum discussions can be split # Confirm that the last post author has been updated. And I should not see "Student 2" in the "Photosynthesis" "table_row" # Confirm that the current author has been shown for the new split discussion. - And I should see "Student 1" in the "Mass number in periodic table" "table_row" + And I should see "Student 1" in the "Mass number in periodic table" "table_row" \ No newline at end of file From 5e5a72e6303193ed9125758f7a8c1b66b750896d Mon Sep 17 00:00:00 2001 From: Angelia Dela Cruz Date: Tue, 13 Sep 2022 13:09:16 +0800 Subject: [PATCH 3/3] MDL-70152 behat: Forum behat generators use UI Behat cleanup and optimisation --- .../tests/behat/edit_permissions.feature | 12 +- .../tests/behat/edit_availability.feature | 10 +- .../behat/restore_moodle2_courses.feature | 7 +- .../tests/behat/structural_changes.feature | 70 +++------ .../tests/behat/edit_activities.feature | 12 +- ...ompletion_no_calendar_capabilities.feature | 19 ++- .../behat/enable_manual_complete_mark.feature | 13 +- .../tests/behat/activities_edit_name.feature | 1 - .../behat/activities_visibility_icons.feature | 10 +- course/tests/behat/course_controls.feature | 22 ++- course/tests/behat/general_section.feature | 6 +- course/tests/behat/move_activities.feature | 2 +- course/tests/behat/move_sections.feature | 26 ++-- course/tests/behat/section_visibility.feature | 37 ++--- enrol/guest/tests/behat/guest_access.feature | 20 ++- grade/tests/behat/grade_to_pass.feature | 20 +-- .../tests/behat/modgrade_validation.feature | 4 +- .../summary/tests/behat/bulk_message.feature | 4 +- .../tests/behat/course_summary.feature | 18 +-- .../tests/behat/private_replies.feature | 16 +-- .../tests/behat/summary_data_access.feature | 4 +- .../behat/summary_data_attachments.feature | 11 +- .../behat/summary_data_post_dates.feature | 11 +- .../tests/behat/summary_filter_groups.feature | 8 +- .../behat/summary_filter_no_groups.feature | 11 +- mod/forum/tests/behat/add_forum.feature | 4 +- .../tests/behat/add_forum_inline.feature | 5 +- mod/forum/tests/behat/discussion_lock.feature | 27 ++-- .../tests/behat/discussion_navigation.feature | 88 +++--------- .../behat/discussion_subscriptions.feature | 134 ++++++------------ .../tests/behat/edit_post_student.feature | 11 +- .../tests/behat/edit_post_teacher.feature | 2 +- mod/forum/tests/behat/edit_tags.feature | 9 +- .../tests/behat/favourite_discussion.feature | 14 +- mod/forum/tests/behat/forum_export.feature | 7 +- .../tests/behat/forum_subscriptions.feature | 6 +- .../forum_subscriptions_availability.feature | 18 +-- .../behat/forum_subscriptions_default.feature | 37 ++--- .../forum_subscriptions_management.feature | 16 ++- mod/forum/tests/behat/grade_forum.feature | 2 +- .../tests/behat/grade_view_discussion.feature | 1 - ...roups_in_course_no_groups_in_forum.feature | 12 +- mod/forum/tests/behat/inpage_reply.feature | 22 ++- mod/forum/tests/behat/move_discussion.feature | 20 +-- mod/forum/tests/behat/my_forum_posts.feature | 16 +-- .../tests/behat/no_groups_in_course.feature | 32 ++--- .../tests/behat/portfolio_export.feature | 14 +- .../behat/post_to_multiple_groups.feature | 73 +++------- .../behat/posts_ordering_general.feature | 23 ++- mod/forum/tests/behat/private_replies.feature | 31 ++-- mod/forum/tests/behat/recent_activity.feature | 48 ++----- .../behat/separate_group_discussions.feature | 46 ++---- ...ate_group_single_group_discussions.feature | 27 +--- .../behat/single_forum_discussion.feature | 7 +- .../behat/split_forum_discussion.feature | 2 +- .../tests/behat/timed_discussions.feature | 16 +-- .../tests/behat/track_read_posts.feature | 2 +- .../behat/visible_group_discussions.feature | 36 ++--- report/outline/tests/behat/filter.feature | 18 +-- report/outline/tests/behat/outline.feature | 20 +-- report/outline/tests/behat/user.feature | 4 +- .../tests/behat/select_content.feature | 2 +- search/tests/behat/search_query.feature | 4 +- 63 files changed, 417 insertions(+), 813 deletions(-) diff --git a/admin/tool/behat/tests/behat/edit_permissions.feature b/admin/tool/behat/tests/behat/edit_permissions.feature index bfcbb80eadb..9cd8f3763d7 100644 --- a/admin/tool/behat/tests/behat/edit_permissions.feature +++ b/admin/tool/behat/tests/behat/edit_permissions.feature @@ -48,12 +48,12 @@ Feature: Edit capabilities And "mod/forum:addquestion" capability has "Allow" permission Scenario: Module capabilities overrides - Given I log in as "teacher1" - And I am on "Course 1" course homepage with editing mode on - And I add a "Forum" to section "1" and I fill the form with: - | Forum name | I'm the name | - | Description | I'm the introduction | - And I follow "I'm the name" + Given the following "activity" exists: + | activity | forum | + | course | C1 | + | idnumber | 00001 | + | name | I'm the name | + And I am on the "I'm the name" "forum activity" page logged in as teacher1 And I navigate to "Permissions" in current page administration And I override the system permissions of "Student" role with: | mod/forum:deleteanypost | Prohibit | diff --git a/availability/tests/behat/edit_availability.feature b/availability/tests/behat/edit_availability.feature index ba769e090ff..bd97298412f 100644 --- a/availability/tests/behat/edit_availability.feature +++ b/availability/tests/behat/edit_availability.feature @@ -30,9 +30,7 @@ Feature: edit_availability And the following "activity" exists: | activity | forum | | course | C1 | - | section | 1 | | name | MyForum | - | intro | x | Scenario: Confirm the 'enable availability' option is working Given the following config values are set as admin: @@ -168,9 +166,7 @@ Feature: edit_availability # Button does not exist when conditional access restrictions are turned off. Given the following config values are set as admin: | enableavailability | 0 | - And I log in as "admin" - And I am on "Course 1" course homepage with editing mode on - And I am on the "MyForum" "forum activity editing" page + And I am on the "MyForum" "forum activity editing" page logged in as admin When I expand all fieldsets Then "Add group/grouping access restriction" "button" should not exist @@ -180,9 +176,7 @@ Feature: edit_availability Given the following "groupings" exist: | name | course | idnumber | | GX1 | C1 | GXI1 | - And I log in as "admin" - And I am on "Course 1" course homepage with editing mode on - And I am on the "MyForum" "forum activity editing" page + And I am on the "MyForum" "forum activity editing" page logged in as admin When I expand all fieldsets Then the "Add group/grouping access restriction" "button" should be disabled diff --git a/backup/util/ui/tests/behat/restore_moodle2_courses.feature b/backup/util/ui/tests/behat/restore_moodle2_courses.feature index 0fde152b248..c161c7866ef 100644 --- a/backup/util/ui/tests/behat/restore_moodle2_courses.feature +++ b/backup/util/ui/tests/behat/restore_moodle2_courses.feature @@ -15,13 +15,10 @@ Feature: Restore Moodle 2 course backups | activity | course | idnumber | name | intro | section | externalurl | | assign | C3 | assign1 | Test assign name | Assign description | 1 | | | data | C3 | data1 | Test database name | Database description | 2 | | - | forum | C1 | 0001 | Test forum name | Test forum description | 1 | | + | forum | C1 | 0001 | Test forum name | | 1 | | | url | C1 | url1 | Test URL name | Test URL description | 3 | http://www.moodle.org | And I log in as "admin" And I am on "Course 1" course homepage with editing mode on - And I add a "Forum" to section "1" and I fill the form with: - | Forum name | Test forum name | - | Description | Test forum description | And I add the "Activities" block @javascript @@ -69,7 +66,7 @@ Feature: Restore Moodle 2 course backups | course | C1 | | section | 1 | | name | Test forum post backup name | - | intro | Test forum post backup description | + And I am on "Course 1" course homepage And I navigate to "Restore" in current page administration And I merge "test_backup.mbz" backup into the current course after deleting it's contents using this options: | Schema | Section 3 | 0 | diff --git a/blocks/recent_activity/tests/behat/structural_changes.feature b/blocks/recent_activity/tests/behat/structural_changes.feature index ea4cba18306..c00a75012e3 100644 --- a/blocks/recent_activity/tests/behat/structural_changes.feature +++ b/blocks/recent_activity/tests/behat/structural_changes.feature @@ -47,38 +47,32 @@ Feature: View structural changes in recent activity block Scenario: Check that Added module information is displayed respecting view capability Given the following "activities" exist: - | activity | course | section | name | idnumber | description | groupmode | grouping | visible | - | forum | C1 | 1 | ForumVisibleGroups | forum1 | No description | 2 | | 1 | - | forum | C1 | 1 | ForumSeparateGroups | forum2 | No description | 1 | | 1 | - | forum | C1 | 1 | ForumHidden | forum3 | No description | 1 | | 0 | - | forum | C1 | 1 | ForumNoGroups | forum4 | No description | 0 | | 1 | - | forum | C1 | 2 | ForumVisibleGroupsG1 | forum5 | No description | 2 | GG1 | 1 | - | forum | C1 | 2 | ForumSeparateGroupsG1 | forum6 | No description | 1 | GG1 | 1 | - | forum | C1 | 3 | ForumVisibleGroupsG2 | forum7 | No description | 2 | GG2 | 1 | - | forum | C1 | 3 | ForumSeparateGroupsG2 | forum8 | No description | 1 | GG2 | 1 | - And I log in as "teacher1" + | activity | course | name | idnumber | groupmode | grouping | visible | + | forum | C1 | ForumVisibleGroups | forum1 | 2 | | 1 | + | forum | C1 | ForumSeparateGroups | forum2 | 1 | | 1 | + | forum | C1 | ForumHidden | forum3 | 1 | | 0 | + | forum | C1 | ForumNoGroups | forum4 | 0 | | 1 | + | forum | C1 | ForumVisibleGroupsG1 | forum5 | 2 | GG1 | 1 | + | forum | C1 | ForumSeparateGroupsG1 | forum6 | 1 | GG1 | 1 | + | forum | C1 | ForumVisibleGroupsG2 | forum7 | 2 | GG2 | 1 | + | forum | C1 | ForumSeparateGroupsG2 | forum8 | 1 | GG2 | 1 | - And I am on "Course 1" course homepage - And I click on "ForumVisibleGroupsG1" "link" - And I click on "Edit settings" "link" + And I am on the "ForumVisibleGroupsG1" "forum activity editing" page logged in as teacher1 And I set the following fields to these values: | Access restrictions | Grouping: Grouping 1 | And I press "Save and return to course" - And I click on "ForumSeparateGroupsG1" "link" - And I click on "Edit settings" "link" + And I am on the "ForumSeparateGroupsG1" "forum activity editing" page And I set the following fields to these values: | Access restrictions | Grouping: Grouping 1 | And I press "Save and return to course" - And I click on "ForumVisibleGroupsG2" "link" - And I click on "Edit settings" "link" + And I am on the "ForumVisibleGroupsG2" "forum activity editing" page And I set the following fields to these values: | Access restrictions | Grouping: Grouping 2 | And I press "Save and return to course" - And I click on "ForumSeparateGroupsG2" "link" - And I click on "Edit settings" "link" + And I am on the "ForumSeparateGroupsG2" "forum activity editing" page And I set the following fields to these values: | Access restrictions | Grouping: Grouping 2 | And I press "Save and return to course" @@ -94,10 +88,8 @@ Feature: View structural changes in recent activity block And I should see "ForumSeparateGroupsG1" in the "Recent activity" "block" And I should see "ForumVisibleGroupsG2" in the "Recent activity" "block" And I should see "ForumSeparateGroupsG2" in the "Recent activity" "block" - 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 "ForumVisibleGroups" in the "Recent activity" "block" And I should see "ForumSeparateGroups" in the "Recent activity" "block" And I should see "ForumNoGroups" in the "Recent activity" "block" @@ -106,10 +98,8 @@ Feature: View structural changes in recent activity block And I should see "ForumSeparateGroupsG1" in the "Recent activity" "block" And I should not see "ForumVisibleGroupsG2" in the "Recent activity" "block" And I should not see "ForumSeparateGroupsG2" in the "Recent activity" "block" - 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 should see "ForumVisibleGroups" in the "Recent activity" "block" And I should see "ForumSeparateGroups" in the "Recent activity" "block" And I should see "ForumNoGroups" in the "Recent activity" "block" @@ -118,10 +108,8 @@ Feature: View structural changes in recent activity block And I should not see "ForumSeparateGroupsG1" in the "Recent activity" "block" And I should see "ForumVisibleGroupsG2" in the "Recent activity" "block" And I should see "ForumSeparateGroupsG2" in the "Recent activity" "block" - And I log out - And I log in as "student3" - And I am on "Course 1" course homepage + And I am on the "Course 1" course page logged in as student3 And I should see "ForumVisibleGroups" in the "Recent activity" "block" And I should see "ForumSeparateGroups" in the "Recent activity" "block" And I should see "ForumNoGroups" in the "Recent activity" "block" @@ -130,17 +118,14 @@ Feature: View structural changes in recent activity block And I should see "ForumSeparateGroupsG1" in the "Recent activity" "block" And I should see "ForumVisibleGroupsG2" in the "Recent activity" "block" And I should see "ForumSeparateGroupsG2" in the "Recent activity" "block" - And I log out # Teachers have capability to see all groups and hidden activities - And I log in as "assistant1" - And I am on "Course 1" course homepage + And I am on the "Course 1" course page logged in as assistant1 And I should see "ForumHidden" in the "Recent activity" "block" And I should see "ForumVisibleGroupsG1" in the "Recent activity" "block" And I should see "ForumSeparateGroupsG1" in the "Recent activity" "block" And I should see "ForumVisibleGroupsG2" in the "Recent activity" "block" And I should see "ForumSeparateGroupsG2" in the "Recent activity" "block" - And I log out Scenario: Updates and deletes in recent activity block Given the following "activity" exists: @@ -148,7 +133,6 @@ Feature: View structural changes in recent activity block | course | C1 | | idnumber | forum1 | | name | ForumNew | - | description | No description | When I log in as "teacher1" And I am on "Course 1" course homepage with editing mode on And I add the "Recent activity" block @@ -158,8 +142,7 @@ Feature: View structural changes in recent activity block # Update forum as a teacher after a second to ensure we have a new timestamp for recent activity. And I wait "1" seconds - 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 "Added Forum" in the "Recent activity" "block" And I should see "ForumNew" in the "Recent activity" "block" And I log out @@ -167,10 +150,7 @@ Feature: View structural changes in recent activity block And I wait "1" seconds # Update forum as a teacher - And I log in as "teacher1" - And I am on "Course 1" course homepage - And I follow "ForumNew" - And I navigate to "Edit settings" in current page administration + And I am on the "ForumNew" "forum activity editing" page logged in as teacher1 And I set the following fields to these values: | name | ForumUpdated | And I press "Save and return to course" @@ -178,8 +158,7 @@ Feature: View structural changes in recent activity block And I wait "1" seconds # Student 1 already saw that forum was created, now he can see that forum was updated - 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 not see "Added Forum" in the "Recent activity" "block" And I should not see "ForumNew" in the "Recent activity" "block" And I should see "Updated Forum" in the "Recent activity" "block" @@ -188,8 +167,7 @@ Feature: View structural changes in recent activity block And I wait "1" seconds # Student 2 has bigger interval and he can see one entry that forum was created but with the new name - 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 should see "Added Forum" in the "Recent activity" "block" And I should not see "ForumNew" in the "Recent activity" "block" And I should not see "Updated Forum" in the "Recent activity" "block" @@ -206,8 +184,7 @@ Feature: View structural changes in recent activity block And I wait "1" seconds # Students 1 and 2 see that forum was deleted - 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 not see "Added Forum" in the "Recent activity" "block" And I should not see "ForumNew" in the "Recent activity" "block" And I should not see "Updated Forum" in the "Recent activity" "block" @@ -217,8 +194,7 @@ Feature: View structural changes in recent activity block And I wait "1" seconds # Student 3 never knew that forum was created, so he does not see anything - And I log in as "student3" - And I am on "Course 1" course homepage + And I am on the "Course 1" course page logged in as student3 And I should not see "Added Forum" in the "Recent activity" "block" And I should not see "ForumNew" in the "Recent activity" "block" And I should not see "Updated Forum" in the "Recent activity" "block" diff --git a/blocks/social_activities/tests/behat/edit_activities.feature b/blocks/social_activities/tests/behat/edit_activities.feature index ddce9f6d419..02aab4b2fcf 100644 --- a/blocks/social_activities/tests/behat/edit_activities.feature +++ b/blocks/social_activities/tests/behat/edit_activities.feature @@ -19,11 +19,11 @@ Feature: Edit activities in social activities block @javascript Scenario: Edit name of acitivity in-place in social activities block - Given I log in as "user1" + Given the following "activities" exist: + | activity | course | name | + | forum | C1 | My forum name | + And I log in as "user1" And I am on "Course 1" course homepage with editing mode on - And I set the field "Add an activity to section 'section 0'" to "Forum" - And I set the field "Forum name" to "My forum name" - And I press "Save and return to course" When I set the field "Edit title" in the "My forum name" "block_social_activities > Activity" to "New forum name" Then I should not see "My forum name" in the "Social activities" "block" And I should see "New forum name" @@ -71,10 +71,8 @@ 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 turn editing mode off 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 am on the "Course 1" course page logged in as student1 And 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/completion/tests/behat/completion_no_calendar_capabilities.feature b/completion/tests/behat/completion_no_calendar_capabilities.feature index f690f76e556..f81d97260a4 100644 --- a/completion/tests/behat/completion_no_calendar_capabilities.feature +++ b/completion/tests/behat/completion_no_calendar_capabilities.feature @@ -23,21 +23,20 @@ Feature: Completion with no calendar capabilites And I log out Scenario: Editing completion date - Given I log in as "admin" + Given the following "activity" exists: + | activity | forum | + | course | C1 | + | name | Test forum name | + | completion | 2 | + And I log in as "admin" And I am on "Course 1" course homepage with editing mode on - When I add a "Forum" to section "1" and I fill the form with: - | Forum name | Test forum name | - | Description | Test forum description | - | Completion tracking | Show activity as complete when conditions are met | + And I am on the "Test forum name" "forum activity editing" page + And I set the following fields to these values: | id_completionexpected_enabled | 1 | | id_completionexpected_day | 1 | | id_completionexpected_month | 1 | | id_completionexpected_year | 2017 | - And I log out - When I log in as "teacher1" - And I am on "Course 1" course homepage with editing mode on - And I follow "Test forum name" - And I navigate to "Edit settings" in current page administration + When I am on the "Test forum name" "forum activity editing" page logged in as teacher1 And I set the following fields to these values: | id_completionexpected_year | 2018 | And I press "Save and return to course" diff --git a/completion/tests/behat/enable_manual_complete_mark.feature b/completion/tests/behat/enable_manual_complete_mark.feature index 906d213951d..ee18423e377 100644 --- a/completion/tests/behat/enable_manual_complete_mark.feature +++ b/completion/tests/behat/enable_manual_complete_mark.feature @@ -20,11 +20,8 @@ Feature: Allow students to manually mark an activity as complete And the following "activity" exists: | activity | forum | | course | C1 | - | section | 1 | | name | Test forum name | - | intro | Test forum description | - 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 "Edit settings" in current page administration And I set the following fields to these values: | Enable completion tracking | Yes | @@ -34,12 +31,8 @@ Feature: Allow students to manually mark an activity as complete | completion | 1 | And I press "Save and return to course" And "Student First" user has not completed "Test forum name" activity - 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 When I click on "Not completed: Test forum name. Select to mark as complete." "icon" Then the "Test forum name" "forum" activity with "manual" completion should be marked as complete - And I log out - And I log in as "teacher1" - And I am on "Course 1" course homepage + And I am on the "Course 1" course page logged in as teacher1 And "Student First" user has completed "Test forum name" activity diff --git a/course/tests/behat/activities_edit_name.feature b/course/tests/behat/activities_edit_name.feature index 18217384e98..e2efa4f7ba4 100644 --- a/course/tests/behat/activities_edit_name.feature +++ b/course/tests/behat/activities_edit_name.feature @@ -19,7 +19,6 @@ Feature: Edit activity name in-place | course | C1 | | activity | forum | | name | Test forum name | - | description | Test forum description | | idnumber | forum1 | When I log in as "teacher1" And I am on "Course 1" course homepage with editing mode on diff --git a/course/tests/behat/activities_visibility_icons.feature b/course/tests/behat/activities_visibility_icons.feature index 54a5e3b38bc..083db18290a 100644 --- a/course/tests/behat/activities_visibility_icons.feature +++ b/course/tests/behat/activities_visibility_icons.feature @@ -27,7 +27,6 @@ Feature: Toggle activities visibility from the course page | course | C1 | | idnumber | C1F1 | | name | Test forum name | - | intro | Test forum description | | visible | 1 | And I log in as "teacher1" And I am on "Course 1" course homepage with editing mode on @@ -63,10 +62,8 @@ Feature: Toggle activities visibility from the course page And "Test forum name" activity should be hidden And I turn editing mode off And "Test forum name" activity should be hidden - And I log out # Student should not see this activity. - 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 not see "Test forum name" @javascript @@ -77,7 +74,6 @@ Feature: Toggle activities visibility from the course page | idnumber | C1F1 | | section | 2 | | name | Test forum name | - | intro | Test forum description | | visible | 1 | And I log in as "teacher1" And I am on "Course 1" course homepage with editing mode on @@ -108,10 +104,8 @@ Feature: Toggle activities visibility from the course page And "Test forum name" activity should be available but hidden from course page And I turn editing mode off And "Test forum name" activity 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 am on the "Course 1" course page logged in as student1 And "Test forum name" activity should be hidden And I click on "Test forum name" "link" in the "Recent activity" "block" And I should see "Test forum name" diff --git a/course/tests/behat/course_controls.feature b/course/tests/behat/course_controls.feature index fb542d43b16..4d8eafc5aa6 100644 --- a/course/tests/behat/course_controls.feature +++ b/course/tests/behat/course_controls.feature @@ -27,11 +27,10 @@ Feature: Course activity controls works as expected | user | course | role | | teacher1 | C1 | editingteacher | And the following "activities" exist: - | activity | course | section | name | intro | - | forum | C1 | 1 | Test forum name 1 | Test forum description 1 | - | forum | C1 | 1 | Test forum name 2 | Test forum description 2 | - And I log in as "teacher1" - And I am on "Course 1" course homepage + | activity | course | section | name | + | forum | C1 | 1 | Test forum name 1 | + | forum | C1 | 1 | Test forum name 2 | + And I am on the "Course 1" course page logged in as teacher1 When I follow And I turn editing mode on And I add the "Recent activity" block @@ -96,8 +95,11 @@ Feature: Course activity controls works as expected And the following "course enrolments" exist: | user | course | role | | teacher1 | C1 | editingteacher | - And I log in as "teacher1" - And I am on "Course 1" course homepage + And the following "activities" exist: + | activity | course | section | name | + | forum | C1 | 1 | Test forum name 1 | + | forum | C1 | 1 | Test forum name 2 | + And I am on the "Course 1" course page logged in as teacher1 When I follow And I turn editing mode on And I add the "Recent activity" block @@ -105,12 +107,6 @@ Feature: Course activity controls works as expected And I click on "Delete Recent activity block" "link" And I press "Yes" And "section" exist - And I add a "Forum" to section "1" and I fill the form with: - | Forum name | Test forum name 1 | - | Description | Test forum description 1 | - And I add a "Forum" to section "1" and I fill the form with: - | Forum name | Test forum name 2 | - | Description | Test forum description 2 | And "section" exist And I indent right "Test forum name 1" activity And "section" exist diff --git a/course/tests/behat/general_section.feature b/course/tests/behat/general_section.feature index 4a5a259c4a0..3c0a0540403 100644 --- a/course/tests/behat/general_section.feature +++ b/course/tests/behat/general_section.feature @@ -14,12 +14,12 @@ Feature: General section does not show in navigation when empty And the following "course enrolments" exist: | user | course | role | | teacher1 | C1 | editingteacher | + And the following "activities" exist: + | activity | name | course | idnumber | section | + | forum | Test forum name | C1 | forum1 | 1 | And I log in as "teacher1" And I am on "Course 1" course homepage with editing mode on And I add the "Navigation" block if not present - And I add a "Forum" to section "1" and I fill the form with: - | Forum name | Test forum name | - | Description | Test forum description | Scenario: General section is visible in navigation when it is not empty When I move "Test forum name" activity to section "0" diff --git a/course/tests/behat/move_activities.feature b/course/tests/behat/move_activities.feature index 7e69e7e3258..2ecc84741c6 100644 --- a/course/tests/behat/move_activities.feature +++ b/course/tests/behat/move_activities.feature @@ -42,4 +42,4 @@ Feature: Activities can be moved between sections And I press "Save and display" And I follow "Topic 1" When I move "Second forum name" activity to section "1" - Then "Second forum name" "link" should appear before "Test forum name" "link" \ No newline at end of file + Then "Second forum name" "link" should appear before "Test forum name" "link" diff --git a/course/tests/behat/move_sections.feature b/course/tests/behat/move_sections.feature index 0e9e097346c..22cd53caeb6 100644 --- a/course/tests/behat/move_sections.feature +++ b/course/tests/behat/move_sections.feature @@ -15,38 +15,40 @@ Feature: Sections can be moved | user | course | role | | teacher1 | C1 | editingteacher | And I log in as "teacher1" - And I am on "Course 1" course homepage with editing mode on Scenario: Move up and down a section with Javascript disabled in a single page course - Given I add a "Forum" to section "1" and I fill the form with: - | Forum name | Test forum name | - | Description | Test forum description | + Given the following "activities" exist: + | activity | name | course | idnumber | section | + | forum | Test forum name | C1 | forum1 | 1 | + And I am on "Course 1" course homepage with editing mode on When I move down section "1" Then I should see "Test forum name" in the "Topic 2" "section" And I move up section "2" And I should see "Test forum name" in the "Topic 1" "section" Scenario: Move up and down a section with Javascript disabled in the course home of a course using paged mode - Given I navigate to "Edit settings" in current page administration + Given the following "activities" exist: + | activity | name | course | idnumber | section | + | forum | Test forum name | C1 | forum1 | 1 | + And I am on "Course 1" course homepage with editing mode on + And I navigate to "Edit settings" in current page administration And I set the following fields to these values: | Course layout | Show one section per page | And I press "Save and display" - And I add a "Forum" to section "1" and I fill the form with: - | Forum name | Test forum name | - | Description | Test forum description | When I move down section "1" Then I should see "Test forum name" in the "Topic 2" "section" And I move up section "2" And I should see "Test forum name" in the "Topic 1" "section" Scenario: Sections can not be moved with Javascript disabled in a section page of a course using paged mode - Given I navigate to "Edit settings" in current page administration + Given the following "activities" exist: + | activity | name | course | idnumber | section | + | forum | Test forum name | C1 | forum1 | 2 | + And I am on "Course 1" course homepage with editing mode on + And I navigate to "Edit settings" in current page administration And I set the following fields to these values: | Course layout | Show one section per page | And I press "Save and display" - And I add a "Forum" to section "2" and I fill the form with: - | Forum name | Test forum name | - | Description | Test forum description | When I follow "Topic 2" Then "Topic 1" "section" should not exist And "Topic 3" "section" should not exist diff --git a/course/tests/behat/section_visibility.feature b/course/tests/behat/section_visibility.feature index 7bba43f9c3f..6e5312c138c 100644 --- a/course/tests/behat/section_visibility.feature +++ b/course/tests/behat/section_visibility.feature @@ -17,33 +17,16 @@ Feature: Show/hide course sections | user | course | role | | teacher1 | C1 | editingteacher | | student1 | C1 | student | + And the following "activities" exist: + | activity | course | section | name | visible | + | forum | C1 | 1 | Test hidden forum 11 name | 0 | + | forum | C1 | 1 | Test hidden forum 12 name | 1 | + | forum | C1 | 2 | Test hidden forum 21 name | 0 | + | forum | C1 | 2 | Test hidden forum 22 name | 1 | + | forum | C1 | 3 | Test hidden forum 31 name | 0 | + | forum | C1 | 3 | Test hidden forum 32 name | 1 | And I log in as "teacher1" And I am on "Course 1" course homepage with editing mode on - And I add a "Forum" to section "1" and I fill the form with: - | Forum name | Test hidden forum 11 name | - | Description | Test hidden forum 11 description | - | Availability | Hide from students | - And I add a "Forum" to section "1" and I fill the form with: - | Forum name | Test hidden forum 12 name | - | Description | Test hidden forum 12 description | - | Availability | Show on course page | - And I add a "Forum" to section "2" and I fill the form with: - | Forum name | Test hidden forum 21 name | - | Description | Test hidden forum 21 description | - | Availability | Hide from students | - And I add a "Forum" to section "2" and I fill the form with: - | Forum name | Test hidden forum 22 name | - | Description | Test hidden forum 22 description | - | Availability | Show on course page | - And I add a "Forum" to section "3" and I fill the form with: - | Forum name | Test hidden forum 31 name | - | Description | Test hidden forum 31 description | - | Availability | Hide from students | - And I add a "Forum" to section "3" and I fill the form with: - | Forum name | Test hidden forum 32 name | - | Description | Test hidden forum 32 description | - | Availability | Show on course page | - And I am on "Course 1" course homepage When I hide section "1" Then section "1" should be hidden And section "2" should be visible @@ -62,9 +45,7 @@ Feature: Show/hide course sections And section "2" should be visible And section "3" should be hidden And all activities in section "1" should be hidden - 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 section "1" should be hidden And all activities in section "1" should be hidden And section "2" should be visible diff --git a/enrol/guest/tests/behat/guest_access.feature b/enrol/guest/tests/behat/guest_access.feature index 93742ba4f81..cd89abe6f43 100644 --- a/enrol/guest/tests/behat/guest_access.feature +++ b/enrol/guest/tests/behat/guest_access.feature @@ -15,11 +15,12 @@ Feature: Guest users can auto-enrol themself in courses where guest access is al And the following "course enrolments" exist: | user | course | role | | teacher1 | C1 | editingteacher | - And I log in as "teacher1" - And I am on "Course 1" course homepage with editing mode on - And I add a "Forum" to section "1" and I fill the form with: - | Forum name | Test forum name | - | Description | Test forum description | + And the following "activity" exists: + | activity | forum | + | course | C1 | + | idnumber | 0001 | + | name | Test forum name | + And I am on the "Course 1" course page logged in as teacher1 Scenario: Allow guest access without password Given I navigate to "Users > Enrolment methods" in current page administration @@ -27,10 +28,7 @@ Feature: Guest users can auto-enrol themself in courses where guest access is al And I set the following fields to these values: | Allow guest access | Yes | And I press "Save changes" - And I log out - And I log in as "student1" - And I am on "Course 1" course homepage - When I follow "Test forum name" + When I am on the "Test forum name" "forum activity" page logged in as student1 Then I should not see "Subscribe to this forum" Scenario: Allow guest access with password @@ -40,9 +38,7 @@ Feature: Guest users can auto-enrol themself in courses where guest access is al | Allow guest access | Yes | | Password | moodle_rules | And I press "Save changes" - 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 Then I should see "Guest access" And I set the following fields to these values: | Password | moodle_rules | diff --git a/grade/tests/behat/grade_to_pass.feature b/grade/tests/behat/grade_to_pass.feature index 7f5648b0e1f..98d7a829ec0 100644 --- a/grade/tests/behat/grade_to_pass.feature +++ b/grade/tests/behat/grade_to_pass.feature @@ -216,11 +216,9 @@ Feature: We can set the grade to pass value Scenario: Set an invalid grade to pass for forum activity Given the following "activities" exist: - | activity | name | intro | course | section | idnumber | - | forum | Test Forum 1 | Test | C1 | 1 | forum1 | - And I am on "Course 1" course homepage with editing mode on - And I follow "Test Forum 1" - And I navigate to "Edit settings" in current page administration + | activity | name | course | idnumber | + | forum | Test Forum 1 | C1 | forum1 | + And I am on the "Test Forum 1" "forum activity editing" page And I expand all fieldsets And I set the following fields to these values: | Ratings > Aggregate type | Average of ratings | @@ -232,11 +230,9 @@ Feature: We can set the grade to pass value Scenario: Set a valid grade to pass for forum activity Given the following "activities" exist: - | activity | name | intro | course | section | idnumber | - | forum | Test Forum 1 | Test | C1 | 1 | forum1 | - And I am on "Course 1" course homepage with editing mode on - And I follow "Test Forum 1" - And I navigate to "Edit settings" in current page administration + | activity | name | course | idnumber | + | forum | Test Forum 1 | C1 | forum1 | + And I am on the "Test Forum 1" "forum activity editing" page And I expand all fieldsets And I set the following fields to these values: | Ratings > Aggregate type | Average of ratings | @@ -250,9 +246,7 @@ Feature: We can set the grade to pass value Then the field "Grade to pass" matches value "90" And I set the field "Grade to pass" to "80" And I press "Save changes" - And I am on "Course 1" course homepage - And I follow "Test Forum 1" - And I follow "Edit settings" + And I am on the "Test Forum 1" "forum activity editing" page And the field "Ratings > Grade to pass" matches value "80" Scenario: Set a valid grade to pass for glossary activity diff --git a/lib/form/tests/behat/modgrade_validation.feature b/lib/form/tests/behat/modgrade_validation.feature index 686b2f9b8ae..424ace1ad5e 100644 --- a/lib/form/tests/behat/modgrade_validation.feature +++ b/lib/form/tests/behat/modgrade_validation.feature @@ -103,6 +103,7 @@ Feature: Using the activity grade form element And the field "grade[modgrade_type]" matches value "Scale" And the field "grade[modgrade_scale]" matches value "ABCDEF" + @javascript Scenario: Attempting to change the maximum grade when ratings exist Given I am on the "Test forum name" "forum activity editing" page logged in as teacher1 And I set the following fields to these values: @@ -112,7 +113,6 @@ Feature: Using the activity grade form element And I press "Save and display" And I follow "Discussion subject" And I set the field "rating" to "100" - And I press "Rate" And I am on the "Test forum name" "forum activity editing" page When I expand all fieldsets Then I should see "You cannot change the type, as grades already exist for this item." @@ -130,4 +130,4 @@ Feature: Using the activity grade form element And I press "OK" And I follow "Edit settings" When I expand all fieldsets - Then I should see "Some grades have already been awarded, so the grade type cannot be changed. If you wish to change the maximum grade, you must first choose whether or not to rescale existing grades." \ No newline at end of file + Then I should see "Some grades have already been awarded, so the grade type cannot be changed. If you wish to change the maximum grade, you must first choose whether or not to rescale existing grades." diff --git a/mod/forum/report/summary/tests/behat/bulk_message.feature b/mod/forum/report/summary/tests/behat/bulk_message.feature index e9332b7a410..403dc94e50f 100644 --- a/mod/forum/report/summary/tests/behat/bulk_message.feature +++ b/mod/forum/report/summary/tests/behat/bulk_message.feature @@ -19,8 +19,8 @@ Feature: Message users in the summary report | student1 | C1 | student | | student2 | C1 | student | And the following "activities" exist: - | activity | name | description | course | idnumber | - | forum | forum1 | C1 first forum | C1 | forum1 | + | activity | name | course | idnumber | + | forum | forum1 | C1 | forum1 | And the following forum discussions exist in course "Course 1": | user | forum | name | message | | teacher1 | forum1 | discussion1 | t1 earliest | diff --git a/mod/forum/report/summary/tests/behat/course_summary.feature b/mod/forum/report/summary/tests/behat/course_summary.feature index 2206b60b856..bff8627239e 100644 --- a/mod/forum/report/summary/tests/behat/course_summary.feature +++ b/mod/forum/report/summary/tests/behat/course_summary.feature @@ -24,11 +24,11 @@ Feature: Course level forum summary report | student2 | C2 | student | | student3 | C2 | student | And the following "activities" exist: - | activity | name | description | course | idnumber | - | forum | forum1 | C1 forum 1 | C1 | forum1 | - | forum | forum2 | C1 forum 2 | C1 | forum2 | - | forum | forum3 | C1 forum 3 | C1 | forum3 | - | forum | forum4 | C2 forum 1 | C2 | forum4 | + | activity | name | course | idnumber | + | forum | forum1 | C1 | forum1 | + | forum | forum2 | C1 | forum2 | + | forum | forum3 | C1 | forum3 | + | forum | forum4 | C2 | forum4 | And the following forum discussions exist in course "Course 1": | user | forum | name | message | created | | teacher1 | forum1 | discussion1 | Discussion 1 | ##2018-01-14 09:00:00## | @@ -55,9 +55,7 @@ Feature: Course level forum summary report | student2 | forum4 | discussion7 | Re d7 | Reply 8 | ##2020-02-04 13:50:00## | Scenario: Course forum summary report can be viewed by teacher and contains accurate data - When I log in as "teacher1" - And I am on "Course 1" course homepage - And I follow "forum2" + When I am on the "forum2" "forum activity" page logged in as teacher1 And I navigate to "Forum summary report" in current page administration And I should see "Export posts" And the following should exist in the "forumreport_summary_table" table: @@ -90,9 +88,7 @@ Feature: Course level forum summary report Given the following "permission overrides" exist: | capability | permission | role | contextlevel | reference | | forumreport/summary:view | Allow | student | Course | C1 | - When I log in as "student1" - And I am on "Course 1" course homepage - And I follow "forum1" + When I am on the "forum1" "forum activity" page logged in as student1 And I navigate to "Forum summary report" in current page administration And the following should exist in the "forumreport_summary_table" table: # | | Discussions | Replies | | | diff --git a/mod/forum/report/summary/tests/behat/private_replies.feature b/mod/forum/report/summary/tests/behat/private_replies.feature index ab80ad431c7..95fcf37c6bb 100644 --- a/mod/forum/report/summary/tests/behat/private_replies.feature +++ b/mod/forum/report/summary/tests/behat/private_replies.feature @@ -21,8 +21,8 @@ Feature: Include private replies in the summary report | student1 | C1 | student | | student2 | C1 | student | And the following "activities" exist: - | activity | name | description | course | idnumber | - | forum | forum1 | C1 first forum | C1 | forum1 | + | activity | name | course | idnumber | + | forum | forum1 | C1 | forum1 | And the following forum discussions exist in course "Course 1": | user | forum | name | message | | teacher1 | forum1 | discussion1 | t1 earliest | @@ -33,17 +33,13 @@ Feature: Include private replies in the summary report | teacher1 | forum1 | discussion1 | t1 between | t1 between | | teacher1 | forum1 | discussion2 | t1 latest | t1 latest | | student1 | forum1 | discussion1 | s1 earliest | s1 earliest | - 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 reply "s1 earliest" post from "discussion1" forum with: | Message | This is a private reply | | Reply privately | 1 | - And I log out Scenario: Private replies are counted for Teacher - When I log in as "teacher2" - And I am on "Course 1" course homepage - And I follow "forum1" + When I am on the "forum1" "forum activity" page logged in as teacher2 And I navigate to "Forum summary report" in current page administration Then "Teacher 1" row "Number of replies posted" column of "forumreport_summary_table" table should contain "3" @@ -51,8 +47,6 @@ Feature: Include private replies in the summary report Given the following "permission overrides" exist: | capability | permission | role | contextlevel | reference | | mod/forum:readprivatereplies | Prevent | editingteacher | Course | C1 | - When I log in as "teacher2" - And I am on "Course 1" course homepage - And I follow "forum1" + When I am on the "forum1" "forum activity" page logged in as teacher2 And I navigate to "Forum summary report" in current page administration Then "Teacher 1" row "Number of replies posted" column of "forumreport_summary_table" table should contain "2" diff --git a/mod/forum/report/summary/tests/behat/summary_data_access.feature b/mod/forum/report/summary/tests/behat/summary_data_access.feature index 21ee76967dc..57ccfe3f0d5 100644 --- a/mod/forum/report/summary/tests/behat/summary_data_access.feature +++ b/mod/forum/report/summary/tests/behat/summary_data_access.feature @@ -19,8 +19,8 @@ Feature: Report relevant content availability | student1 | C1 | student | | student2 | C1 | student | And the following "activities" exist: - | activity | name | description | course | idnumber | - | forum | forum1 | C1 forum | C1 | forum1 | + | activity | name | course | idnumber | + | forum | forum1 | C1 | forum1 | And the following forum discussions exist in course "Course 1": | user | forum | name | message | attachments | inlineattachments | | teacher1 | forum1 | discussion1 | message 1 | | | diff --git a/mod/forum/report/summary/tests/behat/summary_data_attachments.feature b/mod/forum/report/summary/tests/behat/summary_data_attachments.feature index b448a850d4a..7cb8ef72de4 100644 --- a/mod/forum/report/summary/tests/behat/summary_data_attachments.feature +++ b/mod/forum/report/summary/tests/behat/summary_data_attachments.feature @@ -21,10 +21,10 @@ Feature: Attachments count column data available | student2 | C1 | student | | teacher1 | C2 | editingteacher | And the following "activities" exist: - | activity | name | description | course | idnumber | - | forum | forum1 | C1 first forum | C1 | forum1 | - | forum | forum2 | C1 second forum | C1 | forum2 | - | forum | forum1 | C2 first forum | C2 | forum1 | + | activity | name | course | idnumber | + | forum | forum1 | C1 | forum1 | + | forum | forum2 | C1 | forum2 | + | forum | forum1 | C2 | forum1 | And the following forum discussions exist in course "Course 1": | user | forum | name | message | attachments | inlineattachments | | teacher1 | forum1 | discussion1 | message1 | att1.jpg, att2.txt | | @@ -41,8 +41,7 @@ Feature: Attachments count column data available And the following forum discussions exist in course "Course 2": | user | forum | name | message | attachments | inlineattachments | | teacher1 | forum1 | discussion1 | message1 | att1.jpg, att2.txt | | - 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 follow "forum1" And I navigate to "Forum summary report" in current page administration Then "Teacher 1" row "Number of attachments" column of "forumreport_summary_table" table should contain "6" diff --git a/mod/forum/report/summary/tests/behat/summary_data_post_dates.feature b/mod/forum/report/summary/tests/behat/summary_data_post_dates.feature index 783db9f5d74..25f2bfd71a7 100644 --- a/mod/forum/report/summary/tests/behat/summary_data_post_dates.feature +++ b/mod/forum/report/summary/tests/behat/summary_data_post_dates.feature @@ -21,10 +21,10 @@ Feature: Post date columns data available | student2 | C1 | student | | teacher1 | C2 | editingteacher | And the following "activities" exist: - | activity | name | description | course | idnumber | - | forum | forum1 | C1 first forum | C1 | forum1 | - | forum | forum2 | C1 second forum | C1 | forum2 | - | forum | forum1 | C2 first forum | C2 | forum1 | + | activity | name | course | idnumber | + | forum | forum1 | C1 | forum1 | + | forum | forum2 | C1 | forum2 | + | forum | forum1 | C2 | forum1 | And the following forum discussions exist in course "Course 1": | user | forum | name | message | created | | teacher1 | forum1 | discussion1 | t1 earliest | ##2018-01-02 09:00:00## | @@ -43,8 +43,7 @@ Feature: Post date columns data available | user | forum | name | message | created | | teacher1 | forum1 | discussion1 | t1 other course | ##2017-01-01 03:00:00## | | teacher1 | forum1 | discussion2 | t1 other course | ##2019-09-13 23:59:00## | - 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 follow "forum1" And I navigate to "Forum summary report" in current page administration Then "Teacher 1" row "Earliest post" column of "forumreport_summary_table" table should contain "Tuesday, 2 January 2018, 9:00" diff --git a/mod/forum/report/summary/tests/behat/summary_filter_groups.feature b/mod/forum/report/summary/tests/behat/summary_filter_groups.feature index 323230e4d43..3905bae86c2 100644 --- a/mod/forum/report/summary/tests/behat/summary_filter_groups.feature +++ b/mod/forum/report/summary/tests/behat/summary_filter_groups.feature @@ -34,10 +34,10 @@ Feature: Groups report filter is available if groups exist | teacher1 | G3 | | student1 | G3 | And the following "activities" exist: - | activity | name | description | course | idnumber | groupmode | - | forum | forum1 | C1 first forum | C1 | c1forum1 | 1 | - | forum | forum2 | C1 second forum | C1 | c1forum2 | 2 | - | forum | forum1 | C2 first forum | C2 | c2forum1 | 0 | + | activity | name | course | idnumber | groupmode | + | forum | forum1 | C1 | c1forum1 | 1 | + | forum | forum2 | C1 | c1forum2 | 2 | + | forum | forum1 | C2 | c2forum1 | 0 | And the following forum discussions exist in course "Course 1": | user | forum | name | message | group | created | | teacher1 | forum1 | discussion1 | D1 message | G1 | ## 1 month ago ## | diff --git a/mod/forum/report/summary/tests/behat/summary_filter_no_groups.feature b/mod/forum/report/summary/tests/behat/summary_filter_no_groups.feature index 7f837dce86a..b736e9e45c4 100644 --- a/mod/forum/report/summary/tests/behat/summary_filter_no_groups.feature +++ b/mod/forum/report/summary/tests/behat/summary_filter_no_groups.feature @@ -27,10 +27,10 @@ Feature: Groups report filter is not available if no groups exist | user | group | | teacher1 | G1 | And the following "activities" exist: - | activity | name | description | course | idnumber | groupmode | - | forum | forum1 | C1 first forum | C1 | forum1 | 0 | - | forum | forum2 | C1 second forum | C1 | forum2 | 0 | - | forum | forum1 | C2 first forum | C2 | forum1 | 2 | + | activity | name | course | idnumber | groupmode | + | forum | forum1 | C1 | forum1 | 0 | + | forum | forum2 | C1 | forum2 | 0 | + | forum | forum1 | C2 | forum1 | 2 | And the following forum discussions exist in course "Course 1": | user | forum | name | message | created | | teacher1 | forum1 | discussion1 | D1 message | ## 1 month ago ## | @@ -49,8 +49,7 @@ Feature: Groups report filter is not available if no groups exist | user | forum | name | message | created | | teacher1 | forum1 | discussion1 | D1 other course | ## 1 week ago ## | | teacher1 | forum1 | discussion2 | D2 other course | ## 4 days ago ## | - 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 follow "forum1" And I navigate to "Forum summary report" in current page administration Then "Groups" "button" should not exist diff --git a/mod/forum/tests/behat/add_forum.feature b/mod/forum/tests/behat/add_forum.feature index 38816fed316..8ae0d74bd6b 100644 --- a/mod/forum/tests/behat/add_forum.feature +++ b/mod/forum/tests/behat/add_forum.feature @@ -20,15 +20,13 @@ Feature: Add forum activities and discussions And the following "activity" exists: | activity | forum | | course | C1 | - | section | 1 | | name | Test forum name | | type | general | - | description | Test forum description | And the following forum discussions exist in course "Course 1": | user | forum | name | message | attachments | | teacher1 | Test forum name | Forum post 1 | this is the body | | | student1 | Test forum name | Post with attachment | this is the body | empty.txt | - And I log in as "student1" + When I am on the "Course 1" course page logged in as student1 And I reply "Forum post 1" post from "Test forum name" forum with: | Subject | Reply with attachment | | Message | This is the body | diff --git a/mod/forum/tests/behat/add_forum_inline.feature b/mod/forum/tests/behat/add_forum_inline.feature index 1510c281038..0d157c7bfa9 100644 --- a/mod/forum/tests/behat/add_forum_inline.feature +++ b/mod/forum/tests/behat/add_forum_inline.feature @@ -16,10 +16,8 @@ Feature: Add forum activities and discussions utilizing the inline add discussio And the following "activity" exists: | activity | forum | | course | C1 | - | section | 1 | | idnumber | 0001 | | name | Test forum name | - | description | Test forum description | | type | general | And the following "mod_forum > discussion" exists: | forum | 0001 | @@ -29,8 +27,7 @@ Feature: Add forum activities and discussions utilizing the inline add discussio | message | This is the body | Scenario: Student can add a discussion via the inline form - 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 Then I add a new discussion to "Test forum name" forum inline with: | Subject | Post with attachment | | Message | This is the body | diff --git a/mod/forum/tests/behat/discussion_lock.feature b/mod/forum/tests/behat/discussion_lock.feature index 246ffecca8a..1c74f04a305 100644 --- a/mod/forum/tests/behat/discussion_lock.feature +++ b/mod/forum/tests/behat/discussion_lock.feature @@ -15,22 +15,17 @@ Feature: As a teacher, you can manually lock individual discussions when viewing | course | C1 | | activity | forum | | name | Test forum name | - And I am on the "Course 1" course page logged in as admin - And I add a new discussion to "Test forum name" forum with: - | Subject | Discussion 1 | - | Message | Discussion contents 1, first message | - And I reply "Discussion 1" post from "Test forum name" forum with: - | Subject | Reply 1 to discussion 1 | - | Message | Discussion contents 1, second message | - And I add a new discussion to "Test forum name" forum with: - | Subject | Discussion 2 | - | Message | Discussion contents 2, first message | - And I reply "Discussion 2" post from "Test forum name" forum with: - | Subject | Reply 1 to discussion 2 | - | Message | Discussion contents 2, second message | + And the following forum discussions exist in course "Course 1": + | user | forum | name | message | + | admin | Test forum name | Discussion 1 | Discussion contents 1, first message | + | admin | Test forum name | Discussion 2 | Discussion contents 2, first message | + And the following forum replies exist in course "Course 1": + | user | forum | discussion | subject | message | + | admin | Test forum name | Discussion 1 | Reply 1 to discussion 1 | Discussion contents 1, second message | + | admin | Test forum name | Discussion 2 | Reply 1 to discussion 2 | Discussion contents 2, second message | Scenario: Lock a discussion and view - Given I am on the "Course 1" course page + Given I am on the "Course 1" course page logged in as admin And I navigate to post "Discussion 1" in "Test forum name" forum And I press "Settings" Then "Lock this discussion" "link" should be visible @@ -42,9 +37,7 @@ Feature: As a teacher, you can manually lock individual discussions when viewing And I press "Settings" And I follow "Discussion 2" Then I should not see "This discussion has been locked so you can no longer reply to it." - 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 navigate to post "Discussion 1" in "Test forum name" forum Then I should see "This discussion has been locked so you can no longer reply to it." And "Reply" "link" should not be visible diff --git a/mod/forum/tests/behat/discussion_navigation.feature b/mod/forum/tests/behat/discussion_navigation.feature index e6354772254..601ec77faf2 100644 --- a/mod/forum/tests/behat/discussion_navigation.feature +++ b/mod/forum/tests/behat/discussion_navigation.feature @@ -31,11 +31,9 @@ Feature: A user can navigate to previous and next discussions Scenario: A user can navigate between discussions Given the following "activities" exist: - | activity | name | intro | course | idnumber | groupmode | - | forum | Test forum name | Test forum name | C1 | forum | 0 | - And I log in as "teacher1" - And I am on "Course 1" course homepage - And I follow "Test forum name" + | activity | name | course | idnumber | groupmode | + | forum | Test forum name | C1 | forum | 0 | + And I am on the "Test forum name" "forum activity" page logged in as teacher1 And I add a new discussion to "Test forum name" forum with: | Subject | Discussion 1 | | Message | Test post message | @@ -72,37 +70,17 @@ Feature: A user can navigate to previous and next discussions Scenario: A user can navigate between discussions with visible groups Given the following "activities" exist: - | activity | name | intro | course | idnumber | groupmode | - | forum | Test forum name | Test forum name | C1 | forum | 2 | - And I log in as "teacher1" - And I am on "Course 1" course homepage - And I follow "Test forum name" - And I add a new discussion to "Test forum name" forum with: - | Subject | Discussion 1 Group 0 | - | Message | Test post message | - And I add a new discussion to "Test forum name" forum with: - | Subject | Discussion 2 Group 0 | - | Message | Test post message | - And I add a new discussion to "Test forum name" forum with: - | Subject | Discussion 1 Group 1 | - | Message | Test post message | - | Group | Group 1 | - And I add a new discussion to "Test forum name" forum with: - | Subject | Discussion 2 Group 1 | - | Message | Test post message | - | Group | Group 1 | - And I add a new discussion to "Test forum name" forum with: - | Subject | Discussion 1 Group 2 | - | Message | Test post message | - | Group | Group 2 | - And I add a new discussion to "Test forum name" forum with: - | Subject | Discussion 2 Group 2 | - | Message | Test post message | - | Group | Group 2 | - And I log out - When I log in as "student1" - And I am on "Course 1" course homepage - And I follow "Test forum name" + | activity | name | course | idnumber | groupmode | + | forum | Test forum name | C1 | forum | 2 | + And the following forum discussions exist in course "Course 1": + | user | forum | name | message | group | + | teacher1 | Test forum name | Discussion 1 Group 0 | Test post message | | + | teacher1 | Test forum name | Discussion 2 Group 0 | Test post message | | + | teacher1 | Test forum name | Discussion 1 Group 1 | Test post message | G1 | + | teacher1 | Test forum name | Discussion 2 Group 1 | Test post message | G1 | + | teacher1 | Test forum name | Discussion 1 Group 2 | Test post message | G2 | + | teacher1 | Test forum name | Discussion 2 Group 2 | Test post message | G2 | + When I am on the "Test forum name" "forum activity" page logged in as student1 And I select "All participants" from the "Visible groups" singleselect And I follow "Discussion 1 Group 0" Then I should see "Discussion 2 Group 0" @@ -131,35 +109,15 @@ Feature: A user can navigate to previous and next discussions Given the following "activities" exist: | activity | name | intro | course | idnumber | groupmode | | forum | Test forum name | Test forum name | C1 | forum | 1 | - And I log in as "teacher1" - And I am on "Course 1" course homepage - And I follow "Test forum name" - And I add a new discussion to "Test forum name" forum with: - | Subject | Discussion 1 Group 0 | - | Message | Test post message | - And I add a new discussion to "Test forum name" forum with: - | Subject | Discussion 2 Group 0 | - | Message | Test post message | - And I add a new discussion to "Test forum name" forum with: - | Subject | Discussion 1 Group 1 | - | Message | Test post message | - | Group | Group 1 | - And I add a new discussion to "Test forum name" forum with: - | Subject | Discussion 2 Group 1 | - | Message | Test post message | - | Group | Group 1 | - And I add a new discussion to "Test forum name" forum with: - | Subject | Discussion 1 Group 2 | - | Message | Test post message | - | Group | Group 2 | - And I add a new discussion to "Test forum name" forum with: - | Subject | Discussion 2 Group 2 | - | Message | Test post message | - | Group | Group 2 | - And I log out - When I log in as "student1" - And I am on "Course 1" course homepage - And I follow "Test forum name" + And the following forum discussions exist in course "Course 1": + | user | forum | name | message | group | + | teacher1 | Test forum name | Discussion 1 Group 0 | Test post message | | + | teacher1 | Test forum name | Discussion 2 Group 0 | Test post message | | + | teacher1 | Test forum name | Discussion 1 Group 1 | Test post message | G1 | + | teacher1 | Test forum name | Discussion 2 Group 1 | Test post message | G1 | + | teacher1 | Test forum name | Discussion 1 Group 2 | Test post message | G2 | + | teacher1 | Test forum name | Discussion 2 Group 2 | Test post message | G2 | + When I am on the "Test forum name" "forum activity" page logged in as student1 And I follow "Discussion 1 Group 1" Then I should see "Discussion 2 Group 0" And I should see "Discussion 2 Group 1" diff --git a/mod/forum/tests/behat/discussion_subscriptions.feature b/mod/forum/tests/behat/discussion_subscriptions.feature index 0ac10d94438..5bc438920ad 100644 --- a/mod/forum/tests/behat/discussion_subscriptions.feature +++ b/mod/forum/tests/behat/discussion_subscriptions.feature @@ -14,7 +14,6 @@ Feature: A user can control their own subscription preferences for a discussion And the following "course enrolments" exist: | user | course | role | | student1 | C1 | student | - And I log in as "admin" @javascript Scenario: An optional forum can have discussions subscribed to @@ -23,17 +22,12 @@ Feature: A user can control their own subscription preferences for a discussion | course | C1 | | idnumber | forum1 | | name | Test forum name | - | intro | Test forum description | | type | general | | forcesubscribe | 0 | - And I am on "Course 1" course homepage - And I add a new discussion to "Test forum name" forum with: - | Subject | Test post subject one | - | Message | Test post message one | - And I add a new discussion to "Test forum name" forum with: - | Subject | Test post subject two | - | Message | Test post message two | - And I log out + And the following forum discussions exist in course "Course 1": + | user | forum | name | message | + | admin | Test forum name | Test post subject one | Test post message one | + | admin | Test forum name | Test post subject two | Test post message two | When I am on the "Test forum name" "forum activity" page logged in as student1 Then I can subscribe to this forum And "Subscribe to this discussion" "checkbox" should exist in the "Test post subject one" "table_row" @@ -68,17 +62,12 @@ Feature: A user can control their own subscription preferences for a discussion | course | C1 | | idnumber | forum1 | | name | Test forum name | - | intro | Test forum description | | type | general | | forcesubscribe | 2 | - And I am on "Course 1" course homepage - And I add a new discussion to "Test forum name" forum with: - | Subject | Test post subject one | - | Message | Test post message one | - And I add a new discussion to "Test forum name" forum with: - | Subject | Test post subject two | - | Message | Test post message two | - And I log out + And the following forum discussions exist in course "Course 1": + | user | forum | name | message | + | admin | Test forum name | Test post subject one | Test post message one | + | admin | Test forum name | Test post subject two | Test post message two | When I am on the "Test forum name" "forum activity" page logged in as student1 Then I can unsubscribe from this forum And "Unsubscribe from this discussion" "checkbox" should exist in the "Test post subject one" "table_row" @@ -113,17 +102,12 @@ Feature: A user can control their own subscription preferences for a discussion | course | C1 | | idnumber | forum1 | | name | Test forum name | - | intro | Test forum description | | type | general | | forcesubscribe | 0 | - And I am on "Course 1" course homepage - And I add a new discussion to "Test forum name" forum with: - | Subject | Test post subject one | - | Message | Test post message one | - And I add a new discussion to "Test forum name" forum with: - | Subject | Test post subject two | - | Message | Test post message two | - And I log out + And the following forum discussions exist in course "Course 1": + | user | forum | name | message | + | admin | Test forum name | Test post subject one | Test post message one | + | admin | Test forum name | Test post subject two | Test post message two | And I am on the "Test forum name" "forum activity" page logged in as student1 And I can subscribe to this forum And "Subscribe to this discussion" "checkbox" should exist in the "Test post subject one" "table_row" @@ -132,13 +116,11 @@ Feature: A user can control their own subscription preferences for a discussion And I can subscribe to this forum And "Unsubscribe from this discussion" "checkbox" should exist in the "Test post subject one" "table_row" And "Subscribe to this discussion" "checkbox" should exist in the "Test post subject two" "table_row" - And I log out And I am on the "Test forum name" "forum activity" page logged in as admin And I navigate to "Edit settings" in current page administration And I set the following fields to these values: | Subscription mode | Auto subscription | And I press "Save and return to course" - And I log out And I am on the "Test forum name" "forum activity" page logged in as student1 And I can unsubscribe from this forum And "Unsubscribe from this discussion" "checkbox" should exist in the "Test post subject one" "table_row" @@ -156,17 +138,12 @@ Feature: A user can control their own subscription preferences for a discussion | course | C1 | | idnumber | forum1 | | name | Test forum name | - | intro | Test forum description | | type | general | | forcesubscribe | 0 | - And I am on "Course 1" course homepage - And I add a new discussion to "Test forum name" forum with: - | Subject | Test post subject one | - | Message | Test post message one | - And I add a new discussion to "Test forum name" forum with: - | Subject | Test post subject two | - | Message | Test post message two | - And I log out + And the following forum discussions exist in course "Course 1": + | user | forum | name | message | + | admin | Test forum name | Test post subject one | Test post message one | + | admin | Test forum name | Test post subject two | Test post message two | And I am on the "Test forum name" "forum activity" page logged in as student1 And I can subscribe to this forum And "Subscribe to this discussion" "checkbox" should exist in the "Test post subject one" "table_row" @@ -175,14 +152,10 @@ Feature: A user can control their own subscription preferences for a discussion And I can subscribe to this forum And "Unsubscribe from this discussion" "checkbox" should exist in the "Test post subject one" "table_row" And "Subscribe to this discussion" "checkbox" should exist in the "Test post subject two" "table_row" - And I log out - And I log in as "admin" - And I am on the "Test forum name" "forum activity" page - And I navigate to "Edit settings" in current page administration + And I am on the "Test forum name" "forum activity editing" page logged in as admin And I set the following fields to these values: | Subscription mode | Auto subscription | And I press "Save and return to course" - And I log out And I am on the "Test forum name" "forum activity" page logged in as student1 And I can unsubscribe from this forum And "Unsubscribe from this discussion" "checkbox" should exist in the "Test post subject one" "table_row" @@ -199,17 +172,12 @@ Feature: A user can control their own subscription preferences for a discussion | course | C1 | | idnumber | forum1 | | name | Test forum name | - | intro | Test forum description | | type | general | | forcesubscribe | 0 | - And I am on "Course 1" course homepage - And I add a new discussion to "Test forum name" forum with: - | Subject | Test post subject one | - | Message | Test post message one | - And I add a new discussion to "Test forum name" forum with: - | Subject | Test post subject two | - | Message | Test post message two | - And I log out + And the following forum discussions exist in course "Course 1": + | user | forum | name | message | + | admin | Test forum name | Test post subject one | Test post message one | + | admin | Test forum name | Test post subject two | Test post message two | When I am on the "Test forum name" "forum activity" page logged in as student1 And I should see "Subscribe to this forum" And I reply "Test post subject one" post from "Test forum name" forum with: @@ -237,17 +205,12 @@ Feature: A user can control their own subscription preferences for a discussion | course | C1 | | idnumber | forum1 | | name | Test forum name | - | intro | Test forum description | | type | general | | forcesubscribe | 2 | - And I am on "Course 1" course homepage - And I add a new discussion to "Test forum name" forum with: - | Subject | Test post subject one | - | Message | Test post message one | - And I add a new discussion to "Test forum name" forum with: - | Subject | Test post subject two | - | Message | Test post message two | - And I log out + And the following forum discussions exist in course "Course 1": + | user | forum | name | message | + | admin | Test forum name | Test post subject one | Test post message one | + | admin | Test forum name | Test post subject two | Test post message two | When I am on the "Test forum name" "forum activity" page logged in as student1 And I should see "Unsubscribe from this forum" And I reply "Test post subject one" post from "Test forum name" forum with: @@ -270,18 +233,13 @@ Feature: A user can control their own subscription preferences for a discussion And the field "Discussion subscription" matches value "I don't want to be notified of new posts in this discussion" Scenario: A guest should not be able to subscribe to a discussion - Given I am on site homepage - And I turn editing mode on - And I add a "Forum" to section "1" and I fill the form with: - | Forum name | Test forum name | - | Forum type | Standard forum for general use | - | Description | Test forum description | - And I add a new discussion to "Test forum name" forum with: - | Subject | Test post subject one | - | Message | Test post message one | - And I log out - When I log in as "guest" - And I follow "Test forum name" + Given the following "activities" exist: + | activity | name | course | section | idnumber | type | + | forum | Test forum name | Acceptance test site | 1 | forum1 | general | + And the following forum discussions exist in course "Acceptance test site": + | user | forum | name | message | + | admin | Test forum name | Test post subject one | Test post message one | + When I am on the "Test forum name" "forum activity" page logged in as guest Then "Subscribe to this discussion" "checkbox" should not exist in the "Test post subject one" "table_row" And "Unsubscribe from this discussion" "checkbox" should not exist in the "Test post subject one" "table_row" And I follow "Test post subject one" @@ -289,17 +247,14 @@ Feature: A user can control their own subscription preferences for a discussion And "Unsubscribe from this discussion" "checkbox" should not exist Scenario: A user who is not logged in should not be able to subscribe to a discussion - Given I am on site homepage - And I turn editing mode on - And I add a "Forum" to section "1" and I fill the form with: - | Forum name | Test forum name | - | Forum type | Standard forum for general use | - | Description | Test forum description | - And I add a new discussion to "Test forum name" forum with: - | Subject | Test post subject one | - | Message | Test post message one | - And I log out - When I follow "Test forum name" + Given the following "activities" exist: + | activity | name | course | section | idnumber | type | + | forum | Test forum name | Acceptance test site | 1 | forum1 | general | + And the following forum discussions exist in course "Acceptance test site": + | user | forum | name | message | + | admin | Test forum name | Test post subject one | Test post message one | + When I am on site homepage + And I follow "Test forum name" Then "Subscribe to this discussion" "checkbox" should not exist in the "Test post subject one" "table_row" And "Unsubscribe from this discussion" "checkbox" should not exist in the "Test post subject one" "table_row" And I follow "Test post subject one" @@ -312,14 +267,11 @@ Feature: A user can control their own subscription preferences for a discussion | course | C1 | | idnumber | forum1 | | name | Test forum name | - | intro | Test forum description | | type | general | | forcesubscribe | 0 | - And I am on "Course 1" course homepage - And I add a new discussion to "Test forum name" forum with: - | Subject | Test post subject one | - | Message | Test post message one | - And I log out + And the following forum discussions exist in course "Course 1": + | user | forum | name | message | + | admin | Test forum name | Test post subject one | Test post message one | When I am on the "Test forum name" "forum activity" page logged in as student1 Then "Subscribe to this forum" "link" should exist in current page administration And I follow "Test post subject one" diff --git a/mod/forum/tests/behat/edit_post_student.feature b/mod/forum/tests/behat/edit_post_student.feature index 42e66bc658f..d4c1bfbbee3 100644 --- a/mod/forum/tests/behat/edit_post_student.feature +++ b/mod/forum/tests/behat/edit_post_student.feature @@ -15,10 +15,9 @@ Feature: Students can edit or delete their forum posts within a set time limit | user | course | role | | student1 | C1 | student | And the following "activities" exist: - | activity | name | intro | course | idnumber | - | forum | Test forum name | Test forum description | C1 | forum | - And I log in as "student1" - And I am on "Course 1" course homepage + | activity | name | course | idnumber | + | forum | Test forum name | C1 | forum | + And I am on the "Course 1" course page logged in as student1 And I add a new discussion to "Test forum name" forum with: | Subject | Forum post subject | | Message | This is the body | @@ -48,9 +47,7 @@ Feature: Students can edit or delete their forum posts within a set time limit | maxeditingtime | 1 | And I am on "Course 1" course homepage with editing mode on And I add the "Recent activity" block - And I log out - And I log in as "student1" - And I am on "Course 1" course homepage + And I 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" When I wait "2" seconds diff --git a/mod/forum/tests/behat/edit_post_teacher.feature b/mod/forum/tests/behat/edit_post_teacher.feature index df9b2802c18..eb820e508b8 100644 --- a/mod/forum/tests/behat/edit_post_teacher.feature +++ b/mod/forum/tests/behat/edit_post_teacher.feature @@ -49,4 +49,4 @@ Feature: Teachers can edit or delete any forum post When I am on the "Test forum name" "forum activity" page logged in as student1 And I follow "Teacher post subject" Then I should not see "Edit" in the "//div[contains(concat(' ', normalize-space(@class), ' '), ' forumpost ')][contains(., 'Teacher post subject')]" "xpath_element" - And I should not see "Delete" in the "//div[contains(concat(' ', normalize-space(@class), ' '), ' forumpost ')][contains(., 'Teacher post subject')]" "xpath_element" \ No newline at end of file + And I should not see "Delete" in the "//div[contains(concat(' ', normalize-space(@class), ' '), ' forumpost ')][contains(., 'Teacher post subject')]" "xpath_element" diff --git a/mod/forum/tests/behat/edit_tags.feature b/mod/forum/tests/behat/edit_tags.feature index 20a1ccf6c42..e02a8d7d425 100644 --- a/mod/forum/tests/behat/edit_tags.feature +++ b/mod/forum/tests/behat/edit_tags.feature @@ -20,11 +20,9 @@ Feature: Edited forum posts handle tags correctly | course | C1 | | activity | forum | | name | Test forum name | - And I am on the "Course 1" Course page logged in as teacher1 - And I add a new discussion to "Test forum name" forum with: - | Subject | Teacher post subject | - | Message | Teacher post message | - And I log out + And the following forum discussions exist in course "Course 1": + | user | forum | name | message | + | teacher1 | Test forum name | Teacher post subject | Teacher post message | @javascript Scenario: Forum post edition of custom tags works as expected @@ -45,7 +43,6 @@ Feature: Edited forum posts handle tags correctly And I follow "Add standard tags" And I set the field "Enter comma-separated list of new tags" to "OT1, OT2, OT3" And I press "Continue" - And I log out And I am on the "Test forum name" "forum activity" page logged in as teacher1 And I click on "Add a new discussion topic" "link" And I click on "Advanced" "button" diff --git a/mod/forum/tests/behat/favourite_discussion.feature b/mod/forum/tests/behat/favourite_discussion.feature index 8ff9650ef15..eaf3822f404 100644 --- a/mod/forum/tests/behat/favourite_discussion.feature +++ b/mod/forum/tests/behat/favourite_discussion.feature @@ -15,14 +15,12 @@ Feature: A student can favourite a discussion via the forum settings menu | course | C1 | | activity | forum | | name | Test forum name | - And I am on the "Course 1" Course page logged in as admin - And I add a new discussion to "Test forum name" forum with: - | Subject | Discussion 1 | - | Message | Discussion contents 1, first message | - And I reply "Discussion 1" post from "Test forum name" forum with: - | Subject | Reply 1 to discussion 1 | - | Message | Discussion contents 1, second message | - And I log out + And the following forum discussions exist in course "Course 1": + | user | forum | name | message | + | admin | Test forum name | Discussion 1 | Discussion contents 1, first message | + And the following forum replies exist in course "Course 1": + | user | forum | discussion | name | message | + | admin | Test forum name | Discussion 1 | Reply 1 to discussion 1 | Discussion contents 1, second message | Scenario: Student can favourite a discussion from within an individual discussion Given I am on the "Course 1" Course page logged in as student1 diff --git a/mod/forum/tests/behat/forum_export.feature b/mod/forum/tests/behat/forum_export.feature index 12d71f84e6c..66902ce480f 100644 --- a/mod/forum/tests/behat/forum_export.feature +++ b/mod/forum/tests/behat/forum_export.feature @@ -18,8 +18,8 @@ Feature: Export forum | teacher1 | C1 | editingteacher | | student1 | C1 | student | And the following "activities" exist: - | activity | name | intro | type | course | idnumber | - | forum | Test forum 1 | Test forum 1 description | general | C1 | 123 | + | activity | name | type | course | idnumber | + | forum | Test forum 1 | general | C1 | 123 | Scenario: Teacher can export forum Given I am on the "Test forum 1" "forum activity" page logged in as teacher1 @@ -30,12 +30,10 @@ Feature: Export forum And I should not see "Student 2" in the ".form-autocomplete-suggestions" "css_element" # This will fail if an exception is thrown. This is the best we can do without the ability to use the download. Hence, there is no "Then" step. And I click on "Export" "button" - And I log out Scenario: Students cannot export forum by default Given I am on the "Test forum 1" "forum activity" page logged in as student1 Then "Export" "link" should not exist in current page administration - And I log out Scenario: User with the capability can export Given the following "permission overrides" exist: @@ -49,4 +47,3 @@ Feature: Export forum And I should not see "Student 2" in the ".form-autocomplete-suggestions" "css_element" # This will fail if an exception is thrown. This is the best we can do without the ability to use the download. Hence, there is no "Then" step. And I click on "Export" "button" - And I log out diff --git a/mod/forum/tests/behat/forum_subscriptions.feature b/mod/forum/tests/behat/forum_subscriptions.feature index 17b035f88a9..c51967cbbc5 100644 --- a/mod/forum/tests/behat/forum_subscriptions.feature +++ b/mod/forum/tests/behat/forum_subscriptions.feature @@ -15,8 +15,8 @@ Feature: A user can control their own subscription preferences for a forum | user | course | role | | student1 | C1 | student | And the following "activities" exist: - | activity | course | idnumber | name | intro | type | section | - | forum | C1 | forum1 | Test forum name | Test forum description | general | 1 | + | activity | course | idnumber | name | type | + | forum | C1 | forum1 | Test forum name | general | And the following "mod_forum > discussions" exist: | forum | course | user | name | message | | forum1 | C1 | admin | Test post subject | Test post message | @@ -68,4 +68,4 @@ Feature: A user can control their own subscription preferences for a forum And I follow "Unsubscribe from this forum" And I should see "Student One will NOT be notified of new posts in 'Test forum name'" And I should see "Subscribe to this forum" - And I should not see "Unsubscribe from this forum" \ No newline at end of file + And I should not see "Unsubscribe from this forum" diff --git a/mod/forum/tests/behat/forum_subscriptions_availability.feature b/mod/forum/tests/behat/forum_subscriptions_availability.feature index 4796674b5b5..7736d4d8f38 100644 --- a/mod/forum/tests/behat/forum_subscriptions_availability.feature +++ b/mod/forum/tests/behat/forum_subscriptions_availability.feature @@ -35,10 +35,10 @@ Feature: As a teacher I need to see an accurate list of subscribed users | grouping | group | | GG1 | G1 | And the following "activities" exist: - | activity | course | idnumber | section | type | name | description | forcesubscribe | - | forum | C1 | 1 | 1 | general | Forced Forum 1 | Test forum description | 1 | - | forum | C1 | 0001 | 1 | general | Forced Forum 2 | Test forum description | | - | forum | C1 | 0002 | 1 | general | Forced Forum 3 | Test forum description | 2 | + | activity | course | idnumber | type | name | forcesubscribe | + | forum | C1 | 1 | general | Forced Forum 1 | 1 | + | forum | C1 | 0001 | general | Forced Forum 2 | | + | forum | C1 | 0002 | general | Forced Forum 3 | 2 | And I log in as "teacher" And I am on "Course 1" course homepage with editing mode on @@ -63,13 +63,11 @@ Feature: As a teacher I need to see an accurate list of subscribed users And I should not see "Student 3" Scenario: A forced forum does not allow to edit the subscribers - Given I am on the "Forced Forum 2" "forum activity" page - And I navigate to "Settings" in current page administration + Given I am on the "Forced Forum 2" "forum activity editing" page And I set the following fields to these values: | Subscription mode | Forced subscription | | Availability | Show on course page | - And I press "Save and return to course" - And I am on the "Forced Forum 2" "forum activity" page + And I press "Save and display" And I navigate to "Show/edit current subscribers" in current page administration Then I should see "Teacher Teacher" And I should see "Student 1" @@ -82,8 +80,7 @@ Feature: As a teacher I need to see an accurate list of subscribed users And I set the following fields to these values: | Subscription mode | Forced subscription | | Availability | Hide from students | - And I press "Save and return to course" - And I am on the "Forced Forum 2" "forum activity" page + And I press "Save and display" And I navigate to "Show/edit current subscribers" in current page administration Then I should see "Teacher Teacher" And I should not see "Student 1" @@ -98,7 +95,6 @@ Feature: As a teacher I need to see an accurate list of subscribed users And I should see "Teacher Teacher" And I should see "Student 2" And I should see "Student 3" - And I am on "Course 1" course homepage And I am on the "Forced Forum 3" "forum activity editing" page And I expand all fieldsets And I click on "Add restriction..." "button" diff --git a/mod/forum/tests/behat/forum_subscriptions_default.feature b/mod/forum/tests/behat/forum_subscriptions_default.feature index e51cc985e75..57ddfa244e4 100644 --- a/mod/forum/tests/behat/forum_subscriptions_default.feature +++ b/mod/forum/tests/behat/forum_subscriptions_default.feature @@ -17,36 +17,31 @@ Feature: A user can control their default discussion subscription settings | student1 | C1 | student | | student2 | C1 | student | And the following "activities" exist: - | activity | name | intro | course | type | section | - | forum | Test forum name | Test forum description | C1 | general | 1 | + | activity | name | course | idnumber | type | + | forum | Test forum name | C1 | forump1 | general | And I am on the "Test forum name" "forum activity editing" page logged in as admin And I set the following fields to these values: | Subscription mode | Optional subscription | And I press "Save and return to course" - And I log out Scenario: Creating a new discussion in an optional forum follows user preferences Given I am on the "Test forum name" "forum activity" page logged in as student1 When I click on "Add a new discussion topic" "link" And I click on "Advanced" "button" Then "input[name=discussionsubscribe][checked=checked]" "css_element" should exist - And I log out And I am on the "Test forum name" "forum activity" page logged in as student2 And I click on "Add a new discussion topic" "link" And I click on "Advanced" "button" And "input[name=discussionsubscribe]:not([checked=checked])" "css_element" should exist Scenario: Replying to an existing discussion in an optional forum follows user preferences - Given I am on the "Test forum name" "forum activity" page logged in as admin - And I add a new discussion to "Test forum name" forum with: - | Subject | Test post subject | - | Message | Test post message | - And I log out + Given the following forum discussions exist in course "Course 1": + | user | forum | name | message | + | admin | Test forum name | Test post subject | Test post message | And I am on the "Test forum name" "forum activity" page logged in as student1 And I follow "Test post subject" When I follow "Reply" Then "input[name=discussionsubscribe][checked=checked]" "css_element" should exist - And I log out And I am on the "Test forum name" "forum activity" page logged in as student2 And I follow "Test post subject" And I follow "Reply" @@ -57,31 +52,27 @@ Feature: A user can control their default discussion subscription settings And I set the following fields to these values: | Subscription mode | Auto subscription | And I press "Save and return to course" - And I log out And I am on the "Test forum name" "forum activity" page logged in as student1 When I click on "Add a new discussion topic" "link" And I click on "Advanced" "button" Then "input[name=discussionsubscribe][checked=checked]" "css_element" should exist - And I log out And I am on the "Test forum name" "forum activity" page logged in as student2 And I click on "Add a new discussion topic" "link" And I click on "Advanced" "button" And "input[name=discussionsubscribe][checked=checked]" "css_element" should exist Scenario: Replying to an existing discussion in an automatic forum follows forum subscription - Given I am on the "Test forum name" "forum activity editing" page logged in as admin + Given the following forum discussions exist in course "Course 1": + | user | forum | name | message | + | admin | Test forum name | Test post subject | Test post message | + And I am on the "Test forum name" "forum activity editing" page logged in as admin And I set the following fields to these values: | Subscription mode | Optional subscription | And I press "Save and return to course" - And I add a new discussion to "Test forum name" forum with: - | Subject | Test post subject | - | Message | Test post message | - And I log out And I am on the "Test forum name" "forum activity" page logged in as student1 And I follow "Test post subject" When I follow "Reply" Then "input[name=discussionsubscribe][checked=checked]" "css_element" should exist - And I log out And I am on the "Test forum name" "forum activity" page logged in as student2 And I follow "Test post subject" And I follow "Reply" @@ -89,21 +80,19 @@ Feature: A user can control their default discussion subscription settings @javascript Scenario: Replying to an existing discussion in an automatic forum which has been unsubscribed from follows user preferences - Given I am on the "Test forum name" "forum activity editing" page logged in as admin + Given the following forum discussions exist in course "Course 1": + | user | forum | name | message | + | admin | Test forum name | Test post subject | Test post message | + And I am on the "Test forum name" "forum activity editing" page logged in as admin And I set the following fields to these values: | Subscription mode | Auto subscription | And I press "Save and return to course" - And I add a new discussion to "Test forum name" forum with: - | Subject | Test post subject | - | Message | Test post message | - And I log out And I am on the "Test forum name" "forum activity" page logged in as student1 And I click on "input[id^=subscription-toggle]" "css_element" in the "Test post subject" "table_row" And I follow "Test post subject" When I follow "Reply" And I click on "Advanced" "button" And "input[name=discussionsubscribe][checked]" "css_element" should exist - And I log out And I am on the "Test forum name" "forum activity" page logged in as student2 And I click on "input[id^=subscription-toggle]" "css_element" in the "Test post subject" "table_row" And I follow "Test post subject" diff --git a/mod/forum/tests/behat/forum_subscriptions_management.feature b/mod/forum/tests/behat/forum_subscriptions_management.feature index 9a21ffaa4ef..9fd4e8e005f 100644 --- a/mod/forum/tests/behat/forum_subscriptions_management.feature +++ b/mod/forum/tests/behat/forum_subscriptions_management.feature @@ -18,13 +18,15 @@ Feature: A teacher can control the subscription to a forum | teacher | C1 | editingteacher | | student1 | C1 | student | | student2 | C1 | student | - And I log in as "teacher" - And I am on "Course 1" course homepage with editing mode on - And I add a "Forum" to section "1" and I fill the form with: - | Forum name | Test forum name | - | Forum type | Standard forum for general use | - | Description | Test forum description | - | Subscription mode | Auto subscription | + And the following "activity" exists: + | activity | forum | + | course | C1 | + | idnumber | f01 | + | name | Test forum name | + And I am on the "Test forum name" "forum activity editing" page logged in as teacher + And I set the following fields to these values: + | Subscription mode | Auto subscription | + And I press "Save and return to course" Scenario: A teacher can change toggle subscription editing on and off Given I follow "Test forum name" diff --git a/mod/forum/tests/behat/grade_forum.feature b/mod/forum/tests/behat/grade_forum.feature index 3e78a9846f2..5ac50c3b630 100644 --- a/mod/forum/tests/behat/grade_forum.feature +++ b/mod/forum/tests/behat/grade_forum.feature @@ -160,4 +160,4 @@ Feature: I can grade a students interaction across a forum When I expand all fieldsets Then the field "Maximum grade" matches value "10" Then the field "Grade to pass" matches value "4" - And I should see "Tutor" in the "Parent category" "fieldset" \ No newline at end of file + And I should see "Tutor" in the "Parent category" "fieldset" diff --git a/mod/forum/tests/behat/grade_view_discussion.feature b/mod/forum/tests/behat/grade_view_discussion.feature index e992a6c5ba9..eaf1a18f018 100644 --- a/mod/forum/tests/behat/grade_view_discussion.feature +++ b/mod/forum/tests/behat/grade_view_discussion.feature @@ -22,7 +22,6 @@ Feature: View discussion while grading in a forum And the following "activity" exists: | activity | forum | | name | Gradable forum | - | intro | Standard forum description | | course | C1 | | idnumber | forum1 | | grade_forum | 100 | diff --git a/mod/forum/tests/behat/groups_in_course_no_groups_in_forum.feature b/mod/forum/tests/behat/groups_in_course_no_groups_in_forum.feature index ae8af762fae..729b328a0de 100644 --- a/mod/forum/tests/behat/groups_in_course_no_groups_in_forum.feature +++ b/mod/forum/tests/behat/groups_in_course_no_groups_in_forum.feature @@ -26,13 +26,11 @@ Feature: Forums in 'No groups' mode allow posting to All participants for all us | teacher1 | G2 | | student1 | G1 | And the following "activities" exist: - | activity | name | intro | course | idnumber | groupmode | - | forum | Standard forum name | Standard forum description | C1 | nogroups | 0 | + | activity | name | course | idnumber | groupmode | + | forum | Standard forum name | C1 | nogroups | 0 | Scenario: Teacher can post - Given I log in as "teacher1" - And I am on "Course 1" course homepage - And I follow "Standard forum name" + Given I am on the "Standard forum name" "forum activity" page logged in as teacher1 And I should not see "Group A" And I should not see "Group B" When I click on "Add a new discussion topic" "link" @@ -46,9 +44,7 @@ Feature: Forums in 'No groups' mode allow posting to All participants for all us And I should see "Teacher 1 -> Forum" Scenario: Student can post - Given I log in as "student1" - And I am on "Course 1" course homepage - And I follow "Standard forum name" + Given I am on the "Standard forum name" "forum activity" page logged in as student1 And I should not see "Group A" And I should not see "Group B" When I click on "Add a new discussion topic" "link" diff --git a/mod/forum/tests/behat/inpage_reply.feature b/mod/forum/tests/behat/inpage_reply.feature index 9dc90a1c949..02f26eb5b9a 100644 --- a/mod/forum/tests/behat/inpage_reply.feature +++ b/mod/forum/tests/behat/inpage_reply.feature @@ -16,31 +16,27 @@ Feature: Students can reply to a discussion in page. And the following "activity" exists: | activity | forum | | course | C1 | - | section | 1 | | idnumber | 0001 | | name | Test forum name | - | description | Test forum description | And the following "mod_forum > discussions" exist: | forum | course | user | name | message | | 0001 | C1 | teacher1 | Discussion 1 | Discussion contents 1, first message | | 0001 | C1 | teacher1 | Discussion 2 | Discussion contents 2, first message | Scenario: Confirm inpage replies work - Given I log in as "student1" - And I am on "Course 1" course homepage - Given I reply "Discussion 2" post from "Test forum name" forum using an inpage reply with: + Given I am on the "Course 1" course page logged in as student1 + When I reply "Discussion 2" post from "Test forum name" forum using an inpage reply with: | post | Discussion contents 1, third message | Then I should see "Discussion contents 1, third message" - When I reload the page - Then I should see "Discussion contents 1, third message" + And I reload the page + And I should see "Discussion contents 1, third message" Scenario: Confirm inpage replies work - private reply - Given I log in as "teacher1" - And I am on "Course 1" course homepage - And I reply "Discussion 2" post from "Test forum name" forum using an inpage reply with: + Given I am on the "Course 1" course page logged in as teacher1 + When I reply "Discussion 2" post from "Test forum name" forum using an inpage reply with: | post | Discussion contents 1, third message | | privatereply | 1 | Then I should see "Discussion contents 1, third message" - Then I should see "This is a private reply. It is not visible to other participants." - When I reload the page - Then I should see "Discussion contents 1, third message" + And I should see "This is a private reply. It is not visible to other participants." + And I reload the page + And I should see "Discussion contents 1, third message" diff --git a/mod/forum/tests/behat/move_discussion.feature b/mod/forum/tests/behat/move_discussion.feature index 9590e650863..9a823319d8a 100644 --- a/mod/forum/tests/behat/move_discussion.feature +++ b/mod/forum/tests/behat/move_discussion.feature @@ -19,19 +19,13 @@ Feature: A teacher can move discussions between forums Scenario: A teacher can move discussions Given the following "activities" exist: - | activity | name | intro | course | idnumber | groupmode | - | forum | Test forum 1 | Test forum 2 | C1 | forum | 0 | - | forum | Test forum 2 | Test forum 1 | C1 | forum | 0 | - And I log in as "student1" - And I am on "Course 1" course homepage - And I follow "Test forum 1" - And I add a new discussion to "Test forum 1" forum with: - | Subject | Discussion 1 | - | Message | Test post message | - And I log out - And I log in as "teacher1" - And I am on "Course 1" course homepage - And I follow "Test forum 1" + | activity | name | course | idnumber | groupmode | + | forum | Test forum 1 | C1 | forum | 0 | + | forum | Test forum 2 | C1 | forum | 0 | + And the following forum discussions exist in course "Course 1": + | user | forum | name | message | + | student1 | Test forum 1 | Discussion 1 | Test post message | + And I am on the "Test forum 1" "forum activity" page logged in as teacher1 And I follow "Discussion 1" When I set the field "jump" to "Test forum 2" And I press "Move" diff --git a/mod/forum/tests/behat/my_forum_posts.feature b/mod/forum/tests/behat/my_forum_posts.feature index 1805ff740d8..35a1d0afe7f 100644 --- a/mod/forum/tests/behat/my_forum_posts.feature +++ b/mod/forum/tests/behat/my_forum_posts.feature @@ -15,15 +15,15 @@ Feature: A user can view their posts and discussions | user | course | role | | student1 | C1 | student | And the following "activities" exist: - | activity | name | intro | course | idnumber | groupmode | - | forum | Test forum name | Test forum | C1 | forum | 0 | + | activity | name | course | idnumber | groupmode | + | forum | Test forum name | C1 | forum | 0 | + And the following forum discussions exist in course "Course 1": + | user | forum | name | message | + | student1 | Test forum name | Forum discussion 1 | How awesome is this forum discussion? | + And the following forum replies exist in course "Course 1": + | user | forum | discussion | message | + | student1 | Test forum name | Forum discussion 1 | Actually, I've seen better. | And I log in as "student1" - And I am on "Course 1" course homepage - And I add a new discussion to "Test forum name" forum with: - | Subject | Forum discussion 1 | - | Message | How awesome is this forum discussion? | - And I reply "Forum discussion 1" post from "Test forum name" forum with: - | Message | Actually, I've seen better. | When I follow "Profile" in the user menu And I follow "Forum posts" Then I should see "How awesome is this forum discussion?" diff --git a/mod/forum/tests/behat/no_groups_in_course.feature b/mod/forum/tests/behat/no_groups_in_course.feature index 37148ac3e8d..ba0d24f4af6 100644 --- a/mod/forum/tests/behat/no_groups_in_course.feature +++ b/mod/forum/tests/behat/no_groups_in_course.feature @@ -14,15 +14,13 @@ Feature: Posting to forums in a course with no groups behaves correctly | teacher1 | C1 | editingteacher | | student1 | C1 | student | And the following "activities" exist: - | activity | name | intro | course | idnumber | groupmode | - | forum | Standard forum | Standard forum description | C1 | nogroups | 0 | - | forum | Visible forum | Visible forum description | C1 | visgroups | 2 | - | forum | Separate forum | Separate forum description | C1 | sepgroups | 1 | + | activity | name | course | idnumber | groupmode | + | forum | Standard forum | C1 | nogroups | 0 | + | forum | Visible forum | C1 | visgroups | 2 | + | forum | Separate forum | C1 | sepgroups | 1 | Scenario: Teachers can post in standard forum - Given I log in as "teacher1" - And I am on "Course 1" course homepage - And I follow "Standard forum" + Given I am on the "Standard forum" "forum activity" page logged in as teacher1 When I click on "Add a new discussion topic" "link" Then I should not see "Post a copy to all groups" And I set the following fields to these values: @@ -33,9 +31,7 @@ Feature: Posting to forums in a course with no groups behaves correctly And I should see "Teacher -> All participants" Scenario: Teachers can post in forum with separate groups - Given I log in as "teacher1" - And I am on "Course 1" course homepage - And I follow "Separate forum" + Given I am on the "Separate forum" "forum activity" page logged in as teacher1 When I click on "Add a new discussion topic" "link" Then I should not see "Post a copy to all groups" And I set the following fields to these values: @@ -46,9 +42,7 @@ Feature: Posting to forums in a course with no groups behaves correctly And I should see "Teacher -> All participants" Scenario: Teachers can post in forum with visible groups - Given I log in as "teacher1" - And I am on "Course 1" course homepage - And I follow "Visible forum" + Given I am on the "Visible forum" "forum activity" page logged in as teacher1 When I click on "Add a new discussion topic" "link" Then I should not see "Post a copy to all groups" And I set the following fields to these values: @@ -59,9 +53,7 @@ Feature: Posting to forums in a course with no groups behaves correctly And I should see "Teacher -> All participants" Scenario: Students can post in standard forum - Given I log in as "student1" - And I am on "Course 1" course homepage - And I follow "Standard forum" + Given I am on the "Standard forum" "forum activity" page logged in as student1 When I click on "Add a new discussion topic" "link" Then I should not see "Post a copy to all groups" And I set the following fields to these values: @@ -72,15 +64,11 @@ Feature: Posting to forums in a course with no groups behaves correctly And I should see "Student -> All participants" Scenario: Students cannot post in forum with separate groups - Given I log in as "student1" - And I am on "Course 1" course homepage - When I follow "Separate forum" + When I am on the "Separate forum" "forum activity" page logged in as student1 Then I should see "You are not able to create a discussion because you are not a member of any group." And I should not see "Add a new discussion topic" Scenario: Students cannot post in forum with visible groups - Given I log in as "student1" - And I am on "Course 1" course homepage - When I follow "Visible forum" + When I am on the "Visible forum" "forum activity" page logged in as student1 Then I should see "You are not able to create a discussion because you are not a member of any group." And I should not see "Add a new discussion topic" diff --git a/mod/forum/tests/behat/portfolio_export.feature b/mod/forum/tests/behat/portfolio_export.feature index 0bf6df2fea4..06e78bc3247 100644 --- a/mod/forum/tests/behat/portfolio_export.feature +++ b/mod/forum/tests/behat/portfolio_export.feature @@ -16,28 +16,22 @@ Feature: Ensure only users with appropriate permissions can export forum discuss Scenario: A teacher can export discussions to a portfolio. Given the following "activities" exist: - | activity | name | intro | course | idnumber | groupmode | - | forum | Test forum 1 | Test forum 2 | C1 | forum | 0 | + | activity | name | course | idnumber | groupmode | + | forum | Test forum 1 | C1 | forum | 0 | And I log in as "admin" And the following config values are set as admin: | enableportfolios | 1 | And I navigate to "Plugins > Portfolios > Manage portfolios" in site administration And I set portfolio instance "File download" to "Enabled and visible" And I click on "Save" "button" - And I log out - When I log in as "student1" - And I am on "Course 1" course homepage - And I follow "Test forum 1" + When I am on the "Test forum 1" "forum activity" page logged in as student1 And I add a new discussion to "Test forum 1" forum with: | Subject | Discussion 1 | | Message | Test post message | And I reload the page And I follow "Discussion 1" Then "Export whole discussion to portfolio" "button" should not exist - And I log out - And I log in as "teacher1" - And I am on "Course 1" course homepage - And I follow "Test forum 1" + And I am on the "Test forum 1" "forum activity" page logged in as teacher1 And I follow "Discussion 1" And "Export whole discussion to portfolio" "button" should exist And I press "Export whole discussion to portfolio" diff --git a/mod/forum/tests/behat/post_to_multiple_groups.feature b/mod/forum/tests/behat/post_to_multiple_groups.feature index 2862144a015..f1599ea1723 100644 --- a/mod/forum/tests/behat/post_to_multiple_groups.feature +++ b/mod/forum/tests/behat/post_to_multiple_groups.feature @@ -56,79 +56,44 @@ Feature: A user with access to multiple groups should be able to post a copy of | G1 | C2G1 | | G1 | C2G2 | And the following "activities" exist: - | activity | name | intro | course | idnumber | groupmode | grouping | - | forum | No group forum | Test forum name | C1 | forum | 0 | | - | forum | Separate group forum | Test forum name | C1 | forum | 1 | | - | forum | Visible group forum | Test forum name | C1 | forum | 2 | | - | forum | Groupings forum | Test forum name | C2 | forum | 1 | G1 | + | activity | name | course | idnumber | groupmode | grouping | + | forum | No group forum | C1 | forum | 0 | | + | forum | Separate group forum | C1 | forum | 1 | | + | forum | Visible group forum | C1 | forum | 2 | | + | forum | Groupings forum | C2 | forum | 1 | G1 | + And the following forum discussions exist in course "Course 1": + | user | forum | name | message | posttomygroups | + | teacher1 | Separate group forum | Discussion 1 | test | 1 | + | teacher1 | Visible group forum | Discussion 1 | test | 1 | Scenario: Teacher is able to post a copy of a message to all groups in a separate group forum - Given I log in as "teacher1" - And I am on "Course 1" course homepage - And I add a new discussion to "Separate group forum" forum with: - | Subject | Discussion 1 | - | Message | test | - | Post a copy to all groups | 1 | - And I log out - And I log in as "student1" - And I am on "Course 1" course homepage - When I follow "Separate group forum" + When I am on the "Separate group forum" "forum activity" page logged in as student1 Then I should see "Discussion 1" - And I log out - And I log in as "student2" - And I am on "Course 1" course homepage - And I follow "Separate group forum" + And I am on the "Separate group forum" "forum activity" page logged in as student2 And I should see "Discussion 1" - And I log out - And I log in as "student3" - And I am on "Course 1" course homepage - And I follow "Separate group forum" + And I am on the "Separate group forum" "forum activity" page logged in as student3 And I should see "Discussion 1" Scenario: Teacher is able to post a copy of a message to all groups in a visible group forum - Given I log in as "teacher1" - And I am on "Course 1" course homepage - And I add a new discussion to "Visible group forum" forum with: - | Subject | Discussion 1 | - | Message | test | - | Post a copy to all groups | 1 | - And I log out - And I log in as "student1" - And I am on "Course 1" course homepage - When I follow "Visible group forum" + When I am on the "Visible group forum" "forum activity" page logged in as student1 Then I should see "Discussion 1" - And I log out - And I log in as "student2" - And I am on "Course 1" course homepage - And I follow "Visible group forum" + And I am on the "Visible group forum" "forum activity" page logged in as student2 And I should see "Discussion 1" - And I log out - And I log in as "student3" - And I am on "Course 1" course homepage - And I follow "Visible group forum" + And I am on the "Visible group forum" "forum activity" page logged in as student3 And I should see "Discussion 1" Scenario: Teacher is unable to post a copy of a message to all groups in a no group forum - Given I log in as "teacher1" - And I am on "Course 1" course homepage - And I follow "No group forum" + Given I am on the "No group forum" "forum activity" page logged in as teacher1 And I click on "Add a new discussion topic" "link" Then I should not see "Post a copy to all groups" Scenario: Posts to all groups that have groupings should only display within the grouping and not to other groups - Given I log in as "teacher1" - And I am on "Course 2" course homepage + Given I am on the "Course 2" course page logged in as teacher1 And I add a new discussion to "Groupings forum" forum with: | Subject | Discussion 1 | | Message | test | | Post a copy to all groups | 1 | - And I log out - And I log in as "student1" - And I am on "Course 2" course homepage - When I follow "Groupings forum" + When I am on the "Groupings forum" "forum activity" page logged in as student1 Then I should see "Discussion 1" - And I log out - And I log in as "student2" - And I am on "Course 2" course homepage - And I follow "Groupings forum" + And I am on the "Groupings forum" "forum activity" page logged in as student2 And I should not see "Discussion 1" diff --git a/mod/forum/tests/behat/posts_ordering_general.feature b/mod/forum/tests/behat/posts_ordering_general.feature index ba74c7e41a1..e181d50a5b3 100644 --- a/mod/forum/tests/behat/posts_ordering_general.feature +++ b/mod/forum/tests/behat/posts_ordering_general.feature @@ -20,6 +20,14 @@ Feature: New discussions and discussions with recently added replies are display | course | C1 | | activity | forum | | name | Course general forum | + # + # Add three posts into the blog. + # + And the following forum discussions exist in course "Course 1": + | user | forum | name | message | timemodified | + | student1 | Course general forum | Forum post 1 | This is the first post | ##now +1 second## | + | student1 | Course general forum | Forum post 2 | This is the second post | ##now +2 second## | + | student1 | Course general forum | Forum post 3 | This is the third post | ##now +3 second## | # # We need javascript/wait to prevent creation of the posts in the same second. The threads @@ -30,27 +38,14 @@ Feature: New discussions and discussions with recently added replies are display Scenario: Replying to a forum post or editing it puts the discussion to the front Given I am on the "Course general forum" "forum activity" page logged in as student1 # - # Add three posts into the forum. - # - When I add a new discussion to "Course general forum" forum with: - | Subject | Forum post 1 | - | Message | This is the first post | - And I add a new discussion to "Course general forum" forum with: - | Subject | Forum post 2 | - | Message | This is the second post | - And I add a new discussion to "Course general forum" forum with: - | Subject | Forum post 3 | - | Message | This is the third post | - # # Edit one of the forum posts. # - And I follow "Forum post 2" + When I follow "Forum post 2" And I click on "Edit" "link" in the "//div[contains(concat(' ', normalize-space(@class), ' '), ' forumpost ')][contains(., 'Forum post 2')]" "xpath_element" And I set the following fields to these values: | Subject | Edited forum post 2 | And I press "Save changes" And I wait to be redirected - And I log out # # Reply to another forum post. # diff --git a/mod/forum/tests/behat/private_replies.feature b/mod/forum/tests/behat/private_replies.feature index eb2d8eda5ab..3ebbe2b8c47 100644 --- a/mod/forum/tests/behat/private_replies.feature +++ b/mod/forum/tests/behat/private_replies.feature @@ -15,22 +15,18 @@ Feature: Forum posts can be replied to in private | fullname | shortname | category | | Science 101 | C1 | 0 | And the following "activities" exist: - | activity | name | intro | course | idnumber | - | forum | Study discussions | Test forum description | C1 | forum | + | activity | name | course | idnumber | + | forum | Study discussions | C1 | forum | And the following "course enrolments" exist: | user | course | role | | teacher1 | C1 | editingteacher | | teacher2 | C1 | editingteacher | | student1 | C1 | student | | student2 | C1 | student | - And I log in as "student1" - And I am on "Science 101" course homepage - And I add a new discussion to "Study discussions" forum with: - | Subject | Answers to the homework | - | Message | Here are the answers to last night's homework. | - And I log out - And I log in as "teacher1" - And I am on "Science 101" course homepage + And the following forum discussions exist in course "Science 101": + | user | forum | name | message | + | student1 | Study discussions | Answers to the homework | Here are the answers to last night's homework. | + And I am on the "Science 101" course page logged in as teacher1 And I reply "Answers to the homework" post from "Study discussions" forum with: | Message | How about you and I have a meeting after class about plagiarism? | | Reply privately | 1 | @@ -40,25 +36,16 @@ Feature: Forum posts can be replied to in private Then I should see "How about you and I have a meeting after class about plagiarism?" Scenario: As a fellow teacher I can see the other teacher's response - Given I log out - And I log in as "teacher2" - And I am on "Science 101" course homepage - And I follow "Study discussions" + Given I am on the "Study discussions" "forum activity" page logged in as teacher2 When I follow "Answers to the homework" Then I should see "How about you and I have a meeting after class about plagiarism?" Scenario: As the intended recipient I can see my own response - Given I log out - And I log in as "student1" - And I am on "Science 101" course homepage - And I follow "Study discussions" + Given I am on the "Study discussions" "forum activity" page logged in as student1 When I follow "Answers to the homework" Then I should see "How about you and I have a meeting after class about plagiarism?" Scenario: As a non-privileged user I cannot see my own response - Given I log out - And I log in as "student2" - And I am on "Science 101" course homepage - And I follow "Study discussions" + Given I am on the "Study discussions" "forum activity" page logged in as student2 When I follow "Answers to the homework" Then I should not see "How about you and I have a meeting after class about plagiarism?" diff --git a/mod/forum/tests/behat/recent_activity.feature b/mod/forum/tests/behat/recent_activity.feature index 382e2f02c15..25fc99c2ebb 100644 --- a/mod/forum/tests/behat/recent_activity.feature +++ b/mod/forum/tests/behat/recent_activity.feature @@ -29,12 +29,12 @@ Feature: Users can see the relevant recent forum posts from the recent activity | teacher1 | G1 | | teacher1 | G2 | And the following "activities" exist: - | activity | name | intro | course | idnumber | type | groupmode | visible | - | forum | Separate groups forum | Separate groups description | C1 | forum1 | general | 1 | 1 | - | forum | Visible groups forum | Visible groups description | C1 | forum2 | general | 2 | 1 | - | forum | Standard forum | Standard description | C1 | forum3 | general | 0 | 1 | - | forum | Hidden forum | Hidden description | C1 | forum4 | general | 0 | 0 | - | forum | Q&A forum | Q&A description | C1 | forum5 | qanda | 0 | 1 | + | activity | name | course | idnumber | type | groupmode | visible | + | forum | Separate groups forum | C1 | forum1 | general | 1 | 1 | + | forum | Visible groups forum | C1 | forum2 | general | 2 | 1 | + | 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 I log in as "teacher1" And I am on "Course 1" course homepage with editing mode on And I add the "Recent activity" block @@ -44,13 +44,9 @@ Feature: Users can see the relevant recent forum posts from the recent activity | Subject | Group 1 separate discussion | | Message | Group 1 members only | | Group | Group 1 | - 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 Then I should see "Group 1 separate discussion" in the "Recent activity" "block" - 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 should not see "Group 1 separate discussion" in the "Recent activity" "block" Scenario: Recent forum activity with visible groups discussion @@ -58,13 +54,9 @@ Feature: Users can see the relevant recent forum posts from the recent activity | Subject | Group 1 visible discussion | | Message | Not just for group 1 members | | Group | Group 1 | - 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 Then I should see "Group 1 visible discussion" in the "Recent activity" "block" - 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 should see "Group 1 visible discussion" in the "Recent activity" "block" Scenario: Recent forum activity with recent post as a private reply @@ -78,9 +70,7 @@ 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 "Standard forum discussion" in the "Recent activity" "block" And I should see "Teacher's private reply" in the "Recent activity" "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 Then I should see "Standard forum discussion" in the "Recent activity" "block" But I should not see "Teacher's private reply" in the "Recent activity" "block" @@ -90,18 +80,14 @@ Feature: Users can see the relevant recent forum posts from the recent activity | Message | Should be hidden! | And I am on "Course 1" course homepage And I should see "Hidden discussion" in the "Recent activity" "block" - 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 Then I should not see "Hidden discussion" in the "Recent activity" "block" Scenario: Recent forum activity with question and answer forum Given I add a new question to "Q&A forum" forum with: | Subject | The egg vs the chicken | | Message | Which came first? The egg or the chicken? | - 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 reply "The egg vs the chicken" post from "Q&A forum" forum with: | Subject | Student 1's answer | | Message | The egg! | @@ -112,9 +98,7 @@ Feature: Users can see the relevant recent forum posts from the recent activity And I log in as "admin" And the following config values are set as admin: | maxeditingtime | 1 | - And I log out - When I log in as "student2" - And I am on "Course 1" course homepage + When I am on the "Course 1" course page logged in as student2 Then I should see "The egg vs the chicken" in the "Recent activity" "block" But I should not see "Student 1's answer" in the "Recent activity" "block" And I reply "The egg vs the chicken" post from "Q&A forum" forum with: @@ -135,7 +119,5 @@ Feature: Users can see the relevant recent forum posts from the recent activity | timeend[day] | 1 | And I am on "Course 1" course homepage And I should see "Timed discussion" in the "Recent activity" "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 Then I should not see "Timed discussion" in the "Recent activity" "block" diff --git a/mod/forum/tests/behat/separate_group_discussions.feature b/mod/forum/tests/behat/separate_group_discussions.feature index 0941747751b..c30b6c1120c 100644 --- a/mod/forum/tests/behat/separate_group_discussions.feature +++ b/mod/forum/tests/behat/separate_group_discussions.feature @@ -40,8 +40,8 @@ Feature: Posting to all groups in a separate group discussion is restricted to u | student2 | G1 | | student2 | G2 | And the following "activities" exist: - | activity | name | intro | course | idnumber | groupmode | - | forum | Standard forum name | Standard forum description | C1 | sepgroups | 1 | + | activity | name | course | idnumber | groupmode | + | forum | Standard forum name | C1 | sepgroups | 1 | And the following "mod_forum > discussions" exist: | forum | name | subject | message | group | | sepgroups | Initial Disc ALL | Initial Disc ALL | Disc ALL content | All participants | @@ -50,9 +50,7 @@ Feature: Posting to all groups in a separate group discussion is restricted to u | sepgroups | Initial Disc G3 | Initial Disc G3 | Disc G3 content | G3 | Scenario: Teacher with accessallgroups can view all groups - Given I log in as "teacher1" - And I am on "Course 1" course homepage - When I follow "Standard forum name" + When I am on the "Standard forum name" "forum activity" page logged in as teacher1 Then the "Separate groups" select box should contain "All participants" And the "Separate groups" select box should contain "Group A" And the "Separate groups" select box should contain "Group B" @@ -74,9 +72,7 @@ Feature: Posting to all groups in a separate group discussion is restricted to u And I should not see "Initial Disc G3" Scenario: Teacher with accessallgroups can select any group when posting - Given I log in as "teacher1" - And I am on "Course 1" course homepage - And I follow "Standard forum name" + Given I am on the "Standard forum name" "forum activity" page logged in as teacher1 When I click on "Add a new discussion topic" "link" And I click on "Advanced" "button" Then the "Group" select box should contain "All participants" @@ -86,9 +82,7 @@ Feature: Posting to all groups in a separate group discussion is restricted to u And I should see "Post a copy to all groups" Scenario: Teacher with accessallgroups can post in groups they are a member of - Given I log in as "teacher1" - And I am on "Course 1" course homepage - And I follow "Standard forum name" + Given I am on the "Standard forum name" "forum activity" page logged in as teacher1 And I select "Group A" from the "Separate groups" singleselect When I click on "Add a new discussion topic" "link" And I click on "Advanced" "button" @@ -117,9 +111,7 @@ Feature: Posting to all groups in a separate group discussion is restricted to u And I should not see "Teacher 1 -> Group B" Scenario: Teacher with accessallgroups can post in groups they are not a member of - Given I log in as "teacher1" - And I am on "Course 1" course homepage - And I follow "Standard forum name" + Given I am on the "Standard forum name" "forum activity" page logged in as teacher1 And I select "Group A" from the "Separate groups" singleselect When I click on "Add a new discussion topic" "link" And I click on "Advanced" "button" @@ -148,9 +140,7 @@ Feature: Posting to all groups in a separate group discussion is restricted to u And I should not see "Teacher 1 -> Group C" Scenario: Teacher with accessallgroups can post to all groups - Given I log in as "teacher1" - And I am on "Course 1" course homepage - And I follow "Standard forum name" + Given I am on the "Standard forum name" "forum activity" page logged in as teacher1 When I click on "Add a new discussion topic" "link" And I click on "Advanced" "button" And I set the following fields to these values: @@ -176,9 +166,7 @@ Feature: Posting to all groups in a separate group discussion is restricted to u # No point testing the "All participants". Scenario: Students in one group can only post in their group - Given I log in as "student1" - And I am on "Course 1" course homepage - When I follow "Standard forum name" + When I am on the "Standard forum name" "forum activity" page logged in as student1 Then I should see "Group A" And I click on "Add a new discussion topic" "link" And I should see "Group A" @@ -194,9 +182,7 @@ Feature: Posting to all groups in a separate group discussion is restricted to u And I should not see "Group B" in the "Student -> B" "table_row" Scenario: Students in multiple group can post in all of their group individually - Given I log in as "student2" - And I am on "Course 1" course homepage - When I follow "Standard forum name" + When I am on the "Standard forum name" "forum activity" page logged in as student2 And I select "Group A" from the "Separate groups" singleselect And I click on "Add a new discussion topic" "link" And I click on "Advanced" "button" @@ -243,10 +229,7 @@ Feature: Posting to all groups in a separate group discussion is restricted to u And I log in as "admin" And I set the following system permissions of "Non-editing teacher" role: | moodle/site:accessallgroups | Prohibit | - And I log out - Given I log in as "noneditor1" - And I am on "Course 1" course homepage - And I follow "Standard forum name" + Given I am on the "Standard forum name" "forum activity" page logged in as noneditor1 When I click on "Add a new discussion topic" "link" And I click on "Advanced" "button" Then the "Group" select box should not contain "All participants" @@ -258,10 +241,7 @@ Feature: Posting to all groups in a separate group discussion is restricted to u And I log in as "admin" And I set the following system permissions of "Non-editing teacher" role: | moodle/site:accessallgroups | Prohibit | - And I log out - Given I log in as "noneditor1" - And I am on "Course 1" course homepage - And I follow "Standard forum name" + Given I am on the "Standard forum name" "forum activity" page logged in as noneditor1 When I click on "Add a new discussion topic" "link" And I click on "Advanced" "button" Then the "Group" select box should not contain "All participants" @@ -270,7 +250,5 @@ Feature: Posting to all groups in a separate group discussion is restricted to u And I should see "Post a copy to all groups" Scenario: Students can view all participants discussions in separate groups mode - Given I log in as "student1" - And I am on "Course 1" course homepage - When I follow "Standard forum name" + When I am on the "Standard forum name" "forum activity" page logged in as student1 Then I should see "Initial Disc ALL" diff --git a/mod/forum/tests/behat/separate_group_single_group_discussions.feature b/mod/forum/tests/behat/separate_group_single_group_discussions.feature index c7d53359859..83cd3bc8d8d 100644 --- a/mod/forum/tests/behat/separate_group_single_group_discussions.feature +++ b/mod/forum/tests/behat/separate_group_single_group_discussions.feature @@ -38,26 +38,13 @@ Feature: Posting to groups in a separate group discussion when restricted to gro | G1 | G1G1 | | G1 | G1G2 | | G2 | G2G1 | - And I log in as "admin" - And I am on "Course 1" course homepage with editing mode on - And I add a "Forum" to section "1" and I fill the form with: - | Forum name | Multiple groups forum | - | Forum type | Standard forum for general use | - | Description | Standard forum description | - | Group mode | Separate groups | - | Grouping | G1 | - And I add a "Forum" to section "1" and I fill the form with: - | Forum name | Single groups forum | - | Forum type | Standard forum for general use | - | Description | Standard forum description | - | Group mode | Separate groups | - | Grouping | G2 | - And I log out + And the following "activities" exist: + | activity | course | idnumber | name | type | groupmode | grouping | + | forum | C1 | 00001 | Multiple groups forum | general | 1 | G1 | + | forum | C1 | 00001 | Single groups forum | general | 1 | G2 | Scenario: Teacher with accessallgroups can post in all groups - Given I log in as "teacher1" - And I am on "Course 1" course homepage - And I follow "Multiple groups forum" + Given I am on the "Multiple groups forum" "forum activity" page logged in as teacher1 When I click on "Add a new discussion topic" "link" And I click on "Advanced" "button" Then the "Group" select box should contain "All participants" @@ -72,9 +59,7 @@ Feature: Posting to groups in a separate group discussion when restricted to gro And I should not see "Post a copy to all groups" Scenario: Teacher in all groups but without accessallgroups can post in either group but not to All Participants - Given I log in as "teacher2" - And I am on "Course 1" course homepage - And I follow "Multiple groups forum" + Given I am on the "Multiple groups forum" "forum activity" page logged in as teacher2 When I click on "Add a new discussion topic" "link" And I click on "Advanced" "button" Then the "Group" select box should not contain "All participants" diff --git a/mod/forum/tests/behat/single_forum_discussion.feature b/mod/forum/tests/behat/single_forum_discussion.feature index 7caa2d374bc..6c05ff02a02 100644 --- a/mod/forum/tests/behat/single_forum_discussion.feature +++ b/mod/forum/tests/behat/single_forum_discussion.feature @@ -21,15 +21,12 @@ Feature: Single simple forum discussion type | forum | Single discussion forum name | Single discussion forum description | single | C1 | forum | Scenario: Teacher can start the single simple discussion - Given I log in as "teacher1" - And I am on "Course 1" course homepage - When I follow "Single discussion forum name" + When I am on the "Single discussion forum name" "forum activity" page logged in as teacher1 Then I should see "Single discussion forum description" in the "div.firstpost.starter" "css_element" And I should not see "Add a new discussion topic" Scenario: Student can not add more discussions - And 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 reply "Single discussion forum name" post from "Single discussion forum name" forum with: | Subject | Reply to single discussion subject | | Message | Reply to single discussion message | diff --git a/mod/forum/tests/behat/split_forum_discussion.feature b/mod/forum/tests/behat/split_forum_discussion.feature index 869e2d816be..62509650d32 100644 --- a/mod/forum/tests/behat/split_forum_discussion.feature +++ b/mod/forum/tests/behat/split_forum_discussion.feature @@ -48,4 +48,4 @@ Feature: Forum discussions can be split # Confirm that the last post author has been updated. And I should not see "Student 2" in the "Photosynthesis" "table_row" # Confirm that the current author has been shown for the new split discussion. - And I should see "Student 1" in the "Mass number in periodic table" "table_row" \ No newline at end of file + And I should see "Student 1" in the "Mass number in periodic table" "table_row" diff --git a/mod/forum/tests/behat/timed_discussions.feature b/mod/forum/tests/behat/timed_discussions.feature index 406fa615eac..15cb6bd991d 100644 --- a/mod/forum/tests/behat/timed_discussions.feature +++ b/mod/forum/tests/behat/timed_discussions.feature @@ -14,13 +14,13 @@ Feature: Users can choose to set start and end time for display of their discuss And the following "course enrolments" exist: | user | course | role | | student1 | C1 | student | + And the following "activities" exist: + | activity | name | course | idnumber | type | + | forum | Test forum name | C1 | forump1 | general | And I log in as "admin" And the following config values are set as admin: | forum_enabletimedposts | 1 | - And I am on "Course 1" course homepage with editing mode on - And I add a "Forum" to section "1" and I fill the form with: - | Forum name | Test forum name | - | Description | Test forum description | + And I am on "Course 1" course homepage And I add a new discussion to "Test forum name" forum with: | Subject | Discussion 1 | | Message | Discussion contents 1, first message | @@ -33,15 +33,11 @@ Feature: Users can choose to set start and end time for display of their discuss | Subject | Discussion 3 timed visible now | | Message | Discussion contents 3, first message | | timestart[enabled] | 1 | - And I am on "Course 1" course homepage - And I follow "Test forum name" + And I am on the "Test forum name" "forum activity" page And I should see "Discussion 2 timed" And I should see "Discussion 3 timed" And "[data-region=timed-label]" "css_element" should exist - And I log out - And I log in as "student1" - When I am on "Course 1" course homepage - And I follow "Test forum name" + When I am on the "Test forum name" "forum activity" page logged in as student1 Then I should see "Discussion 1" And I should not see "Discussion 2 timed" And "[data-region=timed-label]" "css_element" should not exist diff --git a/mod/forum/tests/behat/track_read_posts.feature b/mod/forum/tests/behat/track_read_posts.feature index 82d45fee68c..b1b354a1149 100644 --- a/mod/forum/tests/behat/track_read_posts.feature +++ b/mod/forum/tests/behat/track_read_posts.feature @@ -184,4 +184,4 @@ Feature: A teacher can set one of 3 possible options for tracking read forum pos When I am on the "Course 1" course page logged in as student2 Then I should not see "1 unread post" And I follow "Test forum name" - And I should not see "Track unread posts" \ No newline at end of file + And I should not see "Track unread posts" diff --git a/mod/forum/tests/behat/visible_group_discussions.feature b/mod/forum/tests/behat/visible_group_discussions.feature index a7485af3d63..3fdd983220a 100644 --- a/mod/forum/tests/behat/visible_group_discussions.feature +++ b/mod/forum/tests/behat/visible_group_discussions.feature @@ -31,8 +31,8 @@ Feature: Posting to all groups in a visible group discussion is restricted to us | student2 | G1 | | student2 | G2 | And the following "activities" exist: - | activity | name | intro | course | idnumber | groupmode | - | forum | Standard forum name | Standard forum description | C1 | groups | 2 | + | activity | name | course | idnumber | groupmode | + | forum | Standard forum name | C1 | groups | 2 | And the following "mod_forum > discussions" exist: | forum | name | subject | message | group | | groups | Initial Disc ALL | Initial Disc ALL | Disc ALL content | All participants | @@ -41,9 +41,7 @@ Feature: Posting to all groups in a visible group discussion is restricted to us | groups | Initial Disc G3 | Initial Disc G3 | Disc G3 content | G3 | Scenario: Teacher with accessallgroups can view all groups - Given I log in as "teacher1" - And I am on "Course 1" course homepage - When I follow "Standard forum name" + When I am on the "Standard forum name" "forum activity" page logged in as teacher1 Then the "Visible groups" select box should contain "All participants" And the "Visible groups" select box should contain "Group A" And the "Visible groups" select box should contain "Group B" @@ -65,9 +63,7 @@ Feature: Posting to all groups in a visible group discussion is restricted to us And I should not see "Initial Disc G3" Scenario: Teacher with accessallgroups can select any group when posting - Given I log in as "teacher1" - And I am on "Course 1" course homepage - And I follow "Standard forum name" + Given I am on the "Standard forum name" "forum activity" page logged in as teacher1 When I click on "Add a new discussion topic" "link" And I click on "Advanced" "button" Then the "Group" select box should contain "All participants" @@ -77,9 +73,7 @@ Feature: Posting to all groups in a visible group discussion is restricted to us And I should see "Post a copy to all groups" Scenario: Teacher with accessallgroups can post in groups they are a member of - Given I log in as "teacher1" - And I am on "Course 1" course homepage - And I follow "Standard forum name" + Given I am on the "Standard forum name" "forum activity" page logged in as teacher1 And I select "Group A" from the "Visible groups" singleselect When I click on "Add a new discussion topic" "link" And I click on "Advanced" "button" @@ -108,9 +102,7 @@ Feature: Posting to all groups in a visible group discussion is restricted to us And I should not see "Teacher 1 -> Group B" Scenario: Teacher with accessallgroups can post in groups they are not a member of - Given I log in as "teacher1" - And I am on "Course 1" course homepage - And I follow "Standard forum name" + Given I am on the "Standard forum name" "forum activity" page logged in as teacher1 And I select "Group A" from the "Visible groups" singleselect When I click on "Add a new discussion topic" "link" And I click on "Advanced" "button" @@ -139,9 +131,7 @@ Feature: Posting to all groups in a visible group discussion is restricted to us And I should not see "Teacher 1 -> Group C" Scenario: Teacher with accessallgroups can post to all groups - Given I log in as "teacher1" - And I am on "Course 1" course homepage - And I follow "Standard forum name" + Given I am on the "Standard forum name" "forum activity" page logged in as teacher1 When I click on "Add a new discussion topic" "link" And I click on "Advanced" "button" And I set the following fields to these values: @@ -167,9 +157,7 @@ Feature: Posting to all groups in a visible group discussion is restricted to us # No point testing the "All participants". Scenario: Students can view all groups - Given I log in as "student1" - And I am on "Course 1" course homepage - When I follow "Standard forum name" + When I am on the "Standard forum name" "forum activity" page logged in as student1 Then the "Visible groups" select box should contain "All participants" And the "Visible groups" select box should contain "Group A" And the "Visible groups" select box should contain "Group B" @@ -191,9 +179,7 @@ Feature: Posting to all groups in a visible group discussion is restricted to us And I should not see "Initial Disc G3" Scenario: Students in one group can only post in their group - Given I log in as "student1" - And I am on "Course 1" course homepage - When I follow "Standard forum name" + When I am on the "Standard forum name" "forum activity" page logged in as student1 Then I should see "Group A" And I click on "Add a new discussion topic" "link" And I click on "Advanced" "button" @@ -210,9 +196,7 @@ Feature: Posting to all groups in a visible group discussion is restricted to us And I should not see "Group B" in the "Student -> B" "table_row" Scenario: Students in multiple group can post in all of their group individually - Given I log in as "student2" - And I am on "Course 1" course homepage - When I follow "Standard forum name" + When I am on the "Standard forum name" "forum activity" page logged in as student2 And I select "Group A" from the "Visible groups" singleselect And I click on "Add a new discussion topic" "link" And I click on "Advanced" "button" diff --git a/report/outline/tests/behat/filter.feature b/report/outline/tests/behat/filter.feature index 353061e88a0..d0dd0dd4e7d 100644 --- a/report/outline/tests/behat/filter.feature +++ b/report/outline/tests/behat/filter.feature @@ -19,21 +19,16 @@ Feature: Filter an outline report | student1 | C1 | student | | student2 | C1 | student | And the following "activities" exist: - | activity | course | name | idnumber | - | book | C1 | Book name | BOOK01 | - When I log in as "admin" - And I am on "Course 1" course homepage with editing mode on - And I add a "Forum" to section "1" and I fill the form with: - | Forum name | Forum name | - | Description | Forum description | - | ID number| FORUM01 | + | activity | name | course | idnumber | section | + | forum | Forum name | C1 | FORUM01 | 1 | + | book | Book name | C1 | BOOK01 | 1 | + When I am on the "Course 1" course page logged in as admin Scenario: Filter the outline report by start date Given I navigate to "Plugins > Logging > Manage log stores" in site administration And "Enable" "link" should exist in the "Legacy log" "table_row" And "Disable" "link" should exist in the "Standard log" "table_row" - And I am on the "Course 1" course page logged in as student1 - And I follow "Forum name" + And I am on the "Forum name" "forum activity" page logged in as student1 And the log timestamp for "student1" and "FORUM01" is set to "12 June 2017 12:49:00" And I am on "Course 1" course homepage And I follow "Book name" @@ -58,8 +53,7 @@ Feature: Filter an outline report Given I navigate to "Plugins > Logging > Manage log stores" in site administration And "Enable" "link" should exist in the "Legacy log" "table_row" And "Disable" "link" should exist in the "Standard log" "table_row" - And I am on the "Course 1" course page logged in as student1 - And I follow "Forum name" + And I am on the "Forum name" "forum activity" page logged in as student1 And the log timestamp for "student1" and "FORUM01" is set to "12 June 2017 12:49:00" And I am on "Course 1" course homepage And I follow "Book name" diff --git a/report/outline/tests/behat/outline.feature b/report/outline/tests/behat/outline.feature index 7ddfb739d35..a42e5171811 100644 --- a/report/outline/tests/behat/outline.feature +++ b/report/outline/tests/behat/outline.feature @@ -19,13 +19,10 @@ Feature: View an outline report | student1 | C1 | student | | student2 | C1 | student | And the following "activities" exist: - | activity | course | name | - | book | C1 | Book name | - When I log in as "admin" - And I am on "Course 1" course homepage with editing mode on - And I add a "Forum" to section "1" and I fill the form with: - | Forum name | Forum name | - | Description | Forum description | + | activity | name | course | idnumber | + | forum | Forum name | C1 | forum1 | + | book | Book name | C1 | book1 | + And I am on the "Course 1" course page logged in as admin Scenario: View the outline report when only the legacy log reader is enabled Given I navigate to "Plugins > Logging > Manage log stores" in site administration @@ -33,8 +30,7 @@ Feature: View an outline report And I click on "Disable" "link" in the "Standard log" "table_row" And the following config values are set as admin: | loglegacy | 1 | logstore_legacy | - And I am on the "Course 1" course page logged in as student1 - And I follow "Forum name" + And I am on the "Forum name" "forum activity" page logged in as student1 And I am on "Course 1" course homepage And I follow "Book name" And I am on the "Course 1" course page logged in as student2 @@ -48,8 +44,7 @@ Feature: View an outline report Given I navigate to "Plugins > Logging > Manage log stores" in site administration And "Enable" "link" should exist in the "Legacy log" "table_row" And "Disable" "link" should exist in the "Standard log" "table_row" - And I am on the "Course 1" course page logged in as student1 - And I follow "Forum name" + And I am on the "Forum name" "forum activity" page logged in as student1 And I am on "Course 1" course homepage And I follow "Book name" And I am on the "Course 1" course page logged in as student2 @@ -65,8 +60,7 @@ Feature: View an outline report And "Disable" "link" should exist in the "Standard log" "table_row" And the following config values are set as admin: | loglegacy | 1 | logstore_legacy | - And I am on the "Course 1" course page logged in as student1 - And I follow "Forum name" + And I am on the "Forum name" "forum activity" page logged in as student1 And I am on "Course 1" course homepage And I follow "Book name" And I am on the "Course 1" course page logged in as student2 diff --git a/report/outline/tests/behat/user.feature b/report/outline/tests/behat/user.feature index e9b1edff93b..2ada25d0cb3 100644 --- a/report/outline/tests/behat/user.feature +++ b/report/outline/tests/behat/user.feature @@ -116,8 +116,8 @@ Feature: View the user page for the outline report Scenario: View the user complete report page when there is a no-grade forum Given the following "activities" exist: - | activity | name | description | course | idnumber | - | forum | forum1 | C1 first forum | C1 | forum1 | + | activity | name | course | idnumber | + | forum | forum1 | C1 | forum1 | And I am on "Course 1" course homepage When I follow "Participants" And I follow "Student 1" diff --git a/repository/contentbank/tests/behat/select_content.feature b/repository/contentbank/tests/behat/select_content.feature index 52b8f22bcc2..7aac302c42d 100644 --- a/repository/contentbank/tests/behat/select_content.feature +++ b/repository/contentbank/tests/behat/select_content.feature @@ -30,7 +30,7 @@ Feature: Select content bank files using the content bank files repository | System | | contenttype_h5p | admin | filltheblanks.h5p | /h5p/tests/fixtures/filltheblanks.h5p | And the following "activities" exist: | activity | name | intro | introformat | course | idnumber | - | forum | Forum | ForumDesc | 1 | mscC1 | forum1 | + | forum | Forum | | 1 | mscC1 | forum1 | | folder | Folder | FolderDesc | 1 | mscC1 | folder1 | And the following "course enrolments" exist: | user | course | role | diff --git a/search/tests/behat/search_query.feature b/search/tests/behat/search_query.feature index 6328758f656..0d4c6939fa8 100644 --- a/search/tests/behat/search_query.feature +++ b/search/tests/behat/search_query.feature @@ -86,8 +86,8 @@ Feature: Use global search interface | A Group | F1 | G1 | | B Group | F1 | G2 | And the following "activities" exist: - | activity | name | intro | course | idnumber | groupmode | - | forum | ForumSG | ForumDesc1 | F1 | FORUM2 | 1 | + | activity | name | course | idnumber | groupmode | + | forum | ForumSG | F1 | FORUM2 | 1 | When I am on the ForumSG "Forum activity" page And global search expects the query "frogs" and will return: | type | idnumber |