mirror of
https://github.com/MODSetter/SurfSense.git
synced 2026-05-12 09:12:40 +02:00
test(web): add native Google Gmail live-tool journey
This commit is contained in:
parent
a5c04cb38d
commit
9dafd38e19
5 changed files with 183 additions and 1 deletions
|
|
@ -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 {
|
||||
|
|
|
|||
32
surfsense_web/tests/fixtures/connectors/native-gmail.fixture.ts
vendored
Normal file
32
surfsense_web/tests/fixtures/connectors/native-gmail.fixture.ts
vendored
Normal 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);
|
||||
}
|
||||
},
|
||||
});
|
||||
Loading…
Add table
Add a link
Reference in a new issue