test(e2e): add Slack connector Playwright journey

This commit is contained in:
Anish Sarkar 2026-05-08 03:09:11 +05:30
parent 73b6375688
commit 029f2168b3
5 changed files with 191 additions and 0 deletions

View 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);
}
},
});