test(web): extend Composio Drive journey to assert chat retrieval

This commit is contained in:
Anish Sarkar 2026-05-06 21:36:47 +05:30
parent dedccd5c1c
commit 5bdf8a0c31

View file

@ -1,24 +1,31 @@
import { composioDriveTest as test, expect } from "../../../fixtures";
import { listConnectors, triggerIndex, updateConnectorConfig } from "../../../helpers/api/connectors";
import { expect, composioDriveWithChatTest as test } from "../../../fixtures";
import { streamChatToCompletion } from "../../../helpers/api/chat";
import {
listConnectors,
triggerIndex,
updateConnectorConfig,
} from "../../../helpers/api/connectors";
import { getEditorContent, listDocuments } from "../../../helpers/api/documents";
import { CANARY_TOKENS, FAKE_DRIVE_FILES } from "../../../helpers/canary";
import { openConnectorPopup } from "../../../helpers/ui/connector-popup";
import {
waitForDocumentByTitle,
waitForIndexingComplete,
} from "../../../helpers/waits/indexing";
import { waitForDocumentByTitle, waitForIndexingComplete } from "../../../helpers/waits/indexing";
/**
* Proves the Drive wiring from OAuth fixture -> selection persistence ->
* indexing -> stored source_markdown -> editor-content retrieval.
* indexing -> stored source_markdown -> editor-content retrieval -> chat.
*
* UI-driven file selection, chat retrieval, and LLM/embedding quality are
* UI-driven file selection and LLM/embedding quality are
* covered by later phases or narrower tests.
*/
test.describe("Composio Drive journey", () => {
test(
"user connects Drive, selects a file, and sees it indexed with the canary token",
async ({ page, request, apiToken, searchSpace, composioDriveConnector }) => {
test("user connects Drive, selects a file, indexes it, and chats with the canary token", async ({
page,
request,
apiToken,
searchSpace,
composioDriveConnector,
chatThread,
}) => {
test.setTimeout(180_000); // worker cold-start + summarize + embed + chunk
await page.goto(`/dashboard/${searchSpace.id}/new-chat`, {
@ -67,13 +74,9 @@ test.describe("Composio Drive journey", () => {
minDocuments: 1,
});
await waitForDocumentByTitle(
request,
apiToken,
searchSpace.id,
FAKE_DRIVE_FILES.canary.name,
{ timeoutMs: 30_000 }
);
await waitForDocumentByTitle(request, apiToken, searchSpace.id, FAKE_DRIVE_FILES.canary.name, {
timeoutMs: 30_000,
});
const docs = await listDocuments(request, apiToken, searchSpace.id);
const canaryDoc = docs.find((d) => d.title === FAKE_DRIVE_FILES.canary.name);
@ -94,6 +97,15 @@ test.describe("Composio Drive journey", () => {
const refreshedConnectors = await listConnectors(request, apiToken, searchSpace.id);
const refreshed = refreshedConnectors.find((c) => c.id === composioDriveConnector.id);
expect(refreshed?.last_indexed_at).not.toBeNull();
}
);
const chat = await streamChatToCompletion(request, apiToken, {
searchSpaceId: searchSpace.id,
threadId: chatThread.id,
query: "What is in my e2e-canary.txt Drive file?",
});
expect(
chat.assistantText,
`chat agent should surface canary token after indexing; got: ${chat.assistantText.slice(0, 200)}`
).toContain(CANARY_TOKENS.driveCanaryFile);
});
});