2 Feature: Users can view and search database entries
3 In order to find the database entries that I am looking for
5 I need to list and search the database entries
7 Scenario: Students can add view, list and search entries
8 Given the following "users" exist:
9 | username | firstname | lastname | email |
10 | student1 | Student | 1 | student1@asd.com |
11 | teacher1 | Teacher | 1 | teacher1@asd.com |
12 And the following "courses" exist:
13 | fullname | shortname | category |
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 | Test database name | n | C1 | data1 |
22 And I log in as "teacher1"
23 And I follow "Course 1"
24 And I add a "Text input" field to "Test database name" database and I fill the form with:
25 | Field name | Test field name |
26 | Field description | Test field description |
27 # To generate the default templates.
28 And I follow "Templates"
29 And I add an entry to "Test database name" database with:
30 | Test field name | Teacher entry 1 |
31 And I press "Save and add another"
32 And I add an entry to "Test database name" database with:
33 | Test field name | Teacher entry 2 |
34 And I press "Save and add another"
35 And I add an entry to "Test database name" database with:
36 | Test field name | Teacher entry 3 |
37 And I press "Save and view"
39 When I log in as "student1"
40 And I follow "Course 1"
41 And I follow "Test database name"
42 Then I should see "Teacher entry 1"
43 And I should see "Teacher entry 2"
44 And I should see "Teacher entry 3"
45 And I follow "View single"
46 And I should see "Teacher entry 1"
47 And I should not see "Teacher entry 2"
48 And "2" "link" should exist
49 And "3" "link" should exist
51 And I should see "Teacher entry 2"
52 And I should not see "Teacher entry 1"
54 And I should see "Teacher entry 3"
55 And I should not see "Teacher entry 2"
56 And I follow "Previous"
57 And I should see "Teacher entry 2"
58 And I should not see "Teacher entry 1"
59 And I should not see "Teacher entry 3"
61 And I set the field "Test field name" to "Teacher entry 1"
62 And I press "Save settings"
63 And I should see "Teacher entry 1"
64 And I should not see "Teacher entry 2"
65 And I should not see "Teacher entry 3"
67 And I set the field "Test field name" to "Teacher entry"
68 And I set the field "Order" to "Descending"
69 And I press "Save settings"
70 And "Teacher entry 3" "text" should appear before "Teacher entry 2" "text"
71 And "Teacher entry 2" "text" should appear before "Teacher entry 1" "text"