diff --git a/admin/tests/behat/behat_admin.php b/admin/tests/behat/behat_admin.php index af027dec4c895..5b48dbff6af23 100644 --- a/admin/tests/behat/behat_admin.php +++ b/admin/tests/behat/behat_admin.php @@ -53,11 +53,8 @@ public function i_set_the_following_administration_settings_values(TableNode $ta } foreach ($data as $label => $value) { - $this->execute('behat_navigation::i_select_from_flat_navigation_drawer', [get_string('administrationsite')]); - - // Search by label. - $this->execute('behat_forms::i_set_the_field_to', [get_string('query', 'admin'), $label]); - $this->execute("behat_forms::press_button", get_string('search', 'admin')); + // Navigate straight to the search results fo rthis label. + $this->execute('behat_general::i_visit', ["/admin/search.php?query=" . urlencode($label)]); // Admin settings does not use the same DOM structure than other moodle forms // but we also need to use lib/behat/form_field/* to deal with the different moodle form elements. diff --git a/admin/tool/dataprivacy/tests/behat/manage_data_requests.feature b/admin/tool/dataprivacy/tests/behat/manage_data_requests.feature index 0c0d943265bdd..47caf1daa5537 100644 --- a/admin/tool/dataprivacy/tests/behat/manage_data_requests.feature +++ b/admin/tool/dataprivacy/tests/behat/manage_data_requests.feature @@ -9,10 +9,8 @@ Feature: Manage data requests | username | firstname | lastname | email | | student1 | John | Doe | s1@example.com | | student2 | Jane | Doe | s2@example.com | - And I log in as "admin" - And I set the following administration settings values: - | contactdataprotectionofficer | 1 | - And I log out + And the following config values are set as admin: + | contactdataprotectionofficer | 1 | tool_dataprivacy | @javascript Scenario: Marking general enquiries as complete diff --git a/auth/tests/behat/login.feature b/auth/tests/behat/login.feature index f80390b204e8d..250955b7289d1 100644 --- a/auth/tests/behat/login.feature +++ b/auth/tests/behat/login.feature @@ -41,10 +41,8 @@ Feature: Authentication Then I should see "You are not logged in" in the "page-footer" "region" Scenario Outline: Checking the display of the Remember username checkbox - Given I log in as "admin" - And I set the following administration settings values: + Given the following config values are set as admin: | rememberusername | | - And I log out And I am on homepage When I click on "Log in" "link" in the ".logininfo" "css_element" Then I should "Remember username" diff --git a/backup/util/ui/tests/behat/duplicate_activities.feature b/backup/util/ui/tests/behat/duplicate_activities.feature index 9b1b9afd392a9..6f2d47c6cb87a 100644 --- a/backup/util/ui/tests/behat/duplicate_activities.feature +++ b/backup/util/ui/tests/behat/duplicate_activities.feature @@ -14,10 +14,8 @@ Feature: Duplicate activities And the following "course enrolments" exist: | user | course | role | | teacher1 | C1 | editingteacher | - And I log in as "admin" - And I set the following administration settings values: - | backup_import_activities | 0 | - And I log out + And the following config values are set as admin: + | backup_import_activities | 0 | backup | And I log in as "teacher1" And I am on "Course 1" course homepage with editing mode on And I add a "Database" to section "1" and I fill the form with: diff --git a/blocks/site_main_menu/tests/behat/edit_activities.feature b/blocks/site_main_menu/tests/behat/edit_activities.feature index 51b60ea550064..e8aa3315c9a7f 100644 --- a/blocks/site_main_menu/tests/behat/edit_activities.feature +++ b/blocks/site_main_menu/tests/behat/edit_activities.feature @@ -24,9 +24,9 @@ Feature: Edit activities in main menu block @javascript Scenario: Activities in main menu block can be made available but not visible on a course page - And I log in as "admin" - And I set the following administration settings values: + Given the following config values are set as admin: | allowstealth | 1 | + And I log in as "admin" And I am on site homepage And I navigate to "Turn editing on" in current page administration And I add the "Main menu" block diff --git a/blocks/social_activities/tests/behat/edit_activities.feature b/blocks/social_activities/tests/behat/edit_activities.feature index 9ea303183c22b..ddce9f6d4192a 100644 --- a/blocks/social_activities/tests/behat/edit_activities.feature +++ b/blocks/social_activities/tests/behat/edit_activities.feature @@ -33,10 +33,8 @@ Feature: Edit activities in social activities block @javascript Scenario: Activities in social activities block can be made available but not visible on a course page - And I log in as "admin" - And I set the following administration settings values: + Given the following config values are set as admin: | allowstealth | 1 | - And I log out And I log in as "user1" And I am on "Course 1" course homepage with editing mode on And I add the "Recent activity" block diff --git a/course/tests/behat/activities_visibility_icons.feature b/course/tests/behat/activities_visibility_icons.feature index b936e4a2327ee..d26ae6716b84f 100644 --- a/course/tests/behat/activities_visibility_icons.feature +++ b/course/tests/behat/activities_visibility_icons.feature @@ -131,10 +131,8 @@ Feature: Toggle activities visibility from the course page | user | course | role | | teacher1 | C1 | editingteacher | | student1 | C1 | student | - And I log in as "admin" - And I set the following administration settings values: + And the following config values are set as admin: | allowstealth | 1 | - And I log out And I log in as "teacher1" And I am on "Course 1" course homepage with editing mode on And I add the "Recent activity" block diff --git a/course/tests/behat/activity_navigation.feature b/course/tests/behat/activity_navigation.feature index dff44351b0ae9..9184770ae8add 100644 --- a/course/tests/behat/activity_navigation.feature +++ b/course/tests/behat/activity_navigation.feature @@ -42,9 +42,9 @@ Feature: Activity navigation | wiki | Wiki 1 | Test wiki description | C1 | wiki1 | 6 | | workshop | Workshop 1 | Test workshop description | C1 | workshop1 | 6 | | assign | Assignment 1 | Test assignment description | C2 | assign21 | 0 | - And I log in as "admin" - And I set the following administration settings values: + And the following config values are set as admin: | allowstealth | 1 | + And I log in as "teacher1" And I am on "Course 1" course homepage with editing mode on # Stealth activity. And I click on "Hide" "link" in the "Forum 1" activity diff --git a/course/tests/behat/add_activities.feature b/course/tests/behat/add_activities.feature index 61466e52ef89a..71e4db9212032 100644 --- a/course/tests/behat/add_activities.feature +++ b/course/tests/behat/add_activities.feature @@ -11,16 +11,16 @@ Feature: Add activities to courses | student2 | Student | 2 | student2@example.com | And the following "courses" exist: | fullname | shortname | format | - | Course 1 | C1 | topics | + | Course 1 | Course 1 | topics | And the following "course enrolments" exist: | user | course | role | - | student1 | C1 | student | - | student2 | C1 | student | - And I log in as "admin" - And I am on "Course 1" course homepage with editing mode on + | student1 | Course 1 | student | + | student2 | Course 1 | student | @javascript Scenario: Add an activity to a course + Given I am on the "Course 1" Course page logged in as admin + And I am on "Course 1" course homepage with editing mode on When I add a "Database" to section "3" and I fill the form with: | Name | Test name | | Description | Test database description | @@ -38,15 +38,18 @@ Feature: Add activities to courses @javascript Scenario: Add an activity supplying only the name + Given I am on the "Course 1" Course page logged in as admin + And I am on "Course 1" course homepage with editing mode on When I add a "Database" to section "3" and I fill the form with: | Name | Test name | Then I should see "Test name" @javascript Scenario: Set activity description to required then add an activity supplying only the name - Given I set the following administration settings values: - | requiremodintro | Yes | - When I am on "Course 1" course homepage + Given the following config values are set as admin: + | requiremodintro | 1 | + And I am on the "Course 1" Course page logged in as admin + And I am on "Course 1" course homepage with editing mode on And I add a "Database" to section "3" and I fill the form with: | Name | Test name | Then I should see "Required" diff --git a/course/tests/behat/course_relativedatesmode.feature b/course/tests/behat/course_relativedatesmode.feature index e0372cd08dca3..ed8cda6e31283 100644 --- a/course/tests/behat/course_relativedatesmode.feature +++ b/course/tests/behat/course_relativedatesmode.feature @@ -6,9 +6,9 @@ Feature: Courses can be set up to display dates relative to the user's enrolment @javascript Scenario: Create a course with relative dates feature disabled - Given I log in as "admin" - And I set the following administration settings values: + Given the following config values are set as admin: | enablecourserelativedates | 0 | + And I log in as "admin" And I am on site homepage And I turn editing mode on When I press "Add a new course" @@ -18,20 +18,19 @@ Feature: Courses can be set up to display dates relative to the user's enrolment @javascript Scenario: Create a course with relative dates feature enabled - Given I log in as "admin" - And I set the following administration settings values: + Given the following config values are set as admin: | enablecourserelativedates | 1 | + And I log in as "admin" And I am on site homepage And I turn editing mode on When I press "Add a new course" - And I wait until the page is ready Then I should see "Relative dates mode" And I should see "Relative dates mode cannot be changed once the course has been created." Scenario: Edit courses with relative dates feature enabled - Given I log in as "admin" - And I set the following administration settings values: + Given the following config values are set as admin: | enablecourserelativedates | 1 | + And I log in as "admin" And I create a course with: | Course full name | Course 1 | | Course short name | C1 | diff --git a/course/tests/behat/course_request.feature b/course/tests/behat/course_request.feature index c50671f4ef2e9..3eee1ed9a5af4 100644 --- a/course/tests/behat/course_request.feature +++ b/course/tests/behat/course_request.feature @@ -13,11 +13,11 @@ Feature: Users can request and approve courses Scenario: Simple course request workflow Given the following "system role assigns" exist: - | user | course | role | + | user | course | role | | user2 | Acceptance test site | manager | - Given I log in as "admin" - And I set the following administration settings values: + And the following config values are set as admin: | lockrequestcategory | 1 | + Given I log in as "admin" And I set the following system permissions of "Authenticated user" role: | capability | permission | | moodle/course:request | Allow | diff --git a/mod/feedback/tests/behat/anonymous.feature b/mod/feedback/tests/behat/anonymous.feature index 9e098efca049f..b01c03541c812 100644 --- a/mod/feedback/tests/behat/anonymous.feature +++ b/mod/feedback/tests/behat/anonymous.feature @@ -110,10 +110,8 @@ Feature: Anonymous feedback And I log out Scenario: Complete fully anonymous feedback on the front page as a guest - And I log in as "admin" - And I set the following administration settings values: + Given the following config values are set as admin: | feedback_allowfullanonymous | 1 | - And I log out When I follow "Site feedback" And I follow "Preview" And I should see "Do you like our site?" @@ -128,9 +126,9 @@ Feature: Anonymous feedback @javascript Scenario: Complete fully anonymous feedback and view analyze on the front page as a guest - And I log in as "admin" - And I set the following administration settings values: + Given the following config values are set as admin: | feedback_allowfullanonymous | 1 | + And I log in as "admin" And I set the following system permissions of "Guest" role: | capability | permission | | mod/feedback:viewanalysepage | Allow | diff --git a/mod/h5pactivity/tests/behat/result_fillin.feature b/mod/h5pactivity/tests/behat/result_fillin.feature index bfba4c0ba5f72..526fe21f5a6d4 100644 --- a/mod/h5pactivity/tests/behat/result_fillin.feature +++ b/mod/h5pactivity/tests/behat/result_fillin.feature @@ -14,10 +14,10 @@ Feature: View fill the blanks attempt report And the following "course enrolments" exist: | user | course | role | | student1 | C1 | student | - And I log in as "admin" - # No HTML should appear even with formatstringstriptags disabled. - And I set the following administration settings values: + And the following config values are set as admin: + # No HTML should appear even with formatstringstriptags disabled. | formatstringstriptags | 0 | + And I log in as "admin" And I am on "Course 1" course homepage with editing mode on And I add a "H5P" to section "1" And I set the following fields to these values: diff --git a/mod/h5pactivity/tests/behat/result_longfillin.feature b/mod/h5pactivity/tests/behat/result_longfillin.feature index de37562accede..826c19f4ba16c 100644 --- a/mod/h5pactivity/tests/behat/result_longfillin.feature +++ b/mod/h5pactivity/tests/behat/result_longfillin.feature @@ -14,10 +14,10 @@ Feature: View essay attempt report And the following "course enrolments" exist: | user | course | role | | student1 | C1 | student | - And I log in as "admin" - # No HTML should appear even with formatstringstriptags disabled. - And I set the following administration settings values: + And the following config values are set as admin: + # No HTML should appear even with formatstringstriptags disabled. | formatstringstriptags | 0 | + And I log in as "admin" And I am on "Course 1" course homepage with editing mode on And I add a "H5P" to section "1" And I set the following fields to these values: diff --git a/report/participation/tests/behat/message_participants.feature b/report/participation/tests/behat/message_participants.feature index 2f0bac9d61ada..4b376aa484846 100644 --- a/report/participation/tests/behat/message_participants.feature +++ b/report/participation/tests/behat/message_participants.feature @@ -7,23 +7,24 @@ Feature: Use the particiaption report to message groups of students Background: Given the following "courses" exist: | fullname | shortname | category | groupmode | - | Course 1 | C1 | 0 | 1 | + | Course 1 | C1 | 0 | 1 | And the following "users" exist: - | username | firstname | lastname | email | - | teacher1 | Teacher | 1 | teacher1@example.com | - | student1 | Student | 1 | student1@example.com | - | student2 | Student | 2 | student2@example.com | - | student3 | Student | 3 | student3@example.com | + | username | firstname | lastname | + | teacher1 | Teacher | 1 | + | student1 | Student | 1 | + | student2 | Student | 2 | + | student3 | Student | 3 | And the following "course enrolments" exist: - | user | course | role | - | teacher1 | C1 | editingteacher | - | student1 | C1 | student | - | student2 | C1 | student | - | student3 | C1 | student | + | user | course | role | + | teacher1 | C1 | editingteacher | + | student1 | C1 | student | + | student2 | C1 | student | + | student3 | C1 | student | And the following "activity" exists: | course | C1 | | activity | book | | name | Test book name | + | idnumber | Test book name | | description | Test book | | idnumber | book1 | And I am on the "Test book name" "book activity" page logged in as student1 diff --git a/user/tests/behat/user_grade_navigation.feature b/user/tests/behat/user_grade_navigation.feature index f41b46b75f1d5..040087ac2c295 100644 --- a/user/tests/behat/user_grade_navigation.feature +++ b/user/tests/behat/user_grade_navigation.feature @@ -51,11 +51,9 @@ Feature: The student can navigate to their grades page and user grade report. | Test assignment three | 0.00 %( Empty ) | - | 0–150 | - | 0.00 % | Scenario: Change Grades settings to go to a custom url. - When I log in as "admin" - And I set the following administration settings values: - | grade_mygrades_report | External URL | - | gradereport_mygradeurl | /badges/mybadges.php | - And I log out + Given the following config values are set as admin: + | grade_mygrades_report | external | + | gradereport_mygradeurl | /badges/mybadges.php | And I log in as "student1" And I follow "Student 1" And I follow "Grades" in the user menu