Skip to content

test(ui): cover the file-upload path (backend contract + frontend flow)#173

Merged
haksungjang merged 1 commit into
mainfrom
test/upload-integration
Jun 23, 2026
Merged

test(ui): cover the file-upload path (backend contract + frontend flow)#173
haksungjang merged 1 commit into
mainfrom
test/upload-integration

Conversation

@haksungjang

Copy link
Copy Markdown
Member

Closes the testing gap that let "upload failed: Failed to fetch" slip through: no test exercised the upload path. The Playwright specs only used "current folder" (no upload), and the web server's /upload endpoint had no standalone test.

Changes

  • server.py: OUTPUT_DIR is now overridable via SBOM_OUTPUT_DIR (default /host-output unchanged), so the server can run standalone for testing.
  • tests/test-web-ui.sh (new, No-Docker, CI postprocess job): runs server.py standalone and checks /capabilities, /results, the /upload round-trip (token returned + file saved under .uploads/<token>/, unknown-kind → 400, wrong-extension → 415), the /file traversal guard, and /git-cred.
  • upload.spec.ts (new Playwright): drives the ZIP-upload UI flow — select source, attach a file, run — and asserts it posts to /upload then renders the result (no "Failed to fetch"); plus a failed-upload case that surfaces the error instead of scanning.

Verification

bash tests/test-web-ui.sh → 9 passed. npm run test:ui → 6 passed (4 vendored + 2 upload). shellcheck clean.

This is part (a) of the follow-up to the upload bug; part (b) — reducing mis-attribution noise on real full uploads — follows separately.

The "upload failed: Failed to fetch" surfaced because no test exercised the
upload path: the Playwright specs only used "current folder" (no upload), and
the web server's /upload endpoint had no standalone test. Close both gaps.

- server.py: OUTPUT_DIR is now overridable via SBOM_OUTPUT_DIR (default
  unchanged), so the server can run standalone for testing.
- tests/test-web-ui.sh: No-Docker contract test — runs server.py standalone and
  checks /capabilities, /results, the /upload round-trip (token + file saved
  under .uploads/<token>/, bad-kind 400, wrong-extension 415), /file traversal
  guard, and /git-cred. Wired into the CI postprocess job.
- Playwright upload.spec.ts: drives the ZIP-upload UI flow (select source, attach
  a file, run) and asserts it posts to /upload then renders the result; plus a
  failed-upload case that surfaces the error instead of scanning.
@haksungjang haksungjang merged commit f34e78b into main Jun 23, 2026
25 checks passed
@haksungjang haksungjang deleted the test/upload-integration branch June 23, 2026 05:26
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant