From a1952e8f70ea320cca6a89c1885765f9d092dbd1 Mon Sep 17 00:00:00 2001 From: Rajesh Taneja Date: Tue, 24 Mar 2015 15:35:01 +0800 Subject: [PATCH] MDL-49513 behat: Set admin config using php api Added a new set to set config using set_config() api to make steps faster and more efficient --- admin/tests/behat/behat_admin.php | 24 +++++++++++++++++++ .../behat/set_admin_settings_value.feature | 8 +++---- .../tests/behat/manage_conditions.feature | 8 +++---- .../behat/availability_completion.feature | 8 +++---- .../tests/behat/availability_date.feature | 6 ++--- .../tests/behat/availability_grade.feature | 6 ++--- .../tests/behat/availability_group.feature | 6 ++--- .../tests/behat/availability_grouping.feature | 6 ++--- .../tests/behat/availability_profile.feature | 6 ++--- .../tests/behat/display_availability.feature | 6 ++--- .../tests/behat/edit_availability.feature | 22 ++++++----------- badges/tests/behat/award_badge.feature | 18 +++++--------- .../tests/behat/expand_courses_node.feature | 2 +- .../tests/behat/view_my_courses.feature | 18 ++++++-------- .../tests/behat/structural_changes.feature | 6 ++--- .../behat/enable_manual_complete_mark.feature | 8 +++---- .../behat/restrict_activity_by_date.feature | 6 ++--- .../behat/restrict_activity_by_grade.feature | 6 ++--- .../restrict_section_availability.feature | 8 +++---- .../behat/teacher_manual_completion.feature | 4 ++-- .../behat/activities_edit_completion.feature | 4 ++-- files/tests/behat/course_files.feature | 18 +++++++------- .../tests/behat/edit_available_icons.feature | 12 +++++----- .../tests/behat/outcome_grading.feature | 7 +++--- mod/assign/tests/behat/quickgrading.feature | 8 +++---- ...etion_condition_number_discussions.feature | 8 +++---- .../forum_subscriptions_availability.feature | 6 ++--- .../tests/behat/track_read_posts.feature | 24 +++++++++---------- .../behat/entries_always_editable.feature | 6 ++--- report/log/tests/behat/filter_log.feature | 8 +++---- .../tests/behat/loglive_report.feature | 4 ++-- report/outline/tests/behat/outline.feature | 8 +++---- report/outline/tests/behat/user.feature | 8 +++---- .../tests/behat/filter_participation.feature | 8 +++---- user/tests/behat/view_full_profile.feature | 6 ++--- 35 files changed, 142 insertions(+), 175 deletions(-) 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/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 3f2e3a2112c..32e0bbeb547 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 @@ -172,3 +163,4 @@ Feature: edit_availability And I should not see "None" in the "Restrict access" "fieldset" And "Restriction type" "select" should be visible And I should see "Date" in the "Restrict access" "fieldset" + diff --git a/badges/tests/behat/award_badge.feature b/badges/tests/behat/award_badge.feature index 0812ab70032..0c220866fd6 100644 --- a/badges/tests/behat/award_badge.feature +++ b/badges/tests/behat/award_badge.feature @@ -126,10 +126,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: @@ -139,8 +138,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 click on "//span[text()='Badges']" "xpath_element" in the "Administration" "block" 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 click on "//span[text()='Badges']" "xpath_element" in the "Administration" "block" 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 2fd28caf442..2708f74a999 100644 --- a/blocks/navigation/tests/behat/expand_courses_node.feature +++ b/blocks/navigation/tests/behat/expand_courses_node.feature @@ -187,4 +187,4 @@ Feature: Expand the courses nodes within the navigation block And navigation node "c1" should not be expandable And navigation node "c2" should be expandable And navigation node "c3" should not be expandable - And navigation node "c4" should not be expandable \ No newline at end of file + And navigation node "c4" should not be expandable diff --git a/blocks/navigation/tests/behat/view_my_courses.feature b/blocks/navigation/tests/behat/view_my_courses.feature index a629d9eafa0..f0345d3e88f 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 follow "My home" 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 follow "My home" 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 31911e3a816..c884265ede3 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 group members only | 1 | - And I log out + Given the following config values are set as admin: + | enablegroupmembersonly | 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 7c29e65874f..8b8a826f307 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 441c81b352d..a7823e3900a 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 80858db4931..8084dff1140 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/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/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/forum/tests/behat/completion_condition_number_discussions.feature b/mod/forum/tests/behat/completion_condition_number_discussions.feature index 6d1bbeceef0..464a382f668 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 417ac88be72..46ee2a0f44a 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 group members only | 1 | - And I log out + And the following config values are set as admin: + | enablegroupmembersonly | 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/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 ffcea0f8cc3..3d316a87c91 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/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"