diff --git a/apps/ui/src/components/layout/project-switcher/components/project-switcher-item.tsx b/apps/ui/src/components/layout/project-switcher/components/project-switcher-item.tsx index c1a2fa26..f98e05ac 100644 --- a/apps/ui/src/components/layout/project-switcher/components/project-switcher-item.tsx +++ b/apps/ui/src/components/layout/project-switcher/components/project-switcher-item.tsx @@ -1,6 +1,6 @@ import { Folder, LucideIcon } from 'lucide-react'; import * as LucideIcons from 'lucide-react'; -import { cn } from '@/lib/utils'; +import { cn, sanitizeForTestId } from '@/lib/utils'; import { getAuthenticatedImageUrl } from '@/lib/api-fetch'; import type { Project } from '@/lib/electron'; @@ -37,10 +37,15 @@ export function ProjectSwitcherItem({ const IconComponent = getIconComponent(); const hasCustomIcon = !!project.customIconPath; + // Combine project.id with sanitized name for uniqueness and readability + // Format: project-switcher-{id}-{sanitizedName} + const testId = `project-switcher-${project.id}-${sanitizeForTestId(project.name)}`; + return (