mirror of
https://github.com/MODSetter/SurfSense.git
synced 2026-05-13 17:52:38 +02:00
test(e2e): add Slack connector Playwright journey
This commit is contained in:
parent
73b6375688
commit
029f2168b3
5 changed files with 191 additions and 0 deletions
28
surfsense_web/tests/fixtures/connectors/slack.fixture.ts
vendored
Normal file
28
surfsense_web/tests/fixtures/connectors/slack.fixture.ts
vendored
Normal file
|
|
@ -0,0 +1,28 @@
|
|||
import { type ConnectorRow, deleteConnector, runSlackOAuth } from "../../helpers/api/connectors";
|
||||
import { searchSpaceFixtures } from "../search-space.fixture";
|
||||
|
||||
export type SlackFixtures = {
|
||||
/**
|
||||
* A pre-connected Slack connector inside the fixture's `searchSpace`.
|
||||
* OAuth and MCP tool calls use E2E Slack fakes and are cleaned up
|
||||
* automatically after the test.
|
||||
*/
|
||||
slackConnector: ConnectorRow;
|
||||
};
|
||||
|
||||
export const slackFixtures = searchSpaceFixtures.extend<SlackFixtures>({
|
||||
slackConnector: async ({ request, apiToken, searchSpace }, use) => {
|
||||
const { connector } = await runSlackOAuth(request, apiToken, searchSpace.id);
|
||||
if (!connector) {
|
||||
throw new Error(
|
||||
"slackConnector fixture: OAuth completed but no SLACK_CONNECTOR was created. " +
|
||||
"Check the backend log — the Slack MCP fake likely rejected an unmodelled call."
|
||||
);
|
||||
}
|
||||
try {
|
||||
await use(connector);
|
||||
} finally {
|
||||
await deleteConnector(request, apiToken, connector.id);
|
||||
}
|
||||
},
|
||||
});
|
||||
8
surfsense_web/tests/fixtures/index.ts
vendored
8
surfsense_web/tests/fixtures/index.ts
vendored
|
|
@ -28,6 +28,8 @@
|
|||
* └─ linearWithChatTest — chatThread
|
||||
* └─ jiraFixtures — jiraConnector
|
||||
* └─ jiraWithChatTest — chatThread
|
||||
* └─ slackFixtures — slackConnector
|
||||
* └─ slackWithChatTest — chatThread
|
||||
*
|
||||
* To add a new connector (Gmail, Slack, manual upload, etc.):
|
||||
* 1. Add a fixture file under `fixtures/connectors/<name>.fixture.ts`.
|
||||
|
|
@ -47,6 +49,7 @@ export { nativeDriveFixtures } from "./connectors/native-drive.fixture";
|
|||
export { nativeGmailFixtures } from "./connectors/native-gmail.fixture";
|
||||
export { notionFixtures } from "./connectors/notion.fixture";
|
||||
export { searchSpaceFixtures } from "./search-space.fixture";
|
||||
export { slackFixtures } from "./connectors/slack.fixture";
|
||||
|
||||
import { type ChatThreadFixtures, chatThreadFixtures } from "./chat-thread.fixture";
|
||||
import { composioCalendarFixtures } from "./connectors/composio-calendar.fixture";
|
||||
|
|
@ -60,6 +63,7 @@ import { nativeDriveFixtures } from "./connectors/native-drive.fixture";
|
|||
import { nativeGmailFixtures } from "./connectors/native-gmail.fixture";
|
||||
import { notionFixtures } from "./connectors/notion.fixture";
|
||||
import { searchSpaceFixtures } from "./search-space.fixture";
|
||||
import { slackFixtures } from "./connectors/slack.fixture";
|
||||
|
||||
/** Default `test` for specs that just need auth + a clean search space. */
|
||||
export const test = searchSpaceFixtures;
|
||||
|
|
@ -110,3 +114,7 @@ export const linearWithChatTest = linearFixtures.extend<ChatThreadFixtures>(chat
|
|||
export const jiraTest = jiraFixtures;
|
||||
/** `test` for Jira specs that also need a chat thread. */
|
||||
export const jiraWithChatTest = jiraFixtures.extend<ChatThreadFixtures>(chatThreadFixtures);
|
||||
/** `test` for specs that also need a pre-connected Slack connector. */
|
||||
export const slackTest = slackFixtures;
|
||||
/** `test` for Slack specs that also need a chat thread. */
|
||||
export const slackWithChatTest = slackFixtures.extend<ChatThreadFixtures>(chatThreadFixtures);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue