Proyectos de Subversion Moodle

Rev

| Ultima modificación | Ver Log |

Rev Autor Línea Nro. Línea
1441 ariadna 1
@editor @editor_tiny @tiny_aiplacement
2
Feature: Generate image using AI
3
  In order to generate image using AI, as a teacher, I need to be able to use the AI image 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
    And the following "permission overrides" exist:
28
      | capability                         | permission | role    | contextlevel | reference |
29
      | aiplacement/editor:generate_text  | Prohibit   | user    | System       |           |
30
      | aiplacement/editor:generate_image | 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
 
36
  @javascript
37
  Scenario: Image generation using AI is not available if placement is not enabled
38
    Given I disable "editor" "aiplacement" plugin
39
    When I am on the "PageName2" "page activity" page logged in as teacher1
40
    And I navigate to "Settings" in current page administration
41
    Then "AI generate image" button should not exist in the "Description" TinyMCE editor
42
    And I enable "editor" "aiplacement" plugin
43
    And I am on the "PageName2" "page activity" page logged in as teacher1
44
    And I navigate to "Settings" in current page administration
45
    And "AI generate image" button should exist in the "Description" TinyMCE editor
46
 
47
  @javascript
48
  Scenario: Image generation using AI is not available if provider is not enabled
49
    Given I "disable" the ai provider with name "openai"
50
    When I am on the "PageName2" "page activity" page logged in as teacher1
51
    And I navigate to "Settings" in current page administration
52
    Then "AI generate image" button should not exist in the "Description" TinyMCE editor
53
    And I "enable" the ai provider with name "openai"
54
    And I am on the "PageName2" "page activity" page logged in as teacher1
55
    And I navigate to "Settings" in current page administration
56
    And "AI generate image" button should exist in the "Description" TinyMCE editor
57
 
58
  @javascript
59
  Scenario: Image generation using AI is not available if provider action is not enabled
60
    Given I set the following action configuration for ai provider with name "openai":
61
      | action          | enabled |
62
      | generate_image  | 0       |
63
    When I am on the "PageName2" "page activity" page logged in as teacher1
64
    And I navigate to "Settings" in current page administration
65
    Then "AI generate image" button should not exist in the "Description" TinyMCE editor
66
    And I set the following action configuration for ai provider with name "openai":
67
      | action          | enabled |
68
      | generate_image  | 1       |
69
    And I am on the "PageName2" "page activity" page logged in as teacher1
70
    And I navigate to "Settings" in current page administration
71
    And "AI generate image" button should exist in the "Description" TinyMCE editor
72
 
73
  @javascript
74
  Scenario: Image generation using AI is not available if placement action is not enabled
75
    Given the following config values are set as admin:
76
      | generate_image |  | aiplacement_editor |
77
    When I am on the "PageName2" "page activity" page logged in as teacher1
78
    And I navigate to "Settings" in current page administration
79
    Then "AI generate image" button should not exist in the "Description" TinyMCE editor
80
    And the following config values are set as admin:
81
      | generate_image | 1 | aiplacement_editor |
82
    And I am on the "PageName2" "page activity" page logged in as teacher1
83
    And I navigate to "Settings" in current page administration
84
    And "AI generate image" button should exist in the "Description" TinyMCE editor
85
 
86
  @javascript
87
  Scenario: Image generation using AI is not available if provider action is not enabled and placement action is enabled
88
    Given the following config values are set as admin:
89
      | generate_image |  | aiplacement_editor |
90
    And I set the following action configuration for ai provider with name "openai":
91
      | action          | enabled |
92
      | generate_image  | 0       |
93
    When I am on the "PageName2" "page activity" page logged in as teacher1
94
    And I navigate to "Settings" in current page administration
95
    Then "AI generate image" button should not exist in the "Description" TinyMCE editor
96
    And the following config values are set as admin:
97
      | generate_image | 1 | aiplacement_editor |
98
    And I am on the "PageName2" "page activity" page logged in as teacher1
99
    And I navigate to "Settings" in current page administration
100
    And "AI generate image" button should not exist in the "Description" TinyMCE editor
101
    And I set the following action configuration for ai provider with name "openai":
102
      | action          | enabled |
103
      | generate_image  | 1       |
104
    And I am on the "PageName2" "page activity" page logged in as teacher1
105
    And I navigate to "Settings" in current page administration
106
    And "AI generate image" button should exist in the "Description" TinyMCE editor
107
 
108
  @javascript
109
  Scenario: Image generation using AI is not available if the user does not have permission
110
    Given I am on the "PageName1" "page activity" page logged in as teacher2
111
    When I navigate to "Settings" in current page administration
112
    Then "AI generate image" button should not exist in the "Description" TinyMCE editor
113
    And I am on the "PageName1" "page activity" page logged in as teacher1
114
    And I navigate to "Settings" in current page administration
115
    And "AI generate image" button should exist in the "Description" TinyMCE editor
116
    And I click on the "AI generate image" button for the "Description" TinyMCE editor
117
    And I should see "Welcome to the new AI feature!" in the "AI usage policy" "dialogue"
118
    And I click on "Accept and continue" "button" in the "AI usage policy" "dialogue"
119
    And I should see "Describe the image you want AI to create"