Proyectos de Subversion Moodle

Rev

Rev 1 | | Comparar con el anterior | Ultima modificación | Ver Log |

Rev Autor Línea Nro. Línea
1 efrain 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
 
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
    And the following "activities" exist:
20
      | activity | name               | intro | course | idnumber |
21
      | data     | Test database name | n     | C1     | data1    |
22
 
23
  @javascript
24
  Scenario: Students can add entries to a database
25
    Given the following "mod_data > fields" exist:
26
      | database | type | name              | description              |
27
      | data1    | text | Test field name   | Test field description   |
28
      | data1    | text | Test field 2 name | Test field 2 description |
29
    And the following "mod_data > templates" exist:
30
      | database | name            |
31
      | data1    | singletemplate  |
32
      | data1    | listtemplate    |
33
      | data1    | addtemplate     |
34
      | data1    | asearchtemplate |
35
      | data1    | rsstemplate     |
36
    And the following "mod_data > entries" exist:
37
      | database | user     | Test field name        | Test field 2 name        |
38
      | data1    | student1 | Student original entry | Student original entry 2 |
39
    And I am on the "data1" Activity page logged in as student1
40
    And I open the action menu in "#data-listview-content" "css_element"
41
    And I choose "Edit" in the open action menu
42
    And I set the following fields to these values:
43
      | Test field name   | Student original entry |
44
      | Test field 2 name |                        |
45
    And I press "Save"
46
    Then I should not see "Student original entry 2"
47
    And I open the action menu in "#data-singleview-content" "css_element"
48
    And I choose "Edit" in the open action menu
49
    And I set the following fields to these values:
50
      | Test field name | Student edited entry |
51
    And I press "Save"
52
    And I should see "Student edited entry"
53
    And the following "mod_data > entries" exist:
54
      | database | user     | Test field name        | Test field 2 name |
55
      | data1    | student1 | Student second entry   |                   |
56
      | data1    | student1 | Student third entry    |                   |
57
    And I am on the "data1" Activity page logged in as student1
58
    And I should see "Student edited entry"
59
    And I should see "Student second entry"
60
    And I should see "Student third entry"
61
    # Will delete the first one.
62
    And I open the action menu in ".defaulttemplate-listentry" "css_element"
63
    And I choose "Delete" in the open action menu
64
    And I press "Delete"
65
    And I should not see "Student edited entry"
66
    And I should see "Student second entry"
67
    And I should see "Student third entry"
68
 
11 efrain 69
  @javascript
70
  Scenario: If a new text area entry is added, the filepicker is displayed in the H5P editor dialogue
1 efrain 71
    Given the following "mod_data > fields" exist:
72
      | database | type     | name                |
73
      | data1    | textarea | Textarea field name |
74
    And the following "mod_data > templates" exist:
75
      | database | name            |
76
      | data1    | singletemplate  |
77
      | data1    | listtemplate    |
78
      | data1    | addtemplate     |
79
      | data1    | asearchtemplate |
80
      | data1    | rsstemplate     |
81
    And I am on the "Course 1" course page logged in as teacher1
82
    When I click on "Test database name" "link"
83
    And I click on "Add entry" "button"
11 efrain 84
    And I click on "Configure H5P content" "button"
85
    Then I should see "Browse repositories..." in the "Insert H5P content" "dialogue"
1 efrain 86
 
87
  @javascript
88
  Scenario: If maximum number of entries is set other than None then add entries should be seen only if number of entries is less than it
89
    Given the following "mod_data > fields" exist:
90
      | database | type | name  |
91
      | data1    | text | Test1 |
92
    And the following "mod_data > templates" exist:
93
      | database | name            |
94
      | data1    | singletemplate  |
95
      | data1    | listtemplate    |
96
      | data1    | addtemplate     |
97
      | data1    | asearchtemplate |
98
      | data1    | rsstemplate     |
99
    And the following "mod_data > entries" exist:
100
      | database | user     | Test1 |
101
      | data1    | student1 | foo   |
102
      | data1    | student1 | bar   |
103
    And I am on the "Test database name" "data activity" page logged in as teacher1
104
    And I navigate to "Settings" in current page administration
105
    And I expand all fieldsets
106
    And I set the following fields to these values:
107
      | Maximum number of entries | 2 |
108
    And I press "Save and display"
109
    And I log out
110
    When I am on the "Test database name" "data activity" page logged in as student1
111
    Then I should not see "Add entry"
112
    And I log out
113
    And I am on the "Test database name" "data activity" page logged in as teacher1
114
    And I navigate to "Settings" in current page administration
115
    And I expand all fieldsets
116
    And I set the following fields to these values:
117
      | Maximum number of entries | 3 |
118
    And I press "Save and display"
119
    And I log out
120
    And I am on the "Test database name" "data activity" page logged in as student1
121
    And I should see "Add entry"
122
 
123
  @javascript
124
  Scenario: Guest user cannot add entries to a database
125
    Given the following "mod_data > fields" exist:
126
      | database | type | name                |
127
      | data1    | text | Textarea field name |
128
    And the following "mod_data > templates" exist:
129
      | database | name            |
130
      | data1    | singletemplate  |
131
      | data1    | listtemplate    |
132
      | data1    | addtemplate     |
133
      | data1    | asearchtemplate |
134
      | data1    | rsstemplate     |
135
    And I am on the "Course 1" "enrolment methods" page logged in as teacher1
136
    And I click on "Enable" "link" in the "Guest access" "table_row"
137
    And I log out
138
    When I am on the "Test database name" "data activity" page logged in as "guest"
139
    Then I should not see "Add entry"
140
 
141
  @javascript
142
  Scenario Outline: Users see the Add entry button in the view page when some field has been created only.
143
    Given I am on the "Test database name" "data activity" page logged in as <user>
144
    And I should not see "Add entry"
145
    And I log out
146
    When the following "mod_data > fields" exist:
147
      | database | type | name              | description              |
148
      | data1    | text | Test field name   | Test field description   |
149
    Then I am on the "Test database name" "data activity" page logged in as <user>
150
    And I should see "Add entry"
151
 
152
    Examples:
153
      | user     |
154
      | teacher1 |
155
      | student1 |