MDL-71055 behat: Update core settings to use generator

These changes have only been applied to settings which were already
using settings names and values, but which were still using the UI.
This commit is contained in:
Andrew Nicols 2021-03-05 12:36:48 +08:00
parent 1464843a25
commit 891d1bfad3
17 changed files with 59 additions and 73 deletions

View File

@ -53,11 +53,8 @@ class behat_admin extends behat_base {
}
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.

View File

@ -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

View File

@ -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"

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -11,16 +11,16 @@ Feature: Add activities to courses
| student2 | Student | 2 | student2@example.com |
And the following "courses" exist:
| fullname | shortname | format |
| Course 1 | C1 | topics |
| Course 1 | Course 1 | topics |
And the following "course enrolments" exist:
| user | course | role |
| student1 | C1 | student |
| student2 | C1 | student |
And I log in as "admin"
And I am on "Course 1" course homepage with editing mode on
| student1 | Course 1 | student |
| student2 | Course 1 | student |
@javascript
Scenario: Add an activity to a course
Given I am on the "Course 1" Course page logged in as admin
And I am on "Course 1" course homepage with editing mode on
When I add a "Database" to section "3" and I fill the form with:
| Name | Test name |
| Description | Test database description |
@ -38,15 +38,18 @@ Feature: Add activities to courses
@javascript
Scenario: Add an activity supplying only the name
Given I am on the "Course 1" Course page logged in as admin
And I am on "Course 1" course homepage with editing mode on
When I add a "Database" to section "3" and I fill the form with:
| Name | Test name |
Then I should see "Test name"
@javascript
Scenario: Set activity description to required then add an activity supplying only the name
Given I set the following administration settings values:
| requiremodintro | Yes |
When I am on "Course 1" course homepage
Given the following config values are set as admin:
| requiremodintro | 1 |
And I am on the "Course 1" Course page logged in as admin
And I am on "Course 1" course homepage with editing mode on
And I add a "Database" to section "3" and I fill the form with:
| Name | Test name |
Then I should see "Required"

View File

@ -6,9 +6,9 @@ Feature: Courses can be set up to display dates relative to the user's enrolment
@javascript
Scenario: Create a course with relative dates feature disabled
Given I log in as "admin"
And I set the following administration settings values:
Given the following config values are set as admin:
| enablecourserelativedates | 0 |
And I log in as "admin"
And I am on site homepage
And I turn editing mode on
When I press "Add a new course"
@ -18,20 +18,19 @@ Feature: Courses can be set up to display dates relative to the user's enrolment
@javascript
Scenario: Create a course with relative dates feature enabled
Given I log in as "admin"
And I set the following administration settings values:
Given the following config values are set as admin:
| enablecourserelativedates | 1 |
And I log in as "admin"
And I am on site homepage
And I turn editing mode on
When I press "Add a new course"
And I wait until the page is ready
Then I should see "Relative dates mode"
And I should see "Relative dates mode cannot be changed once the course has been created."
Scenario: Edit courses with relative dates feature enabled
Given I log in as "admin"
And I set the following administration settings values:
Given the following config values are set as admin:
| enablecourserelativedates | 1 |
And I log in as "admin"
And I create a course with:
| Course full name | Course 1 |
| Course short name | C1 |

View File

@ -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 |

View File

@ -110,10 +110,8 @@ Feature: Anonymous feedback
And I log out
Scenario: Complete fully anonymous feedback on the front page as a guest
And I log in as "admin"
And I set the following administration settings values:
Given the following config values are set as admin:
| feedback_allowfullanonymous | 1 |
And I log out
When I follow "Site feedback"
And I follow "Preview"
And I should see "Do you like our site?"
@ -128,9 +126,9 @@ Feature: Anonymous feedback
@javascript
Scenario: Complete fully anonymous feedback and view analyze on the front page as a guest
And I log in as "admin"
And I set the following administration settings values:
Given the following config values are set as admin:
| feedback_allowfullanonymous | 1 |
And I log in as "admin"
And I set the following system permissions of "Guest" role:
| capability | permission |
| mod/feedback:viewanalysepage | Allow |

View File

@ -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:

View File

@ -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:

View File

@ -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

View File

@ -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