1b24bb2157
- Added functions for creating, updating, deleting, and listing collection entries in admin API. - Introduced seed data management for consistent test content across tests. - Updated global setup and teardown processes to ensure seeded content is created and cleaned up. - Refactored existing tests to utilize seeded content for improved reliability and maintainability.
24 lines
597 B
TypeScript
24 lines
597 B
TypeScript
import { test as base, expect, type APIRequestContext } from "@playwright/test"
|
|
import { getAdminContext } from "./helpers/admin-api"
|
|
import { TEST_BASE_URL } from "../fixtures/test-constants"
|
|
|
|
const API_BASE = "/api"
|
|
|
|
type ApiFixtures = {
|
|
api: APIRequestContext
|
|
adminApi: APIRequestContext
|
|
}
|
|
|
|
export const test = base.extend<ApiFixtures>({
|
|
api: async ({ request }, use) => {
|
|
await use(request)
|
|
},
|
|
|
|
adminApi: async ({ baseURL }, use) => {
|
|
const ctx = await getAdminContext(baseURL || TEST_BASE_URL)
|
|
await use(ctx)
|
|
},
|
|
})
|
|
|
|
export { expect, API_BASE }
|