Files
supabase/e2e/studio/features/logs.spec.ts
Jordi Enric a10bc9a88a feat(unified-logs): compact toggle banner and ArrowDown selects first log (#46812)
Visual cleanup of the Logs sidebar (unified logs):

- Restyle the "Go back to old logs" and "Try Unified Logs" banners as
full-bleed bordered strips (no card), with an icon-only switch-back
button and a tooltip
- Add a "Beta" badge next to the "Logs" sidebar title
- Rename the product from "Logs & Analytics" to "Logs"

<!-- This is an auto-generated comment: release notes by coderabbit.ai
-->
## Summary by CodeRabbit

* **New Features**
* Added Unified Logs banner with “Try Unified Logs” and “More
information” actions, plus a “Go back to old logs” utility layout.
  * Show a **“Beta”** badge for Unified Logs eligibility.

* **UX Updates**
* Updated the Logs experience to consistently display under the
**“Logs”** product layout.

* **Tests / Documentation**
* Updated end-to-end checks and examples to expect the **“Logs”**
heading text exactly.
<!-- end of auto-generated comment: release notes by coderabbit.ai -->

---------

Co-authored-by: Claude Opus 4.8 <noreply@anthropic.com>
Co-authored-by: kemal <hello@kemal.earth>
2026-06-16 10:50:52 +00:00

98 lines
2.5 KiB
TypeScript

import { expect } from '@playwright/test'
import { test } from '../utils/test.js'
import { toUrl } from '../utils/to-url.js'
const LOGS_PAGES = [
{ label: 'API Gateway', route: 'edge-logs' },
{ label: 'Postgres', route: 'postgres-logs' },
]
const mockAPILogs = {
error: null,
result: [
{
id: 'uuid-1',
timestamp: 1713200000000, // 15 Apr 18:53:20"
event_message: 'Random event message: uuid-1',
count: 123,
ok_count: 123,
error_count: 0,
warning_count: 20,
metadata: {
foo: 'bar',
request: {
url: 'https://example.com',
},
response: {
status: 200,
},
},
},
],
}
test.beforeEach(async ({ context }) => {
context.route(/.*logs\.all.*/, async (route) => {
await route.fulfill({
status: 200,
contentType: 'application/json',
body: JSON.stringify(mockAPILogs),
})
})
})
test.describe('Logs', () => {
for (const logPage of LOGS_PAGES) {
test(`${logPage.label} logs page`, async ({ page, ref }) => {
/**
* Navigates to Logs
*/
await page.goto(toUrl(`/project/${ref}/logs/${logPage.route}`))
await expect(page.getByRole('heading', { name: 'Logs', exact: true }), {
message: 'Logs heading should be visible',
}).toBeVisible()
/**
* Shows the logs table
*/
const logsTable = page.getByRole('table')
await expect(logsTable, {
message: 'Logs table should be visible',
}).toBeVisible()
/**
* Shows the logs data without errors
*/
await expect(page.getByText(mockAPILogs.result[0].event_message), {
message: 'Logs data should be visible',
}).toBeVisible()
/**
* Can select and view log details
*/
const gridcells = page.getByText('Random event message')
await expect(gridcells, {
message: 'Grid cell should be visible before clicking',
}).toBeVisible()
await gridcells.click()
const tabPanel = page.getByTestId('log-selection')
await expect(tabPanel, {
message: 'Log selection panel should be visible after clicking a log',
}).toBeVisible()
// Assert known fixed values instead of extracting text
await expect(tabPanel, {
message: 'Log selection should be visible',
}).toContainText('Random event message: uuid-1')
await expect(tabPanel.getByTestId('log-selection-id'), {
message: 'Log selection ID should be visible',
}).toContainText('uuid-1')
})
}
})