1 |
efrain |
1 |
@mod @mod_data @datapreset @datapreset_resources
|
|
|
2 |
Feature: Users can use the Resources preset
|
|
|
3 |
In order to create a Resources database
|
|
|
4 |
As a user
|
|
|
5 |
I need to apply and use the Resources preset
|
|
|
6 |
|
|
|
7 |
Background:
|
|
|
8 |
Given the following "users" exist:
|
|
|
9 |
| username | firstname | lastname | email |
|
|
|
10 |
| student1 | Alice | Student | student1@example.com |
|
|
|
11 |
| teacher1 | Pau | Teacher | teacher1@example.com |
|
|
|
12 |
And the following "courses" exist:
|
|
|
13 |
| fullname | shortname | category |
|
|
|
14 |
| Course 1 | C1 | 0 |
|
|
|
15 |
And the following "course enrolments" exist:
|
|
|
16 |
| user | course | role |
|
|
|
17 |
| teacher1 | C1 | editingteacher |
|
|
|
18 |
| student1 | C1 | student |
|
|
|
19 |
And the following "activities" exist:
|
|
|
20 |
| activity | name | intro | course | idnumber |
|
|
|
21 |
| data | Student resources | Database intro | C1 | data1 |
|
|
|
22 |
And I am on the "Student resources" "data activity" page logged in as teacher1
|
|
|
23 |
And I follow "Presets"
|
|
|
24 |
And I click on "fullname" "radio" in the "Resources" "table_row"
|
|
|
25 |
And I click on "Use this preset" "button"
|
|
|
26 |
And the following "mod_data > entries" exist:
|
|
|
27 |
| database | user | Title | Description | Type | Author | Web link | Cover |
|
|
|
28 |
| data1 | student1 | My favourite book | Book content | Type1 | The book author | http://myfavouritebook.cat | first.png |
|
|
|
29 |
| data1 | teacher1 | My favourite podcast | Podcast content| Type2 | The podcast author | http://myfavouritepodcast.cat | second.png |
|
|
|
30 |
|
|
|
31 |
@javascript
|
|
|
32 |
Scenario: Resources. Users view entries
|
|
|
33 |
When I am on the "Student resources" "data activity" page logged in as student1
|
|
|
34 |
Then I should see "My favourite book"
|
|
|
35 |
And I should see "Type1"
|
|
|
36 |
And I should see "The book author"
|
|
|
37 |
And I should see "http://myfavouritebook.cat"
|
|
|
38 |
And I should not see "Book content"
|
|
|
39 |
And "Actions" "icon" should exist in the "#resources-list" "css_element"
|
|
|
40 |
And I should see "My favourite podcast"
|
|
|
41 |
And I should see "Type2"
|
|
|
42 |
And I should see "The podcast author"
|
|
|
43 |
And I should see "http://myfavouritepodcast.cat"
|
|
|
44 |
And I should not see "Podcast content"
|
|
|
45 |
# Single view.
|
|
|
46 |
And I select "Single view" from the "jump" singleselect
|
|
|
47 |
And I should see "My favourite book"
|
|
|
48 |
And I should see "Type1"
|
|
|
49 |
And I should see "The book author"
|
|
|
50 |
And I should see "http://myfavouritebook.cat"
|
|
|
51 |
And I should see "Book content"
|
|
|
52 |
And "Actions" "icon" should exist in the ".resources-single" "css_element"
|
|
|
53 |
And I should not see "My favourite podcast"
|
|
|
54 |
And I should not see "Type2"
|
|
|
55 |
And I should not see "The podcast author"
|
|
|
56 |
And I should not see "http://myfavouritepodcast.cat"
|
|
|
57 |
And I should not see "Podcast content"
|
|
|
58 |
And I follow "Next"
|
|
|
59 |
And I should see "My favourite podcast"
|
|
|
60 |
And I should see "Type2"
|
|
|
61 |
And I should see "The podcast author"
|
|
|
62 |
And I should see "http://myfavouritepodcast.cat"
|
|
|
63 |
And I should see "Podcast content"
|
|
|
64 |
# This student can't edit or delete this entry, so the Actions menu shouldn't be displayed.
|
|
|
65 |
And "Actions" "icon" should not exist in the ".resources-single" "css_element"
|
|
|
66 |
And I should not see "My favourite book"
|
|
|
67 |
And I should not see "Type1"
|
|
|
68 |
And I should not see "The book author"
|
|
|
69 |
And I should not see "http://myfavouritebook.cat"
|
|
|
70 |
And I should not see "Book content"
|
|
|
71 |
|
|
|
72 |
@javascript
|
|
|
73 |
Scenario: Resources. Users can search entries
|
|
|
74 |
Given I am on the "Student resources" "data activity" page logged in as student1
|
|
|
75 |
And "My favourite book" "text" should appear before "My favourite podcast" "text"
|
|
|
76 |
When I click on "Advanced search" "checkbox"
|
|
|
77 |
And I should see "First name"
|
|
|
78 |
And I should see "Last name"
|
|
|
79 |
And I set the field "Title" to "book"
|
|
|
80 |
And I click on "Save settings" "button" in the "data_adv_form" "region"
|
|
|
81 |
Then I should see "My favourite book"
|
|
|
82 |
And I should not see "My favourite podcast"
|
|
|
83 |
But I set the field "Title" to "favourite"
|
|
|
84 |
And I set the field "Order" to "Descending"
|
|
|
85 |
And I click on "Save settings" "button" in the "data_adv_form" "region"
|
|
|
86 |
And "My favourite podcast" "text" should appear before "My favourite book" "text"
|
|
|
87 |
|
|
|
88 |
@javascript
|
|
|
89 |
Scenario: Resources. Users can add entries
|
|
|
90 |
Given I am on the "Student resources" "data activity" page logged in as student1
|
|
|
91 |
When I press "Add entry"
|
|
|
92 |
And I set the field "Title" to "This is the title"
|
|
|
93 |
And I set the field "Author" to "This is the author"
|
|
|
94 |
And I set the field "Description" to "This is description."
|
|
|
95 |
And I set the field "Web link" to "https://thisisthelink.cat"
|
|
|
96 |
And I set the field "Type" to "Type2"
|
|
|
97 |
And I press "Save"
|
|
|
98 |
Then I should see "This is the title"
|
|
|
99 |
And I should see "This is the author"
|
|
|
100 |
And I should see "https://thisisthelink.cat"
|
|
|
101 |
And I should see "Type2"
|
|
|
102 |
|
|
|
103 |
@javascript
|
|
|
104 |
Scenario: Resources. Renaming a field should affect the template
|
|
|
105 |
Given I am on the "Student resources" "data activity" page logged in as teacher1
|
|
|
106 |
And I navigate to "Fields" in current page administration
|
|
|
107 |
And I open the action menu in "Type" "table_row"
|
|
|
108 |
And I choose "Edit" in the open action menu
|
|
|
109 |
And I set the field "Field name" to "Edited field name"
|
|
|
110 |
And I press "Save"
|
|
|
111 |
And I should see "Field updated"
|
|
|
112 |
When I navigate to "Database" in current page administration
|
|
|
113 |
Then I click on "Advanced search" "checkbox"
|
|
|
114 |
And I should see "Edited field name"
|
|
|
115 |
And I click on "Add entry" "button"
|
|
|
116 |
And I should see "Edited field name"
|
|
|
117 |
|
|
|
118 |
@javascript
|
|
|
119 |
Scenario: Resources. Has otherfields tag
|
|
|
120 |
Given the following "mod_data > fields" exist:
|
|
|
121 |
| database | type | name | description |
|
|
|
122 |
| data1 | text | Extra field | Test field description |
|
|
|
123 |
And I am on the "Student resources" "data activity" page logged in as teacher1
|
|
|
124 |
When I select "Single view" from the "jump" singleselect
|
|
|
125 |
Then I should see "Extra field"
|
|
|
126 |
And I click on "Add entry" "button"
|
|
|
127 |
And I should see "Extra field"
|