Commit | Line | Data |
---|---|---|
1e93eb58 SB |
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 | | |
15 | | Course 1 | C1 | 0 | | |
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 I log in as "teacher1" | |
c987d1b2 | 22 | And I am on course page "Course 1" |
ba5c5083 DW |
23 | And I turn editing mode on |
24 | And I add the "Latest announcements" block | |
1e93eb58 SB |
25 | And I navigate to "Edit settings" node in "Course administration" |
26 | And I set the field "id_newsitems" to "1" | |
27 | And I press "Save and display" | |
28 | And I add a new topic to "Announcements" forum with: | |
29 | | Subject | My subject | | |
30 | | Message | My message | | |
c987d1b2 | 31 | And I am on course page "Course 1" |
1e93eb58 SB |
32 | And I add a new topic to "Announcements" forum with: |
33 | | Subject | My subjective| | |
34 | | Message | My long message | | |
35 | And I log out | |
36 | ||
37 | Scenario: Perform an advanced search using any term | |
38 | Given I log in as "student1" | |
c987d1b2 | 39 | And I am on course page "Course 1" |
1e93eb58 SB |
40 | And I follow "Announcements" |
41 | And I press "Search forums" | |
42 | And I should see "Advanced search" | |
43 | And I set the field "words" to "subject" | |
44 | When I press "Search forums" | |
45 | Then I should see "My subject" | |
46 | And I should see "My subjective" | |
47 | ||
48 | Scenario: Perform an advanced search avoiding words | |
49 | Given I log in as "student1" | |
c987d1b2 | 50 | And I am on course page "Course 1" |
1e93eb58 SB |
51 | And I follow "Announcements" |
52 | And I press "Search forums" | |
53 | And I should see "Advanced search" | |
54 | And I set the field "words" to "My" | |
55 | And I set the field "notwords" to "subjective" | |
56 | When I press "Search forums" | |
57 | Then I should see "My subject" | |
58 | And I should not see "My subjective" | |
59 | ||
60 | Scenario: Perform an advanced search using whole words | |
99ad3223 RT |
61 | Given database family used is one of the following: |
62 | | mysql | | |
63 | | postgres | | |
64 | And I log in as "student1" | |
c987d1b2 | 65 | And I am on course page "Course 1" |
1e93eb58 SB |
66 | And I follow "Announcements" |
67 | And I press "Search forums" | |
68 | And I should see "Advanced search" | |
69 | And I set the field "fullwords" to "subject" | |
70 | When I press "Search forums" | |
71 | Then I should see "My subject" | |
72 | And I should not see "My subjective" | |
73 | ||
74 | Scenario: Perform an advanced search matching the subject | |
75 | Given I log in as "student1" | |
c987d1b2 | 76 | And I am on course page "Course 1" |
1e93eb58 SB |
77 | And I follow "Announcements" |
78 | And I press "Search forums" | |
79 | And I should see "Advanced search" | |
80 | And I set the field "subject" to "subjective" | |
81 | When I press "Search forums" | |
82 | Then I should not see "My message" | |
83 | And I should see "My subjective" | |
84 | ||
85 | Scenario: Perform an advanced search matching the author | |
86 | Given I log in as "teacher2" | |
c987d1b2 | 87 | And I am on course page "Course 1" |
1e93eb58 SB |
88 | And I add a new topic to "Announcements" forum with: |
89 | | Subject | My Subjects | | |
90 | | Message | My message | | |
91 | And I log out | |
92 | When I log in as "student1" | |
c987d1b2 | 93 | And I am on course page "Course 1" |
1e93eb58 SB |
94 | And I follow "Announcements" |
95 | And I press "Search forums" | |
96 | And I should see "Advanced search" | |
97 | And I set the field "user" to "TWO" | |
98 | And I press "Search forums" | |
99 | Then I should see "Teacher TWO" | |
100 | And I should not see "Teacher ONE" | |
101 | ||
102 | Scenario: Perform an advanced search with multiple words | |
103 | Given I log in as "student1" | |
c987d1b2 | 104 | And I am on course page "Course 1" |
1e93eb58 SB |
105 | And I follow "Announcements" |
106 | And I press "Search forums" | |
107 | And I should see "Advanced search" | |
108 | And I set the field "subject" to "my subjective" | |
109 | When I press "Search forums" | |
110 | Then I should not see "My message" | |
111 | And I should see "My subjective" |