AutorÃa | Ultima modificación | Ver Log |
@editor @editor_tiny @tiny_aiplacementFeature: Generate image using AIIn order to generate image using AI, as a teacher, I need to be able to use the AI image generation feature in the TinyMCE editorBackground:Given the following "users" exist:| username | firstname | lastname | email || teacher1 | Teacher | 1 | t1@example.com || teacher2 | Teacher | 2 | t2@example.com |And the following "courses" exist:| fullname | shortname | format || Course 1 | C1 | topics || Course 2 | C2 | topics |And the following "roles" exist:| name | shortname | description | archetype || Custom editing teacher | custom1 | My custom role 1 | editingteacher || Custom teacher | custom2 | My custom role 2 | editingteacher |And the following "course enrolments" exist:| user | course | role || teacher1 | C1 | custom1 || teacher2 | C1 | custom2 || teacher1 | C2 | editingteacher |And the following "activities" exist:| activity | name | intro | introformat | course | content | contentformat | idnumber || page | PageName1 | PageDesc1 | 1 | C1 | PageContent | 1 | 1 || page | PageName2 | PageDesc2 | 1 | C2 | PageContent | 1 | 2 |And the following "permission overrides" exist:| capability | permission | role | contextlevel | reference || aiplacement/editor:generate_text | Prohibit | user | System | || aiplacement/editor:generate_image | Prohibit | custom2 | Course | C1 |And the following "core_ai > ai providers" exist:|provider | name | enabled | apikey | orgid ||aiprovider_openai | openai | 1 | 123 | abc |And I enable "editor" "aiplacement" plugin@javascriptScenario: Image generation using AI is not available if placement is not enabledGiven I disable "editor" "aiplacement" pluginWhen I am on the "PageName2" "page activity" page logged in as teacher1And I navigate to "Settings" in current page administrationThen "AI generate image" button should not exist in the "Description" TinyMCE editorAnd I enable "editor" "aiplacement" pluginAnd I am on the "PageName2" "page activity" page logged in as teacher1And I navigate to "Settings" in current page administrationAnd "AI generate image" button should exist in the "Description" TinyMCE editor@javascriptScenario: Image generation using AI is not available if provider is not enabledGiven I "disable" the ai provider with name "openai"When I am on the "PageName2" "page activity" page logged in as teacher1And I navigate to "Settings" in current page administrationThen "AI generate image" button should not exist in the "Description" TinyMCE editorAnd I "enable" the ai provider with name "openai"And I am on the "PageName2" "page activity" page logged in as teacher1And I navigate to "Settings" in current page administrationAnd "AI generate image" button should exist in the "Description" TinyMCE editor@javascriptScenario: Image generation using AI is not available if provider action is not enabledGiven I set the following action configuration for ai provider with name "openai":| action | enabled || generate_image | 0 |When I am on the "PageName2" "page activity" page logged in as teacher1And I navigate to "Settings" in current page administrationThen "AI generate image" button should not exist in the "Description" TinyMCE editorAnd I set the following action configuration for ai provider with name "openai":| action | enabled || generate_image | 1 |And I am on the "PageName2" "page activity" page logged in as teacher1And I navigate to "Settings" in current page administrationAnd "AI generate image" button should exist in the "Description" TinyMCE editor@javascriptScenario: Image generation using AI is not available if placement action is not enabledGiven the following config values are set as admin:| generate_image | | aiplacement_editor |When I am on the "PageName2" "page activity" page logged in as teacher1And I navigate to "Settings" in current page administrationThen "AI generate image" button should not exist in the "Description" TinyMCE editorAnd the following config values are set as admin:| generate_image | 1 | aiplacement_editor |And I am on the "PageName2" "page activity" page logged in as teacher1And I navigate to "Settings" in current page administrationAnd "AI generate image" button should exist in the "Description" TinyMCE editor@javascriptScenario: Image generation using AI is not available if provider action is not enabled and placement action is enabledGiven the following config values are set as admin:| generate_image | | aiplacement_editor |And I set the following action configuration for ai provider with name "openai":| action | enabled || generate_image | 0 |When I am on the "PageName2" "page activity" page logged in as teacher1And I navigate to "Settings" in current page administrationThen "AI generate image" button should not exist in the "Description" TinyMCE editorAnd the following config values are set as admin:| generate_image | 1 | aiplacement_editor |And I am on the "PageName2" "page activity" page logged in as teacher1And I navigate to "Settings" in current page administrationAnd "AI generate image" button should not exist in the "Description" TinyMCE editorAnd I set the following action configuration for ai provider with name "openai":| action | enabled || generate_image | 1 |And I am on the "PageName2" "page activity" page logged in as teacher1And I navigate to "Settings" in current page administrationAnd "AI generate image" button should exist in the "Description" TinyMCE editor@javascriptScenario: Image generation using AI is not available if the user does not have permissionGiven I am on the "PageName1" "page activity" page logged in as teacher2When I navigate to "Settings" in current page administrationThen "AI generate image" button should not exist in the "Description" TinyMCE editorAnd I am on the "PageName1" "page activity" page logged in as teacher1And I navigate to "Settings" in current page administrationAnd "AI generate image" button should exist in the "Description" TinyMCE editorAnd I click on the "AI generate image" button for the "Description" TinyMCE editorAnd I should see "Welcome to the new AI feature!" in the "AI usage policy" "dialogue"And I click on "Accept and continue" "button" in the "AI usage policy" "dialogue"And I should see "Describe the image you want AI to create"