Some checks are pending
CI / Lint bridge (Biome) (push) Waiting to run
CI / Type-check bridge (push) Blocked by required conditions
CI / Tests unit bridge (push) Blocked by required conditions
CI / Tests integration bridge (push) Blocked by required conditions
CI / Security scan (push) Waiting to run
CI / Docker build + healthcheck (push) Blocked by required conditions
E2E Playwright / Playwright e2e (chromium) (push) Waiting to run
7 scenarios covering the full bridge+DocAdenice+Baserow chain: auth login, database-view insert, inline edit persistence, SSE realtime update (no reload), RBAC write-denied, kanban drag-drop, calendar reschedule. Includes docker-compose.e2e.yml (Postgres+Redis+Baserow+bridge+DocAdenice), playwright.config.ts (3 projects: chromium/firefox/webkit), auth+baserow+cleanup fixtures, global setup (API login + Baserow seed), and GitHub Actions e2e.yml. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
89 lines
2.3 KiB
TypeScript
89 lines
2.3 KiB
TypeScript
/**
|
|
* Teardown fixture for e2e tests.
|
|
*
|
|
* Cleans up test-specific entities created during test runs:
|
|
* - Baserow rows created by individual tests (not the pre-seeded fixture rows).
|
|
* - DocAdenice pages created during tests.
|
|
*
|
|
* The Baserow workspace/database/table/views are preserved across test runs
|
|
* (idempotent seed) — only transient data created by individual tests is cleaned.
|
|
*/
|
|
|
|
import { type APIRequestContext } from "@playwright/test";
|
|
|
|
const BASEROW_URL = process.env.E2E_BASEROW_URL ?? "http://localhost:8081";
|
|
const DOCMOST_SERVER_URL = process.env.E2E_DOCMOST_SERVER_URL ?? "http://localhost:3001";
|
|
|
|
/**
|
|
* Delete a single Baserow row.
|
|
* Idempotent: ignores 404 (row already gone).
|
|
*/
|
|
export async function deleteBaserowRow(
|
|
apiContext: APIRequestContext,
|
|
token: string,
|
|
tableId: number,
|
|
rowId: number,
|
|
): Promise<void> {
|
|
const response = await apiContext.delete(
|
|
`${BASEROW_URL}/api/database/rows/table/${tableId}/${rowId}/`,
|
|
{
|
|
headers: { Authorization: `JWT ${token}` },
|
|
},
|
|
);
|
|
|
|
if (!response.ok() && response.status() !== 404) {
|
|
console.warn(
|
|
`[cleanup] Could not delete Baserow row ${rowId} from table ${tableId}: ${response.status()}`,
|
|
);
|
|
}
|
|
}
|
|
|
|
/**
|
|
* Delete multiple Baserow rows.
|
|
*/
|
|
export async function deleteBaserowRows(
|
|
apiContext: APIRequestContext,
|
|
token: string,
|
|
tableId: number,
|
|
rowIds: number[],
|
|
): Promise<void> {
|
|
for (const rowId of rowIds) {
|
|
await deleteBaserowRow(apiContext, token, tableId, rowId);
|
|
}
|
|
}
|
|
|
|
/**
|
|
* Delete a DocAdenice page by ID using the admin token.
|
|
* Idempotent: ignores 404.
|
|
*/
|
|
export async function deleteDocAdencePage(
|
|
apiContext: APIRequestContext,
|
|
adminToken: string,
|
|
pageId: string,
|
|
): Promise<void> {
|
|
const response = await apiContext.delete(
|
|
`${DOCMOST_SERVER_URL}/api/pages/${pageId}`,
|
|
{
|
|
headers: { Authorization: `Bearer ${adminToken}` },
|
|
},
|
|
);
|
|
|
|
if (!response.ok() && response.status() !== 404) {
|
|
console.warn(
|
|
`[cleanup] Could not delete DocAdenice page ${pageId}: ${response.status()}`,
|
|
);
|
|
}
|
|
}
|
|
|
|
/**
|
|
* Delete multiple DocAdenice pages.
|
|
*/
|
|
export async function deleteDocAdencePages(
|
|
apiContext: APIRequestContext,
|
|
adminToken: string,
|
|
pageIds: string[],
|
|
): Promise<void> {
|
|
for (const pageId of pageIds) {
|
|
await deleteDocAdencePage(apiContext, adminToken, pageId);
|
|
}
|
|
}
|