MDL-76542 behat: create custom profile fields using data generators

This commit also adds a new test to verify the custom profile fields
works using the user interface.
This commit is contained in:
Simey Lameze 2022-12-07 10:35:05 +08:00
parent cb6dc699b8
commit 2158f5c2e6
2 changed files with 61 additions and 44 deletions

View File

@ -11,55 +11,22 @@ Feature: Custom profile fields should be visible and editable by those with the
And the following "course enrolments" exist:
| user | course | role |
| userwithinformation | C1 | student |
And the following config values are set as admin:
| registerauth | email |
And the following "custom profile fields" exist:
| datatype | shortname | name | signup | visible |
| text | notvisible_field | notvisible_field | 1 | 0 |
| text | uservisible_field | uservisible_field | 1 | 1 |
| text | everyonevisible_field | everyonevisible_field | 0 | 2 |
| text | teachervisible_field | teachervisible_field | 1 | 3 |
And I log in as "admin"
And I navigate to "Users > Accounts > User profile fields" in site administration
And I click on "Create a new profile field" "link"
And I click on "Text input" "link"
And I set the following fields to these values:
| Short name | notvisible_field |
| Name | notvisible_field |
| Display on signup page? | Yes |
| Who is this field visible to? | Not visible |
And I click on "Save changes" "button"
And I click on "Create a new profile field" "link"
And I click on "Text input" "link"
And I set the following fields to these values:
| Short name | uservisible_field |
| Name | uservisible_field |
| Display on signup page? | Yes |
| Who is this field visible to? | Visible to user |
And I click on "Save changes" "button"
And I click on "Create a new profile field" "link"
And I click on "Text input" "link"
And I set the following fields to these values:
| Short name | everyonevisible_field |
| Name | everyonevisible_field |
| Display on signup page? | No |
| Who is this field visible to? | Visible to everyone |
And I click on "Save changes" "button"
And I click on "Create a new profile field" "link"
And I click on "Text input" "link"
And I set the following fields to these values:
| Short name | teachervisible_field |
| Name | teachervisible_field |
| Display on signup page? | Yes |
| Who is this field visible to? | Visible to user, teachers and admins |
And I click on "Save changes" "button"
And I navigate to "Users > Accounts > Browse list of users" in site administration
And I click on ".icon[title=Edit]" "css_element" in the "userwithinformation@example.com" "table_row"
And I expand all fieldsets
And I set the field "notvisible_field" to "notvisible_field_information"
And I set the field "uservisible_field" to "uservisible_field_information"
And I set the field "everyonevisible_field" to "everyonevisible_field_information"
And I set the field "teachervisible_field" to "teachervisible_field_information"
And I set the following fields to these values:
| notvisible_field | notvisible_field_information |
| uservisible_field | uservisible_field_information |
| everyonevisible_field | everyonevisible_field_information |
| teachervisible_field | teachervisible_field_information |
And I click on "Update profile" "button"
And I log out

View File

@ -0,0 +1,50 @@
@core @core_user
Feature: Custom profile fields creation using UI
@javascript
Scenario Outline: Manual creation of basic custom profile fields
Given I log in as "admin"
And I navigate to "Users > Accounts > User profile fields" in site administration
And I click on "Create a new profile field" "link"
And I click on "<name>" "link"
And I set the following fields to these values:
| Short name | <shortname> |
| Name | <name> |
When I click on "Save changes" "button"
Then I should see "<name>"
Examples:
| shortname | name |
| checkbox | Checkbox |
| datetime | Date/Time |
| textarea | Text area |
| textinput | Text input |
@javascript
Scenario: Manual creation of drop-down menu custom profile field type
Given I log in as "admin"
And I navigate to "Users > Accounts > User profile fields" in site administration
And I click on "Create a new profile field" "link"
And I click on "Drop-down menu" "link"
And I set the following fields to these values:
| Short name | dropdownmenu |
| Name | Drop-down menu field |
And I set the field "Menu options (one per line)" to multiline:
"""
a
b
"""
When I click on "Save changes" "button"
Then I should see "Drop-down menu field"
@javascript
Scenario: Manual creation of social custom profile field type
Given I log in as "admin"
And I navigate to "Users > Accounts > User profile fields" in site administration
And I click on "Create a new profile field" "link"
And I click on "Social" "link"
And I set the following fields to these values:
| Network type | Web page |
| Short name | social |
When I click on "Save changes" "button"
Then I should see "Web page"