test(e2e): fix preflight fixture scope and path handling

This commit is contained in:
kl
2026-03-04 12:54:42 +08:00
parent 7f6ad472c4
commit 3b0f7af382
3 changed files with 9 additions and 5 deletions

View File

@@ -1,4 +1,4 @@
import { test, expect } from '@playwright/test';
import { test, expect, request as playwrightRequest } from '@playwright/test';
const fixtureBase = process.env.FIXTURE_BASE_URL || 'http://127.0.0.1:18080';
@@ -11,12 +11,14 @@ async function openPreview(request: any, fileUrl: string) {
return request.get(`/onlinePreview?url=${encoded}`);
}
test.beforeAll(async ({ request }) => {
test.beforeAll(async () => {
const api = await playwrightRequest.newContext();
const required = ['sample.txt', 'sample.docx', 'sample.xlsx', 'sample.pptx', 'sample.zip'];
for (const name of required) {
const resp = await request.get(`${fixtureBase}/${name}`);
const resp = await api.get(`${fixtureBase}/${name}`);
expect(resp.ok(), `fixture missing or unavailable: ${name}`).toBeTruthy();
}
await api.dispose();
});
test('01 home/index reachable', async ({ request }) => {