2 Feature: Users can add entries to database activities
3 In order to populate databases
5 I need to add entries to databases
8 Scenario: Students can add entries to a database
9 Given the following "users" exist:
10 | username | firstname | lastname | email |
11 | student1 | Student | 1 | student1@asd.com |
12 | teacher1 | Teacher | 1 | teacher1@asd.com |
13 And the following "courses" exist:
14 | fullname | shortname | category |
16 And the following "course enrolments" exist:
17 | user | course | role |
18 | teacher1 | C1 | editingteacher |
19 | student1 | C1 | student |
20 And the following "activities" exist:
21 | activity | name | intro | course | idnumber |
22 | data | Test database name | n | C1 | data1 |
23 And I log in as "teacher1"
24 And I follow "Course 1"
25 And I add a "Text input" field to "Test database name" database and I fill the form with:
26 | Field name | Test field name |
27 | Field description | Test field description |
28 # To generate the default templates.
29 And I follow "Templates"
31 When I log in as "student1"
32 And I follow "Course 1"
33 And I add an entry to "Test database name" database with:
34 | Test field description | Student original entry |
35 And I press "Save and view"
36 Then I should see "Student original entry"
38 And I set the following fields to these values:
39 | Test field description | Student edited entry |
40 And I press "Save and view"
41 And I should see "Student edited entry"
42 And I add an entry to "Test database name" database with:
43 | Test field description | Student second entry |
44 And I press "Save and add another"
45 And I add an entry to "Test database name" database with:
46 | Test field description | Student third entry |
47 And I press "Save and view"
48 And I follow "View list"
49 And I should see "Student edited entry"
50 And I should see "Student second entry"
51 And I should see "Student third entry"
52 # Will delete the first one.
55 And I should not see "Student edited entry"
56 And I should see "Student second entry"
57 And I should see "Student third entry"
58 # Now I will bulk delete the rest of the entries.
60 And I log in as "teacher1"
61 And I follow "Course 1"
62 And I follow "Test database name"
63 And I press "Select all"
64 And I press "Delete selected"
66 And I should see "No entries in database"