░▒▓████████████████████████████████▓▒░ ░▒▓█ ▓▒░ ░▒▓█ ~ S W A M P ~ ▓▒░ ░▒▓█ ▓▒░ ░▒▓████████████████████████████████▓▒░
pplmvsvm
LOCATION:
/var/www/moodle/public/ai/tests/behat
☗ ROOT
↻ REFRESH
✎ CARVE FLESH
EDITING: ai_usage_report.feature
@report @core_ai Feature: AI usage report displays recorded AI data In order to view AI usage data As a manager or admin I can access the AI usage report Background: Given the following "users" exist: | username | firstname | lastname | email | | manager1 | Manager | One | manager1@example.com | | student1 | Student | One | student1@example.com | | student2 | Student | Two | student2@example.com | And the following "role assigns" exist: | user | role | contextlevel | reference | | manager1 | manager | System | | And the following "core_ai > ai providers" exist: | provider | name | enabled | apikey | orgid | | aiprovider_openai | OpenAI API test | 1 | 123 | abc | And the following "core_ai > ai actions" exist: | actionname | user | success | provider | contextid | prompttokens | completiontokens | | generate_text | student1 | 1 | aiprovider_openai | 1 | 22 | 33 | | summarise_text | student1 | 0 | aiprovider_openai | 1 | | | | explain_text | student1 | 1 | aiprovider_openai | 1 | 44 | 55 | | generate_image | student2 | 1 | aiprovider_azureai | 1 | | | Scenario: Managers can view the AI usage report Given I am logged in as "manager1" When I navigate to "Reports > AI reports > AI usage" in site administration Then the following should exist in the "AI usage" table: | Action | First name | Provider | Success | Prompt tokens | Completion tokens | | Generate text | Student One | OpenAI API provider | Yes | 22 | 33 | | Summarise text | Student One | OpenAI API provider | No | | | | Explain text | Student One | OpenAI API provider | Yes | 44 | 55 | | Generate image | Student Two | Azure AI API provider | Yes | | | @javascript Scenario: Managers can filter the AI usage report Given I am logged in as "manager1" When I navigate to "Reports > AI reports > AI usage" in site administration And I click on "Filters" "button" And I set the field "Provider value" in the "Provider" "core_reportbuilder > Filter" to "OpenAI API provider" And I click on "Apply" "button" in the "[data-region='report-filters']" "css_element" Then the following should exist in the "AI usage" table: | Action | First name | Provider | Success | Prompt tokens | Completion tokens | | Generate text | Student One | OpenAI API provider | Yes | 22 | 33 | | Summarise text | Student One | OpenAI API provider | No | | | | Explain text | Student One | OpenAI API provider | Yes | 44 | 55 | And I should not see "Azure AI API provider" in the "AI usage" "table" And I set the following fields in the "Action" "core_reportbuilder > Filter" to these values: | Action operator | Is equal to | | Action value | Generate text | And I click on "Apply" "button" in the "[data-region='report-filters']" "css_element" And the following should exist in the "AI usage" table: | Action | First name | Provider | Success | Prompt tokens | Completion tokens | | Generate text | Student One | OpenAI API provider | Yes | 22 | 33 | And I should not see "Summarise text" in the "AI usage" "table" And I should not see "Azure AI API Provider" in the "AI usage" "table"
CANCEL
Name
Type
Size
Modified
Actions
↩ ..
DIR
—
—
📄 admin.feature
FEATURE
11 KB
2026-02-11 01:44
EDIT
📄 ai_usage_report.feature
FEATURE
3.8 KB
2026-02-11 01:44
EDIT
📄 behat_core_ai.php
PHP
3.6 KB
2026-02-11 01:44
EDIT
📄 reports.feature
FEATURE
3.2 KB
2026-02-11 01:44
EDIT