mirror of
https://github.com/mudler/LocalAI.git
synced 2026-03-31 21:25:59 -04:00
First when sending errors over SSE we now clearly identify them as such instead of just sending the error string as a chat completion message. We use this in the UI to identify errors and link to them to the traces. Signed-off-by: Richard Palethorpe <io@richiejp.com>
42 lines
1.5 KiB
JavaScript
42 lines
1.5 KiB
JavaScript
import { test, expect } from '@playwright/test'
|
|
|
|
test.describe('Settings - Backend Logging', () => {
|
|
test.beforeEach(async ({ page }) => {
|
|
await page.goto('/app/settings')
|
|
// Wait for settings to load
|
|
await expect(page.locator('h3', { hasText: 'Tracing' })).toBeVisible({ timeout: 10_000 })
|
|
})
|
|
|
|
test('backend logging toggle is visible in tracing section', async ({ page }) => {
|
|
await expect(page.locator('text=Enable Backend Logging')).toBeVisible()
|
|
})
|
|
|
|
test('backend logging toggle can be toggled', async ({ page }) => {
|
|
// Find the checkbox associated with backend logging
|
|
const section = page.locator('div', { has: page.locator('text=Enable Backend Logging') })
|
|
const checkbox = section.locator('input[type="checkbox"]').last()
|
|
|
|
// Toggle on
|
|
const wasChecked = await checkbox.isChecked()
|
|
await checkbox.locator('..').click()
|
|
if (wasChecked) {
|
|
await expect(checkbox).not.toBeChecked()
|
|
} else {
|
|
await expect(checkbox).toBeChecked()
|
|
}
|
|
})
|
|
|
|
test('save shows toast', async ({ page }) => {
|
|
// Toggle a setting to enable the Save button (it's disabled when no changes)
|
|
const section = page.locator('div', { has: page.locator('text=Enable Backend Logging') })
|
|
const checkbox = section.locator('input[type="checkbox"]').last()
|
|
await checkbox.locator('..').click()
|
|
|
|
// Click save button
|
|
await page.locator('button', { hasText: /Save Changes/ }).click()
|
|
|
|
// Verify toast appears
|
|
await expect(page.locator('text=Settings saved successfully')).toBeVisible({ timeout: 5_000 })
|
|
})
|
|
})
|