1 |
efrain |
1 |
@mod @mod_forum
|
|
|
2 |
Feature: The forum search allows users to perform advanced searches for forum posts
|
|
|
3 |
In order to perform an advanced search for a forum post
|
|
|
4 |
As a teacher
|
|
|
5 |
I can use the search feature
|
|
|
6 |
|
|
|
7 |
Background:
|
|
|
8 |
Given the following "users" exist:
|
|
|
9 |
| username | firstname | lastname | email | idnumber |
|
|
|
10 |
| teacher1 | Teacher | ONE | teacher1@example.com | T1 |
|
|
|
11 |
| teacher2 | Teacher | TWO | teacher2@example.com | T1 |
|
|
|
12 |
| student1 | Student | 1 | student1@example.com | S1 |
|
|
|
13 |
And the following "courses" exist:
|
|
|
14 |
| fullname | shortname | category | newsitems |
|
|
|
15 |
| Course 1 | C1 | 0 | 1 |
|
|
|
16 |
And the following "course enrolments" exist:
|
|
|
17 |
| user | course | role |
|
|
|
18 |
| teacher1 | C1 | editingteacher |
|
|
|
19 |
| teacher2 | C1 | editingteacher |
|
|
|
20 |
| student1 | C1 | student |
|
|
|
21 |
And the following "tags" exist:
|
|
|
22 |
| name | isstandard |
|
|
|
23 |
| SearchedTag | 1 |
|
|
|
24 |
And the following "blocks" exist:
|
|
|
25 |
| blockname | contextlevel | reference | pagetypepattern | defaultregion |
|
|
|
26 |
| news_items | Course | C1 | course-view-* | side-pre |
|
|
|
27 |
And the following "mod_forum > discussions" exist:
|
|
|
28 |
| user | forum | name | subject | message |
|
|
|
29 |
| teacher1 | Announcements | My subject | My subject | My message |
|
|
|
30 |
| teacher1 | Announcements | Your subjective | Your subjective | Your long message |
|
|
|
31 |
|
|
|
32 |
Scenario: Perform an advanced search using any term
|
|
|
33 |
Given I am on the "Announcements" "forum activity" page logged in as student1
|
|
|
34 |
And I press "Search"
|
|
|
35 |
And I should see "Please enter search terms into one or more of the following fields"
|
|
|
36 |
And I set the field "words" to "subject"
|
|
|
37 |
When I press "Search"
|
|
|
38 |
Then I should see "My subject"
|
|
|
39 |
And I should see "Your subjective"
|
|
|
40 |
|
|
|
41 |
Scenario: Perform an advanced search avoiding words
|
|
|
42 |
Given I am on the "Announcements" "forum activity" page logged in as student1
|
|
|
43 |
And I press "Search"
|
|
|
44 |
And I should see "Please enter search terms into one or more of the following fields"
|
|
|
45 |
And I set the field "words" to "My"
|
|
|
46 |
And I set the field "notwords" to "subjective"
|
|
|
47 |
When I press "Search"
|
|
|
48 |
Then I should see "My subject"
|
|
|
49 |
And I should not see "Your subjective"
|
|
|
50 |
|
|
|
51 |
Scenario: Perform an advanced search using whole words
|
|
|
52 |
Given database family used is one of the following:
|
|
|
53 |
| mysql |
|
|
|
54 |
| postgres |
|
|
|
55 |
And I am on the "Announcements" "forum activity" page logged in as student1
|
|
|
56 |
And I press "Search"
|
|
|
57 |
And I should see "Please enter search terms into one or more of the following fields"
|
|
|
58 |
And I set the field "fullwords" to "subject"
|
|
|
59 |
When I press "Search"
|
|
|
60 |
Then I should see "My subject"
|
|
|
61 |
And I should not see "Your subjective"
|
|
|
62 |
|
|
|
63 |
Scenario: Perform an advanced search matching the subject
|
|
|
64 |
Given I am on the "Announcements" "forum activity" page logged in as student1
|
|
|
65 |
And I press "Search"
|
|
|
66 |
And I should see "Please enter search terms into one or more of the following fields"
|
|
|
67 |
And I set the field "subject" to "subjective"
|
|
|
68 |
When I press "Search"
|
|
|
69 |
Then I should not see "My message"
|
|
|
70 |
And I should see "Your subjective"
|
|
|
71 |
|
|
|
72 |
Scenario: Perform an advanced search matching the author
|
|
|
73 |
Given the following "mod_forum > discussions" exist:
|
|
|
74 |
| user | forum | name | subject | message |
|
|
|
75 |
| teacher2 | Announcements | My Subjects | My Subjects | My message |
|
|
|
76 |
And I am on the "Announcements" "forum activity" page logged in as student1
|
|
|
77 |
When I press "Search"
|
|
|
78 |
And I should see "Please enter search terms into one or more of the following fields"
|
|
|
79 |
And I set the field "user" to "TWO"
|
|
|
80 |
And I press "Search"
|
|
|
81 |
Then I should see "Teacher TWO"
|
|
|
82 |
And I should not see "Teacher ONE"
|
|
|
83 |
|
|
|
84 |
Scenario: Perform an advanced search with multiple words
|
|
|
85 |
Given I am on the "Announcements" "forum activity" page logged in as student1
|
|
|
86 |
And I press "Search"
|
|
|
87 |
And I should see "Please enter search terms into one or more of the following fields"
|
|
|
88 |
And I set the field "subject" to "your subjective"
|
|
|
89 |
When I press "Search"
|
|
|
90 |
Then I should not see "My message"
|
|
|
91 |
And I should see "Your subjective"
|
|
|
92 |
|
|
|
93 |
@javascript
|
|
|
94 |
Scenario: Perform an advanced search using tags
|
|
|
95 |
Given I am on the "Announcements" "forum activity" page logged in as teacher1
|
|
|
96 |
And I follow "My subject"
|
|
|
97 |
And I follow "Edit"
|
|
|
98 |
And I set the following fields to these values:
|
|
|
99 |
| Tags | SearchedTag |
|
|
|
100 |
And I press "Save changes"
|
|
|
101 |
And I am on the "Announcements" "forum activity" page logged in as student1
|
|
|
102 |
And I press "Search"
|
|
|
103 |
And I should see "Please enter search terms into one or more of the following fields"
|
|
|
104 |
And I set the field "Is tagged with" to "SearchedTag"
|
|
|
105 |
When I press "Search"
|
|
|
106 |
Then I should see "My subject"
|
|
|
107 |
And I should not see "Your subjective"
|
|
|
108 |
|
|
|
109 |
@javascript
|
|
|
110 |
Scenario: Perform an advanced search on starred discussions without text
|
|
|
111 |
Given I am on the "Announcements" "forum activity" page logged in as student1
|
|
|
112 |
And I click on "Star this discussion" "link" in the "Your subjective" "table_row"
|
|
|
113 |
And I press "Search"
|
|
|
114 |
And I should see "Please enter search terms into one or more of the following fields"
|
|
|
115 |
And I set the field "starredonly" to "1"
|
|
|
116 |
When I press "Search"
|
|
|
117 |
Then I should not see "My message"
|
|
|
118 |
And I should see "Your subjective"
|
|
|
119 |
|
|
|
120 |
@javascript
|
|
|
121 |
Scenario: Perform an advanced search on starred discussions with text
|
|
|
122 |
Given I am on the "Announcements" "forum activity" page logged in as student1
|
|
|
123 |
And I click on "Star this discussion" "link" in the "Your subjective" "table_row"
|
|
|
124 |
And I press "Search"
|
|
|
125 |
And I should see "Please enter search terms into one or more of the following fields"
|
|
|
126 |
And I set the field "words" to "message"
|
|
|
127 |
And I set the field "starredonly" to "1"
|
|
|
128 |
When I press "Search"
|
|
|
129 |
Then I should not see "My message"
|
|
|
130 |
And I should see "Your subjective"
|