diff --git a/admin/tool/dataprivacy/tests/behat/protecteddelete.feature b/admin/tool/dataprivacy/tests/behat/protecteddelete.feature index b4e36dde72d..978da609881 100644 --- a/admin/tool/dataprivacy/tests/behat/protecteddelete.feature +++ b/admin/tool/dataprivacy/tests/behat/protecteddelete.feature @@ -30,6 +30,12 @@ Feature: Protected data should not be deleted | Site purpose | PT1H | 0 | | prot | P1D | 1 | | unprot | P1D | 0 | + And the following "mod_forum > discussions" exist: + | user | forum | name | message | + | u1 | forump1 | Discussion subject | Test post in forump1 | + | u1 | forumu1 | Discussion subject | Test post in forumu1 | + | u1 | forump2 | Discussion subject | Test post in forump2 | + | u1 | forumu2 | Discussion subject | Test post in forumu2 | And I set the category and purpose for the "forump1" "forum" in course "C1" to "CAT" and "prot" And I set the category and purpose for the "forump2" "forum" in course "C2" to "CAT" and "prot" And I set the category and purpose for the "forumu1" "forum" in course "C1" to "CAT" and "unprot" @@ -38,47 +44,25 @@ Feature: Protected data should not be deleted @javascripta Scenario: Unexpired and protected data is not removed - Given I log in as "u1" - And I am on "C1" course homepage - And I add a new discussion to "forump1" forum with: - | Subject | Discussion subject | - | Message | Test post in forump1 | - And I am on "C1" course homepage - And I add a new discussion to "forumu1" forum with: - | Subject | Discussion subject | - | Message | Test post in forumu1 | - And I am on "C2" course homepage - And I add a new discussion to "forump2" forum with: - | Subject | Discussion subject | - | Message | Test post in forump2 | - And I am on "C2" course homepage - And I add a new discussion to "forumu2" forum with: - | Subject | Discussion subject | - | Message | Test post in forumu2 | - And I log out - And I log in as "admin" + Given I log in as "admin" And I create a dataprivacy "delete" request for "u1" And I approve a dataprivacy "delete" request for "u1" And I run all adhoc tasks And I navigate to "Users > Privacy and policies > Data requests" in site administration And I should see "Deleted" in the "u1" "table_row" - And I am on "C1" course homepage - And I follow "forump1" + And I am on the "forump1" "forum activity" page And I follow "Discussion subject" Then I should not see "Test post in forump1" - When I am on "C1" course homepage - And I follow "forumu1" + When I am on the "forumu1" "forum activity" page And I follow "Discussion subject" Then I should not see "Test post in forumu1" - And I am on "C2" course homepage - And I follow "forump2" + And I am on the "forump2" "forum activity" page And I follow "Discussion subject" Then I should see "Test post in forump2" - When I am on "C2" course homepage - And I follow "forumu2" + When I am on the "forumu2" "forum activity" page And I follow "Discussion subject" Then I should not see "Test post in forumu2" diff --git a/course/format/social/tests/behat/social_adjust_discussion_count.feature b/course/format/social/tests/behat/social_adjust_discussion_count.feature index 830ad4ecd2d..44d5c039985 100644 --- a/course/format/social/tests/behat/social_adjust_discussion_count.feature +++ b/course/format/social/tests/behat/social_adjust_discussion_count.feature @@ -94,11 +94,10 @@ Feature: Change number of discussions displayed | Message | This is forum post one | And I press "Post to forum" And I wait to be redirected - And I am on "Course 1" course homepage + And I am on the "C1" "course editing" page logged in as teacher1 Scenario: When number of discussions is decreased fewer discussions appear - Given I navigate to "Edit settings" in current page administration - And I set the following fields to these values: + Given I set the following fields to these values: | numdiscussions | 5 | When I press "Save and display" Then I should see "This is forum post one" @@ -106,8 +105,7 @@ Feature: Change number of discussions displayed And I should not see "This is forum post six" Scenario: When number of discussions is decreased to less than 1 only 1 discussion should appear - Given I navigate to "Edit settings" in current page administration - And I set the following fields to these values: + Given I set the following fields to these values: | numdiscussions | -1 | When I press "Save and display" Then I should see "This is forum post one" @@ -115,8 +113,7 @@ Feature: Change number of discussions displayed And I should not see "This is forum post ten" Scenario: When number of discussions is increased more discussions appear - Given I navigate to "Edit settings" in current page administration - And I set the following fields to these values: + Given I set the following fields to these values: | numdiscussions | 9 | When I press "Save and display" Then I should see "This is forum post one" diff --git a/lib/form/tests/behat/modgrade_validation.feature b/lib/form/tests/behat/modgrade_validation.feature index 424ace1ad5e..f0a4a632ffa 100644 --- a/lib/form/tests/behat/modgrade_validation.feature +++ b/lib/form/tests/behat/modgrade_validation.feature @@ -24,9 +24,9 @@ Feature: Using the activity grade form element | 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 | + And the following "mod_forum > discussions" exist: + | user | forum | name | message | + | student1 | forum1 | Discussion subject | Discussion message | @javascript Scenario: Being able to change the grade type, scale and maximum grade when there are no grades diff --git a/mod/forum/report/summary/tests/behat/private_replies.feature b/mod/forum/report/summary/tests/behat/private_replies.feature index 95fcf37c6bb..9a020cdfe35 100644 --- a/mod/forum/report/summary/tests/behat/private_replies.feature +++ b/mod/forum/report/summary/tests/behat/private_replies.feature @@ -23,20 +23,17 @@ Feature: Include private replies in the summary report And the following "activities" exist: | 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 | - | teacher1 | forum1 | discussion2 | t1 between | - | student1 | forum1 | discussion3 | s1 latest | - And the following forum replies exist in course "Course 1": - | user | forum | discussion | subject | message | - | teacher1 | forum1 | discussion1 | t1 between | t1 between | - | teacher1 | forum1 | discussion2 | t1 latest | t1 latest | - | student1 | forum1 | discussion1 | s1 earliest | s1 earliest | - 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 the following "mod_forum > discussions" exist: + | user | forum | name | message | + | teacher1 | forum1 | discussion1 | t1 earliest | + | teacher1 | forum1 | discussion2 | t1 between | + | teacher1 | forum1 | discussion3 | s1 latest | + And the following "mod_forum > posts" exist: + | user | parentsubject | subject | message | privatereplyto | + | teacher1 | discussion1 | t1 between | t1 between | | + | teacher1 | discussion2 | t1 latest | t1 latest | | + | student1 | discussion1 | s1 earliest | s1 earliest | | + | teacher1 | s1 earliest | This is a private reply | This is a private reply | 1 | Scenario: Private replies are counted for Teacher When I am on the "forum1" "forum activity" page logged in as teacher2 diff --git a/mod/forum/tests/behat/add_forum.feature b/mod/forum/tests/behat/add_forum.feature index 8ae0d74bd6b..ac7ae122735 100644 --- a/mod/forum/tests/behat/add_forum.feature +++ b/mod/forum/tests/behat/add_forum.feature @@ -17,16 +17,20 @@ Feature: Add forum activities and discussions | user | course | role | | teacher1 | C1 | editingteacher | | student1 | C1 | student | - And the following "activity" exists: - | activity | forum | - | course | C1 | - | name | Test forum name | - | type | general | - 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 | - When I am on the "Course 1" course page logged in as student1 + 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 am on the "Course 1" course page logged in as student1 + 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/advanced_search.feature b/mod/forum/tests/behat/advanced_search.feature index cad0dce83bb..d5e9f061bc3 100644 --- a/mod/forum/tests/behat/advanced_search.feature +++ b/mod/forum/tests/behat/advanced_search.feature @@ -120,8 +120,7 @@ Feature: The forum search allows users to perform advanced searches for forum po @javascript Scenario: Perform an advanced search on starred discussions without text Given I am on the "Announcements" "forum activity" page logged in as student1 - And I click on "Your subjective" action menu - And I follow "Star this discussion" + And I click on "Star this discussion" "link" in the "Your subjective" "table_row" And I press "Search forums" And I should see "Advanced search" And I set the field "starredonly" to "1" @@ -132,8 +131,7 @@ Feature: The forum search allows users to perform advanced searches for forum po @javascript Scenario: Perform an advanced search on starred discussions with text Given I am on the "Announcements" "forum activity" page logged in as student1 - And I click on "Your subjective" action menu - And I follow "Star this discussion" + And I click on "Star this discussion" "link" in the "Your subjective" "table_row" And I press "Search forums" And I should see "Advanced search" And I set the field "words" to "message" diff --git a/mod/forum/tests/behat/discussion_lock.feature b/mod/forum/tests/behat/discussion_lock.feature index 1c74f04a305..6f4250e8ef9 100644 --- a/mod/forum/tests/behat/discussion_lock.feature +++ b/mod/forum/tests/behat/discussion_lock.feature @@ -15,14 +15,15 @@ Feature: As a teacher, you can manually lock individual discussions when viewing | course | C1 | | activity | forum | | name | Test forum name | - 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 | + | idnumber | forum1 | + And the following "mod_forum > discussions" exist: + | user | forum | name | message | + | admin | forum1 | Discussion 1 | Discussion contents 1, first message | + | admin | forum1 | Discussion 2 | Discussion contents 2, first message | + And the following "mod_forum > posts" exist: + | user | parentsubject | subject | message | + | admin | Discussion 1 | Reply 1 to discussion 1 | Discussion contents 1, second message | + | admin | 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 logged in as admin diff --git a/mod/forum/tests/behat/discussion_navigation.feature b/mod/forum/tests/behat/discussion_navigation.feature index 601ec77faf2..4caa84a7081 100644 --- a/mod/forum/tests/behat/discussion_navigation.feature +++ b/mod/forum/tests/behat/discussion_navigation.feature @@ -33,19 +33,12 @@ Feature: A user can navigate to previous and next discussions Given the following "activities" exist: | activity | name | course | idnumber | groupmode | | forum | Test forum name | C1 | forum | 0 | + And the following "mod_forum > discussions" exist: + | user | forum | name | message | + | teacher1 | forum | Discussion 1 | Test post message | + | teacher1 | forum | Discussion 2 | Test post message | + | teacher1 | forum | Discussion 3 | Test post message | 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 | - And I wait "1" seconds - And I add a new discussion to "Test forum name" forum with: - | Subject | Discussion 2 | - | Message | Test post message | - And I wait "1" seconds - And I add a new discussion to "Test forum name" forum with: - | Subject | Discussion 3 | - | Message | Test post message | - And I wait "1" seconds When I follow "Discussion 3" Then I should not see "Discussion 1" And I should see "Discussion 2" @@ -72,14 +65,16 @@ Feature: A user can navigate to previous and next discussions Given the following "activities" exist: | 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 | + And the following "mod_forum > discussions" exist: + | user | forum | name | message | + | student1 | forum | Discussion 1 Group 0 | Test post message | + | student1 | forum | Discussion 2 Group 0 | Test post message | + And the following "mod_forum > discussions" exist: + | user | forum | name | message | group | + | student1 | forum | Discussion 1 Group 1 | Test post message | G1 | + | student1 | forum | Discussion 2 Group 1 | Test post message | G1 | + | student1 | forum | Discussion 1 Group 2 | Test post message | G2 | + | student1 | forum | 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" @@ -99,7 +94,7 @@ Feature: A user can navigate to previous and next discussions And I follow "Test forum name" And I select "Group 1" from the "Visible groups" singleselect And I follow "Discussion 1 Group 1" - Then I should see "Discussion 2 Group 0" + And I should see "Discussion 2 Group 0" And I should see "Discussion 2 Group 1" And I follow "Discussion 2 Group 1" And I should see "Discussion 1 Group 1" @@ -107,16 +102,18 @@ Feature: A user can navigate to previous and next discussions Scenario: A user can navigate between discussions with separate groups Given the following "activities" exist: - | activity | name | intro | course | idnumber | groupmode | - | forum | Test forum name | Test forum name | C1 | forum | 1 | - 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 | + | activity | name | course | idnumber | groupmode | + | forum | Test forum name | C1 | forum | 1 | + And the following "mod_forum > discussions" exist: + | user | forum | name | message | + | student1 | forum | Discussion 1 Group 0 | Test post message | + | student1 | forum | Discussion 2 Group 0 | Test post message | + And the following "mod_forum > discussions" exist: + | user | forum | name | message | group | + | student1 | forum | Discussion 1 Group 1 | Test post message | G1 | + | student1 | forum | Discussion 2 Group 1 | Test post message | G1 | + | student1 | forum | Discussion 1 Group 2 | Test post message | G2 | + | student1 | forum | 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" diff --git a/mod/forum/tests/behat/discussion_subscriptions.feature b/mod/forum/tests/behat/discussion_subscriptions.feature index 5bc438920ad..af57b3b5138 100644 --- a/mod/forum/tests/behat/discussion_subscriptions.feature +++ b/mod/forum/tests/behat/discussion_subscriptions.feature @@ -24,10 +24,10 @@ Feature: A user can control their own subscription preferences for a discussion | name | Test forum name | | type | general | | forcesubscribe | 0 | - 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 the following "mod_forum > discussions" exist: + | user | forum | name | message | + | admin | forum1 | Test post subject one | Test post message one | + | admin | forum1 | 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" @@ -64,10 +64,10 @@ Feature: A user can control their own subscription preferences for a discussion | name | Test forum name | | type | general | | forcesubscribe | 2 | - 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 the following "mod_forum > discussions" exist: + | user | forum | name | message | + | admin | forum1 | Test post subject one | Test post message one | + | admin | forum1 | 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" @@ -104,10 +104,10 @@ Feature: A user can control their own subscription preferences for a discussion | name | Test forum name | | type | general | | forcesubscribe | 0 | - 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 the following "mod_forum > discussions" exist: + | user | forum | name | message | + | admin | forum1 | Test post subject one | Test post message one | + | admin | forum1 | 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" @@ -174,10 +174,10 @@ Feature: A user can control their own subscription preferences for a discussion | name | Test forum name | | type | general | | forcesubscribe | 0 | - 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 the following "mod_forum > discussions" exist: + | user | forum | name | message | + | admin | forum1 | Test post subject one | Test post message one | + | admin | forum1 | 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: @@ -207,10 +207,10 @@ Feature: A user can control their own subscription preferences for a discussion | name | Test forum name | | type | general | | forcesubscribe | 2 | - 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 the following "mod_forum > discussions" exist: + | user | forum | name | message | + | admin | forum1 | Test post subject one | Test post message one | + | admin | forum1 | 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: @@ -236,9 +236,9 @@ Feature: A user can control their own subscription preferences for a discussion 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 | + And the following "mod_forum > discussions" exist: + | user | forum | name | message | + | admin | forum1 | 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" @@ -250,9 +250,9 @@ Feature: A user can control their own subscription preferences for a discussion 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 | + And the following "mod_forum > discussions" exist: + | user | forum | name | message | + | admin | forum1 | 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" @@ -269,9 +269,9 @@ Feature: A user can control their own subscription preferences for a discussion | name | Test forum name | | type | general | | forcesubscribe | 0 | - 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 | + And the following "mod_forum > discussions" exist: + | user | forum | name | message | + | admin | forum1 | 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 1e866bc520e..af0cdddb1e9 100644 --- a/mod/forum/tests/behat/edit_post_student.feature +++ b/mod/forum/tests/behat/edit_post_student.feature @@ -18,9 +18,10 @@ Feature: Students can edit or delete their forum posts within a set time limit | 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 | + And the following "mod_forum > discussions" exist: + | user | forum | name | message | + | student1 | forum | Forum post subject | This is the body | + And I am on the "Test forum name" "forum activity" page Scenario: Edit forum post Given I follow "Forum post subject" diff --git a/mod/forum/tests/behat/edit_tags.feature b/mod/forum/tests/behat/edit_tags.feature index e02a8d7d425..a0d1d9b8d47 100644 --- a/mod/forum/tests/behat/edit_tags.feature +++ b/mod/forum/tests/behat/edit_tags.feature @@ -20,9 +20,10 @@ Feature: Edited forum posts handle tags correctly | course | C1 | | activity | forum | | name | Test forum name | - And the following forum discussions exist in course "Course 1": - | user | forum | name | message | - | teacher1 | Test forum name | Teacher post subject | Teacher post message | + | idnumber | forum1 | + And the following "mod_forum > discussions" exist: + | user | forum | name | message | + | teacher1 | forum1 | Teacher post subject | Teacher post message | @javascript Scenario: Forum post edition of custom tags works as expected diff --git a/mod/forum/tests/behat/favourite_discussion.feature b/mod/forum/tests/behat/favourite_discussion.feature index eaf3822f404..b1743cf9555 100644 --- a/mod/forum/tests/behat/favourite_discussion.feature +++ b/mod/forum/tests/behat/favourite_discussion.feature @@ -15,19 +15,17 @@ Feature: A student can favourite a discussion via the forum settings menu | course | C1 | | activity | forum | | name | Test forum name | - 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 | + | idnumber | forum1 | + And the following "mod_forum > discussions" exist: + | user | forum | name | message | + | admin | forum1 | Discussion 1 | Discussion contents 1, first message | + And the following "mod_forum > posts" exist: + | user | parentsubject | subject | message | + | admin | Discussion 1 | Reply 1 to discussion 1 | Discussion contents 1, second message | + | student1 | Discussion 1 | Reply 2 to discussion 1 | Discussion contents 1, third 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 - And I reply "Discussion 1" post from "Test forum name" forum with: - | Subject | Reply 2 to discussion 1 | - | Message | Discussion contents 1, third message | - And I wait until the page is ready + Given I am on the "Test forum name" "forum activity" page logged in as student1 When I open the action menu in "[data-container='discussion-tools']" "css_element" And I click on "[title='Star this discussion']" "css_element" And I wait "3" seconds @@ -35,11 +33,7 @@ Feature: A student can favourite a discussion via the forum settings menu And I click on "[title='Unstar this discussion']" "css_element" Scenario: Student can favourite a discussion from the discussion list - Given I am on the "Course 1" Course page logged in as student1 - And I reply "Discussion 1" post from "Test forum name" forum with: - | Subject | Reply 2 to discussion 1 | - | Message | Discussion contents 1, third message | - When I am on the "Test forum name" "forum activity" page + When I am on the "Test forum name" "forum activity" page logged in as student1 And I click on "Discussion 1" action menu And I click on "[title='Star this discussion']" "css_element" And I click on "Discussion 1" action menu diff --git a/mod/forum/tests/behat/forum_subscriptions.feature b/mod/forum/tests/behat/forum_subscriptions.feature index c51967cbbc5..2bb2f78936b 100644 --- a/mod/forum/tests/behat/forum_subscriptions.feature +++ b/mod/forum/tests/behat/forum_subscriptions.feature @@ -20,11 +20,10 @@ Feature: A user can control their own subscription preferences for a forum 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 the "Test forum name" "forum activity editing" page logged in as admin Scenario: A disallowed subscription forum cannot be subscribed to - Given I am on the "Test forum name" "forum activity editing" page - And I set the following fields to these values: + Given I set the following fields to these values: | Subscription mode | Subscription disabled | And I press "Save and return to course" When I am on the "Test forum name" "forum activity" page logged in as student1 @@ -34,8 +33,7 @@ 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 I am on the "Test forum name" "forum activity editing" page - And I set the following fields to these values: + Given I set the following fields to these values: | Subscription mode | Forced subscription | And I press "Save and return to course" When I am on the "Test forum name" "forum activity" page logged in as student1 @@ -45,8 +43,7 @@ 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 I am on the "Test forum name" "forum activity editing" page - And I set the following fields to these values: + Given I set the following fields to these values: | Subscription mode | Optional subscription | And I press "Save and return to course" When I am on the "Test forum name" "forum activity" page logged in as student1 @@ -58,8 +55,7 @@ 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 am on the "Test forum name" "forum activity editing" page - And I set the following fields to these values: + Given I set the following fields to these values: | Subscription mode | Auto subscription | And I press "Save and return to course" When I am on the "Test forum name" "forum activity" page logged in as student1 diff --git a/mod/forum/tests/behat/move_discussion.feature b/mod/forum/tests/behat/move_discussion.feature index 9a823319d8a..d773716fc2d 100644 --- a/mod/forum/tests/behat/move_discussion.feature +++ b/mod/forum/tests/behat/move_discussion.feature @@ -19,12 +19,12 @@ Feature: A teacher can move discussions between forums Scenario: A teacher can move discussions Given the following "activities" exist: - | 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 | + | activity | name | course | idnumber | groupmode | + | forum | Test forum 1 | C1 | forum1 | 0 | + | forum | Test forum 2 | C1 | forum2 | 0 | + And the following "mod_forum > discussions" exist: + | user | forum | name | message | + | student1 | forum1 | 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" diff --git a/mod/forum/tests/behat/my_forum_posts.feature b/mod/forum/tests/behat/my_forum_posts.feature index 35a1d0afe7f..27cbdcc3b94 100644 --- a/mod/forum/tests/behat/my_forum_posts.feature +++ b/mod/forum/tests/behat/my_forum_posts.feature @@ -17,12 +17,12 @@ Feature: A user can view their posts and discussions And the following "activities" exist: | 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 the following "mod_forum > discussions" exist: + | user | forum | name | message | + | student1 | forum | Forum discussion 1 | How awesome is this forum discussion? | + And the following "mod_forum > posts" exist: + | user | parentsubject | subject | message | + | student1 | Forum discussion 1 | Actually, I've seen better. | Actually, I've seen better. | And I log in as "student1" When I follow "Profile" in the user menu And I follow "Forum posts" diff --git a/mod/forum/tests/behat/post_to_multiple_groups.feature b/mod/forum/tests/behat/post_to_multiple_groups.feature index f1599ea1723..a23e34b0be7 100644 --- a/mod/forum/tests/behat/post_to_multiple_groups.feature +++ b/mod/forum/tests/behat/post_to_multiple_groups.feature @@ -84,7 +84,7 @@ Feature: A user with access to multiple groups should be able to post a copy of Scenario: Teacher is unable to post a copy of a message to all groups in a 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" + When 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 diff --git a/mod/forum/tests/behat/posts_ordering_general.feature b/mod/forum/tests/behat/posts_ordering_general.feature index e181d50a5b3..f82c6ad044b 100644 --- a/mod/forum/tests/behat/posts_ordering_general.feature +++ b/mod/forum/tests/behat/posts_ordering_general.feature @@ -20,14 +20,15 @@ Feature: New discussions and discussions with recently added replies are display | course | C1 | | activity | forum | | name | Course general forum | + | idnumber | forum1 | # # 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## | + And the following "mod_forum > discussions" exist: + | user | forum | name | message | timemodified | + | student1 | forum1 | Forum post 1 | This is the first post | ##now +1 second## | + | student1 | forum1 | Forum post 2 | This is the second post | ##now +2 second## | + | student1 | forum1 | 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 @@ -51,7 +52,7 @@ Feature: New discussions and discussions with recently added replies are display # And I am on the "Course general forum" "forum activity" page logged in as teacher1 And I follow "Forum post 1" - And I reply "Forum post 1" post from "Course general forum" forum with: + When I reply "Forum post 1" post from "Course general forum" forum with: | Message | Reply to the first post | And I am on the "Course general forum" "forum activity" page # diff --git a/mod/forum/tests/behat/private_replies.feature b/mod/forum/tests/behat/private_replies.feature index 3ebbe2b8c47..ec64e3632bc 100644 --- a/mod/forum/tests/behat/private_replies.feature +++ b/mod/forum/tests/behat/private_replies.feature @@ -23,16 +23,17 @@ Feature: Forum posts can be replied to in private | teacher2 | C1 | editingteacher | | student1 | C1 | student | | student2 | C1 | student | - 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 the following "mod_forum > discussions" exist: + | user | forum | name | message | + | student1 | forum | 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 | Scenario: As a teacher I can see my own response - Given I follow "Answers to the homework" + Given I am on the "Study discussions" "forum activity" page logged in as teacher1 + 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 fellow teacher I can see the other teacher's response diff --git a/mod/forum/tests/behat/recent_activity.feature b/mod/forum/tests/behat/recent_activity.feature index c559bbcc726..8769e57af18 100644 --- a/mod/forum/tests/behat/recent_activity.feature +++ b/mod/forum/tests/behat/recent_activity.feature @@ -41,33 +41,30 @@ Feature: Users can see the relevant recent forum posts from the recent activity And I log in as "teacher1" Scenario: Recent forum activity with separate group discussion - Given I add a new discussion to "Separate groups forum" forum with: - | Subject | Group 1 separate discussion | - | Message | Group 1 members only | - | Group | Group 1 | + Given the following "mod_forum > discussions" exist: + | user | forum | name | message | group | + | teacher1 | forum1 | Group 1 separate discussion | Group 1 members only | G1 | 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 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 - Given I add a new discussion to "Visible groups forum" forum with: - | Subject | Group 1 visible discussion | - | Message | Not just for group 1 members | - | Group | Group 1 | + Given the following "mod_forum > discussions" exist: + | user | forum | name | message | group | + | teacher1 | forum2 | Group 1 visible discussion | Not just for group 1 members | G1 | 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 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 - Given I add a new discussion to "Standard forum" forum with: - | Subject | Standard forum discussion | - | Message | Discuss anything under the sun here! | - And I reply "Standard forum discussion" post from "Standard forum" forum with: - | Subject | Teacher's private reply | - | Message | This is a private reply | - | Reply privately | 1 | + Given the following "mod_forum > discussions" exist: + | user | forum | name | message | + | teacher1 | forum3 | Standard forum discussion | Discuss anything under the sun here! | + And the following "mod_forum > posts" exist: + | user | parentsubject | subject | message | privatereplyto | + | teacher1 | Standard forum discussion | Teacher's private reply | This is a private reply | 1 | 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" @@ -76,23 +73,22 @@ Feature: Users can see the relevant recent forum posts from the recent activity But I should not see "Teacher's private reply" in the "Recent activity" "block" Scenario: Recent forum activity with recent post in a hidden forum - Given I add a new discussion to "Hidden forum" forum with: - | Subject | Hidden discussion | - | Message | Should be hidden! | + Given the following "mod_forum > discussions" exist: + | user | forum | name | message | + | teacher1 | forum4 | Hidden discussion | Should be hidden! | And I am on "Course 1" course homepage And I should see "Hidden discussion" in the "Recent activity" "block" 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? | + Given the following "mod_forum > discussions" exist: + | user | forum | name | message | + | teacher1 | forum5 | The egg vs the chicken | Which came first? The egg or the chicken? | + And the following "mod_forum > posts" exist: + | user | parentsubject | subject | message | + | student1 | The egg vs the chicken | Student 1's answer | The egg! | 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! | - And I am on "Course 1" course homepage And I should see "The egg vs the chicken" in the "Recent activity" "block" And I should see "Student 1's answer" in the "Recent activity" "block" And the following config values are set as admin: @@ -109,13 +105,9 @@ Feature: Users can see the relevant recent forum posts from the recent activity And I should see "Student 2's answer" in the "Recent activity" "block" Scenario: Recent forum activity with timed discussion - Given I add a new discussion to "Standard forum" forum with: - | Subject | Timed discussion | - | Message | Discuss anything under the sun here... no more!!! | - | timeend[enabled] | 1 | - | timeend[year] | 2020 | - | timeend[month] | 1 | - | timeend[day] | 1 | + Given the following "mod_forum > discussions" exist: + | user | forum | name | message | timeend | + | teacher1 | forum3 | Timed discussion | Discuss anything under the sun here... no more!!! | ##1 Jan 2020 08:00## | And I am on "Course 1" course homepage And I should see "Timed discussion" in the "Recent activity" "block" When I am on the "Course 1" course page logged in as student1 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 83cd3bc8d8d..c76a60d1b38 100644 --- a/mod/forum/tests/behat/separate_group_single_group_discussions.feature +++ b/mod/forum/tests/behat/separate_group_single_group_discussions.feature @@ -39,9 +39,9 @@ Feature: Posting to groups in a separate group discussion when restricted to gro | G1 | G1G2 | | G2 | G2G1 | 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 | + | activity | course | idnumber | name | intro | type | section | groupmode | grouping | + | forum | C1 | 00001 | Multiple groups forum | Standard forum description | general | 1 | 1 | G1 | + | forum | C1 | 00001 | Single groups forum | Standard forum description | general | 1 | 1 | G2 | Scenario: Teacher with accessallgroups can post in all groups Given I am on the "Multiple groups forum" "forum activity" page logged in as teacher1 diff --git a/mod/forum/tests/behat/timed_discussions.feature b/mod/forum/tests/behat/timed_discussions.feature index 15cb6bd991d..54d7af870b6 100644 --- a/mod/forum/tests/behat/timed_discussions.feature +++ b/mod/forum/tests/behat/timed_discussions.feature @@ -17,23 +17,14 @@ Feature: Users can choose to set start and end time for display of their discuss 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 "mod_forum > discussions" exist: + | user | forum | name | message | timeend | timestart | + | admin | forump1 | Discussion 1 | Discussion contents 1, first message | | | + | admin | forump1 | Discussion 2 timed not visible | Discussion contents 2, first message | ##1 Jan 2014 08:00## | | + | admin | forump1 | Discussion 3 timed visible now | Discussion contents 3, first message | | 1 | And the following config values are set as admin: | forum_enabletimedposts | 1 | - 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 | - And I add a new discussion to "Test forum name" forum with: - | Subject | Discussion 2 timed not visible | - | Message | Discussion contents 2, first message | - | timeend[enabled] | 1 | - | timeend[year] | 2014 | - And I add a new discussion to "Test forum name" forum with: - | Subject | Discussion 3 timed visible now | - | Message | Discussion contents 3, first message | - | timestart[enabled] | 1 | - And I am on the "Test forum name" "forum activity" page + And I am on the "Test forum name" "forum activity" page logged in as admin And I should see "Discussion 2 timed" And I should see "Discussion 3 timed" And "[data-region=timed-label]" "css_element" should exist