Skip to content

Commit 8c8dd66

Browse files
committed
add missing test for readtracking
1 parent a7476a1 commit 8c8dd66

File tree

2 files changed

+34
-2
lines changed

2 files changed

+34
-2
lines changed

tests/behat/behat_mod_moodleoverflow.php

Lines changed: 19 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -131,7 +131,7 @@ public function i_add_a_moodleoverflow_discussion_with_posts_from_different_user
131131
}
132132

133133
/**
134-
* The admins adds a moodleoverflow discussions with a tracking type. Used in the track_read_posts_feature.
134+
* The admin adds a moodleoverflow discussions with a tracking type. Used in the track_read_posts_feature.
135135
*
136136
* @Given /^The admin posts "(?P<subject>[^"]*)" in "(?P<name>[^"]*)" with tracking type "(?P<trackingtype>[^"]*)"$/
137137
*
@@ -153,6 +153,24 @@ public function admin_adds_moodleoverflow_with_tracking_type(string $subject, st
153153
]));
154154
}
155155

156+
/**
157+
* The admin adds a moodleoverflow discussion.
158+
*
159+
* @Given /^The admin posts "(?P<subject>[^"]*)" in "(?P<name>[^"]*)"$/
160+
*
161+
* @param string $subject
162+
* @param string $name
163+
* @return void
164+
*/
165+
public function admin_adds_discussion(string $subject, string $name): void {
166+
$this->execute('behat_auth::i_log_in_as', 'admin');
167+
$this->execute('behat_navigation::i_am_on_course_homepage', 'Course 1');
168+
$this->i_add_a_moodleoverflow_discussion_to_moodleoverflow_with($name, new TableNode([
169+
['Subject', $subject],
170+
['Message', 'Test post message'],
171+
]));
172+
}
173+
156174
/**
157175
* Logs in as a user and navigates in a course to dedicated moodleoverflow discussion.
158176
*

tests/behat/track_read_posts.feature

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
@mod @mod_moodleoverflow
1+
@mod @mod_moodleoverflow @javascript
22
Feature: A teacher can set one of 3 possible options for tracking read moodleoverflow posts
33
In order to ease the moodleoverflow posts follow up
44
As a user
@@ -67,3 +67,17 @@ Feature: A teacher can set one of 3 possible options for tracking read moodleove
6767
And I click on "1" "link" in the "Test post subject" moodleoverflow discussion card
6868
And I am on "Course 1" course homepage
6969
And I should not see "1 unread post"
70+
71+
Scenario: Marking all unread posts as read.
72+
Given the following config values are set as admin:
73+
| allowforcedreadtracking | 1 | moodleoverflow |
74+
And The admin posts "Test post subject" in "Test moodleoverflow name" with tracking type "2"
75+
And The admin posts "Test post subject 2" in "Test moodleoverflow name"
76+
And I log in as "student1"
77+
And I am on "Course 1" course homepage
78+
And I should see "2 unread post"
79+
And I follow "Test moodleoverflow name"
80+
When I click on "Mark all posts as read" "link"
81+
And I am on "Course 1" course homepage
82+
Then I should not see "2 unread post"
83+

0 commit comments

Comments
 (0)