Skip to content

Commit

Permalink
MDL-71055 behat: Update core settings to use generator
Browse files Browse the repository at this point in the history
These changes have only been applied to settings which were already
using settings names and values, but which were still using the UI.
  • Loading branch information
andrewnicols committed Aug 23, 2021
1 parent 1464843 commit 891d1bf
Show file tree
Hide file tree
Showing 17 changed files with 59 additions and 73 deletions.
7 changes: 2 additions & 5 deletions admin/tests/behat/behat_admin.php
Expand Up @@ -53,11 +53,8 @@ public function i_set_the_following_administration_settings_values(TableNode $ta
}

foreach ($data as $label => $value) {
$this->execute('behat_navigation::i_select_from_flat_navigation_drawer', [get_string('administrationsite')]);

// Search by label.
$this->execute('behat_forms::i_set_the_field_to', [get_string('search'), $label]);
$this->execute("behat_forms::press_button", get_string('search', 'admin'));
// Navigate straight to the search results fo rthis label.
$this->execute('behat_general::i_visit', ["/admin/search.php?query=" . urlencode($label)]);

// Admin settings does not use the same DOM structure than other moodle forms
// but we also need to use lib/behat/form_field/* to deal with the different moodle form elements.
Expand Down
Expand Up @@ -9,10 +9,8 @@ Feature: Manage data requests
| username | firstname | lastname | email |
| student1 | John | Doe | s1@example.com |
| student2 | Jane | Doe | s2@example.com |
And I log in as "admin"
And I set the following administration settings values:
| contactdataprotectionofficer | 1 |
And I log out
And the following config values are set as admin:
| contactdataprotectionofficer | 1 | tool_dataprivacy |

@javascript
Scenario: Marking general enquiries as complete
Expand Down
4 changes: 1 addition & 3 deletions auth/tests/behat/login.feature
Expand Up @@ -41,10 +41,8 @@ Feature: Authentication
Then I should see "You are not logged in" in the "page-footer" "region"

Scenario Outline: Checking the display of the Remember username checkbox
Given I log in as "admin"
And I set the following administration settings values:
Given the following config values are set as admin:
| rememberusername | <settingvalue> |
And I log out
And I am on homepage
When I click on "Log in" "link" in the ".logininfo" "css_element"
Then I should <expect> "Remember username"
Expand Down
6 changes: 2 additions & 4 deletions backup/util/ui/tests/behat/duplicate_activities.feature
Expand Up @@ -17,10 +17,8 @@ Feature: Duplicate activities
And the following "activities" exist:
| activity | name | intro | course | idnumber | section |
| data | Test database name | Test database description | C1 | database1 | 1 |
And I log in as "admin"
And I set the following administration settings values:
| backup_import_activities | 0 |
And I log out
And the following config values are set as admin:
| backup_import_activities | 0 | backup |
And I log in as "teacher1"
And I am on "Course 1" course homepage with editing mode on
And I duplicate "Test database name" activity
Expand Down
4 changes: 2 additions & 2 deletions blocks/section_links/tests/behat/show_section_name.feature
Expand Up @@ -16,9 +16,9 @@ Feature: The Section links block can be configured to display section name in ad
| user | course | role |
| teacher1 | C1 | editingteacher |
| student1 | C1 | student |
And the following config values are set as admin:
| showsectionname | 1 | block_section_links |
And I log in as "admin"
And I set the following administration settings values:
| showsectionname | 1 |
And I am on "Course 1" course homepage with editing mode on
And I add the "Section links" block
And I log out
Expand Down
4 changes: 2 additions & 2 deletions blocks/site_main_menu/tests/behat/edit_activities.feature
Expand Up @@ -24,9 +24,9 @@ Feature: Edit activities in main menu block

@javascript
Scenario: Activities in main menu block can be made available but not visible on a course page
And I log in as "admin"
And I set the following administration settings values:
Given the following config values are set as admin:
| allowstealth | 1 |
And I log in as "admin"
And I am on site homepage
And I navigate to "Turn editing on" in current page administration
And I add the "Main menu" block
Expand Down
4 changes: 1 addition & 3 deletions blocks/social_activities/tests/behat/edit_activities.feature
Expand Up @@ -34,10 +34,8 @@ Feature: Edit activities in social activities block

@javascript
Scenario: Activities in social activities block can be made available but not visible on a course page
And I log in as "admin"
And I set the following administration settings values:
Given the following config values are set as admin:
| allowstealth | 1 |
And I log out
And I log in as "user1"
And I am on "Course 1" course homepage with editing mode on
And I add the "Recent activity" block
Expand Down
4 changes: 1 addition & 3 deletions course/tests/behat/activities_visibility_icons.feature
Expand Up @@ -131,10 +131,8 @@ Feature: Toggle activities visibility from the course page
| user | course | role |
| teacher1 | C1 | editingteacher |
| student1 | C1 | student |
And I log in as "admin"
And I set the following administration settings values:
And the following config values are set as admin:
| allowstealth | 1 |
And I log out
And I log in as "teacher1"
And I am on "Course 1" course homepage with editing mode on
And I add the "Recent activity" block
Expand Down
4 changes: 2 additions & 2 deletions course/tests/behat/activity_navigation.feature
Expand Up @@ -42,9 +42,9 @@ Feature: Activity navigation
| wiki | Wiki 1 | Test wiki description | C1 | wiki1 | 6 |
| workshop | Workshop 1 | Test workshop description | C1 | workshop1 | 6 |
| assign | Assignment 1 | Test assignment description | C2 | assign21 | 0 |
And I log in as "admin"
And I set the following administration settings values:
And the following config values are set as admin:
| allowstealth | 1 |
And I log in as "teacher1"
And I am on "Course 1" course homepage with editing mode on
# Stealth activity.
And I click on "Hide" "link" in the "Forum 1" activity
Expand Down
19 changes: 11 additions & 8 deletions course/tests/behat/add_activities.feature
Expand Up @@ -11,16 +11,16 @@ Feature: Add activities to courses
| student2 | Student | 2 | student2@example.com |
And the following "courses" exist:
| fullname | shortname | format |
| Course 1 | C1 | topics |
| Course 1 | Course 1 | topics |
And the following "course enrolments" exist:
| user | course | role |
| student1 | C1 | student |
| student2 | C1 | student |
And I log in as "admin"
And I am on "Course 1" course homepage with editing mode on
| student1 | Course 1 | student |
| student2 | Course 1 | student |

@javascript
Scenario: Add an activity to a course
Given I am on the "Course 1" Course page logged in as admin
And I am on "Course 1" course homepage with editing mode on
When I add a "Database" to section "3" and I fill the form with:
| Name | Test name |
| Description | Test database description |
Expand All @@ -38,15 +38,18 @@ Feature: Add activities to courses

@javascript
Scenario: Add an activity supplying only the name
Given I am on the "Course 1" Course page logged in as admin
And I am on "Course 1" course homepage with editing mode on
When I add a "Database" to section "3" and I fill the form with:
| Name | Test name |
Then I should see "Test name"

@javascript
Scenario: Set activity description to required then add an activity supplying only the name
Given I set the following administration settings values:
| requiremodintro | Yes |
When I am on "Course 1" course homepage
Given the following config values are set as admin:
| requiremodintro | 1 |
And I am on the "Course 1" Course page logged in as admin
And I am on "Course 1" course homepage with editing mode on
And I add a "Database" to section "3" and I fill the form with:
| Name | Test name |
Then I should see "Required"
13 changes: 6 additions & 7 deletions course/tests/behat/course_relativedatesmode.feature
Expand Up @@ -6,9 +6,9 @@ Feature: Courses can be set up to display dates relative to the user's enrolment

@javascript
Scenario: Create a course with relative dates feature disabled
Given I log in as "admin"
And I set the following administration settings values:
Given the following config values are set as admin:
| enablecourserelativedates | 0 |
And I log in as "admin"
And I am on site homepage
And I turn editing mode on
When I press "Add a new course"
Expand All @@ -18,20 +18,19 @@ Feature: Courses can be set up to display dates relative to the user's enrolment

@javascript
Scenario: Create a course with relative dates feature enabled
Given I log in as "admin"
And I set the following administration settings values:
Given the following config values are set as admin:
| enablecourserelativedates | 1 |
And I log in as "admin"
And I am on site homepage
And I turn editing mode on
When I press "Add a new course"
And I wait until the page is ready
Then I should see "Relative dates mode"
And I should see "Relative dates mode cannot be changed once the course has been created."

Scenario: Edit courses with relative dates feature enabled
Given I log in as "admin"
And I set the following administration settings values:
Given the following config values are set as admin:
| enablecourserelativedates | 1 |
And I log in as "admin"
And I create a course with:
| Course full name | Course 1 |
| Course short name | C1 |
Expand Down
6 changes: 3 additions & 3 deletions course/tests/behat/course_request.feature
Expand Up @@ -13,11 +13,11 @@ Feature: Users can request and approve courses

Scenario: Simple course request workflow
Given the following "system role assigns" exist:
| user | course | role |
| user | course | role |
| user2 | Acceptance test site | manager |
Given I log in as "admin"
And I set the following administration settings values:
And the following config values are set as admin:
| lockrequestcategory | 1 |
Given I log in as "admin"
And I set the following system permissions of "Authenticated user" role:
| capability | permission |
| moodle/course:request | Allow |
Expand Down
8 changes: 3 additions & 5 deletions mod/feedback/tests/behat/anonymous.feature
Expand Up @@ -110,10 +110,8 @@ Feature: Anonymous feedback
And I log out

Scenario: Complete fully anonymous feedback on the front page as a guest
And I log in as "admin"
And I set the following administration settings values:
Given the following config values are set as admin:
| feedback_allowfullanonymous | 1 |
And I log out
When I follow "Site feedback"
And I follow "Preview"
And I should see "Do you like our site?"
Expand All @@ -128,9 +126,9 @@ Feature: Anonymous feedback

@javascript
Scenario: Complete fully anonymous feedback and view analyze on the front page as a guest
And I log in as "admin"
And I set the following administration settings values:
Given the following config values are set as admin:
| feedback_allowfullanonymous | 1 |
And I log in as "admin"
And I set the following system permissions of "Guest" role:
| capability | permission |
| mod/feedback:viewanalysepage | Allow |
Expand Down
6 changes: 3 additions & 3 deletions mod/h5pactivity/tests/behat/result_fillin.feature
Expand Up @@ -14,10 +14,10 @@ Feature: View fill the blanks attempt report
And the following "course enrolments" exist:
| user | course | role |
| student1 | C1 | student |
And I log in as "admin"
# No HTML should appear even with formatstringstriptags disabled.
And I set the following administration settings values:
And the following config values are set as admin:
# No HTML should appear even with formatstringstriptags disabled.
| formatstringstriptags | 0 |
And I log in as "admin"
And I am on "Course 1" course homepage with editing mode on
And I add a "H5P" to section "1"
And I set the following fields to these values:
Expand Down
6 changes: 3 additions & 3 deletions mod/h5pactivity/tests/behat/result_longfillin.feature
Expand Up @@ -14,10 +14,10 @@ Feature: View essay attempt report
And the following "course enrolments" exist:
| user | course | role |
| student1 | C1 | student |
And I log in as "admin"
# No HTML should appear even with formatstringstriptags disabled.
And I set the following administration settings values:
And the following config values are set as admin:
# No HTML should appear even with formatstringstriptags disabled.
| formatstringstriptags | 0 |
And I log in as "admin"
And I am on "Course 1" course homepage with editing mode on
And I add a "H5P" to section "1"
And I set the following fields to these values:
Expand Down
23 changes: 12 additions & 11 deletions report/participation/tests/behat/message_participants.feature
Expand Up @@ -7,23 +7,24 @@ Feature: Use the particiaption report to message groups of students
Background:
Given the following "courses" exist:
| fullname | shortname | category | groupmode |
| Course 1 | C1 | 0 | 1 |
| Course 1 | C1 | 0 | 1 |
And the following "users" exist:
| username | firstname | lastname | email |
| teacher1 | Teacher | 1 | teacher1@example.com |
| student1 | Student | 1 | student1@example.com |
| student2 | Student | 2 | student2@example.com |
| student3 | Student | 3 | student3@example.com |
| username | firstname | lastname |
| teacher1 | Teacher | 1 |
| student1 | Student | 1 |
| student2 | Student | 2 |
| student3 | Student | 3 |
And the following "course enrolments" exist:
| user | course | role |
| teacher1 | C1 | editingteacher |
| student1 | C1 | student |
| student2 | C1 | student |
| student3 | C1 | student |
| user | course | role |
| teacher1 | C1 | editingteacher |
| student1 | C1 | student |
| student2 | C1 | student |
| student3 | C1 | student |
And the following "activity" exists:
| course | C1 |
| activity | book |
| name | Test book name |
| idnumber | Test book name |
| description | Test book |
| idnumber | book1 |
And I am on the "Test book name" "book activity" page logged in as student1
Expand Down
8 changes: 3 additions & 5 deletions user/tests/behat/user_grade_navigation.feature
Expand Up @@ -51,11 +51,9 @@ Feature: The student can navigate to their grades page and user grade report.
| Test assignment three | 0.00 %( Empty ) | - | 0150 | - | 0.00 % |

Scenario: Change Grades settings to go to a custom url.
When I log in as "admin"
And I set the following administration settings values:
| grade_mygrades_report | External URL |
| gradereport_mygradeurl | /badges/mybadges.php |
And I log out
Given the following config values are set as admin:
| grade_mygrades_report | external |
| gradereport_mygradeurl | /badges/mybadges.php |
And I log in as "student1"
And I follow "Student 1"
And I follow "Grades" in the user menu
Expand Down

0 comments on commit 891d1bf

Please sign in to comment.