diff --git a/badges/tests/behat/add_badge.feature b/badges/tests/behat/add_badge.feature index 4c36aff639f..99c906844a2 100644 --- a/badges/tests/behat/add_badge.feature +++ b/badges/tests/behat/add_badge.feature @@ -40,12 +40,11 @@ Feature: Add badges to the system And I should see "Alignments (0)" And I should not see "Create badge" And I should not see "Issuer details" - And I follow "Overview" + And I select "Overview" from the "jump" singleselect And I should see "Issuer details" And I should see "Test Badge Site" And I should see "testuser@example.com" And I navigate to "Badges > Manage badges" in site administration - And I should see "Number of badges available: 1" And I should not see "There are no badges available." @javascript @_file_upload @@ -62,7 +61,6 @@ Feature: Add badges to the system And I press "Create badge" And I wait until the page is ready And I navigate to "Badges > Manage badges" in site administration - And I should see "Number of badges available: 1" And I press "Add a new badge" And I set the following fields to these values: | Name | Test Badge 2 | @@ -73,7 +71,7 @@ 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 follow "Related badges (0)" + And I select "Related badges (0)" from the "jump" singleselect And I should see "This badge does not have any related badges." And I press "Add related badge" And I follow "Related badges" @@ -97,7 +95,7 @@ Feature: Add badges to the system When I press "Create badge" Then I should see "Edit details" And I should see "Endorsement" - And I follow "Endorsement" + And I select "Endorsement" from the "jump" singleselect And I set the following fields to these values: | Endorser name | Endorser | | Email | endorsement@example.com | @@ -121,7 +119,7 @@ Feature: Add badges to the system When I press "Create badge" Then I should see "Test Badge" And I should see "Endorsement" - And I follow "Alignments (0)" + And I select "Alignments (0)" from the "jump" singleselect And I should see "This badge does not have any external skills or standards specified." And I press "Add external skill or standard" And I set the following fields to these values: @@ -158,7 +156,6 @@ Feature: Add badges to the system And I should see "Alignments (0)" And I should not see "Create badge" And I navigate to "Badges > Manage badges" in site administration - And I should see "Number of badges available: 1" And I should not see "There are no badges available." # See buttons from the "Site badges" page. And I am on homepage @@ -183,14 +180,14 @@ 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" - When I follow "Edit details" + When I select "Edit details" from the "jump" singleselect And I should see "Test badge with 'apostrophe' and other friends (&@#)" And I should not see "Issuer details" And I set the following fields to these values: | Name | Test badge renamed | | Version | secondversion | And I press "Save changes" - And I follow "Overview" + And I select "Overview" from the "jump" singleselect Then I should not see "Test badge with 'apostrophe' and other friends (&@#)" And I should not see "firstversion" And I should see "Test badge renamed" diff --git a/badges/tests/behat/award_badge.feature b/badges/tests/behat/award_badge.feature index e780e812982..d9947f6d624 100644 --- a/badges/tests/behat/award_badge.feature +++ b/badges/tests/behat/award_badge.feature @@ -63,7 +63,7 @@ Feature: Award badges And I am on "Course 1" course homepage And I navigate to "Badges > Manage badges" in current page administration And I follow "Course Badge 1" - And I follow "Recipients (0)" + 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 (student1@example.com)" @@ -71,7 +71,7 @@ Feature: Award badges And I am on "Course 1" course homepage And I navigate to "Badges > Manage badges" in current page administration And I follow "Course Badge 1" - And I follow "Recipients (1)" + And I select "Recipients (1)" from the "jump" singleselect Then I should see "Recipients (1)" And I log out # Student 1 should have both badges. @@ -152,7 +152,7 @@ Feature: Award badges And I press "Save" And I press "Enable access" And I press "Continue" - And I follow "Recipients (0)" + And I select "Recipients (0)" from the "jump" singleselect And I press "Award badge" And I set the field "potentialrecipients[]" to "Teacher 1 (teacher1@example.com)" And I press "Award badge" @@ -181,7 +181,7 @@ Feature: Award badges And I press "Save" And I press "Enable access" And I press "Continue" - And I follow "Recipients (0)" + And I select "Recipients (0)" from the "jump" singleselect And I press "Award badge" And I set the field "potentialrecipients[]" to "Student 2 (student2@example.com)" And I press "Award badge" @@ -284,7 +284,7 @@ Feature: Award badges And I press "Save" And I press "Enable access" And I press "Continue" - And I follow "Recipients (0)" + 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 (student1@example.com)" @@ -292,7 +292,7 @@ Feature: Award badges And I am on "Course 1" course homepage And I navigate to "Badges > Manage badges" in current page administration And I follow "Course Badge 1" - And I follow "Recipients (1)" + And I select "Recipients (1)" from the "jump" singleselect Then I should see "Recipients (1)" # Add course badge 2. And I am on "Course 1" course homepage @@ -310,7 +310,7 @@ Feature: Award badges And I press "Save" And I press "Enable access" And I press "Continue" - And I follow "Recipients (0)" + And I select "Recipients (0)" from the "jump" singleselect And I press "Award badge" # Award course badge 2 to student 2. And I set the field "potentialrecipients[]" to "Student 2 (student2@example.com)" @@ -318,7 +318,7 @@ Feature: Award badges And I am on "Course 1" course homepage And I navigate to "Badges > Manage badges" in current page administration And I follow "Course Badge 2" - And I follow "Recipients (1)" + And I select "Recipients (1)" from the "jump" singleselect Then I should see "Recipients (1)" And I log out And I trigger cron @@ -351,7 +351,7 @@ Feature: Award badges And I press "Save" And I press "Enable access" And I press "Continue" - And I follow "Recipients (0)" + And I select "Recipients (0)" from the "jump" singleselect And I press "Award badge" And I set the field "potentialrecipients[]" to "Student 2 (student2@example.com)" And I press "Award badge" @@ -361,7 +361,7 @@ Feature: Award badges And I navigate to "Badges > Manage badges" in current page administration And I follow "Course Badge" Then I should see "Recipients (2)" - And I follow "Recipients (2)" + And I select "Recipients (2)" from the "jump" singleselect And I press "Award badge" And I set the field "existingrecipients[]" to "Student 2 (student2@example.com)" And I press "Revoke badge" diff --git a/badges/tests/behat/backpack.feature b/badges/tests/behat/backpack.feature index e2a745165ce..3f584b6d1f0 100644 --- a/badges/tests/behat/backpack.feature +++ b/badges/tests/behat/backpack.feature @@ -60,7 +60,7 @@ Feature: Backpack badges And I press "Save" And I press "Enable access" And I press "Continue" - And I follow "Recipients (0)" + And I select "Recipients (0)" from the "jump" singleselect And I press "Award badge" And I set the field "potentialrecipients[]" to "Student 1 (student1@example.com)" And I press "Award badge" @@ -97,7 +97,7 @@ Feature: Backpack badges And I press "Save" And I press "Enable access" And I press "Continue" - And I follow "Recipients (0)" + And I select "Recipients (0)" from the "jump" singleselect And I press "Award badge" And I set the field "potentialrecipients[]" to "Student 1 (student1@example.com)" And I press "Award badge" diff --git a/badges/tests/behat/badge_navigation.feature b/badges/tests/behat/badge_navigation.feature new file mode 100644 index 00000000000..f88a49692b6 --- /dev/null +++ b/badges/tests/behat/badge_navigation.feature @@ -0,0 +1,147 @@ +@core @core_badges @_file_upload @javascript +Feature: Test tertiary navigation as various users + + Background: + Given the following "users" exist: + | username | firstname | lastname | email | + | student1 | Student | 1 | student1@example.com | + | teacher | Teacher | 1 | teacher@example.com | + | nonediting | Nonediting | 1 | nonediting@example.com | + And the following "courses" exist: + | fullname | shortname | format | enablecompletion | + | Course 1 | C1 | topics | 1 | + And the following "course enrolments" exist: + | user | course | role | + | teacher | C1 | editingteacher | + | student1 | C1 | student | + | nonediting | C1 | teacher | + # Create system badge and define a criterion. + And I log in as "admin" + And I am on "Course 1" course homepage + And I navigate to "Badges > Add a new badge" in current page administration + And I set the following fields to these values: + | Name | Testing course badge | + | Version | 1.1 | + | Language | Catalan | + | Description | Testing course badge description | + | Image author | http://author.example.com | + | Image caption | Test caption image | + And I upload "badges/tests/behat/badge.png" file to "Image" filemanager + And I press "Create badge" + And I set the field "type" to "Manual issue by role" + And I expand all fieldsets + And I set the field "Teacher" to "1" + And I press "Save" + And I am on site homepage + And I navigate to "Badges > Add a new badge" in site administration + And I set the following fields to these values: + | Name | Testing site badge | + | Version | 1.1 | + | Language | Catalan | + | Description | Testing site badge description | + | Image author | http://author.example.com | + | Image caption | Test caption image | + And I upload "badges/tests/behat/badge.png" file to "Image" filemanager + And I press "Create badge" + And I set the field "type" to "Manual issue by role" + And I expand all fieldsets + And I set the field "Teacher" to "1" + And I press "Save" + + Scenario Outline: Check navigation as different users in a course context + Given I log in as "" + 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" + And I should see "" 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" + And I should see "" 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" + And I should see "" 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 "" 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" + And I should see "" is active in secondary navigation + + Examples: + | user | createbutton | activetab | + | admin | should exist | More | + | teacher | should exist | More | + | nonediting | should not exist | Badges | + + Scenario: Check navigation as a student + Given I log in as "student1" + And I am on "Course 1" course homepage + When I navigate to "Badges" in current page administration + Then "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 + And I should see "Site administration" 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 "Site administration" 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 + Given I log in as "admin" + And I navigate to "Badges > Manage badges" in site administration + And I click on "Testing site badge" "link" + When I select "