MDL-42330 Automate MDLQA-5257 - An admin can award a site badge

This commit is contained in:
Jerome Mouneyrac 2013-10-21 13:45:12 +08:00 committed by Dan Poltawski
parent 8be0ca758c
commit 844d74d788

View File

@ -9,29 +9,7 @@ Feature: Award badges
And I log in as "admin"
@javascript
Scenario: Add criteria
Given I expand "Site administration" node
And I expand "Badges" node
And I follow "Add a new badge"
And I fill the moodle form with:
| Name | Test Badge |
| Description | Test badge description |
| issuername | Test Badge Site |
| issuercontact | testuser@test-badge-site.com |
And I upload "badges/tests/behat/badge.png" file to "Image" filepicker
And I press "Create badge"
And I select "Profile completion" from "type"
And I wait "5" seconds
And I check "First name"
And I check "Email address"
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 not see "Criteria for this badge have not been set up yet."
@javascript
Scenario: Earn badge
Scenario: Award profile badge
Given I expand "Site administration" node
And I expand "Badges" node
And I follow "Add a new badge"
@ -43,9 +21,14 @@ Feature: Award badges
And I upload "badges/tests/behat/badge.png" file to "Image" filepicker
And I press "Create badge"
And I select "Profile completion" from "type"
And I wait "5" seconds
And I check "First name"
And I check "Email address"
And I check "Phone"
And I press "Save"
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 not see "Criteria for this badge have not been set up yet."
And I press "Enable access"
And I press "Continue"
And I expand "My profile settings" node
@ -53,6 +36,40 @@ Feature: Award badges
And I expand all fieldsets
And I fill in "Phone" with "123456789"
And I press "Update profile"
When I follow "My badges"
And I follow "My badges"
Then I should see "Profile Badge"
And I should not see "There are no badges available."
@javascript
Scenario: Award site badge
Given the following "users" exists:
| username | firstname | lastname | email |
| teacher | teacher | 1 | teacher1@asd.com |
| student | student | 1 | student1@asd.com |
And I expand "Site administration" node
And I expand "Badges" node
And I follow "Add a new badge"
And I fill the moodle form with:
| Name | Site Badge |
| Description | Site badge description |
| issuername | Tester of site badge |
And I upload "badges/tests/behat/badge.png" file to "Image" filepicker
And I press "Create badge"
And I select "Manual issue by role" from "type"
And I check "Teacher"
And I press "Save"
And I press "Enable access"
And I press "Continue"
And I follow "Recipients (0)"
And I press "Award badge"
And I select "teacher 1 (teacher1@asd.com)" from "potentialrecipients[]"
And I press "Award badge"
And I select "student 1 (student1@asd.com)" from "potentialrecipients[]"
And I press "Award badge"
When I follow "Site Badge"
Then I should see "Recipients (2)"
And I log out
And I log in as "student"
And I expand "My profile" node
And I follow "My badges"
Then I should see "Site Badge"