From 640db57c0eec6f4e842dc4878288e5b29c97438b Mon Sep 17 00:00:00 2001 From: Angelia Dela Cruz Date: Mon, 17 Jan 2022 17:47:48 +0800 Subject: [PATCH] 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. --- .../usertours/tests/behat/tour_filter.feature | 11 ++- .../tests/behat/edit_availability.feature | 13 ++-- .../behat/restore_moodle2_courses.feature | 49 +++++++++---- .../tests/behat/edit_activities.feature | 12 ++-- .../behat/enable_manual_complete_mark.feature | 14 ++-- .../behat/course_collapse_sections.feature | 11 +-- course/tests/behat/course_controls.feature | 10 ++- course/tests/behat/move_activities.feature | 18 ++--- course/tests/behat/section_visibility.feature | 29 +------- .../tests/behat/modgrade_validation.feature | 72 ++++++++----------- mod/forum/tests/behat/add_forum.feature | 26 +++---- .../tests/behat/add_forum_inline.feature | 24 ++++--- .../tests/behat/edit_post_teacher.feature | 9 +-- .../tests/behat/forum_subscriptions.feature | 66 ++++------------- .../forum_subscriptions_availability.feature | 42 +++-------- mod/forum/tests/behat/grade_forum.feature | 30 ++++---- mod/forum/tests/behat/inpage_reply.feature | 23 +++--- .../behat/separate_group_grade_forum.feature | 8 ++- .../behat/split_forum_discussion.feature | 9 +-- 19 files changed, 196 insertions(+), 280 deletions(-) diff --git a/admin/tool/usertours/tests/behat/tour_filter.feature b/admin/tool/usertours/tests/behat/tour_filter.feature index fb59a64f050..0e4d0e1a04a 100644 --- a/admin/tool/usertours/tests/behat/tour_filter.feature +++ b/admin/tool/usertours/tests/behat/tour_filter.feature @@ -153,14 +153,11 @@ Feature: Apply tour filters to a tour | Course 1 | C1 | topics | 1 | | Course 2 | C2 | topics | 1 | And the following "activities" exist: - | activity | course | name | firstpagetitle | wikimode | - | wiki | C1 | Test wiki name | First page | collaborative | + | activity | course | name | firstpagetitle | wikimode | idnumber | intro | type | + | wiki | C1 | Test wiki name | First page | collaborative | | | | + | forum | C2 | Test forum name | | | 001 | Test forum description | general | And I log in as "admin" - And I am on "Course 2" 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 am on "Course 1" course homepage with editing mode on And I add a new user tour with: | Name | Wiki tour | | Description | A tour with both matches | diff --git a/availability/tests/behat/edit_availability.feature b/availability/tests/behat/edit_availability.feature index d88bd12c33a..c31fa3f4f1e 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: @@ -180,7 +186,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 @@ -192,10 +198,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 f14bf80cfe8..9d802110fc9 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 am on the "Course 1" "restore" page And I merge "test_backup.mbz" backup into the current course after deleting it's contents using this options: | Schema | Section 3 | 0 | @@ -109,7 +112,11 @@ Feature: Restore Moodle 2 course backups @javascript Scenario: Restore a backup in an existing course retaining the backup course settings - Given I hide section "3" + Given I add a "URL" to section "3" and I fill the form with: + | Name | Test URL name | + | Description | Test URL description | + | id_externalurl | http://www.moodle.org | + And I hide section "3" And I hide section "7" When I backup "Course 1" course using this options: | Confirmation | Filename | test_backup.mbz | @@ -131,7 +138,11 @@ Feature: Restore Moodle 2 course backups @javascript Scenario: Restore a backup in an existing course keeping the target course settings - Given I hide section "3" + Given I add a "URL" to section "3" and I fill the form with: + | Name | Test URL name | + | Description | Test URL description | + | id_externalurl | http://www.moodle.org | + And I hide section "3" And I hide section "7" When I backup "Course 1" course using this options: | Confirmation | Filename | test_backup.mbz | @@ -153,7 +164,11 @@ Feature: Restore Moodle 2 course backups @javascript Scenario: Restore a backup in an existing course deleting contents and retaining the backup course settings - Given I hide section "3" + Given I add a "URL" to section "3" and I fill the form with: + | Name | Test URL name | + | Description | Test URL description | + | id_externalurl | http://www.moodle.org | + And I hide section "3" And I hide section "7" When I backup "Course 1" course using this options: | Initial | Include enrolled users | 0 | @@ -177,7 +192,11 @@ Feature: Restore Moodle 2 course backups @javascript Scenario: Restore a backup in an existing course deleting contents and keeping the current course settings - Given I hide section "3" + Given I add a "URL" to section "3" and I fill the form with: + | Name | Test URL name | + | Description | Test URL description | + | id_externalurl | http://www.moodle.org | + And I hide section "3" And I hide section "7" When I backup "Course 1" course using this options: | Initial | Include enrolled users | 0 | @@ -201,7 +220,11 @@ Feature: Restore Moodle 2 course backups @javascript Scenario: Restore a backup in an existing course deleting contents decreasing the number of sections - Given I hide section "3" + Given I add a "URL" to section "3" and I fill the form with: + | Name | Test URL name | + | Description | Test URL description | + | id_externalurl | http://www.moodle.org | + And I hide section "3" And I hide section "7" When I backup "Course 1" course using this options: | Initial | Include enrolled users | 0 | diff --git a/blocks/site_main_menu/tests/behat/edit_activities.feature b/blocks/site_main_menu/tests/behat/edit_activities.feature index e19c4ea51d5..45d50143408 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 turn editing mode on - 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 b86b01e5bed..cae44ac5e1a 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 "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_collapse_sections.feature b/course/tests/behat/course_collapse_sections.feature index ecda98465d2..6a3df99cbbc 100644 --- a/course/tests/behat/course_collapse_sections.feature +++ b/course/tests/behat/course_collapse_sections.feature @@ -44,12 +44,15 @@ Feature: Collapse course sections @javascript Scenario: No chevron on site home - Given I log in as "admin" + Given the following activity" exists: + | activity | forum | + | course | Acceptance test site | + | section | 1 | + | name | Test forum post backup name | + | intro | Test forum post backup description | + And I log in as "admin" And 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 post backup name | - | Description | Test forum post backup description | And I click on "Edit summary" "link" in the "region-main" "region" And I click on "Custom" "checkbox" And I set the field "New value for Section name" to "New section name" diff --git a/course/tests/behat/course_controls.feature b/course/tests/behat/course_controls.feature index f858d1c9aed..29546707277 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 with editing mode on When I click on "link" in the "region-main" "region" @@ -34,12 +38,6 @@ Feature: Course activity controls works as expected And I click on "Delete Recent activity block" "link" And I click on "Delete" "button" in the "Delete block?" "dialogue" 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 open "Test forum name 1" actions menu And I click on "Edit settings" "link" in the "Test forum name 1" activity diff --git a/course/tests/behat/move_activities.feature b/course/tests/behat/move_activities.feature index 7e85daa5155..43baa75558f 100644 --- a/course/tests/behat/move_activities.feature +++ b/course/tests/behat/move_activities.feature @@ -14,13 +14,10 @@ Feature: Activities can be moved between sections And the following "course enrolments" exist: | user | course | role | | teacher1 | C1 | editingteacher | - And the following "activity" exists: - | activity | forum | - | course | C1 | - | idnumber | 00001 | - | name | Test forum name | - | intro | Test forum description | - | section | 1 | + And the following "activities" exist: + | activity | name | intro | course | idnumber | section | + | forum | Test forum name | Test forum description | C1 | 00001 | 1 | + | forum | Second forum name | Second forum description | C1 | 00002 | 1 | And I log in as "teacher1" And I am on "Course 1" course homepage with editing mode on @@ -40,13 +37,6 @@ Feature: Activities can be moved between sections Scenario: Move activities in a course section with Javascript disabled using paged mode Given I navigate to "Settings" in current page administration - And the following "activity" exists: - | activity | forum | - | course | C1 | - | idnumber | 00002 | - | name | Second forum name | - | intro | Second forum description | - | section | 1 | And I set the following fields to these values: | Course layout | Show one section per page | And I press "Save and display" diff --git a/course/tests/behat/section_visibility.feature b/course/tests/behat/section_visibility.feature index 861417e8d81..e9b9c7ab8a1 100644 --- a/course/tests/behat/section_visibility.feature +++ b/course/tests/behat/section_visibility.feature @@ -17,31 +17,6 @@ Feature: Show/hide course sections | 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 hidden forum 11 name | - | Description | Test hidden forum 11 description | - | Availability | Hide on course page | - 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 on course page | - 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 on course page | - 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 | @javascript Scenario: Show / hide section icon functions correctly @@ -75,7 +50,7 @@ Feature: Show/hide course sections @javascript Scenario: Students can not navigate to hidden sections - Given I am on "Course 1" course homepage + Given I am on "Course 1" course homepage with editing mode on And I hide section "2" Given I navigate to "Settings" in current page administration And I set the following fields to these values: @@ -98,7 +73,7 @@ Feature: Show/hide course sections @javascript Scenario: Students can not navigate to restricted sections - Given I am on "Course 1" course homepage + Given I am on "Course 1" course homepage with editing mode on Given I navigate to "Settings" in current page administration And I set the following fields to these values: | Course layout | Show one section per page | diff --git a/lib/form/tests/behat/modgrade_validation.feature b/lib/form/tests/behat/modgrade_validation.feature index 07dd527a289..f8f751c6be3 100644 --- a/lib/form/tests/behat/modgrade_validation.feature +++ b/lib/form/tests/behat/modgrade_validation.feature @@ -20,59 +20,48 @@ 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 | Test forum description | forum1 | general | 0 | + + @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 | - | 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 "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 "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 | + 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: + | Ratings > Aggregate type | Average of ratings | + | id_scale_modgrade_type | Scale | + | Ratings > scale[modgrade_scale] | ABCDEF | + 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 discussion topic" "link" @@ -93,9 +82,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 "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 @@ -122,16 +111,11 @@ Feature: Using the activity grade form element @javascript 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 | + | Ratings > Aggregate type | Average of ratings | + | id_scale_modgrade_type | Point | + | Ratings > scale[modgrade_point] | 100 | 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 diff --git a/mod/forum/tests/behat/add_forum.feature b/mod/forum/tests/behat/add_forum.feature index d32f7bb8ba7..9e531ac5abd 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 6a9ec280d7e..ae5c2376ec7 100644 --- a/mod/forum/tests/behat/edit_post_teacher.feature +++ b/mod/forum/tests/behat/edit_post_teacher.feature @@ -19,12 +19,9 @@ Feature: Teachers can edit or delete any forum post And the following "activities" exist: | activity | name | intro | course | section | idnumber | | forum | Test forum name | Test forum description | C1 | 1 | forum1 | - And I log in as "teacher1" - And I am on "Course 1" course homepage - 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 "mod_forum > discussions" exist: + | forum | course | user | name | message | + | forum1 | C1 | teacher1 | Teacher post subject | Teacher post message | 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: diff --git a/mod/forum/tests/behat/forum_subscriptions.feature b/mod/forum/tests/behat/forum_subscriptions.feature index 9b81d6b841e..8561bb262c1 100644 --- a/mod/forum/tests/behat/forum_subscriptions.feature +++ b/mod/forum/tests/behat/forum_subscriptions.feature @@ -14,26 +14,21 @@ 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" Scenario: A disallowed subscription forum cannot be subscribed to - Given the following "activity" exists: - | activity | forum | - | course | C1 | - | idnumber | forum1 | - | name | Test forum name | - | intro | Test forum description | - | type | general | - | section | 1 | - And I am on "Course 1" course homepage - Given I follow "Test forum name" + Given I am on "Course 1" course homepage + And I follow "Test forum name" And I navigate to "Settings" in current page administration And I set the following fields to these values: | Subscription mode | Subscription disabled | 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 When I log in as "student1" And I am on "Course 1" course homepage @@ -44,23 +39,12 @@ Feature: A user can control their own subscription preferences for a forum 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 the following "activity" exists: - | activity | forum | - | course | C1 | - | idnumber | forum1 | - | name | Test forum name | - | intro | Test forum description | - | type | general | - | section | 1 | - And I am on "Course 1" course homepage - Given I follow "Test forum name" + Given I am on "Course 1" course homepage + And I follow "Test forum name" And I navigate to "Settings" in current page administration And I set the following fields to these values: | Subscription mode | Forced 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 When I log in as "student1" And I am on "Course 1" course homepage @@ -71,23 +55,12 @@ Feature: A user can control their own subscription preferences for a forum 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 the following "activity" exists: - | activity | forum | - | course | C1 | - | idnumber | forum1 | - | name | Test forum name | - | intro | Test forum description | - | type | general | - | section | 1 | - And I am on "Course 1" course homepage - Given I follow "Test forum name" + Given I am on "Course 1" course homepage + And I follow "Test forum name" And I navigate to "Settings" in current page administration 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 When I log in as "student1" And I am on "Course 1" course homepage @@ -100,23 +73,12 @@ Feature: A user can control their own subscription preferences for a forum And I should not see "Subscribe to forum" Scenario: An Automatic forum can be unsubscribed from - Given the following "activity" exists: - | activity | forum | - | course | C1 | - | idnumber | forum1 | - | name | Test forum name | - | intro | Test forum description | - | type | general | - | section | 1 | - And I am on "Course 1" course homepage - Given I follow "Test forum name" + Given I am on "Course 1" course homepage + And I follow "Test forum name" And I navigate to "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 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 diff --git a/mod/forum/tests/behat/forum_subscriptions_availability.feature b/mod/forum/tests/behat/forum_subscriptions_availability.feature index 560528f3c67..38edac602a5 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 "Subscriptions" in current page administration Then I should see "Student 1" And I should see "Teacher Teacher" @@ -63,15 +63,7 @@ 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 + 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 | @@ -85,16 +77,7 @@ Feature: As a teacher I need to see an accurate list of subscribed users And I should see "Student 3" 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 on course page | @@ -108,19 +91,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 "Subscriptions" 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 43e1ef49896..d4af5ef8178 100644 --- a/mod/forum/tests/behat/grade_forum.feature +++ b/mod/forum/tests/behat/grade_forum.feature @@ -23,17 +23,22 @@ 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 | + | description | Test | + | section | 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 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" page + And I navigate to "Settings" in current page administration 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" @@ -74,11 +79,9 @@ Feature: I can grade a students interaction across a forum And I should see "Tutor" in the "Parent category" "fieldset" 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" page + And I navigate to "Settings" in current page administration 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" @@ -130,17 +133,10 @@ 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 the following "activity" exists: - | activity | forum | - | course | C1 | - | idnumber | 0001 | - | name | Test Forum 1 | - | intro | Test | - | section | 1 | - And I am on "Course 1" course homepage - And I follow "Test Forum 1" + Given I am on the "Test Forum 1" "forum activity" page And I navigate to "Settings" in current page administration And I expand all fieldsets + And I set the field "Ratings > Aggregate type" to "Count of ratings" And I set the field "Ratings > Type" to "Point" And I set the field "Ratings > Maximum grade" to "100" diff --git a/mod/forum/tests/behat/inpage_reply.feature b/mod/forum/tests/behat/inpage_reply.feature index 73ded216451..48a1e40df5c 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/separate_group_grade_forum.feature b/mod/forum/tests/behat/separate_group_grade_forum.feature index 5a7acb3471e..14dd16282d7 100644 --- a/mod/forum/tests/behat/separate_group_grade_forum.feature +++ b/mod/forum/tests/behat/separate_group_grade_forum.feature @@ -32,10 +32,16 @@ Feature: I can grade a students by group with separate groups | student1 | G3 | | student2 | G3 | | student3 | G3 | + And the following "activity" exists: + | activity | forum | + | course | C1 | + | section | 1 | + | name | Test Forum 1 | + | intro | Test | And I log in as "teacher1" And I am on "Course 1" course homepage And I turn editing mode on - And I add a "Forum" to section "1" + And I am on the "Test Forum 1" "forum activity editing" page logged in as teacher1 And I expand all fieldsets And I set the following fields to these values: | Forum name | Test Forum 1 | diff --git a/mod/forum/tests/behat/split_forum_discussion.feature b/mod/forum/tests/behat/split_forum_discussion.feature index 51e8a4efb47..e907d0d0e99 100644 --- a/mod/forum/tests/behat/split_forum_discussion.feature +++ b/mod/forum/tests/behat/split_forum_discussion.feature @@ -21,12 +21,9 @@ Feature: Forum discussions can be split And the following "activities" exist: | activity | name | intro | course | idnumber | type | | forum | Study discussions | Forum to discuss your coursework. | C1 | forump1 | general | - And I log in as "teacher1" - And I am on "Science 101" course homepage - 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 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 I log in as "student1" And I am on "Science 101" course homepage And I reply "Photosynthesis discussion" post from "Study discussions" forum with: