MDL-60953 search: Set solr as search engine for testing
[moodle.git] / search / tests / behat / search_query.feature
CommitLineData
e36eefae 1@core @core_search
2Feature: 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 |
b71ce360 10 | searchengine | solr |
7f9fb2c8 11 And the following "courses" exist:
12 | shortname | fullname |
13 | F1 | Amphibians |
e36eefae 14 And the following "activities" exist:
7f9fb2c8 15 | activity | name | intro | course | idnumber |
16 | page | PageName1 | PageDesc1 | F1 | PAGE1 |
17 | forum | ForumName1 | ForumDesc1 | F1 | FORUM1 |
e36eefae 18 And I log in as "admin"
19
20 @javascript
21 Scenario: Search from header search box with one result
22 Given global search expects the query "frogs" and will return:
23 | type | idnumber |
24 | activity | PAGE1 |
25 When I search for "frogs" using the header global search box
26 Then I should see "PageName1"
27 And I should see "PageDesc1"
28
29 # Check the link works.
30 And I follow "PageName1"
31 And I should see "PageName1" in the ".breadcrumb" "css_element"
32
33 @javascript
34 Scenario: Search from search page with two results
35 Given global search expects the query "zombies" and will return:
36 | nothing |
37 When I search for "zombies" using the header global search box
38 Then I should see "No results"
39 And I set the field "id_q" to "Toads"
40 And global search expects the query "Toads" and will return:
41 | type | idnumber |
42 | activity | FORUM1 |
43 | activity | PAGE1 |
44 # You cannot press "Search" because there's a fieldset with the same name that gets in the way.
45 And I press "id_submitbutton"
46 And I should see "ForumName1"
47 And I should see "ForumDesc1"
48 And I should see "PageName1"
49 And I should see "PageDesc1"
50
51 # Check the link works.
52 And I follow "ForumName1"
53 And I should see "ForumName1" in the ".breadcrumb" "css_element"
7f9fb2c8 54
55 @javascript
56 Scenario: Search starting from site context (no within option)
57 Given global search expects the query "frogs" and will return:
58 | type | idnumber |
59 | activity | PAGE1 |
60 When I search for "frogs" using the header global search box
61 And I expand all fieldsets
62 Then I should not see "Search within"
6f7daa5e 63 And I should see "Courses" in the "region-main" "region"
7f9fb2c8 64
65 @javascript
66 Scenario: Search starting from course context (within option lists course)
67 Given global search expects the query "frogs" and will return:
68 | type | idnumber |
69 | activity | PAGE1 |
70 When I am on "Amphibians" course homepage
71 And I search for "frogs" using the header global search box
72 And I expand all fieldsets
73 Then I should see "Search within"
74 And I select "Everywhere you can access" from the "Search within" singleselect
6f7daa5e 75 And I should see "Courses" in the "region-main" "region"
7f9fb2c8 76 And I select "Course: Amphibians" from the "Search within" singleselect
6f7daa5e 77 And I should not see "Courses" in the "region-main" "region"
7f9fb2c8 78
79 @javascript
80 Scenario: Search starting from forum context (within option lists course and forum)
81 Given global search expects the query "frogs" and will return:
82 | type | idnumber |
83 | activity | PAGE1 |
84 When I am on "Amphibians" course homepage
85 And I follow "ForumName1"
86 And I search for "frogs" using the header global search box
87 And I expand all fieldsets
88 And I should see "Search within"
89 And I select "Everywhere you can access" from the "Search within" singleselect
6f7daa5e 90 And I should see "Courses" in the "region-main" "region"
7f9fb2c8 91 And I select "Course: Amphibians" from the "Search within" singleselect
6f7daa5e 92 And I should not see "Courses" in the "region-main" "region"
7f9fb2c8 93 And I select "Forum: ForumName1" from the "Search within" singleselect
6f7daa5e 94 And I should not see "Courses" in the "region-main" "region"
3c49b0e6 95
96 @javascript
97 Scenario: Check that groups option in search form appears when intended
98 Given the following "groups" exist:
99 | name | course | idnumber |
100 | A Group | F1 | G1 |
101 | B Group | F1 | G2 |
102 And the following "activities" exist:
103 | activity | name | intro | course | idnumber | groupmode |
104 | forum | ForumSG | ForumDesc1 | F1 | FORUM2 | 1 |
105 When I am on "Amphibians" course homepage
106 And I follow "ForumSG"
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
b71ce360 112 Then I should not see "All groups" in the "region-main" "region"
3c49b0e6 113 And I select "Course: Amphibians" from the "Search within" singleselect
b71ce360 114 And I should see "All groups" in the "region-main" "region"
3c49b0e6 115 And I set the field "Groups" to "A Group"
116 And I select "Forum: ForumSG" from the "Search within" singleselect
b71ce360 117 And I should see "A Group" in the "region-main" "region"
3c49b0e6 118 And I am on "Amphibians" course homepage
119 And I follow "ForumName1"
120 And global search expects the query "frogs" and will return:
121 | type | idnumber |
122 | activity | PAGE1 |
123 And I search for "frogs" using the header global search box
124 And I expand all fieldsets
b71ce360 125 Then I should not see "All groups" in the "region-main" "region"
3c49b0e6 126 And I select "Course: Amphibians" from the "Search within" singleselect
b71ce360 127 And I should see "All groups" in the "region-main" "region"
3c49b0e6 128 And I select "Forum: ForumName1" from the "Search within" singleselect
b71ce360 129 And I should not see "All groups" in the "region-main" "region"