mirror of
https://github.com/MODSetter/SurfSense.git
synced 2026-05-13 17:52:38 +02:00
test(e2e): wire Dropbox Playwright fixtures
This commit is contained in:
parent
69437b1fe4
commit
7303e3ebb3
5 changed files with 147 additions and 2 deletions
32
surfsense_web/tests/fixtures/connectors/native-dropbox.fixture.ts
vendored
Normal file
32
surfsense_web/tests/fixtures/connectors/native-dropbox.fixture.ts
vendored
Normal file
|
|
@ -0,0 +1,32 @@
|
|||
import {
|
||||
type ConnectorRow,
|
||||
deleteConnector,
|
||||
runNativeDropboxOAuth,
|
||||
} from "../../helpers/api/connectors";
|
||||
import { searchSpaceFixtures } from "../search-space.fixture";
|
||||
|
||||
export type NativeDropboxFixtures = {
|
||||
/**
|
||||
* A pre-connected native Dropbox connector inside the fixture's
|
||||
* `searchSpace`. OAuth uses E2E Dropbox fakes and is cleaned up
|
||||
* automatically after the test.
|
||||
*/
|
||||
nativeDropboxConnector: ConnectorRow;
|
||||
};
|
||||
|
||||
export const nativeDropboxFixtures = searchSpaceFixtures.extend<NativeDropboxFixtures>({
|
||||
nativeDropboxConnector: async ({ request, apiToken, searchSpace }, use) => {
|
||||
const { connector } = await runNativeDropboxOAuth(request, apiToken, searchSpace.id);
|
||||
if (!connector) {
|
||||
throw new Error(
|
||||
"nativeDropboxConnector fixture: OAuth completed but no DROPBOX_CONNECTOR was created. " +
|
||||
"Check the backend log — the Dropbox 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