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@example.com |
12 | teacher1 | Teacher | 1 | teacher1@example.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 am on "Course 1" course homepage
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 And I add a "Text input" field to "Test database name" database and I fill the form with:
29 | Field name | Test field 2 name |
30 | Field description | Test field 2 description |
31 # To generate the default templates.
32 And I follow "Templates"
33 And I wait until the page is ready
35 When I log in as "student1"
36 And I am on "Course 1" course homepage
37 And I add an entry to "Test database name" database with:
38 | Test field name | Student original entry |
39 | Test field 2 name | Student original entry 2 |
40 And I press "Save and view"
41 Then I should see "Student original entry"
43 And I set the following fields to these values:
44 | Test field name | Student original entry |
45 | Test field 2 name | |
46 And I press "Save and view"
47 Then I should not see "Student original entry 2"
49 And I set the following fields to these values:
50 | Test field name | Student edited entry |
51 And I press "Save and view"
52 And I should see "Student edited entry"
53 And I add an entry to "Test database name" database with:
54 | Test field name | Student second entry |
55 And I press "Save and add another"
56 And the field "Test field name" does not match value "Student second entry"
57 And I add an entry to "Test database name" database with:
58 | Test field name | Student third entry |
59 And I press "Save and view"
60 And I follow "View list"
61 And I should see "Student edited entry"
62 And I should see "Student second entry"
63 And I should see "Student third entry"
64 # Will delete the first one.
67 And I should not see "Student edited entry"
68 And I should see "Student second entry"
69 And I should see "Student third entry"
70 # Now I will bulk delete the rest of the entries.
72 And I log in as "teacher1"
73 And I am on "Course 1" course homepage
74 And I follow "Test database name"
75 And I press "Select all"
76 And I press "Delete selected"
78 And I should see "No entries in database"