1 |
efrain |
1 |
@core @core_search
|
|
|
2 |
Feature: Use global search interface
|
|
|
3 |
In order to search for things
|
|
|
4 |
As a user
|
|
|
5 |
I need to be able to type search queries and see results
|
|
|
6 |
|
|
|
7 |
Background:
|
|
|
8 |
Given the following config values are set as admin:
|
|
|
9 |
| enableglobalsearch | 1 |
|
|
|
10 |
| searchengine | simpledb |
|
|
|
11 |
And the following "courses" exist:
|
|
|
12 |
| shortname | fullname |
|
|
|
13 |
| F1 | Amphibians |
|
|
|
14 |
And the following "activities" exist:
|
|
|
15 |
| activity | name | intro | course | idnumber |
|
|
|
16 |
| page | PageName1 frogs amphibians | PageDesc1 | F1 | PAGE1 |
|
|
|
17 |
| forum | ForumName1 toads amphibians | ForumDesc1 | F1 | FORUM1 |
|
|
|
18 |
And I update the global search index
|
|
|
19 |
And I log in as "admin"
|
|
|
20 |
|
|
|
21 |
@javascript
|
|
|
22 |
Scenario: Search from header search box with one result
|
|
|
23 |
When I search for "frogs" using the header global search box
|
|
|
24 |
Then I should see "PageName1"
|
|
|
25 |
And I should see "PageDesc1"
|
|
|
26 |
|
|
|
27 |
# Check the link works.
|
|
|
28 |
And I follow "PageName1"
|
|
|
29 |
And I should see "PageName1" in the ".breadcrumb" "css_element"
|
|
|
30 |
|
|
|
31 |
@javascript
|
|
|
32 |
Scenario: Search from search page with two results
|
|
|
33 |
When I search for "zombies" using the header global search box
|
|
|
34 |
Then I should see "No results"
|
|
|
35 |
And I set the field "id_q" to "amphibians"
|
|
|
36 |
# You cannot press "Search" because there's a fieldset with the same name that gets in the way.
|
|
|
37 |
And I press "id_submitbutton"
|
|
|
38 |
And I should see "ForumName1"
|
|
|
39 |
And I should see "ForumDesc1"
|
|
|
40 |
And I should see "PageName1"
|
|
|
41 |
And I should see "PageDesc1"
|
|
|
42 |
|
|
|
43 |
# Check the link works.
|
|
|
44 |
And I follow "ForumName1"
|
|
|
45 |
And I should see "ForumName1" in the ".breadcrumb" "css_element"
|
|
|
46 |
|
|
|
47 |
@javascript
|
|
|
48 |
Scenario: Search from search page with quotes
|
|
|
49 |
Given I search for "zombies" using the header global search box
|
|
|
50 |
And I should see "No results"
|
|
|
51 |
When I set the field "id_q" to "\"amphibians\""
|
|
|
52 |
# You cannot press "Search" because there's a fieldset with the same name that gets in the way.
|
|
|
53 |
And I press "id_submitbutton"
|
|
|
54 |
Then I should see "ForumName1"
|
|
|
55 |
And I should see "ForumDesc1"
|
|
|
56 |
And I should see "PageName1"
|
|
|
57 |
And I should see "PageDesc1"
|
|
|
58 |
# Check the link works.
|
|
|
59 |
And I follow "ForumName1"
|
|
|
60 |
And I should see "ForumName1" in the ".breadcrumb" "css_element"
|
|
|
61 |
|
|
|
62 |
@javascript
|
|
|
63 |
Scenario: Search starting from site context (no within option)
|
|
|
64 |
When I search for "frogs" using the header global search box
|
|
|
65 |
And I expand all fieldsets
|
|
|
66 |
Then I should not see "Search within"
|
|
|
67 |
And I should see "Courses" in the "region-main" "region"
|
|
|
68 |
|
|
|
69 |
@javascript
|
|
|
70 |
Scenario: Search starting from course context (within option lists course)
|
|
|
71 |
When I am on "Amphibians" course homepage
|
|
|
72 |
And I search for "frogs" using the header global search box
|
|
|
73 |
And I expand all fieldsets
|
|
|
74 |
Then I should see "Search within"
|
|
|
75 |
And I select "Everywhere you can access" from the "Search within" singleselect
|
|
|
76 |
And I should see "Courses" in the "region-main" "region"
|
|
|
77 |
And I select "Course: Amphibians" from the "Search within" singleselect
|
|
|
78 |
And I should not see "Courses" in the "region-main" "region"
|
|
|
79 |
|
|
|
80 |
@javascript
|
|
|
81 |
Scenario: Search starting from forum context (within option lists course and forum)
|
|
|
82 |
Given I am on the "ForumName1 toads amphibians" "Forum activity" page
|
|
|
83 |
When I search for "frogs" using the header global search box
|
|
|
84 |
Then I expand all fieldsets
|
|
|
85 |
And I should see "Search within"
|
|
|
86 |
And I select "Everywhere you can access" from the "Search within" singleselect
|
|
|
87 |
And I should see "Courses" in the "region-main" "region"
|
|
|
88 |
And I select "Course: Amphibians" from the "Search within" singleselect
|
|
|
89 |
And I should not see "Courses" in the "region-main" "region"
|
|
|
90 |
And I select "Forum: ForumName1" from the "Search within" singleselect
|
|
|
91 |
And I should not see "Courses" in the "region-main" "region"
|
|
|
92 |
|
|
|
93 |
@javascript
|
|
|
94 |
Scenario: Check that groups option in search form appears when intended
|
|
|
95 |
# Switch to mocked Solr search because simpledb doesn't support groups.
|
|
|
96 |
Given solr is installed
|
|
|
97 |
And the following config values are set as admin:
|
|
|
98 |
| searchengine | solr |
|
|
|
99 |
And the following "groups" exist:
|
|
|
100 |
| name | course | idnumber |
|
|
|
101 |
| A Group | F1 | G1 |
|
|
|
102 |
| B Group | F1 | G2 |
|
|
|
103 |
And the following "activities" exist:
|
|
|
104 |
| activity | name | course | idnumber | groupmode |
|
|
|
105 |
| forum | ForumSG | F1 | FORUM2 | 1 |
|
|
|
106 |
When I am on the ForumSG "Forum activity" page
|
|
|
107 |
And global search expects the query "frogs" and will return:
|
|
|
108 |
| type | idnumber |
|
|
|
109 |
| activity | PAGE1 |
|
|
|
110 |
And I search for "frogs" using the header global search box
|
|
|
111 |
And I expand all fieldsets
|
|
|
112 |
Then I should not see "All groups" in the "region-main" "region"
|
|
|
113 |
And I select "Course: Amphibians" from the "Search within" singleselect
|
|
|
114 |
And I should see "All groups" in the "region-main" "region"
|
|
|
115 |
And I set the field "Groups" to "A Group"
|
|
|
116 |
And I select "Forum: ForumSG" from the "Search within" singleselect
|
|
|
117 |
And I should see "A Group" in the "region-main" "region"
|
|
|
118 |
And I am on the "ForumName1 toads amphibians" "Forum activity" page
|
|
|
119 |
And global search expects the query "frogs" and will return:
|
|
|
120 |
| type | idnumber |
|
|
|
121 |
| activity | PAGE1 |
|
|
|
122 |
And I search for "frogs" using the header global search box
|
|
|
123 |
And I expand all fieldsets
|
|
|
124 |
Then I should not see "All groups" in the "region-main" "region"
|
|
|
125 |
And I select "Course: Amphibians" from the "Search within" singleselect
|
|
|
126 |
And I should see "All groups" in the "region-main" "region"
|
|
|
127 |
And I select "Forum: ForumName1" from the "Search within" singleselect
|
|
|
128 |
And I should not see "All groups" in the "region-main" "region"
|