From 35cea4556641f720d69e06a5ad919f7a23ecadf9 Mon Sep 17 00:00:00 2001 From: Andrew Nicols Date: Mon, 9 Nov 2020 17:15:32 +0800 Subject: [PATCH] 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 | 112 ++++++++++-------- 1 file changed, 61 insertions(+), 51 deletions(-) diff --git a/mod/forum/tests/behat/track_read_posts.feature b/mod/forum/tests/behat/track_read_posts.feature index 3eabca865fd..a9ea4087a39 100644 --- a/mod/forum/tests/behat/track_read_posts.feature +++ b/mod/forum/tests/behat/track_read_posts.feature @@ -16,22 +16,22 @@ 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" Scenario: Tracking forum posts off Given the following "activity" exists: - | activity | forum | - | course | C1 | - | idnumber | 00001 | - | name | Test forum name | - | intro | Test forum description | - | section | 1 | - | trackingtype | 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 | - | Message | Test post message | - And I log out + | activity | forum | + | course | C1 | + | idnumber | forum1 | + | type | general | + | name | Test forum name | + | description | Test forum description | + | 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 log in as "student1" And I am on "Course 1" course homepage Then I should not see "1 unread post" @@ -40,19 +40,19 @@ Feature: A teacher can set one of 3 possible options for tracking read forum pos Scenario: Tracking forum posts optional with user tracking on Given the following "activity" exists: - | activity | forum | - | course | C1 | - | idnumber | 00001 | - | name | Test forum name | - | intro | Test forum description | - | section | 1 | - | type | generalforum | - | trackingtype | 1 | - And I am on "Course 1" course homepage - And I add a new discussion to "Test forum name" forum with: - | Subject | Test post subject | - | Message | Test post message | - And I log out + | activity | forum | + | course | C1 | + | idnumber | forum1 | + | name | Test forum name | + | type | general | + | description | Test forum description | + | 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 log in as "student1" And I am on "Course 1" course homepage Then I should see "1 unread post" @@ -76,12 +76,14 @@ Feature: A teacher can set one of 3 possible options for tracking read forum pos | name | Test forum name | | intro | Test forum description | | section | 1 | - | type | generalforum | + | type | general | | trackingtype | 1 | - And I am on "Course 1" course homepage - And I add a new discussion to "Test forum name" forum with: - | Subject | Test post subject | - | Message | Test post message | + And the following "mod_forum > discussion" exists: + | forum | 00001 | + | course | C1 | + | user | admin | + | name | 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 @@ -99,12 +101,14 @@ Feature: A teacher can set one of 3 possible options for tracking read forum pos | name | Test forum name | | intro | Test forum description | | section | 1 | - | type | generalforum | + | type | general | | trackingtype | 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 | - | Message | Test post message | + And the following "mod_forum > discussion" exists: + | forum | 00001 | + | course | C1 | + | user | admin | + | name | 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 @@ -125,12 +129,14 @@ Feature: A teacher can set one of 3 possible options for tracking read forum pos | name | Test forum name | | intro | Test forum description | | section | 1 | - | type | generalforum | + | type | general | | trackingtype | 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 | - | Message | Test post message | + And the following "mod_forum > discussion" exists: + | forum | 00001 | + | course | C1 | + | user | admin | + | name | 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 @@ -151,12 +157,14 @@ Feature: A teacher can set one of 3 possible options for tracking read forum pos | name | Test forum name | | description | Test forum description | | section | 1 | - | type | generalforum | + | type | general | | trackingtype | 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 | - | Message | Test post message | + 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 @@ -185,12 +193,14 @@ Feature: A teacher can set one of 3 possible options for tracking read forum pos | name | Test forum name | | description | Test forum description | | section | 1 | - | type | generalforum | + | type | general | | trackingtype | 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 | - | Message | Test post message | + 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