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 <jun@moodle.com>
This commit is contained in:
Andrew Nicols 2020-11-09 17:15:32 +08:00 committed by Angelia Dela Cruz
parent 090baf556e
commit c38a977f3d

View File

@ -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