1441 |
ariadna |
1 |
@core_ai @aiplacement_courseassist
|
|
|
2 |
Feature: AI course assist features
|
|
|
3 |
In order to use AI course assist features
|
|
|
4 |
As a user
|
|
|
5 |
I need to access a course and choose the desired AI feature
|
|
|
6 |
|
|
|
7 |
Background:
|
|
|
8 |
Given the following "users" exist:
|
|
|
9 |
| username | firstname | lastname | email |
|
|
|
10 |
| teacher1 | Teacher | 1 | t1@example.com |
|
|
|
11 |
| teacher2 | Teacher | 2 | t2@example.com |
|
|
|
12 |
And the following "courses" exist:
|
|
|
13 |
| fullname | shortname | format |
|
|
|
14 |
| Course 1 | C1 | topics |
|
|
|
15 |
And the following "roles" exist:
|
|
|
16 |
| name | shortname | description | archetype |
|
|
|
17 |
| Custom editing teacher | custom1 | My custom role 1 | editingteacher |
|
|
|
18 |
| Custom teacher | custom2 | My custom role 2 | editingteacher |
|
|
|
19 |
And the following "course enrolments" exist:
|
|
|
20 |
| user | course | role |
|
|
|
21 |
| teacher1 | C1 | custom1 |
|
|
|
22 |
| teacher2 | C1 | custom2 |
|
|
|
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 |
And the following "permission overrides" exist:
|
|
|
27 |
| capability | permission | role | contextlevel | reference |
|
|
|
28 |
| aiplacement/courseassist:summarise_text | Prohibit | custom2 | Course | C1 |
|
|
|
29 |
And the following "core_ai > ai providers" exist:
|
|
|
30 |
| provider | name | enabled | apikey | orgid |
|
|
|
31 |
| aiprovider_openai | OpenAI API test | 1 | 123 | abc |
|
|
|
32 |
And the following config values are set as admin:
|
|
|
33 |
| enabled | 1 | aiplacement_courseassist |
|
|
|
34 |
|
|
|
35 |
Scenario: AI features dropdown is visible when more than one feature is enabled
|
|
|
36 |
When I am on the "PageName1" "page activity" page logged in as teacher1
|
|
|
37 |
Then "AI features" "button" should exist
|
|
|
38 |
# Check nested buttons exist too.
|
|
|
39 |
And "Summarise" "button" should exist
|
|
|
40 |
And "Explain" "button" should exist
|
|
|
41 |
|
|
|
42 |
Scenario: AI features dropdown is not visible when only one feature is enabled
|
|
|
43 |
Given I set the following action configuration for ai provider with name "OpenAI API test":
|
|
|
44 |
| action | enabled |
|
|
|
45 |
| explain_text | 0 |
|
|
|
46 |
| summarise_text | 1 |
|
|
|
47 |
When I am on the "PageName1" "page activity" page logged in as teacher1
|
|
|
48 |
Then "AI features" "button" should not exist
|
|
|
49 |
And "Explain" "button" should not exist
|
|
|
50 |
# Only the summarise button should exist.
|
|
|
51 |
And "Summarise" "button" should exist
|
|
|
52 |
|
|
|
53 |
Scenario: AI features are not available if placement is not enabled
|
|
|
54 |
Given the following config values are set as admin:
|
|
|
55 |
| enabled | | aiplacement_courseassist |
|
|
|
56 |
When I am on the "PageName1" "page activity" page logged in as teacher1
|
|
|
57 |
Then "AI features" "button" should not exist
|
|
|
58 |
|
|
|
59 |
Scenario: AI features are not available if provider action is not enabled
|
|
|
60 |
Given I set the following action configuration for ai provider with name "OpenAI API test":
|
|
|
61 |
| action | enabled |
|
|
|
62 |
| explain_text | 0 |
|
|
|
63 |
| summarise_text | 0 |
|
|
|
64 |
When I am on the "PageName1" "page activity" page logged in as teacher1
|
|
|
65 |
Then "AI features" "button" should not exist
|
|
|
66 |
|
|
|
67 |
Scenario: AI features are not available if placement action is not enabled
|
|
|
68 |
Given I set the following action configuration for ai provider with name "OpenAI API test":
|
|
|
69 |
| action | enabled |
|
|
|
70 |
| explain_text | 0 |
|
|
|
71 |
| summarise_text | 0 |
|
|
|
72 |
When I am on the "PageName1" "page activity" page logged in as teacher1
|
|
|
73 |
Then "AI features" "button" should not exist
|
|
|
74 |
|
|
|
75 |
Scenario: AI features are not available if the user does not have permission
|
|
|
76 |
When I am on the "PageName1" "page activity" page logged in as teacher2
|
|
|
77 |
Then "AI features" "button" should not exist
|
|
|
78 |
|
|
|
79 |
@javascript
|
|
|
80 |
Scenario: I can view the AI drawer contents using the AI features dropdown
|
|
|
81 |
Given I am on the "PageName1" "page activity" page logged in as teacher1
|
|
|
82 |
When I click on "AI features" "button"
|
|
|
83 |
And I click on "Summarise" "button"
|
|
|
84 |
Then I should see "Welcome to the new AI feature!" in the ".ai-drawer" "css_element"
|