Skip to content

YC (S26) | Open Computer History | Continuously record your company computer work, map your workflows, help you find work worth automating, and power your agents' context

test: stabilize source citation footer click

Louis Beaumont6f1217593aef
diff --git a/apps/screenpipe-app-tauri/components/chat/source-citation-footer.tsx b/apps/screenpipe-app-tauri/components/chat/source-citation-footer.tsx
index e98f7d8af..602d41bc6 100644
--- a/apps/screenpipe-app-tauri/components/chat/source-citation-footer.tsx
+++ b/apps/screenpipe-app-tauri/components/chat/source-citation-footer.tsx
@@ -113,6 +113,7 @@ export function SourceCitationFooter({ citations, className, onOpenFile }: Sourc
<div className={cn("mt-3 border-t border-border/40 pt-2 text-xs", className)}>
<button
type="button"
+ data-testid="source-citation-toggle"
onClick={() => setExpanded((value) => !value)}
className="group flex min-w-0 max-w-full items-center gap-1.5 text-muted-foreground transition-colors hover:text-foreground"
aria-expanded={expanded}
diff --git a/apps/screenpipe-app-tauri/e2e/specs/chat-source-file-preview.spec.ts b/apps/screenpipe-app-tauri/e2e/specs/chat-source-file-preview.spec.ts
index b909da480..0b152d4a4 100644
--- a/apps/screenpipe-app-tauri/e2e/specs/chat-source-file-preview.spec.ts
+++ b/apps/screenpipe-app-tauri/e2e/specs/chat-source-file-preview.spec.ts
@@ -115,10 +115,9 @@ async function expandSeededSourcesFooter(content: string): Promise<void> {
).find((el) =>
(el.textContent ?? "").includes(assistantContent),
);
- const sourceButtons = Array.from(document.querySelectorAll("button")).filter((el) => {
- const text = el.textContent ?? "";
- return el.getAttribute("aria-expanded") !== null && /\bsources?\b/i.test(text);
- });
+ const sourceButtons = Array.from(
+ document.querySelectorAll('[data-testid="source-citation-toggle"]'),
+ );
const button = assistantMessage
? sourceButtons.find((el) => assistantMessage.contains(el)) ??
sourceButtons.find((el) =>
@@ -135,7 +134,7 @@ async function expandSeededSourcesFooter(content: string): Promise<void> {
return true;
}, content)) as boolean,
{
- timeout: t(8_000),
+ timeout: t(20_000),
interval: 150,
timeoutMsg: "seeded sources footer toggle never appeared",
},