Add live search readiness and telemetry-off e2e coverage
This commit is contained in:
@@ -369,6 +369,77 @@ test.describe('Unified Search - Experience Quality UX', () => {
|
||||
expect(lastAction?.['source']).toBe('advisory_ai_chat');
|
||||
expect(lastAction?.['domain']).toBe('policy');
|
||||
});
|
||||
|
||||
test('keeps search, history, and AdvisoryAI handoff working when analytics endpoints are unavailable', async ({ page }) => {
|
||||
let analyticsAttempts = 0;
|
||||
|
||||
await page.route('**/api/v1/advisory-ai/search/analytics', async (route) => {
|
||||
analyticsAttempts += 1;
|
||||
return route.fulfill({
|
||||
status: 503,
|
||||
contentType: 'application/json',
|
||||
body: JSON.stringify({ error: 'telemetry-disabled' }),
|
||||
});
|
||||
});
|
||||
await page.route('**/api/v1/advisory-ai/search/feedback', async (route) =>
|
||||
route.fulfill({
|
||||
status: 503,
|
||||
contentType: 'application/json',
|
||||
body: JSON.stringify({ error: 'telemetry-disabled' }),
|
||||
}),
|
||||
);
|
||||
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: [
|
||||
{
|
||||
historyId: 'history-telemetry-off',
|
||||
query: 'critical findings',
|
||||
resultCount: 1,
|
||||
createdAt: '2026-03-07T11:05:00Z',
|
||||
},
|
||||
],
|
||||
}),
|
||||
});
|
||||
});
|
||||
|
||||
await mockSearchResponses(page, (query) =>
|
||||
query.includes('critical findings')
|
||||
? criticalFindingResponse
|
||||
: emptyResponse(query));
|
||||
await mockChatConversation(page, {
|
||||
content: 'Analytics can fail without blocking the search or assistant flow.',
|
||||
citations: [{ type: 'finding', path: 'CVE-2024-21626', verified: true }],
|
||||
groundingScore: 0.91,
|
||||
});
|
||||
|
||||
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);
|
||||
await expect(page.locator('.search__group').filter({ hasText: 'Recent' })).toContainText('critical findings');
|
||||
|
||||
await typeInSearch(page, 'critical findings');
|
||||
await waitForResults(page);
|
||||
await waitForEntityCards(page, 1);
|
||||
await expect(page.locator('[data-answer-status="grounded"]')).toBeVisible();
|
||||
await expect.poll(() => analyticsAttempts).toBeGreaterThan(0);
|
||||
|
||||
await page.locator('.search__chat-launcher').click();
|
||||
await expect(page.locator('.assistant-drawer')).toBeVisible({ timeout: 10_000 });
|
||||
|
||||
await searchInput.focus();
|
||||
await waitForResults(page);
|
||||
await expect(page.locator('.search__group').filter({ hasText: 'Recent' })).toContainText('critical findings');
|
||||
});
|
||||
});
|
||||
|
||||
async function mockSearchResponses(
|
||||
|
||||
Reference in New Issue
Block a user