Commit | Line | Data |
---|---|---|
f2cc870f DM |
1 | @mod @mod_data |
2 | Feature: Users can add entries to database activities | |
3 | In order to populate databases | |
4 | As a user | |
5 | I need to add entries to databases | |
6 | ||
1be2350a | 7 | Background: |
f2cc870f DM |
8 | Given the following "users" exist: |
9 | | username | firstname | lastname | email | | |
0fe86bbd RT |
10 | | student1 | Student | 1 | student1@example.com | |
11 | | teacher1 | Teacher | 1 | teacher1@example.com | | |
f2cc870f DM |
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 | Test database name | n | C1 | data1 | | |
1be2350a SA |
22 | |
23 | @javascript | |
24 | Scenario: Students can add entries to a database | |
25 | Given I log in as "teacher1" | |
fdeeaff9 | 26 | And I am on "Course 1" course homepage |
f2cc870f DM |
27 | And I add a "Text input" field to "Test database name" database and I fill the form with: |
28 | | Field name | Test field name | | |
29 | | Field description | Test field description | | |
9b5e702a JO |
30 | And I add a "Text input" field to "Test database name" database and I fill the form with: |
31 | | Field name | Test field 2 name | | |
32 | | Field description | Test field 2 description | | |
f2cc870f DM |
33 | # To generate the default templates. |
34 | And I follow "Templates" | |
dc90838a | 35 | And I wait until the page is ready |
f2cc870f DM |
36 | And I log out |
37 | When I log in as "student1" | |
fdeeaff9 | 38 | And I am on "Course 1" course homepage |
f2cc870f | 39 | And I add an entry to "Test database name" database with: |
1c3b2058 | 40 | | Test field name | Student original entry | |
9b5e702a | 41 | | Test field 2 name | Student original entry 2 | |
f2cc870f DM |
42 | And I press "Save and view" |
43 | Then I should see "Student original entry" | |
44 | And I follow "Edit" | |
9b5e702a JO |
45 | And I set the following fields to these values: |
46 | | Test field name | Student original entry | | |
47 | | Test field 2 name | | | |
48 | And I press "Save and view" | |
49 | Then I should not see "Student original entry 2" | |
50 | And I follow "Edit" | |
f2cc870f | 51 | And I set the following fields to these values: |
1c3b2058 | 52 | | Test field name | Student edited entry | |
f2cc870f DM |
53 | And I press "Save and view" |
54 | And I should see "Student edited entry" | |
55 | And I add an entry to "Test database name" database with: | |
1c3b2058 | 56 | | Test field name | Student second entry | |
f2cc870f | 57 | And I press "Save and add another" |
f27ca945 | 58 | And the field "Test field name" does not match value "Student second entry" |
f2cc870f | 59 | And I add an entry to "Test database name" database with: |
1c3b2058 | 60 | | Test field name | Student third entry | |
f2cc870f DM |
61 | And I press "Save and view" |
62 | And I follow "View list" | |
63 | And I should see "Student edited entry" | |
64 | And I should see "Student second entry" | |
65 | And I should see "Student third entry" | |
66 | # Will delete the first one. | |
67 | And I follow "Delete" | |
68 | And I press "Delete" | |
69 | And I should not see "Student edited entry" | |
70 | And I should see "Student second entry" | |
71 | And I should see "Student third entry" | |
c1d222fc AG |
72 | # Now I will bulk delete the rest of the entries. |
73 | And I log out | |
74 | And I log in as "teacher1" | |
fdeeaff9 | 75 | And I am on "Course 1" course homepage |
c1d222fc AG |
76 | And I follow "Test database name" |
77 | And I press "Select all" | |
78 | And I press "Delete selected" | |
79 | And I press "Delete" | |
7afd16ad | 80 | And I should see "No entries in database" |
1be2350a SA |
81 | |
82 | @javascript @editor @editor_atto @atto @atto_h5p | |
83 | Scenario: If a new text area entry is added, the filepicker is displayed in the H5P Atto button | |
84 | Given I log in as "teacher1" | |
85 | And I am on "Course 1" course homepage | |
86 | And I add a "Text area" field to "Test database name" database and I fill the form with: | |
87 | | Field name | Textarea field name | | |
88 | When I add an entry to "Test database name" database with: | |
89 | | Textarea field name | This is the content | | |
90 | And I click on "Insert H5P" "button" | |
91 | Then I should see "Browse repositories..." |