test(web): add native Google Drive E2E journey

This commit is contained in:
Anish Sarkar 2026-05-07 03:59:58 +05:30
parent 3f2912a4ca
commit 92dd967bf1
4 changed files with 194 additions and 0 deletions

View file

@ -0,0 +1,32 @@
import {
type ConnectorRow,
deleteConnector,
runNativeGoogleDriveOAuth,
} from "../../helpers/api/connectors";
import { searchSpaceFixtures } from "../search-space.fixture";
export type NativeDriveFixtures = {
/**
* A pre-connected native Google Drive connector inside the fixture's
* `searchSpace`. OAuth uses E2E native Google fakes and is cleaned up
* automatically after the test.
*/
nativeDriveConnector: ConnectorRow;
};
export const nativeDriveFixtures = searchSpaceFixtures.extend<NativeDriveFixtures>({
nativeDriveConnector: async ({ request, apiToken, searchSpace }, use) => {
const { connector } = await runNativeGoogleDriveOAuth(request, apiToken, searchSpace.id);
if (!connector) {
throw new Error(
"nativeDriveConnector fixture: OAuth completed but no GOOGLE_DRIVE_CONNECTOR was created. " +
"Check the backend log — the native Google Drive fake likely rejected an unmodelled call."
);
}
try {
await use(connector);
} finally {
await deleteConnector(request, apiToken, connector.id);
}
},
});

View file

@ -14,6 +14,8 @@
* composioGmailWithChatTest chatThread
* composioCalendarFixtures composioCalendarConnector
* composioCalendarWithChatTest chatThread
* nativeDriveFixtures nativeDriveConnector
* nativeDriveWithChatTest chatThread
*
* To add a new connector (Gmail, Slack, manual upload, etc.):
* 1. Add a fixture file under `fixtures/connectors/<name>.fixture.ts`.
@ -25,12 +27,14 @@ export { chatThreadFixtures } from "./chat-thread.fixture";
export { composioCalendarFixtures } from "./connectors/composio-calendar.fixture";
export { composioDriveFixtures } from "./connectors/composio-drive.fixture";
export { composioGmailFixtures } from "./connectors/composio-gmail.fixture";
export { nativeDriveFixtures } from "./connectors/native-drive.fixture";
export { searchSpaceFixtures } from "./search-space.fixture";
import { type ChatThreadFixtures, chatThreadFixtures } from "./chat-thread.fixture";
import { composioCalendarFixtures } from "./connectors/composio-calendar.fixture";
import { composioDriveFixtures } from "./connectors/composio-drive.fixture";
import { composioGmailFixtures } from "./connectors/composio-gmail.fixture";
import { nativeDriveFixtures } from "./connectors/native-drive.fixture";
import { searchSpaceFixtures } from "./search-space.fixture";
/** Default `test` for specs that just need auth + a clean search space. */
@ -50,3 +54,8 @@ export const composioCalendarTest = composioCalendarFixtures;
/** `test` for Calendar specs that also need a chat thread. */
export const composioCalendarWithChatTest =
composioCalendarFixtures.extend<ChatThreadFixtures>(chatThreadFixtures);
/** `test` for specs that also need a pre-connected native Google Drive connector. */
export const nativeDriveTest = nativeDriveFixtures;
/** `test` for native Drive specs that also need a chat thread. */
export const nativeDriveWithChatTest =
nativeDriveFixtures.extend<ChatThreadFixtures>(chatThreadFixtures);