first commit

This commit is contained in:
CHIEFSOFT\ameye
2024-09-30 18:11:26 -04:00
commit e592ca6823
27270 changed files with 5002257 additions and 0 deletions
@@ -0,0 +1,104 @@
@core @core_course @core_customfield @javascript
Feature: Managers can manage categories for course custom fields
In order to have additional data on the course
As a manager
I need to create, edit, remove and sort custom field's categories
Scenario: Create a category for custom course fields
Given I log in as "admin"
When I navigate to "Courses > Default settings > Course custom fields" in site administration
And I press "Add a new category"
And I wait until the page is ready
Then I should see "Other fields" in the "#customfield_catlist" "css_element"
And I navigate to "Reports > Logs" in site administration
And I press "Get these logs"
Scenario: Edit a category name for custom course fields
Given the following "custom field categories" exist:
| name | component | area | itemid |
| Category for test | core_course | course | 0 |
And I log in as "admin"
And I navigate to "Courses > Default settings > Course custom fields" in site administration
And I set the field "Edit category name" in the "//div[contains(@class,'categoryinstance') and contains(.,'Category for test')]" "xpath_element" to "Good fields"
Then I should not see "Category for test" in the "#customfield_catlist" "css_element"
And "New value for Category for test" "field" should not exist
And I should see "Good fields" in the "#customfield_catlist" "css_element"
And I navigate to "Reports > Logs" in site administration
And I press "Get these logs"
Scenario: Delete a category for custom course fields
Given the following "custom field categories" exist:
| name | component | area | itemid |
| Category for test | core_course | course | 0 |
And the following "custom fields" exist:
| name | category | type | shortname |
| Field 1 | Category for test | text | f1 |
And I log in as "admin"
And I navigate to "Courses > Default settings > Course custom fields" in site administration
And I click on "[data-role='deletecategory']" "css_element"
And I click on "Yes" "button" in the "Confirm" "dialogue"
And I wait until the page is ready
And I wait until "Test category" "text" does not exist
Then I should not see "Test category" in the "#customfield_catlist" "css_element"
And I navigate to "Reports > Logs" in site administration
And I press "Get these logs"
Scenario: Move field in the course custom fields to another category
Given the following "custom field categories" exist:
| name | component | area | itemid |
| Category1 | core_course | course | 0 |
| Category2 | core_course | course | 0 |
| Category3 | core_course | course | 0 |
And the following "custom fields" exist:
| name | category | type | shortname |
| Field1 | Category1 | text | f1 |
| Field2 | Category2 | text | f2 |
When I log in as "admin"
And I navigate to "Courses > Default settings > Course custom fields" in site administration
Then "Field1" "text" should appear after "Category1" "text"
And "Category2" "text" should appear after "Field1" "text"
And "Field2" "text" should appear after "Category2" "text"
And "Category3" "text" should appear after "Field2" "text"
And I press "Move \"Field1\""
And I follow "To the top of category Category2"
And "Category2" "text" should appear after "Category1" "text"
And "Field1" "text" should appear after "Category2" "text"
And "Field2" "text" should appear after "Field1" "text"
And "Category3" "text" should appear after "Field2" "text"
And I navigate to "Courses > Default settings > Course custom fields" in site administration
And "Category2" "text" should appear after "Category1" "text"
And "Field1" "text" should appear after "Category2" "text"
And "Field2" "text" should appear after "Field1" "text"
And "Category3" "text" should appear after "Field2" "text"
And I press "Move \"Field1\""
And I follow "After field Field2"
And "Field1" "text" should appear after "Field2" "text"
Scenario: Reorder course custom field categories
Given the following "custom field categories" exist:
| name | component | area | itemid |
| Category1 | core_course | course | 0 |
| Category2 | core_course | course | 0 |
| Category3 | core_course | course | 0 |
And the following "custom fields" exist:
| name | category | type | shortname |
| Field1 | Category1 | text | f1 |
When I log in as "admin"
And I navigate to "Courses > Default settings > Course custom fields" in site administration
Then "Field1" "text" should appear after "Category1" "text"
And "Category2" "text" should appear after "Field1" "text"
And "Category3" "text" should appear after "Category2" "text"
And I press "Move \"Category2\""
And I follow "After \"Category3\""
And "Field1" "text" should appear after "Category1" "text"
And "Category3" "text" should appear after "Field1" "text"
And "Category2" "text" should appear after "Category3" "text"
And I navigate to "Courses > Default settings > Course custom fields" in site administration
And "Field1" "text" should appear after "Category1" "text"
And "Category3" "text" should appear after "Field1" "text"
And "Category2" "text" should appear after "Category3" "text"
And I press "Move \"Category2\""
And I follow "After \"Category1\""
And "Field1" "text" should appear after "Category1" "text"
And "Category2" "text" should appear after "Field1" "text"
And "Category3" "text" should appear after "Category2" "text"
@@ -0,0 +1,114 @@
@core @core_course @core_customfield @javascript
Feature: Teachers can edit course custom fields
In order to have additional data on the course
As a teacher
I need to edit data for custom fields
Background:
Given the following "custom field categories" exist:
| name | component | area | itemid |
| Category for test | core_course | course | 0 |
And the following "custom fields" exist:
| name | category | type | shortname | description | configdata |
| Field 1 | Category for test | text | f1 | d1 | |
| Field 2 | Category for test | textarea | f2 | d2 | |
| Field 3 | Category for test | checkbox | f3 | d3 | |
| Field 4 | Category for test | date | f4 | d4 | |
| Field 5 | Category for test | select | f5 | d5 | {"options":"a\nb\nc"} |
And the following "users" exist:
| username | firstname | lastname | email |
| teacher1 | Teacher | 1 | teacher1@example.com |
And the following "courses" exist:
| fullname | shortname | format |
| Course 1 | C1 | topics |
And the following "course enrolments" exist:
| user | course | role |
| teacher1 | C1 | editingteacher |
And the following "user private files" exist:
| user | filepath |
| admin | lib/tests/fixtures/gd-logo.png |
Scenario: Display custom fields on course edit form
When I log in as "teacher1"
And I am on "Course 1" course homepage
And I navigate to "Settings" in current page administration
And I expand all fieldsets
Then I should see "Category for test"
And I should see "Field 1"
And I should see "Field 2"
And I should see "Field 3"
And I should see "Field 4"
And I should see "Field 5"
And I log out
Scenario: Create a course with custom fields from the management interface
When I log in as "admin"
And I go to the courses management page
And I should see the "Categories" management page
And I click on category "Category 1" in the management interface
And I should see the "Course categories and courses" management page
And I click on "Create new course" "link" in the "#course-listing" "css_element"
And I set the following fields to these values:
| Course full name | Course 2 |
| Course short name | C2 |
| Field 1 | testcontent1 |
| Field 2 | testcontent2 |
| Field 3 | 1 |
| customfield_f4[enabled] | 1 |
| customfield_f4[day] | 1 |
| customfield_f4[month] | January |
| customfield_f4[year] | 2019 |
| Field 5 | b |
And I press "Save and display"
And I navigate to "Settings" in current page administration
And the following fields match these values:
| Course full name | Course 2 |
| Course short name | C2 |
| Field 1 | testcontent1 |
| Field 2 | testcontent2 |
| Field 3 | 1 |
| customfield_f4[day] | 1 |
| customfield_f4[month] | January |
| customfield_f4[year] | 2019 |
| Field 5 | b |
And I log out
@javascript @editor_tiny
Scenario: Use images in the custom field description
When I log in as "admin"
And I navigate to "Courses > Default settings > Course custom fields" in site administration
And I click on "Edit" "link" in the "Field 1" "table_row"
And I click on "Image" "button" in the "Description" "form_row"
And I click on "Browse repositories" "button"
And I click on "Private files" "link" in the ".fp-repo-area" "css_element"
And I click on "gd-logo.png" "link"
And I click on "Select this file" "button"
And I set the field "How would you describe this image to someone who can't see it?" to "Example"
And I click on "Save" "button" in the "Image details" "dialogue"
And I click on "Save changes" "button" in the "Updating Field 1" "dialogue"
And I log out
And I log in as "teacher1"
And I am on "Course 1" course homepage
And I navigate to "Settings" in current page administration
And I expand all fieldsets
Then the image at "//div[contains(@class, 'fitem')][contains(., 'Field 1')]/following-sibling::div[1]//img[contains(@src, 'pluginfile.php') and contains(@src, '/core_customfield/description/') and @alt='Example']" "xpath_element" should be identical to "lib/tests/fixtures/gd-logo.png"
And I log out
@javascript
Scenario: Custom field short name must be present and unique
When I log in as "admin"
And I navigate to "Courses > Default settings > Course custom fields" in site administration
And I click on "Add a new custom field" "link"
And I click on "Short text" "link"
And I set the following fields to these values:
| Name | Test field |
And I click on "Save changes" "button" in the "Adding a new Short text" "dialogue"
Then I should see "You must supply a value here" in the "Short name" "form_row"
And I set the field "Short name" to "short name"
And I click on "Save changes" "button" in the "Adding a new Short text" "dialogue"
Then I should see "The short name can only contain alphanumeric lowercase characters and underscores (_)." in the "Short name" "form_row"
And I set the field "Short name" to "f1"
And I click on "Save changes" "button" in the "Adding a new Short text" "dialogue"
Then I should see "Short name already exists" in the "Short name" "form_row"
And I click on "Cancel" "button" in the "Adding a new Short text" "dialogue"
And I log out
@@ -0,0 +1,58 @@
@core @core_course @core_customfield @javascript
Feature: Requiredness The course custom fields can be mandatory or not
In order to make users required to fill a custom field
As a manager
I can change the requiredness of the fields
Background:
Given the following "custom field categories" exist:
| name | component | area | itemid |
| Category for test | core_course | course | 0 |
Given the following "users" exist:
| username | firstname | lastname | email |
| teacher1 | Teacher | 1 | teacher1@example.com |
And the following "courses" exist:
| fullname | shortname | format |
| Course 1 | C1 | topics |
And the following "course enrolments" exist:
| user | course | role |
| teacher1 | C1 | editingteacher |
Scenario: A required course custom field must be filled when editing course settings
When I log in as "admin"
And I navigate to "Courses > Default settings > Course custom fields" in site administration
And I click on "Add a new custom field" "link"
And I click on "Short text" "link"
And I set the following fields to these values:
| Name | Test field |
| Short name | testfield |
| Required | Yes |
And I click on "Save changes" "button" in the "Adding a new Short text" "dialogue"
And I log out
And I log in as "teacher1"
And I am on "Course 1" course homepage
And I navigate to "Settings" in current page administration
And I press "Save and display"
Then I should see "You must supply a value here"
And I set the field "Test field" to "some value"
And I press "Save and display"
And I should not see "This field is required"
And I log out
Scenario: A course custom field that is not required may not be filled
When I log in as "admin"
And I navigate to "Courses > Default settings > Course custom fields" in site administration
And I click on "Add a new custom field" "link"
And I click on "Short text" "link"
And I set the following fields to these values:
| Name | Test field |
| Short name | testfield |
| Required | No |
And I click on "Save changes" "button" in the "Adding a new Short text" "dialogue"
And I log out
And I log in as "teacher1"
And I am on "Course 1" course homepage
And I navigate to "Settings" in current page administration
And I press "Save and display"
Then I should see "Course 1"
And I should see "New section"
@@ -0,0 +1,74 @@
@core @core_course @core_customfield @javascript
Feature: Uniqueness The course custom fields can be mandatory or not
In order to make users required to fill a custom field
As a manager
I can change the uniqueness of the fields
Background:
Given the following "custom field categories" exist:
| name | component | area | itemid |
| Category for test | core_course | course | 0 |
Given the following "users" exist:
| username | firstname | lastname | email |
| teacher1 | Teacher | 1 | teacher1@example.com |
And the following "courses" exist:
| fullname | shortname | format |
| Course 1 | C1 | topics |
| Course 2 | C2 | topics |
And the following "course enrolments" exist:
| user | course | role |
| teacher1 | C1 | editingteacher |
| teacher1 | C2 | editingteacher |
When I log in as "admin"
And I navigate to "Courses > Default settings > Course custom fields" in site administration
And I click on "Add a new custom field" "link"
And I click on "Short text" "link"
And I set the following fields to these values:
| Name | Test field |
| Short name | testfield |
| Unique data | Yes |
And I click on "Save changes" "button" in the "Adding a new Short text" "dialogue"
And I log out
Scenario: A course custom field with unique data must not allow same data in same field in different courses
When I log in as "teacher1"
And I am on "Course 1" course homepage
And I navigate to "Settings" in current page administration
And I set the following fields to these values:
| Test field | testcontent |
And I press "Save and display"
And I am on "Course 2" course homepage
And I navigate to "Settings" in current page administration
And I set the following fields to these values:
| Test field | testcontent |
And I press "Save and display"
Then I should see "This value is already used"
Scenario: A course custom field with unique data must not compare with itself
When I log in as "teacher1"
And I am on "Course 1" course homepage
And I navigate to "Settings" in current page administration
And I set the following fields to these values:
| Test field | testcontent |
And I press "Save and display"
And I am on "Course 1" course homepage
And I navigate to "Settings" in current page administration
And I set the following fields to these values:
| Test field | testcontent |
And I press "Save and display"
Then I should not see "This value is already used"
And I should see "New section"
Scenario: A course custom field with unique data must allow empty data
When I log in as "teacher1"
And I am on "Course 1" course homepage
And I navigate to "Settings" in current page administration
And I set the following fields to these values:
| Test field | |
And I press "Save and display"
And I am on "Course 2" course homepage
And I navigate to "Settings" in current page administration
And I set the following fields to these values:
| Test field | |
And I press "Save and display"
Then I should not see "This value is already used"