Test the library import against a real server and worker

The browser scenario of the import page runs on isolated API fixtures, so
nothing checked the page with the real handlers, the background worker and
the publisher together. tests/browser-library-import-live.cjs seeds a few
library tracks on a fresh disposable instance, uploads a Spotify export
ZIP built in the test and checks that only the playlist files are sent,
the statistics after the worker finishes, the private playlists in source
order without repeats, the filters, a manual choice published by the next
pass, the export flagged as already imported, Retry unmatched, history
deletion that keeps the playlists and the page at phone width.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
sanapachandClaude Opus 5.5 committed 2026-11-26 20:25:14 +02:00
1 parent 4b73de46ec
commit 6dc547e66e
2 files changed
+289

No files matched your search

+29
View File
@@ -212,6 +212,35 @@ removal in a playlist and reduced motion. Set `PLAYWRIGHT_MODULE` and
`CHROME_PATH` as for the other browser tests; `FURU_SCREENSHOT_DIR` chooses
where screenshots go (default `target/`).
`tests/browser-library-import-live.cjs` runs the same page against a real server
and its background worker:
```bash
# Fresh disposable instance; federation disabled, no Spotify client id.
FURU_DATABASE_URL=postgresql://postgres:postgres@127.0.0.1:55432/furumi_libimport_live \
FURU_AGENT_STORAGE_DIR=/tmp/furumi-libimport-storage FURU_FEDERATION_ENABLED=false \
target/release/furumusic -l 127.0.0.1:3020
FURU_TEST_STORAGE_DIR=/tmp/furumi-libimport-storage node tests/browser-library-import-live.cjs
```
Start the instance a second time once the first start has applied the
migrations: on an empty database the scheduler starts before them, and import
workers run only after a restart. The test creates the administrator, seeds
library tracks over `psql` in the disposable container `FURU_TEST_PG_CONTAINER`
(default `furumi-libimport-test-pg`, database `FURU_TEST_DATABASE`, default
`furumi_libimport_live`) and writes their audio files into
`FURU_TEST_STORAGE_DIR`, which must be the instance's absolute
`FURU_AGENT_STORAGE_DIR`. `FURU_TEST_URL` defaults to `http://127.0.0.1:3020`.
It builds a Spotify export ZIP with listening history, checks that only the
playlist files are sent, and waits for the worker: statistics, private playlists
with the matched tracks in source order and without repeats (in the API, the
sidebar and the player), filters for unmatched and unsupported entries, a
manual choice for a remaster found only as the original and published by the
next pass, the same export flagged as already imported, Retry unmatched
appending a track added to the library meanwhile, history deletion that keeps
the playlists, and the page at phone width without horizontal scrolling. Run it
only against a fresh disposable instance and drop its database afterwards.
`src/player/vendor/fflate-0.8.2.min.js` is `umd/index.js` of the npm package
`fflate@0.8.2` (MIT, `src/player/vendor/fflate-LICENSE`), served unchanged at
`/vendor/fflate-0.8.2.js` and loaded only when a user picks an archive.