Proyectos de Subversion Moodle

Rev

| Ultima modificación | Ver Log |

Rev Autor Línea Nro. Línea
1 efrain 1
@core @core_badges @_file_upload @javascript
2
Feature: Display badges
3
  In order to access to badges information
4
  As a user
5
  I need to view badges data awarded to users
6
 
7
  Background:
8
    Given the following "users" exist:
9
      | username | firstname | lastname | email |
10
      | student1 | Student | 1 | student1@example.com |
11
    # Create system badge and define a criterion.
12
    And I log in as "admin"
13
    And I navigate to "Badges > Add a new badge" in site administration
14
    And I set the following fields to these values:
15
      | Name | Testing system badge |
16
      | Version | 1.1 |
17
      | Language | Catalan |
18
      | Description | Testing system badge description |
19
      | Image author | http://author.example.com |
20
      | Image caption | Test caption image |
21
    And I upload "badges/tests/behat/badge.png" file to "Image" filemanager
22
    And I press "Create badge"
23
    And I set the field "type" to "Manual issue by role"
24
    And I expand all fieldsets
25
    And I set the field "Teacher" to "1"
26
    And I press "Save"
27
 
28
  Scenario: Display badge without expired date
29
    # Enable the badge.
30
    Given I press "Enable access"
31
    And I press "Continue"
32
    # Award badge to student1.
33
    And I select "Recipients (0)" from the "jump" singleselect
34
    And I press "Award badge"
35
    And I set the field "potentialrecipients[]" to "Student 1 (student1@example.com)"
36
    And I press "Award badge"
37
    # Check badge details are displayed.
38
    And I navigate to "Badges > Manage badges" in site administration
39
    And I follow "Testing system badge"
40
    And I select "Recipients (1)" from the "jump" singleselect
41
    And I press "View issued badge" action in the "Student 1" report row
42
    Then I should see "Awarded to Student 1"
43
    And I should see "This badge has to be awarded by a user with the following role:"
44
    And I should not see "Expired"
45
    And I should not see "Expires"
46
    And I follow "More details"
47
    And I should see "Catalan"
48
    And I should see "1.1"
49
 
50
  Scenario: Display badge with ALL criteria
51
    # Add another criterion and enable the badge.
52
    Given I set the field "type" to "Profile completion"
53
    And I set the field "id_field_firstname" to "1"
54
    And I press "Save"
55
    And I press "Enable access"
56
    And I press "Continue"
57
    # Award badge to student1.
58
    And I select "Recipients (0)" from the "jump" singleselect
59
    And I press "Award badge"
60
    And I set the field "potentialrecipients[]" to "Student 1 (student1@example.com)"
61
    And I press "Award badge"
62
    # Check badge details are displayed.
63
    And I navigate to "Badges > Manage badges" in site administration
64
    And I follow "Testing system badge"
65
    And I select "Recipients (1)" from the "jump" singleselect
66
    And I press "View issued badge" action in the "Student 1" report row
67
    Then I should see "Awarded to Student 1"
68
    And I should see "Complete ALL of the listed requirements."
69
    And I should see "This badge has to be awarded by a user with the following role:"
70
    And I should see "The following user profile field has to be completed:"
71
    And I should not see "Expired"
72
    And I should not see "Expires"
73
    And I follow "More details"
74
    And I should see "Catalan"
75
    And I should see "1.1"
76
 
77
  Scenario: Display badge with ANY criteria
78
    # Add another criterion and enable the badge.
79
    Given I set the field "type" to "Profile completion"
80
    And I set the field "id_field_firstname" to "1"
81
    And I press "Save"
82
    And I set the field "update" to "2"
83
    And I press "Enable access"
84
    And I press "Continue"
85
    # Check badge details are displayed.
86
    And I select "Recipients (2)" from the "jump" singleselect
87
    And I press "View issued badge" action in the "Student 1" report row
88
    Then I should see "Awarded to Student 1"
89
    And I should see "Complete ANY of the listed requirements."
90
    And I should see "This badge has to be awarded by a user with the following role:"
91
    And I should see "The following user profile field has to be completed:"
92
    And I should not see "Expired"
93
    And I should not see "Expires"
94
    And I follow "More details"
95
    And I should see "Catalan"
96
    And I should see "1.1"
97
 
98
  Scenario: Display badge with expiration date but not expired yet
99
    # Set expired date to badge (future date).
100
    Given I select "Edit details" from the "jump" singleselect
101
    When I click on "Relative date" "radio"
102
    And I set the field "expireperiod[number]" to "1"
103
    And I press "Save changes"
104
    And I press "Enable access"
105
    And I press "Continue"
106
    # Award badge to student1.
107
    And I select "Recipients (0)" from the "jump" singleselect
108
    And I press "Award badge"
109
    And I set the field "potentialrecipients[]" to "Student 1 (student1@example.com)"
110
    And I press "Award badge"
111
    # Check "Expires" date is displayed.
112
    And I navigate to "Badges > Manage badges" in site administration
113
    And I follow "Testing system badge"
114
    And I select "Recipients (1)" from the "jump" singleselect
115
    And I press "View issued badge" action in the "Student 1" report row
116
    Then I should see "Expires"
117
    And I should not see "Expired"
118
 
119
  Scenario: Display expired badge
120
    # Set expired date to badge (relative date 1 seconds after the date of issue it).
121
    Given I select "Edit details" from the "jump" singleselect
122
    When I click on "Relative date" "radio"
123
    And I set the field "expireperiod[timeunit]" to "1"
124
    And I set the field "expireperiod[number]" to "1"
125
    And I press "Save changes"
126
    And I press "Enable access"
127
    And I press "Continue"
128
    # Award badge to student1.
129
    And I select "Recipients (0)" from the "jump" singleselect
130
    And I press "Award badge"
131
    And I set the field "potentialrecipients[]" to "Student 1 (student1@example.com)"
132
    And I press "Award badge"
133
    # Wait 1 second to guarantee the badge is expired.
134
    And I wait "1" seconds
135
    # Check "Expired" date is displayed.
136
    And I navigate to "Badges > Manage badges" in site administration
137
    And I follow "Testing system badge"
138
    And I select "Recipients (1)" from the "jump" singleselect
139
    And I press "View issued badge" action in the "Student 1" report row
140
    Then I should see "Expired"
141
    And I should not see "Expires"