mirror of
https://github.com/MODSetter/SurfSense.git
synced 2026-05-13 17:52:38 +02:00
test(web): extend Composio Drive journey to assert chat retrieval
This commit is contained in:
parent
dedccd5c1c
commit
5bdf8a0c31
1 changed files with 89 additions and 77 deletions
|
|
@ -1,24 +1,31 @@
|
||||||
import { composioDriveTest as test, expect } from "../../../fixtures";
|
import { expect, composioDriveWithChatTest as test } from "../../../fixtures";
|
||||||
import { listConnectors, triggerIndex, updateConnectorConfig } from "../../../helpers/api/connectors";
|
import { streamChatToCompletion } from "../../../helpers/api/chat";
|
||||||
|
import {
|
||||||
|
listConnectors,
|
||||||
|
triggerIndex,
|
||||||
|
updateConnectorConfig,
|
||||||
|
} from "../../../helpers/api/connectors";
|
||||||
import { getEditorContent, listDocuments } from "../../../helpers/api/documents";
|
import { getEditorContent, listDocuments } from "../../../helpers/api/documents";
|
||||||
import { CANARY_TOKENS, FAKE_DRIVE_FILES } from "../../../helpers/canary";
|
import { CANARY_TOKENS, FAKE_DRIVE_FILES } from "../../../helpers/canary";
|
||||||
import { openConnectorPopup } from "../../../helpers/ui/connector-popup";
|
import { openConnectorPopup } from "../../../helpers/ui/connector-popup";
|
||||||
import {
|
import { waitForDocumentByTitle, waitForIndexingComplete } from "../../../helpers/waits/indexing";
|
||||||
waitForDocumentByTitle,
|
|
||||||
waitForIndexingComplete,
|
|
||||||
} from "../../../helpers/waits/indexing";
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Proves the Drive wiring from OAuth fixture -> selection persistence ->
|
* 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.
|
* covered by later phases or narrower tests.
|
||||||
*/
|
*/
|
||||||
test.describe("Composio Drive journey", () => {
|
test.describe("Composio Drive journey", () => {
|
||||||
test(
|
test("user connects Drive, selects a file, indexes it, and chats with the canary token", async ({
|
||||||
"user connects Drive, selects a file, and sees it indexed with the canary token",
|
page,
|
||||||
async ({ page, request, apiToken, searchSpace, composioDriveConnector }) => {
|
request,
|
||||||
|
apiToken,
|
||||||
|
searchSpace,
|
||||||
|
composioDriveConnector,
|
||||||
|
chatThread,
|
||||||
|
}) => {
|
||||||
test.setTimeout(180_000); // worker cold-start + summarize + embed + chunk
|
test.setTimeout(180_000); // worker cold-start + summarize + embed + chunk
|
||||||
|
|
||||||
await page.goto(`/dashboard/${searchSpace.id}/new-chat`, {
|
await page.goto(`/dashboard/${searchSpace.id}/new-chat`, {
|
||||||
|
|
@ -67,13 +74,9 @@ test.describe("Composio Drive journey", () => {
|
||||||
minDocuments: 1,
|
minDocuments: 1,
|
||||||
});
|
});
|
||||||
|
|
||||||
await waitForDocumentByTitle(
|
await waitForDocumentByTitle(request, apiToken, searchSpace.id, FAKE_DRIVE_FILES.canary.name, {
|
||||||
request,
|
timeoutMs: 30_000,
|
||||||
apiToken,
|
});
|
||||||
searchSpace.id,
|
|
||||||
FAKE_DRIVE_FILES.canary.name,
|
|
||||||
{ timeoutMs: 30_000 }
|
|
||||||
);
|
|
||||||
|
|
||||||
const docs = await listDocuments(request, apiToken, searchSpace.id);
|
const docs = await listDocuments(request, apiToken, searchSpace.id);
|
||||||
const canaryDoc = docs.find((d) => d.title === FAKE_DRIVE_FILES.canary.name);
|
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 refreshedConnectors = await listConnectors(request, apiToken, searchSpace.id);
|
||||||
const refreshed = refreshedConnectors.find((c) => c.id === composioDriveConnector.id);
|
const refreshed = refreshedConnectors.find((c) => c.id === composioDriveConnector.id);
|
||||||
expect(refreshed?.last_indexed_at).not.toBeNull();
|
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);
|
||||||
|
});
|
||||||
});
|
});
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue