CI / skip-ci-check (pull_request) Successful in 4s
CI / docker-ci (pull_request) Successful in 6s
CI / secret-scan (pull_request) Successful in 11s
CI / viewer-unit (pull_request) Failing after 1m3s
CI / admin-unit (pull_request) Failing after 1m1s
CI / e2e (pull_request) Failing after 59s
- upload.smoke.spec.ts / gallery.search-filters.spec.ts: replace
waitForResponse/text-scrape with typed interceptNetworkCall spies (status
+ JSON shape) on the real upload POST and the filtered /api/search GET.
- api.fastapi-login.spec.ts: Zod-validate the FastAPI TokenResponse and
/auth/me UserResponse instead of loose casts. gallery.search-filters.spec.ts
gets the same treatment for the Prisma-backed SearchResponse.
- prod.smoke.spec.ts: opt-in (PROD_BASE_URL) health + login-page check on a
real PROD host; skips as a no-op until the PROD LXC exists (none does yet
per `pct list` — see ROADMAP).
- viewer.write-gates.spec.ts: NextAuth (browser-session) hasWriteAccess gate
on POST /api/faces/{id}/identify — viewer 403s, admin passes through.
Provisioned a third, independent auth-DB user (e2e-viewer@levkine.ca,
hasWriteAccess=false) for this via ansible's provision-punimtag-e2e-user.py
(see that repo for the vault/Infisical/Gitea/Vaultwarden side).
57 lines
2.1 KiB
TypeScript
57 lines
2.1 KiB
TypeScript
import { assertPublicHost, interceptNetworkCall, waitForUrlHost } from '@levkin/playkit';
|
|
import path from 'node:path';
|
|
import { test, expect } from '../fixtures';
|
|
|
|
const tinyPng = path.join(__dirname, '../fixtures/tiny.png');
|
|
|
|
test.describe('upload @smoke', () => {
|
|
test.use({ storageState: path.join(__dirname, '../.auth/admin.json') });
|
|
|
|
test('authenticated user can select a file and POST upload', async ({
|
|
page,
|
|
playkitConfig,
|
|
timings,
|
|
}) => {
|
|
assertPublicHost(playkitConfig.baseUrl);
|
|
|
|
await timings.measure('open_upload', async () => {
|
|
await page.goto(`${playkitConfig.baseUrl}/upload`);
|
|
await waitForUrlHost(page, playkitConfig.expectedHost);
|
|
});
|
|
|
|
expect(new URL(page.url()).pathname).toMatch(/\/upload/);
|
|
await expect(page.getByLabel('Account menu')).toBeVisible({ timeout: 20_000 });
|
|
|
|
await timings.measure('upload_file', async () => {
|
|
await page.locator('#file-upload').setInputFiles(tinyPng);
|
|
await expect(page.getByText(/tiny\.png/i).first()).toBeVisible({ timeout: 15_000 });
|
|
const submit = page.getByRole('button', { name: /Submit for Review/i });
|
|
await expect(submit).toBeEnabled({ timeout: 15_000 });
|
|
|
|
const uploadCall = interceptNetworkCall({
|
|
page,
|
|
url: '**/api/photos/upload',
|
|
method: 'POST',
|
|
timeout: 60_000,
|
|
});
|
|
await submit.click();
|
|
const { status, responseJson } = await uploadCall;
|
|
expect([200, 201, 401, 403]).toContain(status);
|
|
if (status < 300) {
|
|
// viewer-frontend's own /api/photos/upload route (not FastAPI) —
|
|
// { message, photos: [...] } on success, see viewer-frontend route.ts.
|
|
expect(responseJson).toMatchObject({
|
|
message: expect.any(String),
|
|
photos: expect.any(Array),
|
|
});
|
|
}
|
|
|
|
// Success banner or inline error/alert — either proves the submit path ran.
|
|
const outcome = page
|
|
.getByText(/submitted successfully|failed|error|not authorized|permission/i)
|
|
.first();
|
|
await expect(outcome).toBeVisible({ timeout: 30_000 });
|
|
});
|
|
});
|
|
});
|