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,60 @@
@core @core_question @core_customfield @qbank_customfields @javascript
Feature: A teacher can edit question with custom fields
In order to improve my questions
As a teacher
I need to be able to edit questions and add extra metadata via custom fields
Background:
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 | weeks |
And the following "course enrolments" exist:
| user | course | role |
| teacher1 | C1 | editingteacher |
And the following "custom field categories" exist:
| name | component | area | itemid |
| Category for test | qbank_customfields | question | 0 |
And the following "custom fields" exist:
| name | category | type | shortname |
| Field 1 | Category for test | text | f1 |
And the following "activity" exists:
| activity | quiz |
| course | C1 |
| idnumber | 00001 |
| name | Test quiz name |
| intro | Test quiz description |
| section | 1 |
| grade | 10 |
And I log in as "teacher1"
And I am on "Course 1" course homepage with editing mode on
And I add a "True/False" question to the "Test quiz name" quiz with:
| Question name | First question |
| Question text | Answer the first question |
| General feedback | Thank you, this is the general feedback |
| Correct answer | False |
| Feedback for the response 'True'. | So you think it is true |
| Feedback for the response 'False'. | So you think it is false |
And I am on the "Test quiz name" "mod_quiz > question bank" page
Scenario: Edit a previously created question and see the custom field in the overview table and in the question preview.
When I am on the "First question" "core_question > edit" page
Then I should see "Category for test"
And I expand all fieldsets
And I should see "Field 1"
And I set the following fields to these values:
| Question name | First question edited |
| Field 1 | custom field text |
And I press "id_submitbutton"
And I should see "First question"
And I should see "custom field text"
And I am on the "First question edited" "core_question > preview" page
And I should see "Field 1"
And I should see "custom field text"
Scenario: Preview a previously created question with custom fields set with empty values
When I am on the "First question" "core_question > preview" page
Then I should see "Field 1"
And I should not see "custom field text"
@@ -0,0 +1,98 @@
@core @core_question @core_customfield @qbank_customfields @javascript
Feature: Site administrators can manage categories for question custom fields
In order to have additional data in questions
As a site site administrator
I need to create, edit, remove and sort question custom field categories
Scenario: Create a category for custom question fields
Given I log in as "admin"
When I navigate to "Plugins > Question bank plugins > Question 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"
Scenario: Edit a category name for custom question fields
Given the following "custom field categories" exist:
| name | component | area | itemid |
| Category for test | qbank_customfields | question | 0 |
And I log in as "admin"
And I navigate to "Plugins > Question bank plugins > Question 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"
Scenario: Delete a category for custom question fields
Given the following "custom field categories" exist:
| name | component | area | itemid |
| Category for test | qbank_customfields | question | 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 "Plugins > Question bank plugins > Question 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"
Scenario: Move field in the question custom fields to another category
Given the following "custom field categories" exist:
| name | component | area | itemid |
| Category1 | qbank_customfields | question | 0 |
| Category2 | qbank_customfields | question | 0 |
| Category3 | qbank_customfields | question | 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 "Plugins > Question bank plugins > Question 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 "Plugins > Question bank plugins > Question 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 question custom field categories
Given the following "custom field categories" exist:
| name | component | area | itemid |
| Category1 | qbank_customfields | question | 0 |
| Category2 | qbank_customfields | question | 0 |
| Category3 | qbank_customfields | question | 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 "Plugins > Question bank plugins > Question 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 "Plugins > Question bank plugins > Question 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,65 @@
@core @core_quiz @core_customfield @qbank_customfields @javascript
Feature: The visibility of question custom fields control where they are displayed
In order to display custom fields in a quiz
Background:
Given the following "users" exist:
| username | firstname | lastname | email |
| teacher1 | Terry1 | Teacher1 | teacher1@example.com |
And the following "courses" exist:
| fullname | shortname | format |
| Course 1 | C1 | weeks |
And the following "course enrolments" exist:
| user | course | role |
| teacher1 | C1 | editingteacher |
And the following "custom field categories" exist:
| name | component | area | itemid |
| Category for test | qbank_customfields | question | 0 |
And the following "custom fields" exist:
| name | category | type | shortname | configdata |
| Field 1 | Category for test | text | f1 | {"visibility":"2"} |
| Field 2 | Category for test | text | f2 | {"visibility":"2"} |
| Field 3 | Category for test | text | f3 | {"visibility":"2","defaultvalue":"secret"} |
And the following "activity" exists:
| activity | quiz |
| course | C1 |
| idnumber | 00001 |
| name | Test quiz name |
| intro | Test quiz description |
| section | 1 |
| grade | 10 |
When I log in as "teacher1"
And I am on "Course 1" course homepage with editing mode on
And I add a "True/False" question to the "Test quiz name" quiz with:
| Question name | First question |
| Question text | Answer the first question |
| General feedback | Thank you, this is the general feedback |
| Correct answer | False |
| Feedback for the response 'True'. | So you think it is true |
| Feedback for the response 'False'. | So you think it is false |
@javascript
Scenario: Display custom question fields to teachers based on their visibility.
When I am on the "First question" "core_question > edit" page
Then I should see "Category for test"
And I expand all fieldsets
And I should see "Field 1"
And I should see "Field 2"
And I should see "Field 3"
And I set the following fields to these values:
| Field 1 | custom field text one|
| Field 2 | custom field text two|
And I press "id_submitbutton"
And I should see "Field 1"
And I should see "custom field text one"
And I should see "Field 2"
And I should see "custom field text two"
And I should see "Field 3"
And I should see "secret"
And I choose "Preview" action for "First question" in the question bank
And I should see "Field 1"
And I should see "custom field text one"
And I should see "Field 2"
And I should see "custom field text two"
And I should see "Field 3"
And I should see "secret"