test(web): add native Google Gmail live-tool journey

This commit is contained in:
Anish Sarkar 2026-05-07 04:23:20 +05:30
parent a5c04cb38d
commit 9dafd38e19
5 changed files with 183 additions and 1 deletions

View file

@ -20,7 +20,7 @@ export const nativeDriveFixtures = searchSpaceFixtures.extend<NativeDriveFixture
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."
"Check the backend log — the native Google fake likely rejected an unmodelled call."
);
}
try {

View file

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

View file

@ -16,6 +16,8 @@
* composioCalendarWithChatTest chatThread
* nativeDriveFixtures nativeDriveConnector
* nativeDriveWithChatTest chatThread
* nativeGmailFixtures nativeGmailConnector
* nativeGmailWithChatTest chatThread
*
* To add a new connector (Gmail, Slack, manual upload, etc.):
* 1. Add a fixture file under `fixtures/connectors/<name>.fixture.ts`.
@ -28,6 +30,7 @@ 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 { nativeGmailFixtures } from "./connectors/native-gmail.fixture";
export { searchSpaceFixtures } from "./search-space.fixture";
import { type ChatThreadFixtures, chatThreadFixtures } from "./chat-thread.fixture";
@ -35,6 +38,7 @@ 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 { nativeGmailFixtures } from "./connectors/native-gmail.fixture";
import { searchSpaceFixtures } from "./search-space.fixture";
/** Default `test` for specs that just need auth + a clean search space. */
@ -59,3 +63,8 @@ export const nativeDriveTest = nativeDriveFixtures;
/** `test` for native Drive specs that also need a chat thread. */
export const nativeDriveWithChatTest =
nativeDriveFixtures.extend<ChatThreadFixtures>(chatThreadFixtures);
/** `test` for specs that also need a pre-connected native Gmail connector. */
export const nativeGmailTest = nativeGmailFixtures;
/** `test` for native Gmail specs that also need a chat thread. */
export const nativeGmailWithChatTest =
nativeGmailFixtures.extend<ChatThreadFixtures>(chatThreadFixtures);