1 |
efrain |
1 |
@mod @mod_data
|
|
|
2 |
Feature: Users can edit approved entries in database activities
|
|
|
3 |
In order to control whether approved database entries can be changed
|
|
|
4 |
As a teacher
|
|
|
5 |
I need to be able to enable or disable management of approved entries
|
|
|
6 |
|
|
|
7 |
Background:
|
|
|
8 |
Given the following "users" exist:
|
|
|
9 |
| username | firstname | lastname | email |
|
|
|
10 |
| student1 | Student | 1 | student1@example.com |
|
|
|
11 |
| teacher1 | Teacher | 1 | 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 |
|
|
|
20 |
@javascript
|
|
|
21 |
Scenario: Students can manage their approved entries to a database
|
|
|
22 |
Given the following "activity" exists:
|
|
|
23 |
| activity | data |
|
|
|
24 |
| course | C1 |
|
|
|
25 |
| idnumber | Test database name |
|
|
|
26 |
| name | Test database name |
|
|
|
27 |
| approval | 1 |
|
|
|
28 |
| manageapproved | 1 |
|
|
|
29 |
And the following "mod_data > fields" exist:
|
|
|
30 |
| database | type | name | description |
|
|
|
31 |
| Test database name | text | Test field name | Test field description |
|
|
|
32 |
And the following "mod_data > templates" exist:
|
|
|
33 |
| database | name |
|
|
|
34 |
| Test database name | singletemplate |
|
|
|
35 |
| Test database name | listtemplate |
|
|
|
36 |
| Test database name | addtemplate |
|
|
|
37 |
| Test database name | asearchtemplate |
|
|
|
38 |
| Test database name | rsstemplate |
|
|
|
39 |
And the following "mod_data > entries" exist:
|
|
|
40 |
| database | user | Test field name |
|
|
|
41 |
| Test database name | student1 | Student entry |
|
|
|
42 |
# Approve the student's entry as a teacher.
|
|
|
43 |
And I am on the "Test database name" "data activity" page logged in as teacher1
|
|
|
44 |
And I open the action menu in ".defaulttemplate-listentry" "css_element"
|
|
|
45 |
And I choose "Approve" in the open action menu
|
|
|
46 |
And I log out
|
|
|
47 |
# Make sure the student can still edit their entry after it's approved.
|
|
|
48 |
When I am on the "Test database name" "data activity" page logged in as student1
|
|
|
49 |
Then I should see "Student entry"
|
|
|
50 |
And "Edit" "link" should exist
|
|
|
51 |
|
|
|
52 |
@javascript
|
|
|
53 |
Scenario: Students can not manage their approved entries to a database
|
|
|
54 |
# Create database activity and don't allow editing of approved entries.
|
|
|
55 |
Given the following "activity" exists:
|
|
|
56 |
| activity | data |
|
|
|
57 |
| course | C1 |
|
|
|
58 |
| idnumber | Test database name |
|
|
|
59 |
| name | Test database name |
|
|
|
60 |
| approval | 1 |
|
|
|
61 |
| manageapproved | 0 |
|
|
|
62 |
And the following "mod_data > fields" exist:
|
|
|
63 |
| database | type | name | description |
|
|
|
64 |
| Test database name | text | Test field name | Test field description |
|
|
|
65 |
And the following "mod_data > templates" exist:
|
|
|
66 |
| database | name |
|
|
|
67 |
| Test database name | singletemplate |
|
|
|
68 |
| Test database name | listtemplate |
|
|
|
69 |
| Test database name | addtemplate |
|
|
|
70 |
| Test database name | asearchtemplate |
|
|
|
71 |
| Test database name | rsstemplate |
|
|
|
72 |
And the following "mod_data > entries" exist:
|
|
|
73 |
| database | user | Test field name |
|
|
|
74 |
| Test database name | student1 | Student entry |
|
|
|
75 |
# Approve the student's entry as a teacher.
|
|
|
76 |
And I am on the "Test database name" "data activity" page logged in as teacher1
|
|
|
77 |
And I open the action menu in ".defaulttemplate-listentry" "css_element"
|
|
|
78 |
And I choose "Approve" in the open action menu
|
|
|
79 |
And I log out
|
|
|
80 |
# Make sure the student isn't able to edit their entry after it's approved.
|
|
|
81 |
When I am on the "Test database name" "data activity" page logged in as student1
|
|
|
82 |
Then "Edit" "link" should not exist
|
|
|
83 |
And I should see "Student entry"
|