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
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 |
1441 ariadna 17
    And the following "core_competency > frameworks" exist:
18
      | shortname   | idnumber |
19
      | Framework 1 | sc-y-2   |
20
    And the following "core_competency > competencies" exist:
21
      | shortname | competencyframework |
22
      | comp1     | sc-y-2              |
23
      | comp2     | sc-y-2              |
1 efrain 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 follow "Course Badge"
51
    And I select "Criteria" from the "jump" singleselect
52
    # Set the competency as a criteria for the badge
53
    And I set the field "type" to "Competencies"
54
    When I open the autocomplete suggestions list
55
    And I click on "ul[class='form-autocomplete-suggestions'] li" "css_element"
56
    And I wait until the page is ready
57
    And I press "Save"
58
    And I wait until the page is ready
59
    # Enable the badge
60
    And I press "Enable access"
1441 ariadna 61
    And I click on "Enable" "button" in the "Confirm" "dialogue"
1 efrain 62
    # Rate the competency in the course
63
    And I am on "Course 1" course homepage
64
    And I navigate to "Competencies" in current page administration
65
    And I click on "comp1" "link" in the "[data-region='coursecompetencies']" "css_element"
66
    And I press "Rate"
67
    And I set the following fields to these values:
68
      | Rating | C |
69
    And I click on "Rate" "button" in the "Rate" "dialogue"
70
    And I should see "The competency rating was manually set in the course"
71
    And I log out
72
    # See if we got the badge
73
    Then I log in as "user1"
74
    And I follow "Profile" in the user menu
75
    And I should see "Course Badge"
76
 
77
  @javascript
78
  Scenario: Award badge for completing a competency in the site
79
    Given the following "core_badges > Badge" exists:
80
      | name        | Site Badge                   |
81
      | status      | 0                            |
82
      | description | Site badge description       |
83
      | image       | badges/tests/behat/badge.png |
84
    # Add a competency to the course
85
    When I am on "Course 1" course homepage
86
    And I navigate to "Competencies > Add competencies to course" in current page administration
87
    And "Competency picker" "dialogue" should be visible
88
    And I select "comp1" of the competency tree
89
    And I click on "Add" "button" in the "Competency picker" "dialogue"
90
    And I press "Add competencies to course"
91
    And "Competency picker" "dialogue" should be visible
92
    And I select "comp2" of the competency tree
93
    And I click on "Add" "button" in the "Competency picker" "dialogue"
94
    # Add a badge to the site
95
    And I navigate to "Badges > Manage badges" in site administration
96
    And I press "Edit" action in the "Site Badge" report row
97
    And I select "Criteria" from the "jump" singleselect
98
    # Set the competency as a criteria for the badge
99
    And I set the field "type" to "Competencies"
100
    And I press "Add competency"
101
    And "Competency picker" "dialogue" should be visible
102
    And I select "comp1" of the competency tree
103
    And I click on "Add" "button" in the "Competency picker" "dialogue"
104
    And I wait until the page is ready
105
    And I press "Add competency"
106
    And "Competency picker" "dialogue" should be visible
107
    And I select "comp2" of the competency tree
108
    And I click on "Add" "button" in the "Competency picker" "dialogue"
109
    And I wait until the page is ready
110
    And I press "Save"
111
    # Enable the badge
112
    And I wait until the page is ready
113
    And I press "Enable access"
1441 ariadna 114
    And I click on "Enable" "button" in the "Confirm" "dialogue"
1 efrain 115
    # Rate the competency in the course
116
    And I am on "Course 1" course homepage
117
    And I navigate to "Competencies" in current page administration
118
    And I click on "comp1" "link" in the "[data-region='coursecompetencies']" "css_element"
119
    And I press "Rate"
120
    And I set the following fields to these values:
121
      | Rating | C |
122
    And I click on "Rate" "button" in the "Rate" "dialogue"
123
    And I should see "The competency rating was manually set in the course"
124
    And I log out
125
    # See if we got the badge
126
    Then I log in as "user1"
127
    And I follow "Profile" in the user menu
128
    And I should see "Site Badge"
129
 
130
  @javascript
131
  Scenario: Award badge for completing all competencies in the site
132
    Given the following "core_badges > Badge" exists:
133
      | name        | Site Badge                   |
134
      | status      | 0                            |
135
      | description | Site badge description       |
136
      | image       | badges/tests/behat/badge.png |
137
    # Add a competency to the course
138
    When I am on "Course 1" course homepage
139
    And I navigate to "Competencies > Add competencies to course" in current page administration
140
    And "Competency picker" "dialogue" should be visible
141
    And I select "comp1" of the competency tree
142
    And I click on "Add" "button" in the "Competency picker" "dialogue"
143
    And I press "Add competencies to course"
144
    And "Competency picker" "dialogue" should be visible
145
    And I select "comp2" of the competency tree
146
    And I click on "Add" "button" in the "Competency picker" "dialogue"
147
    # Add a badge to the site
148
    And I navigate to "Badges > Manage badges" in site administration
149
    And I press "Edit" action in the "Site Badge" report row
150
    And I select "Criteria" from the "jump" singleselect
151
    # Set the competency as a criteria for the badge
152
    And I set the field "type" to "Competencies"
153
    And I press "Add competency"
154
    And "Competency picker" "dialogue" should be visible
155
    And I select "comp1" of the competency tree
156
    And I click on "Add" "button" in the "Competency picker" "dialogue"
157
    And I wait until the page is ready
158
    And I press "Add competency"
159
    And "Competency picker" "dialogue" should be visible
160
    And I select "comp2" of the competency tree
161
    And I click on "Add" "button" in the "Competency picker" "dialogue"
162
    And I wait until the page is ready
163
    And I click on "This criterion is complete when" "link"
164
    And I click on "All of the selected competencies have been completed" "radio"
165
    And I press "Save"
166
    # Enable the badge
167
    And I wait until the page is ready
168
    And I press "Enable access"
1441 ariadna 169
    And I click on "Enable" "button" in the "Confirm" "dialogue"
1 efrain 170
    # Rate the competency in the course
171
    And I am on "Course 1" course homepage
172
    And I navigate to "Competencies" in current page administration
173
    And I click on "comp1" "link" in the "[data-region='coursecompetencies']" "css_element"
174
    And I press "Rate"
175
    And I set the following fields to these values:
176
      | Rating | C |
177
    And I click on "Rate" "button" in the "Rate" "dialogue"
178
    And I should see "The competency rating was manually set in the course"
179
    And I log out
180
    # We should not get the badge yet.
181
    Then I log in as "user1"
182
    And I follow "Profile" in the user menu
183
    And I should not see "Site Badge"
184
    And I log out
185
    # Rate the other competency.
186
    And I log in as "admin"
187
    And I am on "Course 1" course homepage
188
    And I navigate to "Competencies" in current page administration
189
    And I click on "comp2" "link" in the "[data-region='coursecompetencies']" "css_element"
190
    And I press "Rate"
191
    And I set the following fields to these values:
192
      | Rating | C |
193
    And I click on "Rate" "button" in the "Rate" "dialogue"
194
    And I should see "The competency rating was manually set in the course"
195
    And I log out
196
    # See if we got the badge now.
197
    Then I log in as "user1"
198
    And I follow "Profile" in the user menu
199
    And I should see "Site Badge"