Commit f083d614 authored by David Monllaó's avatar David Monllaó
Browse files

MDL-43738 behat: Updating features files

The following used steps were replaced by the ones
added in this issue:
- I fill the moodle form with
- I fill in with
- I select from
- I select radio button
- I check
- I uncheck
- the field should match

Also removing test for deprecated steps:
- the ASD checkbox should be checked
- the ASD checkbox should not be checked
parent a5254141
......@@ -17,7 +17,7 @@ Feature: Display extended course names
Scenario: Courses list with extended course names
Given I expand "Site administration" node
And I click on "Courses" "link" in the "//div[@id='settingsnav']/descendant::li[contains(concat(' ', normalize-space(@class), ' '), ' type_setting ')][contains(., 'Appearance')]" "xpath_element"
And I check "Display extended course names"
And I set the field "Display extended course names" to "1"
When I press "Save changes"
And I am on homepage
Then I should see "C_shortname Course fullname"
......@@ -29,7 +29,7 @@ Feature: An administrator can filter user accounts by role, cohort and other pro
@javascript
Scenario: Filter user accounts by role and cohort
When I fill the moodle form with:
When I set the following fields to these values:
| courserole_rl | Student |
| courserole_ct | any category |
| courserole | C1 |
......@@ -38,7 +38,7 @@ Feature: An administrator can filter user accounts by role, cohort and other pro
And I should see "User Two"
And I should see "User Three"
And I should not see "User Four"
And I fill the moodle form with:
And I set the following fields to these values:
| cohort | CH1 |
And I press "Add filter"
And I should not see "User One"
......@@ -53,14 +53,14 @@ Feature: An administrator can filter user accounts by role, cohort and other pro
@javascript
Scenario: Filter user accounts by confirm and authentication method
When I fill the moodle form with:
When I set the following fields to these values:
| Confirmed | No |
And I press "Add filter"
Then I should see "User One"
And I should not see "User Two"
And I should not see "User Three"
And I should see "User Four"
And I fill the moodle form with:
And I set the following fields to these values:
| Authentication | manual |
And I press "Add filter"
And I should see "User One"
......
......@@ -41,5 +41,5 @@ Feature: Upload users
And I follow "Maths"
And I expand "Users" node
And I follow "Groups"
And I select "Section 1 (1)" from "groups"
And I set the field "groups" to "Section 1 (1)"
And the "members" select box should contain "Tom Jones"
......@@ -11,7 +11,7 @@ Feature: Page contents assertions
And I expand "Users" node
And I follow "Groups"
And I press "Create group"
And I fill the moodle form with:
And I set the following fields to these values:
| Group name | I'm the name |
| Group description | I'm the description |
And I press "Save changes"
......
......@@ -89,11 +89,11 @@ Feature: Set up contextual data for tests
And I follow "Course 1"
And I expand "Users" node
And I follow "Permissions"
And I select "Student (1)" from "Advanced role override"
Then the "mod/forum:editanypost" field should match "1" value
And I set the field "Advanced role override" to "Student (1)"
Then "mod/forum:editanypost" capability has "Allow" permission
And I press "Cancel"
And I select "Teacher (1)" from "Advanced role override"
And the "mod/forum:replynews" field should match "-1" value
And I set the field "Advanced role override" to "Teacher (1)"
And "mod/forum:replynews" capability has "Prevent" permission
And I press "Cancel"
Scenario: Add course enrolments
......@@ -249,7 +249,7 @@ Feature: Set up contextual data for tests
And I follow "Groups"
Then the "groups" select box should contain "Group 1 (1)"
And the "groups" select box should contain "Group 2 (1)"
And I select "Group 1 (1)" from "groups"
And I set the field "groups" to "Group 1 (1)"
And the "members" select box should contain "Student 1"
And I select "Group 2 (1)" from "groups"
And I set the field "groups" to "Group 2 (1)"
And the "members" select box should contain "Student 2"
......@@ -25,10 +25,10 @@ Feature: Edit capabilities
| moodle/grade:managesharedforms | Prevent |
| moodle/course:request | Prohibit |
When I follow "Edit Teacher role"
Then the "block/mnet_hosts:myaddinstance" field should match "1" value
And the "moodle/community:add" field should match "0" value
And the "moodle/grade:managesharedforms" field should match "-1" value
And the "moodle/course:request" field should match "-1000" value
Then "block/mnet_hosts:myaddinstance" capability has "Allow" permission
And "moodle/community:add" capability has "Not set" permission
And "moodle/grade:managesharedforms" capability has "Prevent" permission
And "moodle/course:request" capability has "Prohibit" permission
@javascript
Scenario: Course capabilities overrides
......@@ -40,10 +40,10 @@ Feature: Edit capabilities
| mod/forum:deleteanypost | Prohibit |
| mod/forum:editanypost | Prevent |
| mod/forum:addquestion | Allow |
When I select "Student (3)" from "Advanced role override"
Then the "mod/forum:deleteanypost" field should match "-1000" value
And the "mod/forum:editanypost" field should match "-1" value
And the "mod/forum:addquestion" field should match "1" value
When I set the field "Advanced role override" to "Student (3)"
Then "mod/forum:deleteanypost" capability has "Prohibit" permission
And "mod/forum:editanypost" capability has "Prevent" permission
And "mod/forum:addquestion" capability has "Allow" permission
@javascript
Scenario: Module capabilities overrides
......@@ -59,7 +59,7 @@ Feature: Edit capabilities
| mod/forum:deleteanypost | Prohibit |
| mod/forum:editanypost | Prevent |
| mod/forum:addquestion | Allow |
When I select "Student (3)" from "Advanced role override"
Then the "mod/forum:deleteanypost" field should match "-1000" value
And the "mod/forum:editanypost" field should match "-1" value
And the "mod/forum:addquestion" field should match "1" value
When I set the field "Advanced role override" to "Student (3)"
Then "mod/forum:deleteanypost" capability has "Prohibit" permission
And "mod/forum:editanypost" capability has "Prevent" permission
And "mod/forum:addquestion" capability has "Allow" permission
......@@ -36,8 +36,8 @@ Feature: Verify that all form fields values can be get and set
And I expand "Site administration" node
And I expand "Appearance" node
And I follow "Manage tags"
# Select (multi-select) - We will check "I fill in...".
And I fill in "otagsadd" with "OT1, OT2, OT3, OT4, OT5"
# Select (multi-select) - We will check "I set the field...".
And I set the field "otagsadd" to "OT1, OT2, OT3, OT4, OT5"
And I press "Add official tags"
And I am on homepage
And I follow "Course 1"
......@@ -55,8 +55,8 @@ Feature: Verify that all form fields values can be get and set
And the "tags[officialtags][]" select box should not contain "OT6"
And the "tags[officialtags][]" select box should not contain "OT7"
And the "tags[officialtags][]" select box should not contain "OT6, OT7"
# Text (textarea & editor) & Select (multi-select) - Checking "I fill the moodle form with".
When I fill the moodle form with:
# Text (textarea & editor) & Select (multi-select) - Checking "I set the following fields to these values".
When I set the following fields to these values:
| HTML format | Student page contents to be tagged |
| tags[officialtags][] | OT1, OT3, OT5 |
And I press "Save"
......@@ -67,8 +67,8 @@ Feature: Verify that all form fields values can be get and set
And I should not see "OT2" in the ".wiki-tags" "css_element"
And I should not see "OT4" in the ".wiki-tags" "css_element"
And I follow "Edit"
# Select (multi-select) - Checking "I select from".
And I select "OT2, OT4" from "tags[officialtags][]"
# Select (multi-select) - Checking "I set the field".
And I set the field "tags[officialtags][]" to "OT2, OT4"
And I press "Save"
And I should see "OT2" in the ".wiki-tags" "css_element"
And I should see "OT4" in the ".wiki-tags" "css_element"
......@@ -76,40 +76,40 @@ Feature: Verify that all form fields values can be get and set
And I should not see "OT3" in the ".wiki-tags" "css_element"
And I should not see "OT5" in the ".wiki-tags" "css_element"
And I follow "Edit"
# Select (multi-select) - Checking "the field should match" and "the field does not match value".
And the "tags[officialtags][]" field should match "OT2, OT4" value
# Select (multi-select) - Checking "the field matches value" and "the field does not match value".
And the field "tags[officialtags][]" matches value "OT2, OT4"
And the field "tags[officialtags][]" does not match value "OT4"
And the field "tags[officialtags][]" does not match value "OT2"
And the field "tags[officialtags][]" does not match value "OT1, OT3, OT5"
And I press "Cancel"
And I follow "Edit settings"
And I expand all fieldsets
# Checkbox - Checking "I check".
And I check "Display description on course page"
# Checkbox - Checking "I fill the moodle form with:".
And I fill the moodle form with:
# Checkbox - Checking "I set the field".
And I set the field "Display description on course page" to "1"
# Checkbox - Checking "I set the following fields to these values:".
And I set the following fields to these values:
| Force format | 1 |
# Checkbox - Checking "the field should match" and "the field does not match value".
And the "Display description on course page" field should match "1" value
# Checkbox - Checking "the field matches value" and "the field does not match value".
And the field "Display description on course page" matches value "1"
And the field "Display description on course page" does not match value ""
And I press "Save and return to course"
And I should see "Test this one"
And I follow "Test this one"
And I follow "Edit settings"
# Checkbox - Checking "the field should match" and "the following fields match these values".
# Checkbox - Checking "the field matches value" and "the following fields match these values".
And the following fields match these values:
| Display description on course page | 1 |
| Default format | HTML |
| Wiki name | Test this one |
And the "Force format" field should match "1" value
# Select (simple) - Checking "I fill the moodle form with:".
And I fill the moodle form with:
And the field "Force format" matches value "1"
# Select (simple) - Checking "I set the following fields to these values:".
And I set the following fields to these values:
| Default format | NWiki |
| Display description on course page | |
# Checkbox - Checking "I uncheck".
And I uncheck "Force format"
# Select (simple) - Checking "I select from".
And I select "Separate groups" from "Group mode"
# Checkbox - Checking "I set the field" to uncheck.
And I set the field "Force format" to ""
# Select (simple) - Checking "I set the field".
And I set the field "Group mode" to "Separate groups"
And I press "Save and display"
And I follow "Edit settings"
And the following fields match these values:
......@@ -124,7 +124,7 @@ Feature: Verify that all form fields values can be get and set
| Force format | 1 |
And I press "Cancel"
And I follow "Course 1"
# Radio - Checking "I check" and "the field should match".
# Radio - Checking "I set the field" and "the field matches value".
And I add a "Choice" to section "1" and I fill the form with:
| Choice name | Test choice name |
| Description | Test choice description |
......@@ -133,10 +133,10 @@ Feature: Verify that all form fields values can be get and set
| Option 2 | two |
| Option 3 | three |
And I follow "Test choice name"
And I check "one"
And I set the field "one" to "1"
And I press "Save my choice"
And the "one" field should match "1" value
And the "two" field should match "" value
And the field "one" matches value "1"
And the field "two" matches value ""
Scenario: with JS disabled all form fields getters and setters works as expected
......@@ -145,29 +145,29 @@ Feature: Verify that all form fields values can be get and set
Then I follow "Course 1"
And I expand "Users" node
And I follow "Groups"
# Select (multi-select & AJAX) - Checking "I select from" and "select box should contain".
And I select "Group 2" from "groups"
# Select (multi-select & AJAX) - Checking "I set the field" and "select box should contain".
And I set the field "groups" to "Group 2"
And the "members" select box should contain "Student 2"
And the "members" select box should contain "Student 3"
And the "members" select box should not contain "Student 1"
And I select "Group 1" from "groups"
And I set the field "groups" to "Group 1"
And the "members" select box should contain "Student 1"
And the "members" select box should contain "Student 2"
And the "members" select box should not contain "Student 3"
# Checkbox (AJAX) - Checking "I check" and "I fill the moodle form with".
# Checkbox (AJAX) - Checking "I set the field" and "I set the following fields to these values".
And I follow "Course 1"
And I add a "Lesson" to section "1"
And I fill the moodle form with:
And I set the following fields to these values:
| Name | Test lesson |
| available[enabled] | 1 |
And I check "deadline[enabled]"
# Checkbox (AJAX) - Checking "field should match" before saving.
And the "available[enabled]" field should match "1" value
And I set the field "deadline[enabled]" to "1"
# Checkbox (AJAX) - Checking "the field matches value" before saving.
And the field "available[enabled]" matches value "1"
And the "available[day]" "field" should be enabled
And the "deadline[enabled]" field should match "1" value
And the field "deadline[enabled]" matches value "1"
And I press "Save and display"
And I follow "Edit settings"
And the "available[enabled]" field should match "1" value
And the field "available[enabled]" matches value "1"
And the "available[day]" "field" should be enabled
And the "deadline[enabled]" field should match "1" value
And the field "deadline[enabled]" matches value "1"
And I press "Cancel"
......@@ -18,14 +18,14 @@ Feature: List the system steps definitions
@javascript
Scenario: Filtering by type
Given I select "Then. Checkings to ensure the outcomes are the expected ones" from "Type"
Given I set the field "Type" to "Then. Checkings to ensure the outcomes are the expected ones"
When I press "Filter"
Then I should see "Checks, that page contains specified text."
And I should not see "Opens Moodle homepage."
@javascript
Scenario: Filtering by keyword
Given I fill in "Contains" with "homepage"
Given I set the field "Contains" to "homepage"
When I press "Filter"
Then I should see "Opens Moodle homepage."
......@@ -9,14 +9,14 @@ Feature: Forms manipulation
Given I log in as "admin"
And I follow "Admin User"
And I follow "Edit profile"
When I fill in "First name" with "Field value"
And I select "Plain text area" from "Text editor"
And I check "Unmask"
Then the "First name" field should match "Field value" value
When I set the field "First name" to "Field value"
And I set the field "Text editor" to "Plain text area"
And I set the field "Unmask" to "1"
Then the field "First name" matches value "Field value"
And the "Text editor" select box should contain "Plain text area"
And the "Unmask" checkbox should be checked
And I uncheck "Unmask"
And the "Unmask" checkbox should not be checked
And the field "Unmask" matches value "1"
And I set the field "Unmask" to ""
And the field "Unmask" matches value ""
And I press "Update profile"
@javascript
......
......@@ -14,47 +14,47 @@ Feature: Transform steps arguments
And I follow "Edit profile"
Scenario: Use nasty strings on steps arguments
When I fill in "Surname" with "$NASTYSTRING1"
And I fill in "Description" with "$NASTYSTRING2"
And I fill in "City/town" with "$NASTYSTRING3"
When I set the field "Surname" to "$NASTYSTRING1"
And I set the field "Description" to "$NASTYSTRING2"
And I set the field "City/town" to "$NASTYSTRING3"
And I press "Update profile"
And I follow "Edit profile"
Then I should not see "NASTYSTRING"
And the "Surname" field should match "$NASTYSTRING1" value
And the "City/town" field should match "$NASTYSTRING3" value
And the field "Surname" matches value "$NASTYSTRING1"
And the field "City/town" matches value "$NASTYSTRING3"
Scenario: Use nasty strings on table nodes
When I fill the moodle form with:
When I set the following fields to these values:
| Surname | $NASTYSTRING1 |
| Description | $NASTYSTRING2 |
| City/town | $NASTYSTRING3 |
And I press "Update profile"
And I follow "Edit profile"
Then I should not see "NASTYSTRING"
And the "Surname" field should match "$NASTYSTRING1" value
And the "City/town" field should match "$NASTYSTRING3" value
And the field "Surname" matches value "$NASTYSTRING1"
And the field "City/town" matches value "$NASTYSTRING3"
Scenario: Use double quotes
When I fill the moodle form with:
When I set the following fields to these values:
| First name | va"lue1 |
| Description | va\"lue2 |
And I fill in "City/town" with "va\"lue3"
And I set the field "City/town" to "va\"lue3"
And I press "Update profile"
And I follow "Edit profile"
Then I should not see "NASTYSTRING"
And the "First name" field should match "va\"lue1" value
And the "Description" field should match "va\\"lue2" value
And the "City/town" field should match "va\"lue3" value
And the field "First name" matches value "va\"lue1"
And the field "Description" matches value "va\\"lue2"
And the field "City/town" matches value "va\"lue3"
@javascript
Scenario: Nasty strings with other contents
When I fill in "First name" with "My Firstname $NASTYSTRING1"
And I fill the moodle form with:
When I set the field "First name" to "My Firstname $NASTYSTRING1"
And I set the following fields to these values:
| Surname | My Surname $NASTYSTRING2 |
And I press "Update profile"
And I follow "Edit profile"
Then I should not see "NASTYSTRING"
And I should see "My Firstname"
And I should see "My Surname"
And the "First name" field should match "My Firstname $NASTYSTRING1" value
And the "Surname" field should match "My Surname $NASTYSTRING2" value
And the field "First name" matches value "My Firstname $NASTYSTRING1"
And the field "Surname" matches value "My Surname $NASTYSTRING2"
......@@ -30,7 +30,7 @@ Feature: An admin can create courses using a CSV file
@javascript
Scenario: Creation of existing courses
Given I upload "admin/tool/uploadcourse/tests/fixtures/courses.csv" file to "File" filemanager
And I select "Create all, increment shortname if needed" from "Upload mode"
And I set the field "Upload mode" to "Create all, increment shortname if needed"
And I click on "Preview" "button"
When I click on "Upload courses" "button"
Then I should see "Course created"
......
......@@ -16,8 +16,8 @@ Feature: An admin can update courses using a CSV file
@javascript
Scenario: Updating a course fullname
Given I upload "admin/tool/uploadcourse/tests/fixtures/courses.csv" file to "File" filemanager
And I select "Only update existing courses" from "Upload mode"
And I select "Update with CSV data only" from "Update mode"
And I set the field "Upload mode" to "Only update existing courses"
And I set the field "Update mode" to "Update with CSV data only"
And I click on "Preview" "button"
When I click on "Upload courses" "button"
Then I should see "Course updated"
......
......@@ -56,8 +56,8 @@ class behat_auth extends behat_base {
// Generic steps (we will prefix them later expanding the navigation dropdown if necessary).
$steps = array(
new Given('I follow "' . get_string('login') . '"'),
new Given('I fill in "' . get_string('username') . '" with "' . $this->escape($username) . '"'),
new Given('I fill in "' . get_string('password') . '" with "'. $this->escape($username) . '"'),
new Given('I set the field "' . get_string('username') . '" to "' . $this->escape($username) . '"'),
new Given('I set the field "' . get_string('password') . '" to "'. $this->escape($username) . '"'),
new Given('I press "' . get_string('login') . '"')
);
......
......@@ -19,8 +19,8 @@ Feature: Authentication
| testuser | testuser | Test | User | moodle@moodlemoodle.com |
And I am on homepage
When I follow "Log in"
And I fill in "Username" with "testuser"
And I fill in "Password" with "testuser"
And I set the field "Username" to "testuser"
And I set the field "Password" to "testuser"
And I press "Log in"
Then I should see "You are logged in as"
......@@ -30,8 +30,8 @@ Feature: Authentication
| testuser | testuser | Test | User | moodle@moodlemoodle.com |
And I am on homepage
When I follow "Log in"
And I fill in "Username" with "testuser"
And I fill in "Password" with "unexisting"
And I set the field "Username" to "testuser"
And I set the field "Password" to "unexisting"
And I press "Log in"
Then I should see "Invalid login, please try again"
......
......@@ -25,12 +25,12 @@ Feature: Duplicate activities
And I wait until section "1" is available
And I open "Test database name" actions menu
And I click on "Edit settings" "link" in the "Test database name" activity
And I fill the moodle form with:
And I set the following fields to these values:
| Name | Original database name |
And I press "Save and return to course"
And I open "Test database name" actions menu
And I click on "Edit settings" "link" in the "Test database name" activity
And I fill the moodle form with:
And I set the following fields to these values:
| Name | Duplicated database name |
| Description | Duplicated database description |
And I press "Save and return to course"
......
......@@ -42,9 +42,9 @@ Feature: Restore Moodle 2 course backups
And I should see "Test forum name"
And I click on "Edit settings" "link" in the "Administration" "block"
And I expand all fieldsets
And the "id_format" field should match "Topics format" value
And the "Number of sections" field should match "15" value
And the "Course layout" field should match "Show one section per page" value
And the field "id_format" matches value "Topics format"
And the field "Number of sections" matches value "15"
And the field "Course layout" matches value "Show one section per page"
And I press "Cancel"
@javascript
......@@ -87,8 +87,8 @@ Feature: Restore Moodle 2 course backups
And I should see "Test forum name"
And I click on "Edit settings" "link" in the "Administration" "block"
And I expand all fieldsets
And the "id_format" field should match "Topics format" value
And I fill the moodle form with:
And the field "id_format" matches value "Topics format"
And I set the following fields to these values:
| id_startdate_day | 1 |
| id_startdate_month | January |
| id_startdate_year | 2020 |
......@@ -98,14 +98,14 @@ Feature: Restore Moodle 2 course backups
And I should see "Test forum name"
And I click on "Edit settings" "link" in the "Administration" "block"
And I expand all fieldsets
And the "id_format" field should match "Weekly format" value
And I fill the moodle form with:
And the field "id_format" matches value "Weekly format"
And I set the following fields to these values:
| id_format | Social format |
And I press "Save changes"
And I should see "An open forum for chatting about anything you want to"
And I click on "Edit settings" "link" in the "Administration" "block"
And I expand all fieldsets
And the "id_format" field should match "Social format" value
And the field "id_format" matches value "Social format"
And I press "Cancel"
@javascript
......@@ -122,9 +122,9 @@ Feature: Restore Moodle 2 course backups
| Overwrite course configuration | Yes |
And I click on "Edit settings" "link" in the "Administration" "block"
And I expand all fieldsets
Then the "id_format" field should match "Topics format" value
And the "Number of sections" field should match "15" value
And the "Course layout" field should match "Show one section per page" value
Then the field "id_format" matches value "Topics format"
And the field "Number of sections" matches value "15"
And the field "Course layout" matches value "Show one section per page"
And I press "Cancel"
And section "3" should be hidden
And section "7" should be hidden
......
......@@ -13,12 +13,12 @@ Feature: Add badges to the system
Given I expand "Site administration" node
And I expand "Badges" node
And I follow "Badges settings"
And I fill in "Default badge issuer name" with "Test Badge Site"
And I fill in "Default badge issuer contact details" with "testuser@test-badge-site.com"
And I set the field "Default badge issuer name" to "Test Badge Site"
And I set the field "Default badge issuer contact details" to "testuser@test-badge-site.com"
And I press "Save changes"
When I follow "Add a new badge"
Then the "issuercontact" field should match "testuser@test-badge-site.com" value
And the "issuername" field should match "Test Badge Site" value
Then the field "issuercontact" matches value "testuser@test-badge-site.com"
And the field "issuername" matches value "Test Badge Site"
@javascript
Scenario: Accessing the badges
......@@ -31,7 +31,7 @@ Feature: Add badges to the system
Given I expand "Site administration" node
And I expand "Badges" node
And I follow "Add a new badge"
And I fill the moodle form with:
And I set the following fields to these values:
| Name | Test Badge |
| Description | Test badge description |
| issuername | Test Badge Site |
......
......@@ -10,17 +10,17 @@ Feature: Award badges
And I expand "Site administration" node
And I expand "Badges" node
And I follow "Add a new badge"
And I fill the moodle form with:
And I set the following fields to these values:
| Name | Profile Badge |
| Description | Test badge description |
| issuername | Test Badge Site |
| issuercontact | testuser@test-badge-site.com |
And I upload "badges/tests/behat/badge.png" file to "Image" filemanager
And I press "Create badge"
And I select "Profile completion" from "type"
And I check "First name"
And I check "Email address"
And I check "Phone"
And I set the field "type" to "Profile completion"
And I set the field "First name" to "1"
And I set the field "Email address" to "1"
And I set the field "Phone" to "1"
When I press "Save"
Then I should see "Profile completion"
And I should see "First name"
......@@ -31,7 +31,7 @@ Feature: Award badges
And I expand "My profile settings" node
And I follow "Edit profile"
And I expand all fieldsets
And I fill in "Phone" with "123456789"
And I set the field "Phone" to "123456789"
And I press "Update profile"
And I follow "My badges"
Then I should see "Profile Badge"
......@@ -47,22 +47,22 @@ Feature: Award badges
And I expand "Site administration" node
And I expand "Badges" node
And I follow "Add a new badge"
And I fill the moodle form with:
And I set the following fields to these values:
| Name | Site Badge |
| Description | Site badge description |
| issuername | Tester of site badge |
And I upload "badges/tests/behat/badge.png" file to "Image" filemanager
And I press "Create badge"
And I select "Manual issue by role" from "type"
And I check "Teacher"
And I set the field "type" to "Manual issue by role"
And I set the field "Teacher" to "1"
And I press "Save"
And I press "Enable access"
And I press "Continue"