MDL-68483 contentbank: improve search API
[moodle.git] / contentbank / tests / behat / search_content.feature
CommitLineData
f9b6849b
SA
1@core @core_contentbank @contentbank_h5p @_file_upload @javascript
2Feature: Search content in the content bank
3 In order to find easily content in the content bank
4 As an admin
5 I need to be able to search content in the content bank
6
7 Background:
8 Given the following "contentbank content" exist:
9 | contextid | contenttype | user | contentname |
10 | 1 | contenttype_h5p | admin | santjordi.h5p |
11 | 1 | contenttype_h5p | admin | santjordi_rose.h5p |
12 | 1 | contenttype_h5p | admin | SantJordi_book |
13 | 1 | contenttype_h5p | admin | Dragon_santjordi.h5p |
14 | 1 | contenttype_h5p | admin | princess.h5p |
15 | 1 | contenttype_h5p | admin | mathsbook.h5p |
16 | 1 | contenttype_h5p | admin | historybook.h5p |
17 | 1 | contenttype_h5p | admin | santvicenc.h5p |
18
19 Scenario: Admins can search content in the content bank
20 Given I log in as "admin"
21 And I am on site homepage
22 And I turn editing mode on
23 And I add the "Navigation" block if not present
24 And I expand "Site pages" node
25 And I click on "Content bank" "link"
26 And I should see "santjordi.h5p"
27 And "Clear search input" "button" should not exist
28 And I should not see "items found"
29 When I set the field "Search" to "book"
30 Then "Clear search input" "button" should exist
31 And I should see "3 items found"
32 And I should see "SantJordi_book"
33 And I should see "mathsbook.h5p"
34 And I should see "historybook.h5p"
35 And I set the field "Search" to "sant"
36 And "Clear search input" "button" should exist
37 And I should see "5 items found"
38 And I set the field "Search" to "santjordi"
39 And I should see "4 items found"
40 And I should see "santjordi.h5p"
41 And I should see "santjordi_rose.h5p"
42 And I should see "SantJordi_book"
43 And I should see "Dragon_santjordi.h5p"
44 And I click on "Clear search input" "button"
45 And "Clear search input" "button" should not exist
46 And I should not see "items found"
47 And I set the field "Search" to ".h5p"
48 And "Clear search input" "button" should exist
49 And I should see "7 items found"
50 And I set the field "Search" to "friend"
51 And I should see "0 items found"