Skip to content

Commit

Permalink
MDL-72090 navigation: Update to behat feature files for navigation.
Browse files Browse the repository at this point in the history
This updates feature files to use the new steps to navigate to certain
pages.
  • Loading branch information
abgreeve committed Dec 9, 2021
1 parent 8a5e36f commit fcd4de8
Show file tree
Hide file tree
Showing 66 changed files with 160 additions and 287 deletions.
3 changes: 1 addition & 2 deletions admin/roles/tests/behat/override_roles_highlighting.feature
Expand Up @@ -12,8 +12,7 @@ Feature: Highlight non-inherited permissions

@javascript
Scenario: Override a permission
Given I am on "Course fullname" course homepage
And I navigate to "Users > Permissions" in current page administration
Given I am on the "Course fullname" "permissions" page
And I select "Manager (0)" from the "roleid" singleselect
And I click on "Prohibit" "radio" in the "View added and updated modules in recent activity block" "table_row"
And I press "Save changes"
Expand Down
8 changes: 4 additions & 4 deletions admin/tests/behat/check.feature
Expand Up @@ -27,8 +27,8 @@ Feature: Staff can check user permissions

@javascript
Scenario: Search for a user (enrolled on the course) by custom field and select them to see permissions
When I am on the "C1" "Course" page logged in as "admin"
And I navigate to "Users > Permissions > Check permissions" in current page administration
When I am on the "C1" "permissions" page logged in as "admin"
And I select "Check permissions" from the "jump" singleselect
And I set the field "Search" to "Kermit"
# The Behat 'I should see' step doesn't work for optgroup labels.
Then "optgroup[label='Matching enrolled users (1)']" "css_element" should exist
Expand All @@ -41,8 +41,8 @@ Feature: Staff can check user permissions

@javascript
Scenario: Search for a user (not enrolled on the course) by custom field and select them to see permissions
When I am on the "C1" "Course" page logged in as "admin"
And I navigate to "Users > Permissions > Check permissions" in current page administration
When I am on the "C1" "permissions" page logged in as "admin"
And I select "Check permissions" from the "jump" singleselect
And I set the field "Search" to "Kermit"
# The Behat 'I should see' step doesn't work for optgroup labels.
Then "optgroup[label*='Potential users matching'][label*=' (1)']" "css_element" should exist
Expand Down
9 changes: 3 additions & 6 deletions admin/tool/behat/tests/behat/data_generators.feature
Expand Up @@ -57,8 +57,7 @@ Feature: Set up contextual data for tests
| Grouping 1 | C1 | GG1 |
| Grouping 2 | C1 | GG2 |
When I log in as "admin"
And I am on "Course 1" course homepage
And I navigate to "Users > Groups" in current page administration
And I am on the "Course 1" "groups" page
Then I should see "Group 1"
And I should see "Group 2"
And I select "Groupings" from the "jump" singleselect
Expand Down Expand Up @@ -86,8 +85,7 @@ Feature: Set up contextual data for tests
| mod/forum:editanypost | Allow | student | Course | C1 |
| mod/forum:replynews | Prevent | editingteacher | Course | C1 |
When I log in as "admin"
And I am on "Course 1" course homepage
And I navigate to "Users > Permissions" in current page administration
And I am on the "Course 1" "permissions" page
And I set the field "Advanced role override" to "Student (1)"
Then "mod/forum:editanypost" capability has "Allow" permission
And I press "Cancel"
Expand Down Expand Up @@ -254,8 +252,7 @@ Feature: Set up contextual data for tests
| grouping | group |
| GG1 | G1 |
When I log in as "admin"
And I am on "Course 1" course homepage
And I navigate to "Users > Groups" in current page administration
And I am on the "Course 1" "groups" page
Then the "groups" select box should contain "Group 1 (1)"
And the "groups" select box should contain "Group 2 (1)"
And I set the field "groups" to "Group 1 (1)"
Expand Down
10 changes: 5 additions & 5 deletions admin/tool/behat/tests/behat/edit_permissions.feature
Expand Up @@ -35,14 +35,14 @@ Feature: Edit capabilities

Scenario: Course capabilities overrides
Given I log in as "teacher1"
And I am on "Course 1" course homepage
And I navigate to "Users > Permissions" in current page administration
And I am on the "Course 1" "permissions" page
And I override the system permissions of "Student" role with:
| mod/forum:deleteanypost | Prohibit |
| mod/forum:editanypost | Prevent |
| mod/forum:addquestion | Allow |
When I set the field "Advanced role override" to "Student (3)"
And I click on "Go" "button" in the "div.advancedoverride" "css_element"
# There are two select elements and go buttons and we want to press the second one.
And I click on "//div[@class='advancedoverride']/div/form/noscript/input" "xpath_element"
Then "mod/forum:deleteanypost" capability has "Prohibit" permission
And "mod/forum:editanypost" capability has "Prevent" permission
And "mod/forum:addquestion" capability has "Allow" permission
Expand All @@ -64,7 +64,7 @@ Feature: Edit capabilities
| mod/forum:editanypost | Prevent |
| mod/forum:addquestion | Allow |
When I set the field "Advanced role override" to "Student (3)"
And I click on "Go" "button" in the "region-main" "region"
And I click on "//div[@class='advancedoverride']/div/form/noscript/input" "xpath_element"
Then "mod/forum:deleteanypost" capability has "Prohibit" permission
And "mod/forum:editanypost" capability has "Prevent" permission
And "mod/forum:addquestion" capability has "Allow" permission
Expand All @@ -82,7 +82,7 @@ Feature: Edit capabilities
Then I should see "Teacher >= editing (Teacher)" in the "Teacher 1" "table_row"
And I should see "Teacher < \"editing\" (Non-editing teacher)" in the "Teaching Assistant" "table_row"
And I should see "Studier & 'learner' (Student)" in the "Student One" "table_row"
And I navigate to "Users > Permissions" in current page administration
And I am on the "C1" "permissions" page
And I should see "Teacher >= editing" in the "mod/forum:replypost" "table_row"
And I should see "Teacher < \"editing\"" in the "mod/forum:replypost" "table_row"
And I should see "Studier & 'learner'" in the "mod/forum:replypost" "table_row"
Expand Down
6 changes: 2 additions & 4 deletions admin/tool/behat/tests/behat/get_and_set_fields.feature
Expand Up @@ -33,8 +33,7 @@ Feature: Verify that all form fields values can be get and set
| activity | course | idnumber | name | intro | firstpagetitle | wikimode | visible |
| wiki | C1 | wiki1 | Test this one | Test this one | Test this one | collaborative | 0 |
And I log in as "admin"
And I am on "Course 1" course homepage
And I navigate to "Reset" in current page administration
And I am on the "Course 1" "reset" page
# Select (multi-select) - Checking "the select box should contain".
And I expand all fieldsets
And the "Unenrol users" select box should contain "No roles"
Expand Down Expand Up @@ -147,8 +146,7 @@ Feature: Verify that all form fields values can be get and set

@javascript
Scenario: with JS enabled all form fields getters and setters works as expected
Then I am on "Course 1" course homepage
And I navigate to "Users > Groups" in current page administration
Then I am on the "Course 1" "groups" page
# Select (multi-select & AJAX) - Checking "I set the field" and "select box should contain".
And I set the field "groups" to "Group 2"
And the "members" select box should contain "Student 2 (s2@example.com)"
Expand Down
Expand Up @@ -77,8 +77,7 @@ Feature: Basic recycle bin functionality
And I wait to be redirected
And I go to the courses management page
And I should see "Course 2" in the "#course-listing" "css_element"
And I am on "Course 2" course homepage
And I navigate to "Users > Groups" in current page administration
And I am on the "Course 2" "groups" page
And I select "Overview" from the "jump" singleselect
And "Student 1" "text" should exist in the "Group A" "table_row"
And "Student 2" "text" should exist in the "Group A" "table_row"
Expand Down
30 changes: 10 additions & 20 deletions admin/tool/uploadcourse/tests/behat/enrolments.feature
Expand Up @@ -12,8 +12,7 @@ Feature: An admin can update courses enrolments using a CSV file

@javascript
Scenario: Creating enrolment method by enable it
Given I am on "Course 1" course homepage
And I navigate to "Users > Enrolment methods" in current page administration
Given I am on the "Course 1" "enrolment methods" page
And I click on "Delete" "link" in the "Guest access" "table_row"
And I click on "Continue" "button"
And I should not see "Guest access" in the "generaltable" "table"
Expand All @@ -25,14 +24,12 @@ Feature: An admin can update courses enrolments using a CSV file
And I click on "Preview" "button"
When I click on "Upload courses" "button"
Then I should see "Course updated"
And I am on "Course 1" course homepage
And I navigate to "Users > Enrolment methods" in current page administration
And I am on the "Course 1" "enrolment methods" page
And "Disable" "icon" should exist in the "Guest access" "table_row"

@javascript
Scenario: Creating enrolment method by disabling it
Given I am on "Course 1" course homepage
And I navigate to "Users > Enrolment methods" in current page administration
Given I am on the "Course 1" "enrolment methods" page
And I click on "Delete" "link" in the "Guest access" "table_row"
And I click on "Continue" "button"
And I should not see "Guest access" in the "generaltable" "table"
Expand All @@ -44,8 +41,7 @@ Feature: An admin can update courses enrolments using a CSV file
And I click on "Preview" "button"
When I click on "Upload courses" "button"
Then I should see "Course updated"
And I am on "Course 1" course homepage
And I navigate to "Users > Enrolment methods" in current page administration
And I am on the "Course 1" "enrolment methods" page
And "Enable" "icon" should exist in the "Guest access" "table_row"

@javascript
Expand All @@ -58,14 +54,12 @@ Feature: An admin can update courses enrolments using a CSV file
And I click on "Preview" "button"
When I click on "Upload courses" "button"
Then I should see "Course updated"
And I am on "Course 1" course homepage
And I navigate to "Users > Enrolment methods" in current page administration
And I am on the "Course 1" "enrolment methods" page
And "Disable" "icon" should exist in the "Guest access" "table_row"

@javascript
Scenario: Disable an enrolment method
Given I am on "Course 1" course homepage
And I navigate to "Users > Enrolment methods" in current page administration
Given I am on the "Course 1" "enrolment methods" page
And I click on "Enable" "link" in the "Guest access" "table_row"
And "Disable" "icon" should exist in the "Guest access" "table_row"
And I navigate to "Courses > Upload courses" in site administration
Expand All @@ -76,8 +70,7 @@ Feature: An admin can update courses enrolments using a CSV file
And I click on "Preview" "button"
When I click on "Upload courses" "button"
Then I should see "Course updated"
And I am on "Course 1" course homepage
And I navigate to "Users > Enrolment methods" in current page administration
And I am on the "Course 1" "enrolment methods" page
And "Enable" "icon" should exist in the "Guest access" "table_row"

@javascript
Expand All @@ -90,14 +83,12 @@ Feature: An admin can update courses enrolments using a CSV file
And I click on "Preview" "button"
When I click on "Upload courses" "button"
Then I should see "Course updated"
And I am on "Course 1" course homepage
And I navigate to "Users > Enrolment methods" in current page administration
And I am on the "Course 1" "enrolment methods" page
And I should not see "Guest access" in the "generaltable" "table"

@javascript
Scenario: Delete an unexistent enrolment method (nothing should change)
Given I am on "Course 1" course homepage
And I navigate to "Users > Enrolment methods" in current page administration
Given I am on the "Course 1" "enrolment methods" page
And I click on "Delete" "link" in the "Guest access" "table_row"
And I click on "Continue" "button"
And I should not see "Guest access" in the "generaltable" "table"
Expand All @@ -109,6 +100,5 @@ Feature: An admin can update courses enrolments using a CSV file
And I click on "Preview" "button"
When I click on "Upload courses" "button"
Then I should see "Course updated"
And I am on "Course 1" course homepage
And I navigate to "Users > Enrolment methods" in current page administration
And I am on the "Course 1" "enrolment methods" page
And I should not see "Guest access" in the "generaltable" "table"
3 changes: 1 addition & 2 deletions admin/tool/uploaduser/tests/behat/upload_users.feature
Expand Up @@ -33,8 +33,7 @@ Feature: Upload users
And I should see "Tom Jones"
And I should see "Trent Reznor"
And I should see "reznor@example.com"
And I am on "Maths" course homepage
And I navigate to "Users > Groups" in current page administration
And I am on the "Maths" "groups" page
And I set the field "groups" to "Section 1 (1)"
And the "members" select box should contain "Tom Jones (jonest@example.com)"

Expand Down
1 change: 1 addition & 0 deletions backup/util/ui/tests/behat/behat_backup.php
Expand Up @@ -28,6 +28,7 @@
require_once(__DIR__ . '/../../../../../lib/behat/behat_base.php');
require_once(__DIR__ . '/../../../../../lib/behat/behat_field_manager.php');
require_once(__DIR__ . '/../../../../../lib/tests/behat/behat_navigation.php');
require_once(__DIR__ . '/../../../../../lib/behat/form_field/behat_form_field.php');

use Behat\Gherkin\Node\TableNode as TableNode,
Behat\Mink\Exception\ElementNotFoundException as ElementNotFoundException,
Expand Down
6 changes: 3 additions & 3 deletions backup/util/ui/tests/behat/import_course.feature
Expand Up @@ -40,10 +40,10 @@ Feature: Import course's contents into another course
And I log in as "teacher1"
When I import "Course 1" course into "Course 2" course using this options:
| Initial | Include permission overrides | 1 |
And I navigate to "Users > Permissions" in current page administration
And I am on the "Course 1" "permissions" page
Then I should see "Non-editing teacher (1)"
And I set the field "Advanced role override" to "Non-editing teacher (1)"
And I click on "Go" "button" in the "div.advancedoverride" "css_element"
And I click on "//div[@class='advancedoverride']/div/form/noscript/input" "xpath_element"
And "enrol/manual:enrol" capability has "Allow" permission

Scenario: Import process without permission option
Expand All @@ -53,5 +53,5 @@ Feature: Import course's contents into another course
And I log in as "teacher1"
When I import "Course 1" course into "Course 2" course using this options:
| Initial | Include permission overrides | 0 |
And I navigate to "Users > Permissions" in current page administration
And I am on the "Course 2" "permissions" page
Then I should see "Non-editing teacher (0)"
4 changes: 2 additions & 2 deletions backup/util/ui/tests/behat/import_groups.feature
Expand Up @@ -30,7 +30,7 @@ Feature: Option to include groups and groupings when importing a course to anoth
Scenario: Include groups and groupings when importing a course to another course
Given I import "Course 1" course into "Course 2" course using this options:
| Initial | Include groups and groupings | 1 |
When I navigate to "Users > Groups" in current page administration
When I am on the "Course 2" "groups" page
Then I should see "Group 1"
And I should see "Group 2"
And I select "Groupings" from the "jump" singleselect
Expand All @@ -40,7 +40,7 @@ Feature: Option to include groups and groupings when importing a course to anoth
Scenario: Do not include groups and groupings when importing a course to another course
Given I import "Course 1" course into "Course 2" course using this options:
| Initial | Include groups and groupings | 0 |
When I navigate to "Users > Groups" in current page administration
When I am on the "Course 2" "groups" page
Then I should not see "Group 1"
And I should not see "Group 2"
And I select "Groupings" from the "jump" singleselect
Expand Down
15 changes: 6 additions & 9 deletions backup/util/ui/tests/behat/restore_moodle2_courses.feature
Expand Up @@ -66,7 +66,7 @@ Feature: Restore Moodle 2 course backups
And I add a "Forum" to section "1" and I fill the form with:
| Forum name | Test forum post backup name |
| Description | Test forum post backup description |
And I navigate to "Restore" in current page administration
And I am on the "Course 1" "restore" page
And I merge "test_backup.mbz" backup into the current course after deleting it's contents using this options:
| Schema | Section 3 | 0 |
Then I should see "Course 1"
Expand Down Expand Up @@ -169,8 +169,7 @@ Feature: Restore Moodle 2 course backups
When I backup "Course 1" course using this options:
| Initial | Include enrolled users | 0 |
| Confirmation | Filename | test_backup.mbz |
And I am on "Course 2" course homepage
And I navigate to "Restore" in current page administration
And I am on the "Course 2" "restore" page
And I merge "test_backup.mbz" backup into the current course after deleting it's contents using this options:
| Schema | Overwrite course configuration | Yes |
And I navigate to "Settings" in current page administration
Expand Down Expand Up @@ -198,8 +197,7 @@ Feature: Restore Moodle 2 course backups
When I backup "Course 1" course using this options:
| Initial | Include enrolled users | 0 |
| Confirmation | Filename | test_backup.mbz |
And I am on "Course 2" course homepage
And I navigate to "Restore" in current page administration
And I am on the "Course 2" "restore" page
And I merge "test_backup.mbz" backup into the current course after deleting it's contents using this options:
| Schema | Overwrite course configuration | No |
And I navigate to "Settings" in current page administration
Expand Down Expand Up @@ -227,8 +225,7 @@ Feature: Restore Moodle 2 course backups
When I backup "Course 1" course using this options:
| Initial | Include enrolled users | 0 |
| Confirmation | Filename | test_backup.mbz |
And I am on "Course 4" course homepage
And I navigate to "Restore" in current page administration
And I am on the "Course 4" "restore" page
And I merge "test_backup.mbz" backup into the current course after deleting it's contents using this options:
| Schema | Overwrite course configuration | No |
And I navigate to "Settings" in current page administration
Expand All @@ -254,7 +251,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 permission overrides | 1 |
Then I navigate to "Users > Permissions" in current page administration
Then I am on the "Course 1 copy 1" "permissions" page
And I should see "Non-editing teacher (1)"
And I set the field "Advanced role override" to "Non-editing teacher (1)"
And "enrol/manual:enrol" capability has "Allow" permission
Expand All @@ -268,5 +265,5 @@ 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 permission overrides | 0 |
Then I navigate to "Users > Permissions" in current page administration
Then I am on the "Course 1 copy 1" "permissions" page
And I should see "Non-editing teacher (0)"
Expand Up @@ -99,8 +99,7 @@ Feature: Restore Moodle 2 course backups with different user data settings
Given I navigate to "Courses > Backups > General restore defaults" in site administration
And I set the field "s_restore_restore_general_users" to ""
And I press "Save changes"
And I am on "Course 1" course homepage
And I navigate to "Restore" in current page administration
And I am on the "Course 1" "restore" page
# "User data" marks the user data field for the section
# "-" marks the user data field for the data activity
And I restore "test_backup.mbz" backup into a new course using this options:
Expand All @@ -116,8 +115,7 @@ Feature: Restore Moodle 2 course backups with different user data settings
Given I navigate to "Courses > Backups > General restore defaults" in site administration
And I set the field "s_restore_restore_general_users" to ""
And I press "Save changes"
And I am on "Course 1" course homepage
And I navigate to "Restore" in current page administration
And I am on the "Course 1" "restore" page
When I restore "test_backup.mbz" backup into a new course using this options:
| Settings | Include enrolled users | 0 |
Then I should see "Test database name"
Expand Down

0 comments on commit fcd4de8

Please sign in to comment.