working
This commit is contained in:
parent
c0999370c6
commit
4e1a339432
17 changed files with 393 additions and 91 deletions
21
frontend/e2e/helpers/reset-db.ts
Normal file
21
frontend/e2e/helpers/reset-db.ts
Normal file
|
|
@ -0,0 +1,21 @@
|
|||
/**
|
||||
* Helper to reset the database before each test.
|
||||
* Calls the /api/test/reset endpoint on the worker's backend.
|
||||
*/
|
||||
|
||||
import { APIRequestContext } from "@playwright/test";
|
||||
import { getBackendUrl } from "./backend-url";
|
||||
|
||||
/**
|
||||
* Reset the database for the current worker.
|
||||
* Truncates all tables and re-seeds base data.
|
||||
*/
|
||||
export async function resetDatabase(request: APIRequestContext): Promise<void> {
|
||||
const backendUrl = getBackendUrl();
|
||||
const response = await request.post(`${backendUrl}/api/test/reset`);
|
||||
|
||||
if (!response.ok()) {
|
||||
const text = await response.text();
|
||||
throw new Error(`Failed to reset database: ${response.status()} - ${text}`);
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue