Skip to content

Commit a7ff138

Browse files
committed
fix: resolve retained UI bugs
1 parent 99c2b53 commit a7ff138

17 files changed

Lines changed: 272 additions & 14 deletions
3.35 MB
Binary file not shown.

‎e2e/quality-backlog.spec.ts‎

Lines changed: 107 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,107 @@
1+
import { expect, test } from '@playwright/test';
2+
import { setLocale, stubSupabaseSession } from './helpers/auth';
3+
4+
const locales = ['en', 'es', 'hu'] as const;
5+
const titledRoutes = ['generate', 'attack', 'brainstorm', 'factoids', 'ask'] as const;
6+
7+
test('Sources does not show the stale consultation date', async ({ page }) => {
8+
await page.goto('/expocit/sources');
9+
10+
await expect(page.getByRole('heading', { name: 'Sources' })).toBeVisible();
11+
await expect(page.getByText(/Consulta: 8 de marzo de 2026/i)).toHaveCount(0);
12+
});
13+
14+
for (const locale of locales) {
15+
test(`navigation and page titles agree in ${locale}`, async ({ page }, testInfo) => {
16+
await setLocale(page, locale);
17+
await stubSupabaseSession(page);
18+
await page.addInitScript(() => {
19+
window.localStorage.setItem('debate-trainer-onboarding', JSON.stringify({
20+
state: { hasCompletedOnboarding: true, isTourRunning: false },
21+
version: 0,
22+
}));
23+
});
24+
await page.goto('/app');
25+
26+
for (const route of titledRoutes) {
27+
const desktopLink = page.locator(`[data-tour="nav-${route}"]`).first();
28+
const label = await desktopLink.getAttribute('aria-label');
29+
expect(label).toBeTruthy();
30+
if (testInfo.project.name === 'mobile-chromium') {
31+
await page.locator('header button.lg\\:hidden[aria-expanded]').click();
32+
await page.getByRole('navigation', { name: 'Mobile navigation' })
33+
.getByRole('link')
34+
.filter({ hasText: label! })
35+
.first()
36+
.click();
37+
} else {
38+
await desktopLink.click();
39+
}
40+
await expect(page).toHaveURL(new RegExp(`/app/${route}$`));
41+
await expect(page.getByRole('heading', { level: 1, name: label!, exact: true }).last()).toBeVisible();
42+
}
43+
});
44+
}
45+
46+
test('Factoids names the save action with its claim', async ({ page }) => {
47+
await setLocale(page, 'en');
48+
await stubSupabaseSession(page);
49+
await page.route('**/functions/v1/ai', async (route) => {
50+
await route.fulfill({
51+
status: 200,
52+
contentType: 'application/json',
53+
body: JSON.stringify({
54+
output: {
55+
factoids: [{
56+
id: 'fact-1',
57+
shortClaim: 'Solar costs fell by 42 percent',
58+
keyFigure: '42%',
59+
context: 'The official report compares the relevant period.',
60+
limitations: 'The result depends on the measured market segment.',
61+
citation: {
62+
title: 'Official energy statistics',
63+
publisher: 'Department of Energy',
64+
date: '2024',
65+
url: 'https://energy.gov/reports/solar-costs-2024',
66+
verified: 'verified',
67+
},
68+
howToUse: 'Use this as a bounded cost trend.',
69+
relevanceScore: 92,
70+
}],
71+
searchSuggestions: [],
72+
warnings: [],
73+
verificationStatus: 'complete',
74+
},
75+
}),
76+
});
77+
});
78+
79+
await page.goto('/app/factoids');
80+
await page.getByRole('textbox', { name: /statement/i }).fill('Solar energy costs are falling');
81+
await page.getByRole('button', { name: /find factoids/i }).click();
82+
83+
await expect(page.getByRole('button', {
84+
name: 'Save Solar costs fell by 42 percent to library',
85+
})).toBeVisible();
86+
});
87+
88+
test('Flowchart confirms selected-node deletion and reports success', async ({ page }, testInfo) => {
89+
await setLocale(page, 'en');
90+
await stubSupabaseSession(page);
91+
await page.goto('/app/flowchart');
92+
93+
await page.getByText('Argument 1', { exact: true }).click();
94+
await page.getByRole('button', { name: 'Delete' }).last().click();
95+
await expect(page.getByRole('alertdialog', { name: 'Delete node?' })).toBeVisible();
96+
const confirm = page.getByRole('button', { name: 'Delete node' });
97+
if (testInfo.project.name === 'mobile-chromium') {
98+
const box = await confirm.boundingBox();
99+
expect(box).not.toBeNull();
100+
await page.touchscreen.tap(box!.x + box!.width / 2, box!.y + box!.height / 2);
101+
} else {
102+
await confirm.click();
103+
}
104+
105+
await expect(page.getByText('Node deleted', { exact: true })).toBeVisible();
106+
await expect(page.getByText('Argument 1', { exact: true })).toHaveCount(0);
107+
});

‎src/components/features/factoids/FactoidsResults.tsx‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -81,6 +81,7 @@ function FactoidCard({ factoid, onSave }: { factoid: Factoid, onSave?: FactoidsR
8181
size="icon"
8282
className="h-8 w-8 text-muted-foreground hover:text-primary"
8383
onClick={() => onSave(factoid.shortClaim, `${factoid.context}\n\nKey Figure: ${factoid.keyFigure}\nLimitations: ${factoid.limitations}`, factoid.citation?.url)}
84+
aria-label={t('factoidsResults.saveClaimToLibrary', { claim: factoid.shortClaim })}
8485
title={t('factoidsResults.saveToLibrary')}
8586
>
8687
<Bookmark className="h-4 w-4" />

‎src/locales/en.json‎

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -747,6 +747,7 @@
747747
"urlNeedsVerification": "URL requires verification",
748748
"howToUse": "How to use:",
749749
"saveToLibrary": "Save to Library",
750+
"saveClaimToLibrary": "Save {{claim}} to library",
750751
"discuss": "Discuss Evidence",
751752
"verifyAll": "Verify All Sources",
752753
"verifying": "Verifying Sources...",
@@ -1000,7 +1001,12 @@
10001001
"saveFailedToast": "Failed to save flowchart",
10011002
"loadedToast": "Flowchart loaded",
10021003
"deletedToast": "Flowchart deleted",
1003-
"deleteFailedToast": "Failed to delete flowchart"
1004+
"deleteFailedToast": "Failed to delete flowchart",
1005+
"deleteNodeTitle": "Delete node?",
1006+
"deleteNodeDescription": "{{label}} and all of its connections will be removed. This cannot be undone.",
1007+
"deleteNodeConfirm": "Delete node",
1008+
"deleteNodeCancel": "Cancel",
1009+
"nodeDeletedToast": "Node deleted"
10041010
},
10051011
"historyPage": {
10061012
"title": "History",

‎src/locales/es.json‎

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -747,6 +747,7 @@
747747
"urlNeedsVerification": "La URL requiere verificación",
748748
"howToUse": "Cómo usar:",
749749
"saveToLibrary": "Guardar en Biblioteca",
750+
"saveClaimToLibrary": "Guardar {{claim}} en la biblioteca",
750751
"discuss": "Discutir Evidencia",
751752
"verifyAll": "Verificar Todas las Fuentes",
752753
"verifying": "Verificando Fuentes...",
@@ -1000,7 +1001,12 @@
10001001
"saveFailedToast": "Error al guardar diagrama",
10011002
"loadedToast": "Diagrama cargado",
10021003
"deletedToast": "Diagrama eliminado",
1003-
"deleteFailedToast": "Error al eliminar diagrama"
1004+
"deleteFailedToast": "Error al eliminar diagrama",
1005+
"deleteNodeTitle": "¿Eliminar nodo?",
1006+
"deleteNodeDescription": "Se eliminarán «{{label}}» y todas sus conexiones. Esta acción no se puede deshacer.",
1007+
"deleteNodeConfirm": "Eliminar nodo",
1008+
"deleteNodeCancel": "Cancelar",
1009+
"nodeDeletedToast": "Nodo eliminado"
10041010
},
10051011
"historyPage": {
10061012
"title": "Historial",

‎src/locales/hu.json‎

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -747,6 +747,7 @@
747747
"urlNeedsVerification": "Az URL ellenőrzést igényel",
748748
"howToUse": "Használat:",
749749
"saveToLibrary": "Mentés a Könyvtárba",
750+
"saveClaimToLibrary": "„{{claim}}” mentése a könyvtárba",
750751
"discuss": "Bizonyítékok Megvitatása",
751752
"verifyAll": "Összes Forrás Ellenőrzése",
752753
"verifying": "Források Ellenőrzése...",
@@ -1000,7 +1001,12 @@
10001001
"saveFailedToast": "Nem sikerült menteni a folyamatábrát",
10011002
"loadedToast": "Folyamatábra betöltve",
10021003
"deletedToast": "Folyamatábra törölve",
1003-
"deleteFailedToast": "Nem sikerült törölni a folyamatábrát"
1004+
"deleteFailedToast": "Nem sikerült törölni a folyamatábrát",
1005+
"deleteNodeTitle": "Csomópont törlése?",
1006+
"deleteNodeDescription": "A(z) „{{label}}” csomópont és minden kapcsolata törlődik. Ez a művelet nem vonható vissza.",
1007+
"deleteNodeConfirm": "Csomópont törlése",
1008+
"deleteNodeCancel": "Mégse",
1009+
"nodeDeletedToast": "Csomópont törölve"
10041010
},
10051011
"historyPage": {
10061012
"title": "Előzmények",

‎src/pages/AskPage.tsx‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -311,7 +311,7 @@ export default function AskPage() {
311311
<div className="container py-8 px-4">
312312
<div className="max-w-5xl mx-auto">
313313
<AnimatedSection className="mb-8">
314-
<h1 className="text-3xl font-bold text-foreground">{t('ask.title')}</h1>
314+
<h1 className="text-3xl font-bold text-foreground">{t('nav.ask')}</h1>
315315
</AnimatedSection>
316316
<AnimatedSection delay={75}>
317317
<AskChat

‎src/pages/AttackPage.tsx‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -105,7 +105,7 @@ export default function AttackPage() {
105105
<div className="max-w-6xl mx-auto">
106106
<AnimatedSection className="mb-8 flex flex-col sm:flex-row sm:items-end justify-between gap-4">
107107
<div>
108-
<h1 className="text-3xl font-bold tracking-tight text-foreground">{t('attack.title')}</h1>
108+
<h1 className="text-3xl font-bold tracking-tight text-foreground">{t('nav.attack')}</h1>
109109
<p className="text-muted-foreground mt-1 transition-colors duration-300">
110110
{t('attack.subtitle')}
111111
</p>

‎src/pages/BrainstormPage.tsx‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -96,7 +96,7 @@ export default function BrainstormPage() {
9696
<div className="max-w-6xl mx-auto">
9797
<AnimatedSection className="mb-8 flex flex-col sm:flex-row sm:items-end justify-between gap-4">
9898
<div>
99-
<h1 className="text-3xl font-bold tracking-tight text-foreground">{t('brainstorm.title')}</h1>
99+
<h1 className="text-3xl font-bold tracking-tight text-foreground">{t('nav.brainstorm')}</h1>
100100
<p className="text-muted-foreground mt-1 transition-colors duration-300">
101101
{t('brainstorm.subtitle')}
102102
</p>

‎src/pages/FactoidsPage.tsx‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -111,7 +111,7 @@ export default function FactoidsPage() {
111111
<div className="max-w-6xl mx-auto">
112112
<AnimatedSection className="mb-8 flex flex-col sm:flex-row sm:items-end justify-between gap-4">
113113
<div>
114-
<h1 className="text-3xl font-bold tracking-tight text-foreground">{t('factoids.title')}</h1>
114+
<h1 className="text-3xl font-bold tracking-tight text-foreground">{t('nav.factoids')}</h1>
115115
<p className="text-muted-foreground mt-1 transition-colors duration-300">
116116
{t('factoids.subtitle')}
117117
</p>

0 commit comments

Comments
 (0)