Proyectos de Subversion Moodle

Rev

| Ultima modificación | Ver Log |

Rev Autor Línea Nro. Línea
1 efrain 1
@repository @repository_contentbank @javascript
2
Feature: Search content bank files using the content bank files repository
3
  In order to find the content I need to select in the file picker
4
  As a user
5
  I need to be able to search in the content bank files repository by content name
6
 
7
  Background:
8
    Given the following "users" exist:
9
      | username | firstname | lastname | email                |
10
      | student  | Student   | 1        | student@example.com  |
11
      | teacher  | Teacher   | 1        | teacher1@example.com |
12
    And the following "categories" exist:
13
      | name      | category | idnumber |
14
      | Category1 | 0        | CAT1     |
15
      | Category2 | 0        | CAT2     |
16
    And the following "courses" exist:
17
      | fullname | shortname | category |
18
      | Course1  | C1        | CAT1     |
19
      | Course2  | C2        | CAT2     |
20
    And the following "contentbank content" exist:
21
      | contextlevel | reference | contenttype     | user  | contentname          | filepath                                    |
22
      | Course       | C1        | contenttype_h5p | admin | coursecontent1.h5p   | /h5p/tests/fixtures/filltheblanks.h5p       |
23
      | Course       | C2        | contenttype_h5p | admin | coursecontent2.h5p   | /h5p/tests/fixtures/find-the-words.h5p      |
24
      | Category     | CAT1      | contenttype_h5p | admin | categorycontent1.h5p | /h5p/tests/fixtures/ipsums.h5p              |
25
      | Category     | CAT2      | contenttype_h5p | admin | categorycontent2.h5p | /h5p/tests/fixtures/multiple-choice-2-6.h5p |
26
      | System       |           | contenttype_h5p | admin | systemcontent.h5p    | /h5p/tests/fixtures/greeting-card.h5p   |
27
    And the following "activities" exist:
28
      | activity | name       | intro      | introformat | course | idnumber |
29
      | folder   | Folder     | FolderDesc | 1           | C1     | folder   |
30
    And the following "course enrolments" exist:
31
      | user     | course | role           |
32
      | teacher  | C1     | editingteacher |
33
 
34
  Scenario: User can see a search field and reset search button in the content bank files repository
35
    Given I am on the Folder "Folder activity" page logged in as admin
36
    And I click on "Edit" "button"
37
    And I click on "Add..." "button"
38
    And I should see "Content bank" in the ".fp-repo-area" "css_element"
39
    When I select "Content bank" repository in file picker
40
    Then "Search repository" "field" should be visible
41
    And "Refresh" "link" should be visible
42
 
43
  Scenario: User can see search results when there is content that matches the search criteria
44
    Given I am on the Folder "Folder activity" page logged in as admin
45
    And I click on "Edit" "button"
46
    And I click on "Add..." "button"
47
    And I should see "Content bank" in the ".fp-repo-area" "css_element"
48
    And I select "Content bank" repository in file picker
49
    And I set the field "Search repository" to "content"
50
    When I press enter
51
    Then I should see "5" elements in repository content area
52
    And I should see "systemcontent.h5p" "file" in repository content area
53
    And I should see "categorycontent1.h5p" "file" in repository content area
54
    And I should see "categorycontent2.h5p" "file" in repository content area
55
    And I should see "coursecontent1.h5p" "file" in repository content area
56
    And I should see "coursecontent2.h5p" "file" in repository content area
57
 
58
  Scenario: User can see search results when there is content that matches the search criteria ignoring case sensitivity
59
    Given I am on the Folder "Folder activity" page logged in as admin
60
    And I click on "Edit" "button"
61
    And I click on "Add..." "button"
62
    And I should see "Content bank" in the ".fp-repo-area" "css_element"
63
    And I select "Content bank" repository in file picker
64
    And I set the field "Search repository" to "COURSE"
65
    When I press enter
66
    Then I should see "2" elements in repository content area
67
    And I should see "coursecontent1.h5p" "file" in repository content area
68
    And I should see "coursecontent2.h5p" "file" in repository content area
69
 
70
  Scenario: User can not see any search results when there is not a content that matches the search criteria
71
    Given I am on the Folder "Folder activity" page logged in as admin
72
    And I click on "Edit" "button"
73
    And I click on "Add..." "button"
74
    And I should see "Content bank" in the ".fp-repo-area" "css_element"
75
    And I select "Content bank" repository in file picker
76
    And I set the field "Search repository" to "somecontent"
77
    When I press enter
78
    Then I should see "0" elements in repository content area
79
    And I should see "No files available" in the ".filepicker .fp-content" "css_element"
80
 
81
  Scenario: User can reset search criteria and see all content displayed prior the search action
82
    Given I am on the Folder "Folder activity" page logged in as admin
83
    And I click on "Edit" "button"
84
    And I click on "Add..." "button"
85
    And I should see "Content bank" in the ".fp-repo-area" "css_element"
86
    And I select "Content bank" repository in file picker
87
    And I should see "1" elements in repository content area
88
    And I should see "coursecontent1.h5p" "file" in repository content area
89
    And I set the field "Search repository" to "category"
90
    And I press enter
91
    And I should see "2" elements in repository content area
92
    And I should see "categorycontent1.h5p" "file" in repository content area
93
    And I should see "categorycontent2.h5p" "file" in repository content area
94
    When I click on "Refresh" "link"
95
    Then I should see "1" elements in repository content area
96
    And I should see "coursecontent1.h5p" "file" in repository content area
97
 
98
  Scenario: Editing teacher can see search results when the content is available to him and matches the search criteria
99
    Given I am on the Folder "Folder activity" page logged in as teacher
100
    And I click on "Edit" "button"
101
    And I click on "Add..." "button"
102
    And I should see "Content bank" in the ".fp-repo-area" "css_element"
103
    And I select "Content bank" repository in file picker
104
    And I set the field "Search repository" to "content"
105
    When I press enter
106
    Then I should see "3" elements in repository content area
107
    And I should see "coursecontent1.h5p" "file" in repository content area
108
    And I should see "categorycontent1.h5p" "file" in repository content area
109
    And I should see "systemcontent.h5p" "file" in repository content area