Proyectos de Subversion Moodle

Rev

| Ultima modificación | Ver Log |

Rev Autor Línea Nro. Línea
1441 ariadna 1
@core @core_admin @core_ai @core_ai_admin
2
Feature: An administrator can manage AI subsystem settings
3
  In order to alter the user experience
4
  As an admin
5
  I can manage AI subsystem settings
6
 
7
  @javascript
8
  Scenario: An administrator can create AI provider plugin instances using JavaScript
9
    Given I am logged in as "admin"
10
    And I navigate to "AI > AI providers" in site administration
11
    And I should see "Nothing to display"
12
    When I click on "Create a new provider instance" "link"
13
    And I select "OpenAI API provider" from the "Choose AI provider plugin" singleselect
14
    And I set the following fields to these values:
15
        | Name for instance     | OpenAI API provider test|
16
        | OpenAI API key        | 123                     |
17
        | OpenAI organization ID| abc                     |
18
    And I click on "Create instance" "button"
19
    And I should see "OpenAI API provider test AI provider instance created"
20
    And I should see "OpenAI API provider test"
21
    And I click on "Create a new provider instance" "link"
22
    And I select "Azure AI API provider" from the "Choose AI provider plugin" singleselect
23
    And I set the following fields to these values:
24
        | Name for instance    | Azure AI provider test                         |
25
        | Azure AI API key     | 123                                            |
26
        | Azure AI API endpoint| https://api.cognitive.microsofttranslator.com/ |
27
    And I click on "Create instance" "button"
28
    And I should see "Azure AI provider test AI provider instance created"
29
    And I should see "Azure AI provider test"
30
 
31
  @javascript
32
  Scenario: An administrator can enable AI provider plugin instances using JavaScript
33
    Given the following "core_ai > ai providers" exist:
34
      |provider         | name             | enabled | apikey | orgid |
35
      |aiprovider_openai| OpenAI API test  | 0       | 123    | abc   |
36
    And the following "core_ai > ai providers" exist:
37
      |provider           | name             | enabled | apikey | endpoint                                       |
38
      |aiprovider_azureai | Azure AI API test| 0       | 123    | https://api.cognitive.microsofttranslator.com/ |
39
    And  I am logged in as "admin"
40
    And I navigate to "AI > AI providers" in site administration
41
    And I should see "OpenAI API test"
42
    And I should see "Azure AI API test"
43
    And I toggle the "Enable OpenAI API test" admin switch "on"
44
    And I should see "OpenAI API test enabled."
45
    And I toggle the "Enable Azure AI API test" admin switch "on"
46
    And I should see "Azure AI API test enabled."
47
    And I reload the page
48
    And I should see "Disable OpenAI API test"
49
    And I should see "Disable Azure AI API test"
50
    And I toggle the "Disable OpenAI API test" admin switch "off"
51
    And I should see "OpenAI API test disabled."
52
    And I toggle the "Disable Azure AI API test" admin switch "off"
53
    Then I should see "Azure AI API test disabled."
54
 
55
  @javascript
56
  Scenario: An administrator can configure AI provider plugin instance
57
  action settings using JavaScript
58
    Given the following "core_ai > ai providers" exist:
59
      |provider         | name             | enabled | apikey | orgid |
60
      |aiprovider_openai| OpenAI API test  | 0       | 123    | abc   |
61
    And  I am logged in as "admin"
62
    And I navigate to "AI > AI providers" in site administration
63
    And I click on the "Settings" link in the table row containing "OpenAI API test"
64
    And I should see "Configure provider instance"
65
    And I click on the "Settings" link in the table row containing "Generate text"
66
    And I should see "Generate text action settings"
67
    And I set the field "AI model" to "Custom"
68
    And I set the following fields to these values:
69
      | Custom model name | gpt-3                                               |
70
      | API endpoint      | https://api.openai.com/v1/engines/gpt-3/completions |
71
    And I click on "Save changes" "button"
72
    Then I should see "Generate text action settings updated"
73
 
74
  @javascript
75
  Scenario: An administrator can delete AI provider plugin instances using JavaScript
76
    Given the following "core_ai > ai providers" exist:
77
      |provider         | name             | enabled | apikey | orgid |
78
      |aiprovider_openai| OpenAI API test  | 0       | 123    | abc   |
79
    And I am logged in as "admin"
80
    And I navigate to "AI > AI providers" in site administration
81
    And I click on the "Delete" link in the table row containing "OpenAI API test"
82
    And "Delete AI provider instance" "dialogue" should be visible
83
    And I click on "Delete" "button" in the "Delete AI provider instance" "dialogue"
84
    Then I should see "OpenAI API test AI provider instance deleted"
85
 
86
  @javascript
87
  Scenario: An administrator can control the enabled state of AI placement plugins using JavaScript
88
    Given I am logged in as "admin"
89
    And I navigate to "AI > AI placements" in site administration
90
    When I toggle the "Enable Text editor placement" admin switch "on"
91
    And I should see "Text editor placement enabled."
92
    And I reload the page
93
    And I should see "Disable Text editor placement"
94
    And I toggle the "Disable Text editor placement" admin switch "off"
95
    Then I should see "Text editor placement disabled."
96
 
97
  @javascript
98
  Scenario: Placement actions should be available when an Administrator enables AI providers using JavaScript
99
    Given the following "core_ai > ai providers" exist:
100
      |provider         | name             | enabled | apikey | orgid |
101
      |aiprovider_openai| OpenAI API test  | 1       | 123    | abc   |
102
    And  I am logged in as "admin"
103
    And I navigate to "AI > AI placements" in site administration
104
    And I click on the "Settings" link in the table row containing "Text editor placement"
105
    Then I should not see "This action is unavailable."
106
 
107
  @javascript
108
  Scenario: Placement actions should not be available when an Administrator disables AI providers using JavaScript
109
    Given the following "core_ai > ai providers" exist:
110
      |provider         | name             | enabled | apikey | orgid |
111
      |aiprovider_openai| OpenAI API test  | 1       | 123    | abc   |
112
    And  I am logged in as "admin"
113
    And I navigate to "AI > AI providers" in site administration
114
    And I toggle the "Disable OpenAI API test" admin switch "off"
115
    And I navigate to "AI > AI placements" in site administration
116
    And I click on the "Settings" link in the table row containing "Text editor placement"
117
    And I should see "This action is unavailable." in the table row containing "Generate text"
118
    Then I should see "This action is unavailable." in the table row containing "Generate image"
119
 
120
  @javascript
121
  Scenario: Placement actions should not be available for enabled Providers when an Administrator disables an Action using JavaScript
122
    Given the following "core_ai > ai providers" exist:
123
      |provider         | name             | enabled | apikey | orgid |
124
      |aiprovider_openai| OpenAI API test  | 1       | 123    | abc   |
125
    And  I am logged in as "admin"
126
    And I navigate to "AI > AI providers" in site administration
127
    And I click on the "Settings" link in the table row containing "OpenAI API test"
128
    And I toggle the "Generate text" admin switch "off"
129
    And I navigate to "AI > AI placements" in site administration
130
    And I click on the "Settings" link in the table row containing "Text editor placement"
131
    And I should see "This action is unavailable." in the table row containing "Generate text"
132
    Then I should not see "This action is unavailable." in the table row containing "Generate image"
133
 
134
  @javascript
135
  Scenario: An administrator can control the enabled state of AI placement actions using JavaScript
136
    Given the following "core_ai > ai providers" exist:
137
      | provider          | name            | enabled | endpoint               |
138
      | aiprovider_ollama | Ollama API test | 1       | http://localhost:11434 |
139
    And I am logged in as "admin"
140
    And I navigate to "AI > AI placements" in site administration
141
    When I click on the "Settings" link in the table row containing "Text editor placement"
142
    Then I should see "Generate text" in the "flexible" "table"
143
    And I should see "Generate image" in the "flexible" "table"
144
    And I should not see "This action is unavailable. No AI providers are configured for this action." in the "Generate text" "table_row"
145
    And I should see "This action is unavailable. No AI providers are configured for this action." in the "Generate image" "table_row"
146
    And I toggle the "Generate text" admin switch "off"
147
    And I should see "Generate text disabled."