1 |
efrain |
1 |
@block @block_search_forums @mod_forum
|
|
|
2 |
Feature: The search forums block allows users to search for forum posts on course page
|
|
|
3 |
In order to search for a forum post
|
|
|
4 |
As a user
|
|
|
5 |
I can use the search forums block
|
|
|
6 |
|
|
|
7 |
Background:
|
|
|
8 |
Given the following "users" exist:
|
|
|
9 |
| username | firstname | lastname | email | idnumber |
|
|
|
10 |
| teacher1 | Teacher | 1 | teacher1@example.com | T1 |
|
|
|
11 |
| student1 | Student | 1 | student1@example.com | S1 |
|
|
|
12 |
And the following "courses" exist:
|
|
|
13 |
| fullname | shortname | category |
|
|
|
14 |
| Course 1 | C1 | 0 |
|
|
|
15 |
And the following "course enrolments" exist:
|
|
|
16 |
| user | course | role |
|
|
|
17 |
| teacher1 | C1 | editingteacher |
|
|
|
18 |
| student1 | C1 | student |
|
|
|
19 |
And the following "blocks" exist:
|
|
|
20 |
| blockname | contextlevel | reference | pagetypepattern | defaultregion |
|
|
|
21 |
| news_items | Course | C1 | course-view-* | side-pre |
|
|
|
22 |
| search_forums | Course | C1 | course-view-* | side-pre |
|
|
|
23 |
And I am on the "Course 1" "course editing" page logged in as teacher1
|
|
|
24 |
And I set the field "id_newsitems" to "1"
|
|
|
25 |
And I press "Save and display"
|
|
|
26 |
And the following "mod_forum > discussions" exist:
|
|
|
27 |
| user | forum | name | message |
|
|
|
28 |
| teacher1 | Announcements | My subject | My message |
|
|
|
29 |
|
|
|
30 |
Scenario: Use the search forum block in a course without any forum posts
|
|
|
31 |
Given I am on the "Course 1" course page logged in as student1
|
|
|
32 |
When I set the field "Search" to "Moodle"
|
|
|
33 |
And I press "Search"
|
|
|
34 |
Then I should see "No posts"
|
|
|
35 |
|
|
|
36 |
Scenario: Use the search forum block in a course with a hidden forum and search for posts
|
|
|
37 |
Given I am on the "Announcements" "forum activity editing" page logged in as teacher1
|
|
|
38 |
And I expand all fieldsets
|
|
|
39 |
And I set the field "id_visible" to "0"
|
|
|
40 |
And I press "Save and return to course"
|
|
|
41 |
When I am on the "Course 1" course page logged in as student1
|
|
|
42 |
And "Search forums" "block" should exist
|
|
|
43 |
And I set the field "Search" to "message"
|
|
|
44 |
And I press "Search"
|
|
|
45 |
Then I should see "No posts"
|
|
|
46 |
|
|
|
47 |
Scenario: Use the search forum block in a course and search for posts
|
|
|
48 |
Given I am on the "Course 1" course page logged in as student1
|
|
|
49 |
And "Search forums" "block" should exist
|
|
|
50 |
And I set the field "Search" to "message"
|
|
|
51 |
And I press "Search"
|
|
|
52 |
Then I should see "My subject"
|