on-demand release 4.0dev+
[moodle.git] / contentbank / tests / behat / search_content.feature
CommitLineData
39263ddb 1@core @core_contentbank @core_h5p @contentbank_h5p @_file_upload @javascript
f9b6849b
SA
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:
f3d43c76
SA
8 Given I log in as "admin"
9 And I navigate to "H5P > Manage H5P content types" in site administration
10 And I upload "h5p/tests/fixtures/filltheblanks.h5p" file to "H5P content type" filemanager
11 And I click on "Upload H5P content types" "button" in the "#fitem_id_uploadlibraries" "css_element"
12 And the following "contentbank content" exist:
13 | contextlevel | reference | contenttype | user | contentname | filepath |
14 | System | | contenttype_h5p | admin | santjordi.h5p | /h5p/tests/fixtures/filltheblanks.h5p |
15 | System | | contenttype_h5p | admin | santjordi_rose.h5p | /h5p/tests/fixtures/filltheblanks.h5p |
16 | System | | contenttype_h5p | admin | SantJordi_book | /h5p/tests/fixtures/filltheblanks.h5p |
17 | System | | contenttype_h5p | admin | Dragon_santjordi.h5p | /h5p/tests/fixtures/filltheblanks.h5p |
18 | System | | contenttype_h5p | admin | princess.h5p | /h5p/tests/fixtures/filltheblanks.h5p |
19 | System | | contenttype_h5p | admin | mathsbook.h5p | /h5p/tests/fixtures/filltheblanks.h5p |
20 | System | | contenttype_h5p | admin | historybook.h5p | /h5p/tests/fixtures/filltheblanks.h5p |
21 | System | | contenttype_h5p | admin | santvicenc.h5p | /h5p/tests/fixtures/filltheblanks.h5p |
f9b6849b
SA
22
23 Scenario: Admins can search content in the content bank
f3d43c76 24 Given I am on site homepage
f9b6849b
SA
25 And I turn editing mode on
26 And I add the "Navigation" block if not present
27 And I expand "Site pages" node
28 And I click on "Content bank" "link"
29 And I should see "santjordi.h5p"
d0bea8aa 30 And "Clear search input" "button" should not be visible
f9b6849b
SA
31 And I should not see "items found"
32 When I set the field "Search" to "book"
d0bea8aa
AA
33 # Waiting for the animation to show the button to finish.
34 And I wait "1" seconds
35 Then "Clear search input" "button" should be visible
f9b6849b
SA
36 And I should see "3 items found"
37 And I should see "SantJordi_book"
38 And I should see "mathsbook.h5p"
39 And I should see "historybook.h5p"
40 And I set the field "Search" to "sant"
d0bea8aa 41 And "Clear search input" "button" should be visible
f9b6849b
SA
42 And I should see "5 items found"
43 And I set the field "Search" to "santjordi"
44 And I should see "4 items found"
45 And I should see "santjordi.h5p"
46 And I should see "santjordi_rose.h5p"
47 And I should see "SantJordi_book"
48 And I should see "Dragon_santjordi.h5p"
49 And I click on "Clear search input" "button"
d0bea8aa
AA
50 # Waiting for the animation to hide the button to finish.
51 And I wait "1" seconds
52 And "Clear search input" "button" should not be visible
f9b6849b
SA
53 And I should not see "items found"
54 And I set the field "Search" to ".h5p"
d0bea8aa
AA
55 # Waiting for the animation to show the button to finish.
56 And I wait "1" seconds
57 And "Clear search input" "button" should be visible
f9b6849b
SA
58 And I should see "7 items found"
59 And I set the field "Search" to "friend"
60 And I should see "0 items found"