1441 |
ariadna |
1 |
@editor @editor_tiny @tiny_aiplacement
|
|
|
2 |
Feature: Generate text using AI
|
|
|
3 |
In order to generate text using AI, as a teacher, I need to be able to use the AI text generation feature in the TinyMCE editor
|
|
|
4 |
|
|
|
5 |
Background:
|
|
|
6 |
Given the following "users" exist:
|
|
|
7 |
| username | firstname | lastname | email |
|
|
|
8 |
| teacher1 | Teacher | 1 | t1@example.com |
|
|
|
9 |
| teacher2 | Teacher | 2 | t2@example.com |
|
|
|
10 |
And the following "courses" exist:
|
|
|
11 |
| fullname | shortname | format |
|
|
|
12 |
| Course 1 | C1 | topics |
|
|
|
13 |
| Course 2 | C2 | topics |
|
|
|
14 |
And the following "roles" exist:
|
|
|
15 |
| name | shortname | description | archetype |
|
|
|
16 |
| Custom editing teacher | custom1 | My custom role 1 | editingteacher |
|
|
|
17 |
| Custom teacher | custom2 | My custom role 2 | editingteacher |
|
|
|
18 |
And the following "course enrolments" exist:
|
|
|
19 |
| user | course | role |
|
|
|
20 |
| teacher1 | C1 | custom1 |
|
|
|
21 |
| teacher2 | C1 | custom2 |
|
|
|
22 |
| teacher1 | C2 | editingteacher |
|
|
|
23 |
And the following "activities" exist:
|
|
|
24 |
| activity | name | intro | introformat | course | content | contentformat | idnumber |
|
|
|
25 |
| page | PageName1 | PageDesc1 | 1 | C1 | PageContent | 1 | 1 |
|
|
|
26 |
| page | PageName2 | PageDesc2 | 1 | C2 | PageContent | 1 | 2 |
|
|
|
27 |
Given the following "permission overrides" exist:
|
|
|
28 |
| capability | permission | role | contextlevel | reference |
|
|
|
29 |
| aiplacement/editor:generate_image | Prohibit | user | System | |
|
|
|
30 |
| aiplacement/editor:generate_text | Prohibit | custom2 | Course | C1 |
|
|
|
31 |
And the following "core_ai > ai providers" exist:
|
|
|
32 |
|provider | name | enabled | apikey | orgid |
|
|
|
33 |
|aiprovider_openai | openai | 1 | 123 | abc |
|
|
|
34 |
And I enable "editor" "aiplacement" plugin
|
|
|
35 |
And I log in as "admin"
|
|
|
36 |
|
|
|
37 |
@javascript
|
|
|
38 |
Scenario: Text generation using AI is not available if placement is not enabled
|
|
|
39 |
Given I disable "editor" "aiplacement" plugin
|
|
|
40 |
When I am on the "PageName2" "page activity" page logged in as teacher1
|
|
|
41 |
And I navigate to "Settings" in current page administration
|
|
|
42 |
Then "AI generate text" button should not exist in the "Description" TinyMCE editor
|
|
|
43 |
And I enable "editor" "aiplacement" plugin
|
|
|
44 |
And I am on the "PageName2" "page activity" page logged in as teacher1
|
|
|
45 |
And I navigate to "Settings" in current page administration
|
|
|
46 |
And "AI generate text" button should exist in the "Description" TinyMCE editor
|
|
|
47 |
|
|
|
48 |
@javascript
|
|
|
49 |
Scenario: Text generation using AI is not available if provider is not enabled
|
|
|
50 |
Given I "disable" the ai provider with name "openai"
|
|
|
51 |
When I am on the "PageName2" "page activity" page logged in as teacher1
|
|
|
52 |
And I navigate to "Settings" in current page administration
|
|
|
53 |
Then "AI generate text" button should not exist in the "Description" TinyMCE editor
|
|
|
54 |
And I "enable" the ai provider with name "openai"
|
|
|
55 |
And I am on the "PageName2" "page activity" page logged in as teacher1
|
|
|
56 |
And I navigate to "Settings" in current page administration
|
|
|
57 |
And "AI generate text" button should exist in the "Description" TinyMCE editor
|
|
|
58 |
|
|
|
59 |
@javascript
|
|
|
60 |
Scenario: Text generation using AI is not available if provider action is not enabled
|
|
|
61 |
Given I set the following action configuration for ai provider with name "openai":
|
|
|
62 |
| action | enabled |
|
|
|
63 |
| generate_text | 0 |
|
|
|
64 |
When I am on the "PageName2" "page activity" page logged in as teacher1
|
|
|
65 |
And I navigate to "Settings" in current page administration
|
|
|
66 |
Then "AI generate text" button should not exist in the "Description" TinyMCE editor
|
|
|
67 |
And I set the following action configuration for ai provider with name "openai":
|
|
|
68 |
| action | enabled |
|
|
|
69 |
| generate_text | 1 |
|
|
|
70 |
And I am on the "PageName2" "page activity" page logged in as teacher1
|
|
|
71 |
And I navigate to "Settings" in current page administration
|
|
|
72 |
And "AI generate text" button should exist in the "Description" TinyMCE editor
|
|
|
73 |
|
|
|
74 |
@javascript
|
|
|
75 |
Scenario: Text generation using AI is not available if placement action is not enabled
|
|
|
76 |
Given the following config values are set as admin:
|
|
|
77 |
| generate_text | | aiplacement_editor |
|
|
|
78 |
When I am on the "PageName2" "page activity" page logged in as teacher1
|
|
|
79 |
And I navigate to "Settings" in current page administration
|
|
|
80 |
Then "AI generate text" button should not exist in the "Description" TinyMCE editor
|
|
|
81 |
And the following config values are set as admin:
|
|
|
82 |
| generate_text | 1 | aiplacement_editor |
|
|
|
83 |
And I am on the "PageName2" "page activity" page logged in as teacher1
|
|
|
84 |
And I navigate to "Settings" in current page administration
|
|
|
85 |
And "AI generate text" button should exist in the "Description" TinyMCE editor
|
|
|
86 |
|
|
|
87 |
@javascript
|
|
|
88 |
Scenario: Text generation using AI is not available if provider action is not enabled and placement action is enabled
|
|
|
89 |
Given the following config values are set as admin:
|
|
|
90 |
| generate_text | | aiplacement_editor |
|
|
|
91 |
And I set the following action configuration for ai provider with name "openai":
|
|
|
92 |
| action | enabled |
|
|
|
93 |
| generate_text | 0 |
|
|
|
94 |
When I am on the "PageName2" "page activity" page logged in as teacher1
|
|
|
95 |
And I navigate to "Settings" in current page administration
|
|
|
96 |
Then "AI generate text" button should not exist in the "Description" TinyMCE editor
|
|
|
97 |
And the following config values are set as admin:
|
|
|
98 |
| generate_text | 1 | aiplacement_editor |
|
|
|
99 |
And I am on the "PageName2" "page activity" page logged in as teacher1
|
|
|
100 |
And I navigate to "Settings" in current page administration
|
|
|
101 |
And "AI generate text" button should not exist in the "Description" TinyMCE editor
|
|
|
102 |
And I set the following action configuration for ai provider with name "openai":
|
|
|
103 |
| action | enabled |
|
|
|
104 |
| generate_text | 1 |
|
|
|
105 |
And I am on the "PageName2" "page activity" page logged in as teacher1
|
|
|
106 |
And I navigate to "Settings" in current page administration
|
|
|
107 |
And "AI generate text" button should exist in the "Description" TinyMCE editor
|
|
|
108 |
|
|
|
109 |
@javascript
|
|
|
110 |
Scenario: Text generation using AI is not available if the user does not have permission
|
|
|
111 |
When I am on the "PageName1" "page activity" page logged in as teacher2
|
|
|
112 |
And I navigate to "Settings" in current page administration
|
|
|
113 |
Then "AI generate text" button should not exist in the "Description" TinyMCE editor
|
|
|
114 |
When I am on the "PageName1" "page activity" page logged in as teacher1
|
|
|
115 |
And I navigate to "Settings" in current page administration
|
|
|
116 |
And "AI generate text" button should exist in the "Description" TinyMCE editor
|
|
|
117 |
And I click on the "AI generate text" button for the "Description" TinyMCE editor
|
|
|
118 |
And I should see "Welcome to the new AI feature!" in the "AI usage policy" "dialogue"
|
|
|
119 |
And I click on "Accept and continue" "button" in the "AI usage policy" "dialogue"
|
|
|
120 |
And I should see "Describe the text you want AI to create"
|