diff --git a/admin/tests/behat/behat_admin.php b/admin/tests/behat/behat_admin.php index 91433c81c5a..8c56f7ae552 100644 --- a/admin/tests/behat/behat_admin.php +++ b/admin/tests/behat/behat_admin.php @@ -114,6 +114,30 @@ class behat_admin extends behat_base { } } + /** + * Sets the specified site settings. A table with | config | value | (optional)plugin | is expected. + * + * @Given /^the following config values are set as admin:$/ + * @param TableNode $table + */ + public function the_following_config_values_are_set_as_admin(TableNode $table) { + + if (!$data = $table->getRowsHash()) { + return; + } + + foreach ($data as $config => $value) { + // Default plugin value is null. + $plugin = null; + + if (is_array($value)) { + $plugin = $value[1]; + $value = $value[0]; + } + set_config($config, $value, $plugin); + } + } + /** * Waits with the provided params if we are running a JS session. * diff --git a/admin/tests/behat/set_admin_settings_value.feature b/admin/tests/behat/set_admin_settings_value.feature index 4edbb5c46e1..66ab175788d 100644 --- a/admin/tests/behat/set_admin_settings_value.feature +++ b/admin/tests/behat/set_admin_settings_value.feature @@ -13,15 +13,13 @@ Feature: Set admin settings value And I should not see "C_shortname Course fullname" Scenario: set admin value with full name - Given I set the following administration settings values: - | Display extended course names | 1 | - When I press "Save changes" + Given the following config values are set as admin: + | courselistshortnames | 1 | And I am on homepage Then I should see "C_shortname Course fullname" Scenario: set admin value with short name - Given I set the following administration settings values: + Given the following config values are set as admin: | courselistshortnames | 1 | - When I press "Save changes" And I am on homepage Then I should see "C_shortname Course fullname" \ No newline at end of file diff --git a/admin/tool/availabilityconditions/tests/behat/manage_conditions.feature b/admin/tool/availabilityconditions/tests/behat/manage_conditions.feature index 3df48ed4f41..e968c2027ee 100644 --- a/admin/tool/availabilityconditions/tests/behat/manage_conditions.feature +++ b/admin/tool/availabilityconditions/tests/behat/manage_conditions.feature @@ -13,8 +13,8 @@ Feature: Manage availability conditions Then I should not see "Availability restrictions" # Enable it and check I can now see and click on it. - And I set the following administration settings values: - | Enable conditional access | 1 | + And the following config values are set as admin: + | enableavailability | 1 | And I am on homepage And I navigate to "Manage restrictions" node in "Site administration > Plugins > Availability restrictions" @@ -28,9 +28,9 @@ Feature: Manage availability conditions Given the following "courses" exist: | fullname | shortname | format | | Course 1 | C1 | topics | + And the following config values are set as admin: + | enableavailability | 1 | And I log in as "admin" - And I set the following administration settings values: - | Enable conditional access | 1 | And I am on homepage When I navigate to "Manage restrictions" node in "Site administration > Plugins > Availability restrictions" diff --git a/admin/tool/behat/tests/behat/data_generators.feature b/admin/tool/behat/tests/behat/data_generators.feature index 2b32cb096e6..63ffdbc15d4 100644 --- a/admin/tool/behat/tests/behat/data_generators.feature +++ b/admin/tool/behat/tests/behat/data_generators.feature @@ -385,9 +385,9 @@ Feature: Set up contextual data for tests And the following "grade outcomes" exist: | fullname | shortname | course | scale | | Grade outcome 2 | OT2 | C1 | Test Scale 1 | + And the following config settings values are set as admin: + | enableoutcomes | 1 | When I log in as "admin" - And I set the following administration settings values: - | Enable outcomes | 1 | And I follow "Home" And I follow "Course 1" And I follow "Outcomes" @@ -414,9 +414,9 @@ Feature: Set up contextual data for tests And the following "grade items" exist: | itemname | course | outcome | gradecategory | | Test Outcome Grade Item 1 | C1 | OT1 | Grade category 1 | + And the following config settings values are set as admin: + | enableoutcomes | 1 | When I log in as "admin" - And I set the following administration settings values: - | Enable outcomes | 1 | And I follow "Home" And I follow "Course 1" And I follow "Grades" diff --git a/availability/condition/completion/tests/behat/availability_completion.feature b/availability/condition/completion/tests/behat/availability_completion.feature index e10a8b6603f..b31b7c66e3e 100644 --- a/availability/condition/completion/tests/behat/availability_completion.feature +++ b/availability/condition/completion/tests/behat/availability_completion.feature @@ -16,11 +16,9 @@ Feature: availability_completion | user | course | role | | teacher1 | C1 | editingteacher | | student1 | C1 | student | - And I log in as "admin" - And I set the following administration settings values: - | Enable conditional access | 1 | - | Enable completion tracking | 1 | - And I log out + And the following config values are set as admin: + | enableavailability | 1 | + | enablecompletion | 1 | @javascript Scenario: Test condition diff --git a/availability/condition/date/tests/behat/availability_date.feature b/availability/condition/date/tests/behat/availability_date.feature index ff73589bd17..d026849d881 100644 --- a/availability/condition/date/tests/behat/availability_date.feature +++ b/availability/condition/date/tests/behat/availability_date.feature @@ -16,10 +16,8 @@ Feature: availability_date | user | course | role | | teacher1 | C1 | editingteacher | | student1 | C1 | student | - And I log in as "admin" - And I set the following administration settings values: - | Enable conditional access | 1 | - And I log out + And the following config values are set as admin: + | enableavailability | 1 | @javascript Scenario: Test condition diff --git a/availability/condition/grade/tests/behat/availability_grade.feature b/availability/condition/grade/tests/behat/availability_grade.feature index 47baf048705..01681d77a40 100644 --- a/availability/condition/grade/tests/behat/availability_grade.feature +++ b/availability/condition/grade/tests/behat/availability_grade.feature @@ -16,10 +16,8 @@ Feature: availability_grade | user | course | role | | teacher1 | C1 | editingteacher | | student1 | C1 | student | - And I log in as "admin" - And I set the following administration settings values: - | Enable conditional access | 1 | - And I log out + And the following config values are set as admin: + | enableavailability | 1 | @javascript Scenario: Test condition diff --git a/availability/condition/group/tests/behat/availability_group.feature b/availability/condition/group/tests/behat/availability_group.feature index 91bcfaf2fee..d2637d66aca 100644 --- a/availability/condition/group/tests/behat/availability_group.feature +++ b/availability/condition/group/tests/behat/availability_group.feature @@ -16,10 +16,8 @@ Feature: availability_group | user | course | role | | teacher1 | C1 | editingteacher | | student1 | C1 | student | - And I log in as "admin" - And I set the following administration settings values: - | Enable conditional access | 1 | - And I log out + And the following config values are set as admin: + | enableavailability | 1 | @javascript Scenario: Test condition diff --git a/availability/condition/grouping/tests/behat/availability_grouping.feature b/availability/condition/grouping/tests/behat/availability_grouping.feature index 9865ce9ab17..6d14604e78f 100644 --- a/availability/condition/grouping/tests/behat/availability_grouping.feature +++ b/availability/condition/grouping/tests/behat/availability_grouping.feature @@ -22,10 +22,8 @@ Feature: availability_grouping And the following "group members" exist: | user | group | | student1 | GI1 | - And I log in as "admin" - And I set the following administration settings values: - | Enable conditional access | 1 | - And I log out + And the following config values are set as admin: + | enableavailability | 1 | @javascript Scenario: Test condition diff --git a/availability/condition/profile/tests/behat/availability_profile.feature b/availability/condition/profile/tests/behat/availability_profile.feature index 79c41a128d5..720be7d7c56 100644 --- a/availability/condition/profile/tests/behat/availability_profile.feature +++ b/availability/condition/profile/tests/behat/availability_profile.feature @@ -16,10 +16,8 @@ Feature: availability_profile | user | course | role | | teacher1 | C1 | editingteacher | | student1 | C1 | student | - And I log in as "admin" - And I set the following administration settings values: - | Enable conditional access | 1 | - And I log out + And the following config values are set as admin: + | enableavailability | 1 | @javascript Scenario: Test condition diff --git a/availability/tests/behat/display_availability.feature b/availability/tests/behat/display_availability.feature index 90438364e63..519f16c8753 100644 --- a/availability/tests/behat/display_availability.feature +++ b/availability/tests/behat/display_availability.feature @@ -34,10 +34,8 @@ Feature: display_availability | user | course | role | | teacher1 | C1 | editingteacher | | student1 | C1 | student | - And I log in as "admin" - And I set the following administration settings values: - | Enable conditional access | 1 | - And I log out + And the following config values are set as admin: + | enableavailability | 1 | @javascript Scenario: Activity availability display diff --git a/availability/tests/behat/edit_availability.feature b/availability/tests/behat/edit_availability.feature index 82f36628e42..00ca5184823 100644 --- a/availability/tests/behat/edit_availability.feature +++ b/availability/tests/behat/edit_availability.feature @@ -39,15 +39,10 @@ Feature: edit_availability When I edit the section "1" Then "Restrict access" "fieldset" should not exist - When I log out - And I log in as "admin" - And I set the following administration settings values: - | Enable conditional access | 1 | + And the following config values are set as admin: + | enableavailability | 1 | - When I log out - And I log in as "teacher1" And I follow "Course 1" - And I turn editing mode on And I add a "Page" to section "1" Then "Restrict access" "fieldset" should exist @@ -58,10 +53,8 @@ Feature: edit_availability @javascript Scenario: Edit availability using settings in activity form # Set up. - Given I log in as "admin" - And I set the following administration settings values: - | Enable conditional access | 1 | - And I log out + Given the following config values are set as admin: + | enableavailability | 1 | And I log in as "teacher1" And I follow "Course 1" @@ -153,10 +146,8 @@ Feature: edit_availability @javascript Scenario: Edit availability using settings in section form # Set up. - Given I log in as "admin" - And I set the following administration settings values: - | Enable conditional access | 1 | - And I log out + Given the following config values are set as admin: + | enableavailability | 1 | And I log in as "teacher1" And I follow "Course 1" And I turn editing mode on @@ -186,12 +177,12 @@ Feature: edit_availability @javascript Scenario: Use the 'Add group/grouping access restriction' button # Button should initially be disabled. - Given I log in as "admin" - And I set the following administration settings values: - | Enable conditional access | 1 | + Given the following config values are set as admin: + | enableavailability | 1 | And the following "groupings" exist: | name | course | idnumber | | GX1 | C1 | GXI1 | + And I log in as "admin" And I am on homepage And I follow "Course 1" And I turn editing mode on diff --git a/badges/tests/behat/award_badge.feature b/badges/tests/behat/award_badge.feature index a4e5cd4b424..919c2694128 100644 --- a/badges/tests/behat/award_badge.feature +++ b/badges/tests/behat/award_badge.feature @@ -128,10 +128,9 @@ Feature: Award badges | user | course | role | | teacher1 | C1 | editingteacher | | student1 | C1 | student | - And I log in as "admin" - And I set the following administration settings values: - | Enable completion tracking | 1 | - And I follow "Home" + And the following config values are set as admin: + | enablecompletion | 1 | + And I log in as "teacher1" And I follow "Course 1" And I follow "Edit settings" And I set the following fields to these values: @@ -141,8 +140,6 @@ Feature: Award badges And I add a "Assignment" to section "1" and I fill the form with: | Assignment name | Test assignment name | | Description | Submit your online text | - And I log out - And I log in as "teacher1" And I follow "Course 1" And I navigate to "Add a new badge" node in "Course administration > Badges" And I follow "Add a new badge" @@ -181,10 +178,9 @@ Feature: Award badges | user | course | role | | teacher1 | C1 | editingteacher | | student1 | C1 | student | - And I log in as "admin" - And I set the following administration settings values: - | Enable completion tracking | 1 | - And I follow "Home" + And the following config values are set as admin: + | enablecompletion | 1 | + And I log in as "teacher1" And I follow "Course 1" And I follow "Edit settings" And I set the following fields to these values: @@ -200,8 +196,6 @@ Feature: Award badges And I click on "Condition: Activity completion" "link" And I set the field "Assign - Test assignment name" to "1" And I press "Save changes" - And I log out - And I log in as "teacher1" And I follow "Course 1" And I navigate to "Add a new badge" node in "Course administration > Badges" And I follow "Add a new badge" diff --git a/blocks/navigation/tests/behat/expand_courses_node.feature b/blocks/navigation/tests/behat/expand_courses_node.feature index 4aa815f6a95..9700e1b119b 100644 --- a/blocks/navigation/tests/behat/expand_courses_node.feature +++ b/blocks/navigation/tests/behat/expand_courses_node.feature @@ -34,6 +34,8 @@ Feature: Expand the courses nodes within the navigation block | student1 | c1 | student | | student1 | c2 | student | | student1 | c4 | student | + And the following config settings values are set as admin: + | navshowallcourses | 1 | And I log in as "admin" And I follow "Course 2" And I turn editing mode on @@ -41,8 +43,6 @@ Feature: Expand the courses nodes within the navigation block And I set the following fields to these values: | Allow guest access | Yes | And I press "Save and display" - And I set the following administration settings values: - | Show all courses | 1 | And I log out @javascript diff --git a/blocks/navigation/tests/behat/expand_my_courses_setting.feature b/blocks/navigation/tests/behat/expand_my_courses_setting.feature index ad6e9f64b2b..8b70d2914d7 100644 --- a/blocks/navigation/tests/behat/expand_my_courses_setting.feature +++ b/blocks/navigation/tests/behat/expand_my_courses_setting.feature @@ -29,10 +29,8 @@ Feature: Test expand my courses navigation setting @javascript Scenario: The My Courses branch is collapsed when expand my courses is off - Given I log in as "admin" - And I set the following administration settings values: - | Show My courses expanded on My home | 0 | - And I log out + Given the following config values are set as admin: + | navexpandmycourses | 0 | When I log in as "student1" And I click on "My home" "link" in the "Navigation" "block" Then I should not see "c1" in the "Navigation" "block" @@ -41,10 +39,8 @@ Feature: Test expand my courses navigation setting @javascript Scenario: My Courses can be expanded on the My Moodle page when expand my courses is off - Given I log in as "admin" - And I set the following administration settings values: - | Show My courses expanded on My home | 0 | - And I log out + Given the following config values are set as admin: + | navexpandmycourses | 0 | When I log in as "student1" And I click on "My home" "link" in the "Navigation" "block" And I should not see "c1" in the "Navigation" "block" diff --git a/blocks/navigation/tests/behat/view_my_courses.feature b/blocks/navigation/tests/behat/view_my_courses.feature index d20bbb04136..0fcf0fadc82 100644 --- a/blocks/navigation/tests/behat/view_my_courses.feature +++ b/blocks/navigation/tests/behat/view_my_courses.feature @@ -29,13 +29,11 @@ Feature: View my courses in navigation block | student1 | c1 | student | | student1 | c31 | student | | student1 | c331 | student | - And I log in as "admin" @javascript Scenario: The plain list of enrolled courses is shown - Given I set the following administration settings values: - | Show my course categories | 0 | - And I log out + Given the following config values are set as admin: + | navshowmycoursecategories | 0 | And I log in as "student1" When I click on "My home" "link" in the "Navigation" "block" Then I should not see "cat1" in the "Navigation" "block" @@ -49,9 +47,8 @@ Feature: View my courses in navigation block @javascript Scenario: The nested list of enrolled courses is shown - Given I set the following administration settings values: - | Show my course categories | 1 | - And I log out + Given the following config values are set as admin: + | navshowmycoursecategories | 1 | And I log in as "student1" When I click on "My home" "link" in the "Navigation" "block" Then I should see "cat1" in the "Navigation" "block" @@ -69,10 +66,9 @@ Feature: View my courses in navigation block @javascript Scenario: I can expand categories and courses as guest - Given I set the following administration settings values: - | Show my course categories | 1 | - | Show all courses | 1 | - And I log out + Given the following config values are set as admin: + | navshowmycoursecategories | 1 | + | navshowallcourses | 1 | And I expand "Courses" node And I should see "cat1" in the "Navigation" "block" And I should see "cat2" in the "Navigation" "block" diff --git a/blocks/recent_activity/tests/behat/structural_changes.feature b/blocks/recent_activity/tests/behat/structural_changes.feature index 78814a59fe7..00c6612e468 100644 --- a/blocks/recent_activity/tests/behat/structural_changes.feature +++ b/blocks/recent_activity/tests/behat/structural_changes.feature @@ -46,10 +46,8 @@ Feature: View structural changes in recent activity block | GG3 | G2 | Scenario: Check that Added module information is displayed respecting view capability - Given I log in as "admin" - And I set the following administration settings values: - | Enable conditional access | 1 | - And I log out + Given the following config values are set as admin: + | enableavailability | 1 | And I log in as "teacher1" And I follow "Course 1" And I turn editing mode on diff --git a/completion/tests/behat/enable_manual_complete_mark.feature b/completion/tests/behat/enable_manual_complete_mark.feature index 303d79f8e5d..bcd93e69d35 100644 --- a/completion/tests/behat/enable_manual_complete_mark.feature +++ b/completion/tests/behat/enable_manual_complete_mark.feature @@ -17,11 +17,9 @@ Feature: Allow students to manually mark an activity as complete | user | course | role | | teacher1 | C1 | editingteacher | | student1 | C1 | student | - And I log in as "admin" - And I set the following administration settings values: - | Enable completion tracking | 1 | - | Enable conditional access | 1 | - And I log out + And the following config values are set as admin: + | enablecompletion | 1 | + | enableavailability | 1 | And I log in as "teacher1" And I follow "Course 1" And I turn editing mode on diff --git a/completion/tests/behat/restrict_activity_by_date.feature b/completion/tests/behat/restrict_activity_by_date.feature index f63b5a57c88..db9a37a7324 100644 --- a/completion/tests/behat/restrict_activity_by_date.feature +++ b/completion/tests/behat/restrict_activity_by_date.feature @@ -16,10 +16,8 @@ Feature: Restrict activity availability through date conditions | user | course | role | | teacher1 | C1 | editingteacher | | student1 | C1 | student | - And I log in as "admin" - And I set the following administration settings values: - | Enable conditional access | 1 | - And I log out + And the following config values are set as admin: + | enableavailability | 1 | And I log in as "teacher1" And I follow "Course 1" And I turn editing mode on diff --git a/completion/tests/behat/restrict_activity_by_grade.feature b/completion/tests/behat/restrict_activity_by_grade.feature index fa9b9099f00..5607307ccd1 100644 --- a/completion/tests/behat/restrict_activity_by_grade.feature +++ b/completion/tests/behat/restrict_activity_by_grade.feature @@ -17,10 +17,8 @@ Feature: Restrict activity availability through grade conditions | user | course | role | | teacher1 | C1 | editingteacher | | student1 | C1 | student | - And I log in as "admin" - And I set the following administration settings values: - | Enable conditional access | 1 | - And I log out + And the following config values are set as admin: + | enableavailability | 1 | And I log in as "teacher1" And I follow "Course 1" And I turn editing mode on diff --git a/completion/tests/behat/restrict_section_availability.feature b/completion/tests/behat/restrict_section_availability.feature index 69239a4afa9..41f2bf734c5 100644 --- a/completion/tests/behat/restrict_section_availability.feature +++ b/completion/tests/behat/restrict_section_availability.feature @@ -16,11 +16,9 @@ Feature: Restrict sections availability through completion or grade conditions | user | course | role | | teacher1 | C1 | editingteacher | | student1 | C1 | student | - And I log in as "admin" - And I set the following administration settings values: - | Enable completion tracking | 1 | - | Enable conditional access | 1 | - And I log out + And the following config values are set as admin: + | enablecompletion | 1 | + | enableavailability | 1 | @javascript Scenario: Show section greyed-out to student when completion condition is not satisfied diff --git a/completion/tests/behat/teacher_manual_completion.feature b/completion/tests/behat/teacher_manual_completion.feature index d15691a41a8..6df1130c7a6 100644 --- a/completion/tests/behat/teacher_manual_completion.feature +++ b/completion/tests/behat/teacher_manual_completion.feature @@ -16,9 +16,9 @@ Feature: Allow teachers to manually mark users as complete when configured | user | course | role | | student1 | CC1 | student | | teacher1 | CC1 | editingteacher | + And the following config values are set as admin: + | enablecompletion | 1 | And I log in as "admin" - And I set the following administration settings values: - | Enable completion tracking | 1 | And I am on homepage And I follow "Completion course" And completion tracking is "Enabled" in current course diff --git a/course/tests/behat/activities_edit_completion.feature b/course/tests/behat/activities_edit_completion.feature index b1d2b6ce2ce..42cd98c1abb 100644 --- a/course/tests/behat/activities_edit_completion.feature +++ b/course/tests/behat/activities_edit_completion.feature @@ -8,9 +8,9 @@ Feature: Edit completion settings of an activity Given the following "courses" exist: | fullname | shortname | enablecompletion | | Course 1 | C1 | 1 | + And the following config values are set as admin: + | enablecompletion | 1 | And I log in as "admin" - And I set the following administration settings values: - | Enable completion tracking | 1 | And I am on homepage And I follow "Course 1" And I turn editing mode on diff --git a/files/tests/behat/course_files.feature b/files/tests/behat/course_files.feature index 6ae5577ea4e..133635c1eee 100644 --- a/files/tests/behat/course_files.feature +++ b/files/tests/behat/course_files.feature @@ -9,11 +9,10 @@ Feature: Course files Given the following "courses" exist: | fullname | shortname | category | legacyfiles | | Course 1 | C1 | 0 | 2 | - And I log in as "admin" - And I set the following administration settings values: - | Legacy course files in new courses | 1 | - | Allow adding to legacy course files | 1 | - When I follow "Home" + And the following config values are set as admin: + | legacyfilesinnewcourses | 1 | + | legacyfilesaddallowed | 1 | + When I log in as "admin" And I follow "Course 1" Then I should see "Legacy course files" And I follow "Legacy course files" @@ -26,11 +25,10 @@ Feature: Course files Given the following "courses" exist: | fullname | shortname | category | legacyfiles | | Course 1 | C1 | 0 | 2 | - And I log in as "admin" - And I set the following administration settings values: - | Legacy course files in new courses | 1 | - | Allow adding to legacy course files | 0 | - When I follow "Home" + And the following config values are set as admin: + | legacyfilesinnewcourses | 1 | + | legacyfilesaddallowed | 0 | + When I log in as "admin" And I follow "Course 1" Then I should see "Legacy course files" And I follow "Legacy course files" diff --git a/grade/tests/behat/grade_aggregation.feature b/grade/tests/behat/grade_aggregation.feature index e545f6166b7..61dc0f2e143 100644 --- a/grade/tests/behat/grade_aggregation.feature +++ b/grade/tests/behat/grade_aggregation.feature @@ -248,10 +248,8 @@ Feature: We can use calculated grade totals @javascript Scenario: Natural aggregation on outcome items with natural weights - And I log out - And I log in as "admin" - And I set the following administration settings values: - | Enable outcomes | 1 | + And the following config settings values are set as admin: + | enableoutcomes | 1 | And the following "scales" exist: | name | scale | | Test Scale | Disappointing, Good, Very good, Excellent | @@ -261,10 +259,7 @@ Feature: We can use calculated grade totals And the following "grade items" exist: | itemname | course | outcome | gradetype | scale | | Test outcome item one | C1 | OT1 | Scale | Test Scale | - And I log out - When I log in as "teacher1" - And I follow "Course 1" - And I follow "Grades" + Then I follow "Grades" And I expand "Setup" node And I follow "Categories and items" And I set the following settings for grade item "Course 1": @@ -272,8 +267,6 @@ Feature: We can use calculated grade totals | Include outcomes in aggregation | 1 | | Exclude empty grades | 0 | And I follow "Grader report" - And I turn editing mode on - And I press "Save changes" And I give the grade "Excellent" to the user "Student 1" for the grade item "Test outcome item one" And I press "Save changes" And I navigate to "Course grade settings" node in "Grade administration > Setup" @@ -321,10 +314,8 @@ Feature: We can use calculated grade totals @javascript Scenario: Natural aggregation on outcome items with modified weights - And I log out - And I log in as "admin" - And I set the following administration settings values: - | Enable outcomes | 1 | + And the following config settings values are set as admin: + | enableoutcomes | 1 | And the following "scales" exist: | name | scale | | Test Scale | Disappointing, Good, Very good, Excellent | @@ -334,9 +325,6 @@ Feature: We can use calculated grade totals And the following "grade items" exist: | itemname | course | outcome | gradetype | scale | | Test outcome item one | C1 | OT1 | Scale | Test Scale | - And I log out - When I log in as "teacher1" - And I follow "Course 1" And I follow "Grades" And I expand "Setup" node And I follow "Categories and items" @@ -348,8 +336,6 @@ Feature: We can use calculated grade totals | Weight adjusted | 1 | | aggregationcoef2 | 100 | And I follow "Grader report" - And I turn editing mode on - And I press "Save changes" And I give the grade "Excellent" to the user "Student 1" for the grade item "Test outcome item one" And I press "Save changes" And I navigate to "Course grade settings" node in "Grade administration > Setup" diff --git a/grade/tests/behat/grade_scales_aggregation.feature b/grade/tests/behat/grade_scales_aggregation.feature index 71060007f53..5e3eaaec14f 100644 --- a/grade/tests/behat/grade_scales_aggregation.feature +++ b/grade/tests/behat/grade_scales_aggregation.feature @@ -32,13 +32,13 @@ Feature: Control the aggregation of the scales And the following "grade items" exist: | itemname | course | scale | | Scale me | C1 | Letterscale | + And the following config settings values are set as admin: + | grade_includescalesinaggregation | 0 | + And I log out @javascript Scenario Outline: Scales can be exluded from aggregation - Given I set the following administration settings values: - | grade_includescalesinaggregation | 0 | - And I log out - And I log in as "teacher1" + Given I log in as "teacher1" And I follow "Course 1" And I follow "Grades" And I turn editing mode on @@ -84,10 +84,7 @@ Feature: Control the aggregation of the scales @javascript Scenario: Weights of scales cannot be edited when they are not aggregated - Given I set the following administration settings values: - | grade_includescalesinaggregation | 0 | - And I log out - And I log in as "teacher1" + Given I log in as "teacher1" And I follow "Course 1" And I follow "Grades" And I turn editing mode on @@ -101,12 +98,8 @@ Feature: Control the aggregation of the scales And I follow "Show more..." And I should not see "Weight adjusted" And I should not see "Weight" - And I log out - And I log in as "admin" - And I set the following administration settings values: + And the following config settings values are set as admin: | grade_includescalesinaggregation | 1 | - And I log out - And I log in as "teacher1" And I follow "Course 1" And I follow "Grades" And I navigate to "Categories and items" node in "Grade administration > Setup" diff --git a/grade/tests/behat/grade_single_item_scales.feature b/grade/tests/behat/grade_single_item_scales.feature index 200b2098ba2..b7ec8071b3a 100644 --- a/grade/tests/behat/grade_single_item_scales.feature +++ b/grade/tests/behat/grade_single_item_scales.feature @@ -71,19 +71,19 @@ Feature: View gradebook when single item scales are used And the following should exist in the "user-grade" table: | Grade item | Grade | Range | Contribution to course total | | Test assignment one | Ace! | Ace!–Ace! | 100.00 % | - | Sub category 1 total | 1.00 | 0–1 | - | + | Sub category 1 total| 1.00 | 0–1 | - | | Course total | 1.00 | 0–1 | - | And I set the field "Select all or one user" to "Student 2" And the following should exist in the "user-grade" table: | Grade item | Grade | Range | Contribution to course total | | Test assignment one | - | Ace!–Ace! | - | - | Sub category 1 total | - | 0–1 | - | + | Sub category 1 total| - | 0–1 | - | | Course total | - | 0–1 | - | And I set the field "jump" to "Categories and items" And the following should exist in the "grade_edit_tree_table" table: | Name | Max grade | | Test assignment one | 1.00 | - | Sub category 1 total | 1.00 | + | Sub category 1 total| 1.00 | | Course total | 1.00 | @javascript @@ -111,10 +111,10 @@ Feature: View gradebook when single item scales are used And I set the field "Select all or one user" to "Student 1" And I click on "Select all or one user" "select" And the following should exist in the "user-grade" table: - | Grade item | Grade | Range | Contribution to course total | - | Test assignment one | Ace! | Ace!–Ace! | | - | Sub category () total. | | 0–100 | - | - | Course total. | | 0–100 | - | + | Grade item | Grade | Range | Contribution to course total | + | Test assignment one | Ace! | Ace!–Ace! | | + | Sub category () total. | | 0–100 | - | + | Course total. | | 0–100 | - | And I set the field "jump" to "Categories and items" And the following should exist in the "grade_edit_tree_table" table: | Name | Max grade | diff --git a/lib/editor/tinymce/tests/behat/edit_available_icons.feature b/lib/editor/tinymce/tests/behat/edit_available_icons.feature index 2724d5c7805..131749e09cb 100644 --- a/lib/editor/tinymce/tests/behat/edit_available_icons.feature +++ b/lib/editor/tinymce/tests/behat/edit_available_icons.feature @@ -16,8 +16,8 @@ Feature: Add or remove items from the TinyMCE editor toolbar @javascript Scenario: Remove icons - When I set the following administration settings values: - | Editor toolbar | fontselect,fontsizeselect,formatselect,\|,undo,redo,\|,search,replace,\|,fullscreen | + When the following config values are set as admin: + | customtoolbar | fontselect,fontsizeselect,formatselect,\|,undo,redo,\|,search,replace,\|,fullscreen | editor_tinymce | And I am on homepage And I follow "Course 1" And I turn editing mode on @@ -28,16 +28,16 @@ Feature: Add or remove items from the TinyMCE editor toolbar @javascript Scenario: Add icons - When I set the following administration settings values: - | Editor toolbar | fontselect,fontsizeselect,formatselect,\|,undo,redo,\|,search,replace,\|,fullscreen,anchor | + When the following config values are set as admin: + | customtoolbar | fontselect,fontsizeselect,formatselect,\|,undo,redo,\|,search,replace,\|,fullscreen,anchor | editor_tinymce | And I am on homepage And I follow "Course 1" And I turn editing mode on And I add a "Database" to section "1" Then "#id_introeditor_tbl .mce_bold" "css_element" should not exist And "#id_introeditor_tbl .mce_anchor" "css_element" should exist - And I set the following administration settings values: - | Editor toolbar | fontselect,fontsizeselect,formatselect,\|,undo,redo,\|,search,replace,\|,fullscreen | + And the following config values are set as admin: + | customtoolbar | fontselect,fontsizeselect,formatselect,\|,undo,redo,\|,search,replace,\|,fullscreen | editor_tinymce | And I am on homepage And I follow "Course 1" And I add a "Database" to section "1" diff --git a/message/tests/behat/send_message.feature b/message/tests/behat/send_message.feature index 996b6f7eae5..6121834dcc5 100644 --- a/message/tests/behat/send_message.feature +++ b/message/tests/behat/send_message.feature @@ -12,10 +12,8 @@ Feature: Users can send messages to each other @javascript Scenario: Using the 'Send message' dialog on one's profile - Given I log in as "admin" - And I set the following administration settings values: + Given the following config settings values are set as admin: | forceloginforprofiles | 0 | - And I log out And I log in as "user1" And I navigate to "Messages" node in "My profile" And I set the field "Search people and messages" to "User Two" diff --git a/mod/assign/tests/behat/outcome_grading.feature b/mod/assign/tests/behat/outcome_grading.feature index 65dc2e4b4c5..92b80c4833d 100644 --- a/mod/assign/tests/behat/outcome_grading.feature +++ b/mod/assign/tests/behat/outcome_grading.feature @@ -18,11 +18,10 @@ Feature: Outcome grading | teacher1 | C1 | editingteacher | | student0 | C1 | student | | student1 | C1 | student | + And the following config values are set as admin: + | enableoutcomes | 1 | And I log in as "admin" - And I set the following administration settings values: - | Enable outcomes | 1 | - And I expand "Grades" node - And I follow "Scales" + And I navigate to "Scales" node in "Site administration > Grades" And I press "Add a new scale" And I set the following fields to these values: | Name | Test Scale | diff --git a/mod/assign/tests/behat/quickgrading.feature b/mod/assign/tests/behat/quickgrading.feature index fa968b37547..fa1f945edfd 100644 --- a/mod/assign/tests/behat/quickgrading.feature +++ b/mod/assign/tests/behat/quickgrading.feature @@ -58,11 +58,9 @@ Feature: In an assignment, teachers grade multiple students on one page | teacher1 | C1 | editingteacher | | student1 | C1 | student | | student2 | C1 | student | - When I log in as "admin" - And I set the following administration settings values: - | Enable outcomes | 1 | - And I log out - And I log in as "teacher1" + And the following config values are set as admin: + | enableoutcomes | 1 | + When I log in as "teacher1" And I follow "Course 1" And I follow "Outcomes" And I follow "Edit outcomes" diff --git a/mod/feedback/tests/behat/show_nonrespondents.feature b/mod/feedback/tests/behat/show_nonrespondents.feature index 9e8fd7d7279..82eff464807 100644 --- a/mod/feedback/tests/behat/show_nonrespondents.feature +++ b/mod/feedback/tests/behat/show_nonrespondents.feature @@ -33,9 +33,9 @@ Feature: Show users who have not responded to the feedback survey And the following "grouping groups" exist: | grouping | group | | GXI1 | GI1 | + And the following config settings values are set as admin: + | enableavailability | 1 | And I log in as "admin" - And I set the following administration settings values: - | Enable conditional access | 1 | And I navigate to "Manage activities" node in "Site administration > Plugins > Activity modules" And I click on "Show" "link" in the "Feedback" "table_row" And I log out diff --git a/mod/forum/tests/behat/completion_condition_number_discussions.feature b/mod/forum/tests/behat/completion_condition_number_discussions.feature index 68ea13263f5..a69fbd793aa 100644 --- a/mod/forum/tests/behat/completion_condition_number_discussions.feature +++ b/mod/forum/tests/behat/completion_condition_number_discussions.feature @@ -17,11 +17,9 @@ Feature: Set a certain number of discussions as a completion condition for a for | user | course | role | | teacher1 | C1 | editingteacher | | student1 | C1 | student | - And I log in as "admin" - And I set the following administration settings values: - | Enable completion tracking | 1 | - | Enable conditional access | 1 | - And I log out + And the following config values are set as admin: + | enablecompletion | 1 | + | enableavailability | 1 | And I log in as "teacher1" And I follow "Course 1" And I turn editing mode on diff --git a/mod/forum/tests/behat/forum_subscriptions_availability.feature b/mod/forum/tests/behat/forum_subscriptions_availability.feature index 5d94fbed162..32d45675a9a 100644 --- a/mod/forum/tests/behat/forum_subscriptions_availability.feature +++ b/mod/forum/tests/behat/forum_subscriptions_availability.feature @@ -34,10 +34,8 @@ Feature: As a teacher I need to see an accurate list of subscribed users And the following "grouping groups" exist: | grouping | group | | GG1 | G1 | - And I log in as "admin" - And I set the following administration settings values: - | Enable conditional access | 1 | - And I log out + And the following config values are set as admin: + | enableavailability | 1 | And I log in as "teacher" And I follow "Course 1" And I turn editing mode on diff --git a/mod/forum/tests/behat/track_read_posts.feature b/mod/forum/tests/behat/track_read_posts.feature index c6217f5a97a..5bf1233ad0b 100644 --- a/mod/forum/tests/behat/track_read_posts.feature +++ b/mod/forum/tests/behat/track_read_posts.feature @@ -82,8 +82,8 @@ Feature: A teacher can set one of 3 possible options for tracking read forum pos @javascript Scenario: Tracking forum posts forced with user tracking on - Given I set the following administration settings values: - | Allow forced read tracking | 1 | + Given the following config values are set as admin: + | forum_allowforcedreadtracking | 1 | And I follow "Home" And I follow "Course 1" Given I add a "Forum" to section "1" and I fill the form with: @@ -106,8 +106,8 @@ Feature: A teacher can set one of 3 possible options for tracking read forum pos @javascript Scenario: Tracking forum posts forced with user tracking off - Given I set the following administration settings values: - | Allow forced read tracking | 1 | + Given the following config values are set as admin: + | forum_allowforcedreadtracking | 1 | And I follow "Home" And I follow "Course 1" Given I add a "Forum" to section "1" and I fill the form with: @@ -130,8 +130,8 @@ Feature: A teacher can set one of 3 possible options for tracking read forum pos @javascript Scenario: Tracking forum posts forced (with force disabled) with user tracking on - Given I set the following administration settings values: - | Allow forced read tracking | 1 | + Given the following config values are set as admin: + | forum_allowforcedreadtracking | 1 | And I follow "Home" And I follow "Course 1" Given I add a "Forum" to section "1" and I fill the form with: @@ -142,8 +142,8 @@ Feature: A teacher can set one of 3 possible options for tracking read forum pos And I add a new discussion to "Test forum name" forum with: | Subject | Test post subject | | Message | Test post message | - And I set the following administration settings values: - | Allow forced read tracking | 0 | + And the following config values are set as admin: + | forum_allowforcedreadtracking | 0 | And I log out When I log in as "student1" And I follow "Course 1" @@ -162,8 +162,8 @@ Feature: A teacher can set one of 3 possible options for tracking read forum pos @javascript Scenario: Tracking forum posts forced (with force disabled) with user tracking off - Given I set the following administration settings values: - | Allow forced read tracking | 1 | + Given the following config values are set as admin: + | forum_allowforcedreadtracking | 1 | And I follow "Home" And I follow "Course 1" Given I add a "Forum" to section "1" and I fill the form with: @@ -174,8 +174,8 @@ Feature: A teacher can set one of 3 possible options for tracking read forum pos And I add a new discussion to "Test forum name" forum with: | Subject | Test post subject | | Message | Test post message | - And I set the following administration settings values: - | Allow forced read tracking | 0 | + And the following config values are set as admin: + | forum_allowforcedreadtracking | 0 | And I log out When I log in as "student2" And I follow "Course 1" diff --git a/mod/glossary/tests/behat/entries_always_editable.feature b/mod/glossary/tests/behat/entries_always_editable.feature index bc1633311e7..efc9c1e29bc 100644 --- a/mod/glossary/tests/behat/entries_always_editable.feature +++ b/mod/glossary/tests/behat/entries_always_editable.feature @@ -17,10 +17,8 @@ Feature: A teacher can set whether glossary entries are always editable or not | user | course | role | | teacher1 | C1 | editingteacher | | student1 | C1 | student | - And I log in as "admin" - And I set the following administration settings values: - | Maximum time to edit posts | 1 minutes | - And I log out + And the following config values are set as admin: + | maxeditingtime | 60 | And I log in as "teacher1" And I follow "Course 1" And I turn editing mode on diff --git a/mod/lesson/tests/behat/completion_condition_end_reached.feature b/mod/lesson/tests/behat/completion_condition_end_reached.feature index 1bdc2a97736..32cd09f8447 100644 --- a/mod/lesson/tests/behat/completion_condition_end_reached.feature +++ b/mod/lesson/tests/behat/completion_condition_end_reached.feature @@ -17,10 +17,8 @@ Feature: Set end of lesson reached as a completion condition for a lesson | user | course | role | | teacher1 | C1 | editingteacher | | student1 | C1 | student | - And I log in as "admin" - And I set the following administration settings values: - | Enable completion tracking | 1 | - And I log out + And the following config settings values are set as admin: + | enablecompletion | 1 | And I log in as "teacher1" And I follow "Course 1" And I turn editing mode on diff --git a/mod/lesson/tests/behat/completion_condition_time_spent.feature b/mod/lesson/tests/behat/completion_condition_time_spent.feature index 221010aefec..e7f239f8046 100644 --- a/mod/lesson/tests/behat/completion_condition_time_spent.feature +++ b/mod/lesson/tests/behat/completion_condition_time_spent.feature @@ -17,10 +17,8 @@ Feature: Set time spent as a completion condition for a lesson | user | course | role | | teacher1 | C1 | editingteacher | | student1 | C1 | student | - And I log in as "admin" - And I set the following administration settings values: - | Enable completion tracking | 1 | - And I log out + And the following config settings values are set as admin: + | enablecompletion | 1 | And I log in as "teacher1" And I follow "Course 1" And I turn editing mode on diff --git a/mod/quiz/tests/behat/completion_condition_attempts_used.feature b/mod/quiz/tests/behat/completion_condition_attempts_used.feature index cf229a183a2..abcd18836bd 100644 --- a/mod/quiz/tests/behat/completion_condition_attempts_used.feature +++ b/mod/quiz/tests/behat/completion_condition_attempts_used.feature @@ -16,11 +16,10 @@ Feature: Set a quiz to be marked complete when the student uses all attempts all | user | course | role | | teacher1 | C1 | editingteacher | | student1 | C1 | student | + And the following config settings values are set as admin: + | enablecompletion | 1 | And I log in as "admin" - And I set the following administration settings values: - | Enable completion tracking | 1 | - And I expand "Grades" node - And I follow "Grade item settings" + And I navigate to "Grade item settings" node in "Site administration > Grades" And I set the field "Advanced grade item options" to "hiddenuntil" And I press "Save changes" And I log out diff --git a/mod/quiz/tests/behat/completion_condition_passing_grade.feature b/mod/quiz/tests/behat/completion_condition_passing_grade.feature index afa40b7eef5..b16bc856495 100644 --- a/mod/quiz/tests/behat/completion_condition_passing_grade.feature +++ b/mod/quiz/tests/behat/completion_condition_passing_grade.feature @@ -16,11 +16,10 @@ Feature: Set a quiz to be marked complete when the student passes | user | course | role | | teacher1 | C1 | editingteacher | | student1 | C1 | student | + And the following config settings values are set as admin: + | enablecompletion | 1 | And I log in as "admin" - And I set the following administration settings values: - | Enable completion tracking | 1 | - And I expand "Grades" node - And I follow "Grade item settings" + And I navigate to "Grade item settings" node in "Site administration > Grades" And I set the field "Advanced grade item options" to "hiddenuntil" And I press "Save changes" And I log out diff --git a/report/log/tests/behat/filter_log.feature b/report/log/tests/behat/filter_log.feature index a9ad191a552..1a8cb405dd5 100644 --- a/report/log/tests/behat/filter_log.feature +++ b/report/log/tests/behat/filter_log.feature @@ -21,8 +21,8 @@ Feature: In a report, admin can filter log data Scenario: Filter log report for standard and legacy log reader Given I navigate to "Manage log stores" node in "Site administration > Plugins > Logging" And I click on "Enable" "link" in the "Legacy log" "table_row" - And I set the following administration settings values: - | Log legacy data | 1 | + And the following config values are set as admin: + | loglegacy | 1 | logstore_legacy | And I follow "Home" And I follow "Course 1" And I navigate to "Participants" node in "Current course > C1" @@ -62,8 +62,8 @@ Feature: In a report, admin can filter log data Given I navigate to "Manage log stores" node in "Site administration > Plugins > Logging" And I click on "Enable" "link" in the "Legacy log" "table_row" And I click on "Disable" "link" in the "Standard log" "table_row" - And I set the following administration settings values: - | Log legacy data | 1 | + And the following config values are set as admin: + | loglegacy | 1 | logstore_legacy | And I follow "Home" And I follow "Course 1" And I follow "Home" diff --git a/report/loglive/tests/behat/loglive_report.feature b/report/loglive/tests/behat/loglive_report.feature index 98b83472b7a..3ec38eabcc3 100644 --- a/report/loglive/tests/behat/loglive_report.feature +++ b/report/loglive/tests/behat/loglive_report.feature @@ -11,8 +11,8 @@ Feature: In a report, admin can see loglive data And I log in as "admin" And I navigate to "Manage log stores" node in "Site administration > Plugins > Logging" And I click on "Enable" "link" in the "Legacy log" "table_row" - And I set the following administration settings values: - | Log legacy data | 1 | + And the following config values are set as admin: + | loglegacy | 1 | logstore_legacy | And I am on homepage And I follow "Course 1" And I turn editing mode on diff --git a/report/outline/tests/behat/outline.feature b/report/outline/tests/behat/outline.feature index 65ef7f60ba1..eb0abda7ef1 100644 --- a/report/outline/tests/behat/outline.feature +++ b/report/outline/tests/behat/outline.feature @@ -33,8 +33,8 @@ Feature: View an outline report Given I navigate to "Manage log stores" node in "Site administration > Plugins > Logging" And I click on "Enable" "link" in the "Legacy log" "table_row" And I click on "Disable" "link" in the "Standard log" "table_row" - And I set the following administration settings values: - | Log legacy data | 1 | + And the following config values are set as admin: + | loglegacy | 1 | logstore_legacy | And I log out And I log in as "student1" And I follow "Course 1" @@ -79,8 +79,8 @@ Feature: View an outline report Given I navigate to "Manage log stores" node in "Site administration > Plugins > Logging" And I click on "Enable" "link" in the "Legacy log" "table_row" And "Disable" "link" should exist in the "Standard log" "table_row" - And I set the following administration settings values: - | Log legacy data | 1 | + And the following config values are set as admin: + | loglegacy | 1 | logstore_legacy | And I log out And I log in as "student1" And I follow "Course 1" diff --git a/report/outline/tests/behat/user.feature b/report/outline/tests/behat/user.feature index 8a181dcdff9..10a33bbad6f 100644 --- a/report/outline/tests/behat/user.feature +++ b/report/outline/tests/behat/user.feature @@ -32,8 +32,8 @@ Feature: View the user page for the outline report Given I navigate to "Manage log stores" node in "Site administration > Plugins > Logging" And I click on "Enable" "link" in the "Legacy log" "table_row" And I click on "Disable" "link" in the "Standard log" "table_row" - And I set the following administration settings values: - | Log legacy data | 1 | + And the following config values are set as admin: + | loglegacy | 1 | logstore_legacy | And I log out And I log in as "student1" And I follow "Course 1" @@ -84,8 +84,8 @@ Feature: View the user page for the outline report Given I navigate to "Manage log stores" node in "Site administration > Plugins > Logging" And I click on "Enable" "link" in the "Legacy log" "table_row" And "Disable" "link" should exist in the "Standard log" "table_row" - And I set the following administration settings values: - | Log legacy data | 1 | + And the following config values are set as admin: + | loglegacy | 1 | logstore_legacy | And I log out And I log in as "student1" And I follow "Course 1" diff --git a/report/participation/tests/behat/filter_participation.feature b/report/participation/tests/behat/filter_participation.feature index 02f84df7e4c..6820059b744 100644 --- a/report/participation/tests/behat/filter_participation.feature +++ b/report/participation/tests/behat/filter_participation.feature @@ -34,8 +34,8 @@ Feature: In a participation report, admin can filter student actions And I navigate to "Manage log stores" node in "Site administration > Plugins > Logging" And I click on "Disable" "link" in the "Standard log" "table_row" And I click on "Enable" "link" in the "Legacy log" "table_row" - And I set the following administration settings values: - | Log legacy data | 1 | + And the following config values are set as admin: + | loglegacy | 1 | logstore_legacy | And I log out And I log in as "student1" And I follow "Course 1" @@ -55,8 +55,8 @@ Feature: In a participation report, admin can filter student actions And I navigate to "Manage log stores" node in "Site administration > Plugins > Logging" And I click on "Disable" "link" in the "Standard log" "table_row" And I click on "Enable" "link" in the "Legacy log" "table_row" - And I set the following administration settings values: - | Log legacy data | 1 | + And the following config values are set as admin: + | loglegacy | 1 | logstore_legacy | And I log out And I log in as "student1" And I follow "Course 1" diff --git a/user/tests/behat/table_sorting.feature b/user/tests/behat/table_sorting.feature index f3923e502c3..cf822f2c254 100644 --- a/user/tests/behat/table_sorting.feature +++ b/user/tests/behat/table_sorting.feature @@ -12,9 +12,9 @@ Feature: Tables can be sorted by additional names | student3 | Travis | Sutcliff | Peter | Mr T | student3@mail.com | s3 | And I log in as "admin" And I navigate to "User policies" node in "Site administration > Users > Permissions" - And I set the following administration settings values: - | Full name format | firstname middlename lastname | - | Alternative full name format | firstname middlename alternatename lastname | + And the following config values are set as admin: + | fullnamedisplay | firstname middlename lastname | + | alternativefullnameformat | firstname middlename alternatename lastname | @javascript Scenario: All user names are show and sortable in the administration user list. diff --git a/user/tests/behat/view_full_profile.feature b/user/tests/behat/view_full_profile.feature index dc38c54bc42..87efb76e27d 100644 --- a/user/tests/behat/view_full_profile.feature +++ b/user/tests/behat/view_full_profile.feature @@ -40,10 +40,8 @@ Feature: Access to full profiles of users @javascript Scenario: Viewing full profiles with forceloginforprofiles off - Given I log in as "admin" - And I set the following administration settings values: - | Force users to log in for profiles | 0 | - And I log out + Given the following config values are set as admin: + | forceloginforprofiles | 0 | When I log in as "student1" And I follow "Course 1" And I navigate to "Participants" node in "Current course > C1"