MDL-82503 badges: Fix behat and PHPUnit tests

This commit is contained in:
Sara Arjona 2024-08-14 16:46:57 +02:00
parent 9b58ab3e87
commit 2f4efdb879
No known key found for this signature in database
15 changed files with 91 additions and 162 deletions

View file

@ -69,7 +69,7 @@ Feature: Import course's contents into another course
| Unpublished course badge | editingteacher |
When I import "Course 1" course into "Course 2" course using this options:
| Settings | Include badges | 1 |
And I navigate to "Badges > Manage badges" in current page administration
And I navigate to "Badges" in current page administration
Then I should see "Published course badge"
And I should see "Unpublished course badge"
And I should see "Unpublished without criteria course badge"

View file

@ -285,7 +285,7 @@ Feature: Restore Moodle 2 course backups
| Confirmation | Filename | test_backup.mbz |
When I restore "test_backup.mbz" backup into a new course using this options:
| Settings | Include badges | 1 |
And I navigate to "Badges > Manage badges" in current page administration
And I navigate to "Badges" in current page administration
Then I should see "Published course badge"
And I should see "Unpublished course badge"
And I should see "Unpublished without criteria course badge"

View file

@ -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 "testuser@example.com"
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"

View file

@ -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,7 +47,7 @@ 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"
@ -55,7 +55,7 @@ Feature: Award badges
And I set the field "potentialrecipients[]" to "Student 1 (student1@example.com)"
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 (student1@example.com)"
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,7 +290,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 1"
And I select "Recipients (0)" from the "jump" singleselect
And I press "Award badge"
@ -288,7 +298,7 @@ Feature: Award badges
And I set the field "potentialrecipients[]" to "Student 1 (student1@example.com)"
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 (student2@example.com)"
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 (student1@example.com)"
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 (student1@example.com)"
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)"

View file

@ -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 (student2@example.com)"
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>"

View file

@ -46,28 +46,14 @@ Feature: Test tertiary navigation as various users
Given I log in as "<user>"
And I am on "Course 1" course homepage
When I navigate to "Badges" in current page administration
Then "Manage badges" "button" should exist
And "Add a new badge" "button" <createbutton>
Then "Add a new badge" "button" <createbutton>
And I should see "<activetab>" is active in secondary navigation
And I click on "Manage badges" "button"
And "Manage badges" "button" should not exist
And "Back" "button" should exist
And "Add a new badge" "button" <createbutton>
And I should see "<activetab>" is active in secondary navigation
And I click on "Back" "button"
And "Back" "button" should not exist
And "Manage badges" "button" should exist
And "Add a new badge" "button" <createbutton>
And I should see "<activetab>" is active in secondary navigation
And I click on "Manage badges" "button"
And I click on "Testing course badge" "link"
And "Manage badges" "button" should not exist
And "Add a new badge" "button" should not exist
And "Back" "button" should exist
And I should see "<activetab>" is active in secondary navigation
And I click on "Back" "button"
And "Back" "button" should exist
And "Manage badges" "button" should not exist
And "Add a new badge" "button" <createbutton>
And I should see "<activetab>" is active in secondary navigation
@ -84,7 +70,6 @@ Feature: Test tertiary navigation as various users
# Enable one badge.
When I am on the "C1" "Course" page logged in as "admin"
And I navigate to "Badges" in current page administration
And I click on "Manage badges" "button"
And I press "Enable access" action in the "Testing course badge" report row
And I click on "Enable" "button" in the "Confirm" "dialogue"
And I log out
@ -93,24 +78,20 @@ Feature: Test tertiary navigation as various users
Then "Badges" "link" should exist in current page administration
And I navigate to "Badges" in current page administration
And "Back" "button" should not exist
And "Manage badges" "button" should not exist
And "Add a new badge" "button" should not exist
And I should see "Badges" is active in secondary navigation
Scenario: Check navigation as an admin in a site context
Given I log in as "admin"
When I navigate to "Badges > Manage badges" in site administration
Then "Manage badges" "button" should not exist
And "Add a new badge" "button" should exist
Then "Add a new badge" "button" should exist
And I should see "General" is active in secondary navigation
And I click on "Testing site badge" "link"
And "Manage badges" "button" should not exist
And "Add a new badge" "button" should not exist
And "Back" "button" should exist
And I should see "General" is active in secondary navigation
And I click on "Back" "button"
And "Back" "button" should not exist
And "Manage badges" "button" should not exist
And "Add a new badge" "button" should exist
Scenario Outline: Check secondary navigation highlights after tertiary nav jumps in site admin
@ -135,7 +116,6 @@ Feature: Test tertiary navigation as various users
Given I log in as "admin"
And I am on "Course 1" course homepage
And I navigate to "Badges" in current page administration
And I click on "Manage badges" "button"
And I click on "Testing course badge" "link"
When I select "<option>" from the "jump" singleselect
Then I should see "More" is active in secondary navigation

View file

@ -52,7 +52,6 @@ Feature: Award badges based on activity completion
Scenario: Student does not earn a badge using activity completion when does not get passing grade
Given I navigate to "Badges" in current page administration
And I press "Manage badges"
And I follow "Course Badge 1"
And I select "Criteria" from the "jump" singleselect
And I set the field "type" to "Activity completion"
@ -69,7 +68,7 @@ Feature: Award badges based on activity completion
And user "student2" has attempted "Test quiz name 1" with responses:
| slot | response |
| 1 | False |
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"
Then I should see "Recipients (1)"
And I select "Recipients (1)" from the "jump" singleselect
@ -78,7 +77,6 @@ Feature: Award badges based on activity completion
Scenario: Students with any grades in an activity will receive a badge if the completion condition is set to receive any grade
Given I navigate to "Badges" in current page administration
And I press "Manage badges"
And I follow "Course Badge 2"
And I select "Criteria" from the "jump" singleselect
And I set the field "type" to "Activity completion"
@ -94,7 +92,7 @@ Feature: Award badges based on activity completion
And user "student2" has attempted "Test quiz name 2" with responses:
| slot | response |
| 1 | False |
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"
Then I should see "Recipients (2)"
And I select "Recipients (2)" from the "jump" singleselect
@ -111,7 +109,6 @@ Feature: Award badges based on activity completion
| slot | response |
| 1 | False |
And I navigate to "Badges" in current page administration
And I press "Manage badges"
And I follow "Course Badge 1"
And I select "Criteria" from the "jump" singleselect
And I set the field "type" to "Activity completion"

View file

@ -47,7 +47,6 @@ Feature: Award badges based on competency completion
And I am on "Course 1" course homepage
And I change window size to "large"
And I navigate to "Badges" in current page administration
And I press "Manage badges"
And I follow "Course Badge"
And I select "Criteria" from the "jump" singleselect
# Set the competency as a criteria for the badge

View file

@ -19,33 +19,33 @@ Feature: Delete course badge already awarded
@javascript
Scenario Outline: Delete course badge already awarded to student
Given the following "core_badges > Badges" exist:
| name | course | description | image | status | type |
| <badgename> | C1 | <badgename> description | badges/tests/behat/badge.png | active | 2 |
| name | course | description | image | status | type |
| Testing badge 1 | C1 | Testing badge 1 description | badges/tests/behat/badge.png | active | 2 |
And the following "core_badges > Criterias" exist:
| badge | role |
| <badgename> | editingteacher |
| badge | role |
| Testing badge 1 | editingteacher |
And the following "core_badges > Issued badges" exist:
| badge | user |
| <badgename> | student1 |
| badge | user |
| Testing badge 1 | student1 |
When I am on the "Course 1" "enrolled users" page logged in as "teacher1"
And I click on "Student 1" "link"
Then I should see "<badgename>"
Then I should see "Testing badge 1"
And I am on the "Course 1" course page
# Navigate to Manage Badges page in order to delete the badge
And I navigate to "Badges > Manage badges" in current page administration
# Navigate to Badges page in order to delete the badge
And I navigate to "Badges" in current page administration
# Delete the badge
And I press "Delete" action in the "<badgename>" report row
And I press "Delete" action in the "Testing badge 1" report row
And I press "<deleteoption>"
And the following <shouldtable> exist in the "reportbuilder-table" table:
| Name | Badge status |
| Testing badge 1 | Archived |
And I <shouldmsg> see "There are no matching badges available for users to earn"
# Confirm that badge is retained in the first case as awarded badge but not in the second.
And I am on the "Course 1" "enrolled users" page
And I click on "Student 1" "link"
# Confirm that Badge 1 is retained as awarded badge but Badge 2 is not
And I <visibility> see "<badgename>"
And I am on the "Course 1" course page
# Navigate to Badges page to confirm that no badges exist, hence, Manage badges would not exist
And I navigate to "Badges" in current page administration
# Confirm that badges are sucessfully deleted
And I should see "There are no matching badges available for users to earn"
And I <shouldtable> see "Testing badge 1"
Examples:
| badgename | deleteoption | visibility |
| Badge 1 | Delete and keep existing issued badges | should |
| Badge 2 | Delete and remove existing issued badges | should not |
| deleteoption | shouldtable | shouldmsg |
| Delete and keep existing issued badges | should | should not |
| Delete and remove existing issued badges | should not | should |

View file

@ -23,9 +23,9 @@ Feature: Manage badges
And I press "Save changes"
And I click on "Back" "button"
Then the following should exist in the "reportbuilder-table" table:
| Name | Version | Badge status |
| Badge #1 | 1.0 | Not available |
| Copy of Badge #1 | 1.0 | Not available |
| Name | Badge status |
| Badge #1 | Not available |
| Copy of Badge #1 | Not available |
Scenario: Edit a badge
Given I log in as "admin"
@ -37,8 +37,10 @@ Feature: Manage badges
And I press "Save changes"
And I click on "Back" "button"
Then the following should exist in the "reportbuilder-table" table:
| Name | Version | Badge status |
| New Badge #1 | 1.1 | Not available |
| Name | Badge status |
| New Badge #1 | Not available |
And I follow "New Badge #1"
And I should see "1.1"
Scenario: Delete a badge
Given I log in as "admin"

View file

@ -1,11 +1,10 @@
@core @core_badges @_file_upload @javascript
Feature: Manage badges is not shown when there are no existing badges.
Feature: Badges not shown when there are no existing badges.
Scenario: Check navigation at site level with no badges
Given I log in as "admin"
When I navigate to "Badges > Manage badges" in site administration
And I should see "There are no matching badges available for users to earn"
Then "Manage badges" "button" should not exist
Then I should see "There are no matching badges available for users to earn"
Scenario: Check navigation at course level with no badges
Given the following "users" exist:
@ -20,8 +19,7 @@ Feature: Manage badges is not shown when there are no existing badges.
And I log in as "teacher"
And I am on "Course 1" course homepage
When I navigate to "Badges" in current page administration
Then "Manage badges" "button" should not exist
And I click on "Add a new badge" "button"
Then I click on "Add a new badge" "button"
And I set the following fields to these values:
| Name | Testing course badge |
| Version | 1.1 |
@ -33,11 +31,6 @@ Feature: Manage badges is not shown when there are no existing badges.
And I click on "Create badge" "button"
And I click on "Back" "button"
And I should see "Testing course badge"
And I click on "Back" "button"
And "Manage badges" "button" should exist
# Badge is not enabled so is not listed.
And I should not see "Testing course badge"
And I click on "Manage badges" "button"
And I press "Edit" action in the "Testing course badge" report row
And I click on "Add criteria" "button"
And I set the field "type" to "Manual issue by role"
@ -46,18 +39,9 @@ Feature: Manage badges is not shown when there are no existing badges.
And I click on "Save" "button"
And I click on "Back" "button"
And I should see "Testing course badge"
And I click on "Back" "button"
And "Manage badges" "button" should exist
# Badge is not enabled yet so is not listed.
And I should not see "Testing course badge"
And I click on "Manage badges" "button"
And I press "Enable access" action in the "Testing course badge" report row
And I click on "Enable" "button" in the "Confirm" "dialogue"
And I should see "Testing course badge"
And I click on "Back" "button"
And "Manage badges" "button" should exist
# Badge is already enabled so is listed.
And I should see "Testing course badge"
Scenario: Check navigation at course level with no badges as a student
# Create a badge, but leave it not enabled for now.
@ -90,16 +74,14 @@ Feature: Manage badges is not shown when there are no existing badges.
# Enable the badge.
And I am on the "C1" "Course" page logged in as "admin"
And I navigate to "Badges" in current page administration
And I click on "Manage badges" "button"
And I press "Enable access" action in the "Testing course badge" report row
And I click on "Enable" "button" in the "Confirm" "dialogue"
And I log out
# Now student should see the Badges link.
And I am on the "C1" "Course" page logged in as "student1"
And I follow "Badges"
And "Manage badges" "button" should not exist
And "Add a new badge" "button" should not exist
And I should not see "There are no matching badges available for users to earn"
And the following should exist in the "Course badges" table:
| Name | Description | Criteria |
| Testing course badge | Testing course badge description | Awarded by: Teacher |
And I should not see "There are no matching badges available for users to earn."
And the following should exist in the "reportbuilder-table" table:
| Name | Criteria |
| Testing course badge | Awarded by: Teacher |

View file

@ -69,9 +69,7 @@ class manage_badge_action_bar_test extends \advanced_testcase {
]
],
"Test tertiary nav as a student" => [
"student", [
'Overview'
]
"student", [],
]
];
}

View file

@ -23,7 +23,7 @@ Feature: Enable Block Badges in a course
| Badge 1 | editingteacher |
| Badge 2 | 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 "Badge 1"
And I select "Recipients (0)" from the "jump" singleselect
And I press "Award badge"
@ -31,7 +31,7 @@ Feature: Enable Block Badges in a course
And I press "Award badge"
# Issue Badge 2 of 2
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 "Badge 2"
And I select "Recipients (0)" from the "jump" singleselect
And I press "Award badge"

View file

@ -28,7 +28,7 @@ Feature: Enable Block Badges on the dashboard and view awarded badges
| badge | 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 "Badge 1"
And I select "Recipients (0)" from the "jump" singleselect
And I press "Award badge"

View file

@ -28,7 +28,7 @@ Feature: Enable Block Badges on the frontpage and view awarded badges
| badge | 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 "Badge 1"
And I select "Recipients (0)" from the "jump" singleselect
And I press "Award badge"