Rev 1 | AutorÃa | Comparar con el anterior | Ultima modificación | Ver Log |
@core @core_badges @_file_uploadFeature: Award badgesIn order to award badges to users for their achievementsAs an adminI need to add criteria to badges in the systemBackground:Given the following "courses" exist:| fullname | shortname | format | enablecompletion || Course 1 | C1 | topics | 1 |And the following "users" exist:| username | firstname | lastname | email || teacher1 | Teacher | 1 | teacher1@example.com || student1 | Student | 1 | student1@example.com || student2 | Student | 2 | student2@example.com |And the following "course enrolments" exist:| user | course | role || teacher1 | C1 | editingteacher || student1 | C1 | student || student2 | C1 | student |And the following "activity" exists:| activity | assign || course | C1 || section | 1 || name | Test assignment name || intro | Submit your online text || completion | 1 || assignsubmission_onlinetext_enabled | 1 |@javascriptScenario: Award badge on other badges as criteriaGiven the following "core_badges > Badges" exist:| name | course | description | image | status | type || Course Badge 1 | C1 | Course badge 1 description | badges/tests/behat/badge.png | active | 2 || Course Badge 2 | C1 | Course badge 2 description | badges/tests/behat/badge.png | 0 | 2 |And the following "core_badges > Criteria" exists:| badge | Course Badge 1 || role | editingteacher |And I am on the "Course 1" "course" page logged in as "teacher1"And I navigate to "Badges" in current page administrationAnd I follow "Course Badge 2"And I select "Criteria" from the "jump" singleselect# Set "course badge 1" as criteria for Badge 2.And I set the field "type" to "Awarded badges"And I set the field "id_badge_badges" to "Course Badge 1"And I press "Save"And I press "Enable access"And I click on "Enable" "button" in the "Confirm" "dialogue"And I am on "Course 1" course homepageAnd I navigate to "Badges" in current page administrationAnd I follow "Course Badge 1"And I select "Recipients (0)" from the "jump" singleselectAnd I press "Award badge"# Award course badge 1 to student 1.And I set the field "potentialrecipients[]" to "Student 1 (student1@example.com)"When I press "Award badge"And I am on "Course 1" course homepageAnd I navigate to "Badges" in current page administrationAnd I follow "Course Badge 1"And I select "Recipients (1)" from the "jump" singleselectThen I should see "Recipients (1)"And I log out# Student 1 should have both badges.And I log in as "student1"And I follow "Profile" in the user menuWhen I click on "Course 1" "link" in the "region-main" "region"Then I should see "Course Badge 1"And I should see "Course Badge 2"# Student 1 should have both badges also in the Badges navigation section.When I follow "Badges"Then I should see "Course Badge 1"And I should see "Course Badge 2"And I should not see "Add a new badge"# Student 1 should have both badges in the course too.And I am on "Course 1" course homepageAnd I follow "Badges"And I should see "Course Badge 1"And I should see "Course Badge 2"And I should not see "Course badge 1 description"And I should not see "Course badge 2 description"And I should not see "Recipients"And I should not see "Badge status"And I follow "Course Badge 1"And I should see "Course badge 1 description"And I should not see "Course badge 2 description"And I log out# Teacher 1 should have access to manage/create badges in the Badges navigation section.When I log in as "teacher1"And I am on "Course 1" course homepageAnd I navigate to "Badges" in current page administrationThen I should see "Course Badge 1"And I should see "Course Badge 2"And I should see "Add a new badge"# Teacher 1 should NOT have access to manage/create site badges in the Site badges section.When I am on homepageAnd I turn editing mode onAnd the following config values are set as admin:| unaddableblocks | | theme_boost|# TODO MDL-57120 site "Badges" link not accessible without navigation block.And I add the "Navigation" block if not presentAnd I click on "Site pages" "list_item" in the "Navigation" "block"And I click on "Site badges" "link" in the "Navigation" "block"Then I should see "There are no matching badges available for users to earn."And I should not see "Add a new badge"@javascriptScenario: Award profile badgeGiven the following "core_badges > Badge" exists:| name | Profile Badge || description | Test badge description || image | badges/tests/behat/badge.png || status | 0 || type | 1 |Given I log in as "admin"And I navigate to "Badges > Manage badges" in site administrationAnd I follow "Profile Badge"And I select "Criteria" from the "jump" singleselectAnd I set the field "type" to "Profile completion"And I expand all fieldsetsAnd I set the field "First name" to "1"And I set the field "Email address" to "1"And I set the field "Phone" to "1"And I set the field "id_description" to "Criterion description"When I press "Save"Then I should see "Profile completion"And I should see "First name"And I should see "Email address"And I should see "Phone"And I should see "Criterion description"And I should not see "Criteria for this badge have not been set up yet."And I press "Enable access"And I click on "Enable" "button" in the "Confirm" "dialogue"And I open my profile in edit modeAnd I expand all fieldsetsAnd I set the field "Phone" to "123456789"And I press "Update profile"And I follow "Profile" in the user menuThen I should see "Profile Badge"And I should not see "There are no matching badges available for users to earn."@javascriptScenario: Award site badgeGiven the following "core_badges > Badge" exists:| name | Site Badge || description | Site badge description || image | badges/tests/behat/badge.png || status | active || type | 1 |And the following "core_badges > Criteria" exists:| badge | Site Badge || role | editingteacher |And I log in as "admin"And I navigate to "Badges > Manage badges" in site administrationAnd I follow "Site Badge"And I select "Recipients (0)" from the "jump" singleselectAnd I press "Award badge"And I set the field "potentialrecipients[]" to "Teacher 1 (teacher1@example.com)"And I press "Award badge"And I set the field "potentialrecipients[]" to "Student 1 (student1@example.com)"And I press "Award badge"And I navigate to "Badges > Manage badges" in site administrationWhen I follow "Site Badge"Then I should see "Recipients (2)"And I log outAnd I log in as "student1"And I follow "Profile" in the user menuThen I should see "Site Badge"@javascriptScenario: Award course badgeGiven the following "core_badges > Badge" exists:| name | Course Badge || course | C1 || description | Course badge description || image | badges/tests/behat/badge.png || status | active || type | 2 |And the following "core_badges > Criteria" exists:| badge | Course Badge || role | editingteacher |And I am on the "Course 1" "course" page logged in as "teacher1"And I navigate to "Badges" in current page administrationAnd I follow "Course Badge"And I select "Recipients (0)" from the "jump" singleselectAnd I press "Award badge"And I set the field "potentialrecipients[]" to "Student 2 (student2@example.com)"And I press "Award badge"And I set the field "potentialrecipients[]" to "Student 1 (student1@example.com)"When I press "Award badge"And I am on "Course 1" course homepageAnd I navigate to "Badges" in current page administrationAnd I follow "Course Badge"Then I should see "Recipients (2)"And I log outAnd I log in as "student1"And I follow "Profile" in the user menuAnd I click on "Course 1" "link" in the "region-main" "region"And I click on "Course Badge" "link"And I should see "Course: Course 1"@javascriptScenario: Award badge on activity completionGiven the following "core_badges > Badge" exists:| name | Course Badge || course | C1 || description | Course badge description || image | badges/tests/behat/badge.png || status | 0 || type | 2 |And I am on the "Course 1" "course" page logged in as "teacher1"And I navigate to "Badges" in current page administrationAnd I follow "Course Badge"And I select "Criteria" from the "jump" singleselectAnd I set the field "type" to "Activity completion"And I set the field "Test assignment name" to "1"And I press "Save"And I press "Enable access"And I click on "Enable" "button" in the "Confirm" "dialogue"And I log outAnd I log in as "student1"And I follow "Profile" in the user menuAnd I click on "Course 1" "link" in the "region-main" "region"Then I should not see "badges"And I am on "Course 1" course homepageAnd I toggle the manual completion state of "Test assignment name"And I follow "Profile" in the user menuAnd I click on "Course 1" "link" in the "region-main" "region"Then I should see "Course Badge"@javascriptScenario: Award badge on course completionGiven the following "activity" exists:| activity | assign || course | C1 || name | Music history || section | 1 || completion | 2 || completionview | 1 |Given the following "core_badges > Badge" exists:| name | Course Badge || course | C1 || description | Course badge description || image | badges/tests/behat/badge.png || status | 0 || type | 2 |And I am on the "Course 1" "course" page logged in as "teacher1"And I navigate to "Course completion" in current page administrationAnd I set the field "id_overall_aggregation" to "2"And I click on "Condition: Activity completion" "link"And I set the field "Assignment - Music history" to "1"And I press "Save changes"And I am on "Course 1" course homepageAnd I navigate to "Badges" in current page administrationAnd I follow "Course Badge"And I select "Criteria" from the "jump" singleselectAnd I set the field "type" to "Course completion"And I set the field with xpath ".//*[contains(., 'Minimum grade required')]/ancestor::*[contains(concat(' ', @class, ' '), ' fitem ')]//input[1]" to "0"And I press "Save"And I press "Enable access"And I click on "Enable" "button" in the "Confirm" "dialogue"And I log outAnd I log in as "student1"And I follow "Profile" in the user menuAnd I click on "Course 1" "link" in the "region-main" "region"Then I should not see "badges"When I am on the "Music history" "assign activity" pageAnd I log out# Completion cron won't mark the whole course completed unless the# individual criteria was marked completed more than a second ago. So# run it twice, first to mark the criteria and second for the course.And I run the scheduled task "core\task\completion_regular_task"And I wait "1" secondsAnd I run the scheduled task "core\task\completion_regular_task"# The student should now see their badge.And I log in as "student1"And I follow "Profile" in the user menuAnd I click on "Course 1" "link" in the "region-main" "region"Then I should see "Course Badge"@javascriptScenario: All of the selected roles can award badgesGiven the following "core_badges > Badge" exists:| name | Course Badge 1 || course | C1 || description | Course badge description || image | badges/tests/behat/badge.png || status | active || type | 2 |And the following "core_badges > Criteria" exists:| badge | Course Badge 1 || role | editingteacher |And I am on the "Course 1" "course" page logged in as "teacher1"And I navigate to "Badges" in current page administrationAnd I follow "Course Badge 1"And I select "Recipients (0)" from the "jump" singleselectAnd I press "Award badge"# Award course badge 1 to student 1.And I set the field "potentialrecipients[]" to "Student 1 (student1@example.com)"When I press "Award badge"And I am on "Course 1" course homepageAnd I navigate to "Badges" in current page administrationAnd I follow "Course Badge 1"And I select "Recipients (1)" from the "jump" singleselectThen I should see "Recipients (1)"# Add course badge 2.Given the following "core_badges > Badge" exists:| name | Course Badge 2 || course | C1 || description | Course badge description || image | badges/tests/behat/badge.png || status | 0 || type | 2 |And I navigate to "Badges" in current page administrationAnd I follow "Course Badge 2"And I select "Criteria" from the "jump" singleselectAnd I set the field "type" to "Manual issue by role"And I expand all fieldsets# Set to ALL of the selected roles award badge.And I set the field "Teacher" to "1"And I set the field "All of the selected roles award the badge" to "1"And I press "Save"And I press "Enable access"And I click on "Enable" "button" in the "Confirm" "dialogue"And I select "Recipients (0)" from the "jump" singleselectAnd I press "Award badge"# Award course badge 2 to student 2.And I set the field "potentialrecipients[]" to "Student 2 (student2@example.com)"When I press "Award badge"And I am on "Course 1" course homepageAnd I navigate to "Badges" in current page administrationAnd I follow "Course Badge 2"And I select "Recipients (1)" from the "jump" singleselectThen I should see "Recipients (1)"And I log outAnd I trigger cron# Student 1 should have just course badge 1.And I log in as "student1"And I follow "Profile" in the user menuWhen I click on "Course 1" "link" in the "region-main" "region"Then I should see "Course Badge 1"And I should not see "Course Badge 2"And I log out# Student 2 should have just course badge 2.And I log in as "student2"And I follow "Profile" in the user menuWhen I click on "Course 1" "link" in the "region-main" "region"Then I should see "Course Badge 2"Then I should not see "Course Badge 1"@javascriptScenario: Revoke badgeGiven the following "core_badges > Badge" exists:| name | Course Badge || course | C1 || description | Course badge description || image | badges/tests/behat/badge.png || status | active || type | 2 |And the following "core_badges > Criteria" exists:| badge | Course Badge || role | editingteacher |And I am on the "Course 1" "course" page logged in as "teacher1"And I navigate to "Badges" in current page administrationAnd I follow "Course Badge"And I select "Recipients (0)" from the "jump" singleselectAnd I press "Award badge"And I set the field "potentialrecipients[]" to "Student 2 (student2@example.com)"And I press "Award badge"And I set the field "potentialrecipients[]" to "Student 1 (student1@example.com)"When I press "Award badge"And I am on "Course 1" course homepageAnd I navigate to "Badges" in current page administrationAnd I follow "Course Badge"Then I should see "Recipients (2)"And I select "Recipients (2)" from the "jump" singleselectAnd I press "Award badge"And I set the field "existingrecipients[]" to "Student 2 (student2@example.com)"And I press "Revoke badge"And I set the field "existingrecipients[]" to "Student 1 (student1@example.com)"When I press "Revoke badge"And I am on "Course 1" course homepageAnd I navigate to "Badges" in current page administrationAnd I follow "Course Badge"Then I should see "Recipients (0)"