Proyectos de Subversion Moodle

Rev

| Ultima modificación | Ver Log |

Rev Autor Línea Nro. Línea
1 efrain 1
@core @core_badges
2
Feature: Award badges based on competency completion
3
  In order to award badges to users based on competency completion
4
  As an admin
5
  I need to add competency completion criteria to badges in the system
6
 
7
  Background: Setup the competency framework and the course
8
    Given the following "users" exist:
9
      | username | firstname | lastname | email           |
10
      | user1    | First     | User     | first@example.com  |
11
    And the following "courses" exist:
12
      | fullname | shortname | category |
13
      | Course 1 | C1 | 0 |
14
    And the following "course enrolments" exist:
15
      | user | course | role |
16
      | user1 | C1 | student |
17
    And the following lp "frameworks" exist:
18
      | shortname | idnumber |
19
      | Framework 1 | sc-y-2 |
20
    And the following lp "competencies" exist:
21
      | shortname | framework |
22
      | comp1 | sc-y-2 |
23
      | comp2 | sc-y-2 |
24
    And I log in as "admin"
25
 
26
  @javascript
27
  Scenario: Award badge for completing a competency in a course
28
    Given the following "core_badges > Badge" exists:
29
      | name        | Course Badge                 |
30
      | status      | 0                            |
31
      | type        | 2                            |
32
      | course      | C1                           |
33
      | description | Course badge description     |
34
      | image       | badges/tests/behat/badge.png |
35
    # Add a competency to the course
36
    When I am on "Course 1" course homepage
37
    And I navigate to "Competencies > Add competencies to course" in current page administration
38
    And "Competency picker" "dialogue" should be visible
39
    And I select "comp1" of the competency tree
40
    And I click on "Add" "button" in the "Competency picker" "dialogue"
41
    And I wait until the page is ready
42
    And I click on "Edit" "link" in the "[data-region='configurecoursecompetencies']" "css_element"
43
    And I wait until the page is ready
44
    And I click on "Rating a competency only updates the competency in this course" "text"
45
    And I click on "Save changes" "button" in the "Configure course competencies" "dialogue"
46
    # Add a badge to the course
47
    And I am on "Course 1" course homepage
48
    And I change window size to "large"
49
    And I navigate to "Badges" in current page administration
50
    And I press "Manage badges"
51
    And I follow "Course Badge"
52
    And I select "Criteria" from the "jump" singleselect
53
    # Set the competency as a criteria for the badge
54
    And I set the field "type" to "Competencies"
55
    When I open the autocomplete suggestions list
56
    And I click on "ul[class='form-autocomplete-suggestions'] li" "css_element"
57
    And I wait until the page is ready
58
    And I press "Save"
59
    And I wait until the page is ready
60
    # Enable the badge
61
    And I press "Enable access"
62
    And I press "Continue"
63
    # Rate the competency in the course
64
    And I am on "Course 1" course homepage
65
    And I navigate to "Competencies" in current page administration
66
    And I click on "comp1" "link" in the "[data-region='coursecompetencies']" "css_element"
67
    And I press "Rate"
68
    And I set the following fields to these values:
69
      | Rating | C |
70
    And I click on "Rate" "button" in the "Rate" "dialogue"
71
    And I should see "The competency rating was manually set in the course"
72
    And I log out
73
    # See if we got the badge
74
    Then I log in as "user1"
75
    And I follow "Profile" in the user menu
76
    And I should see "Course Badge"
77
 
78
  @javascript
79
  Scenario: Award badge for completing a competency in the site
80
    Given the following "core_badges > Badge" exists:
81
      | name        | Site Badge                   |
82
      | status      | 0                            |
83
      | description | Site badge description       |
84
      | image       | badges/tests/behat/badge.png |
85
    # Add a competency to the course
86
    When I am on "Course 1" course homepage
87
    And I navigate to "Competencies > Add competencies to course" in current page administration
88
    And "Competency picker" "dialogue" should be visible
89
    And I select "comp1" of the competency tree
90
    And I click on "Add" "button" in the "Competency picker" "dialogue"
91
    And I press "Add competencies to course"
92
    And "Competency picker" "dialogue" should be visible
93
    And I select "comp2" of the competency tree
94
    And I click on "Add" "button" in the "Competency picker" "dialogue"
95
    # Add a badge to the site
96
    And I navigate to "Badges > Manage badges" in site administration
97
    And I press "Edit" action in the "Site Badge" report row
98
    And I select "Criteria" from the "jump" singleselect
99
    # Set the competency as a criteria for the badge
100
    And I set the field "type" to "Competencies"
101
    And I press "Add competency"
102
    And "Competency picker" "dialogue" should be visible
103
    And I select "comp1" of the competency tree
104
    And I click on "Add" "button" in the "Competency picker" "dialogue"
105
    And I wait until the page is ready
106
    And I press "Add competency"
107
    And "Competency picker" "dialogue" should be visible
108
    And I select "comp2" of the competency tree
109
    And I click on "Add" "button" in the "Competency picker" "dialogue"
110
    And I wait until the page is ready
111
    And I press "Save"
112
    # Enable the badge
113
    And I wait until the page is ready
114
    And I press "Enable access"
115
    And I press "Continue"
116
    # Rate the competency in the course
117
    And I am on "Course 1" course homepage
118
    And I navigate to "Competencies" in current page administration
119
    And I click on "comp1" "link" in the "[data-region='coursecompetencies']" "css_element"
120
    And I press "Rate"
121
    And I set the following fields to these values:
122
      | Rating | C |
123
    And I click on "Rate" "button" in the "Rate" "dialogue"
124
    And I should see "The competency rating was manually set in the course"
125
    And I log out
126
    # See if we got the badge
127
    Then I log in as "user1"
128
    And I follow "Profile" in the user menu
129
    And I should see "Site Badge"
130
 
131
  @javascript
132
  Scenario: Award badge for completing all competencies in the site
133
    Given the following "core_badges > Badge" exists:
134
      | name        | Site Badge                   |
135
      | status      | 0                            |
136
      | description | Site badge description       |
137
      | image       | badges/tests/behat/badge.png |
138
    # Add a competency to the course
139
    When I am on "Course 1" course homepage
140
    And I navigate to "Competencies > Add competencies to course" in current page administration
141
    And "Competency picker" "dialogue" should be visible
142
    And I select "comp1" of the competency tree
143
    And I click on "Add" "button" in the "Competency picker" "dialogue"
144
    And I press "Add competencies to course"
145
    And "Competency picker" "dialogue" should be visible
146
    And I select "comp2" of the competency tree
147
    And I click on "Add" "button" in the "Competency picker" "dialogue"
148
    # Add a badge to the site
149
    And I navigate to "Badges > Manage badges" in site administration
150
    And I press "Edit" action in the "Site Badge" report row
151
    And I select "Criteria" from the "jump" singleselect
152
    # Set the competency as a criteria for the badge
153
    And I set the field "type" to "Competencies"
154
    And I press "Add competency"
155
    And "Competency picker" "dialogue" should be visible
156
    And I select "comp1" of the competency tree
157
    And I click on "Add" "button" in the "Competency picker" "dialogue"
158
    And I wait until the page is ready
159
    And I press "Add competency"
160
    And "Competency picker" "dialogue" should be visible
161
    And I select "comp2" of the competency tree
162
    And I click on "Add" "button" in the "Competency picker" "dialogue"
163
    And I wait until the page is ready
164
    And I click on "This criterion is complete when" "link"
165
    And I click on "All of the selected competencies have been completed" "radio"
166
    And I press "Save"
167
    # Enable the badge
168
    And I wait until the page is ready
169
    And I press "Enable access"
170
    And I press "Continue"
171
    # Rate the competency in the course
172
    And I am on "Course 1" course homepage
173
    And I navigate to "Competencies" in current page administration
174
    And I click on "comp1" "link" in the "[data-region='coursecompetencies']" "css_element"
175
    And I press "Rate"
176
    And I set the following fields to these values:
177
      | Rating | C |
178
    And I click on "Rate" "button" in the "Rate" "dialogue"
179
    And I should see "The competency rating was manually set in the course"
180
    And I log out
181
    # We should not get the badge yet.
182
    Then I log in as "user1"
183
    And I follow "Profile" in the user menu
184
    And I should not see "Site Badge"
185
    And I log out
186
    # Rate the other competency.
187
    And I log in as "admin"
188
    And I am on "Course 1" course homepage
189
    And I navigate to "Competencies" in current page administration
190
    And I click on "comp2" "link" in the "[data-region='coursecompetencies']" "css_element"
191
    And I press "Rate"
192
    And I set the following fields to these values:
193
      | Rating | C |
194
    And I click on "Rate" "button" in the "Rate" "dialogue"
195
    And I should see "The competency rating was manually set in the course"
196
    And I log out
197
    # See if we got the badge now.
198
    Then I log in as "user1"
199
    And I follow "Profile" in the user menu
200
    And I should see "Site Badge"