Consolidate search-first shell UX

This commit is contained in:
master
2026-03-08 00:14:57 +02:00
parent f709d519ec
commit a6187c70b4
13 changed files with 222 additions and 41 deletions

View File

@@ -154,6 +154,7 @@ test.describe('Unified Search - Experience Quality UX', () => {
await page.locator('.search__chat-launcher').click();
await expect(page.locator('.assistant-drawer')).toBeVisible({ timeout: 10_000 });
await expect(page.locator('.header-title')).toContainText('Search assistant');
await expect(page.locator('app-global-search input[type="text"]')).toHaveValue('');
await expect.poll(() => capturedTurnBodies.length).toBeGreaterThan(0);
@@ -192,6 +193,54 @@ test.describe('Unified Search - Experience Quality UX', () => {
await waitForEntityCards(page, 1);
});
test('suppresses a starter chip after it executes to no results and keeps it out of history', async ({ page }) => {
await page.route('**/search/query**', async (route) => {
const request = route.request().postDataJSON() as Record<string, unknown>;
const query = String(request['q'] ?? '').toLowerCase();
const response = query.includes('critical findings')
? emptyResponse('critical findings')
: criticalFindingResponse;
return route.fulfill({
status: 200,
contentType: 'application/json',
body: JSON.stringify(response),
});
});
await page.route('**/api/v1/advisory-ai/search/history', async (route) => {
if (route.request().method() === 'DELETE') {
return route.fulfill({ status: 204, body: '' });
}
return route.fulfill({
status: 200,
contentType: 'application/json',
body: JSON.stringify({ entries: [] }),
});
});
await page.goto('/security/triage');
await expect(page.locator('aside.sidebar')).toBeVisible({ timeout: 15_000 });
const searchInput = page.locator('app-global-search input[type="text"]');
await searchInput.focus();
await waitForResults(page);
const failingChip = page.locator('[data-starter-kind]', { hasText: /critical findings/i }).first();
await expect(failingChip).toBeVisible();
await failingChip.click();
await waitForResults(page);
await expect(page.locator('.search__empty')).toContainText('No results found');
await searchInput.fill('');
await waitForResults(page);
await expect(page.locator('[data-starter-kind]', { hasText: /critical findings/i })).toHaveCount(0);
await expect(page.locator('.search__group').filter({ hasText: 'Recent' })).toHaveCount(0);
});
test('renders did-you-mean directly below the search bar and removes teaching controls', async ({ page }) => {
const capturedRequests: Array<Record<string, unknown>> = [];
await page.route('**/search/query**', async (route) => {
@@ -310,7 +359,7 @@ test.describe('Unified Search - Experience Quality UX', () => {
/current-page findings matched first/i,
);
await expect(page.locator('.search__scope-hint')).toHaveCount(0);
await expect(page.locator('[data-overflow-results]')).toContainText(/also worth checking/i);
await expect(page.locator('[data-overflow-results]')).toContainText(/also relevant elsewhere/i);
await expect(page.locator('[data-overflow-results]')).toContainText(/policy results remain relevant/i);
await expect(page.locator('[data-role="domain-filter"]')).toHaveCount(0);
await expect(page.locator('app-synthesis-panel')).toHaveCount(0);

View File

@@ -97,7 +97,7 @@ test.describe('Unified Search - Self-Serve Answer Panel', () => {
const answerPanel = page.locator('[data-answer-status="grounded"]');
await expect(answerPanel).toBeVisible();
await expect(answerPanel).toContainText('What we found');
await expect(answerPanel).toContainText('Best answer');
await expect(answerPanel).toContainText('A reachable critical finding is blocking the current workflow and policy review is warranted.');
await expect(answerPanel).toContainText('Grounded in 2 source(s) across Findings, Policy.');
await expect(answerPanel.locator('[data-answer-citation]')).toContainText(['CVE-2024-21626 in api-gateway']);
@@ -156,6 +156,7 @@ test.describe('Unified Search - Self-Serve Answer Panel', () => {
await page.locator('[data-answer-action="ask-ai"]').click();
await expect(page.locator('.assistant-drawer')).toBeVisible({ timeout: 10_000 });
await expect(page.locator('.header-title')).toContainText('Search assistant');
await expect(page.locator('.chat-message.user .message-body').first()).toContainText(/Expand the grounded answer/i);
await expect(page.locator('.chat-message.user .message-body').first()).toContainText(/critical findings/i);
await expect.poll(() => capturedTurnBodies.length).toBeGreaterThan(0);