mirror of
https://github.com/MODSetter/SurfSense.git
synced 2026-05-12 09:12:40 +02:00
test(e2e): add OneDrive connector Playwright journey
This commit is contained in:
parent
da8b151634
commit
2d78dda487
5 changed files with 239 additions and 0 deletions
32
surfsense_web/tests/fixtures/connectors/native-onedrive.fixture.ts
vendored
Normal file
32
surfsense_web/tests/fixtures/connectors/native-onedrive.fixture.ts
vendored
Normal file
|
|
@ -0,0 +1,32 @@
|
|||
import {
|
||||
type ConnectorRow,
|
||||
deleteConnector,
|
||||
runNativeOneDriveOAuth,
|
||||
} from "../../helpers/api/connectors";
|
||||
import { searchSpaceFixtures } from "../search-space.fixture";
|
||||
|
||||
export type NativeOneDriveFixtures = {
|
||||
/**
|
||||
* A pre-connected native Microsoft OneDrive connector inside the
|
||||
* fixture's `searchSpace`. OAuth uses E2E Microsoft Graph fakes and is
|
||||
* cleaned up automatically after the test.
|
||||
*/
|
||||
nativeOneDriveConnector: ConnectorRow;
|
||||
};
|
||||
|
||||
export const nativeOneDriveFixtures = searchSpaceFixtures.extend<NativeOneDriveFixtures>({
|
||||
nativeOneDriveConnector: async ({ request, apiToken, searchSpace }, use) => {
|
||||
const { connector } = await runNativeOneDriveOAuth(request, apiToken, searchSpace.id);
|
||||
if (!connector) {
|
||||
throw new Error(
|
||||
"nativeOneDriveConnector fixture: OAuth completed but no ONEDRIVE_CONNECTOR was created. " +
|
||||
"Check the backend log — the OneDrive fake likely rejected an unmodelled call."
|
||||
);
|
||||
}
|
||||
try {
|
||||
await use(connector);
|
||||
} finally {
|
||||
await deleteConnector(request, apiToken, connector.id);
|
||||
}
|
||||
},
|
||||
});
|
||||
9
surfsense_web/tests/fixtures/index.ts
vendored
9
surfsense_web/tests/fixtures/index.ts
vendored
|
|
@ -20,6 +20,8 @@
|
|||
* └─ nativeGmailWithChatTest — chatThread
|
||||
* └─ nativeCalendarFixtures — nativeCalendarConnector
|
||||
* └─ nativeCalendarWithChatTest — chatThread
|
||||
* └─ nativeOneDriveFixtures — nativeOneDriveConnector
|
||||
* └─ nativeOneDriveWithChatTest — chatThread
|
||||
* └─ notionFixtures — notionConnector
|
||||
* └─ notionWithChatTest — chatThread
|
||||
* └─ confluenceFixtures — confluenceConnector
|
||||
|
|
@ -47,6 +49,7 @@ export { linearFixtures } from "./connectors/linear.fixture";
|
|||
export { nativeCalendarFixtures } from "./connectors/native-calendar.fixture";
|
||||
export { nativeDriveFixtures } from "./connectors/native-drive.fixture";
|
||||
export { nativeGmailFixtures } from "./connectors/native-gmail.fixture";
|
||||
export { nativeOneDriveFixtures } from "./connectors/native-onedrive.fixture";
|
||||
export { notionFixtures } from "./connectors/notion.fixture";
|
||||
export { searchSpaceFixtures } from "./search-space.fixture";
|
||||
export { slackFixtures } from "./connectors/slack.fixture";
|
||||
|
|
@ -61,6 +64,7 @@ import { linearFixtures } from "./connectors/linear.fixture";
|
|||
import { nativeCalendarFixtures } from "./connectors/native-calendar.fixture";
|
||||
import { nativeDriveFixtures } from "./connectors/native-drive.fixture";
|
||||
import { nativeGmailFixtures } from "./connectors/native-gmail.fixture";
|
||||
import { nativeOneDriveFixtures } from "./connectors/native-onedrive.fixture";
|
||||
import { notionFixtures } from "./connectors/notion.fixture";
|
||||
import { searchSpaceFixtures } from "./search-space.fixture";
|
||||
import { slackFixtures } from "./connectors/slack.fixture";
|
||||
|
|
@ -97,6 +101,11 @@ export const nativeCalendarTest = nativeCalendarFixtures;
|
|||
/** `test` for native Calendar specs that also need a chat thread. */
|
||||
export const nativeCalendarWithChatTest =
|
||||
nativeCalendarFixtures.extend<ChatThreadFixtures>(chatThreadFixtures);
|
||||
/** `test` for specs that also need a pre-connected native OneDrive connector. */
|
||||
export const nativeOneDriveTest = nativeOneDriveFixtures;
|
||||
/** `test` for native OneDrive specs that also need a chat thread. */
|
||||
export const nativeOneDriveWithChatTest =
|
||||
nativeOneDriveFixtures.extend<ChatThreadFixtures>(chatThreadFixtures);
|
||||
/** `test` for specs that also need a pre-connected Notion connector. */
|
||||
export const notionTest = notionFixtures;
|
||||
/** `test` for Notion specs that also need a chat thread. */
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue