forked from moodle/moodle
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
MDL-82503 badges: Fix behat and PHPUnit tests
- Loading branch information
Showing
15 changed files
with
91 additions
and
162 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -67,8 +67,8 @@ Feature: Add badges to the system | |
| Image caption | Test caption image | | ||
And I upload "badges/tests/behat/badge.png" file to "Image" filemanager | ||
And I press "Create badge" | ||
And I navigate to "Badges > Manage badges" in site administration | ||
And I press "Add a new badge" | ||
And I wait until the page is ready | ||
And I navigate to "Badges > Add a new badge" in site administration | ||
And I set the following fields to these values: | ||
| Name | Test Badge 2 | | ||
| Version | v2 | | ||
|
@@ -82,6 +82,7 @@ Feature: Add badges to the system | |
And I should see "This badge does not have any related badges." | ||
And I press "Add related badge" | ||
And I follow "Related badges" | ||
And I wait until the page is ready | ||
And I follow "Related badges" | ||
And I set the field "relatedbadgeids[]" to "Test Badge 1 (version: v1, language: French, Site badges)" | ||
When I press "Save changes" | ||
|
@@ -168,13 +169,12 @@ Feature: Add badges to the system | |
And I am on homepage | ||
When 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 "Manage badges" | ||
And I should see "Add a new badge" | ||
Then I should see "Add a new badge" | ||
|
||
@javascript @_file_upload | ||
Scenario: Edit a site badge | ||
Given the following "core_badges > Badge" exists: | ||
| name | Site badge | | ||
| name | Testing site badge | | ||
| status | inactive | | ||
| version | 1 | | ||
| language | ca | | ||
|
@@ -184,11 +184,11 @@ Feature: Add badges to the system | |
| imagecaption | My caption image | | ||
| issuercontact | testuser@example.com | | ||
And the following "core_badges > Criterias" exist: | ||
| badge | role | | ||
| Site badge | editingteacher | | ||
| badge | role | | ||
| Testing site badge | editingteacher | | ||
And I navigate to "Badges > Manage badges" in site administration | ||
When I press "Edit" action in the "Site badge" report row | ||
And I should see "Site badge" | ||
When I press "Edit" action in the "Testing site badge" report row | ||
And I should see "Testing site badge" | ||
And the field "Issuer contact" matches value "[email protected]" | ||
And I set the following fields to these values: | ||
| Name | Test badge with 'apostrophe' and other friends (<>&@#) | | ||
|
@@ -203,7 +203,7 @@ Feature: Add badges to the system | |
And I select "Overview" from the "jump" singleselect | ||
And I expand all fieldsets | ||
Then I should see "Test badge with 'apostrophe' and other friends (&@#)" | ||
And I should not see "Site badge" | ||
And I should not see "Testing site badge" | ||
And I should see "secondversion" | ||
And I should not see "firstversion" | ||
And I should see "Math" | ||
|
@@ -218,42 +218,3 @@ Feature: Add badges to the system | |
| badges_defaultissuername | Test Badge Site | | ||
And I navigate to "Badges > Add a new badge" in site administration | ||
And the field "Issuer name" matches value "Test Badge Site" | ||
|
||
Scenario: Cancel button behaviour when creating badges | ||
Given the following "course" exists: | ||
| fullname | Course 1 | | ||
| shortname | C1 | | ||
And the following "core_badges > Badge" exists: | ||
| name | Site Badge 1 | | ||
| description | Site badge 1 description | | ||
| image | badges/tests/behat/badge.png | | ||
| status | 0 | | ||
| type | 1 | | ||
And the following "core_badges > Badge" exists: | ||
| name | Course Badge 1 | | ||
| course | C1 | | ||
| description | Course badge 1 description | | ||
| image | badges/tests/behat/badge.png | | ||
| status | 0 | | ||
| type | 2 | | ||
# Site badge: cancel when creating. | ||
When I navigate to "Badges > Add a new badge" in site administration | ||
And I click on "Cancel" "button" | ||
Then I should see "Manage badges" | ||
And I should see "Add a new badge" | ||
# Site badge: cancel when editing. | ||
And I press "Edit" action in the "Site Badge 1" report row | ||
And I click on "Cancel" "button" | ||
And I should see "Site badge 1" | ||
And I should not see "Save changes" | ||
# Course badge: cancel when creating. | ||
And I am on the "Course 1" "course" page | ||
And I navigate to "Badges > Manage badges > Add a new badge" in current page administration | ||
And I click on "Cancel" "button" | ||
Then I should see "Manage badges" | ||
And I should see "Add a new badge" | ||
# Course badge: cancel when editing. | ||
And I press "Edit" action in the "Course Badge 1" report row | ||
And I click on "Cancel" "button" | ||
And I should see "Course badge 1" | ||
And I should not see "Save changes" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -37,7 +37,7 @@ Feature: Award badges | |
| badge | Course Badge 1 | | ||
| role | editingteacher | | ||
And I am on the "Course 1" "course" page logged in as "teacher1" | ||
And I navigate to "Badges > Manage badges" in current page administration | ||
And I navigate to "Badges" in current page administration | ||
And I follow "Course Badge 2" | ||
And I select "Criteria" from the "jump" singleselect | ||
# Set "course badge 1" as criteria for Badge 2. | ||
|
@@ -47,15 +47,15 @@ Feature: Award badges | |
And I press "Enable access" | ||
And I click on "Enable" "button" in the "Confirm" "dialogue" | ||
And I am on "Course 1" course homepage | ||
And I navigate to "Badges > Manage badges" in current page administration | ||
And I navigate to "Badges" in current page administration | ||
And I follow "Course Badge 1" | ||
And I select "Recipients (0)" from the "jump" singleselect | ||
And I press "Award badge" | ||
# Award course badge 1 to student 1. | ||
And I set the field "potentialrecipients[]" to "Student 1 ([email protected])" | ||
When I press "Award badge" | ||
And I am on "Course 1" course homepage | ||
And I navigate to "Badges > Manage badges" in current page administration | ||
And I navigate to "Badges" in current page administration | ||
And I follow "Course Badge 1" | ||
And I select "Recipients (1)" from the "jump" singleselect | ||
Then I should see "Recipients (1)" | ||
|
@@ -70,16 +70,26 @@ Feature: Award badges | |
When I follow "Badges" | ||
Then I should see "Course Badge 1" | ||
And I should see "Course Badge 2" | ||
And I should not see "Manage badges" | ||
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 homepage | ||
And I navigate to "Badges" in current page administration | ||
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 homepage | ||
And I navigate to "Badges > Manage badges" in current page administration | ||
And I navigate to "Badges" in current page administration | ||
Then I should see "Course Badge 1" | ||
And I should see "Course Badge 2" | ||
And I should see "Manage badges" | ||
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 homepage | ||
|
@@ -91,7 +101,6 @@ Feature: Award badges | |
And 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 "Manage badges" | ||
And I should not see "Add a new badge" | ||
|
||
@javascript | ||
|
@@ -127,6 +136,7 @@ Feature: Award badges | |
And I press "Update profile" | ||
And I follow "Profile" in the user menu | ||
Then I should see "Profile Badge" | ||
And I should not see "There are no matching badges available for users to earn" | ||
|
||
@javascript | ||
Scenario: Award site badge | ||
|
@@ -169,7 +179,7 @@ Feature: Award badges | |
| badge | Course Badge | | ||
| role | editingteacher | | ||
And I am on the "Course 1" "course" page logged in as "teacher1" | ||
And I navigate to "Badges > Manage badges" in current page administration | ||
And I navigate to "Badges" in current page administration | ||
And I follow "Course Badge" | ||
And I select "Recipients (0)" from the "jump" singleselect | ||
And I press "Award badge" | ||
|
@@ -178,7 +188,7 @@ Feature: Award badges | |
And I set the field "potentialrecipients[]" to "Student 1 ([email protected])" | ||
When I press "Award badge" | ||
And I am on "Course 1" course homepage | ||
And I navigate to "Badges > Manage badges" in current page administration | ||
And I navigate to "Badges" in current page administration | ||
And I follow "Course Badge" | ||
Then I should see "Recipients (2)" | ||
And I log out | ||
|
@@ -198,7 +208,7 @@ Feature: Award badges | |
| status | 0 | | ||
| type | 2 | | ||
And I am on the "Course 1" "course" page logged in as "teacher1" | ||
And I navigate to "Badges > Manage badges" in current page administration | ||
And I navigate to "Badges" in current page administration | ||
And I follow "Course Badge" | ||
And I select "Criteria" from the "jump" singleselect | ||
And I set the field "type" to "Activity completion" | ||
|
@@ -240,7 +250,7 @@ Feature: Award badges | |
And I set the field "Assignment - Music history" to "1" | ||
And I press "Save changes" | ||
And I am on "Course 1" course homepage | ||
And I navigate to "Badges > Manage badges" in current page administration | ||
And I navigate to "Badges" in current page administration | ||
And I follow "Course Badge" | ||
And I select "Criteria" from the "jump" singleselect | ||
And I set the field "type" to "Course completion" | ||
|
@@ -280,15 +290,15 @@ Feature: Award badges | |
| badge | Course Badge 1 | | ||
| role | editingteacher | | ||
And I am on the "Course 1" "course" page logged in as "teacher1" | ||
And I navigate to "Badges > Manage badges" in current page administration | ||
And I navigate to "Badges" in current page administration | ||
And I follow "Course Badge 1" | ||
And I select "Recipients (0)" from the "jump" singleselect | ||
And I press "Award badge" | ||
# Award course badge 1 to student 1. | ||
And I set the field "potentialrecipients[]" to "Student 1 ([email protected])" | ||
When I press "Award badge" | ||
And I am on "Course 1" course homepage | ||
And I navigate to "Badges > Manage badges" in current page administration | ||
And I navigate to "Badges" in current page administration | ||
And I follow "Course Badge 1" | ||
And I select "Recipients (1)" from the "jump" singleselect | ||
Then I should see "Recipients (1)" | ||
|
@@ -300,7 +310,7 @@ Feature: Award badges | |
| image | badges/tests/behat/badge.png | | ||
| status | 0 | | ||
| type | 2 | | ||
And I navigate to "Badges > Manage badges" in current page administration | ||
And I navigate to "Badges" in current page administration | ||
And I follow "Course Badge 2" | ||
And I select "Criteria" from the "jump" singleselect | ||
And I set the field "type" to "Manual issue by role" | ||
|
@@ -317,7 +327,7 @@ Feature: Award badges | |
And I set the field "potentialrecipients[]" to "Student 2 ([email protected])" | ||
When I press "Award badge" | ||
And I am on "Course 1" course homepage | ||
And I navigate to "Badges > Manage badges" in current page administration | ||
And I navigate to "Badges" in current page administration | ||
And I follow "Course Badge 2" | ||
And I select "Recipients (1)" from the "jump" singleselect | ||
Then I should see "Recipients (1)" | ||
|
@@ -350,7 +360,7 @@ Feature: Award badges | |
| badge | Course Badge | | ||
| role | editingteacher | | ||
And I am on the "Course 1" "course" page logged in as "teacher1" | ||
And I navigate to "Badges > Manage badges" in current page administration | ||
And I navigate to "Badges" in current page administration | ||
And I follow "Course Badge" | ||
And I select "Recipients (0)" from the "jump" singleselect | ||
And I press "Award badge" | ||
|
@@ -359,7 +369,7 @@ Feature: Award badges | |
And I set the field "potentialrecipients[]" to "Student 1 ([email protected])" | ||
When I press "Award badge" | ||
And I am on "Course 1" course homepage | ||
And I navigate to "Badges > Manage badges" in current page administration | ||
And I navigate to "Badges" in current page administration | ||
And I follow "Course Badge" | ||
Then I should see "Recipients (2)" | ||
And I select "Recipients (2)" from the "jump" singleselect | ||
|
@@ -369,6 +379,6 @@ Feature: Award badges | |
And I set the field "existingrecipients[]" to "Student 1 ([email protected])" | ||
When I press "Revoke badge" | ||
And I am on "Course 1" course homepage | ||
And I navigate to "Badges > Manage badges" in current page administration | ||
And I navigate to "Badges" in current page administration | ||
And I follow "Course Badge" | ||
Then I should see "Recipients (0)" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -38,7 +38,7 @@ Feature: Award badges with separate groups | |
| status | 0 | | ||
| type | 2 | | ||
And I am on the "Course 1" "course" page logged in as "teacher1" | ||
And I navigate to "Badges > Manage badges" in current page administration | ||
And I navigate to "Badges" in current page administration | ||
And I follow "Course Badge" | ||
And I select "Criteria" from the "jump" singleselect | ||
And I set the field "type" to "Manual issue by role" | ||
|
@@ -55,7 +55,7 @@ Feature: Award badges with separate groups | |
Scenario: Award course badge as non-editing teacher with only one group | ||
When I log in as "teacher2" | ||
And I am on "Course 1" course homepage | ||
And I navigate to "Badges > Manage badges" in current page administration | ||
And I navigate to "Badges" in current page administration | ||
And I follow "Course Badge" | ||
And I press "Award badge" | ||
And I set the field "role" to "Non-editing teacher" | ||
|
@@ -68,7 +68,7 @@ Feature: Award badges with separate groups | |
And I set the field "potentialrecipients[]" to "Student 2 ([email protected])" | ||
And I press "Award badge" | ||
And I am on "Course 1" course homepage | ||
And I navigate to "Badges > Manage badges" in current page administration | ||
And I navigate to "Badges" in current page administration | ||
And I follow "Course Badge" | ||
And I should see "Recipients (1)" | ||
And I log out | ||
|
@@ -89,7 +89,7 @@ Feature: Award badges with separate groups | |
And I log out | ||
When I log in as "teacher2" | ||
And I am on "Course 1" course homepage | ||
And I navigate to "Badges > Manage badges" in current page administration | ||
And I navigate to "Badges" in current page administration | ||
And I follow "Course Badge" | ||
And I press "Award badge" | ||
And I set the field "role" to "Non-editing teacher" | ||
|
@@ -114,7 +114,7 @@ Feature: Award badges with separate groups | |
And I log out | ||
When I log in as "teacher2" | ||
And I am on "Course 1" course homepage | ||
And I navigate to "Badges > Manage badges" in current page administration | ||
And I navigate to "Badges" in current page administration | ||
And I follow "Course Badge" | ||
And I press "Award badge" | ||
# Teacher 2 shouldn't be able to go further | ||
|
@@ -123,7 +123,7 @@ Feature: Award badges with separate groups | |
@javascript | ||
Scenario: Editing teacher can award badge to members of separate groups | ||
Given I am on the "Course 1" course page logged in as teacher1 | ||
And I navigate to "Badges > Manage badges" in current page administration | ||
And I navigate to "Badges" in current page administration | ||
And I follow "Course Badge" | ||
And I press "Award badge" | ||
When I set the field "role" to "Teacher" | ||
|
@@ -155,7 +155,7 @@ Feature: Award badges with separate groups | |
And I set the field "Group mode" to "Visible groups" | ||
And I press "Save and display" | ||
When I am on the "Course 1" course page logged in as <loggedinuser> | ||
And I navigate to "Badges > Manage badges" in current page administration | ||
And I navigate to "Badges" in current page administration | ||
And I follow "Course Badge" | ||
And I press "Award badge" | ||
And I set the field "role" to "<awarder>" | ||
|
@@ -196,7 +196,7 @@ Feature: Award badges with separate groups | |
And I set the field "Group mode" to "No groups" | ||
And I press "Save and display" | ||
When I am on the "Course 1" course page logged in as <loggedinuser> | ||
And I navigate to "Badges > Manage badges" in current page administration | ||
And I navigate to "Badges" in current page administration | ||
And I follow "Course Badge" | ||
And I press "Award badge" | ||
And I set the field "role" to "<awarder>" | ||
|
Oops, something went wrong.