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
@core @core_badges @javascript
2
Feature: Manage badges
3
  In order to manage badges in the system
4
  As an admin
5
  I need to be able to edit, copy, enable/disable access, delete and award badges
6
 
7
  Background:
8
    Given the following "core_badges > Badge" exists:
9
      | name           | Badge #1                     |
10
      | status         | 0                            |
11
      | version        | 1.0                          |
12
      | language       | en                           |
13
      | description    | Test badge description       |
14
      | image          | badges/tests/behat/badge.png |
15
      | imagecaption   | Test caption image           |
16
 
17
  Scenario: Copy a badge
18
    Given I log in as "admin"
19
    And I navigate to "Badges > Manage badges" in site administration
20
    And I press "Copy" action in the "Badge #1" report row
21
    And I should see "Copy of Badge #1"
22
    And I press "Save changes"
23
    And I click on "Back" "button"
24
    Then the following should exist in the "reportbuilder-table" table:
1441 ariadna 25
      | Name             | Badge status  |
26
      | Badge #1         | Not available |
27
      | Copy of Badge #1 | Not available |
1 efrain 28
 
29
  Scenario: Edit a badge
30
    Given I log in as "admin"
31
    And I navigate to "Badges > Manage badges" in site administration
32
    And I press "Edit" action in the "Badge #1" report row
33
    And I set the following fields to these values:
34
      | Name    | New Badge #1 |
35
      | Version | 1.1          |
36
    And I press "Save changes"
37
    And I click on "Back" "button"
38
    Then the following should exist in the "reportbuilder-table" table:
1441 ariadna 39
      | Name          | Badge status  |
40
      | New Badge #1  | Not available |
41
    And I follow "New Badge #1"
42
    And I should see "1.1"
1 efrain 43
 
44
  Scenario: Delete a badge
45
    Given I log in as "admin"
46
    And I navigate to "Badges > Manage badges" in site administration
47
    And I press "Delete" action in the "Badge #1" report row
48
    And I press "Delete and remove existing issued badges"
1441 ariadna 49
    Then I should see "There are no matching badges available for users to earn."
1 efrain 50
 
51
  Scenario Outline: Filter managed badges
52
    Given the following "core_badges > Badges" exist:
1441 ariadna 53
      | name     | status | version | image                        |
54
      | Badge #2 | 1      | 2.0     | badges/tests/behat/badge.png |
1 efrain 55
    And I log in as "admin"
56
    When I navigate to "Badges > Manage badges" in site administration
57
    And I click on "Filters" "button"
58
    And I set the following fields in the "<filter>" "core_reportbuilder > Filter" to these values:
59
      | <filter> operator | Is equal to |
60
      | <filter> value    | <value>     |
61
    And I click on "Apply" "button" in the "[data-region='report-filters']" "css_element"
62
    Then I should see "Filters applied"
63
    And I should see "Badge #1" in the "Badges" "table"
64
    And I should not see "Badge #2" in the "Badges" "table"
65
    Examples:
66
      | filter       | value         |
67
      | Name         | Badge #1      |
68
      | Version      | 1.0           |
69
      | Badge status | Not available |
70
 
71
  Scenario: Enable and disable access to a badge
72
    Given I log in as "admin"
73
    And I navigate to "Badges > Manage badges" in site administration
74
    And I press "Edit" action in the "Badge #1" report row
75
    And I select "Criteria" from the "jump" singleselect
76
    And I set the field "type" to "Manual issue by role"
77
    And I set the field "Manager" to "1"
78
    And I press "Save"
79
    And I navigate to "Badges > Manage badges" in site administration
80
    And I press "Enable access" action in the "Badge #1" report row
1441 ariadna 81
    And I should see "This will make your badge visible to users and allow them to start earning it."
82
    And I click on "Enable" "button" in the "Confirm" "dialogue"
83
    And I should see "Access to badge 'Badge #1' enabled"
1 efrain 84
    Then the following should exist in the "reportbuilder-table" table:
85
      | Name      | Badge status  |
86
      | Badge #1  | Available     |
87
    And I press "Disable access" action in the "Badge #1" report row
1441 ariadna 88
    And I should see "Access to badge 'Badge #1' disabled"
1 efrain 89
    And the following should exist in the "reportbuilder-table" table:
90
      | Name      | Badge status  |
91
      | Badge #1  | Not available |
92
 
93
  Scenario: Award a badge
1441 ariadna 94
    Given the following "users" exist:
95
      | username | firstname | lastname | email             |
96
      | user1    | User      | One      | user1@example.com |
97
    When I log in as "admin"
1 efrain 98
    And I navigate to "Badges > Manage badges" in site administration
99
    And I press "Edit" action in the "Badge #1" report row
100
    And I select "Criteria" from the "jump" singleselect
101
    And I set the field "type" to "Manual issue by role"
102
    And I set the field "Manager" to "1"
103
    And I press "Save"
104
    And I navigate to "Badges > Manage badges" in site administration
105
    And I press "Enable access" action in the "Badge #1" report row
1441 ariadna 106
    And I click on "Enable" "button" in the "Confirm" "dialogue"
1 efrain 107
    And I press "Award badge" action in the "Badge #1" report row
1441 ariadna 108
    And I set the field "potentialrecipients[]" to "Admin User (moodle@example.com),User One (user1@example.com)"
1 efrain 109
    And I press "Award badge"
110
    And I navigate to "Badges > Manage badges" in site administration
1441 ariadna 111
    Then the following should exist in the "Badges" table:
1 efrain 112
      | Name      | Badge status  | Recipients |
1441 ariadna 113
      | Badge #1  | Available     | 2          |
114
    And I click on "2" "link" in the "Badge #1" "table_row"
115
    And the following should exist in the "Recipients" table:
116
      | -1-        |
117
      | Admin User |
118
      | User One   |
119
 
120
  @accessibility
121
  Scenario: View list of badges with recipients
122
    Given the following "users" exist:
123
      | username | firstname | lastname |
124
      | user1    | User      | One      |
125
      | user2    | User      | Two      |
126
    And the following "core_badges > Badges" exist:
127
      | name     | status | image                        |
128
      | Badge #2 | 1      | badges/tests/behat/badge.png |
129
      | Badge #3 | 1      | badges/tests/behat/badge.png |
130
    And the following "core_badges > Issued badges" exist:
131
      | badge    | user  |
132
      | Badge #1 | user1 |
133
      | Badge #1 | user2 |
134
      | Badge #2 | user1 |
135
    When I log in as "admin"
136
    And I navigate to "Badges > Manage badges" in site administration
137
    Then the following should exist in the "Badges" table:
138
      | Name     | Badge status  | Recipients |
139
      | Badge #1 | Not available | 2          |
140
      | Badge #2 | Available     | 1          |
141
      | Badge #3 | Available     | 0          |
142
    And the "Badges" "table" should meet accessibility standards with "best-practice" extra tests
143
 
144
  @_file_upload
145
  Scenario: Badge names are not unique anymore
146
    Given the following "courses" exist:
147
      | fullname | shortname | category |
148
      | Course 1 | C1        | 0        |
149
    And the following "core_badges > Badge" exists:
150
      | name           | Badge #2                     |
151
      | status         | 0                            |
152
      | course         | C1                           |
153
      | type           | 1                            |
154
      | version        | 1.0                          |
155
      | language       | en                           |
156
      | description    | Test badge description       |
157
      | image          | badges/tests/behat/badge.png |
158
      | imagecaption   | Test caption image           |
159
    And I log in as "admin"
160
    And I navigate to "Badges > Add a new badge" in site administration
161
    And I set the following fields to these values:
162
      | name           | Badge #1                     |
163
      | description    | Test badge description       |
164
    And I upload "badges/tests/behat/badge.png" file to "Image" filemanager
165
    When I press "Create badge"
166
    Then I should see "Criteria for this badge have not been set up yet."
167
    And I select "Edit details" from the "jump" singleselect
168
    # Set name for a site badge with existing badge name in a course is also allowed.
169
    And I set the field "name" to "Badge #2"
170
    And I press "Save changes"
171
    And I should see "Changes saved"