2 Feature: Database entries can be searched using an advanced search form.
3 In order to find an entry
5 I need to have an advanced search form
8 Given the following "users" exist:
9 | username | firstname | lastname | email |
10 | teacher1 | Teacher | 1 | teacher1@example.com |
11 And the following "courses" exist:
12 | fullname | shortname | category |
14 And the following "course enrolments" exist:
15 | user | course | role |
16 | teacher1 | C1 | editingteacher |
17 And the following "activities" exist:
18 | activity | name | intro | course | idnumber |
19 | data | Test database name | n | C1 | data1 |
20 And the following "mod_data > fields" exist:
21 | database | type | name | description |
22 | data1 | text | My Field | Field 1 description |
23 | data1 | text | Their field | Field 2 description |
24 And the following "mod_data > entries" exist:
25 | database | user | My Field | Their field |
26 | data1 | teacher1 | First content | Owned content |
27 | data1 | teacher1 | Second content | Authored content |
28 And I am on the "Test database name" "data activity" page logged in as teacher1
29 And I should see "First content"
30 And I should see "Second content"
33 Scenario: Content can be searched using advanced search
34 Given I click on "Advanced search" "checkbox"
35 And I should see "My Field" in the "data_adv_form" "region"
36 And I should see "Their field" in the "data_adv_form" "region"
37 When I set the field "My Field" to "First"
38 And I click on "Save settings" "button" in the "data_adv_form" "region"
39 Then I should see "First content"
40 And I should not see "Second content"
43 Scenario: Advanced search template can use field information tags
44 Given I navigate to "Templates" in current page administration
45 And I set the field "Templates tertiary navigation" to "Advanced search template"
46 And I set the following fields to these values:
47 | Advanced search template | The test is on [[My Field#name]], [[My Field#description]], and the input [[My Field]] |
48 And I click on "Save" "button" in the "sticky-footer" "region"
49 And I navigate to "Database" in current page administration
50 And I should see "First content"
51 And I should see "Second content"
52 And I click on "Advanced search" "checkbox"
53 And I should see "The test is on My Field, Field 1 description, and the input" in the "data_adv_form" "region"
54 And I should not see "Their field" in the "data_adv_form" "region"
55 When I set the field "My Field" to "First"
56 And I click on "Save settings" "button" in the "data_adv_form" "region"
57 Then I should see "First content"
58 And I should not see "Second content"
61 Scenario: Advanced search can use otherfields tag
62 Given I navigate to "Templates" in current page administration
63 And I set the field "Templates tertiary navigation" to "Advanced search template"
64 And I set the following fields to these values:
65 | Advanced search template | Main search [[My Field]], Other fields ##otherfields## |
66 And I click on "Save" "button" in the "sticky-footer" "region"
67 And I navigate to "Database" in current page administration
68 And I should see "First content"
69 And I should see "Second content"
70 And I click on "Advanced search" "checkbox"
71 And I should see "Main search" in the "data_adv_form" "region"
72 And I should see "Other fields" in the "data_adv_form" "region"
73 And I should see "Their field" in the "data_adv_form" "region"
74 When I set the field "My Field" to "First"
75 And I click on "Save settings" "button" in the "data_adv_form" "region"
76 Then I should see "First content"
77 And I should not see "Second content"
78 And I set the field "My Field" to ""
79 And I set the field "Their field" to "Authored content"
80 And I click on "Save settings" "button" in the "data_adv_form" "region"
81 And I should not see "First content"
82 And I should see "Second content"