Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
30 changes: 23 additions & 7 deletions browser-tests/tests/traces.test.ts
Original file line number Diff line number Diff line change
@@ -1,22 +1,38 @@
import { expect, sendMessage, test } from '../fixtures';

test.describe('Traces', () => {
test('traces panel shows trace after invocation', async ({ page }) => {
test('traces panel shows span tree after invocation', async ({ page }) => {
await page.goto('/');

await sendMessage(page, 'Say hello');

await page.getByRole('tab', { name: 'Traces' }).click();
const resourcePanel = page.getByTestId('resource-panel');
await expect(resourcePanel).toBeVisible({ timeout: 10_000 });

const traceList = page.getByTestId('trace-list');
const tracesTab = resourcePanel.getByRole('tab', { name: 'Traces' });
await tracesTab.click();

// Wait for trace list to populate
const traceList = resourcePanel.getByTestId('traces-trace-list');
await expect(traceList).toBeVisible({ timeout: 30_000 });

// Click the first trace
const traceButton = traceList.getByRole('button').first();
await expect(traceButton).toBeVisible({ timeout: 30_000 });

await expect(traceButton).toBeVisible({ timeout: 10_000 });
await traceButton.click();

const spanRow = page.locator('[role="button"]').filter({ hasText: /.+/ });
await expect(spanRow.first()).toBeVisible({ timeout: 10_000 });
// Verify span tree renders
const spanTree = resourcePanel.getByTestId('traces-span-tree');
await expect(spanTree).toBeVisible({ timeout: 10_000 });

// Verify tree has at least one span row with a name
const spanRows = spanTree.getByRole('button');
await expect(spanRows.first()).toBeVisible();

// Click a span to open log panel
await spanRows.first().click();

const logPanel = resourcePanel.getByTestId('traces-log-panel');
await expect(logPanel).toBeVisible({ timeout: 5_000 });
});
});
18 changes: 18 additions & 0 deletions docs/TESTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -415,6 +415,24 @@ Test configuration is in `vitest.config.ts` using Vitest projects:
- Test timeout: 120 seconds
- Hook timeout: 120 seconds

## Troubleshooting

### `Cannot find module '@playwright/test'`

Playwright is not installed. Run:

```bash
npm install
```

### `browserType.launch: Executable doesn't exist` (Playwright browsers)

Playwright browsers need to be downloaded after install. Run:

```bash
npx playwright install chromium
```

## Integration Tests

Integration tests require:
Expand Down
Loading